diff --git a/BLFS/envars.conf b/BLFS/envars.conf index 20c2b35..2a117fd 100644 --- a/BLFS/envars.conf +++ b/BLFS/envars.conf @@ -10,15 +10,23 @@ #======== Common envars ========== -#--- The sources directory. -# This directory contains sub directories (one for each package), where -# packages are stored, unpacked, and compiled. -export SRC_DIR=/sources +#--- The build directory: +# - If BUILD_SUBDIRS is set, this directory contains sub directories +# (one for each package), where packages are unpacked, and compiled. +# - If BUILD_SUBDIRS is unset, packages are unpacked, and compiled directly +# in $BUILD_ROOT. +export BUILD_ROOT=/sources +export BUILD_SUBDIRS=1 -#--- The local repository for packages/file -# Any missing file will be downloaded and archived here, -# if the user has the right priviledges. Can be the same as SRC_DIR +#--- The local repository for packages/file: +# Any missing file will be downloaded and archived either: +# - into a subdirectory (one for each page of the book) fo this directory, +# if SRC_SUBDIRS is set. +# - directly into this directory if SRC_SUBDIRS is unset. +# This directory can be the same as $BUILD_ROOT, provided BUILD_SUBDIRS +# and SRC_SUBDIRS are different. export SRC_ARCHIVE=/sources +unset SRC_SUBDIRS #--- Set a well-known working locale when building software # Note that an UTF-8 locale may be needed for some packages, @@ -27,7 +35,7 @@ export SRC_ARCHIVE=/sources # sourced at the end of this file. export LC_ALL=C -#--- Server used if the file isn't found in SRC_ARCHIVE or SRC_DIR, +#--- Server used if the file isn't found in SRC_DIR, # and cannot be downloaded from upstream. # # The server path MUST be set as listed in @@ -35,6 +43,12 @@ export LC_ALL=C # Note that despite the name of the variable, it can be an http url. export FTP_SERVER=http://ftp.osuosl.org/pub/blfs/ +#--- Keep the buid directory to examine it: +# If KEEP_FILES is unset, the extracted tarball is removed after build. +# Otherwise, the build tree is kept for later study. +#export KEEP_FILES=1 +unset KEEP_FILES + ### Currently not used in scripts ### # Use a server close to you for Xorg (see http://wiki.x.org/wiki/Mirrors) # export FTP_X_SERVER=ftp://mirror.cict.fr/x.org/ diff --git a/BLFS/xsl/scripts.xsl b/BLFS/xsl/scripts.xsl index 5f47bd9..7a92c7c 100644 --- a/BLFS/xsl/scripts.xsl +++ b/BLFS/xsl/scripts.xsl @@ -78,11 +78,18 @@ "export" it --> export PKG_DIR= - + +SRC_DIR=${SRC_ARCHIVE}${SRC_SUBDIRS:+/${PKG_DIR}} +BUILD_DIR=${BUILD_ROOT}${BUILD_SUBDIRS:+/${PKG_DIR}} +mkdir -p $SRC_DIR +mkdir -p $BUILD_DIR + + - cd $SRC_DIR/$PKG_DIR + cd $BUILD_DIR +[[ -n "$KEEP_FILES" ]] || @@ -105,8 +112,8 @@ - mkdir -p $SRC_DIR/$PKG_DIR - cd $SRC_DIR/$PKG_DIR + cd $SRC_DIR + @@ -116,6 +123,7 @@ +cd $BUILD_DIR find . -maxdepth 1 -mindepth 1 -type d | xargs sudo @@ -123,21 +131,21 @@ find . -maxdepth 1 -mindepth 1 -type d | xargs rm -rf case $PACKAGE in *.tar.gz|*.tar.bz2|*.tar.xz|*.tgz|*.tar.lzma) - tar -xvf $PACKAGE > unpacked + tar -xvf $SRC_DIR/$PACKAGE > unpacked UNPACKDIR=`grep '[^./]\+' unpacked | head -n1 | sed 's@^\./@@;s@/.*@@'` ;; *.tar.lz) - bsdtar -xvf $PACKAGE 2> unpacked + bsdtar -xvf $SRC_DIR/$PACKAGE 2> unpacked UNPACKDIR=`head -n1 unpacked | cut -d" " -f2 | sed 's@^\./@@;s@/.*@@'` ;; *.zip) - zipinfo -1 $PACKAGE > unpacked + zipinfo -1 $SRC_DIR/$PACKAGE > unpacked UNPACKDIR="$(sed 's@/.*@@' unpacked | uniq )" if test $(wc -w <<< $UNPACKDIR) -eq 1; then - unzip $PACKAGE + unzip $SRC_DIR/$PACKAGE else UNPACKDIR=${PACKAGE%.zip} - unzip -d $UNPACKDIR $PACKAGE + unzip -d $UNPACKDIR $SRC_DIR/$PACKAGE fi ;; *) @@ -221,7 +229,9 @@ cd $UNPACKDIR if [[ ! -f $ ]] ; then - + - wget -T 30 -t 5 + wget -T 30 -t 5 || - wget -T 30 -t 5 + wget -T 30 -t 5 || - wget -T 30 -t 5 ${FTP_SERVER}svn/ + wget -T 30 -t 5 ${FTP_SERVER}svn/ /$ - cp $ + fi @@ -268,6 +278,15 @@ fi $ " | md5sum -c - + + + + + +[[ "$SRC_DIR" != "$BUILD_DIR" ]] && ln -sf $SRC_DIR/$ + + $BUILD_DIR diff --git a/Config.in b/Config.in index c59259a..cab285c 100644 --- a/Config.in +++ b/Config.in @@ -39,10 +39,26 @@ menu "BOOK Settings" to build BLFS packages. endchoice + choice + depends BOOK_BLFS + prompt "Init system" + + config BLFS_SYSV + bool "BLFS Sys V" + help + Extract the Sys V flavour of the BLFS book + + config BLFS_SYSD + bool "BLFS systemd" + help + Extract the systemd flavour of the BLFS book + + endchoice + config INITSYS string - default "sysv" if BOOK_LFS - default "systemd" if BOOK_LFS_SYSD + default "sysv" if BOOK_LFS || BLFS_SYSV + default "systemd" if BOOK_LFS_SYSD || BLFS_SYSD config PROGNAME string @@ -874,6 +890,7 @@ depends !BOOK_BLFS endmenu menu "System configuration + depends !BOOK_BLFS #--- FSTAB config HAVE_FSTAB diff --git a/install-blfs-tools.sh b/install-blfs-tools.sh index bf0ed13..82e8a61 100755 --- a/install-blfs-tools.sh +++ b/install-blfs-tools.sh @@ -11,12 +11,12 @@ BLFS_ROOT : where the installed tools will be installed, relative to $HOME. Must start with a '/' (default /blfs_root) BLFS_BRANCH_ID: development, branch-xxx, xxx (where xxx is a valid tag) (default development) -INIT_SYSTEM : which book do you want? 'sysv' or 'systemd' (default sysv) +INITSYS : which book do you want? 'sysv' or 'systemd' (default sysv) Examples: 1 - If you plan to use the tools to build BLFS on top of LFS, but you did not use jhalfs, or forgot to include the jhalfs-blfs tools: (as root) mkdir -p /var/lib/jhalfs/BLFS && chown -R /var/lib/jhalfs -(as user) INIT_SYSTEM= ./install-blfs-tools.sh +(as user) INITSYS= ./install-blfs-tools.sh 2 - To install with only user privileges (default to sysv): TRACKING_DIR=$HOME/blfs_root/trackdir ./install-blfs-tools.sh @@ -80,12 +80,12 @@ BLFS_TOOL='y' BUILDDIR=$(cd ~;pwd) BLFS_ROOT="${BLFS_ROOT:=/blfs_root}" TRACKING_DIR="${TRACKING_DIR:=/var/lib/jhalfs/BLFS}" -INIT_SYSTEM="${INIT_SYSTEM:=sysv}" +INITSYS="${INITSYS:=sysv}" BLFS_BRANCH_ID=${BLFS_BRANCH_ID:=development} BLFS_XML=${BLFS_XML:=blfs-xml} # Validate the configuration: -PARAMS="BLFS_ROOT TRACKING_DIR INIT_SYSTEM BLFS_XML" +PARAMS="BLFS_ROOT TRACKING_DIR INITSYS BLFS_XML" if [ "$WORKING_COPY" = y ]; then PARAMS="$PARAMS WORKING_COPY BOOK" else @@ -167,7 +167,7 @@ cp -a $BLFS_BOOK $BUILDDIR$BLFS_ROOT/$BLFS_XML make -j1 -C $BUILDDIR$BLFS_ROOT \ TRACKING_DIR=$TRACKING_DIR \ - REV=$INIT_SYSTEM \ + REV=$INITSYS \ BLFS_XML=$BUILDDIR$BLFS_ROOT/$BLFS_XML \ SVN=svn://svn.linuxfromscratch.org/BLFS/$BLFS_TREE \ $BUILDDIR$BLFS_ROOT/packages.xml