Changeset 9daa202


Ignore:
Timestamp:
11/21/2021 06:19:16 PM (3 years ago)
Author:
Pierre Labastie <pierre.labastie@…>
Branches:
ablfs-more, legacy, trunk
Children:
0a93085
Parents:
60e539b
git-author:
Pierre Labastie <pierre.labastie@…> (11/06/2021 02:43:58 PM)
git-committer:
Pierre Labastie <pierre.labastie@…> (11/21/2021 06:19:16 PM)
Message:

BLFS tools: Take variables from config instead of envars.conf

Get them in gen_pkg_book, and pass them to sripts.xsl
use them in scripts.xsl. We set them at the beginning of
of the scriptlet, so that it is easy to modify them.

Location:
BLFS
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • BLFS/gen_pkg_book.sh

    r60e539b r9daa202  
    3131declare LANGUAGE
    3232declare WRAP_INSTALL
     33declare PACK_INSTALL
    3334declare DEL_LA_FILES
    3435declare STATS
     36declare SRC_ARCHIVE
     37declare SRC_SUBDIRS
     38declare BUILD_ROOT
     39declare BUILD_SUBDIRS
     40declare KEEP_FILES
     41declare -i JOBS
     42declare CFG_CFLAGS
     43declare CFG_CXXFLAGS
     44declare CFG_LDFLAGS
    3545
    3646#--------------------------#
     
    5262      MAIL_SERVER=*   | \
    5363      WRAP_INSTALL=*  | \
     64      PACK_INSTALL=*  | \
    5465      DEL_LA_FILES=*  | \
    5566      STATS=*         | \
    5667      LANGUAGE=*      | \
    57       SUDO=*  )  eval ${REPLY} # Define/set a global variable..
     68      SUDO=*          | \
     69      SRC_ARCHIVE=*   | \
     70      SRC_SUBDIRS=*   | \
     71      BUILD_ROOT=*    | \
     72      BUILD_SUBDIRS=* | \
     73      KEEP_FILES=*    | \
     74      JOBS=*          | \
     75      CFG_CFLAGS=*    | \
     76      CFG_CXXFLAGS=*  | \
     77      CFG_LDFLAGS=*   )  eval ${REPLY} # Define/set a global variable..
    5878                      continue ;;
    5979    esac
     
    7696  DEL_LA_FILES=${DEL_LA_FILES:-n}
    7797  STATS=${STATS:-n}
     98# Other boolean variables are supposed to be either set or unset. Their values
     99# are not relevant
    78100}
    79101
     
    82104#--------------------------#
    83105  local -r dotSTR=".................."
    84   local -r PARAM_LIST="DEP_LEVEL SUDO LANGUAGE MAIL_SERVER WRAP_INSTALL DEL_LA_FILES STATS"
     106  local -r PARAM_LIST="DEP_LEVEL SUDO LANGUAGE MAIL_SERVER WRAP_INSTALL PACK_INSTALL DEL_LA_FILES STATS SRC_ARCHIVE SRC_SUBDIRS BUILD_ROOT BUILD_SUBDIRS KEEP_FILES JOBS CFG_CFLAGS CFG_CXXFLAGS CFG_LDFLAGS"
    85107  local -r PARAM_VALS='${config_param}${dotSTR:${#config_param}} ${L_arrow}${BOLD}${!config_param}${OFF}${R_arrow}'
    86108  local config_param
     
    209231  LIST_STAT=""
    210232fi
    211 xsltproc --xinclude --nonet \
    212          --stringparam sudo "$SUDO" \
    213          --stringparam wrap-install "$WRAP_INSTALL" \
    214          --stringparam del-la-files "$DEL_LA_FILES" \
    215          --stringparam list-stat "$LIST_STAT" \
    216          --stringparam language "$LANGUAGE" \
    217          --stringparam fqdn "$(hostname -f)" \
    218          -o ./scripts/ ${MakeScripts} \
     233xsltproc --xinclude --nonet                           \
     234         --stringparam language      "$LANGUAGE"      \
     235         --stringparam sudo          "$SUDO"          \
     236         --stringparam wrap-install  "$WRAP_INSTALL"  \
     237         --stringparam pack-install  "$PACK_INSTALL"  \
     238         --stringparam del-la-files  "$DEL_LA_FILES"  \
     239         --stringparam list-stat     "$LIST_STAT"     \
     240         --stringparam src-archive   "$SRC_ARCHIVE"   \
     241         --stringparam src-subdirs   "$SRC_SUBDIRS"   \
     242         --stringparam build-root    "$BUILD_ROOT"    \
     243         --stringparam build-subdirs "$BUILD_SUBDIRS" \
     244         --stringparam keep-files    "$KEEP_FILES"    \
     245         --param       jobs          "$JOBS"          \
     246         --stringparam cfg-cflags    "$CFG_CFLAGS"    \
     247         --stringparam cfg-cxxflags  "$CFG_CXXFLAGS"  \
     248         --stringparam cfg-ldflags   "$CFG_LDFLAGS"   \
     249         --stringparam fqdn          "$(hostname -f)" \
     250         --output      ./scripts/                     \
     251         ${MakeScripts}                               \
    219252         ${BookXml}
    220253# Make the scripts executable.
  • BLFS/xsl/scripts.xsl

    r60e539b r9daa202  
    2424       "porg style" package management -->
    2525  <xsl:param name="wrap-install" select="'n'"/>
     26  <xsl:param name="pack-install" select="'$HOME/blfs_root/packInstall.sh'"/>
    2627
    2728  <!-- list of packages needing stats -->
     
    3435  <xsl:param name="sudo" select="'y'"/>
    3536
     37  <!-- Root of sources directory -->
     38  <xsl:param name="src-archive" select="'/sources'"/>
     39
     40  <!-- Download and archive tarballs to subdirs. Can be 'y' or '',
     41       not 'n' -->
     42  <xsl:param name="src-subdirs" select="''"/>
     43
     44  <!-- Root of build directory -->
     45  <xsl:param name="build-root" select="'/sources'"/>
     46
     47  <!-- extract sources and build into subdirs. Can be 'y' or '',
     48       not 'n' -->
     49  <xsl:param name="build-subdirs" select="''"/>
     50
     51  <!-- Keep files in the build directory after building. Can be 'y' or '',
     52       not 'n' -->
     53  <xsl:param name="keep-files" select="''"/>
     54
     55  <!-- Number of parallel jobs; type integer, not string -->
     56  <xsl:param name="jobs" select="0"/>
    3657<!-- simple instructions for removing .la files. -->
    3758<!-- We'll use the rule that any text output begins with a linefeed if needed
     
    110131      <xsl:text>#!/bin/bash
    111132set -e
    112 unset MAKELEVEL
    113 </xsl:text>
     133# Variables coming from configuration
     134export JH_PACK_INSTALL="</xsl:text>
     135      <xsl:copy-of select="$pack-install"/>
     136      <xsl:text>"
     137export JH_SRC_ARCHIVE="</xsl:text>
     138      <xsl:copy-of select="$src-archive"/>
     139      <xsl:text>"
     140export JH_SRC_SUBDIRS="</xsl:text>
     141      <xsl:copy-of select="$src-subdirs"/>
     142      <xsl:text>"
     143export JH_BUILD_ROOT="</xsl:text>
     144      <xsl:copy-of select="$build-root"/>
     145      <xsl:text>"
     146export JH_BUILD_SUBDIRS="</xsl:text>
     147      <xsl:copy-of select="$build-subdirs"/>
     148      <xsl:text>"
     149export JH_KEEP_FILES="</xsl:text>
     150      <xsl:copy-of select="$keep-files"/>
     151      <xsl:text>"
     152</xsl:text>
     153      <xsl:choose>
     154        <xsl:when test="$cfg-cflags = 'EMPTY'">
     155          <xsl:text>unset CFLAGS
     156</xsl:text>
     157        </xsl:when>
     158        <xsl:otherwise>
     159          <xsl:text>export CFLAGS="</xsl:text>
     160          <xsl:copy-of select="$cfg-cflags"/>
     161          <xsl:text>"
     162</xsl:text>
     163        </xsl:otherwise>
     164      </xsl:choose>
     165      <xsl:choose>
     166        <xsl:when test="$cfg-cxxflags = 'EMPTY'">
     167          <xsl:text>unset CXXFLAGS
     168</xsl:text>
     169        </xsl:when>
     170        <xsl:otherwise>
     171          <xsl:text>export CXXFLAGS="</xsl:text>
     172          <xsl:copy-of select="$cfg-cxxflags"/>
     173          <xsl:text>"
     174</xsl:text>
     175        </xsl:otherwise>
     176      </xsl:choose>
     177      <xsl:choose>
     178        <xsl:when test="$cfg-ldflags = 'EMPTY'">
     179          <xsl:text>unset LDFLAGS
     180</xsl:text>
     181        </xsl:when>
     182        <xsl:otherwise>
     183          <xsl:text>export LDFLAGS="</xsl:text>
     184          <xsl:copy-of select="$cfg-ldflags"/>
     185          <xsl:text>"
     186</xsl:text>
     187        </xsl:otherwise>
     188      </xsl:choose>
     189<!-- We use MAKEFLAGS and NINJAJOBS for setting the number of
     190     parallel jobs. This supposes that ninja has been build with
     191     support for NINJAJOBS in lfs. We'll have to change that code
     192     if lfs changes its policy for ninja. -->
     193      <xsl:text>export MAKEFLAGS="-j</xsl:text>
     194      <xsl:choose>
     195        <xsl:when test="$jobs = 0">
     196          <xsl:text>$(nproc)"
     197</xsl:text>
     198        </xsl:when>
     199        <xsl:otherwise>
     200          <xsl:value-of select="$jobs"/>
     201          <xsl:text>"
     202</xsl:text>
     203        </xsl:otherwise>
     204      </xsl:choose>
     205      <xsl:choose>
     206        <xsl:when test="$jobs = 0">
     207          <xsl:text>unset NINJAJOBS
     208</xsl:text>
     209        </xsl:when>
     210        <xsl:otherwise>
     211          <xsl:text>export NINJAJOBS="</xsl:text>
     212          <xsl:value-of select="$jobs"/>
     213          <xsl:text>"
     214</xsl:text>
     215       </xsl:otherwise>
     216     </xsl:choose>
    114217<!-- Unsetting MAKELEVEL is needed for some packages which assume that
    115218     their top level Makefile is at level zero -->
     219     <xsl:text>unset MAKELEVEL
     220# End of environment</xsl:text>
     221
    116222      <xsl:choose>
    117223        <!-- Package page -->
    118224        <xsl:when test="sect2[@role='package']">
    119225          <!-- We build in a subdirectory, whose name may be needed
    120                if using package management (see envars.conf), so
     226               if using package management, so
    121227               "export" it -->
    122228          <xsl:text>
     
    130236</xsl:text>
    131237
    132 <!-- If stats are requested, include some definitions and intitializations -->
     238<!-- If stats are requested, include some definitions and initializations -->
    133239          <xsl:if test="$want-stats">
    134240            <xsl:text>
    135241INFOLOG=$(pwd)/info-${JH_PKG_DIR}
    136242TESTLOG=$(pwd)/test-${JH_PKG_DIR}
    137 unset MAKEFLAGS
    138 #MAKEFLAGS=-j4
    139 echo MAKEFLAGS: $MAKEFLAGS > $INFOLOG
     243echo MAKEFLAGS: $MAKEFLAGS >  $INFOLOG
     244echo NINJAJOBS: $NINJAJOBS >> $INFOLOG
    140245: > $TESTLOG
    141246PKG_DEST=${BUILD_DIR}/dest
    142 rm -rf $PKG_DEST
    143 </xsl:text>
    144           </xsl:if>
     247</xsl:text>
     248<!-- in some cases, DESTDIR may have been populated by root -->
     249            <xsl:if test="$sudo = 'y'">
     250              <xsl:text>sudo </xsl:text>
     251            </xsl:if>
     252            <xsl:text>rm -rf $PKG_DEST
     253</xsl:text>
     254          </xsl:if><!-- want-stats -->
    145255        <!-- Download code and build commands -->
    146256          <xsl:apply-templates select="sect2">
     
    334444    <xsl:value-of select="$varname"/>
    335445    <xsl:text> ]] ; then
    336   if [[ -f $JH_SRC_ARCHIVE/$</xsl:text>
     446  if [ -f "$JH_SRC_ARCHIVE/$</xsl:text>
    337447    <xsl:value-of select="$varname"/>
    338     <xsl:text> ]] ; then&#xA;</xsl:text>
    339     <xsl:text>    cp $JH_SRC_ARCHIVE/$</xsl:text>
     448    <xsl:text>" ] ; then&#xA;</xsl:text>
     449    <xsl:text>    cp "$JH_SRC_ARCHIVE/$</xsl:text>
    340450    <xsl:value-of select="$varname"/>
    341     <xsl:text> $</xsl:text>
     451    <xsl:text>" "$</xsl:text>
    342452    <xsl:value-of select="$varname"/>
    343     <xsl:text>
     453    <xsl:text>"
    344454  else&#xA;</xsl:text>
    345455    <!-- Download from upstream http -->
    346456    <xsl:if test="string-length($httpurl) &gt; 10">
    347       <xsl:text>    wget -T 30 -t 5 </xsl:text>
     457      <xsl:text>    wget -T 30 -t 5 "</xsl:text>
    348458      <xsl:value-of select="$httpurl"/>
    349       <xsl:text> ||&#xA;</xsl:text>
     459      <xsl:text>" ||&#xA;</xsl:text>
    350460    </xsl:if>
    351461    <!-- Download from upstream ftp -->
    352462    <xsl:if test="string-length($ftpurl) &gt; 10">
    353       <xsl:text>    wget -T 30 -t 5 </xsl:text>
     463      <xsl:text>    wget -T 30 -t 5 "</xsl:text>
    354464      <xsl:value-of select="$ftpurl"/>
    355       <xsl:text> ||&#xA;</xsl:text>
     465      <xsl:text>" ||&#xA;</xsl:text>
    356466    </xsl:if>
    357467    <!-- The FTP_SERVER mirror as a last resort -->
    358     <xsl:text>    wget -T 30 -t 5 ${JH_FTP_SERVER}svn/</xsl:text>
     468    <xsl:text>    wget -T 30 -t 5 "${JH_FTP_SERVER}svn/</xsl:text>
    359469    <xsl:value-of select="$first_letter"/>
    360470    <xsl:text>/$</xsl:text>
    361471    <xsl:value-of select="$varname"/>
    362     <xsl:text>
     472    <xsl:text>"
    363473  fi
    364474fi</xsl:text>
     
    375485    <xsl:if test="string($varname) != 'PACKAGE'">
    376486      <xsl:text>
    377 [[ "$SRC_DIR" != "$BUILD_DIR" ]] &amp;&amp; ln -sf $SRC_DIR/$</xsl:text>
     487[ "$SRC_DIR" != "$BUILD_DIR" ] &amp;&amp; ln -sf "$SRC_DIR/$</xsl:text>
    378488      <xsl:value-of select="$varname"/>
    379       <xsl:text> $BUILD_DIR</xsl:text>
     489      <xsl:text>" "$BUILD_DIR"</xsl:text>
    380490    </xsl:if>
    381491    <xsl:text>&#xA;</xsl:text>
Note: See TracChangeset for help on using the changeset viewer.