Prepend JH_ to exported variables in jhalfs-blfs, so that collision with

build system variables is unlikely
This commit is contained in:
Pierre Labastie 2018-01-30 13:53:34 +00:00
parent 2140f22a88
commit 1fa0dee15b
5 changed files with 61 additions and 64 deletions

View file

@ -11,22 +11,22 @@
#======== Common envars ========== #======== Common envars ==========
#--- The build directory: #--- The build directory:
# - If BUILD_SUBDIRS is set, this directory contains sub directories # - If JH_BUILD_SUBDIRS is set, this directory contains sub directories
# (one for each package), where packages are unpacked, and compiled. # (one for each package), where packages are unpacked, and compiled.
# - If BUILD_SUBDIRS is unset, packages are unpacked, and compiled directly # - If JH_BUILD_SUBDIRS is unset, packages are unpacked, and compiled
# in $BUILD_ROOT. # directly in $JH_BUILD_ROOT.
export BUILD_ROOT=/sources export JH_BUILD_ROOT=/sources
export BUILD_SUBDIRS=1 export JH_BUILD_SUBDIRS=1
#--- The local repository for packages/file: #--- The local repository for packages/file:
# Any missing file will be downloaded and archived either: # Any missing file will be downloaded and archived either:
# - into a subdirectory (one for each page of the book) fo this directory, # - into a subdirectory (one for each page of the book) of this directory,
# if SRC_SUBDIRS is set. # if JH_SRC_SUBDIRS is set.
# - directly into this directory if SRC_SUBDIRS is unset. # - directly into this directory if JH_SRC_SUBDIRS is unset.
# This directory can be the same as $BUILD_ROOT, provided BUILD_SUBDIRS # This directory can be the same as $JH_BUILD_ROOT, provided JH_BUILD_SUBDIRS
# and SRC_SUBDIRS are different. # and JH_SRC_SUBDIRS are different.
export SRC_ARCHIVE=/sources export JH_SRC_ARCHIVE=/sources
unset SRC_SUBDIRS unset JH_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,
@ -43,13 +43,13 @@ unset SRC_SUBDIRS
# The server path MUST be set as listed in # The server path MUST be set as listed in
# http://www.linuxfromscratch.org/blfs/download.html. # http://www.linuxfromscratch.org/blfs/download.html.
# 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 JH_FTP_SERVER=http://ftp.osuosl.org/pub/blfs/
#--- Keep the buid directory to examine it: #--- Keep the buid directory to examine it:
# If KEEP_FILES is unset, the extracted tarball is removed after build. # If JH_KEEP_FILES is unset, the extracted tarball is removed after build.
# Otherwise, the build tree is kept for later study. # Otherwise, the build tree is kept for later study.
#export KEEP_FILES=1 #export JH_KEEP_FILES=1
unset KEEP_FILES unset JH_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)
@ -98,4 +98,4 @@ if [ -r /etc/profile ]; then source /etc/profile; fi
# where the functions are defined, and we'll source it just before # where the functions are defined, and we'll source it just before
# installing. # installing.
export PACK_INSTALL=/blfs_root/packInstall.sh # change as needed export JH_PACK_INSTALL=/blfs_root/packInstall.sh # change as needed

View file

