Add the possibility to choose build and source dirs, and whether subdirs are
used in blfs tools, + various fixes
This commit is contained in:
parent
8010030910
commit
50618eeb88
4 changed files with 81 additions and 31 deletions
|
@ -10,15 +10,23 @@
|
||||||
|
|
||||||
#======== Common envars ==========
|
#======== Common envars ==========
|
||||||
|
|
||||||
#--- The sources directory.
|
#--- The build directory:
|
||||||
# This directory contains sub directories (one for each package), where
|
# - If BUILD_SUBDIRS is set, this directory contains sub directories
|
||||||
# packages are stored, unpacked, and compiled.
|
# (one for each package), where packages are unpacked, and compiled.
|
||||||
export SRC_DIR=/sources
|
# - 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
|
#--- The local repository for packages/file:
|
||||||
# Any missing file will be downloaded and archived here,
|
# Any missing file will be downloaded and archived either:
|
||||||
# if the user has the right priviledges. Can be the same as SRC_DIR
|
# - 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
|
export SRC_ARCHIVE=/sources
|
||||||
|
unset SRC_SUBDIRS
|
||||||
|
|
||||||
#--- Set a well-known working locale when building software
|
#--- Set a well-known working locale when building software
|
||||||
# Note that an UTF-8 locale may be needed for some packages,
|
# 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.
|
# sourced at the end of this file.
|
||||||
export LC_ALL=C
|
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.
|
# and cannot be downloaded from upstream.
|
||||||
#
|
#
|
||||||
# The server path MUST be set as listed in
|
# 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.
|
# Note that despite the name of the variable, it can be an http url.
|
||||||
export FTP_SERVER=http://ftp.osuosl.org/pub/blfs/
|
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 ###
|
### Currently not used in scripts ###
|
||||||
# Use a server close to you for Xorg (see http://wiki.x.org/wiki/Mirrors)
|
# 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/
|
# export FTP_X_SERVER=ftp://mirror.cict.fr/x.org/
|
||||||
|
|
|
@ -78,11 +78,18 @@
|
||||||
"export" it -->
|
"export" it -->
|
||||||
<xsl:text>export PKG_DIR=</xsl:text>
|
<xsl:text>export PKG_DIR=</xsl:text>
|
||||||
<xsl:value-of select="$filename"/>
|
<xsl:value-of select="$filename"/>
|
||||||
<xsl:text>
</xsl:text>
|
<xsl:text>
|
||||||
|
SRC_DIR=${SRC_ARCHIVE}${SRC_SUBDIRS:+/${PKG_DIR}}
|
||||||
|
BUILD_DIR=${BUILD_ROOT}${BUILD_SUBDIRS:+/${PKG_DIR}}
|
||||||
|
mkdir -p $SRC_DIR
|
||||||
|
mkdir -p $BUILD_DIR
|
||||||
|
|
||||||
|
</xsl:text>
|
||||||
<!-- Download code and build commands -->
|
<!-- Download code and build commands -->
|
||||||
<xsl:apply-templates select="sect2"/>
|
<xsl:apply-templates select="sect2"/>
|
||||||
<!-- Clean-up -->
|
<!-- Clean-up -->
|
||||||
<xsl:text>cd $SRC_DIR/$PKG_DIR
</xsl:text>
|
<xsl:text>cd $BUILD_DIR
|
||||||
|
[[ -n "$KEEP_FILES" ]] || </xsl:text>
|
||||||
<!-- In some case, some files in the build tree are owned
|
<!-- In some case, some files in the build tree are owned
|
||||||
by root -->
|
by root -->
|
||||||
<xsl:if test="$sudo='y'">
|
<xsl:if test="$sudo='y'">
|
||||||
|
@ -105,8 +112,8 @@
|
||||||
<xsl:template match="sect2">
|
<xsl:template match="sect2">
|
||||||
<xsl:choose>
|
<xsl:choose>
|
||||||
<xsl:when test="@role = 'package'">
|
<xsl:when test="@role = 'package'">
|
||||||
<xsl:text>mkdir -p $SRC_DIR/$PKG_DIR
</xsl:text>
|
<xsl:text>cd $SRC_DIR
|
||||||
<xsl:text>cd $SRC_DIR/$PKG_DIR
</xsl:text>
|
</xsl:text>
|
||||||
<!-- Download information is in bridgehead tags -->
|
<!-- Download information is in bridgehead tags -->
|
||||||
<xsl:apply-templates select="bridgehead[@renderas='sect3']"/>
|
<xsl:apply-templates select="bridgehead[@renderas='sect3']"/>
|
||||||
<xsl:text>
</xsl:text>
|
<xsl:text>
</xsl:text>
|
||||||
|
@ -116,6 +123,7 @@
|
||||||
</xsl:when>
|
</xsl:when>
|
||||||
<xsl:when test="@role = 'installation'">
|
<xsl:when test="@role = 'installation'">
|
||||||
<xsl:text>
|
<xsl:text>
|
||||||
|
cd $BUILD_DIR
|
||||||
find . -maxdepth 1 -mindepth 1 -type d | xargs </xsl:text>
|
find . -maxdepth 1 -mindepth 1 -type d | xargs </xsl:text>
|
||||||
<xsl:if test="$sudo='y'">
|
<xsl:if test="$sudo='y'">
|
||||||
<xsl:text>sudo </xsl:text>
|
<xsl:text>sudo </xsl:text>
|
||||||
|
@ -123,21 +131,21 @@ find . -maxdepth 1 -mindepth 1 -type d | xargs </xsl:text>
|
||||||
<xsl:text>rm -rf
|
<xsl:text>rm -rf
|
||||||
case $PACKAGE in
|
case $PACKAGE in
|
||||||
*.tar.gz|*.tar.bz2|*.tar.xz|*.tgz|*.tar.lzma)
|
*.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@/.*@@'`
|
UNPACKDIR=`grep '[^./]\+' unpacked | head -n1 | sed 's@^\./@@;s@/.*@@'`
|
||||||
;;
|
;;
|
||||||
*.tar.lz)
|
*.tar.lz)
|
||||||
bsdtar -xvf $PACKAGE 2> unpacked
|
bsdtar -xvf $SRC_DIR/$PACKAGE 2> unpacked
|
||||||
UNPACKDIR=`head -n1 unpacked | cut -d" " -f2 | sed 's@^\./@@;s@/.*@@'`
|
UNPACKDIR=`head -n1 unpacked | cut -d" " -f2 | sed 's@^\./@@;s@/.*@@'`
|
||||||
;;
|
;;
|
||||||
*.zip)
|
*.zip)
|
||||||
zipinfo -1 $PACKAGE > unpacked
|
zipinfo -1 $SRC_DIR/$PACKAGE > unpacked
|
||||||
UNPACKDIR="$(sed 's@/.*@@' unpacked | uniq )"
|
UNPACKDIR="$(sed 's@/.*@@' unpacked | uniq )"
|
||||||
if test $(wc -w <<< $UNPACKDIR) -eq 1; then
|
if test $(wc -w <<< $UNPACKDIR) -eq 1; then
|
||||||
unzip $PACKAGE
|
unzip $SRC_DIR/$PACKAGE
|
||||||
else
|
else
|
||||||
UNPACKDIR=${PACKAGE%.zip}
|
UNPACKDIR=${PACKAGE%.zip}
|
||||||
unzip -d $UNPACKDIR $PACKAGE
|
unzip -d $UNPACKDIR $SRC_DIR/$PACKAGE
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
|
@ -221,7 +229,9 @@ cd $UNPACKDIR

