Changeset 63fc514


Ignore:
Timestamp:
02/22/2012 05:09:47 PM (13 years ago)
Author:
Pierre Labastie <pierre@…>
Branches:
ablfs
Children:
c1987b0
Parents:
0216209
Message:

Initial modificaiton of BLFS tools

Files:
7 added
6 deleted
8 edited
1 moved

Legend:

Unmodified
Added
Removed
  • BLFS/Makefile

    r0216209 r63fc514  
    22# Modified By: Joe Ciccone <jciccone@linuxfromscratch.org
    33# Additional changes: George Boudreau <georgeb@linuxfromscratch.org>
     4#                     Pierre Labastie <pierre.labastie at neuf.fr>
    45
    5 # $Id$
     6# $Id: Makefile 36 2012-02-22 13:01:46Z labastie $
     7
     8ifdef V
     9  Q =
     10else
     11  Q = @
     12endif
    613
    714LANG=C
    815LC_ALL=C
     16TRACKING_DIR = tracking-dir
    917TOPDIR=$(shell pwd)
    10 CONFIG_CONFIG_IN = Config.in
    11 CONFIG = menu
     18BLFS_XML = $(TOPDIR)/blfs-xml
     19XSLDIR = $(TOPDIR)/xsl
    1220
    13 all:    menuconfig
     21RENDERTMP = $(BLFS_XML)/tmp
     22BLFS_FULL = $(RENDERTMP)/blfs-full.xml
     23PACK_LIST = $(TOPDIR)/packages.xml
     24MENU = $(TOPDIR)/menu
     25CONFIG_CONFIG_IN = $(TOPDIR)/Config.in
     26CONFIG_OUT = $(TOPDIR)/configuration
     27BOOK_XML = $(TOPDIR)/book.xml
     28TRACKFILE = $(TRACKING_DIR)/instpkg.xml
    1429
    15 $(CONFIG)/conf:
    16         $(MAKE) -B -C $(CONFIG) conf
     30define INITIAL_TRACK
     31<?xml version="1.0" encoding="ISO-8859-1"?>\
     32\
     33<!DOCTYPE sublist SYSTEM "$(TOPDIR)/packdesc.dtd">\
     34<sublist>\
     35  <name>Installed</name>\
     36</sublist>
     37endef
    1738
    18 $(CONFIG)/mconf:
    19         $(MAKE) -B -C $(CONFIG) ncurses conf mconf
     39SVN = svn://svn.linuxfromscratch.org/BLFS/trunk/BOOK
    2040
    21 menuconfig: $(CONFIG)/mconf
    22         @./update_book.sh none
    23         @./gen_config.sh
    24         @$(CONFIG)/mconf $(CONFIG_CONFIG_IN)
    25         @./gen_pkg_book.sh
     41ALLXML := $(filter-out $(RENDERTMP)/%, \
     42        $(wildcard $(BLFS_XML)/*.xml $(BLFS_XML)/*/*.xml $(BLFS_XML)/*/*/*.xml $(BLFS_XML)/*/*/*/*.xml $(BLFS_XML)/*/*/*/*/*.xml))
     43ALLXSL := $(filter-out $(RENDERTMP)/%, \
     44        $(wildcard $(BLFS_XML)/*.xsl $(BLFS_XML)/*/*.xsl $(BLFS_XML)/*/*/*.xsl $(BLFS_XML)/*/*/*/*.xsl $(BLFS_XML)/*/*/*/*/*.xsl))
    2645
    27 config: $(CONFIG)/conf
    28         @$(CONFIG)/conf $(CONFIG_CONFIG_IN)
     46$(BOOK_XML): $(CONFIG_OUT)
     47        $(Q)$(TOPDIR)/gen_pkg_book.sh $(TOPDIR) $(BLFS_FULL)
     48
     49$(CONFIG_OUT): $(CONFIG_CONFIG_IN) $(MENU)/mconf
     50        $(Q)$(MENU)/mconf $(CONFIG_CONFIG_IN)
     51
     52$(MENU)/mconf:
     53        $(Q)$(MAKE) -C $(MENU) ncurses conf mconf
     54
     55$(CONFIG_CONFIG_IN): $(PACK_LIST) $(XSLDIR)/gen_config.xsl
     56        $(Q)xsltproc --nonet -o $@ $(XSLDIR)/gen_config.xsl $(PACK_LIST)
     57
     58$(PACK_LIST): $(XSLDIR)/gen_pkg_list.xsl $(XSLDIR)/specialCases.xsl $(TRACKFILE)
     59        $(Q)xsltproc --stringparam installed-packages $(TRACKFILE) \
     60        -o $@.tmp $(XSLDIR)/gen_pkg_list.xsl $(BLFS_FULL)
     61        $(Q)xmllint --postvalid --format -o $@ $@.tmp
     62        $(Q)rm $@.tmp
     63
     64$(TRACKFILE): $(TRACKING_DIR)
     65        $(Q)if ! [ -f $@ ]; then \
     66        echo Initializing $(TRACKFILE) && \
     67        echo '$(INITIAL_TRACK)' > $@ && \
     68        $(MAKE) $(PACK_LIST) && \
     69        for track in $(TRACKING_DIR)/*-*; do \
     70        pack=$$(echo $$track | sed 's@.*/\(.*\)-[0-9c].*@\1@') && \
     71        xsltproc --stringparam packages $(PACK_LIST) \
     72        --stringparam package $$pack \
     73        -o track.tmp $(XSLDIR)/bump.xsl $@ && \
     74        sed -i 's@PACKDESC@$(TOPDIR)/packdesc.dtd@' track.tmp && \
     75        xmllint --format --postvalid track.tmp > $@; \
     76        done; \
     77        rm -f track.tmp; \
     78        fi
     79
     80$(TRACKING_DIR):
     81        @echo Creating $(TRACKING_DIR)
     82        $(Q)mkdir -p $@
     83
     84$(XSLDIR)/specialCases.xsl: $(TOPDIR)/gen-special.sh $(BLFS_FULL)
     85        $(Q)$(TOPDIR)/gen-special.sh $(BLFS_FULL) $@
     86
     87$(BLFS_FULL): $(BLFS_XML) $(BLFS_XML)/general.ent $(ALLXML) $(ALLXSL)
     88        @echo "Validating the book..."
     89        $(Q)[ -d $(RENDERTMP) ] || mkdir -p $(RENDERTMP)
     90        $(Q)xmllint --nonet --noent --xinclude --postvalid \
     91          -o $@ $(BLFS_XML)/index.xml
     92
     93all: update $(BOOK_XML)
     94
     95update: $(BLFS_XML)
     96        @echo Updating the book sources
     97        $(Q)cd $(BLFS_XML) && svn up
     98
     99$(BLFS_XML):
     100        @echo Getting the book sources...
     101        $(Q)svn co $(SVN) $@
    29102
    30103# Clean up
    31104
    32105clean:
    33         rm -f configuration configuration.old error
    34         - $(MAKE) -C $(CONFIG) clean
     106        rm -f $(CONFIG_OUT) $(CONFIG_OUT).old $(TOPDIR)/packages.xml $(XSLDIR)/specialCases.xsl $(CONFIG_CONFIG_IN) book.xml
     107        rm -rf $(TOPDIR)/dependencies $(TOPDIR)/book-html $(TOPDIR)/scripts
     108        - $(MAKE) -C $(MENU) clean
    35109
    36 clean-target:
    37         rm -f error
    38         - $(MAKE) -C $(CONFIG) clean
    39 
    40 .PHONY: all menuconfig config clean clean-target $(CONFIG)/conf $(CONFIG)/mconf
     110.PHONY: clean all update $(CONFIG_OUT)
  • BLFS/envars.conf

    r0216209 r63fc514  
    1717#    Any missing file will be downloaded and archived here,
    1818#    if the user has the right priviledges.
    19 export SRC_ARCHIVE=$SRC_ARCHIVE
     19export SRC_ARCHIVE=/sources
    2020
    2121#--- Server used if the file isn't found in SRC_ARCHIVE.
     
    2626export FTP_SERVER=ftp://anduin.linuxfromscratch.org/BLFS/
    2727
     28# Use a server close to you for Xorg (see http://wiki.x.org/wiki/Mirrors)
     29export FTP_X_SERVER=ftp://mirror.cict.fr/x.org/
    2830
    2931#--- The sources directory.
    3032#    Full path to the top level directory where packages will be stored,
    3133#    unpacked, and compiled.
    32 export SRC_DIR=$HOME/sources
     34export SRC_DIR=/sources
    3335
    3436
     
    8082#   asking for support.
    8183
    82 #export MAKEFLAGS="-j3"
     84export MAKEFLAGS="-j5"
    8385
    8486#export CFLAGS="-O3 -pipe"
  • BLFS/gen-makefile.sh

    r0216209 r63fc514  
    66
    77# TEMPORARY VARIABLES.. development use only
     8declare TOPDIR=$(cd ..; pwd)
    89declare MKFILE=Makefile
    910declare PREV_PACKAGE=""
    10 declare BUILD_SCRIPTS=scripts
    11 declare TRACKING_DIR=tracking-dir
     11declare BUILD_SCRIPTS=${TOPDIR}/scripts
     12declare TRACKING_FILE=tracking-dir/instpkg.xml
     13declare XSLDIR=${TOPDIR}/xsl
     14declare PACK_FILE=${TOPDIR}/packages.xml
     15declare BUMP=${XSLDIR}/bump.xsl
    1216
    1317HEADER="# This file is automatically generated by gen-makefile.sh
     
    3943(
    4044cat << EOF
    41         @source ../envars.conf && ${BUILD_SCRIPTS}/\$@ >logs/\$@ 2>&1
     45        @source ${TOPDIR}/envars.conf && ${BUILD_SCRIPTS}/\$@ >logs/\$@ 2>&1
    4246EOF
    4347) >> $MKFILE.tmp
     
    4852#----------------------------------#
    4953  local pkg_name=$1
    50   local pkg_ver=$2
    51   local alsa_ver=$(grep "^alsa[[:space:]]" ../packages | cut -f3)
    52   local kde_core_ver=$(grep "^kde-core[[:space:]]" ../packages | cut -f3)
    53   local xorg7_ver=$(grep "^xorg7[[:space:]]" ../packages | cut -f3)
    54 
    55   if [[ -n "$pkg_ver" ]] ; then
    56 (
    57 cat << EOF
    58         @rm -f \$(TRACKING_DIR)/${pkg_name#*-?-}-{0..9}* && \\
    59         touch \$(TRACKING_DIR)/${pkg_name#*-?-}-${pkg_ver}
    60 EOF
    61 ) >> $MKFILE.tmp
    62   fi
    63 
    64   case $pkg_name in
    65     *-alsa-lib ) #this the unique mandatory package for ALSA support.
    66 (
    67 cat << EOF
    68         @rm -f \$(TRACKING_DIR)/alsa-{0..9}* && \\
    69         touch \$(TRACKING_DIR)/alsa-${alsa_ver}
    70 EOF
    71 ) >> $MKFILE.tmp
    72       ;;
    73     *-kdebase )
    74 (
    75 cat << EOF
    76         @rm -f \$(TRACKING_DIR)/kde-core-{0..9}* && \\
    77         touch \$(TRACKING_DIR)/kde-core-${kde_core_ver}
    78 EOF
    79 ) >> $MKFILE.tmp
    80       ;;
    81     *-xorg7-driver ) # xtrerm2 and rman are optional
    82 (
    83 cat << EOF
    84         @rm -f \$(TRACKING_DIR)/xorg7-{0..9}* && \\
    85         touch \$(TRACKING_DIR)/xorg7-${xorg7_ver}
    86 EOF
    87 ) >> $MKFILE.tmp
    88       ;;
    89   esac
    9054
    9155(
    9256cat << EOF
    93         @touch  \$@ && \\
     57        @xsltproc --stringparam packages ${PACK_FILE} \\
     58        --stringparam package ${pkg_name#*-?-} \\
     59        -o track.tmp \\
     60        ${BUMP} \$(TRACKING_FILE) && \\
     61        sed -i 's@PACKDESC@${TOPDIR}/packdesc.dtd@' track.tmp && \\
     62        xmllint --format --postvalid track.tmp > \$(TRACKING_FILE) && \\
     63        rm track.tmp && \\
     64        touch  \$@ && \\
    9465        sleep .25 && \\
    9566        echo -e "\n\n "\$(BOLD)Target \$(BLUE)\$@ \$(BOLD)OK && \\
     
    10475#----------------------------#
    10576  local script_name=$1
    106   local pkg_ver=$2
    10777
    10878  echo -n "${tab_}${tab_} entry for <$script_name>"
     
    11989  # Include a touch of the target name so make can check
    12090  # if it's already been made.
    121   __wrt_touch "${script_name}" "${pkg_ver}"
     91  __wrt_touch "${script_name}"
    12292  #
    12393  #--------------------------------------------------------------------#
     
    12595  #--------------------------------------------------------------------#
    12696  echo " .. OK"
    127 }
    128 
    129 #----------------------------#
    130 __write_meta_pkg_touch() {   #
    131 #----------------------------#
    132   local meta_pkg=$1
    133   local pkg_ver=$(grep "^${meta_pkg}[[:space:]]" ../packages | cut -f3)
    134   local gnome_core_ver=$(grep "^gnome-core[[:space:]]" ../packages | cut -f3)
    135   local kde_full_ver=$(grep "^kde-full[[:space:]]" ../packages | cut -f3)
    136 
    137 (
    138 cat << EOF
    139 
    140 999-z-$meta_pkg:  $PREV_PACKAGE
    141         @rm -f \$(TRACKING_DIR)/${meta_pkg}-{0..9}* && \\
    142         touch \$(TRACKING_DIR)/${meta_pkg}-${pkg_ver}
    143 EOF
    144 ) >> $MKFILE.tmp
    145 
    146   case $meta_pkg in
    147     gnome-full )
    148 (
    149 cat << EOF
    150         @rm -f \$(TRACKING_DIR)/gnome-core-{0..9}* && \\
    151         touch \$(TRACKING_DIR)/gnome-core-${gnome_core_ver}
    152 EOF
    153 ) >> $MKFILE.tmp
    154       ;;
    155     kde-koffice )
    156 (
    157 cat << EOF
    158         @rm -f \$(TRACKING_DIR)/kde-full-{0..9}* && \\
    159         touch \$(TRACKING_DIR)/kde-full-${kde_full_ver}
    160 EOF
    161 ) >> $MKFILE.tmp
    162       ;;
    163   esac
    164 
    165 (
    166 cat << EOF
    167         @touch  \$@
    168 EOF
    169 ) >> $MKFILE.tmp
    170 
    17197}
    17298
     
    183109
    184110
    185   for package_script in scripts/* ; do
     111  for package_script in ${BUILD_SCRIPTS}/* ; do
    186112    this_script=`basename $package_script`
    187     pkg_ver=$(grep "^${this_script#*-?-}[[:space:]]" ../packages | cut -f3)
    188113    pkg_list="$pkg_list ${this_script}"
    189     __write_entry "${this_script}" "${pkg_ver}"
     114    __write_entry "${this_script}"
    190115    PREV_PACKAGE=${this_script}
    191116  done
    192117
    193   PACKAGE=$(basename $PWD)
    194 
    195    # alsa, kde-core and xorg7 are also available dependencies, thus handled
    196    # in another way.
    197   case $PACKAGE in
    198     gnome-core | \
    199     gnome-full | \
    200     kde-full | \
    201     kde-koffice )  pkg_list="$pkg_list 999-z-${PACKAGE}"
    202                   __write_meta_pkg_touch "${PACKAGE}"
    203                   ;;
    204   esac
    205 
    206 
    207   # Add a header, some variables and include the function file
    208   # to the top of the real Makefile.
    209118(
    210119    cat << EOF
    211120$HEADER
    212121
    213 PACKAGE= $PACKAGE
    214 TRACKING_DIR= $TRACKING_DIR
     122TRACKING_FILE= $TRACKING_FILE
    215123
    216124BOLD= "[0;1m"
     
    229137
    230138
    231 define fin_message
     139define end_message
    232140  @echo \$(BOLD)
    233141  @echo --------------------------------------------------------------------------------
     
    237145
    238146all : $pkg_list
    239         @\$(call fin_message )
     147        @\$(call end_message )
    240148EOF
    241149) > $MKFILE
     
    248156}
    249157
    250 if [[ -e Config.in ]] ; then
    251   echo -e "\n\tThis script must be run from inside a target package directory.\n"
    252   exit 1
    253 fi
    254 
    255 if [[ ! -d scripts ]] ; then
    256   echo -e "\n\tNo ./scripts/ directory has been found.\n"
     158if [[ ! -d ${BUILD_SCRIPTS} ]] ; then
     159  echo -e "\n\tThe \'${BUILD_SCRIPTS}\' directory has not been found.\n"
    257160  exit 1
    258161fi
  • BLFS/gen_pkg_book.sh

    r0216209 r63fc514  
    77set -e
    88
    9 declare -r ConfigFile="configuration"
    10 declare TARGET
     9TOPDIR=$1
     10if test -z "TOPDIR"; then
     11  TOPDIR=$(pwd)
     12fi
     13BLFS_FULL=$2
     14if test -z "BLFS_FULL"; then
     15  BLFS_FULL=${TOPDIR}/blfs-xml/tmp/blfs-full.xml
     16fi
     17declare -r ConfigFile="${TOPDIR}/configuration"
     18declare DepDir="${TOPDIR}/dependencies"
     19declare LibDir="${TOPDIR}/libs"
     20declare PackFile="${TOPDIR}/packages.xml"
     21declare BookXml="${TOPDIR}/book.xml"
     22declare MakeBook="${TOPDIR}/xsl/make_book.xsl"
     23declare MakeScripts="${TOPDIR}/xsl/scripts.xsl"
     24declare BookHtml="${TOPDIR}/book-html"
     25declare BLFS_XML="${TOPDIR}/blfs-xml"
     26declare -a TARGET
    1127declare DEP_LEVEL
    1228declare SUDO
    13 declare PKGXML
    14 declare BLFS_XML
    15 declare VERBOSITY=1
    1629
    1730#--------------------------#
    1831parse_configuration() {    #
    1932#--------------------------#
    20   local cntr
    21   local optTARGET
     33  local -i cntr=0
     34  local -a optTARGET
    2235
    23   while [ 0 ]; do
    24     read || break 1
     36  while read; do
    2537
    2638    # Garbage collection
     
    3042
    3143    case "${REPLY}" in
    32       CONFIG_ALSA=* | \
    33       CONFIG_GNOME-CORE=* | \
    34       CONFIG_GNOME-FULL=* | \
    35       CONFIG_KDE-CORE=* | \
    36       CONFIG_KDE-FULL=* | \
    37       CONFIG_KDE-KOFFICE=* | \
    38       CONFIG_XORG7=* ) REPLY=${REPLY%=*}  # Strip the trailing '=y' test.. unecessary
    39                        echo -n "${REPLY}"
    40                        if [[ $((++cntr)) > 1 ]]; then
    41                          echo "  <<-- ERROR:: SELECT ONLY 1 PACKAGE AT A TIME, META-PACKAGE NOT SELECTED"
    42                        else
    43                          echo ""
    44                          optTARGET=$(echo $REPLY | cut -d "_" -f2 | tr [A-Z] [a-z])
    45                        fi
    46                        continue ;;
    47 
    4844      # Create global variables for these parameters.
    4945      optDependency=* | \
     
    5248      GHOSTSCRIPT=*   | \
    5349      KBR5=*  | \
    54       X11=*   | \
    5550      SUDO=*  )  eval ${REPLY} # Define/set a global variable..
    5651                      continue ;;
     
    5853
    5954    if [[ "${REPLY}" =~ ^CONFIG_ ]]; then
    60       echo -n "$REPLY"
    61       if [[ $((++cntr)) > 1 ]]; then
    62         echo "  <<-- ERROR SELECT ONLY 1 PACKAGE AT A TIME, WILL NOT BUILD"
    63       else
    64         echo ""
    65         optTARGET=$( echo $REPLY | sed -e 's@CONFIG_@@' -e 's@=y@@' )
    66       fi
     55      echo "$REPLY"
     56      optTARGET[$((cntr++))]=$( echo $REPLY | sed -e 's@CONFIG_@@' -e 's@=y@@' )
    6757    fi
    68   done <$ConfigFile
     58  done < $ConfigFile
    6959
    70   if [[ $optTARGET = "" ]]; then
    71     echo -e "\n>>> NO TARGET SELECTED.. applicaton terminated"
    72     echo -e "    Run <make> again and select a package to build\n"
     60  if (( $cntr == 0 )); then
     61    echo -e "\n>>> NO TARGET SELECTED.. application terminated"
     62    echo -e "    Run <make> again and select (a) package(s) to build\n"
    7363    exit 0
    7464  fi
    75 
    76   TARGET=$optTARGET
     65  TARGET=(${optTARGET[*]})
    7766  DEP_LEVEL=$optDependency
    7867  SUDO=${SUDO:-n}
     
    8372#--------------------------#
    8473  local -r dotSTR=".................."
    85   local -r PARAM_LIST="TARGET DEP_LEVEL SUDO PRINT_SERVER MAIL_SERVER GHOSTSCRIPT KBR5 X11"
     74  local -r PARAM_LIST="DEP_LEVEL SUDO PRINT_SERVER MAIL_SERVER GHOSTSCRIPT KBR5"
    8675  local -r PARAM_VALS='${config_param}${dotSTR:${#config_param}} ${L_arrow}${BOLD}${!config_param}${OFF}${R_arrow}'
    8776  local config_param
     77  local -i index
    8878
    8979  for config_param in ${PARAM_LIST}; do
    9080    echo -e "`eval echo $PARAM_VALS`"
    9181  done
     82  for (( index=0 ; index < ${#TARGET[*]} ; index ++ )); do
     83    echo -e "TARGET${index}${dotSTR:6} ${L_arrow}${BOLD}${TARGET[${index}]}${OFF}${R_arrow}"
     84  done
    9285}
    9386
    9487#
    95 # Regenerate the META-package dependencies from the configuration file
     88# Generates the root of the dependency tree
    9689#
    9790#--------------------------#
    98 regenerate_deps() {        #
     91generate_deps() {        #
    9992#--------------------------#
    10093
    101   rm -f libs/*.dep-MOD
    102   while [ 0 ]; do
    103     read || break 1
    104     case ${REPLY} in
    105       \#* | '') continue ;;
    106     esac
    107 
    108     # Drop the "=y"
    109     REPLY=${REPLY%=*}
    110     if [[ "${REPLY}" =~ ^DEP_ ]]; then
    111       META_PACKAGE=$(echo $REPLY | cut -d "_" -f2 | tr [A-Z] [a-z])
    112       DEP_FNAME=$(echo $REPLY | cut -d "_" -f3)
    113        echo "${DEP_FNAME}" >>libs/${META_PACKAGE}.dep-MOD
    114     fi
    115 
    116   done <$ConfigFile
    117   #
    118   # Replace to 'old' dependency file with a new one.
    119   #
    120   for dst in `ls ./libs/*.dep-MOD 2>/dev/null`; do
    121     cp -vf $dst ${dst%-MOD}
     94  local -i index
     95  local DepDir=$1
     96  rm -f $DepDir/*.dep
     97  echo 1 > $DepDir/root.dep
     98  for (( index=0 ; index < ${#TARGET[*]} ; index ++ )); do
     99    echo ${TARGET[${index}]} >> $DepDir/root.dep
    122100  done
    123101}
     
    132110#--------------------------#
    133111
    134 tail -n 29 configuration > configuration.tmp
    135 mv configuration.tmp configuration
     112tail -n 15 ${ConfigFile} > ${ConfigFile}.tmp
     113mv ${ConfigFile}.tmp ${ConfigFile}
    136114
    137115}
     
    139117#---------------------
    140118# Constants
    141 source libs/constants.inc
     119source ${LibDir}/constants.inc
    142120[[ $? > 0 ]] && echo -e "\n\tERROR: constants.inc did not load..\n" && exit
    143121
    144122#---------------------
    145123# Dependencies module
    146 source libs/func_dependencies
     124source ${LibDir}/func_dependencies
    147125[[ $? > 0 ]] && echo -e "\n\tERROR: func_dependencies did not load..\n" && exit
    148126
    149 #---------------------
    150 # parser module
    151 source libs/func_parser
    152 [[ $? > 0 ]] && echo -e "\n\tERROR: func_parser did not load..\n" && exit
    153 
    154 
    155127#------- MAIN --------
    156 if [[ ! -f packages ]] ; then
     128if [[ ! -f ${PackFile} ]] ; then
    157129  echo -e "\tNo packages file has been found.\n"
    158130  echo -e "\tExecution aborted.\n"
     
    171143fi
    172144echo "${nl_}${SD_BORDER}${nl_}"
    173 regenerate_deps
    174 generate_dependency_tree
    175 generate_TARGET_xml
    176 generate_target_book
    177 create_build_scripts "${SUDO}"
    178 clean_configuration
     145
     146rm -rf $DepDir
     147mkdir $DepDir
     148generate_deps $DepDir
     149pushd $DepDir > /dev/null
     150set +e
     151generate_dependency_tree root.dep
     152echo
     153LIST="$(tree_browse root.dep)"
     154set -e
     155popd > /dev/null
     156rm -f ${BookXml}
     157echo Making XML book
     158xsltproc --stringparam list "$LIST" \
     159         -o ${BookXml} \
     160         ${MakeBook} \
     161         $BLFS_FULL
     162echo "making HTML book (may take some time...)"
     163xsltproc -o ${BookHtml}/ \
     164         -stringparam chunk.quietly 1 \
     165         ${BLFS_XML}/stylesheets/blfs-chunked.xsl \
     166         ${BookXml}
     167if [ ! -d ${BookHtml}/stylesheets ]
     168  then mkdir -p ${BookHtml}/stylesheets
     169  cp ${BLFS_XML}/stylesheets/lfs-xsl/*.css book-html/stylesheets
     170fi
     171if [ ! -d ${BookHtml}/images ]
     172  then mkdir -p ${BookHtml}/images
     173  cp ${BLFS_XML}/images/*.png book-html/images
     174fi
     175for ht in ${BookHtml}/*.html
     176  do sed -i 's@../stylesheets@stylesheets@' $ht
     177  sed -i 's@../images@images@' $ht
     178done
     179echo -en "\n\tGenerating the build scripts ..."
     180rm -rf scripts
     181xsltproc --xinclude --nonet \
     182         --stringparam sudo $SUDO \
     183         -o ./scripts/ ${MakeScripts} \
     184         ${BookXml}
     185# Make the scripts executable.
     186chmod -R +x scripts
     187echo -e "done\n"
     188
     189#clean_configuration
  • BLFS/libs/func_dependencies

    r0216209 r63fc514  
    33# $Id$
    44#
    5 set -e
    65
    7 declare -i cntr=0
     6# A string of spaces for indenting:
    87declare -a spaceSTR="                                                                   "
     8declare -a exchange_triplet
     9
     10# In case we find a cirdular dependency, it has the form :
     11# parent->dependency_0->...->dependency_n->dependency_0
     12# If we want to build dependency_n before dependency_0,
     13# no problem: we just prune the tree at dependency_n.
     14# If we want to build first dependency_0, we need to
     15# put dependency_n as a dependency of parent. The triplet
     16# above shall contain (parent dependency_0 dependency_n)
    917
    1018#----------------------------#
     
    1220#----------------------------#
    1321: <<inline_doc
    14     function:   Create a dependency tree for the TARGET
    15     input vars: none
    16     externals:  vars: TARGET
    17                       PKGXML
     22    function:   Create a subtree of the dependency tree
     23                (recursive function)
     24    input vars: $1 : file with a list of targets
     25                     the first line of the file is an array
     26                     of links
     27    externals:  vars: BLFS_XML
    1828                      DEP_LEVEL
    19                 func: do_dependencies
    20     modifies:   vars: PKGXML
    21                       BLFS_XML
     29    modifies:   vars: none
    2230    returns:    nothing
    23     output:     files: $TARGET.dep
    24                        $TARGET-index.xml.tmp
    25                        depure.txt
     31    output:     files: for each pkg with dependencies in $1,
     32                       a file pkg.dep and its dependencies
    2633    on error:   nothing
    2734    on success: nothing
    2835inline_doc
    2936
    30   local ENTRY_START
    31   local ENTRY_END
     37local DepFile=$1
     38local -a rootlink
     39local -a otherlink
     40local -i depth
     41local -i count=0
     42local id_of_dep
     43local parent
     44local lines_to_remove=
     45local srootlink
     46local dep_level
    3247
    33   #---------------------
    34   # Create the working directory and cd into it
    35   if [[ -d $TARGET ]] ; then
    36     echo -e "\tERROR: Looks like $TARGET has been already processed."
    37     echo -e "\tPlease delete or rename the $TARGET directory.\n"
    38     exit 1
    39   else
    40     mkdir $TARGET && cd $TARGET
     48{
     49# BEWARE : the order of options matters : read -a -u6 rootlink hangs forever
     50# (actually, the doc says -a array -u fd)
     51# We use fd number 6 for input from DepFile, because we need 0 for user input
     52read -u6 -a rootlink
     53depth=${#rootlink[*]}
     54dep_level=$DEP_LEVEL
     55if (( $DEP_LEVEL > 2 )) && (( $depth > 1 )); then dep_level=2; fi
     56srootlink="${rootlink[*]} "
     57# start of Depfile
     58echo -en "\nNode: $depth${spaceSTR:0:$depth}${RED}$DepFile${OFF}"
     59
     60while read -u6 id_of_dep; do
     61# count entries in file
     62  (( count++ ))
     63# Has this entry already been seen?
     64  if [ -f ${id_of_dep}.dep ]; then # found ${id_of_dep}.dep already in tree
     65    otherlink=($(head -n 1 ${id_of_dep}.dep))
     66    if [ -z "${otherlink[*]}" ]
     67      then echo otherlink empty for $id_of_dep.dep
     68      echo This should not happen, but happens to happen...
     69      exit 1
     70    fi
     71# Do not use "${rootlink[*]}" =~ "${otherlink[*]}": case rootlink=(1 11)
     72# and otherlink=(1 1)
     73    if [[ ${srootlink#"${otherlink[*]} "} != ${srootlink} ]]; then # circular dep
     74# First look for the other parent of this dependency.
     75# The parent has the same link without the last entry.
     76# We do not need otherlink anymore so just destroy the last element
     77      unset otherlink[${#otherlink[*]}-1]
     78      parent=$(grep ^"${otherlink[*]}"\$ -l *)
     79      parent=${parent%.dep}
     80      echo -en "\nCirc: $depth${spaceSTR:0:$depth}${BLUE}Circular dependency detected:${OFF}"
     81      echo -en "\nCirc: $depth${spaceSTR:0:$depth}${BOLD}${id_of_dep}${OFF} is a dependency \
     82of ${BOLD}${parent}${OFF}"
     83      echo -en "\nCirc: $depth${spaceSTR:0:$depth}${BOLD}${DepFile%.dep}${OFF} is a dependency \
     84of ${BOLD}${id_of_dep}${OFF}"
     85      echo -en "\nCirc: $depth${spaceSTR:0:$depth}${BOLD}${id_of_dep}${OFF} is a dependency \
     86of ${BOLD}${DepFile%.dep}${OFF}"
     87# If idofdep is the parent of DepFile, we can exchange them if required
     88#      if grep -q ${DepFile%.dep} ${id_of_dep}.dep; then
     89# we propose exchange always
     90        echo -en "\nCirc: $depth${spaceSTR:0:$depth}Do you want to build ${id_of_dep} first? yes/no (no):"
     91        read ANSWER
     92        if [ x$ANSWER = "xyes" ] ; then  # exchange:
     93# set triplet and return 1
     94          exchange_triplet=($parent $id_of_dep ${DepFile%.dep})
     95          return 1
     96        else # no exchange: prune
     97          lines_to_remove="$lines_to_remove $id_of_dep"
     98        fi
     99#      else
     100#        lines_to_remove="$lines_to_remove $id_of_dep"
     101#      fi
     102    else # not circular: prune
     103      lines_to_remove="$lines_to_remove $id_of_dep"
     104    fi
     105    continue
    41106  fi
     107  flag=true
     108  while [ $flag = true ]; do
     109    flag=false
     110    xsltproc --stringparam dependencies ${dep_level} \
     111        --stringparam idofdep $id_of_dep \
     112        -o ${id_of_dep}.dep \
     113        ../xsl/dependencies.xsl ../packages.xml
    42114
    43   #---------------------
    44   # XML file of the target package
    45   PKGXML=`grep "^$TARGET[[:space:]]" ../packages | cut -f2`
    46 
    47   #---------------------
    48   # The BLFS sources directory.
    49   BLFS_XML=`echo $PKGXML | sed -e 's,/.*,,'`
    50 
    51   if [[ ! -d ../$BLFS_XML ]] ; then
    52     echo -e "\tThe BLFS book sources directory is missing.\n"
    53     echo -e "\tExecution aborted.\n"
    54     cd .. && rmdir $TARGET
    55     exit 1
    56   fi
    57 
    58   #---------------------
    59   # XInclude stuff
    60   ENTRY_START="<xi:include xmlns:xi=\"http://www.w3.org/2003/XInclude\" href=\"../"
    61   ENTRY_END="\"/>"
    62 
    63   echo -e "\tGenerating $TARGET dependencies tree ..."
    64 
    65   mkdir dependencies
    66 
    67   #---------------------
    68   # Create target package dependencies list
    69   case $TARGET in
    70     # Skip the creation when all dependencies are circular.
    71     alsa-lib | cracklib | libexif | unixodbc ) ;;
    72 
    73     # Meta-packages at target level
    74     alsa )
    75       cp ../libs/alsa.dep dependencies/
    76       ;;
    77     gnome-core )
    78       cp ../libs/gnome-core.dep dependencies/
    79       ;;
    80     gnome-full )
    81       cp ../libs/gnome-{core,full}.dep dependencies/
    82       ;;
    83     kde-core )
    84       cp ../libs/kde-core.dep dependencies/
    85       ;;
    86     kde-full )
    87       cp ../libs/kde-{core,full}.dep dependencies/
    88       ;;
    89     kde-koffice )
    90       cp ../libs/kde-{core,full,koffice}.dep dependencies/
    91       ;;
    92     xorg7 )
    93       cp ../libs/xorg7.dep dependencies/
    94       ;;
    95     * ) # Default
    96       xsltproc --stringparam dependencies $DEP_LEVEL \
    97                -o dependencies/$TARGET.dep \
    98                ../libs/dependencies.xsl ../$PKGXML
    99       ;;
    100   esac
    101 
    102   #---------------------
    103   # Start with a clean $TARGET-index.xml.tmp file
    104   > $TARGET-index.xml.tmp
    105 
    106   #---------------------
    107   # Write the XInclude
    108   case $TARGET in
    109     # If there is no usefull XML page, skip it.
    110     alsa | gnome-core | gnome-full | kde-core | kde-full | kde-koffice | xorg7) ;;
    111     * )
    112       echo -e "    $ENTRY_START$PKGXML$ENTRY_END" >> $TARGET-index.xml.tmp
    113       ;;
    114   esac
    115 
    116   #---------------------
    117   # If have dependencies, write its XInclude and find sub-dependencies
    118   if [[ -f dependencies/$TARGET.dep ]]; then
    119     mkdir xincludes && do_dependencies $TARGET
    120   fi
    121 
    122   echo -e "\n\t... done"
     115    if [[ -f ${id_of_dep}.dep ]]; then
     116      sed -i "1i${rootlink[*]} $count" ${id_of_dep}.dep
     117      generate_dependency_tree ${id_of_dep}.dep
     118# Test return value, in case we exchange dependencies
     119      case $? in
     120       0) # Normal return
     121         ;;
     122       1) # We are backing up to parent
     123         if [[ ${exchange_triplet} == ${DepFile%.dep} ]]
     124           then tree_erase ${id_of_dep}.dep
     125# Just doing a sed -i "s@${id_of_dep}@${exchange_triplet[2]}@" $DepFile
     126# is not good if $DepFile contains several times the same line
     127# so first find the first line and then sed
     128           lineno=$(sed -n /${id_of_dep}/= $DepFile | head -n1)
     129           sed -i "${lineno}s@${id_of_dep}@${exchange_triplet[2]}@" $DepFile
     130           id_of_dep=${exchange_triplet[2]}
     131           flag=true
     132         else
     133# echo backing up to ${exchange_triplet} at ${DepFile%.dep}
     134           return 1
     135         fi
     136         ;;
     137      esac
     138    else
     139      echo "${rootlink[*]} $count" > ${id_of_dep}.dep
     140    fi
     141  done
     142done
     143echo -en "\n End: $depth${spaceSTR:0:$depth}${GREEN}$DepFile${OFF}"
     144} 6<$DepFile
     145# It may happen that a file is created with several times
     146# the same line. Normally, all those lines but one
     147# would be flagged to be removed (or all of them if
     148# the dependency appeared before). a simple sed /$line/d
     149# destroys all the lines. We should instead remove
     150# only one for each appearance of it in lines_to_remove.
     151# so first get the number of first line and then delete
     152# that line
     153for line in $lines_to_remove
     154  do lineno=$(sed -n /^$line\$/= $DepFile | head -n1)
     155  sed -i ${lineno}d $DepFile
     156done
     157return 0
    123158}
    124159
     160#---------------#
     161tree_browse() { #
     162#---------------#
     163local file=$1
     164local f
    125165
     166#echo file=$file
     167for f in $(grep '[^0-9 ]' $file); do
     168#  echo f=$f
     169  if grep -q '[^0-9 ]' ${f}.dep ; then
     170    tree_browse ${f}.dep
     171  fi
     172  echo $f
     173done
     174}
    126175
    127 #-----------------------#
    128 do_dependencies()  {    #  Loop to find sub-dependencies  :::WARNING::: THIS IS A RECURVISE FUNCTION
    129 #-----------------------#
    130 : <<inline_doc
    131     function:   Loop through all the packages and create a sub-dependency tree
    132     input vars: $1, package name
    133     externals:  vars:  $DEP_LEVEL
    134                        $TARGET
    135                        $PRINT_SERVER
    136                        $KBR5
    137                        $GHOSTSCRIPT
    138                        $MAILSERVER
    139                 file:  depure.txt
    140                        $TARGET-index.xml.tmp
    141                        $PKG.dep
    142                        $PKG.inc
    143     modifies:   files
    144     returns:    nothing
    145     output:     file:  $PKG-xinc.tmp
    146                        depure.txt
    147                        $TARGET-index.xml.tmp
    148     on error:   exit
    149     on success:
    150 inline_doc
     176#--------------#
     177tree_erase() { #
     178#--------------#
     179local file=$1
     180local f
     181local -a rootlink
     182local -a rootlink2
    151183
    152   set -e
    153   local PKG=$1
    154   local saveIFS=$IFS
    155   local DEP_LV=$DEP_LEVEL
    156   local line line2 DEP pkg_ver inst_ver
    157 
    158   #------------------
    159   #  If a premade xinclude file exists, use it. If not, create one
    160   if [[ -f xincludes/$PKG.xinc ]] ; then
    161     IFS=$'\x0A'
    162     for line in `cat xincludes/$PKG.xinc` ; do
    163       IFS=$saveIFS
    164       # Remove the Xinclude entry if found. We want the most newer one.
    165       # Using double quotes to let bash expand variables.
    166       # Remove also the empty line created. Can not be done in one step
    167       # due that d requires the pattner between /, but we have a lot of /
    168       # inside the pattner.
    169       sed -e "s,^[[:space:]]*$line,," -e '/./!d' -i $TARGET-index.xml.tmp
    170       # Write the XInclude
    171       echo -e "$line" >> $TARGET-index.xml.tmp
    172     done
    173     return
     184#echo file=$file
     185rootlink=($(head -n1 $file))
     186for f in $(grep '[^0-9 ]' $file); do
     187#  echo "    f"=$f
     188  if [ -f ${f}.dep ]; then
     189    rootlink2=($(head -n1 ${f}.dep))
     190    if [[ "${rootlink2[*]}" =~ "${rootlink[*]}" ]] ; then
     191      tree_erase ${f}.dep
     192    fi
    174193  fi
    175 
    176   #------------------
    177   # Start with a clean $PKG.xinc.tmp file
    178   > xincludes/$PKG.xinc.tmp
    179   for DEP in `cat dependencies/$PKG.dep`; do
    180 
    181     # Special packages that need be remaped
    182     case $DEP in
    183 
    184       db ) continue ;; # The proper version of DB is installed in LFS
    185 
    186         # Don't have their own XML file
    187       hal-requirements | hal-runtime-dependencies ) continue ;;
    188       perl-* | tk-perl )         DEP=perl-modules ;;
    189       dbus-* )                   DEP=dbus-bindings ;;
    190       pyxml | pycairo | pygobject | pygtk | pyorbit | \
    191       gnome-python | gnome-python-desktop ) DEP=python-modules ;;
    192 
    193         # Orphan links (proper link must be created when generating the book)
    194       arts )                     DEP=aRts ;;
    195       kde )                      DEP=kde-core ;;
    196 
    197         # Set values for alternative packages
    198       LPRng | cups )             DEP=$PRINT_SERVER ;;
    199       mitkrb | heimdal )         DEP=$KBR5 ;;
    200       gs | espgs )               DEP=$GHOSTSCRIPT ;;
    201       server-mail )              DEP=$MAIL_SERVER ;;
    202       x-window-system )
    203         case $X11 in
    204           xorg7 ) DEP=xorg7 ;;
    205               * )
    206                   pkg_ver=$(grep "^${X11}[[:space:]]" ../packages | cut -f3)
    207                   inst_ver=$(grep "^${X11}[[:space:]]" ../packages | cut -f4)
    208                   [ -n "${pkg_ver}" ] && [[ "x${pkg_ver}" = "x${inst_ver}" ]] && continue
    209                   [ -n "${pkg_ver}" ] && [[ "x${pkg_ver}" < "x${inst_ver}" ]] && continue
    210                   ;;
    211         esac
    212         ;;
    213     esac
    214 
    215     # If DEP has been previouly installed, skip it
    216     pkg_ver=$(grep "^${DEP}[[:space:]]" ../packages | cut -f3)
    217     inst_ver=$(grep "^${DEP}[[:space:]]" ../packages | cut -f4)
    218     [ -n "${pkg_ver}" ] && [[ "x${pkg_ver}" = "x${inst_ver}" ]] && continue
    219     [ -n "${pkg_ver}" ] && [[ "x${pkg_ver}" < "x${inst_ver}" ]] && continue
    220 
    221     #------------------
    222     # Prevent circular dependencies
    223     # If all dependencies are circular, the creation of the *.dep file
    224     # must be skipped, not placed here, to avoid that the script will bomb
    225     # due empty *.xinc files
    226     case $DEP in
    227       akode )
    228         # Both are in the same page
    229         [[ "$PKG" = "kdemultimedia" ]] && continue
    230         ;;
    231       aRts )
    232         # esound-->aRts-->esound
    233         [[ "$PKG" = "esound" ]] && continue
    234         ;;
    235       dbus-bindings )
    236         # True circular dependecy
    237         [[ "$PKG" = "dbus-bindings" ]] && continue
    238         ;;
    239       DocBook )
    240         # Used to rebuild the documentation
    241         [[ "$PKG" = "linux-pam" ]] && continue
    242         ;;
    243       docbook-xsl )
    244         # Used to rebuild the documentation
    245         [[ "$PKG" = "linux-pam" ]] && continue
    246         ;;
    247       doxygen )
    248         # Used to rebuild the documentation
    249         [[ "$PKG" = "dbus" ]] && continue
    250         [[ "$PKG" = "libdvdcss" ]] && continue
    251         [[ "$PKG" = "libusb" ]] && continue
    252         [[ "$PKG" = "libxcb" ]] && continue
    253         ;;
    254       espgs )
    255         # Used to rebuild the documentation
    256         [[ "$PKG" = "$MAIL_SERVER" ]] && continue
    257         ;;
    258       ffmpeg )
    259         # alsa-plugins-->ffmpeg-->several-->alsa-plugins
    260         [[ "$PKG" = "alsa-plugins" ]] && continue
    261         ;;
    262       fop )
    263         # Used to rebuild the documentation
    264         [[ "$PKG" = "linux-pam" ]] && continue
    265         ;;
    266       graphviz )
    267         # Used to build the API documentation
    268         [[ "$PKG" = "libusb" ]] && continue
    269         ;;
    270       GTK )
    271         # deprecated GTK version
    272         [[ "$PKG" = "alsa-tools" ]] && continue
    273         ;;
    274       gtk2 )
    275         # Testsuite only
    276         [[ "$PKG" = "cairo" ]] && continue
    277         ;;
    278       jadetex )
    279         # Runtime only
    280         [[ "$PKG" = "docbook-utils" ]] && continue
    281         ;;
    282       $KBR5 )
    283         # cyrus-sasl-->postgresql-->$KBR5-->openldap-->cyrus-sasl
    284         [[ "$PKG" = "cyrus-sasl" ]] && continue
    285         ;;
    286       librsvg )
    287         # Testsuite only
    288         [[ "$PKG" = "cairo" ]] && continue
    289         ;;
    290       libxslt )
    291         # libxml2-->libxslt-->libxml2
    292         [[ "$PKG" = "libxml2" ]] && continue
    293         ;;
    294       Links )
    295         # Runtime only
    296         [[ "$PKG" = "docbook-utils" ]] && continue
    297         ;;
    298       lynx )
    299         # Runtime only
    300         [[ "$PKG" = "docbook-utils" ]] && continue
    301         ;;
    302       openldap )
    303         # cyrus-sasl-->postgresql-->$KBR5-->openldap-->cyrus-sasl
    304         [[ "$PKG" = "cyrus-sasl" ]] && continue
    305         ;;
    306       poppler )
    307         # Testsuite only
    308         [[ "$PKG" = "cairo" ]] && continue
    309         ;;
    310       postgresql )
    311         # cyrus-sasl-->postgresql-->$KBR5-->openldap-->cyrus-sasl
    312         [[ "$PKG" = "cyrus-sasl" ]] && continue
    313         ;;
    314       python-modules )
    315         # True circular dependecy
    316         [[ "$PKG" = "python-modules" ]] && continue
    317         # libgsf-->python-modules-->several combinations-->libgsf
    318         [[ "$PKG" = "libgsf" ]] && continue
    319         # gimp-->python-modules-->several combinations-->gimp
    320         [[ "$PKG" = "gimp" ]] && continue
    321         # Used to rebuild the documentation
    322         [[ "$PKG" = "gstreamer" ]] && continue
    323         [[ "$PKG" = "gst-plugins-base" ]] && continue
    324         [[ "$PKG" = "gst-plugins-good" ]] && continue
    325         ;;
    326       tk )
    327         # python-->tk-->xorg7-->several combinations-->libxslt-->python
    328         [[ "$PKG" = "python" ]] && continue
    329         ;;
    330       w3m )
    331         # Runtime only
    332         [[ "$PKG" = "docbook-utils" ]] && continue
    333         # Used to rebuild the documentation
    334         [[ "$PKG" = "linux-pam" ]] && continue
    335         ;;
    336     esac
    337 
    338     #------------------
    339     # XML file of dependency package
    340     DEP_XML=`grep "^$DEP[[:space:]]" ../packages | cut -f2`
    341     case $DEP in
    342       x-window-system | alsa ) ;; # No page for that (proper link must be created when generating the book)
    343       xorg7 ) ;; # This page will be dump in the xorg7.xinc file
    344       gnome-core | kde-core | kde-full ) ;; # Invented packages
    345       * )
    346         # Remove the Xinclude entry if found
    347         sed -e "s,^[[:space:]]*$ENTRY_START$DEP_XML$ENTRY_END,," \
    348             -e '/./!d' -i xincludes/$PKG.xinc.tmp
    349         # Write the XInclude
    350         echo -e "    $ENTRY_START$DEP_XML$ENTRY_END" >> xincludes/$PKG.xinc.tmp
    351         ;;
    352     esac
    353 
    354     #------------------
    355     # If not already created, create its dependencies list
    356     if [[ ! -f dependencies/$DEP.dep ]] ; then
    357       case $DEP in
    358         # Skip the creation when all dependencies are circular.
    359         alsa-lib | cracklib | libexif | unixodbc ) ;;
    360         # Meta-packages at dependency level
    361         alsa )
    362           cp ../libs/alsa.dep dependencies/
    363           ;;
    364         kde-core )
    365           cp ../libs/kde-core.dep dependencies/
    366           ;;
    367         x-window-system ) # When X11 is not Xorg7
    368           echo -e "x-config\nx-setup\n$X11" > dependencies/x-window-system.dep
    369           ;;
    370         xorg7 )
    371           cp ../libs/xorg7.dep dependencies/
    372           ;;
    373         * ) xsltproc --stringparam dependencies $DEP_LV \
    374                -o dependencies/$DEP.dep ../libs/dependencies.xsl ../$DEP_XML
    375           ;;
    376       esac
    377     fi
    378 
    379     #------------------
    380     # If needed, process its dependencies
    381     if [[ -f dependencies/$DEP.dep ]] ; then
    382       # If a premade xinclude file esist, include it
    383       if [[ -f xincludes/$DEP.xinc ]] ; then
    384         IFS=$'\x0A'
    385         for line2 in `cat xincludes/$DEP.xinc` ; do
    386           IFS=$saveIFS
    387           # Remove the Xinclude entry if found
    388           sed -e "s,^[[:space:]]*$line2,," -e '/./!d' -i xincludes/$PKG.xinc.tmp
    389           # Write the XInclude
    390           echo -e "$line2" >> xincludes/$PKG.xinc.tmp
    391         done
    392       #------------------
    393       # Create the xinclude file
    394       else
    395         #
    396         # >>>>>> THIS IS A RECURSIVE FUNCTION CALL.. BEWARE OF GREMLINS. <<<<<<
    397         #
    398         # If the recursion depth is not too great this is an acceptable methodology for a script language
    399         # However, uncontrolled recursion will cause a seg-fault due to stack issues with local variables.
    400         #
    401         set +e
    402          [[ "${VERBOSITY}" > 0 ]] && echo -ne "\ncall: $((++cntr))${spaceSTR:0:$cntr}${RED}$DEP${OFF}"
    403             do_dependencies $DEP
    404          [[ "${VERBOSITY}" > 0 ]] && echo -ne "\n ret: $cntr${spaceSTR:0:$((cntr--))}${GREEN}$DEP${OFF}  Using $DEP Xinc to solve $PKG"
    405         set -e
    406 
    407         # Include it when done
    408         IFS=$'\x0A'
    409         for line2 in `cat xincludes/$DEP.xinc` ; do
    410           IFS=$saveIFS
    411           # Remove the Xinclude entry if found
    412           sed -e "s,^[[:space:]]*$line2,," -e '/./!d' -i xincludes/$PKG.xinc.tmp
    413           # Write the XInclude
    414           echo -e "$line2" >> xincludes/$PKG.xinc.tmp
    415         done
    416       fi
    417     fi
    418   done
    419 
    420   #------------------
    421   if [[ "$PKG" = "xorg7" ]] ; then
    422     # Add their XInclude
    423     PKG_XML=${BLFS_XML}/x/installing/xorg7.xml
    424     echo -e "    $ENTRY_START$PKG_XML$ENTRY_END" >> xincludes/$PKG.xinc.tmp
    425   fi
    426 
    427   #------------------
    428   mv xincludes/$PKG.xinc.tmp xincludes/$PKG.xinc
    429   IFS=$'\x0A'
    430   for line in `cat xincludes/$PKG.xinc` ; do
    431     IFS=$saveIFS
    432     # Remove the Xinclude entry if found.
    433     sed -e "s,^[[:space:]]*$line,," -e '/./!d' -i $TARGET-index.xml.tmp
    434     # Write the XInclude
    435     echo -e "$line" >> $TARGET-index.xml.tmp
    436   done
     194done
     195rm -f $file
    437196}
  • BLFS/xsl/scripts.xsl

    r0216209 r63fc514  
    66    version="1.0">
    77
    8 <!-- $Id$ -->
     8<!-- $Id: scripts.xsl 34 2012-02-21 16:05:09Z labastie $ -->
    99
    1010<!-- XSLT stylesheet to create shell scripts from "linear build" BLFS books. -->
     
    2020
    2121  <xsl:template match="sect1">
    22     <xsl:if test="(count(descendant::screen/userinput) &gt; 0 and
    23                   count(descendant::screen/userinput) &gt;
    24                   count(descendant::screen[@role='nodump'])) and
    25                   @id != 'locale-issues' and @id != 'xorg7' and
    26                   @id != 'x-setup'">
    27 
     22
     23    <xsl:if test="@id != 'bootscripts'">
    2824        <!-- The file names -->
    2925      <xsl:variable name="filename" select="@id"/>
    30 
    31         <!-- Package name (use "Download FTP" by default. If empty, use "Download HTTP" -->
    32       <xsl:variable name="package">
    33         <xsl:choose>
    34           <xsl:when
    35             test="string-length(sect2[@role='package']/itemizedlist/listitem[2]/para/ulink/@url)
    36             &gt; '10'">
    37             <xsl:call-template name="package_name">
    38               <xsl:with-param name="url"
    39                 select="sect2[@role='package']/itemizedlist/listitem[2]/para/ulink/@url"/>
    40             </xsl:call-template>
    41           </xsl:when>
    42           <xsl:otherwise>
    43             <xsl:call-template name="package_name">
    44               <xsl:with-param name="url"
    45                 select="sect2[@role='package']/itemizedlist/listitem[1]/para/ulink/@url"/>
    46             </xsl:call-template>
    47           </xsl:otherwise>
    48         </xsl:choose>
    49       </xsl:variable>
    50 
    51         <!-- FTP dir name -->
    52       <xsl:variable name="ftpdir">
    53         <xsl:call-template name="ftp_dir">
    54           <xsl:with-param name="package" select="$package"/>
    55         </xsl:call-template>
    56       </xsl:variable>
    5726
    5827        <!-- The build order -->
     
    7746      <xsl:message>
    7847        <xsl:text>SCRIPT is </xsl:text>
    79         <xsl:value-of select="concat($order,'-',$filename)"/>
    80         <xsl:text>&#xA;   PACKAGE is </xsl:text>
    81         <xsl:value-of select="$package"/>
     48        <xsl:value-of select="concat($order,'-z-',$filename)"/>
    8249        <xsl:text>&#xA;    FTPDIR is </xsl:text>
    83         <xsl:value-of select="$ftpdir"/>
     50        <xsl:value-of select="$filename"/>
    8451        <xsl:text>&#xA;&#xA;</xsl:text>
    8552      </xsl:message>
     
    9562                          @id = 'xorg7-proto' or @id = 'xorg7-util')">
    9663            <!-- Variables -->
     64            <!-- These three lines  could be important if SRC_ARCHIVE,
     65                 FTP_SERVER and SRCDIR were not set in the environment.
     66                 But they are not tested for length or anything later,
     67                 so not needed
    9768            <xsl:text>SRC_ARCHIVE=$SRC_ARCHIVE&#xA;</xsl:text>
    98             <xsl:text>FTP_SERVER=$FTP_SERVER&#xA;&#xA;PACKAGE=</xsl:text>
    99             <xsl:value-of select="$package"/>
     69            <xsl:text>FTP_SERVER=$FTP_SERVER&#xA;</xsl:text>
     70            <xsl:text>SRC_DIR=$SRC_DIR&#xA;&#xA;</xsl:text>-->
    10071            <xsl:text>&#xA;PKG_DIR=</xsl:text>
    101             <xsl:value-of select="$ftpdir"/>
    102             <xsl:text>&#xA;SRC_DIR=$SRC_DIR&#xA;&#xA;</xsl:text>
     72            <xsl:value-of select="$filename"/>
     73            <xsl:text>&#xA;</xsl:text>
    10374            <!-- Download code and build commands -->
    104             <xsl:apply-templates select="sect2">
    105               <xsl:with-param name="package" select="$package"/>
    106               <xsl:with-param name="ftpdir" select="$ftpdir"/>
    107             </xsl:apply-templates>
     75            <xsl:apply-templates select="sect2"/>
    10876            <!-- Clean-up -->
    109             <xsl:if test="not(@id='mesalib')">
     77            <!-- xorg7-server used to require mesalib tree being present.
     78                 That is no more true
     79            <xsl:if test="not(@id='mesalib')"> -->
    11080              <xsl:text>cd $SRC_DIR/$PKG_DIR&#xA;</xsl:text>
    11181              <xsl:text>rm -rf $UNPACKDIR unpacked&#xA;&#xA;</xsl:text>
     82            <!-- Same reason as preceding comment
    11283            </xsl:if>
    11384            <xsl:if test="@id='xorg7-server'">
     
    11586UNPACKDIR=`head -n1 unpacked | sed 's@^./@@;s@/.*@@'`
    11687rm -rf $UNPACKDIR unpacked&#xA;&#xA;</xsl:text>
    117             </xsl:if>
     88            </xsl:if> -->
    11889          </xsl:when>
    11990          <!-- Xorg7 pseudo-packages -->
    12091          <xsl:when test="contains(@id,'xorg7') and not(@id = 'xorg7-server')">
    121             <xsl:text>SRC_DIR=$SRC_DIR
     92            <xsl:text># Useless SRC_DIR=$SRC_DIR
    12293
    12394cd $SRC_DIR
     
    133104        <xsl:text>exit</xsl:text>
    134105      </exsl:document>
    135 
    136106    </xsl:if>
    137107  </xsl:template>
     
    140110
    141111  <xsl:template match="sect2">
    142     <xsl:param name="package" select="foo"/>
    143     <xsl:param name="ftpdir" select="foo"/>
    144112    <xsl:choose>
    145113      <xsl:when test="@role = 'package'">
    146114        <xsl:text>mkdir -p $SRC_DIR/$PKG_DIR&#xA;</xsl:text>
    147115        <xsl:text>cd $SRC_DIR/$PKG_DIR&#xA;</xsl:text>
    148         <xsl:apply-templates select="itemizedlist/listitem/para">
    149           <xsl:with-param name="package" select="$package"/>
    150           <xsl:with-param name="ftpdir" select="$ftpdir"/>
    151         </xsl:apply-templates>
     116        <xsl:apply-templates select="bridgehead[@renderas='sect3']"/>
    152117        <xsl:text>&#xA;</xsl:text>
    153118      </xsl:when>
     
    168133      </xsl:when>
    169134      <xsl:when test="@role = 'configuration'">
    170         <xsl:apply-templates select=".//screen"/>
    171         <xsl:text>&#xA;</xsl:text>
     135        <xsl:apply-templates select=".//screen" mode="config"/>
    172136      </xsl:when>
    173137    </xsl:choose>
     
    180144      </xsl:when>
    181145      <xsl:when test="not(@role)">
    182         <xsl:text>SRC_ARCHIVE=$SRC_ARCHIVE
    183 FTP_SERVER=$FTP_SERVER&#xA;</xsl:text>
     146<!-- Useless        <xsl:text>SRC_ARCHIVE=$SRC_ARCHIVE
     147FTP_SERVER=$FTP_SERVER&#xA;</xsl:text> -->
    184148        <xsl:apply-templates select=".//screen" mode="sect-ver"/>
    185149        <xsl:text>mkdir -p ${section}&#xA;cd ${section}&#xA;</xsl:text>
     
    196160      cp $SRC_ARCHIVE/${line} ${line}
    197161    else
    198       wget ${FTP_SERVER}conglomeration/Xorg/${line} || \
    199       wget http://xorg.freedesktop.org/releases/individual/${section}/${line}
     162      wget -T 30 -t 5 ${FTP_X_SERVER}pub/individual/${section}/${line} || \
     163      wget -T 30 -t 5 http://xorg.freedesktop.org/releases/individual/${section}/${line}
    200164    fi
    201165  fi
     
    246210            <xsl:value-of select="substring-before($sub-url,'?')"/>
    247211          </xsl:when>
    248           <xsl:when test="contains($sub-url,'.patch')"/>
     212<!-- Should never happen
     213          <xsl:when test="contains($sub-url,'.patch')"/> -->
    249214          <xsl:otherwise>
    250215            <xsl:value-of select="$sub-url"/>
     
    255220  </xsl:template>
    256221
    257   <xsl:template name="ftp_dir">
    258     <xsl:param name="package" select="foo"/>
    259     <!-- A lot of hardcoded dir names. Not full revised yet. -->
    260     <xsl:choose>
    261         <!-- cdparanoia -->
    262       <xsl:when test="contains($package, '-III')">
    263         <xsl:text>cdparanoia</xsl:text>
    264       </xsl:when>
    265         <!-- DobBook 3.1 -->
    266       <xsl:when test="contains($package, 'docbk31')">
    267         <xsl:text>docbk</xsl:text>
    268       </xsl:when>
    269         <!-- gc -->
    270       <xsl:when test="contains($package, 'gc6')">
    271         <xsl:text>gc</xsl:text>
    272       </xsl:when>
    273         <!-- ISO-codes -->
    274       <xsl:when test="contains($package, 'iso-codes')">
    275         <xsl:text>iso-codes</xsl:text>
    276       </xsl:when>
    277         <!-- JPEG -->
    278       <xsl:when test="contains($package, 'jpegsrc')">
    279         <xsl:text>jpeg</xsl:text>
    280       </xsl:when>
    281         <!-- lynx -->
    282       <xsl:when test="contains($package, 'lynx')">
    283         <xsl:text>lynx</xsl:text>
    284       </xsl:when>
    285         <!-- ntp -->
    286       <xsl:when test="contains($package, 'ntp')">
    287         <xsl:text>ntp</xsl:text>
    288       </xsl:when>
    289         <!-- OpenLDAP -->
    290       <xsl:when test="contains($package, 'openldap')">
    291         <xsl:text>openldap</xsl:text>
    292       </xsl:when>
    293         <!-- Open Office -->
    294       <xsl:when test="contains($package, 'OOo')">
    295         <xsl:text>OOo</xsl:text>
    296       </xsl:when>
    297         <!-- pine -->
    298       <xsl:when test="contains($package, 'pine')">
    299         <xsl:text>pine</xsl:text>
    300       </xsl:when>
    301         <!-- portmap -->
    302       <xsl:when test="contains($package, 'portmap')">
    303         <xsl:text>portmap</xsl:text>
    304       </xsl:when>
    305         <!-- psutils -->
    306       <xsl:when test="contains($package, 'psutils')">
    307         <xsl:text>psutils</xsl:text>
    308       </xsl:when>
    309         <!-- qpopper -->
    310       <xsl:when test="contains($package, 'qpopper')">
    311         <xsl:text>qpopper</xsl:text>
    312       </xsl:when>
    313         <!-- QT -->
    314       <xsl:when test="contains($package, 'qt-x')">
    315         <xsl:text>qt-x11-free</xsl:text>
    316       </xsl:when>
    317         <!-- sendmail -->
    318       <xsl:when test="contains($package, 'sendmail')">
    319         <xsl:text>sendmail</xsl:text>
    320       </xsl:when>
    321         <!-- Slib -->
    322       <xsl:when test="contains($package, 'slib')">
    323         <xsl:text>slib</xsl:text>
    324       </xsl:when>
    325         <!-- TCL -->
    326       <xsl:when test="contains($package, 'tcl')">
    327         <xsl:text>tcl</xsl:text>
    328       </xsl:when>
    329         <!-- tcpwrappers -->
    330       <xsl:when test="contains($package, 'tcp_wrappers')">
    331         <xsl:text>tcp_wrappers</xsl:text>
    332       </xsl:when>
    333         <!-- TeTeX -->
    334       <xsl:when test="contains($package, 'tetex')">
    335         <xsl:text>tetex</xsl:text>
    336       </xsl:when>
    337         <!-- Tidy -->
    338       <xsl:when test="contains($package, 'tidy')">
    339         <xsl:text>tidy</xsl:text>
    340       </xsl:when>
    341         <!-- Tk -->
    342       <xsl:when test="contains($package, 'tk8')">
    343         <xsl:text>tk</xsl:text>
    344       </xsl:when>
    345         <!-- unzip -->
    346       <xsl:when test="contains($package, 'unzip')">
    347         <xsl:text>unzip</xsl:text>
    348       </xsl:when>
    349         <!-- wireless_tools -->
    350       <xsl:when test="contains($package, 'wireless_tools')">
    351         <xsl:text>wireless_tools</xsl:text>
    352       </xsl:when>
    353         <!-- whois -->
    354       <xsl:when test="contains($package, 'whois')">
    355         <xsl:text>whois</xsl:text>
    356       </xsl:when>
    357         <!-- XOrg -->
    358       <xsl:when test="contains($package, 'X11R6')">
    359         <xsl:text>Xorg</xsl:text>
    360       </xsl:when>
    361         <!-- zip -->
    362       <xsl:when test="contains($package, 'zip2')">
    363         <xsl:text>zip</xsl:text>
    364       </xsl:when>
    365         <!-- General rule -->
    366       <xsl:otherwise>
    367         <xsl:variable name="cut"
    368           select="translate(substring-after($package, '-'), '0123456789', '0000000000')"/>
    369         <xsl:variable name="package2">
    370           <xsl:value-of select="substring-before($package, '-')"/>
    371           <xsl:text>-</xsl:text>
    372           <xsl:value-of select="$cut"/>
     222  <xsl:template match="bridgehead">
     223    <xsl:choose>
     224      <xsl:when test="string()='Package Information'">
     225        <xsl:variable name="url">
     226          <xsl:choose>
     227            <xsl:when
     228              test="string-length(
     229                following-sibling::itemizedlist[1]/listitem[1]/para/ulink/@url)
     230                    &gt; 10">
     231              <xsl:value-of select=
     232            "following-sibling::itemizedlist[1]/listitem[1]/para/ulink/@url"/>
     233            </xsl:when>
     234            <xsl:otherwise>
     235              <xsl:value-of select=
     236            "following-sibling::itemizedlist[1]/listitem[2]/para/ulink/@url"/>
     237            </xsl:otherwise>
     238          </xsl:choose>
    373239        </xsl:variable>
    374         <xsl:value-of select="substring-before($package2, '-0')"/>
    375       </xsl:otherwise>
    376     </xsl:choose>
    377   </xsl:template>
    378 
    379   <xsl:template match="itemizedlist/listitem/para">
    380     <xsl:param name="package" select="foo"/>
    381     <xsl:param name="ftpdir" select="foo"/>
    382     <xsl:choose>
    383       <!-- This depend on all package pages having both "Download HTTP" and "Download FTP" lines -->
    384       <xsl:when test="contains(string(),'HTTP')">
    385         <xsl:text>if [[ ! -f $PACKAGE ]] ; then&#xA;</xsl:text>
     240        <xsl:variable name="package">
     241          <xsl:call-template name="package_name">
     242            <xsl:with-param name="url" select="$url"/>
     243          </xsl:call-template>
     244        </xsl:variable>
     245        <xsl:variable
     246          name="first_letter"
     247          select="translate(substring($package,1,1),
     248                            'ABCDEFGHIJKLMNOPQRSTUVWXYZ',
     249                            'abcdefghijklmnopqrstuvwxyz')"/>
     250        <xsl:text>PACKAGE=</xsl:text>
     251        <xsl:value-of select="$package"/>
     252        <xsl:text>&#xA;if [[ ! -f $PACKAGE ]] ; then&#xA;</xsl:text>
    386253        <!-- SRC_ARCHIVE may have subdirectories or not -->
    387254        <xsl:text>  if [[ -f $SRC_ARCHIVE/$PKG_DIR/$PACKAGE ]] ; then&#xA;</xsl:text>
     
    390257        <xsl:text>    cp $SRC_ARCHIVE/$PACKAGE $PACKAGE&#xA;  else&#xA;</xsl:text>
    391258        <!-- The FTP_SERVER mirror -->
    392         <xsl:text>    wget ${FTP_SERVER}conglomeration/$PKG_DIR/$PACKAGE</xsl:text>
     259        <xsl:text>    wget -T 30 -t 5 ${FTP_SERVER}svn/</xsl:text>
     260        <xsl:value-of select="$first_letter"/>
     261        <xsl:text>/$PACKAGE</xsl:text>
     262        <xsl:apply-templates
     263             select="following-sibling::itemizedlist[1]/listitem/para"
     264             mode="package"/>
     265      </xsl:when>
     266      <xsl:when test="string()='Additional Downloads'">
     267        <xsl:apply-templates
     268             select="following-sibling::itemizedlist[1]/listitem/para"
     269             mode="additional"/>
     270      </xsl:when>
     271      <xsl:otherwise/>
     272    </xsl:choose>
     273  </xsl:template>
     274
     275  <xsl:template match="para" mode="package">
     276    <xsl:choose>
     277      <xsl:when test="contains(string(),'HTTP')">
    393278        <!-- Upstream HTTP URL -->
    394279        <xsl:if test="string-length(ulink/@url) &gt; '10'">
    395           <xsl:text> || \&#xA;    wget </xsl:text>
     280          <xsl:text> || \&#xA;    wget -T 30 -t 5 </xsl:text>
    396281          <xsl:choose>
    397282            <xsl:when test="contains(ulink/@url,'?')">
     
    402287            </xsl:otherwise>
    403288          </xsl:choose>
     289          <xsl:if test="not(contains(string(parent::listitem/following-sibling::listitem[1]/para),'FTP'))">
     290            <xsl:text>&#xA;  fi&#xA;fi&#xA;</xsl:text>
     291          </xsl:if>
    404292        </xsl:if>
    405293      </xsl:when>
     
    407295        <!-- Upstream FTP URL -->
    408296        <xsl:if test="string-length(ulink/@url) &gt; '10'">
    409           <xsl:text> || \&#xA;    wget </xsl:text>
     297          <xsl:text> || \&#xA;    wget -T 30 -t 5 </xsl:text>
    410298          <xsl:value-of select="ulink/@url"/>
    411299        </xsl:if>
     
    417305        <xsl:text>&#x20;&#x20;$PACKAGE" | md5sum -c -&#xA;</xsl:text>
    418306      </xsl:when>
    419       <!-- Patches -->
     307    </xsl:choose>
     308  </xsl:template>
     309
     310  <xsl:template match="para" mode="additional">
     311    <xsl:choose>
    420312      <xsl:when test="contains(string(ulink/@url),'.patch')">
    421         <xsl:text>wget </xsl:text>
     313        <xsl:text>wget -T 30 -t 5 </xsl:text>
    422314        <xsl:value-of select="ulink/@url"/>
    423315        <xsl:text>&#xA;</xsl:text>
     316      </xsl:when>
     317      <xsl:when test="ulink">
     318        <xsl:if test="string-length(ulink/@url) &gt; '10'">
     319          <xsl:variable name="package">
     320            <xsl:call-template name="package_name">
     321              <xsl:with-param name="url" select="ulink/@url"/>
     322            </xsl:call-template>
     323          </xsl:variable>
     324          <xsl:variable
     325            name="first_letter"
     326            select="translate(substring($package,1,1),
     327                              'ABCDEFGHIJKLMNOPQRSTUVWXYZ',
     328                              'abcdefghijklmnopqrstuvwxyz')"/>
     329          <xsl:text>PACKAGE1=</xsl:text>
     330          <xsl:value-of select="$package"/>
     331          <xsl:text>&#xA;if [[ ! -f $PACKAGE1 ]] ; then&#xA;</xsl:text>
     332          <!-- SRC_ARCHIVE may have subdirectories or not -->
     333          <xsl:text>  if [[ -f $SRC_ARCHIVE/$PKG_DIR/$PACKAGE1 ]] ; then&#xA;</xsl:text>
     334          <xsl:text>    cp $SRC_ARCHIVE/$PKG_DIR/$PACKAGE1 $PACKAGE1&#xA;</xsl:text>
     335          <xsl:text>  elif [[ -f $SRC_ARCHIVE/$PACKAGE1 ]] ; then&#xA;</xsl:text>
     336          <xsl:text>    cp $SRC_ARCHIVE/$PACKAGE1 $PACKAGE1&#xA;  else&#xA;</xsl:text>
     337          <!-- The FTP_SERVER mirror -->
     338          <xsl:text>    wget -T 30 -t 5 ${FTP_SERVER}blfs/svn/</xsl:text>
     339          <xsl:value-of select="$first_letter"/>
     340          <xsl:text>/$PACKAGE1</xsl:text>
     341          <xsl:text> || \&#xA;    wget -T 30 -t 5 </xsl:text>
     342          <xsl:value-of select="ulink/@url"/>
     343          <xsl:text>&#xA;  fi&#xA;fi&#xA;</xsl:text>
     344        </xsl:if>
     345      </xsl:when>
     346      <xsl:when test="contains(string(),'MD5')">
     347        <xsl:text>echo "</xsl:text>
     348        <xsl:value-of select="substring-after(string(),'sum: ')"/>
     349        <xsl:text>&#x20;&#x20;$PACKAGE1" | md5sum -c -&#xA;</xsl:text>
    424350      </xsl:when>
    425351    </xsl:choose>
     
    429355    <xsl:if test="contains(string(ulink/@url),'.md5') or
    430356                  contains(string(ulink/@url),'.wget')">
    431       <xsl:text>wget </xsl:text>
     357      <xsl:text>wget -T 30 -t 5 </xsl:text>
    432358      <xsl:value-of select="ulink/@url"/>
    433359      <xsl:text>&#xA;</xsl:text>
     
    437363  <xsl:template match="itemizedlist/listitem/para" mode="xorg7-patch">
    438364    <xsl:if test="contains(string(ulink/@url),'.patch')">
    439       <xsl:text>wget </xsl:text>
     365      <xsl:text>wget -T 30 -t 5 </xsl:text>
    440366      <xsl:value-of select="ulink/@url"/>
    441367      <xsl:text>&#xA;</xsl:text>
     
    458384  </xsl:template>
    459385
     386  <xsl:template match="screen" mode="config">
     387    <xsl:if test="preceding-sibling::para[1]/xref[@linkend='bootscripts']">
     388      <xsl:text>[[ ! -d $SRC_DIR/blfs-bootscripts ]] &amp;&amp; mkdir $SRC_DIR/blfs-bootscripts
     389pushd $SRC_DIR/blfs-bootscripts
     390URL=</xsl:text>
     391      <xsl:value-of select="id('bootscripts')//itemizedlist//ulink/@url"/><xsl:text>
     392BOOTPACKG=$(basename $URL)
     393[[ ! -f "$BOOTPACKG" ]] &amp;&amp; { wget -T 30 -t 5 $URL; rm -f unpacked; }
     394if [[ -e unpacked ]] ; then
     395  UNPACKDIR=`head -n1 unpacked | sed 's@^./@@;s@/.*@@'`
     396  if ! [[ -d $UNPACKDIR ]]; then
     397    rm unpacked
     398    tar -xvf $BOOTPACKG > unpacked
     399    UNPACKDIR=`head -n1 unpacked | sed 's@^./@@;s@/.*@@'`
     400  fi
     401else
     402  tar -xvf $BOOTPACKG > unpacked
     403  UNPACKDIR=`head -n1 unpacked | sed 's@^./@@;s@/.*@@'`
     404fi
     405cd $UNPACKDIR
     406</xsl:text>
     407    </xsl:if>
     408    <xsl:apply-templates select='.'/>
     409    <xsl:if test="preceding-sibling::para[1]/xref[@linkend='bootscripts']">
     410      <xsl:text>
     411popd</xsl:text>
     412    </xsl:if>
     413    <xsl:text>&#xA;</xsl:text>
     414  </xsl:template>
     415
    460416  <xsl:template match="screen" mode="sect-ver">
    461417    <xsl:text>section=</xsl:text>
     
    482438
    483439  <xsl:template match="replaceable">
     440<!-- Not needed anymore
    484441    <xsl:choose>
    485442      <xsl:when test="ancestor::sect1[@id='xorg7-server']">
    486443        <xsl:text>$SRC_DIR/MesaLib</xsl:text>
    487444      </xsl:when>
    488       <xsl:otherwise>
     445      <xsl:otherwise> -->
    489446        <xsl:text>**EDITME</xsl:text>
    490447        <xsl:apply-templates/>
    491448        <xsl:text>EDITME**</xsl:text>
    492       </xsl:otherwise>
    493     </xsl:choose>
     449<!--      </xsl:otherwise>
     450    </xsl:choose> -->
    494451  </xsl:template>
    495452
  • README.BLFS

    r0216209 r63fc514  
    331. INTRODUCTION::
    44
    5      If you want to add blfs-tool support into a xLFS base system build,
     5     If you want to add blfs-tool support into an xLFS base system build,
    66  read the "BLFS_TOOL SUPPORT" section found in the README and be sure
    77  to follow the after-booting installation intructions.
     
    3737  is done in several steps:
    3838
    39   3.1  INSTALLED PACKAGES TRACKING SYSTEM
     39  3.1  INSTALLED PACKAGES TRACKING SYSTEM::
    4040
    4141       This tool includes a very simple tracking system to log which packages
     
    4545    management tool.
    4646
    47        The directory where tracking files will be stored needs to be created
    48     before installing blfs-tool. You can place this directory anywhere, taking
    49     care that the user must have read and write privileges on that directory
    50     and on all files it contains.
    51 
    52        To use the default path set in the installation menu, run as root:
    53 
    54     install -d -m1777 /var/lib/jhalfs/BLFS
     47       The tracking system itself is an XML file: instpkg.xml. It is
     48    initialized when make is first run in blfs_root. It resides in a directory
     49    which is created when needed during the process of building custom tools
     50    or blfs tools, after xLFS. You can specify that directory location in
     51    the blfs tools submenu of jhalfs. You may need to update permissions
     52    and/or ownership of this directory before using the blfs tool.
     53
     54       The default location of the tracking directory is /var/lib/jhalfs/BLFS
    5555
    5656  3.2  BLFS_TOOL INSTALLATION::
    5757
    58        Run "make" to launch the jhalfs menuconfig interface. Select the BLFS
    59     book and version. Then set the installation directory (default
    60     $HOME/blfs_root), the BLFS sources directory (default blfs-xml), and
    61     the installed packages tracking directory (default /var/lib/jhalfs/BLFS).
    62 
    63        All required files will be placed in the installation directory and
    64     BLFS XML sources will be installed in the named sub-directory.
    65 
    66        Installed files:
     58       The tools are installed just after the building of xLFS, if the
     59    appropriate options have been selected in the building menu, as per
     60    jhalfs README. If you forgot to select the options and xLFS has been
     61    built, it is possible to go back to selecting the appropriate
     62    BLFS tools options in the jhalfs menu, then tick `Run makefile'
     63    and not `Rebuild files'. You obtain a /blfs_root directory in the
     64    root directory of the new xLFS system, which contains the followings:
    6765
    6866    blfs-xml/*         SVN tree of the selected BLFS book version
    69     lib/*              functions libraries, xsl stylesheets, and auto-generated
    70                        meta-packages dependencies tree files
     67    lib/*              functions libraries
    7168    menu/*             lxdialog and menuconfig source code
     69    xsl/*              XSL stylesheets used at several stages of the process
    7270    README.BLFS        this file
    73     TODO               developers notes
    74     update_book.sh     update the XML book sources and regenerates packages
    75                        database and meta-packages dependencies tree
    76     gen_config.sh      regenerates Config.in
     71    TODO               developers notes (well, not often updated)
    7772    gen_pkg_book.sh    resolves dependencies and generates linear BLFS books
    7873                       and build scripts
    7974    gen-makefile.sh    generates the target Makefile
    8075    progress_bar.sh    the target Makefile progress bar
    81     Makefile           run gen_config.sh to update Config.in,
    82                        then launch the menuconfig interface, and lastly run
     76    gen-special.sh     Helper script for generating the package database
     77    Makefile           Used by make to update the package database from the SVN
     78                       tree, then launch the menuconfig interface, and run
    8379                       gen_pkg_book.sh based on configuration settings
    84     Config.in          menuconfig interface input file
    85     packages           auto-generated packages database
     80    packages.xml       auto-generated packages database
     81    packdesc.dtd       a simple DTD describing the format of the package
     82                       database
    8683    envars.conf        envars needed when running the target build scripts
    8784
     
    8986    root directory.
    9087
    91        When finished the installation, the configuration and target selection
    92     menu is launch.
     88       You may move that directory to the $HOME of a non root user, or build
     89    as root from that directory.
    9390
    9491  3.3  UPDATING BOOK SOURCES::
     
    9895    update the XML sources and packages database.
    9996
    100        To do that run "./update_book.sh"
     97       To do that run "make update". It may happen that the subversion
     98    version of your building host is older than the version you just
     99    built. This may generate weird errors like "'.' omitted". The easiest
     100    thing to do in that case, is to completely remove the blfs-xml directory
     101    and run "make update".
    101102
    102103       On the next configuration run, packages already installed but listed
     
    107108
    108109       The next step is to create a book and build scripts in dependency
    109     build order for a target package. A target can be a package or a
    110     meta-package.
    111 
    112     WARNING:
    113            Only one target (meta-package or individual package) must be
    114            selected on each configuration run.
    115            There is no way to solve dependencies properly when more
    116            than one target are selected.
     110    build order for one or several packages.
    117111
    118112       Run <make> to launch the configuration interface. The main menu contains
    119     three blocks: meta-package selection, individual package selection, and
    120     build options.
    121 
    122        When a meta-package is selected, it is possible to unselect unwanted
    123     components. The unselected components will be skipped if no other components
    124     depends on them.
     113    two blocks: individual package selection, and build options.
    125114
    126115       In the build options section, the dependencies level and default packages
    127     used to solve alternatives are set. You can also select whether the build will
    128     be made as a normal user or as root. That settings are saved to be reused in
    129     future configuration runs.
    130 
    131        If, for example, your target selection is Xsoft-->Graphweb-->galeon, a
    132     directory named "galeon" will be created. Inside that directory you will
    133     find a directory named "HTML" that contains a galeon-based HTML book with
    134     its dependencies in build order, and a "scripts" directory with build
    135     scripts for that packages.
    136 
    137        There are also two other directories ("dependencies" and "xincludes")
    138     that contain files generated while resolving dependencies trees.
     116    used to solve alternatives are set (currently, only for the mTA). You can
     117    also select whether the build will be made as a normal user or as root.
     118    Those settings are saved to be reused in future configuration runs.
     119
     120       When you are done with the menu, a few checks occur, and the book is
     121    generated. When circular dependencies are found, a 3 line message is
     122    printed:
     123           A is a dependency of B
     124           C is a dependency of A
     125           A is a dependency of C
     126    and a question:
     127           Do you want to build A first?
     128    This means that the system has found the dependency chain: B->A->C->A.
     129    You have therefore to choose whether A is built before C, or
     130    C before A: the system cannot make that choice (well, maybe in a few
     131    year, with an AI system able to understand the book). if you answer no,
     132    C is built first. If you answer yes, C is put in place of A as a dependency
     133    of B, then the tree dependency restarts from there, that is with the
     134    layout B->C->... You may then hit the case B->C->A->C, for which you
     135    should answer no, unless you want to enter an infinite (human driven) loop.
     136
     137       You end up with a book.xml file which contains the linearized book,
     138    and a rendered HTML, in the directory book-html, which you can browse with
     139    "lynx book-html/index.html" (or with any other browser).
     140
     141       Furthermore, there is a directory "scripts", which contains the generated
     142    scriptlets.
     143
     144       There is also another directory, "dependencies" that contains files
     145    generated while resolving dependencies.
    139146
    140147  3.5  EDITING BUILD SCRIPTS
    141148
    142        Now it is time to review the generated book and scripts, making any changes
    143     to the scripts necessary to fix generation bugs or to suit your needs.
     149       Now it is time to review the generated book and scripts, making any
     150    changes to the scripts necessary to fix generation bugs or to suit your
     151    needs.
    144152
    145153       Scripts for additional packages (i.e., for non-BLFS packages) can be
    146154    easily inserted. For example, if you want to install the external dependency
    147155    "bar" before "foo" package and the "foo" script is named "064-z-foo", you
    148     need to create a "064-y-bar" build script.
     156    just need to create a "064-y-bar" build script.
    149157
    150158      Remember, the package tracking system isn't a package management tool
     
    157165
    158166       When the build scripts are ready to be run, the Makefile can be
    159     created. Be sure that you cd into the "package" directory and run
    160     ../gen-makefile.sh
    161 
    162     Review the Makefile, and, if all looks sane, start the build.
     167    created. Create an empty directory (for example "mkdir work") and cd
     168    to that directory. Then run ../gen-makefile.sh
     169
     170    Review the Makefile, and, if all looks sane, start the build by running
     171    "make".
    163172
    1641734. GENERATED BUILD SCRIPTS ISSUES::
    165174
    166175      In this section, known issues with the generated build scripts are
    167    discussed. They are due to build procedures and/or BLFS layout particularities
    168    that we can't handle. In several cases, editing the build scripts is mandatory.
     176   discussed. They are due to build procedures and/or BLFS layout
     177   particularities that we can't handle. In several cases, editing the
     178   build scripts is mandatory.
    169179   You may also need to insert some build scripts created by you to resolve
    170180   unhandled dependencies and/or to remove some script installing the affected
     
    173183   4.1  BLFS BOOTSCRIPTS
    174184
    175         For now, bootscripts installation will fail. You will need to edit
    176      the scripts for packages that install bootscripts and fix their
    177      installation command. That could be fixed in the future.
     185      Normally, bootscript installation should work. On the other hand, the
     186   book does not give instruction for running them, so you might have to
     187   manually insert /etc/init.d/<initscript> at some place during the build.
    178188
    179189   4.2  PACKAGE CONFIGURATION
    180190
    181         For those packages that have a "Configuration" section, you should
    182      edit the build script to fit the needs of your system.
    183 
    184    4.4  PDL, Perl modules, and Glib-Bindings.
    185 
    186         The generated scripts for these packages are broken and can not
    187      be fixed. You must rename it as the sub-package to be installed and
    188      edit it to use the proper commads for that sub-package.
    189 
    190         You may need to create additional scripts for these sub-package
    191      dependencies, if any.
     191      For those packages that have a "Configuration" section, you should
     192   edit the build script to fit the needs of your system. Sometimes, the
     193   bash startup files are modified (see for example the instructions for
     194   llvm). You might have to insert something like "source /etc/bash_profile"
     195   at some point during the build.
    192196
    193197   4.4  GCC, JDK, Sane, and KDE-multimedia, freetype2, MesaLib and others
    194198
    195         On the pages for these packages, the BLFS book actually has instructions
     199        On the pages for those packages, the BLFS book actually has instructions
    196200     to download and install two or more packages. You must edit the scripts to
    197201     fix this.
     
    201205   4.5  XORG7
    202206
    203         The generated scripts for Xorg7 pseudo-packages have $SRC_ARCHIVE
     207        The generated scripts for Xorg7 packages have $SRC_ARCHIVE
    204208     support for individual packages, but not for patches nor *.wget and *.md5
    205209     files.
     
    210214       The *.wget and *.md5 files should be downladed always from inside
    211215     the scripts to be sure that the most current individual packages are
    212      used. Thus don't reuse previouly existing ones.
     216     used. Thus don't reuse previously existing ones.
    213217
    214218       In the script for xorg7-font, be sure to move the fonts directories
  • README.PACKAGE_MANAGEMENT

    r0216209 r63fc514  
    6161  in the pkgmngt subdirectory.
    6262
     633. DETAILED INSTRUCTIONS:
    6364
     65      Before beginning, you should know which package manager you want, where
     66  to get the sources, and how to use it for:
     67  a) Making a package from a directory tree. Usually, there is some control
     68     file containing the version, pacakager, build system (32 or 64 bits at
     69     least) or other more or less usefull but mandatory bits of information
     70     which you should understand.
     71  b) Unpack the package.
     72
     73      Second, you ought to have a basic knowledge of bash scripting and
     74  docbook-xml writing, because you have to write a bash function for packing
     75  and unpacking the package, and a set of instructions to install the PM.
     76 
  • jhalfs

    r0216209 r63fc514  
    438438    # Clean-up
    439439    rm -rf ${BUILDDIR}${BLFS_ROOT}/libs/.svn
     440    rm -rf ${BUILDDIR}${BLFS_ROOT}/xsl/.svn
    440441    rm -rf ${BUILDDIR}${BLFS_ROOT}/menu/.svn
    441442    rm -rf ${BUILDDIR}${BLFS_ROOT}/menu/lxdialog/.svn
    442443    # Set some harcoded envars to their proper values
    443     sed -i 's,blfs-xml,'$BLFS_XML',' ${BUILDDIR}${BLFS_ROOT}/{update_book.sh,libs/book.xsl}
    444     sed -i 's,tracking-dir,'$TRACKING_DIR',' ${BUILDDIR}${BLFS_ROOT}/{update_book.sh,gen-makefile.sh}
     444    sed -i 's,tracking-dir,'$TRACKING_DIR',' ${BUILDDIR}${BLFS_ROOT}/{Makefile,gen-makefile.sh}
    445445    # Copy the dependencies build scripts
    446446    cp -r $COMMON_DIR/blfs-tool-deps $JHALFSDIR/
Note: See TracChangeset for help on using the changeset viewer.