source: common/libs/func_book_parser@ f60a8b7

2.4 ablfs-more legacy new_features trunk
Last change on this file since f60a8b7 was e576789, checked in by Pierre Labastie <pierre@…>, 11 years ago

Merge ablfs branch. Normally, jhalfs should not perform differently
for building LFS

  • Property mode set to 100644
File size: 7.2 KB
Line 
1#!/bin/bash
2
3# $Id$
4
5#----------------------------#
6get_book() { #
7#----------------------------#
8 cd $JHALFSDIR
9
10 if [ -z $WORKING_COPY ] ; then
11 # Check for Subversion instead of just letting the script hit 'svn' and fail.
12 test `type -p svn` || eval "echo \"This feature requires Subversion.\"
13 exit 1"
14 echo -n "Downloading the $PROGNAME document, $LFSVRS version... "
15
16 case $PROGNAME in
17 lfs) svn_root="LFS" ;;
18 hlfs) svn_root="HLFS" ;;
19 clfs*) svn_root="cross-lfs" ;;
20 *) echo "BOOK not defined in function <get_book>"
21 exit 1 ;;
22 esac
23 # Grab a fresh book if it's missing, otherwise, update it from the
24 # repo. If we've already extracted the commands, move on to getting the
25 # sources.
26 if [ $PROGNAME == "lfs" ] || [ $PROGNAME == "hlfs" ] && [ ! -d ${PROGNAME}-${LFSVRS}/.svn ]; then
27 svn co $SVN/${svn_root}/${TREE} ${PROGNAME}-$LFSVRS >>$LOGDIR/$LOG 2>&1
28 elif [ $PROGNAME == "clfs" ] || [ $PROGNAME == "clfs2" ] || [ $PROGNAME == "clfs3" ] && [ ! -d ${PROGNAME}-${LFSVRS}/.git ]; then
29 echo $TREE
30 git clone $GIT ${PROGNAME}-$LFSVRS >>$LOGDIR/$LOG 2>&1
31 if [ ! $TREE == "development" ]; then
32 cd ${PROGNAME}-$LFSVRS
33 echo "Checking out $LFSVRS at $PWD in $TREE"
34 git checkout ${TREE} >>$LOGDIR/$LOG 2>&1
35 fi
36 else
37 cd ${PROGNAME}-$LFSVRS
38 case $PROGNAME in
39 clfs*) git pull >>$LOGDIR/$LOG 2>&1
40 if [ ! $TREE == "development" ]; then
41 git checkout ${TREE} >>$LOGDIR/$LOG 2>&1
42 fi
43 ;;
44 lfs | hlfs) svn up >>$LOGDIR/$LOG 2>&1 ;;
45 *) ;;
46 esac
47 fi
48 echo -ne "done\n"
49
50 else
51 echo -ne "Using $BOOK as book's sources ...\n"
52 fi
53}
54
55#----------------------------#
56extract_commands() { #
57#----------------------------#
58
59 # Check for libxslt instead of just letting the script hit 'xsltproc' and fail.
60 test `type -p xsltproc` || eval "echo \"This feature requires libxslt.\"
61 exit 1"
62
63 cd $JHALFSDIR
64 case $PROGNAME in
65 clfs*)
66 VERSION=$(xmllint --noent $BOOK/BOOK/prologue/$ARCH/bookinfo.xml 2>/dev/null | grep subtitle | sed -e 's/^.*ion //' -e 's/<\/.*//') ;;
67 *)
68 VERSION=$(xmllint --noent $BOOK/prologue/bookinfo.xml 2>/dev/null | grep subtitle | sed -e 's/^.*ion //' -e 's/<\/.*//') ;;
69 esac
70
71 # Start clean
72 if [ -d ${PROGNAME}-commands ]; then
73 rm -rf ${PROGNAME}-commands
74 mkdir -v ${PROGNAME}-commands
75 fi
76 echo -n "Extracting commands for"
77
78 # Dump the commands in shell script form from the HLFS book.
79 case ${PROGNAME} in
80 clfs)
81 echo -n " ${L_arrow}${BOLD}$ARCH${R_arrow} target architecture... "
82 xsltproc --nonet \
83 --xinclude \
84 --stringparam method $METHOD \
85 --stringparam testsuite $TEST \
86 --stringparam bomb-testsuite $BOMB_TEST \
87 --stringparam vim-lang $VIMLANG \
88 --stringparam timezone $TIMEZONE \
89 --stringparam page $PAGE \
90 --stringparam lang $LANG \
91 --stringparam sparc $SPARC64_PROC \
92 -o ./${PROGNAME}-commands/ $XSL $BOOK/BOOK/$ARCH-index.xml >>$LOGDIR/$LOG 2>&1
93 ;;
94
95 clfs2)
96 echo -n " ${L_arrow}${BOLD}$ARCH${R_arrow} target architecture... "
97 xsltproc --nonet \
98 --xinclude \
99 --stringparam vim-lang $VIMLANG \
100 --stringparam timezone $TIMEZONE \
101 --stringparam page $PAGE \
102 --stringparam lang $LANG \
103 -o ./${PROGNAME}-commands/ $XSL $BOOK/BOOK/$ARCH-index.xml >>$LOGDIR/$LOG 2>&1
104 ;;
105
106 clfs3)
107 echo -n " ${L_arrow}${BOLD}$ARCH${R_arrow} target architecture... "
108 xsltproc --nonet \
109 --xinclude \
110 --stringparam endian x$ENDIAN \
111 --stringparam timezone $TIMEZONE \
112 --stringparam page $PAGE \
113 --stringparam lang $LANG \
114 -o ./${PROGNAME}-commands/ $XSL $BOOK/BOOK/$ARCH-index.xml >>$LOGDIR/$LOG 2>&1
115 ;;
116
117 hlfs)
118 echo -n " ${L_arrow}${BOLD}$MODEL + $KERNEL${R_arrow} HLFS flavour... "
119 xsltproc --nonet \
120 --xinclude \
121 --stringparam model $MODEL \
122 --stringparam kernel $KERNEL \
123 --stringparam testsuite $TEST \
124 --stringparam bomb-testsuite $BOMB_TEST \
125 --stringparam features x$SSP$ASLR$PAX$HARDENED_TMP$WARNINGS$MISC$BLOWFISH \
126 --stringparam timezone $TIMEZONE \
127 --stringparam page $PAGE \
128 --stringparam lang $LANG \
129 --stringparam grsecurity_host $GRSECURITY_HOST \
130 -o ./${PROGNAME}-commands/ $XSL $BOOK/index.xml >>$LOGDIR/$LOG 2>&1
131 ;;
132 lfs)
133 echo -n " ${L_arrow}${BOLD}LFS${R_arrow} build... "
134 pushd $BOOK > /dev/null
135 if [ -f process-scripts.sh ]; then
136 bash process-scripts.sh >> $LOGDIR/$LOG 2>&1
137 fi
138 popd > /dev/null
139 xsltproc --nonet \
140 --xinclude \
141 --stringparam testsuite $TEST \
142 --stringparam bomb-testsuite $BOMB_TEST \
143 --stringparam vim-lang $VIMLANG \
144 --stringparam full-locale $FULL_LOCALE \
145 --stringparam timezone $TIMEZONE \
146 --stringparam page $PAGE \
147 --stringparam lang $LANG \
148 --stringparam pkgmngt $PKGMNGT \
149 -o ./${PROGNAME}-commands/ $XSL $BOOK/index.xml >>$LOGDIR/$LOG 2>&1
150 ;;
151 *) echo -n " ${L_arrow}${BOLD}${PROGNAME}${R_arrow} book invalid, terminate build... "
152 exit 1 ;;
153 esac
154
155 echo "done"
156
157 # Make the scripts executable.
158 chmod -R +x $JHALFSDIR/${PROGNAME}-commands
159
160 # Create the packages file. We need it for proper Makefile creation
161 create_package_list
162
163 # Done. Moving on...
164 get_sources
165
166}
167
168#----------------------------#
169create_package_list() { #
170#----------------------------#
171
172 # Create the packages file. We need it for proper Makefile creation
173 rm -f pkg_tarball_list
174 echo -n "Creating <${PROGNAME}> list of tarball names for $BOOK"
175 if [ ! -z $ARCH ] ; then echo -n " $ARCH" ; fi
176 echo -n "... "
177 case ${PROGNAME} in
178 clfs*)
179 xsltproc --nonet --xinclude -o pkg_tarball_list packages.xsl \
180 $BOOK/BOOK/materials/${ARCH}-chapter.xml >>$LOGDIR/$LOG 2>&1
181 ;;
182 hlfs)
183 xsltproc --nonet --xinclude \
184 --stringparam model $MODEL \
185 --stringparam kernel $KERNEL \
186 -o pkg_tarball_list packages.xsl \
187 $BOOK/chapter04/chapter04.xml >>$LOGDIR/$LOG 2>&1
188 ;;
189 lfs)
190 xsltproc --nonet --xinclude \
191 --stringparam pkgmngt $PKGMNGT \
192 -o pkg_tarball_list packages.xsl \
193 $BOOK/chapter03/chapter03.xml >>$LOGDIR/$LOG 2>&1
194 ;;
195 *)
196 esac
197
198 if [[ "${BLFS_TOOL}" = "y" ]] ; then
199(
200cat << EOF
201$LIBXML_PKG
202$LIBXSLT_PKG
203$TIDY_PKG
204$UNZIP_PKG
205$DBXML_PKG
206$DBXSL_PKG
207$LYNX_PKG
208$SUDO_PKG
209$WGET_PKG
210$SQLITE_PKG
211$APR_PKG
212$APR_U_PKG
213$SVN_PKG
214$GPM_PKG
215EOF
216) >> pkg_tarball_list
217 fi
218
219 echo "done"
220
221}
222
Note: See TracBrowser for help on using the repository browser.