|
||||||
<xsl:text>
if [[ ! -f $</xsl:text>
|
<xsl:text>
if [[ ! -f $</xsl:text>
|
||||||
<xsl:value-of select="$varname"/>
|
<xsl:value-of select="$varname"/>
|
||||||
<xsl:text> ]] ; then
</xsl:text>
|
<xsl:text> ]] ; then
</xsl:text>
|
||||||
<!-- SRC_ARCHIVE may have subdirectories or not -->
|
<!-- This whole code becomes obsolete because now, it is there or we
|
||||||
|
download; keeping for now, and we may want to grab it from
|
||||||
|
SRC_ARCHIVE when SRC_SUBDIRS is set...
|
||||||
<xsl:text> if [[ -f $SRC_ARCHIVE/$PKG_DIR/$</xsl:text>
|
<xsl:text> if [[ -f $SRC_ARCHIVE/$PKG_DIR/$</xsl:text>
|
||||||
<xsl:value-of select="$varname"/>
|
<xsl:value-of select="$varname"/>
|
||||||
<xsl:text> ]] ; then
</xsl:text>
|
<xsl:text> ]] ; then
</xsl:text>
|
||||||
|
@ -237,7 +247,7 @@ cd $UNPACKDIR

|
||||||
<xsl:value-of select="$varname"/>
|
<xsl:value-of select="$varname"/>
|
||||||
<xsl:text> $</xsl:text>
|
<xsl:text> $</xsl:text>
|
||||||
<xsl:value-of select="$varname"/>
|
<xsl:value-of select="$varname"/>
|
||||||
<xsl:text>
 else
