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 ==========
#--- 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.
# - If BUILD_SUBDIRS is unset, packages are unpacked, and compiled directly
# in $BUILD_ROOT.
export BUILD_ROOT=/sources
export BUILD_SUBDIRS=1
# - If JH_BUILD_SUBDIRS is unset, packages are unpacked, and compiled
# directly in $JH_BUILD_ROOT.
export JH_BUILD_ROOT=/sources
export JH_BUILD_SUBDIRS=1
#--- 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
# - into a subdirectory (one for each page of the book) of this directory,
# if JH_SRC_SUBDIRS is set.
# - directly into this directory if JH_SRC_SUBDIRS is unset.
# This directory can be the same as $JH_BUILD_ROOT, provided JH_BUILD_SUBDIRS
# and JH_SRC_SUBDIRS are different.
export JH_SRC_ARCHIVE=/sources
unset JH_SRC_SUBDIRS
#--- Set a well-known working locale when building software
# 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
# http://www.linuxfromscratch.org/blfs/download.html.
# 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:
# 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.
#export KEEP_FILES=1
unset KEEP_FILES
#export JH_KEEP_FILES=1
unset JH_KEEP_FILES
### Currently not used in scripts ###
# 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
# 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
if using package management (see envars.conf), so
"export" it -->
<xsl:text>export PKG_DIR=</xsl:text>
<xsl:text>export JH_PKG_DIR=</xsl:text>
<xsl:value-of select="$filename"/>
<xsl:text>
SRC_DIR=${SRC_ARCHIVE}${SRC_SUBDIRS:+/${PKG_DIR}}
BUILD_DIR=${BUILD_ROOT}${BUILD_SUBDIRS:+/${PKG_DIR}}
SRC_DIR=${JH_SRC_ARCHIVE}${JH_SRC_SUBDIRS:+/${JH_PKG_DIR}}
BUILD_DIR=${JH_BUILD_ROOT}${JH_BUILD_SUBDIRS:+/${JH_PKG_DIR}}
mkdir -p $SRC_DIR
mkdir -p $BUILD_DIR
@ -100,13 +100,13 @@ mkdir -p $BUILD_DIR
<xsl:apply-templates select="sect2"/>
<!-- Clean-up -->
<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
by root -->
<xsl:if test="$sudo='y'">
<xsl:text>sudo </xsl:text>
</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>
<!-- Non-package page -->
<xsl:otherwise>
@ -143,31 +143,31 @@ find . -maxdepth 1 -mindepth 1 -type d | xargs </xsl:text>
case $PACKAGE in
*.tar.gz|*.tar.bz2|*.tar.xz|*.tgz|*.tar.lzma)
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)
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)
zipinfo -1 $SRC_DIR/$PACKAGE &gt; unpacked
UNPACKDIR="$(sed 's@/.*@@' unpacked | uniq )"
if test $(wc -w &lt;&lt;&lt; $UNPACKDIR) -eq 1; then
JH_UNPACKDIR="$(sed 's@/.*@@' unpacked | uniq )"
if test $(wc -w &lt;&lt;&lt; $JH_UNPACKDIR) -eq 1; then
unzip $SRC_DIR/$PACKAGE
else
UNPACKDIR=${PACKAGE%.zip}
unzip -d $UNPACKDIR $SRC_DIR/$PACKAGE
JH_UNPACKDIR=${PACKAGE%.zip}
unzip -d $JH_UNPACKDIR $SRC_DIR/$PACKAGE
fi
;;
*)
UNPACKDIR=$PKG_DIR-build
mkdir $UNPACKDIR
cp $SRC_DIR/$PACKAGE $UNPACKDIR
cp $(find . -mindepth 1 -maxdepth 1 -type l) $UNPACKDIR
JH_UNPACKDIR=$JH_PKG_DIR-build
mkdir $JH_UNPACKDIR
cp $SRC_DIR/$PACKAGE $JH_UNPACKDIR
cp $(find . -mindepth 1 -maxdepth 1 -type l) $JH_UNPACKDIR
;;
esac
export UNPACKDIR
cd $UNPACKDIR&#xA;
export JH_UNPACKDIR
cd $JH_UNPACKDIR&#xA;
</xsl:text>
<xsl:apply-templates select=".//screen | .//para/command"/>
<xsl:if test="$sudo = 'y'">
@ -241,10 +241,10 @@ cd $UNPACKDIR&#xA;
<xsl:text>&#xA;if [[ ! -f $</xsl:text>
<xsl:value-of select="$varname"/>
<xsl:text> ]] ; then
if [[ -f $SRC_ARCHIVE/$</xsl:text>
if [[ -f $JH_SRC_ARCHIVE/$</xsl:text>
<xsl:value-of select="$varname"/>
<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:text> $</xsl:text>
<xsl:value-of select="$varname"/>
@ -263,14 +263,11 @@ cd $UNPACKDIR&#xA;
<xsl:text> ||&#xA;</xsl:text>
</xsl:if>
<!-- 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:text>/$</xsl:text>
<xsl:value-of select="$varname"/>
<xsl:text><!--
cp $</xsl:text>
<xsl:value-of select="$varname"/>
<xsl:text> $SRC_ARCHIVE-->
<xsl:text>
fi
fi
</xsl:text>
@ -431,8 +428,8 @@ fi
</xsl:if>
<xsl:if test="$wrap-install = 'y' and
ancestor::sect2[@role='installation']">
<xsl:text>if [ -r "$PACK_INSTALL" ]; then
source $PACK_INSTALL
<xsl:text>if [ -r "$JH_PACK_INSTALL" ]; then
source $JH_PACK_INSTALL
export -f wrapInstall
export -f packInstall
fi
@ -471,8 +468,8 @@ wrapInstall '
<xsl:text>BOOTPKG_DIR=blfs-</xsl:text>
<xsl:copy-of select="$bootpkg"/>
<xsl:text>
BOOTSRC_DIR=${SRC_ARCHIVE}${SRC_SUBDIRS:+/${BOOTPKG_DIR}}
BOOTBUILD_DIR=${BUILD_ROOT}${BUILD_SUBDIRS:+/${BOOTPKG_DIR}}
BOOTSRC_DIR=${JH_SRC_ARCHIVE}${JH_SRC_SUBDIRS:+/${BOOTPKG_DIR}}
BOOTBUILD_DIR=${JH_BUILD_ROOT}${JH_BUILD_SUBDIRS:+/${BOOTPKG_DIR}}
mkdir -p $BOOTSRC_DIR
mkdir -p $BOOTBUILD_DIR
@ -482,8 +479,8 @@ URL=</xsl:text>
<xsl:text>
BOOTPACKG=$(basename $URL)
if [[ ! -f $BOOTPACKG ]] ; then
if [[ -f $SRC_ARCHIVE/$BOOTPACKG ]] ; then
cp $SRC_ARCHIVE/$BOOTPACKG $BOOTPACKG
if [[ -f $JH_SRC_ARCHIVE/$BOOTPACKG ]] ; then
cp $JH_SRC_ARCHIVE/$BOOTPACKG $BOOTPACKG
else
wget -T 30 -t 5 $URL
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
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
where the packInstall.sh script resides.
If you use package management, the variable JH_PACK_INSTALL should point to
the directory where the packInstall.sh script resides.
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 README.BLFS ${BUILDDIR}${BLFS_ROOT}
if [ "$WRAP_INSTALL" = y ]; then
sed -e 's/PKGDIR/UNPACKDIR/' \
-e 's/PKG_DEST/PKG_DIR/' \
sed -e 's/PKGDIR/JH_UNPACKDIR/' \
-e 's/PKG_DEST/JH_PKG_DIR/' \
$PKGMNGTDIR/packInstall.sh > ${BUILDDIR}${BLFS_ROOT}/packInstall.sh
fi
@ -144,17 +144,17 @@ mv scripts $BUILDDIR$BLFS_ROOT
# Generates a list containing download and copying instructions for tarballs
echo -e '#!/bin/bash\nset -e\n' > $BUILDDIR$BLFS_ROOT/download_script
sed -n -e '/PACKAGE=/,/^fi/{/^fi/a\
cp $PACKAGE $SRC_ARCHIVE
cp $PACKAGE $JH_SRC_ARCHIVE
p}' \
-e '/|[ ]*md5sum/p' \
-e '/PACKAGE1=/,/^fi/{/^fi/a\
cp $PACKAGE1 $SRC_ARCHIVE
cp $PACKAGE1 $JH_SRC_ARCHIVE
p}' \
-e '/PATCH=/,/^fi/{/^fi/a\
cp $PATCH $SRC_ARCHIVE
cp $PATCH $JH_SRC_ARCHIVE
p}' \
-e '/URL=/,/^fi/{/^fi/a\
cp $BOOTPACKG $SRC_ARCHIVE
cp $BOOTPACKG $JH_SRC_ARCHIVE
p}' \
$BUILDDIR$BLFS_ROOT/scripts/* >> $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
sudo find . -name unpacked -exec rm \{\} \;
if [ "$GETPKG" = "y" ]; then
FTP_SERVER=$SERVER/pub/blfs/ \
SRC_ARCHIVE=${SRC_ARCHIVE:-/dev/null} \
JH_FTP_SERVER=$SERVER/pub/blfs/ \
JH_SRC_ARCHIVE=${SRC_ARCHIVE:-/dev/null} \
$BUILDDIR$BLFS_ROOT/download_script
else # Save the download script in case the user wants to run it later
cp $BUILDDIR$BLFS_ROOT/download_script .

View file

@ -22,31 +22,31 @@ case $1 in
VERSION=$(echo $1 | sed 's/.*shot-//')
;;
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.
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 VERSION2=$(sed -n 's/.*icu-minor[^0-9]*\([^"]*\).*/\1/p' $PACKENT)
VERSION=$VERSION1.$VERSION2
;;
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)
;;
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)
;;
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)
;;
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)
;;
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)
;;
jdk8*)