Changeset e576789 for BLFS


Ignore:
Timestamp:
10/29/2013 03:42:03 PM (11 years ago)
Author:
Pierre Labastie <pierre@…>
Branches:
2.4, ablfs-more, legacy, new_features, trunk
Children:
5795ad7
Parents:
2e64c47
Message:

Merge ablfs branch. Normally, jhalfs should not perform differently
for building LFS

Location:
BLFS
Files:
8 added
7 deleted
5 edited

Legend:

Unmodified
Added
Removed
  • BLFS/Makefile

    r2e64c47 re576789  
    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 $
    67
     8ifdef V
     9  Q =
     10else
     11  Q = @
     12endif
     13
     14# Known behavior
    715LANG=C
    816LC_ALL=C
     17
     18# The right-hand side is updated by jhalfs
     19TRACKING_DIR = tracking-dir
    920TOPDIR=$(shell pwd)
    10 CONFIG_CONFIG_IN = Config.in
    11 CONFIG = menu
     21BLFS_XML = $(TOPDIR)/blfs-xml
     22XSLDIR = $(TOPDIR)/xsl
    1223
    13 all:    menuconfig
     24RENDERTMP = $(BLFS_XML)/tmp
     25BLFS_FULL = $(RENDERTMP)/blfs-full.xml
     26PACK_LIST = $(TOPDIR)/packages.xml
     27MENU = $(TOPDIR)/menu
     28CONFIG_CONFIG_IN = $(TOPDIR)/Config.in
     29CONFIG_OUT = $(TOPDIR)/configuration
     30BOOK_XML = $(TOPDIR)/book.xml
     31TRACKFILE = $(TRACKING_DIR)/instpkg.xml
    1432
    15 $(CONFIG)/conf:
    16         $(MAKE) -B -C $(CONFIG) conf
     33define INITIAL_TRACK
     34<?xml version="1.0" encoding="ISO-8859-1"?>\n\
     35\n\
     36<!DOCTYPE sublist SYSTEM "$(TOPDIR)/packdesc.dtd">\n\
     37<sublist>\n\
     38  <name>Installed</name>\n\
     39</sublist>
     40endef
    1741
    18 $(CONFIG)/mconf:
    19         $(MAKE) -B -C $(CONFIG) ncurses conf mconf
     42SVN = svn://svn.linuxfromscratch.org/BLFS/trunk/BOOK
    2043
    21 menuconfig: $(CONFIG)/mconf
    22         @./update_book.sh none
    23         @./gen_config.sh
    24         @$(CONFIG)/mconf $(CONFIG_CONFIG_IN)
    25         @./gen_pkg_book.sh
     44ALLXML := $(filter-out $(RENDERTMP)/%, \
     45        $(wildcard $(BLFS_XML)/*.xml $(BLFS_XML)/*/*.xml $(BLFS_XML)/*/*/*.xml $(BLFS_XML)/*/*/*/*.xml $(BLFS_XML)/*/*/*/*/*.xml))
     46ALLXSL := $(filter-out $(RENDERTMP)/%, \
     47        $(wildcard $(BLFS_XML)/*.xsl $(BLFS_XML)/*/*.xsl $(BLFS_XML)/*/*/*.xsl $(BLFS_XML)/*/*/*/*.xsl $(BLFS_XML)/*/*/*/*/*.xsl))
    2648
    27 config: $(CONFIG)/conf
    28         @$(CONFIG)/conf $(CONFIG_CONFIG_IN)
     49$(BOOK_XML): $(CONFIG_OUT)
     50        $(Q)$(TOPDIR)/gen_pkg_book.sh $(TOPDIR) $(BLFS_FULL)
     51
     52$(CONFIG_OUT): $(CONFIG_CONFIG_IN) $(MENU)/mconf
     53        $(Q)$(MENU)/mconf $(CONFIG_CONFIG_IN)
     54
     55$(MENU)/mconf:
     56        $(Q)$(MAKE) -C $(MENU) ncurses conf mconf
     57
     58$(CONFIG_CONFIG_IN): $(PACK_LIST) $(XSLDIR)/gen_config.xsl
     59        $(Q)xsltproc --nonet -o $@ $(XSLDIR)/gen_config.xsl $(PACK_LIST)
     60
     61$(PACK_LIST): $(XSLDIR)/gen_pkg_list.xsl $(XSLDIR)/specialCases.xsl $(TRACKFILE)
     62        $(Q)xsltproc --stringparam installed-packages $(TRACKFILE) \
     63        -o $@.tmp $(XSLDIR)/gen_pkg_list.xsl $(BLFS_FULL)
     64        $(Q)xmllint --postvalid --format -o $@ $@.tmp
     65        $(Q)rm $@.tmp
     66
     67# Beware of the echo '$(INITIAL_TRACK)' command below:
     68# if shell is bash or sh linked to bash, needs echo -e
     69# if shell is dash or sh linked to dash: echo is enough
     70# Don't ask me why
     71# So use /bin/echo (needs -e)
     72$(TRACKFILE): $(TRACKING_DIR)
     73        $(Q)if ! [ -f $@ ]; then \
     74        echo Initializing $(TRACKFILE) && \
     75        /bin/echo -e '$(INITIAL_TRACK)' > $@ && \
     76        $(MAKE) $(PACK_LIST); \
     77        fi
     78        $(Q)for track in $(TRACKING_DIR)/*-*; do \
     79        if [ -f $$track ]; then \
     80        pack=$$(echo $$track | sed 's@.*/\(.*\)-[0-9c].*@\1@') && \
     81        version=$$(echo $$track | sed 's@.*-\([0-9c].*\)@\1@') && \
     82        xsltproc --stringparam packages $(PACK_LIST) \
     83        --stringparam package $$pack \
     84        --stringparam version $$version \
     85        -o track.tmp $(XSLDIR)/bump.xsl $@ && \
     86        sed -i 's@PACKDESC@$(TOPDIR)/packdesc.dtd@' track.tmp && \
     87        xmllint --format --postvalid track.tmp > $@; \
     88        fi; \
     89        done; \
     90        rm -f track.tmp
     91
     92$(TRACKING_DIR):
     93        @echo Creating $(TRACKING_DIR)
     94        $(Q)mkdir -p $@
     95
     96$(XSLDIR)/specialCases.xsl: $(TOPDIR)/gen-special.sh $(BLFS_FULL)
     97        $(Q)$(TOPDIR)/gen-special.sh $(BLFS_FULL) $@
     98
     99$(BLFS_FULL): $(BLFS_XML) $(BLFS_XML)/general.ent $(ALLXML) $(ALLXSL)
     100        @echo "Validating the book..."
     101        $(Q)[ -d $(RENDERTMP) ] || mkdir -p $(RENDERTMP)
     102        $(Q)xmllint --nonet --noent --xinclude --postvalid \
     103          -o $@ $(BLFS_XML)/index.xml
     104
     105all: update $(BOOK_XML)
     106
     107update: $(BLFS_XML)
     108        @echo Updating the book sources
     109        $(Q)cd $(BLFS_XML) && svn up
     110
     111$(BLFS_XML):
     112        @echo Getting the book sources...
     113        $(Q)svn co $(SVN) $@
    29114
    30115# Clean up
    31116
    32117clean:
    33         rm -f configuration configuration.old error
    34         - $(MAKE) -C $(CONFIG) clean
     118        rm -f $(CONFIG_OUT) $(CONFIG_OUT).old $(TOPDIR)/packages.xml $(XSLDIR)/specialCases.xsl $(CONFIG_CONFIG_IN) book.xml
     119        rm -rf $(TOPDIR)/dependencies $(TOPDIR)/book-html $(TOPDIR)/scripts
     120        - $(MAKE) -C $(MENU) clean
    35121
    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
     122.PHONY: clean all update $(CONFIG_OUT)
  • BLFS/envars.conf

    r2e64c47 re576789  
    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
     
    3941
    4042#--- Configure switches
    41 export XORG_CONFIG="--prefix=$XORG_PREFIX --sysconfdir=/etc --mandir=$XORG_PREFIX/share/man --localstatedir=/var"
     43export XORG_CONFIG="--prefix=$XORG_PREFIX --sysconfdir=/etc \
     44    --localstatedir=/var --disable-static"
    4245
    43 #======== GNOME envars ===========
     46#======== ABOUT GNOME envars =====
     47
     48# Refer to `Chapter 30. Right now, the book hard codes --prefix=/usr
     49# and does not make use of the variables below. If you need another prefix,
     50# You'll have to modifiy the prefix in the book source and use the variables
     51# below. But this is not supported in this tool.
     52
     53#======== LEGACY GNOME envars ====
     54
     55# We use envars.conf instead of /etc/profile.d. But if you
     56# install into a different prefix, you'll need to update ld.so.conf and
     57# man-db.conf, too.
    4458
    4559#--- Installation prefix
    46 export GNOME_PREFIX=/usr
     60# export GNOME_PREFIX=/usr
     61# export GNOME_SYSCONFDIR=/etc/gnome/3.2.2
     62# export XDG_CONFIG_DIRS=$GNOME_SYSCONFDIR/xdg
     63# export XDG_DATA_DIRS=/usr/share:/usr/local/share
    4764
    48 #--- If you want to install GNOME on a non standart prefix, uncomment
     65#--- If you want to install GNOME on a non standard prefix, uncomment
    4966#    the next export lines and edit it if needed.
    5067#    See also the GNOME Pre-installation Configuration HTML page for
     
    5673#======== KDE envars =============
    5774
     75# Refer to `Chapter 27. Introduction->KDE Pre-installation Configuration'
     76# for rationale. We use envars.conf instead of /etc/profile.d. But if you
     77# install into a different prefix, you'll need to update ld.so.conf and
     78# man-db.conf, and to create and populate the directories $KDE_PREFIX/share
     79# and /etc/dbus-1, as instructed.
     80
    5881#--- Installation prefix
    5982export KDE_PREFIX=/usr
    6083
    61 #--- If you want to install KDE on a non standart prefix, uncomment
    62 #    the next export lines and edit it if needed.
    63 #    See also the KDE Pre-installation Configuration HTML page for
    64 #    aditional required commands.
    65 #export PATH=$PATH:$KDE_PREFIX/bin
    66 #export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:$KDE_PREFIX/lib/pkgconfig
     84#--- If you want to install KDE on a non standard prefix, uncomment
     85#    the next lines and edit them as needed.
     86#export KDE_PREFIX=/opt/kde
     87#export KDEDIR=$KDE_PREFIX
    6788
    68 
     89#PATH=$PATH:$KDE_PREFIX/bin
     90#if [ -z PKG_CONFIG_PATH ]; then
     91#export   PKG_CONFIG_PATH=$KDE_PREFIX/lib/pkgconfig:$KDE_PREFIX/share/pkgconfig
     92#else
     93#  PKG_CONFIG_PATH=$PKG_CONFIG_PATH:$KDE_PREFIX/lib/pkgconfig:$KDE_PREFIX/share/pkgconfig
     94#fi
     95#if [ -z XDG_DATA_DIRS ]; then
     96#export   XDG_DATA_DIRS=$KDE_PREFIX/share
     97#else
     98#  XDG_DATA_DIRS=$XDG_DATA_DIRS:$KDE_PREFIX/share
     99#fi
     100#if [ -z XDG_CONFIG_DIRS ]; then
     101#export   XDG_CONFIG_DIRS=/etc/kde/xdg
     102#else
     103#  XDG_CONFIG_DIRS=$XDG_CONFIG_DIRS:/etc/kde/xdg
     104#fi
    69105
    70106#======== Optimizations =============
     
    80116#   asking for support.
    81117
    82 #export MAKEFLAGS="-j3"
     118export MAKEFLAGS="-j5"
    83119
    84120#export CFLAGS="-O3 -pipe"
     
    90126#export OTHER_LDFLAGS=$LDFLAGS
    91127
     128#======== Environment settings ========
     129
     130# Since the startup files may be changed in the course
     131# of a build, ensure that environment variables are
     132# up to date
     133
     134if [ -r /etc/profile ]; then source /etc/profile; fi
  • BLFS/gen-makefile.sh

    r2e64c47 re576789  
    55set -e
    66
    7 # TEMPORARY VARIABLES.. development use only
     7declare TOPDIR='..'
     8declare ATOPDIR=`cd $TOPDIR; 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@${ATOPDIR}/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"
     158if [[ ! -d ${BUILD_SCRIPTS} ]] ; then
     159  echo -e "\n\tThe \'${BUILD_SCRIPTS}\' directory has not been found.\n"
    252160  exit 1
    253161fi
    254162
    255 if [[ ! -d scripts ]] ; then
    256   echo -e "\n\tNo ./scripts/ directory has been found.\n"
    257   exit 1
    258 fi
     163# Let us make a clean base:
     164rm -rf *
    259165
    260166generate_Makefile
    261167
    262 cp ../progress_bar.sh .
     168cp ${TOPDIR}/progress_bar.sh .
    263169
    264170mkdir -p logs
  • BLFS/gen_pkg_book.sh

    r2e64c47 re576789  
    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=* | \
    50       PRINT_SERVER=*  | \
    5146      MAIL_SERVER=*   | \
    52       GHOSTSCRIPT=*   | \
    53       KBR5=*  | \
    54       X11=*   | \
    5547      SUDO=*  )  eval ${REPLY} # Define/set a global variable..
    5648                      continue ;;
     
    5850
    5951    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
     52      echo "$REPLY"
     53      optTARGET[$((cntr++))]=$( echo $REPLY | sed -e 's@CONFIG_@@' -e 's@=y@@' )
    6754    fi
    68   done <$ConfigFile
     55  done < $ConfigFile
    6956
    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"
     57  if (( $cntr == 0 )); then
     58    echo -e "\n>>> NO TARGET SELECTED.. application terminated"
     59    echo -e "    Run <make> again and select (a) package(s) to build\n"
    7360    exit 0
    7461  fi
    75 
    76   TARGET=$optTARGET
     62  TARGET=(${optTARGET[*]})
    7763  DEP_LEVEL=$optDependency
    7864  SUDO=${SUDO:-n}
     
    8369#--------------------------#
    8470  local -r dotSTR=".................."
    85   local -r PARAM_LIST="TARGET DEP_LEVEL SUDO PRINT_SERVER MAIL_SERVER GHOSTSCRIPT KBR5 X11"
     71  local -r PARAM_LIST="DEP_LEVEL SUDO MAIL_SERVER"
    8672  local -r PARAM_VALS='${config_param}${dotSTR:${#config_param}} ${L_arrow}${BOLD}${!config_param}${OFF}${R_arrow}'
    8773  local config_param
     74  local -i index
    8875
    8976  for config_param in ${PARAM_LIST}; do
    9077    echo -e "`eval echo $PARAM_VALS`"
    9178  done
     79  for (( index=0 ; index < ${#TARGET[*]} ; index ++ )); do
     80    echo -e "TARGET${index}${dotSTR:6} ${L_arrow}${BOLD}${TARGET[${index}]}${OFF}${R_arrow}"
     81  done
    9282}
    9383
    9484#
    95 # Regenerate the META-package dependencies from the configuration file
     85# Generates the root of the dependency tree
    9686#
    9787#--------------------------#
    98 regenerate_deps() {        #
     88generate_deps() {        #
    9989#--------------------------#
    10090
    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}
     91  local -i index
     92  local DepDir=$1
     93  rm -f $DepDir/*.dep
     94  echo 1 > $DepDir/root.dep
     95  for (( index=0 ; index < ${#TARGET[*]} ; index ++ )); do
     96    echo ${TARGET[${index}]} >> $DepDir/root.dep
    12297  done
    12398}
     
    132107#--------------------------#
    133108
    134 tail -n 29 configuration > configuration.tmp
    135 mv configuration.tmp configuration
     109tail -n 15 ${ConfigFile} > ${ConfigFile}.tmp
     110mv ${ConfigFile}.tmp ${ConfigFile}
    136111
    137112}
     
    139114#---------------------
    140115# Constants
    141 source libs/constants.inc
     116source ${LibDir}/constants.inc
    142117[[ $? > 0 ]] && echo -e "\n\tERROR: constants.inc did not load..\n" && exit
    143118
    144119#---------------------
    145120# Dependencies module
    146 source libs/func_dependencies
     121source ${LibDir}/func_dependencies
    147122[[ $? > 0 ]] && echo -e "\n\tERROR: func_dependencies did not load..\n" && exit
    148123
    149 #---------------------
    150 # parser module
    151 source libs/func_parser
    152 [[ $? > 0 ]] && echo -e "\n\tERROR: func_parser did not load..\n" && exit
    153 
    154 
    155124#------- MAIN --------
    156 if [[ ! -f packages ]] ; then
     125if [[ ! -f ${PackFile} ]] ; then
    157126  echo -e "\tNo packages file has been found.\n"
    158127  echo -e "\tExecution aborted.\n"
     
    171140fi
    172141echo "${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
     142
     143rm -rf $DepDir
     144mkdir $DepDir
     145generate_deps $DepDir
     146pushd $DepDir > /dev/null
     147set +e
     148generate_dependency_tree root.dep
     149echo
     150LIST="$(tree_browse root.dep)"
     151set -e
     152popd > /dev/null
     153rm -f ${BookXml}
     154echo Making XML book
     155xsltproc --stringparam list "$LIST" \
     156         -o ${BookXml} \
     157         ${MakeBook} \
     158         $BLFS_FULL
     159echo "making HTML book (may take some time...)"
     160xsltproc -o ${BookHtml}/ \
     161         -stringparam chunk.quietly 1 \
     162         ${BLFS_XML}/stylesheets/blfs-chunked.xsl \
     163         ${BookXml}
     164if [ ! -d ${BookHtml}/stylesheets ]
     165  then mkdir -p ${BookHtml}/stylesheets
     166  cp ${BLFS_XML}/stylesheets/lfs-xsl/*.css ${BookHtml}/stylesheets
     167fi
     168if [ ! -d ${BookHtml}/images ]
     169  then mkdir -p ${BookHtml}/images
     170  cp ${BLFS_XML}/images/*.png ${BookHtml}/images
     171fi
     172for ht in ${BookHtml}/*.html
     173  do sed -i 's@../stylesheets@stylesheets@' $ht
     174  sed -i 's@../images@images@' $ht
     175done
     176echo -en "\n\tGenerating the build scripts ...\n"
     177rm -rf scripts
     178xsltproc --xinclude --nonet \
     179         --stringparam sudo $SUDO \
     180         -o ./scripts/ ${MakeScripts} \
     181         ${BookXml}
     182# Make the scripts executable.
     183chmod -R +x scripts
     184echo -e "done\n"
     185
     186#clean_configuration
  • BLFS/libs/func_dependencies

    r2e64c47 re576789  
    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}
Note: See TracChangeset for help on using the changeset viewer.