1 | #!/bin/bash
|
---|
2 | # $Id$
|
---|
3 | set -e
|
---|
4 |
|
---|
5 | # VT100 colors
|
---|
6 | declare -r BLACK=$'\e[1;30m'
|
---|
7 | declare -r DK_GRAY=$'\e[0;30m'
|
---|
8 |
|
---|
9 | declare -r RED=$'\e[31m'
|
---|
10 | declare -r GREEN=$'\e[32m'
|
---|
11 | declare -r YELLOW=$'\e[33m'
|
---|
12 | declare -r BLUE=$'\e[34m'
|
---|
13 | declare -r MAGENTA=$'\e[35m'
|
---|
14 | declare -r CYAN=$'\e[36m'
|
---|
15 | declare -r WHITE=$'\e[37m'
|
---|
16 |
|
---|
17 | declare -r OFF=$'\e[0m'
|
---|
18 | declare -r BOLD=$'\e[1m'
|
---|
19 | declare -r REVERSE=$'\e[7m'
|
---|
20 | declare -r HIDDEN=$'\e[8m'
|
---|
21 |
|
---|
22 | declare -r tab_=$'\t'
|
---|
23 | declare -r nl_=$'\n'
|
---|
24 |
|
---|
25 | declare -r DD_BORDER="${BOLD}==============================================================================${OFF}"
|
---|
26 | declare -r SD_BORDER="${BOLD}------------------------------------------------------------------------------${OFF}"
|
---|
27 | declare -r STAR_BORDER="${BOLD}******************************************************************************${OFF}"
|
---|
28 |
|
---|
29 | # bold yellow > < pair
|
---|
30 | declare -r R_arrow=$'\e[1;33m>\e[0m'
|
---|
31 | declare -r L_arrow=$'\e[1;33m<\e[0m'
|
---|
32 |
|
---|
33 |
|
---|
34 | #>>>>>>>>>>>>>>>ERROR TRAPPING >>>>>>>>>>>>>>>>>>>>
|
---|
35 | #-----------------------#
|
---|
36 | simple_error() { # Basic error trap.... JUST DIE
|
---|
37 | #-----------------------#
|
---|
38 | # If +e then disable text output
|
---|
39 | if [[ "$-" =~ e ]]; then
|
---|
40 | echo -e "\n${RED}ERROR:${GREEN} basic error trapped!${OFF}\n" >&2
|
---|
41 | fi
|
---|
42 | }
|
---|
43 |
|
---|
44 | see_ya() {
|
---|
45 | echo -e "\n${L_arrow}${BOLD}jhalfs-trunk${R_arrow} exit${OFF}\n"
|
---|
46 | }
|
---|
47 | ##### Simple error TRAPS
|
---|
48 | # ctrl-c SIGINT
|
---|
49 | # ctrl-y
|
---|
50 | # ctrl-z SIGTSTP
|
---|
51 | # SIGHUP 1 HANGUP
|
---|
52 | # SIGINT 2 INTRERRUPT FROM KEYBOARD Ctrl-C
|
---|
53 | # SIGQUIT 3
|
---|
54 | # SIGKILL 9 KILL
|
---|
55 | # SIGTERM 15 TERMINATION
|
---|
56 | # SIGSTOP 17,18,23 STOP THE PROCESS
|
---|
57 | #####
|
---|
58 | set -e
|
---|
59 | trap see_ya 0
|
---|
60 | trap simple_error ERR
|
---|
61 | trap 'echo -e "\n\n${RED}INTERRUPT${OFF} trapped\n" && exit 2' 1 2 3 15 17 18 23
|
---|
62 | #>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
|
---|
63 |
|
---|
64 | version="
|
---|
65 | ${BOLD} \"jhalfs-trunk\"${OFF} builder tool (development) \$Rev$
|
---|
66 | \$Date$
|
---|
67 |
|
---|
68 | Written by George Boudreau and Manuel Canales Esparcia,
|
---|
69 | plus several contributions.
|
---|
70 |
|
---|
71 | Based on an idea from Jeremy Huntwork
|
---|
72 |
|
---|
73 | This set of files are published under the
|
---|
74 | ${BOLD}Gnu General Public License, Version 2.${OFF}
|
---|
75 | "
|
---|
76 |
|
---|
77 | case $1 in
|
---|
78 | -v ) echo "$version" && exit 1 ;;
|
---|
79 | run ) : ;;
|
---|
80 | * )
|
---|
81 | echo "${nl_}${tab_}${BOLD}${RED}This script cannot be called directly: EXITING ${OFF}${nl_}"
|
---|
82 | exit 1
|
---|
83 | ;;
|
---|
84 | esac
|
---|
85 |
|
---|
86 | VERBOSITY=1
|
---|
87 |
|
---|
88 | [[ $VERBOSITY > 0 ]] && echo -n "Loading config params from <configuration>..."
|
---|
89 | source configuration
|
---|
90 | [[ $? > 0 ]] && echo "file: configuration did not load.." && exit 1
|
---|
91 | [[ $VERBOSITY > 0 ]] && echo "OK"
|
---|
92 |
|
---|
93 | # These are boolean vars generated from Config.in.
|
---|
94 | # ISSUE: If a boolean parameter is not set to y(es) there
|
---|
95 | # is no variable defined by the menu app. This can
|
---|
96 | # cause a headache if you are not aware.
|
---|
97 | # The following variables MUST exist. If they don't, the
|
---|
98 | # default value is n(o).
|
---|
99 | RUNMAKE=${RUNMAKE:-n}
|
---|
100 | GETPKG=${GETPKG:-n}
|
---|
101 | GETKERNEL=${GETKERNEL:-n}
|
---|
102 | COMPARE=${COMPARE:-n}
|
---|
103 | RUN_FARCE=${RUN_FARCE:-n}
|
---|
104 | RUN_ICA=${RUN_ICA:-n}
|
---|
105 | PKGMNGT=${PKGMNGT:-n}
|
---|
106 | BOMB_TEST=${BOMB_TEST:-n}
|
---|
107 | STRIP=${STRIP:=n}
|
---|
108 | REPORT=${REPORT:=n}
|
---|
109 | VIMLANG=${VIMLANG:-n}
|
---|
110 | FULL_LOCALE=${FULL_LOCALE:-n}
|
---|
111 | GRSECURITY_HOST=${GRSECURITY_HOST:-n}
|
---|
112 | CUSTOM_TOOLS=${CUSTOM_TOOLS:-n}
|
---|
113 | REBUILD_MAKEFILE=${REBUILD_MAKEFILE:-n}
|
---|
114 | INSTALL_LOG=${INSTALL_LOG:-n}
|
---|
115 | CLEAN=${CLEAN:=n}
|
---|
116 | SET_SSP=${SET_SSP:=n}
|
---|
117 | SET_ASLR=${SET_ASLR:=n}
|
---|
118 | SET_PAX=${SET_PAX:=n}
|
---|
119 | SET_HARDENED_TMP=${SET_HARDENED_TMP:=n}
|
---|
120 | SET_WARNINGS=${SET_WARNINGS:=n}
|
---|
121 | SET_MISC=${SET_MISC:=n}
|
---|
122 | SET_BLOWFISH=${SET_BLOWFISH:=n}
|
---|
123 |
|
---|
124 | if [[ "${NO_PROGRESS_BAR}" = "y" ]] ; then
|
---|
125 | NO_PROGRESS="#"
|
---|
126 | fi
|
---|
127 |
|
---|
128 |
|
---|
129 | # Sanity check on the location of $BUILDDIR / $JHALFSDIR
|
---|
130 | CWD=$(cd `dirname $0` && pwd)
|
---|
131 | if [[ $JHALFSDIR == $CWD ]]; then
|
---|
132 | echo " The jhalfs source directory conflicts with the jhalfs build directory."
|
---|
133 | echo " Please move the source directory or change the build directory."
|
---|
134 | exit 2
|
---|
135 | fi
|
---|
136 |
|
---|
137 | # Book sources envars
|
---|
138 | BRANCH_ID=${BRANCH_ID:=development}
|
---|
139 |
|
---|
140 | case $BRANCH_ID in
|
---|
141 | development )
|
---|
142 | case $PROGNAME in
|
---|
143 | clfs2 ) TREE=branches/clfs-sysroot/BOOK ;;
|
---|
144 | clfs3 ) TREE=branches/clfs-embedded/BOOK ;;
|
---|
145 | *) TREE=trunk/BOOK ;;
|
---|
146 | esac
|
---|
147 | LFSVRS=development
|
---|
148 | ;;
|
---|
149 | *EDIT* ) echo " You forgot to set the branch or stable book version."
|
---|
150 | echo " Please rerun make and fix the configuration."
|
---|
151 | exit 2 ;;
|
---|
152 | branch-* )
|
---|
153 | LFSVRS=${BRANCH_ID}
|
---|
154 | TREE=branches/${BRANCH_ID#branch-}/BOOK
|
---|
155 | ;;
|
---|
156 | * )
|
---|
157 | case $PROGNAME in
|
---|
158 | lfs | hlfs )
|
---|
159 | LFSVRS=${BRANCH_ID}
|
---|
160 | TREE=tags/${BRANCH_ID}/BOOK
|
---|
161 | ;;
|
---|
162 | clfs | clfs2 | clfs3)
|
---|
163 | LFSVRS=${BRANCH_ID}
|
---|
164 | TREE=tags/${BRANCH_ID}
|
---|
165 | ;;
|
---|
166 | esac
|
---|
167 | ;;
|
---|
168 | esac
|
---|
169 |
|
---|
170 | # Set the document location...
|
---|
171 | BOOK=${BOOK:=$PROGNAME-$LFSVRS}
|
---|
172 |
|
---|
173 | # blfs-tool envars
|
---|
174 | BLFS_TOOL=${BLFS_TOOL:-n}
|
---|
175 | if [[ "${BLFS_TOOL}" = "y" ]] ; then
|
---|
176 | BLFS_BRANCH_ID=${BLFS_BRANCH_ID:=development}
|
---|
177 | case $BLFS_BRANCH_ID in
|
---|
178 | development ) BLFS_TREE=trunk/BOOK ;;
|
---|
179 | *EDIT* ) echo " You forgot to set the BLFS branch or stable book version."
|
---|
180 | echo " Please rerun make and fix the configuration."
|
---|
181 | exit 2 ;;
|
---|
182 | branch-* ) BLFS_TREE=branches/${BLFS_BRANCH_ID#branch-} ;;
|
---|
183 | * ) BLFS_TREE=tags/${BLFS_BRANCH_ID} ;;
|
---|
184 | esac
|
---|
185 | # Dependencies envars, easier to update.
|
---|
186 | # Tidy and Unzip version are harcoded also in wrt_blfs_tool_targets()
|
---|
187 | # libxml2
|
---|
188 | LIBXML_PKG="libxml2-2.7.8.tar.gz"
|
---|
189 | LIBXML_URL="ftp://xmlsoft.org/libxml2/${LIBXML_PKG}"
|
---|
190 | LIBXML_MD5="8127a65e8c3b08856093099b52599c86"
|
---|
191 | # libxslt
|
---|
192 | LIBXSLT_PKG="libxslt-1.1.26.tar.gz"
|
---|
193 | LIBXSLT_URL="ftp://xmlsoft.org/libxslt/${LIBXSLT_PKG}"
|
---|
194 | LIBXSLT_MD5="e61d0364a30146aaa3001296f853b2b9"
|
---|
195 | # tidy
|
---|
196 | TIDY_PKG="tidy-cvs_20101110.tar.bz2"
|
---|
197 | TIDY_URL="http://anduin.linuxfromscratch.org/sources/BLFS/svn/t/${TIDY_PKG}"
|
---|
198 | TIDY_MD5="dd1fe109b4259ad3f364b175787ad5e9"
|
---|
199 | # unzip
|
---|
200 | UNZIP_PKG="unzip60.tar.gz"
|
---|
201 | UNZIP_URL="http://downloads.sourceforge.net/infozip/${UNZIP_PKG}"
|
---|
202 | UNZIP_MD5="62b490407489521db863b523a7f86375"
|
---|
203 | # DocBook XML DTD
|
---|
204 | DBXML_PKG="docbook-xml-4.5.zip"
|
---|
205 | DBXML_URL="http://www.docbook.org/xml/4.5/${DBXML_PKG}"
|
---|
206 | DBXML_MD5="03083e288e87a7e829e437358da7ef9e"
|
---|
207 | # DocBook XSL
|
---|
208 | # DBXSL_PKG="docbook-xsl-1.69.1.tar.bz2"
|
---|
209 | # DBXSL_URL="http://prdownloads.sourceforge.net/docbook/${DBXSL_PKG}"
|
---|
210 | # DBXSL_MD5="6ebd29a67f2dcc3f2220f475ee6f6552"
|
---|
211 | # Lynx
|
---|
212 | LYNX_PKG="lynx2.8.7rel.2.tar.bz2"
|
---|
213 | LYNX_URL="http://lynx.isc.org/current/${LYNX_PKG}"
|
---|
214 | LYNX_MD5="cb936aef812e4e463ab86cbbe14d4db9"
|
---|
215 | # sudo
|
---|
216 | SUDO_PKG="sudo-1.8.2.tar.gz"
|
---|
217 | SUDO_URL="http://www.sudo.ws/sudo/dist/${SUDO_PKG}"
|
---|
218 | SUDO_MD5="000f458e7391be9fdf459a9ad6a4912a"
|
---|
219 | # wget
|
---|
220 | WGET_PKG="wget-1.13.4.tar.xz"
|
---|
221 | WGET_URL="ftp://ftp.gnu.org/gnu/wget/${WGET_PKG}"
|
---|
222 | WGET_MD5="7f518b3a71e9efd330e9a0c3714f8463"
|
---|
223 | # SQLite (for subversion)
|
---|
224 | SQLITE_PKG="sqlite-autoconf-3070800.tar.gz"
|
---|
225 | SQLITE_URL="http://sqlite.org/${SQLITE_PKG}"
|
---|
226 | SQLITE_MD5="6bfb46d73caaa1bbbcd2b52184b6c542"
|
---|
227 | # Apache Portable Runtime (for subversion)
|
---|
228 | APR_PKG="apr-1.4.5.tar.bz2"
|
---|
229 | APR_URL="http://mirror.speednetwork.de/apache/apr/$APR_PKG"
|
---|
230 | APR_MD5="8b53f5a5669d0597f2da889a2f576eb6"
|
---|
231 | # APR config patch
|
---|
232 | APR_PATCH_1="apr-1.4.5-config.patch"
|
---|
233 | APR_PATCH_1_URL="file:///sources/local-patches/${APR_PATCH_1}"
|
---|
234 | APR_PATCH_1_MD5="fff6eddf998f4e956915f8053c15e41e"
|
---|
235 | # Apache Portable Runtime Utilities (for subversion)
|
---|
236 | APR_U_PKG="apr-util-1.4.1.tar.bz2"
|
---|
237 | APR_U_URL="http://mirrors.ircam.fr/pub/apache/apr/$APR_U_PKG"
|
---|
238 | APR_U_MD5="52b31b33fb1aa16e65ddaefc76e41151"
|
---|
239 | # APR-util config patch
|
---|
240 | APR_U_PATCH_1="apr-util-1.4.1-config.patch"
|
---|
241 | APR_U_PATCH_1_URL="file:///sources/local-patches/${APR_U_PATCH_1}"
|
---|
242 | APR_U_PATCH_1_MD5="4c07cb0d298ae9ddc75cd2d5acdedb2b"
|
---|
243 | # Subversion
|
---|
244 | SVN_PKG="subversion-1.7.1.tar.bz2"
|
---|
245 | SVN_URL="http://archive.apache.org/dist/subversion/${SVN_PKG}"
|
---|
246 | SVN_MD5="8a4fa74385df85a9702141b6b68b8307"
|
---|
247 | # GPM
|
---|
248 | GPM_PKG="gpm-1.20.6.tar.bz2"
|
---|
249 | GPM_URL="http://www.nico.schottelius.org/software/gpm/archives/$GPM_PKG"
|
---|
250 | GPM_MD5="6b534da16dc1b28ba828dea89e520f6f"
|
---|
251 | fi
|
---|
252 |
|
---|
253 | #--- Envars not sourced from configuration
|
---|
254 | case $PROGNAME in
|
---|
255 | # TODO: clfs is now on git
|
---|
256 | # clfs* ) declare -r SVN="http://svn.cross-lfs.org/svn/repos" ;;
|
---|
257 | * ) declare -r SVN="svn://svn.linuxfromscratch.org" ;;
|
---|
258 | esac
|
---|
259 | declare -r LOG=000-masterscript.log
|
---|
260 | # Needed for fetching BLFS book sources when building CLFS
|
---|
261 | declare -r SVN_2="svn://svn.linuxfromscratch.org"
|
---|
262 |
|
---|
263 | # Set true internal variables
|
---|
264 | COMMON_DIR="common"
|
---|
265 | PACKAGE_DIR=$(echo $PROGNAME | tr '[a-z]' '[A-Z]')
|
---|
266 | MODULE=$PACKAGE_DIR/master.sh
|
---|
267 | PKGMNGTDIR="pkgmngt"
|
---|
268 | # The name packageManager.xml is hardcoded in *.xsl, so no variable.
|
---|
269 |
|
---|
270 | [[ $VERBOSITY > 0 ]] && echo -n "Loading common-functions module..."
|
---|
271 | source $COMMON_DIR/common-functions
|
---|
272 | [[ $? > 0 ]] && echo " $COMMON_DIR/common-functions did not load.." && exit
|
---|
273 | [[ $VERBOSITY > 0 ]] && echo "OK"
|
---|
274 | [[ $VERBOSITY > 0 ]] && echo -n "Loading code module <$MODULE>..."
|
---|
275 | source $MODULE
|
---|
276 | [[ $? > 0 ]] && echo "$MODULE did not load.." && exit 2
|
---|
277 | [[ $VERBOSITY > 0 ]] && echo "OK"
|
---|
278 | #
|
---|
279 | [[ $VERBOSITY > 0 ]] && echo "${SD_BORDER}${nl_}"
|
---|
280 |
|
---|
281 |
|
---|
282 | #*******************************************************************#
|
---|
283 | [[ $VERBOSITY > 0 ]] && echo -n "Loading function <func_check_version.sh>..."
|
---|
284 | source $COMMON_DIR/libs/func_check_version.sh
|
---|
285 | [[ $? > 0 ]] && echo " function module did not load.." && exit 2
|
---|
286 | [[ $VERBOSITY > 0 ]] && echo "OK"
|
---|
287 |
|
---|
288 | [[ $VERBOSITY > 0 ]] && echo -n "Loading function <func_validate_configs.sh>..."
|
---|
289 | source $COMMON_DIR/libs/func_validate_configs.sh
|
---|
290 | [[ $? > 0 ]] && echo " function module did not load.." && exit 2
|
---|
291 | [[ $VERBOSITY > 0 ]] && echo "OK"
|
---|
292 |
|
---|
293 | [[ $VERBOSITY > 0 ]] && echo -n "Loading function <func_custom_pkgs>..."
|
---|
294 | source $COMMON_DIR/libs/func_custom_pkgs
|
---|
295 | [[ $? > 0 ]] && echo " function module did not load.." && exit 2
|
---|
296 | [[ $VERBOSITY > 0 ]] && echo "OK"
|
---|
297 |
|
---|
298 |
|
---|
299 | [[ $VERBOSITY > 0 ]] && echo "${SD_BORDER}${nl_}"
|
---|
300 |
|
---|
301 |
|
---|
302 | ###################################
|
---|
303 | ### MAIN ###
|
---|
304 | ###################################
|
---|
305 |
|
---|
306 | # Check for build prerequisites.
|
---|
307 | echo
|
---|
308 | check_prerequisites
|
---|
309 | echo "${SD_BORDER}${nl_}"
|
---|
310 |
|
---|
311 | validate_config
|
---|
312 | echo "${SD_BORDER}${nl_}"
|
---|
313 | echo -n "Are you happy with these settings? yes/no (no): "
|
---|
314 | read ANSWER
|
---|
315 | if [ x$ANSWER != "xyes" ] ; then
|
---|
316 | echo "${nl_}Rerun make to fix the configuration options.${nl_}"
|
---|
317 | exit 1
|
---|
318 | fi
|
---|
319 | echo "${nl_}${SD_BORDER}${nl_}"
|
---|
320 |
|
---|
321 | # Load additional modules or configuration files based on global settings
|
---|
322 | # compare module
|
---|
323 | if [[ "$COMPARE" = "y" ]]; then
|
---|
324 | [[ $VERBOSITY > 0 ]] && echo -n "Loading compare module..."
|
---|
325 | source $COMMON_DIR/libs/func_compare.sh
|
---|
326 | [[ $? > 0 ]] && echo "$COMMON_DIR/libs/func_compare.sh did not load.." && exit
|
---|
327 | [[ $VERBOSITY > 0 ]] && echo "OK"
|
---|
328 | fi
|
---|
329 | #
|
---|
330 | # optimize module
|
---|
331 | if [[ "$OPTIMIZE" != "0" ]]; then
|
---|
332 | [[ $VERBOSITY > 0 ]] && echo -n "Loading optimization module..."
|
---|
333 | source optimize/optimize_functions
|
---|
334 | [[ $? > 0 ]] && echo " optimize/optimize_functions did not load.." && exit
|
---|
335 | [[ $VERBOSITY > 0 ]] && echo "OK"
|
---|
336 | #
|
---|
337 | # optimize configurations
|
---|
338 | [[ $VERBOSITY > 0 ]] && echo -n "Loading optimization config..."
|
---|
339 | source optimize/opt_config
|
---|
340 | [[ $? > 0 ]] && echo " optimize/opt_config did not load.." && exit
|
---|
341 | [[ $VERBOSITY > 0 ]] && echo "OK"
|
---|
342 | # Validate optimize settings, if required
|
---|
343 | validate_opt_settings
|
---|
344 | fi
|
---|
345 | #
|
---|
346 |
|
---|
347 | if [[ "$REBUILD_MAKEFILE" = "n" ]] ; then
|
---|
348 |
|
---|
349 | # If $BUILDDIR has subdirectories like tools/ or bin/, stop the run
|
---|
350 | # and notify the user about that.
|
---|
351 | if [ -d $BUILDDIR/tools -o -d $BUILDDIR/bin ] && [ -z $CLEAN ] ; then
|
---|
352 | eval "$no_empty_builddir"
|
---|
353 | fi
|
---|
354 |
|
---|
355 | # If requested, clean the build directory
|
---|
356 | clean_builddir
|
---|
357 |
|
---|
358 | if [[ ! -d $JHALFSDIR ]]; then
|
---|
359 | mkdir -p $JHALFSDIR
|
---|
360 | fi
|
---|
361 |
|
---|
362 | # Create $BUILDDIR/sources even though it could be created by get_sources()
|
---|
363 | if [[ ! -d $BUILDDIR/sources ]]; then
|
---|
364 | mkdir -p $BUILDDIR/sources
|
---|
365 | fi
|
---|
366 | #
|
---|
367 | # Create the log directory
|
---|
368 | if [[ ! -d $LOGDIR ]]; then
|
---|
369 | mkdir $LOGDIR
|
---|
370 | fi
|
---|
371 | >$LOGDIR/$LOG
|
---|
372 | #
|
---|
373 | # Copy common helper files
|
---|
374 | cp $COMMON_DIR/{makefile-functions,progress_bar.sh,packages.xsl} $JHALFSDIR/
|
---|
375 | #
|
---|
376 | # Fix the XSL book parser
|
---|
377 | sed 's,FAKEDIR,'$BOOK',' $PACKAGE_DIR/$XSL > $JHALFSDIR/${XSL}
|
---|
378 | export XSL=$JHALFSDIR/${XSL}
|
---|
379 | #
|
---|
380 |
|
---|
381 | # Copy packageManager.xml, if needed
|
---|
382 | [[ "$PKGMNGT" = "y" ]] && [[ "$PROGNAME" = "lfs" ]] &&
|
---|
383 | cp $PKGMNGTDIR/packageManager.xml $JHALFSDIR/ &&
|
---|
384 | cp $PKGMNGTDIR/packInstall.sh $JHALFSDIR/
|
---|
385 | #
|
---|
386 | # Copy urls.xsl, if needed
|
---|
387 | [[ "$GETPKG" = "y" ]] && cp $COMMON_DIR/urls.xsl $JHALFSDIR/
|
---|
388 | #
|
---|
389 | # Copy APR patches, if needed
|
---|
390 | [[ "$DEP_SVN" = "y" ]] &&
|
---|
391 | cp $COMMON_DIR/blfs-tool-deps/apr*.patch $BUILDDIR/sources
|
---|
392 | #
|
---|
393 | # Create the test-log directory, if needed
|
---|
394 | [[ "$TEST" != "0" ]] && [[ ! -d $TESTLOGDIR ]] && install -d -m 1777 $TESTLOGDIR
|
---|
395 | #
|
---|
396 | # Create the installed-files directory, if needed
|
---|
397 | [[ "$INSTALL_LOG" = "y" ]] && [[ ! -d $FILELOGDIR ]] && install -d -m 1777 $FILELOGDIR
|
---|
398 | #
|
---|
399 | # Prepare report creation, if needed
|
---|
400 | if [[ "$REPORT" = "y" ]]; then
|
---|
401 | cp $COMMON_DIR/create-sbu_du-report.sh $JHALFSDIR/
|
---|
402 | # After making sure that all looks sane, dump the settings to a file
|
---|
403 | # This file will be used to create the REPORT header
|
---|
404 | validate_config > $JHALFSDIR/jhalfs.config
|
---|
405 | fi
|
---|
406 | #
|
---|
407 | # Copy optimize files, if needed
|
---|
408 | [[ "$OPTIMIZE" != "0" ]] && cp optimize/opt_override $JHALFSDIR/
|
---|
409 | #
|
---|
410 | # Copy compare files, if needed
|
---|
411 | if [[ "$COMPARE" = "y" ]]; then
|
---|
412 | mkdir -p $JHALFSDIR/extras
|
---|
413 | cp extras/* $JHALFSDIR/extras
|
---|
414 | fi
|
---|
415 | #
|
---|
416 |
|
---|
417 | # Copy custom tools config files, if requested
|
---|
418 | if [[ "${CUSTOM_TOOLS}" = "y" ]]; then
|
---|
419 | echo "Copying custom tool scripts to $JHALFSDIR"
|
---|
420 | mkdir -p $JHALFSDIR/custom-commands
|
---|
421 | cp -f custom/config/* $JHALFSDIR/custom-commands
|
---|
422 | fi
|
---|
423 | #
|
---|
424 | # Install blfs-tool, if requested.
|
---|
425 | if [[ "${BLFS_TOOL}" = "y" ]] ; then
|
---|
426 | # Install the files
|
---|
427 | [[ ! -d ${BUILDDIR}${BLFS_ROOT} ]] && mkdir -p ${BUILDDIR}${BLFS_ROOT}
|
---|
428 | cp -r BLFS/* ${BUILDDIR}${BLFS_ROOT}
|
---|
429 | cp -r menu ${BUILDDIR}${BLFS_ROOT}
|
---|
430 | cp $COMMON_DIR/progress_bar.sh ${BUILDDIR}${BLFS_ROOT}
|
---|
431 | cp README.BLFS ${BUILDDIR}${BLFS_ROOT}
|
---|
432 | # Clean-up
|
---|
433 | rm -rf ${BUILDDIR}${BLFS_ROOT}/libs/.svn
|
---|
434 | rm -rf ${BUILDDIR}${BLFS_ROOT}/menu/.svn
|
---|
435 | rm -rf ${BUILDDIR}${BLFS_ROOT}/menu/lxdialog/.svn
|
---|
436 | # Set some harcoded envars to their proper values
|
---|
437 | sed -i 's,blfs-xml,'$BLFS_XML',' ${BUILDDIR}${BLFS_ROOT}/{update_book.sh,libs/book.xsl}
|
---|
438 | sed -i 's,tracking-dir,'$TRACKING_DIR',' ${BUILDDIR}${BLFS_ROOT}/{update_book.sh,gen-makefile.sh}
|
---|
439 | # Copy the dependencies build scripts
|
---|
440 | cp -r $COMMON_DIR/blfs-tool-deps $JHALFSDIR/
|
---|
441 | rm -rf $JHALFSDIR/blfs-tool-deps/.svn
|
---|
442 | fi
|
---|
443 | #
|
---|
444 |
|
---|
445 | get_book
|
---|
446 | echo "${SD_BORDER}${nl_}"
|
---|
447 |
|
---|
448 | # Get the BLFS book, if requested.
|
---|
449 | if [[ "${BLFS_TOOL}" = "y" ]] ; then
|
---|
450 | echo -n "Downloading the BLFS document, $BLFS_BRANCH_ID version... "
|
---|
451 | if [[ ! -d ${BUILDDIR}${BLFS_ROOT}/${BLFS_XML} ]] ; then
|
---|
452 | mkdir -p ${BUILDDIR}${BLFS_ROOT}/${BLFS_XML}
|
---|
453 | svn co $SVN_2/BLFS/$BLFS_TREE ${BUILDDIR}${BLFS_ROOT}/${BLFS_XML} >>$LOGDIR/$LOG 2>&1
|
---|
454 | else
|
---|
455 | pushd ${BUILDDIR}${BLFS_ROOT}/${BLFS_XML} 1> /dev/null
|
---|
456 | svn up >>$LOGDIR/$LOG 2>&1
|
---|
457 | popd 1> /dev/null
|
---|
458 | fi
|
---|
459 | echo -ne "done\n"
|
---|
460 | echo "${SD_BORDER}${nl_}"
|
---|
461 | fi
|
---|
462 |
|
---|
463 | fi
|
---|
464 |
|
---|
465 | # When regenerating the Makefile, we need to know also the canonical book version
|
---|
466 | if [[ "$REBUILD_MAKEFILE" = "y" ]] ; then
|
---|
467 | case $PROGNAME in
|
---|
468 | clfs | clfs2 | clfs3 )
|
---|
469 | VERSION=$(xmllint --noent $JHALFSDIR/$BOOK/prologue/$ARCH/bookinfo.xml 2>/dev/null | grep subtitle | sed -e 's/^.*ion //' -e 's/<\/.*//') ;;
|
---|
470 | *)
|
---|
471 | VERSION=$(xmllint --noent $JHALFSDIR/$BOOK/prologue/bookinfo.xml 2>/dev/null | grep subtitle | sed -e 's/^.*ion //' -e 's/<\/.*//') ;;
|
---|
472 | esac
|
---|
473 | fi
|
---|
474 |
|
---|
475 | build_Makefile
|
---|
476 |
|
---|
477 | echo "${SD_BORDER}${nl_}"
|
---|
478 |
|
---|
479 | run_make
|
---|