source: common/common-functions@ b179a81

experimental
Last change on this file since b179a81 was 50fb011, checked in by George Boudreau <georgeb@…>, 18 years ago

First commit of changes to makefile generation. Makefile now does recursive calls to itself for the different phases..SETUP,LUSER,CHROOT,ROOT

  • Property mode set to 100644
File size: 22.8 KB
Line 
1#!/bin/bash
2
3# $Id$
4
5set -e
6
7
8no_empty_builddir() {
9 'clear'
10cat <<- -EOF-
11${DD_BORDER}
12
13${tab_}${tab_}${BOLD}${RED}W A R N I N G${OFF}
14 Looks like the \$BUILDDIR directory contains subdirectories
15 from a previous HLFS build.
16
17 Please format the partition mounted on \$BUILDDIR or set
18 a different build directory before running jhalfs-X.
19${OFF}
20${DD_BORDER}
21-EOF-
22 exit
23}
24
25
26HEADER="# This file is automatically generated by jhalfs-X
27# DO NOT EDIT THIS FILE MANUALLY
28#
29# Generated on `date \"+%F %X %Z\"`"
30
31
32#------------------------------------------------------#
33# NEW Makefile scripting functions #
34#------------------------------------------------------#
35
36
37unset get_package_tarball_name
38#----------------------------------#
39get_package_tarball_name() { #
40#----------------------------------#
41 local script_name=$1
42
43 # The use of 'head' is necessary to limit the return value to the FIRST match..
44 # hopefully this will not cause problems.
45 #
46 case $script_name in
47 tcl) echo $(grep "^tcl" $JHALFSDIR/pkg_tarball_list | head -n1 ) ;;
48 linux-headers) echo $(grep "^linux-headers.*.bz2" $JHALFSDIR/pkg_tarball_list | head -n1 ) ;;
49 *) echo $(grep "^$script_name-[[:digit:]]" $JHALFSDIR/pkg_tarball_list | head -n1 ) ;;
50 esac
51
52}
53
54
55unset wrt_RunaAsRoot
56#----------------------------------#
57wrt_RunAsRoot() { # Some scripts must be run as root..
58#----------------------------------#
59 local ENV_MOUNT
60 local this_script=$1
61 local file=$2
62
63 case ${PROGNAME} in
64 lfs ) MOUNT_ENV="LFS" ;;
65 blfs ) MOUNT_ENV="BLFS" ;;
66 clfs ) MOUNT_ENV="CLFS" ;;
67 clfs2 ) MOUNT_ENV="CLFS" ;;
68 hlfs ) MOUNT_ENV="HLFS" ;;
69 *) echo "undefined progname $PROGNAME"; exit 1
70 esac
71
72(
73cat << EOF
74 @( time { export ${MOUNT_ENV}=\$(MOUNT_PT) && ${PROGNAME}-commands/`dirname $file`/\$@ >>logs/\$@ 2>&1 ; } ) 2>>logs/\$@ && \\
75 \$(PRT_DU_CR) >>logs/\$@
76EOF
77) >> $MKFILE.tmp
78}
79
80
81#----------------------------------#
82wrt_target_boot() { # Create target and initialize log file
83#----------------------------------#
84 local i=$1
85 local PREV=$2
86 case $i in
87 iteration* ) local LOGFILE="\$@.log" ;;
88 * ) local LOGFILE="\$@" ;;
89 esac
90(
91cat << EOF
92
93$i: $PREV
94 @\$(call echo_message, Building)
95 @./progress_bar.sh \$@ &
96 @echo -e "\n\`date\`\n\nKB: \`du -skx --exclude=${SCRIPT_ROOT}\`\n" >logs/$LOGFILE
97EOF
98) >> $MKFILE.tmp
99}
100
101
102#------------------------------------------------------#
103#------------------------------------------------------#
104
105
106#----------------------------------#
107LUSER_wrt_target() { # Create target and initialize log file
108#----------------------------------#
109 local i=$1
110 local PREV=$2
111(
112cat << EOF
113
114$i: $PREV
115 @\$(call echo_message, Building)
116 @./progress_bar.sh \$@ \$\$PPID &
117 @echo -e "\n\`date\`\n\nKB: \`du -skx --exclude=\$(SCRIPT_ROOT) \$(MOUNT_PT)\`\n" >logs/\$@
118EOF
119) >> $MKFILE.tmp
120}
121
122
123#----------------------------------#
124LUSER_wrt_RunAsUser() { # Execute script inside time { }, footer to log file
125#----------------------------------#
126 local file=$1
127
128(
129cat << EOF
130 @( time { source ~/.bashrc && \$(CMDSDIR)/`dirname $file`/\$@ >> logs/\$@ 2>&1; } ) 2>> logs/\$@ && \\
131 \$(PRT_DU) >> logs/\$@
132EOF
133) >> $MKFILE.tmp
134}
135
136
137#----------------------------------#
138LUSER_wrt_unpack() { # Unpack and set 'ROOT' var
139#----------------------------------#
140 local FILE=$1
141 local optSAVE_PREVIOUS=$2
142
143 if [[ "${optSAVE_PREVIOUS}" != "1" ]]; then
144(
145cat << EOF
146 @\$(call remove_existing_dirs,$FILE)
147EOF
148) >> $MKFILE.tmp
149 fi
150
151(
152cat << EOF
153 @\$(call unpack,$FILE)
154 @\$(call get_pkg_root_LUSER)
155EOF
156) >> $MKFILE.tmp
157
158}
159
160
161#----------------------------------#
162LUSER_wrt_CopyFstab() { #
163#----------------------------------#
164(
165cat << EOF
166 @( time { cp -v \$(MOUNT_PT)/sources/fstab \$(MOUNT_PT)/etc/fstab >>logs/\$@ 2>&1 ; } ) 2>>logs/\$@
167EOF
168) >> $MKFILE.tmp
169}
170
171
172#----------------------------------#
173LUSER_wrt_test_log() { # Initialize testsuite log file
174#----------------------------------#
175 local TESTLOGFILE=$1
176(
177cat << EOF
178 @echo "export TEST_LOG=$TESTLOGDIR/$TESTLOGFILE" >> envars && \\
179 echo -e '\n\`date\`\n' >$TESTLOGDIR/$TESTLOGFILE
180EOF
181) >> $MKFILE.tmp
182}
183
184
185#----------------------------------#
186LUSER_RemoveBuildDirs() { #
187#----------------------------------#
188 local name=$1
189(
190cat << EOF
191 @\$(call remove_build_dirs,$name)
192EOF
193) >> $MKFILE.tmp
194}
195
196#-----------------------------------------------------------------#
197#-----------------------------------------------------------------#
198
199#----------------------------------#
200CHROOT_wrt_target() { # Create target and initialize log file
201#----------------------------------#
202 local i=$1
203 local PREV=$2
204 case $i in
205 iteration* ) local LOGFILE="${this_script}.log" ;;
206 * ) local LOGFILE="${this_script}" ;;
207 esac
208(
209cat << EOF
210
211$i: $PREV
212 @\$(call echo_message, Building)
213 @./progress_bar.sh \$@ \$\$PPID &
214 @echo -e "\n\`date\`\n\nKB: \`du -skx --exclude=\$(SCRIPT_ROOT) / \`\n" >logs/$LOGFILE
215EOF
216) >> $MKFILE.tmp
217}
218
219
220#----------------------------------#
221CHROOT_Unpack() { #
222#----------------------------------#
223 local FILE=$1
224 local optSAVE_PREVIOUS=$2
225
226 if [ "${optSAVE_PREVIOUS}" != "1" ]; then
227(
228cat << EOF
229 @\$(call remove_existing_dirs2,$FILE)
230EOF
231) >> $MKFILE.tmp
232 fi
233(
234cat << EOF
235 @\$(call unpack3,$FILE)
236 @\$(call get_pkg_root2)
237EOF
238) >> $MKFILE.tmp
239}
240
241
242#----------------------------------#
243CHROOT_wrt_test_log() { #
244#----------------------------------#
245 local TESTLOGFILE=$1
246(
247cat << EOF
248 @echo "export TEST_LOG=/\$(SCRIPT_ROOT)/test-logs/$TESTLOGFILE" >> envars && \\
249 echo -e "\n\`date\`\n" >test-logs/$TESTLOGFILE
250EOF
251) >> $MKFILE.tmp
252}
253
254
255#----------------------------------#
256CHROOT_wrt_RunAsRoot() { #
257#----------------------------------#
258 local file=$1
259(
260cat << EOF
261 @( time { source envars && \$(crCMDSDIR)/$file >>logs/$this_script 2>&1 ; } ) 2>>logs/$this_script && \\
262 \$(PRT_DU_CR) >>logs/$this_script
263EOF
264) >> $MKFILE.tmp
265
266}
267
268
269#----------------------------------#
270CHROOT_wrt_CopyFstab() { #
271#----------------------------------#
272(
273cat << EOF
274 @( time { cp -v /sources/fstab /etc/fstab >>logs/${this_script} 2>&1 ; } ) 2>>logs/${this_script}
275EOF
276) >> $MKFILE.tmp
277}
278
279
280#----------------------------------#
281CHROOT_wrt_RemoveBuildDirs() { #
282#----------------------------------#
283 local name=$1
284(
285cat << EOF
286 @\$(call remove_build_dirs2,$name)
287EOF
288) >> $MKFILE.tmp
289}
290
291
292unset wrt_touch
293#----------------------------------#
294wrt_touch() { #
295#----------------------------------#
296(
297cat << EOF
298 @\$(call housekeeping)
299EOF
300) >> $MKFILE.tmp
301}
302
303#------------------------------------------------------#
304# END Makefile scripting functions #
305#------------------------------------------------------#
306
307
308
309#----------------------------#
310run_make() { #
311#----------------------------#
312 # Test if make must be run.
313 if [ "$RUNMAKE" = "y" ] ; then
314 # Test to make sure we're running the build as root
315 if [ "$UID" != "0" ] ; then
316 echo "You must be logged in as root to successfully build the system."
317 exit 1
318 fi
319 # Build the system
320 if [ -e $MKFILE ] ; then
321 echo -ne "Building the system...\n"
322 cd $JHALFSDIR && make
323 echo -ne "done\n"
324 fi
325 fi
326}
327
328
329#----------------------------#
330clean_builddir() { #
331#----------------------------#
332 # Test if the clean must be done.
333 if [ "${CLEAN}" = "y" ]; then
334 # Test to make sure we're running the clean as root
335 if [ "$UID" != "0" ] ; then
336 echo "You must be logged in as root to clean the build directory."
337 exit 1
338 fi
339 # Test to make sure that the build directory was populated by jhalfs
340 if [ ! -d $JHALFSDIR ] || [ ! -d $BUILDDIR/sources ] ; then
341 echo "Looks like $BUILDDIR was not populated by a previous jhalfs-X run."
342 exit 1
343 else
344 # Clean the build directory
345 echo -ne "Cleaning $BUILDDIR...\n"
346 rm -rf $BUILDDIR/{bin,boot,dev,etc,home,lib,media,mnt,opt,proc,root,sbin,srv,sys,tmp,tools,cross-tools,usr,var}
347 echo -ne "Cleaning $JHALFSDIR...\n"
348 rm -rf $JHALFSDIR/{0*,1*,envars,sources-dir,*commands,*logs,Makefile,*.xsl,makefile-functions,pkg_tarball_list,*.config,*.sh}
349 echo -ne "Cleaning remainig extracted sources in $BUILDDIR/sources...\n"
350 rm -rf `find $BUILDDIR/sources/* -maxdepth 0 -type d`
351 echo -ne "done\n"
352 fi
353 fi
354}
355
356#----------------------------#
357get_book() { #
358#----------------------------#
359 cd $JHALFSDIR
360
361 if [ -z $WORKING_COPY ] ; then
362 # Check for Subversion instead of just letting the script hit 'svn' and fail.
363 test `type -p svn` || eval "echo \"This feature requires Subversion.\"
364 exit 1"
365 echo -n "Downloading the $PROGNAME document, $LFSVRS version... "
366
367 case $PROGNAME in
368 lfs) svn_root="LFS" ;;
369 hlfs) svn_root="HLFS" ;;
370 clfs) svn_root="cross-lfs" ;;
371 clfs2) svn_root="cross-lfs" ;;
372 *) echo "BOOK not defined in function <get_book>"
373 exit 1 ;;
374 esac
375 # Grab a fresh book if it's missing, otherwise, update it from the
376 # repo. If we've already extracted the commands, move on to getting the
377 # sources.
378 if [ -d ${PROGNAME}-$LFSVRS ] ; then
379 cd ${PROGNAME}-$LFSVRS
380 if LC_ALL=C svn up | grep -q At && \
381 test -d $JHALFSDIR/${PROGNAME}-commands && \
382 test -f $JHALFSDIR/pkg_tarball_list ; then
383 # Set the canonical book version
384 echo -ne "done\n"
385 cd $JHALFSDIR
386 case $PROGNAME in
387 clfs | clfs2)
388 VERSION=$(xmllint --noent $BOOK/prologue/$ARCH/bookinfo.xml 2>/dev/null | grep subtitle | sed -e 's/^.*ion //' -e 's/<\/.*//') ;;
389 *)
390 VERSION=$(xmllint --noent $BOOK/prologue/bookinfo.xml 2>/dev/null | grep subtitle | sed -e 's/^.*ion //' -e 's/<\/.*//') ;;
391 esac
392 get_sources
393 else
394 echo -ne "done\n"
395 extract_commands
396 fi
397 else
398 svn co $SVN/${svn_root}/${TREE} ${PROGNAME}-$LFSVRS >>$LOGDIR/$LOG 2>&1
399 echo -ne "done\n"
400 extract_commands
401 fi
402
403 else
404 echo -ne "Using $BOOK as book's sources ...\n"
405 extract_commands
406 fi
407 echo -ne " Document version ${L_arrow}${BOLD}${VERSION}${R_arrow}\n"
408}
409
410#----------------------------#
411extract_commands() { #
412#----------------------------#
413
414 # Check for libxslt instead of just letting the script hit 'xsltproc' and fail.
415 test `type -p xsltproc` || eval "echo \"This feature requires libxslt.\"
416 exit 1"
417
418 cd $JHALFSDIR
419 case $PROGNAME in
420 clfs | clfs2 )
421 VERSION=$(xmllint --noent $BOOK/prologue/$ARCH/bookinfo.xml 2>/dev/null | grep subtitle | sed -e 's/^.*ion //' -e 's/<\/.*//') ;;
422 *)
423 VERSION=$(xmllint --noent $BOOK/prologue/bookinfo.xml 2>/dev/null | grep subtitle | sed -e 's/^.*ion //' -e 's/<\/.*//') ;;
424 esac
425
426 # Start clean
427 if [ -d ${PROGNAME}-commands ]; then
428 rm -rf ${PROGNAME}-commands
429 mkdir -v ${PROGNAME}-commands
430 fi
431 echo -n "Extracting commands for"
432
433 # Dump the commands in shell script form from the HLFS book.
434 case ${PROGNAME} in
435 clfs)
436 echo -n " ${L_arrow}${BOLD}$ARCH${R_arrow} target architecture"
437 xsltproc --nonet \
438 --xinclude \
439 --stringparam method $METHOD \
440 --stringparam testsuite $TEST \
441 --stringparam bomb-testsuite $BOMB_TEST \
442 --stringparam vim-lang $VIMLANG \
443 --stringparam timezone $TIMEZONE \
444 --stringparam page $PAGE \
445 --stringparam lang $LANG \
446 --stringparam keymap $KEYMAP \
447 -o ./${PROGNAME}-commands/ $XSL $BOOK/$ARCH-index.xml >>$LOGDIR/$LOG 2>&1
448 ;;
449
450 clfs2)
451 echo -n " ${L_arrow}${BOLD}$ARCH${R_arrow} target architecture"
452 xsltproc --nonet \
453 --xinclude \
454 --stringparam vim-lang $VIMLANG \
455 --stringparam timezone $TIMEZONE \
456 --stringparam page $PAGE \
457 --stringparam lang $LANG \
458 --stringparam keymap $KEYMAP \
459 -o ./${PROGNAME}-commands/ $XSL $BOOK/$ARCH-index.xml >>$LOGDIR/$LOG 2>&1
460 ;;
461 hlfs)
462 echo -n " ${L_arrow}${BOLD}$MODEL${R_arrow} HLFS libc implementation"
463 xsltproc --nonet \
464 --xinclude \
465 --stringparam model $MODEL \
466 --stringparam testsuite $TEST \
467 --stringparam bomb-testsuite $BOMB_TEST \
468 --stringparam timezone $TIMEZONE \
469 --stringparam page $PAGE \
470 --stringparam lang $LANG \
471 --stringparam lc_all $LC_ALL \
472 --stringparam keymap $KEYMAP \
473 --stringparam grsecurity_host $GRSECURITY_HOST \
474 -o ./${PROGNAME}-commands/ $XSL $BOOK/index.xml >>$LOGDIR/$LOG 2>&1
475 ;;
476 lfs)
477 echo -n " ${L_arrow}${BOLD}LFS${R_arrow} build"
478 xsltproc --nonet \
479 --xinclude \
480 --stringparam testsuite $TEST \
481 --stringparam bomb-testsuite $BOMB_TEST \
482 --stringparam vim-lang $VIMLANG \
483 --stringparam timezone $TIMEZONE \
484 --stringparam page $PAGE \
485 --stringparam lang $LANG \
486 -o ./${PROGNAME}-commands/ $XSL $BOOK/index.xml >>$LOGDIR/$LOG 2>&1
487 ;;
488 *) exit 1 ;;
489 esac
490
491 [[ "${BLFS_TOOL}" = "y" ]] && copy_blfs_deps_scripts
492
493 echo " ...OK"
494
495 # Make the scripts executable.
496 chmod -R +x $JHALFSDIR/${PROGNAME}-commands
497
498 # Create the packages file. We need it for proper Makefile creation
499 create_package_list
500
501 # Done. Moving on...
502 get_sources
503
504}
505
506#----------------------------#
507create_package_list() { #
508#----------------------------#
509
510 # Create the packages file. We need it for proper Makefile creation
511 rm -f pkg_tarball_list
512 echo -n "Creating <${PROGNAME}> list of tarball names for $BOOK $ARCH"
513 case ${PROGNAME} in
514 clfs | clfs2)
515 xsltproc --nonet --xinclude -o pkg_tarball_list packages.xsl \
516 $BOOK/materials/${ARCH}-chapter.xml >>$LOGDIR/$LOG 2>&1
517 ;;
518 hlfs)
519 xsltproc --nonet --xinclude -o pkg_tarball_list packages.xsl \
520 $BOOK/chapter04/chapter04.xml >>$LOGDIR/$LOG 2>&1
521 ;;
522 lfs)
523 xsltproc --nonet --xinclude -o pkg_tarball_list packages.xsl \
524 $BOOK/chapter03/chapter03.xml >>$LOGDIR/$LOG 2>&1
525 ;;
526 esac
527
528 if [[ "${BLFS_TOOL}" = "y" ]] ; then
529(
530cat << EOF
531$LIBXML_PKG
532$LIBXSLT_PKG
533$DBXSL_PKG
534$LINKS_PKG
535$SUDO_PKG
536$WGET_PKG
537$SVN_PKG
538$GPM_PKG
539EOF
540) >> pkg_tarball_list
541 fi
542
543 echo " ...OK"
544
545}
546
547
548#----------------------------#
549get_sources() { # Download file, write name to MISSING_FILES.DMP if an error
550#----------------------------#
551 local saveIFS=$IFS
552 local IFS line URL1 URL2 FILE BOOKMD5 MD5 HAVEMD5 fromARCHIVE
553
554 # Test if the packages must be downloaded
555 [ ! "$GETPKG" = "y" ] && return
556
557 gs_wrt_message(){
558 echo "${RED}$1${OFF}"
559 echo "$1" >> MISSING_FILES.DMP
560 }
561 # Housekeeping
562 [[ ! -d $BUILDDIR/sources ]] && mkdir $BUILDDIR/sources
563 cd $BUILDDIR/sources
564 [[ -f MD5SUMS ]] && rm MD5SUMS
565 [[ -f MISSING_FILES.DMP ]] && rm MISSING_FILES.DMP
566 [[ -f urls.lst ]] && rm urls.lst
567
568 # Generate URLs file
569 create_urls
570
571 IFS=$'\x0A' # Modify the 'internal field separator' to break on 'LF' only
572 for line in `cat urls.lst`; do
573 IFS=$saveIFS # Restore the system defaults
574
575 # Skip some packages if they aren't needed
576 case $line in
577 */tcl* | */expect* | */dejagnu* | */tree* | */gcc-testsuite* )
578 [[ "$TEST" = "0" ]] && continue
579 ;;
580 */vim-*-lang* )
581 [[ "$VIMLANG" = "0" ]] && continue
582 ;;
583 *linux/linux-* )
584 [[ -z "$CONFIG" ]] && [[ -z "$BOOT_CONFIG" ]] && \
585 [[ "$GETKERNEL" = "n" ]] && continue
586 ;;
587 esac
588
589 # Locations
590 URL1=`echo $line | cut -d" " -f2` # Preferred URL
591 URL2=`echo $line | cut -d" " -f1` # Fallback Upstream URL
592 FILE=`basename $URL1` # File name
593 BOOKMD5=`echo $line | cut -d" " -f3` # MD5 book value
594
595 # Validation pair
596 MD5="$BOOKMD5 $FILE"
597 HAVEMD5=1
598
599 set -e
600 # If the file exists in the archive copy it to the
601 # $BUILDDIR/sources dir. MD5SUM will be validated later.
602 if [ ! -z ${SRC_ARCHIVE} ] &&
603 [ -d ${SRC_ARCHIVE} ] &&
604 [ -f ${SRC_ARCHIVE}/$FILE ]; then
605 cp ${SRC_ARCHIVE}/$FILE .
606 echo "$FILE: -- copied from $SRC_ARCHIVE"
607 fromARCHIVE=1
608 else
609 echo "${BOLD}${YELLOW}$FILE: not found in ${SRC_ARCHIVE}${OFF}"
610 fromARCHIVE=0
611 # If the file does not exist yet in /sources download a fresh one
612 if [ ! -f $FILE ] ; then
613 if ! wget $URL1 && ! wget $URL2 ; then
614 gs_wrt_message "$FILE not found in the SRC_ARCHIVE or on any server..SKIPPING"
615 continue
616 fi
617 fi
618 fi
619
620 # IF the md5sum does not match the existing files
621 if ! echo "$MD5" | md5sum -c - >/dev/null ; then
622 [[ $fromARCHIVE = "1" ]] && echo "${BOLD}${YELLOW}MD5SUM did not match SRC_ARCHIVE copy${OFF}"
623 [[ $fromARCHIVE = "0" ]] && echo "${BOLD}${YELLOW}MD5SUM did not match REMOTE copy${OFF}"
624 # Remove the old file and download a new one
625 rm -fv $FILE
626 # Force storage in SRC_ARCHIVE
627 fromARCHIVE=0;
628 # Try to retrieve again the file. Servers in reverse order.
629 if ! wget $URL2 && ! wget $URL1 ; then
630 gs_wrt_message "$FILE not found on the servers.. SKIPPING"
631 continue
632 fi
633 fi
634
635 # Validate the MD5SUM one last time
636 if ! echo "$MD5" | md5sum -c - >/dev/null ; then
637 gs_wrt_message "$FILE does not match MD5SUMS value"
638 # Force generation of MD5SUM
639 HAVEMD5=0
640 fi
641
642 # Generate a fresh MD5SUM for this file
643 if [[ "$HAVEMD5" = "0" ]] ; then
644 echo "${BOLD}${YELLOW}Generating a new MD5SUM for ${OFF}$FILE"
645 echo "NEW MD5SUM: $(md5sum $FILE)" >> MISSING_FILES.DMP
646 fi
647
648 # Good or bad we write the original md5sum to a file
649 echo "$MD5" >> MD5SUMS
650
651 # Copy the freshly downloaded file
652 # to the source archive.
653 if [ ! -z ${SRC_ARCHIVE} ] &&
654 [ -d ${SRC_ARCHIVE} ] &&
655 [ -w ${SRC_ARCHIVE} ] &&
656 [ "$fromARCHIVE" = "0" ] ; then
657 echo "Storing file:<$FILE> in the package archive"
658 cp -f $FILE ${SRC_ARCHIVE}
659 fi
660
661 done
662
663 if [[ -s MISSING_FILES.DMP ]]; then
664 echo -e "\n\n${tab_}${RED} One or more files were not retrieved or have bad MD5SUMS.\n${tab_} Check ${L_arrow}$BUILDDIR/sources/MISSING_FILES.DMP${R_arrow} for names ${OFF}\n"
665 # Do not allow the automatic execution of the Makefile.
666 echo "${tab_}${BOLD}${RED}*** ${YELLOW}Automatic execution of the generated makefile has been inhibited. ${RED}***${OFF}${nl_}"
667 RUNMAKE="n"
668 fi
669}
670
671#----------------------------#
672create_urls() { #
673#----------------------------#
674 cd $JHALFSDIR
675
676 case ${PROGNAME} in
677 clfs)
678 echo -n "Creating CLFS <${ARCH}> specific URLs file"
679 xsltproc --nonet --xinclude \
680 --stringparam server $SERVER \
681 -o $BUILDDIR/sources/urls.lst urls.xsl \
682 $BOOK/materials/$ARCH-chapter.xml >>$LOGDIR/$LOG 2>&1
683 echo " ...OK"
684 ;;
685 clfs2)
686 echo -n "Creating CLFS2 <${ARCH}> specific URLs file"
687 xsltproc --nonet --xinclude \
688 --stringparam server $SERVER \
689 -o $BUILDDIR/sources/urls.lst urls.xsl \
690 $BOOK/materials/$ARCH-chapter.xml >>$LOGDIR/$LOG 2>&1
691 echo " ...OK"
692 ;;
693 hlfs)
694 echo -n "Creating HLFS <${MODEL}> specific URLs file"
695 xsltproc --nonet --xinclude \
696 --stringparam server $SERVER \
697 --stringparam model $MODEL \
698 -o $BUILDDIR/sources/urls.lst urls.xsl \
699 $BOOK/chapter04/chapter04.xml >>$LOGDIR/$LOG 2>&1
700 echo " ...OK"
701 ;;
702 lfs)
703 echo -n "Creating LFS specific URLs file"
704 xsltproc --nonet --xinclude \
705 --stringparam server $SERVER \
706 -o ../sources/urls.lst urls.xsl \
707 $BOOK/chapter03/chapter03.xml >>$LOGDIR/$LOG 2>&1
708 echo " ...OK"
709 ;;
710 esac
711
712 cd $BUILDDIR/sources
713
714 if [[ "${BLFS_TOOL}" = "y" ]]; then
715 add_blfs_deps_urls
716 fi
717
718}
719
720#----------------------------# Hardcoded URLs and MD5.
721add_blfs_deps_urls() { # No easy way to extract it.
722#----------------------------# Some FTP mirrors may not work
723
724 local BLFS_SERVER="${SERVER}/pub/blfs/conglomeration/"
725
726 if [[ "${DEP_LIBXML}" = "y" ]] ; then
727 echo "${LIBXML_URL} ${BLFS_SERVER}libxml2/${LIBXML_PKG} ${LIBXML_MD5}" >> urls.lst
728 fi
729
730 if [[ "${DEP_LIBXSLT}" = "y" ]] ; then
731 echo "${LIBXSLT_URL} ${BLFS_SERVER}libxslt/${LIBXSLT_PKG} ${LIBXSLT_MD5}" >> urls.lst
732 fi
733
734 if [[ "${DEP_DBXSL}" = "y" ]] ; then
735 echo "${DBXSL_URL} ${BLFS_SERVER}docbook-xsl/${DBXSL_PKG} ${DBXSL_MD5}" >> urls.lst
736 fi
737
738 if [[ "${DEP_LINKS}" = "y" ]] ; then
739 echo "${LINKS_URL} ${BLFS_SERVER}links/${LINKS_PKG} ${LINKS_MD5}" >> urls.lst
740 fi
741
742 if [[ "${DEP_SUDO}" = "y" ]] ; then
743 echo "${SUDO_URL} ${BLFS_SERVER}sudo/${SUDO_PKG} ${SUDO_MD5}" >> urls.lst
744 echo "${SUDO_PATCH_URL} ${BLFS_SERVER}sudo/${SUDO_PATCH} ${SUDO_PATCH_MD5}" >> urls.lst
745 fi
746
747 if [[ "${DEP_WGET}" = "y" ]] ; then
748 echo "${WGET_URL} ${BLFS_SERVER}wget/${WGET_PKG} ${WGET_MD5}" >> urls.lst
749 fi
750
751 if [[ "${DEP_SVN}" = "y" ]] ; then
752 echo "${SVN_URL} ${BLFS_SERVER}subversion/${SVN_PKG} ${SVN_MD5}" >> urls.lst
753 fi
754
755 if [[ "${DEP_GPM}" = "y" ]] ; then
756 echo "${GPM_URL} ${BLFS_SERVER}gpm/${GPM_PKG} ${GPM_MD5}" >> urls.lst
757 echo "${GPM_PATCH_1_URL} ${BLFS_SERVER}gpm/${GPM_PATCH_1} ${GPM_PATCH_1_MD5}" >> urls.lst
758 echo "${GPM_PATCH_2_URL} ${BLFS_SERVER}gpm/${GPM_PATCH_2} ${GPM_PATCH_2_MD5}" >> urls.lst
759 fi
760
761}
762
763#----------------------------# Maybe there is a better way to do this, but this
764copy_blfs_deps_scripts() { # method avoid to place the test on all
765#----------------------------# $PROGNAME/master.sh scripts.
766
767 mkdir -p ${PROGNAME}-commands/blfs-tool-deps
768
769 if [[ "${DEP_LIBXML}" = "y" ]] ; then
770 mv blfs-tool-deps/901-libxml2 ${PROGNAME}-commands/blfs-tool-deps
771 fi
772
773 if [[ "${DEP_LIBXSLT}" = "y" ]] ; then
774 mv blfs-tool-deps/902-libxslt ${PROGNAME}-commands/blfs-tool-deps
775 fi
776
777 if [[ "${DEP_DBXSL}" = "y" ]] ; then
778 mv blfs-tool-deps/903-docbook-xsl ${PROGNAME}-commands/blfs-tool-deps
779 fi
780
781 if [[ "${DEP_LINKS}" = "y" ]] ; then
782 mv blfs-tool-deps/905-links ${PROGNAME}-commands/blfs-tool-deps
783 fi
784
785 if [[ "${DEP_SUDO}" = "y" ]] ; then
786 mv blfs-tool-deps/906-sudo ${PROGNAME}-commands/blfs-tool-deps
787 fi
788
789 if [[ "${DEP_WGET}" = "y" ]] ; then
790 mv blfs-tool-deps/907-wget ${PROGNAME}-commands/blfs-tool-deps
791 fi
792
793 if [[ "${DEP_SVN}" = "y" ]] ; then
794 mv blfs-tool-deps/908-subversion ${PROGNAME}-commands/blfs-tool-deps
795 fi
796
797 if [[ "${DEP_GPM}" = "y" ]] ; then
798 mv blfs-tool-deps/904-gpm ${PROGNAME}-commands/blfs-tool-deps
799 fi
800
801 rm -rf blfs-tool-deps
802
803}
Note: See TracBrowser for help on using the repository browser.