</xsl:text>
|
<xsl:text>
 else
</xsl:text> -->
|
||||||
<!-- Download from upstream http -->
|
<!-- Download from upstream http -->
|
||||||
<xsl:if test="string-length($httpurl) > 10">
|
<xsl:if test="string-length($httpurl) > 10">
|
||||||
<xsl:text> wget -T 30 -t 5 </xsl:text>
|
<xsl:text> wget -T 30 -t 5 </xsl:text>
|
||||||
|
@ -256,10 +266,10 @@ cd $UNPACKDIR

|
||||||
<xsl:text>/$</xsl:text>
|
<xsl:text>/$</xsl:text>
|
||||||
<xsl:value-of select="$varname"/>
|
<xsl:value-of select="$varname"/>
|
||||||
<xsl:text>
|
<xsl:text>
|
||||||
cp $</xsl:text>
|
<!-- cp $</xsl:text>
|
||||||
<xsl:value-of select="$varname"/>
|
<xsl:value-of select="$varname"/>
|
||||||
<xsl:text> $SRC_ARCHIVE
|
<xsl:text> $SRC_ARCHIVE
|
||||||
fi
|
fi-->
|
||||||
fi
|
fi
|
||||||
</xsl:text>
|
</xsl:text>
|
||||||
<xsl:if test="string-length($md5) > 10">
|
<xsl:if test="string-length($md5) > 10">
|
||||||
|
@ -268,6 +278,15 @@ fi
|
||||||
<xsl:text>  $</xsl:text>
|
<xsl:text>  $</xsl:text>
|
||||||
<xsl:value-of select="$varname"/>
|
<xsl:value-of select="$varname"/>
|
||||||
<xsl:text>" | md5sum -c -
|
<xsl:text>" | md5sum -c -
|
||||||
|
</xsl:text>
|
||||||
|
</xsl:if>
|
||||||
|
<!-- link additional packages into $BUILD_DIR, because they are supposed to
|
||||||
|
be there-->
|
||||||
|
<xsl:if test="string($varname) != 'PACKAGE'">
|
||||||
|
<xsl:text>
|
||||||
|
[[ "$SRC_DIR" != "$BUILD_DIR" ]] && ln -sf $SRC_DIR/$</xsl:text>
|
||||||
|
<xsl:value-of select="$varname"/>
|
||||||
|
<xsl:text> $BUILD_DIR
|
||||||
</xsl:text>
|
</xsl:text>
|
||||||
</xsl:if>
|
</xsl:if>
|
||||||
</xsl:template>
|
</xsl:template>
|
||||||
|
|
21
Config.in
21
Config.in
|
@ -39,10 +39,26 @@ menu "BOOK Settings"
|
||||||
to build BLFS packages.
|
to build BLFS packages.
|
||||||
endchoice
|
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
|
config INITSYS
|
||||||
string
|
string
|
||||||
default "sysv" if BOOK_LFS
|
default "sysv" if BOOK_LFS || BLFS_SYSV
|
||||||
default "systemd" if BOOK_LFS_SYSD
|
default "systemd" if BOOK_LFS_SYSD || BLFS_SYSD
|
||||||
|
|
||||||
config PROGNAME
|
config PROGNAME
|
||||||
string
|
string
|
||||||
|
@ -874,6 +890,7 @@ depends !BOOK_BLFS
|
||||||
endmenu
|
endmenu
|
||||||
|
|
||||||
menu "System configuration
|
menu "System configuration
|
||||||
|
depends !BOOK_BLFS
|
||||||
|
|
||||||
#--- FSTAB
|
#--- FSTAB
|
||||||
config HAVE_FSTAB
|
config HAVE_FSTAB
|
||||||
|
|
|
@ -11,12 +11,12 @@ BLFS_ROOT : where the installed tools will be installed, relative to $HOME.
|
||||||
Must start with a '/' (default /blfs_root)
|
Must start with a '/' (default /blfs_root)
|
||||||
BLFS_BRANCH_ID: development, branch-xxx, xxx (where xxx is a valid tag)
|
BLFS_BRANCH_ID: development, branch-xxx, xxx (where xxx is a valid tag)
|
||||||
(default development)
|
(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:
|
Examples:
|
||||||
1 - If you plan to use the tools to build BLFS on top of LFS, but you did not
|
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:
|
use jhalfs, or forgot to include the jhalfs-blfs tools:
|
||||||
(as root) mkdir -p /var/lib/jhalfs/BLFS && chown -R <user> /var/lib/jhalfs
|
(as root) mkdir -p /var/lib/jhalfs/BLFS && chown -R <user> /var/lib/jhalfs
|
||||||
(as user) INIT_SYSTEM=<your system> ./install-blfs-tools.sh
|
(as user) INITSYS=<your system> ./install-blfs-tools.sh
|
||||||
2 - To install with only user privileges (default to sysv):
|
2 - To install with only user privileges (default to sysv):
|
||||||
TRACKING_DIR=$HOME/blfs_root/trackdir ./install-blfs-tools.sh
|
TRACKING_DIR=$HOME/blfs_root/trackdir ./install-blfs-tools.sh
|
||||||
|
|
||||||
|
@ -80,12 +80,12 @@ BLFS_TOOL='y'
|
||||||
BUILDDIR=$(cd ~;pwd)
|
BUILDDIR=$(cd ~;pwd)
|
||||||
BLFS_ROOT="${BLFS_ROOT:=/blfs_root}"
|
BLFS_ROOT="${BLFS_ROOT:=/blfs_root}"
|
||||||
TRACKING_DIR="${TRACKING_DIR:=/var/lib/jhalfs/BLFS}"
|
TRACKING_DIR="${TRACKING_DIR:=/var/lib/jhalfs/BLFS}"
|
||||||
INIT_SYSTEM="${INIT_SYSTEM:=sysv}"
|
INITSYS="${INITSYS:=sysv}"
|
||||||
BLFS_BRANCH_ID=${BLFS_BRANCH_ID:=development}
|
BLFS_BRANCH_ID=${BLFS_BRANCH_ID:=development}
|
||||||
BLFS_XML=${BLFS_XML:=blfs-xml}
|
BLFS_XML=${BLFS_XML:=blfs-xml}
|
||||||
|
|
||||||
# Validate the configuration:
|
# 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
|
if [ "$WORKING_COPY" = y ]; then
|
||||||
PARAMS="$PARAMS WORKING_COPY BOOK"
|
PARAMS="$PARAMS WORKING_COPY BOOK"
|
||||||
else
|
else
|
||||||
|
@ -167,7 +167,7 @@ cp -a $BLFS_BOOK $BUILDDIR$BLFS_ROOT/$BLFS_XML
|
||||||
|
|
||||||
make -j1 -C $BUILDDIR$BLFS_ROOT \
|
make -j1 -C $BUILDDIR$BLFS_ROOT \
|
||||||
TRACKING_DIR=$TRACKING_DIR \
|
TRACKING_DIR=$TRACKING_DIR \
|
||||||
REV=$INIT_SYSTEM \
|
REV=$INITSYS \
|
||||||
BLFS_XML=$BUILDDIR$BLFS_ROOT/$BLFS_XML \
|
BLFS_XML=$BUILDDIR$BLFS_ROOT/$BLFS_XML \
|
||||||
SVN=svn://svn.linuxfromscratch.org/BLFS/$BLFS_TREE \
|
SVN=svn://svn.linuxfromscratch.org/BLFS/$BLFS_TREE \
|
||||||
$BUILDDIR$BLFS_ROOT/packages.xml
|
$BUILDDIR$BLFS_ROOT/packages.xml
|
||||||
|
|
Reference in a new issue