@ -87,11 +87,11 @@ done
<!-- We build in a subdirectory, whose name may be needed <!-- We build in a subdirectory, whose name may be needed
if using package management (see envars.conf), so if using package management (see envars.conf), so
"export" it --> "export" it -->
<xsl:text>export PKG_DIR=</xsl:text> <xsl:text>export JH_PKG_DIR=</xsl:text>
<xsl:value-of select="$filename"/> <xsl:value-of select="$filename"/>
<xsl:text> <xsl:text>
SRC_DIR=${SRC_ARCHIVE}${SRC_SUBDIRS:+/${PKG_DIR}} SRC_DIR=${JH_SRC_ARCHIVE}${JH_SRC_SUBDIRS:+/${JH_PKG_DIR}}
BUILD_DIR=${BUILD_ROOT}${BUILD_SUBDIRS:+/${PKG_DIR}} BUILD_DIR=${JH_BUILD_ROOT}${JH_BUILD_SUBDIRS:+/${JH_PKG_DIR}}
mkdir -p $SRC_DIR mkdir -p $SRC_DIR
mkdir -p $BUILD_DIR mkdir -p $BUILD_DIR
@ -100,13 +100,13 @@ mkdir -p $BUILD_DIR
<xsl:apply-templates select="sect2"/> <xsl:apply-templates select="sect2"/>
<!-- Clean-up --> <!-- Clean-up -->
<xsl:text>cd $BUILD_DIR <xsl:text>cd $BUILD_DIR
[[ -n "$KEEP_FILES" ]] || </xsl:text> [[ -n "$JH_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'">
<xsl:text>sudo </xsl:text> <xsl:text>sudo </xsl:text>
</xsl:if> </xsl:if>
<xsl:text>rm -rf $UNPACKDIR unpacked&#xA;&#xA;</xsl:text> <xsl:text>rm -rf $JH_UNPACKDIR unpacked&#xA;&#xA;</xsl:text>
</xsl:when> </xsl:when>
<!-- Non-package page --> <!-- Non-package page -->
<xsl:otherwise> <xsl:otherwise>
@ -143,31 +143,31 @@ find . -maxdepth 1 -mindepth 1 -type d | xargs </xsl:text>
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 $SRC_DIR/$PACKAGE &gt; unpacked tar -xvf $SRC_DIR/$PACKAGE &gt; unpacked
UNPACKDIR=`grep '[^./]\+' unpacked | head -n1 | sed 's@^\./@@;s@/.*@@'` JH_UNPACKDIR=`grep '[^./]\+' unpacked | head -n1 | sed 's@^\./@@;s@/.*@@'`
;; ;;
*.tar.lz) *.tar.lz)
bsdtar -xvf $SRC_DIR/$PACKAGE 2&gt; unpacked bsdtar -xvf $SRC_DIR/$PACKAGE 2&gt; unpacked
UNPACKDIR=`head -n1 unpacked | cut -d" " -f2 | sed 's@^\./@@;s@/.*@@'` JH_UNPACKDIR=`head -n1 unpacked | cut -d" " -f2 | sed 's@^\./@@;s@/.*@@'`
;; ;;
*.zip) *.zip)
zipinfo -1 $SRC_DIR/$PACKAGE &gt; unpacked zipinfo -1 $SRC_DIR/$PACKAGE &gt; unpacked
UNPACKDIR="$(sed 's@/.*@@' unpacked | uniq )" JH_UNPACKDIR="$(sed 's@/.*@@' unpacked | uniq )"
if test $(wc -w &lt;&lt;&lt; $UNPACKDIR) -eq 1; then if test $(wc -w &lt;&lt;&lt; $JH_UNPACKDIR) -eq 1; then
unzip $SRC_DIR/$PACKAGE unzip $SRC_DIR/$PACKAGE
else else
UNPACKDIR=${PACKAGE%.zip} JH_UNPACKDIR=${PACKAGE%.zip}
unzip -d $UNPACKDIR $SRC_DIR/$PACKAGE unzip -d $JH_UNPACKDIR $SRC_DIR/$PACKAGE
fi fi
;; ;;
*) *)
UNPACKDIR=$PKG_DIR-build JH_UNPACKDIR=$JH_PKG_DIR-build
mkdir $UNPACKDIR mkdir $JH_UNPACKDIR
cp $SRC_DIR/$PACKAGE $UNPACKDIR cp $SRC_DIR/$PACKAGE $JH_UNPACKDIR
cp $(find . -mindepth 1 -maxdepth 1 -type l) $UNPACKDIR cp $(find . -mindepth 1 -maxdepth 1 -type l) $JH_UNPACKDIR
;; ;;
esac esac
export UNPACKDIR export JH_UNPACKDIR
cd $UNPACKDIR&#xA; cd $JH_UNPACKDIR&#xA;
</xsl:text> </xsl:text>
<xsl:apply-templates select=".//screen | .//para/command"/> <xsl:apply-templates select=".//screen | .//para/command"/>
<xsl:if test="$sudo = 'y'"> <xsl:if test="$sudo = 'y'">
@ -241,10 +241,10 @@ cd $UNPACKDIR&#xA;
<xsl:text>&#xA;if [[ ! -f $</xsl:text> <xsl:text>&#xA;if [[ ! -f $</xsl:text>
<xsl:value-of select="$varname"/> <xsl:value-of select="$varname"/>
<xsl:text> ]] ; then <xsl:text> ]] ; then
if [[ -f $SRC_ARCHIVE/$</xsl:text> if [[ -f $JH_SRC_ARCHIVE/$</xsl:text>
<xsl:value-of select="$varname"/> <xsl:value-of select="$varname"/>
<xsl:text> ]] ; then&#xA;</xsl:text> <xsl:text> ]] ; then&#xA;</xsl:text>
<xsl:text> cp $SRC_ARCHIVE/$</xsl:text> <xsl:text> cp $JH_SRC_ARCHIVE/$</xsl:text>
<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"/>
@ -263,14 +263,11 @@ cd $UNPACKDIR&#xA;
<xsl:text> ||&#xA;</xsl:text> <xsl:text> ||&#xA;</xsl:text>
</xsl:if> </xsl:if>
<!-- The FTP_SERVER mirror as a last resort --> <!-- The FTP_SERVER mirror as a last resort -->
<xsl:text> wget -T 30 -t 5 ${FTP_SERVER}svn/</xsl:text> <xsl:text> wget -T 30 -t 5 ${JH_FTP_SERVER}svn/</xsl:text>
<xsl:value-of select="$first_letter"/> <xsl:value-of select="$first_letter"/>
<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>
<xsl:value-of select="$varname"/>
<xsl:text> $SRC_ARCHIVE-->
fi fi
fi fi
</xsl:text> </xsl:text>
@ -431,8 +428,8 @@ fi
</xsl:if> </xsl:if>
<xsl:if test="$wrap-install = 'y' and <xsl:if test="$wrap-install = 'y' and
ancestor::sect2[@role='installation']"> ancestor::sect2[@role='installation']">
<xsl:text>if [ -r "$PACK_INSTALL" ]; then <xsl:text>if [ -r "$JH_PACK_INSTALL" ]; then
source $PACK_INSTALL source $JH_PACK_INSTALL
export -f wrapInstall export -f wrapInstall
export -f packInstall export -f packInstall
fi fi
@ -471,8 +468,8 @@ wrapInstall '
<xsl:text>BOOTPKG_DIR=blfs-</xsl:text> <xsl:text>BOOTPKG_DIR=blfs-</xsl:text>
<xsl:copy-of select="$bootpkg"/> <xsl:copy-of select="$bootpkg"/>
<xsl:text> <xsl:text>
BOOTSRC_DIR=${SRC_ARCHIVE}${SRC_SUBDIRS:+/${BOOTPKG_DIR}} BOOTSRC_DIR=${JH_SRC_ARCHIVE}${JH_SRC_SUBDIRS:+/${BOOTPKG_DIR}}
BOOTBUILD_DIR=${BUILD_ROOT}${BUILD_SUBDIRS:+/${BOOTPKG_DIR}} BOOTBUILD_DIR=${JH_BUILD_ROOT}${JH_BUILD_SUBDIRS:+/${BOOTPKG_DIR}}
mkdir -p $BOOTSRC_DIR mkdir -p $BOOTSRC_DIR
mkdir -p $BOOTBUILD_DIR mkdir -p $BOOTBUILD_DIR
@ -482,8 +479,8 @@ URL=</xsl:text>
<xsl:text> <xsl:text>
BOOTPACKG=$(basename $URL) BOOTPACKG=$(basename $URL)
if [[ ! -f $BOOTPACKG ]] ; then if [[ ! -f $BOOTPACKG ]] ; then
if [[ -f $SRC_ARCHIVE/$BOOTPACKG ]] ; then if [[ -f $JH_SRC_ARCHIVE/$BOOTPACKG ]] ; then
cp $SRC_ARCHIVE/$BOOTPACKG $BOOTPACKG cp $JH_SRC_ARCHIVE/$BOOTPACKG $BOOTPACKG
else else
wget -T 30 -t 5 $URL wget -T 30 -t 5 $URL
fi fi

View file

@ -265,8 +265,8 @@ Working files: several files are generated when first running the tool
IMPORTANT: Review and edit envars.conf, at least after installing the IMPORTANT: Review and edit envars.conf, at least after installing the
tool. This file is used to set global envars needed by the build scripts. tool. This file is used to set global envars needed by the build scripts.
If you use package management, the variable PACK_INSTALL should point to If you use package management, the variable JH_PACK_INSTALL should point to
where the packInstall.sh script resides. the directory where the packInstall.sh script resides.
4.4 CREATING THE MAKEFILE:: 4.4 CREATING THE MAKEFILE::

View file

@ -13,8 +13,8 @@ cp -r menu ${BUILDDIR}${BLFS_ROOT}
cp $COMMON_DIR/progress_bar.sh ${BUILDDIR}${BLFS_ROOT} cp $COMMON_DIR/progress_bar.sh ${BUILDDIR}${BLFS_ROOT}
cp README.BLFS ${BUILDDIR}${BLFS_ROOT} cp README.BLFS ${BUILDDIR}${BLFS_ROOT}
if [ "$WRAP_INSTALL" = y ]; then if [ "$WRAP_INSTALL" = y ]; then
sed -e 's/PKGDIR/UNPACKDIR/' \ sed -e 's/PKGDIR/JH_UNPACKDIR/' \
-e 's/PKG_DEST/PKG_DIR/' \ -e 's/PKG_DEST/JH_PKG_DIR/' \
$PKGMNGTDIR/packInstall.sh > ${BUILDDIR}${BLFS_ROOT}/packInstall.sh $PKGMNGTDIR/packInstall.sh > ${BUILDDIR}${BLFS_ROOT}/packInstall.sh
fi fi
@ -144,17 +144,17 @@ mv scripts $BUILDDIR$BLFS_ROOT
# Generates a list containing download and copying instructions for tarballs # Generates a list containing download and copying instructions for tarballs
echo -e '#!/bin/bash\nset -e\n' > $BUILDDIR$BLFS_ROOT/download_script echo -e '#!/bin/bash\nset -e\n' > $BUILDDIR$BLFS_ROOT/download_script
sed -n -e '/PACKAGE=/,/^fi/{/^fi/a\ sed -n -e '/PACKAGE=/,/^fi/{/^fi/a\
cp $PACKAGE $SRC_ARCHIVE cp $PACKAGE $JH_SRC_ARCHIVE
p}' \ p}' \
-e '/|[ ]*md5sum/p' \ -e '/|[ ]*md5sum/p' \
-e '/PACKAGE1=/,/^fi/{/^fi/a\ -e '/PACKAGE1=/,/^fi/{/^fi/a\
cp $PACKAGE1 $SRC_ARCHIVE cp $PACKAGE1 $JH_SRC_ARCHIVE
p}' \ p}' \
-e '/PATCH=/,/^fi/{/^fi/a\ -e '/PATCH=/,/^fi/{/^fi/a\
cp $PATCH $SRC_ARCHIVE cp $PATCH $JH_SRC_ARCHIVE
p}' \ p}' \
-e '/URL=/,/^fi/{/^fi/a\ -e '/URL=/,/^fi/{/^fi/a\
cp $BOOTPACKG $SRC_ARCHIVE cp $BOOTPACKG $JH_SRC_ARCHIVE
p}' \ p}' \
$BUILDDIR$BLFS_ROOT/scripts/* >> $BUILDDIR$BLFS_ROOT/download_script $BUILDDIR$BLFS_ROOT/scripts/* >> $BUILDDIR$BLFS_ROOT/download_script
chmod u+x $BUILDDIR$BLFS_ROOT/download_script chmod u+x $BUILDDIR$BLFS_ROOT/download_script
@ -164,8 +164,8 @@ pushd $BUILDDIR/sources
# Remove `unpacked' files if some have been left # Remove `unpacked' files if some have been left
sudo find . -name unpacked -exec rm \{\} \; sudo find . -name unpacked -exec rm \{\} \;
if [ "$GETPKG" = "y" ]; then if [ "$GETPKG" = "y" ]; then
FTP_SERVER=$SERVER/pub/blfs/ \ JH_FTP_SERVER=$SERVER/pub/blfs/ \
SRC_ARCHIVE=${SRC_ARCHIVE:-/dev/null} \ JH_SRC_ARCHIVE=${SRC_ARCHIVE:-/dev/null} \
$BUILDDIR$BLFS_ROOT/download_script $BUILDDIR$BLFS_ROOT/download_script
else # Save the download script in case the user wants to run it later else # Save the download script in case the user wants to run it later
cp $BUILDDIR$BLFS_ROOT/download_script . cp $BUILDDIR$BLFS_ROOT/download_script .

View file

@ -22,31 +22,31 @@ case $1 in
VERSION=$(echo $1 | sed 's/.*shot-//') VERSION=$(echo $1 | sed 's/.*shot-//')
;; ;;
icu*) # No version in PCKGVRS! Use version directly from xml book. icu*) # No version in PCKGVRS! Use version directly from xml book.
# PACK_INSTALL contains the path to this script, which is in the # JH_PACK_INSTALL contains the path to this script, which is in the
# parent dir of the book. # parent dir of the book.
local PACKENT=$(dirname $PACK_INSTALL)/blfs-xml/packages.ent local PACKENT=$(dirname $JH_PACK_INSTALL)/blfs-xml/packages.ent
local VERSION1=$(sed -n 's/.*icu-major[^0-9]*\([^"]*\).*/\1/p' $PACKENT) local VERSION1=$(sed -n 's/.*icu-major[^0-9]*\([^"]*\).*/\1/p' $PACKENT)
local VERSION2=$(sed -n 's/.*icu-minor[^0-9]*\([^"]*\).*/\1/p' $PACKENT) local VERSION2=$(sed -n 's/.*icu-minor[^0-9]*\([^"]*\).*/\1/p' $PACKENT)
VERSION=$VERSION1.$VERSION2 VERSION=$VERSION1.$VERSION2
;; ;;
exiv*) exiv*)
local PACKENT=$(dirname $PACK_INSTALL)/blfs-xml/packages.ent local PACKENT=$(dirname $JH_PACK_INSTALL)/blfs-xml/packages.ent
VERSION=$(sed -n 's/.*exiv2[^0-9]*\([^"]*\).*/\1/p' $PACKENT) VERSION=$(sed -n 's/.*exiv2[^0-9]*\([^"]*\).*/\1/p' $PACKENT)
;; ;;
flashplayer*) flashplayer*)
local PACKENT=$(dirname $PACK_INSTALL)/blfs-xml/packages.ent local PACKENT=$(dirname $JH_PACK_INSTALL)/blfs-xml/packages.ent
VERSION=$(sed -n 's/.*flashplayer[^0-9]*\([^"]*\).*/\1/p' $PACKENT) VERSION=$(sed -n 's/.*flashplayer[^0-9]*\([^"]*\).*/\1/p' $PACKENT)
;; ;;
soundtouch*) soundtouch*)
local PACKENT=$(dirname $PACK_INSTALL)/blfs-xml/packages.ent local PACKENT=$(dirname $JH_PACK_INSTALL)/blfs-xml/packages.ent
VERSION=$(sed -n 's/.*soundtouch[^0-9]*\([^"]*\).*/\1/p' $PACKENT) VERSION=$(sed -n 's/.*soundtouch[^0-9]*\([^"]*\).*/\1/p' $PACKENT)
;; ;;
xvid*) xvid*)
local PACKENT=$(dirname $PACK_INSTALL)/blfs-xml/packages.ent local PACKENT=$(dirname $JH_PACK_INSTALL)/blfs-xml/packages.ent
VERSION=$(sed -n 's/.*xvid[^0-9]*\([^"]*\).*/\1/p' $PACKENT) VERSION=$(sed -n 's/.*xvid[^0-9]*\([^"]*\).*/\1/p' $PACKENT)
;; ;;
xf86-video-intel) xf86-video-intel)
local PACKENT=$(dirname $PACK_INSTALL)/blfs-xml/x/installing/x7driver-intel.xml local PACKENT=$(dirname $JH_PACK_INSTALL)/blfs-xml/x/installing/x7driver-intel.xml
VERSION=$(sed -n '/<!--/!s/.*-version[^;][^0-9]*\([^"]*\).*/\1/p' $PACKENT) VERSION=$(sed -n '/<!--/!s/.*-version[^;][^0-9]*\([^"]*\).*/\1/p' $PACKENT)
;; ;;
jdk8*) jdk8*)