From 3c10176753145d9f6a955559df6553bb5f05e969 Mon Sep 17 00:00:00 2001 From: Manuel Canales Esparcia Date: Sun, 16 Jul 2006 10:29:37 +0000 Subject: [PATCH] Added new BLFS files from the experimental branch. --- BLFS/TODO | 32 ++++ BLFS/alternatives.conf | 27 +++ BLFS/blfs-parser.sh | 125 ++++++++++++ BLFS/libs/book.xsl | 105 ++++++++++ BLFS/libs/constants.inc | 40 ++++ BLFS/libs/dependencies.xsl | 47 +++++ BLFS/libs/func_dependencies | 371 +++++++++++++++++++++++++++++++++++ BLFS/libs/func_makefile | 149 ++++++++++++++ BLFS/libs/func_packages | 129 +++++++++++++ BLFS/libs/func_parser | 149 ++++++++++++++ BLFS/libs/scripts.xsl | 373 ++++++++++++++++++++++++++++++++++++ BLFS/packages.sh | 97 ++++++++++ 12 files changed, 1644 insertions(+) create mode 100644 BLFS/TODO create mode 100644 BLFS/alternatives.conf create mode 100755 BLFS/blfs-parser.sh create mode 100644 BLFS/libs/book.xsl create mode 100644 BLFS/libs/constants.inc create mode 100644 BLFS/libs/dependencies.xsl create mode 100644 BLFS/libs/func_dependencies create mode 100644 BLFS/libs/func_makefile create mode 100644 BLFS/libs/func_packages create mode 100644 BLFS/libs/func_parser create mode 100644 BLFS/libs/scripts.xsl create mode 100755 BLFS/packages.sh diff --git a/BLFS/TODO b/BLFS/TODO new file mode 100644 index 0000000..9f1a956 --- /dev/null +++ b/BLFS/TODO @@ -0,0 +1,32 @@ +##### +# +# Project TODO list +# +# $Id$ +##### + +For now the code is able to do the first step for the new approach: to create +LFS-like books from BLFS sources, allowing to create linear build scrips and +Makefiles similars to the current ones for {C,H}LFS. + +What remains to do: + +1. - To make the top-level blfs script functional. That script should to create + the working directory (selected at command line) + a. Copy all BLFS/* files to it, + b. Fetch the BLFS sources (output directory selected at command line or + based on the book version), + c. Run the packages.sh script. + +2. - To develop the XSL code needed to create the build scripts. + Work in progress. + +3. - To develop the code to create the Makefile. + Should be a separate script to be run manually after the user has + review and edited the target build scripts. + Must make the build scripts executables and set the SRC_ARCHIVE and + FTP_SERVER envars. + +4. - To find a way to track already installed packages by previous runs, to can + skip them when creating the book/scripts/Makefile for a new target. + diff --git a/BLFS/alternatives.conf b/BLFS/alternatives.conf new file mode 100644 index 0000000..0b6b928 --- /dev/null +++ b/BLFS/alternatives.conf @@ -0,0 +1,27 @@ +##### +# +# Configuration file for the BLFS module +# +# $Id$ +# +# Set default package for alternatives when resolving dependencies +# +##### + +# Print server cups/LPRng +PRINT_SERVER=cups + +# Mail server sendmail/postfix/exim +MAIL_SERVER=sendmail + +# GhostScript gs/espgs +GHOSTSCRIPT=espgs + +# Kerberos 5 mitkrb/heimdal +KBR5=heimdal + +# X11 implementation xorg7/xorg/xfree86 +X11=xorg7 + + + diff --git a/BLFS/blfs-parser.sh b/BLFS/blfs-parser.sh new file mode 100755 index 0000000..1d9f61d --- /dev/null +++ b/BLFS/blfs-parser.sh @@ -0,0 +1,125 @@ +#!/bin/bash +# +# $Id$ +# +set -e +declare TARGET +declare DEP_LEVEL +declare PKGXML +declare BLFS_XML +declare VERBOSITY=1 + +# Grab and name the command line options + optTARGET=$1 +optDEPENDENCY=$2 + + +#--------------------- +# Constants +source libs/constants.inc +[[ $? > 0 ]] && echo -e "\n\tERROR: constants.inc did not load..\n" && exit + +#--------------------- +# Configuration file for alternatives +source alternatives.conf +[[ $? > 0 ]] && echo -e "\n\tERROR: alternatives.conf did not load..\n" && exit + +#--------------------- +# Dependencies module +source libs/func_dependencies +[[ $? > 0 ]] && echo -e "\n\tERROR: func_dependencies did not load..\n" && exit + +#--------------------- +# parser module +source libs/func_parser +[[ $? > 0 ]] && echo -e "\n\tERROR: func_parser did not load..\n" && exit + +#--------------------- +# Makefile module +source libs/func_makefile +[[ $? > 0 ]] && echo -e "\n\tERROR: func_makefile did not load..\n" && exit + + + +#-------------------------# +validate_target() { # ID of target package (as listed in packages file) +#-------------------------# +: < /dev/null ; then + echo -e "\n\t$1 is not a valid package ID." + echo -e "\tSee packages file for a list of available targets.\n" + exit 1 + fi + + TARGET=$1 + echo -e "\n\tUsing $TARGET as the target package." +} + +#-------------------------# +validate_dependency() { # Dependencies level 1(required)/2(1 + recommended)/3(2+ optional) +#-------------------------# +: < + + + + + + + + + + + + + + + + + + + + alsa-lib + + + aRts + + + kdelibs + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + (in the full book) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/BLFS/libs/constants.inc b/BLFS/libs/constants.inc new file mode 100644 index 0000000..3a3745a --- /dev/null +++ b/BLFS/libs/constants.inc @@ -0,0 +1,40 @@ +##### +# +# common constants +# +# $Id: +##### + + +# VT100 colors +declare -r BLACK=$'\e[1;30m' +declare -r DK_GRAY=$'\e[0;30m' + +declare -r RED=$'\e[31m' +declare -r GREEN=$'\e[32m' +declare -r YELLOW=$'\e[33m' +declare -r BLUE=$'\e[34m' +declare -r MAGENTA=$'\e[35m' +declare -r CYAN=$'\e[36m' +declare -r WHITE=$'\e[37m' + +declare -r OFF=$'\e[0m' +declare -r BOLD=$'\e[1m' +declare -r REVERSE=$'\e[7m' +declare -r HIDDEN=$'\e[8m' + +declare -r tab_=$'\t' +declare -r nl_=$'\n' + +declare -r DD_BORDER="${BOLD}==============================================================================${OFF}" +declare -r SD_BORDER="${BOLD}------------------------------------------------------------------------------${OFF}" +declare -r STAR_BORDER="${BOLD}******************************************************************************${OFF}" + +# bold yellow > < pair +declare -r R_arrow=$'\e[1;33m>\e[0m' +declare -r L_arrow=$'\e[1;33m<\e[0m' + +HEADER="# This file is automatically generated by jhalfs +# DO NOT EDIT THIS FILE MANUALLY +# +# Generated on `date \"+%F %X %Z\"`" diff --git a/BLFS/libs/dependencies.xsl b/BLFS/libs/dependencies.xsl new file mode 100644 index 0000000..f62a271 --- /dev/null +++ b/BLFS/libs/dependencies.xsl @@ -0,0 +1,47 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/BLFS/libs/func_dependencies b/BLFS/libs/func_dependencies new file mode 100644 index 0000000..53272dc --- /dev/null +++ b/BLFS/libs/func_dependencies @@ -0,0 +1,371 @@ +#!/bin/bash +# +# $Id$ +# +set -e + +declare -i cntr=0 +declare -a spaceSTR=" " + +#----------------------------# +generate_dependency_tree() { # +#----------------------------# +: <" + + echo -en "\tGenerating $TARGET dependencies tree ..." + + mkdir dependencies + + #--------------------- + # Create target package dependencies list + case $TARGET in + # Skip the creation when all dependencies are circular. + alsa-lib | cracklib | libexif | unixodbc ) ;; + + # Meta-packages at target level + # KDE and Gnome-{core,full} could be made via packages.sh, but not sure yet how. + alsa ) + echo -e "alsa-oss\nalsa-firmware\nalsa-tools\nalsa-utils\n \ + alsa-plugins\nalsa-lib" > dependencies/alsa.dep + ;; + gnome-core ) + cp ../libs/gnome-core.dep dependencies/ + ;; + gnome-full ) + cp ../libs/gnome-{core,full}.dep dependencies/ + ;; + kde-core ) + cp ../libs/kde-core.dep dependencies/ + ;; + kde-full ) + cp ../libs/kde-{core,full}.dep dependencies/ + ;; + kde-koffice ) + cp ../libs/kde-{core,full}.dep dependencies/ + echo -e "koffice\nkde-full\nkde-core" > dependencies/kde-koffice.dep + ;; + xorg7 ) # At atarget level, add also x-config and x-setup + echo -e "x-config\nx-setup\nrman\nxterm2\nxorg7-driver\nxorg7-server\nluit\n \ + xorg7-font\nxorg7-data\nxorg7-app\nxbitmaps\nmesalib\nlibdrm\n \ + xorg7-lib\nxorg7-util\nxorg7-proto" > dependencies/xorg7.dep + ;; + * ) # Default + xsltproc --stringparam dependencies $DEP_LEVEL \ + -o dependencies/$TARGET.dep \ + ../libs/dependencies.xsl ../$PKGXML + ;; + esac + + #--------------------- + # Start with a clean $TARGET-index.xml.tmp file + > $TARGET-index.xml.tmp + + #--------------------- + # Write the XInclude + case $TARGET in + # If there is no usefull XML page, skip it. + alsa | gnome-core | gnome-full | kde-core | kde-full | kde-koffice ) ;; + * ) + echo -e " $ENTRY_START$PKGXML$ENTRY_END" >> $TARGET-index.xml.tmp + ;; + esac + + #------------------P--- + # Start with a clean depure.txt file + > depure.txt + + #--------------------- + # If have dependencies, write its XInclude and find sub-dependencies + if [[ -f dependencies/$TARGET.dep ]]; then + echo -e "Start loop for PKG $TARGET\n" >> depure.txt + mkdir xincludes && do_dependencies $TARGET + fi + + echo "done" +} + + + +#-----------------------# +do_dependencies() { # Loop to find sub-dependencies :::WARNING::: THIS IS A RECURVISE FUNCTION +#-----------------------# +: <> depure.txt + echo -e "\tDEP_LEVEL for $PKG is $DEP_LV\n" >> depure.txt + + #------------------ + # If a premade xinclude file exists, use it. If not, create one + if [[ -f xincludes/$PKG.xinc ]] ; then + echo -e "\tReusing xinclude file for PKG $PKG" >> depure.txt + IFS=$'\x0A' + for line in `cat xincludes/$PKG.xinc` ; do + IFS=$saveIFS + # Remove the Xinclude entry if found. We want the most newer one. + # Using double quotes to let bash expand variables. + # Remove also the empty line created. Can not be done in one step + # due that d requires the pattner between /, but we have a lot of / + # inside the pattner. + sed -e "s,^[[:space:]]*$line,," -e '/./!d' -i $TARGET-index.xml.tmp + # Write the XInclude + echo -e "$line" >> $TARGET-index.xml.tmp + done + return + fi + + #------------------ + # Start with a clean $PKG.xinc.tmp file + > xincludes/$PKG.xinc.tmp + for DEP in `cat dependencies/$PKG.dep`; do + # Special packages (a lot of hacks) + case $DEP in + + db ) continue ;; # The proper version of DB is installed in LFS + + # Don't have their own XML file + hal-requirements | hal-runtime-dependencies ) continue ;; + perl-* | tk-perl ) DEP=perl-modules ;; + + # Orphan links (proper link must be created when generating the book) + arts ) DEP=aRts ;; + kde ) DEP=kde-core ;; + + # Dummy gnome-core pages + GNOME-desktop-file-utils ) DEP=desktop-file-utils ;; + GNOME-shared-mime-info ) DEP=shared-mime-info ;; + + # Set values for alternative packages + # X is a meta-package, thus handled in another way. + LPRng | cups ) DEP=$PRINT_SERVER ;; + mitkrb | heimdal ) DEP=$KBR5 ;; + gs | espgs ) DEP=$GHOSTSCRIPT ;; + server-mail ) DEP=$MAIL_SERVER ;; + esac + + #------------------ + echo -e "\tDEP for $PKG is $DEP" >> depure.txt + # Prevent circular dependencies + # If all dependencies are circular, the creation of the *.dep file + # must be skipped, not placed here, to avoid that the script will bomb + # due empty *.xinc files + case $DEP in + jadetex | perl-* | lynx | Links | w3m ) + # Optional dependencies are runtime only + [[ "$PKG" = "docbook-utils" ]] && continue + ;; + libxslt ) + # libxml2-->libxslt-->libxml2 + [[ "$PKG" = "libxml2" ]] && continue + ;; + openldap | postgresql | $KBR5 ) + # cyrus-sasl-->several-->cyrus-sasl + [[ "$PKG" = "cyrus-sasl" ]] && continue + ;; + espgs ) + # sendmail-->espgs-->cups-->php-->sendmail + [[ "$PKG" = "$MAIL_SERVER" ]] && continue + ;; + aRts ) + # esound-->aRts-->esound + [[ "$PKG" = "esound" ]] && continue + ;; + gimp | sane ) + # imagemagick-->{sane}-->gimp-->imagemagick + [[ "$PKG" = "imagemagick" ]] && continue + ;; + ffmpeg ) + # alsa-plugins-->ffmpeg-->several-->alsa-plugins + [[ "$PKG" = "alsa-plugins" ]] && continue + ;; + akode ) + # Both are in the same page + [[ "$PKG" = "kdemultimedia" ]] && continue + ;; + esac + + #------------------ + echo -e "\tDEP_LEVEL for $DEP is $DEP_LV" >> depure.txt + # XML file of dependency package + DEP_XML=`grep "^$DEP[[:space:]]" ../packages | cut -f2` + echo -e "\t\tDEP_XML is $DEP_XML\n" >> depure.txt + case $DEP in + x-window-system | alsa ) ;; # No page for that (proper link must be created when generating the book) + xorg7 ) ;; # This page will be dump in the xorg7.xinc file + gnome-core | kde-core | kde-full ) ;; # Invented packages + * ) + # Remove the Xinclude entry if found + sed -e "s,^[[:space:]]*$ENTRY_START$DEP_XML$ENTRY_END,," \ + -e '/./!d' -i xincludes/$PKG.xinc.tmp + # Write the XInclude + echo -e " $ENTRY_START$DEP_XML$ENTRY_END" >> xincludes/$PKG.xinc.tmp + ;; + esac + + #------------------ + # If not already created, create its dependencies list + if [[ ! -f dependencies/$DEP.dep ]] ; then + case $DEP in + # Skip the creation when all dependencies are circular. + alsa-lib | cracklib | libexif | unixodbc ) ;; + # Meta-packages at dependency level (ugly *.dep files, but work for now) + alsa ) # When dependency "alsa", use all alsa-* packages + echo -e "alsa-oss\nalsa-firmware\nalsa-tools\nalsa-utils\n \ + alsa-plugins\nalsa-lib" > dependencies/alsa.dep + ;; + kde-core ) + cp ../libs/kde-core.dep dependencies/ + ;; + x-window-system ) # X11 alternatives + echo -e "x-config\nx-setup\n$X11" > dependencies/x-window-system.dep + ;; + xorg7 ) + echo -e "rman\nxterm2\nxorg7-driver\nxorg7-server\nluit\nxorg7-font\n \ + xorg7-data\nxorg7-app\nxbitmaps\nmesalib\nlibdrm\n \ + xorg7-lib\nxorg7-util\nxorg7-proto" > dependencies/xorg7.dep + ;; + * ) xsltproc --stringparam dependencies $DEP_LV \ + -o dependencies/$DEP.dep ../libs/dependencies.xsl ../$DEP_XML + ;; + esac + fi + + #------------------ + # If needed, process its dependencies + if [[ -f dependencies/$DEP.dep ]] ; then + # If a premade xinclude file esist, include it + if [[ -f xincludes/$DEP.xinc ]] ; then + echo -e "\tReusing xinclude file for PKG $DEP (to solve $PKG)\n" >> depure.txt + IFS=$'\x0A' + for line2 in `cat xincludes/$DEP.xinc` ; do + IFS=$saveIFS + # Remove the Xinclude entry if found + sed -e "s,^[[:space:]]*$line2,," -e '/./!d' -i xincludes/$PKG.xinc.tmp + # Write the XInclude + echo -e "$line2" >> xincludes/$PKG.xinc.tmp + done + #------------------ + # Create the xinclude file + else + echo -e "\nStart new loop for PKG $DEP (to solve $PKG)\n" >> depure.txt + # + # >>>>>> THIS IS A RECURSIVE FUNCTION CALL.. BEWARE OF GREMLINS. <<<<<< + # + # If the recursion depth is not too great this is an acceptable methodology for a script language + # However, uncontrolled recursion will cause a seg-fault due to stack issues with local variables. + # + set +e + [[ "${VERBOSITY}" > 0 ]] && echo -ne "\nrecursive call: $((++cntr)) ${spaceSTR:0:$cntr} ${RED}$DEP${OFF}" + do_dependencies $DEP + [[ "${VERBOSITY}" > 0 ]] && echo -ne "\n ret: $cntr ${spaceSTR:0:$((cntr--))} ${GREEN}$DEP${OFF}\tUsing the new xinclude file for PKG $DEP (to solve $PKG)" + set -e + + # Include it when done + echo -e "\tUsing the new xinclude file for PKG $DEP (to solve $PKG)\n" >> depure.txt + IFS=$'\x0A' + for line2 in `cat xincludes/$DEP.xinc` ; do + IFS=$saveIFS + # Remove the Xinclude entry if found + sed -e "s,^[[:space:]]*$line2,," -e '/./!d' -i xincludes/$PKG.xinc.tmp + # Write the XInclude + echo -e "$line2" >> xincludes/$PKG.xinc.tmp + done + fi + fi + done + + #------------------ + if [[ "$PKG" = "xorg7" ]] ; then + # Add their XInclude + PKG_XML=`grep "^$PKG[[:space:]]" ../packages | cut -f2` + echo -e " $ENTRY_START$PKG_XML$ENTRY_END" >> xincludes/$PKG.xinc.tmp + fi + + #------------------ + mv xincludes/$PKG.xinc.tmp xincludes/$PKG.xinc + echo -e "Using the new xinclude file for PKG $PKG" >> depure.txt + IFS=$'\x0A' + for line in `cat xincludes/$PKG.xinc` ; do + IFS=$saveIFS + # Remove the Xinclude entry if found. + sed -e "s,^[[:space:]]*$line,," -e '/./!d' -i $TARGET-index.xml.tmp + # Write the XInclude + echo -e "$line" >> $TARGET-index.xml.tmp + done + + echo -e "\nEnd loop for PKG $PKG\n" >> depure.txt +} diff --git a/BLFS/libs/func_makefile b/BLFS/libs/func_makefile new file mode 100644 index 0000000..933f3c5 --- /dev/null +++ b/BLFS/libs/func_makefile @@ -0,0 +1,149 @@ +##### +# +# +# +# $Id$ +##### + +# TEMPORARY VARIABLES.. development use only +declare MKFILE=devMakefile +declare PREV_PACKAGE="" +declare BUILD_SCRIPTS=scripts +declare TRACKING_DIR=/var/lib/jhalfs/BLFS + + +#----------------------------------# +__wrt_target() { # Create target and initialize log file +#----------------------------------# + local i=$1 + local PREV=$2 +( +cat << EOF + +$i: $PREV + @\$(call echo_message, Building) + @./progress_bar.sh \$@ & +EOF +) >> $MKFILE.tmp +} + + + +#----------------------------------# +__write_build_cmd() { # +#----------------------------------# + local this_script=$1 + local file=$2 +( +cat << EOF + @( time { ${BUILD_SCRIPTS}/${file} >>logs/${this_script} 2>&1 ; } ) 2>>logs/${this_script} +EOF +) >> $MKFILE.tmp +} + +#----------------------------------# +__wrt_touch() { # +#----------------------------------# + local pkg_name=$1 +( +cat << EOF + @touch \$@ && \\ + touch \$(TRACKING_DIR)/${pkg_name#*-} && \\ + sleep .25 && \\ + echo -e "\n\n "\$(BOLD)Target \$(BLUE)\$@ \$(BOLD)OK && \\ + echo --------------------------------------------------------------------------------\$(WHITE) +EOF +) >> $MKFILE.tmp +} + + +#----------------------------# +__write_entry() { # +#----------------------------# + local script_name=$1 + + echo -n "${tab_}${tab_} entry for <$script_name>" + + #--------------------------------------------------------------------# + # >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<< # + #--------------------------------------------------------------------# + # + # Drop in the name of the target on a new line, and the previous target + # as a dependency. Also call the echo_message function. + __wrt_target "${script_name}" "$PREV_PACKAGE" + __write_build_cmd "${script_name}" "${script_name}" + + # Include a touch of the target name so make can check + # if it's already been made. + __wrt_touch "${script_name}" + # + #--------------------------------------------------------------------# + # >>>>>>>> END OF Makefile ENTRY <<<<<<<< # + #--------------------------------------------------------------------# + echo " .. OK" +} + +#----------------------------# +generate_Makefile () { # +#----------------------------# + + + echo "${tab_}Creating Makefile... ${BOLD}START${OFF}" + + # Start with a clean files + >$MKFILE + >$MKFILE.tmp + + + for package_script in scripts/* ; do + this_script=`basename $package_script` + if [ ! -e $TRACKING_DIR/${this_script#*-} ]; then + pkg_list="$pkg_list ${this_script}" + __write_entry $this_script + PREV_PACKAGE=${this_script} + fi + done + + + # Add a header, some variables and include the function file + # to the top of the real Makefile. +( + cat << EOF +$HEADER + +PACKAGE= "`basename $PKGXML .xml`" +TRACKING_DIR= $TRACKING_DIR + +BOLD= "" +RED= "" +GREEN= "" +ORANGE= "" +BLUE= "" +WHITE= "" + +define echo_message + @echo \$(BOLD) + @echo -------------------------------------------------------------------------------- + @echo \$(BOLD)\$(1) target \$(BLUE)\$@\$(BOLD) + @echo \$(WHITE) +endef + + +define fin_message + @echo \$(BOLD) + @echo -------------------------------------------------------------------------------- + @echo \$(BOLD) Build complete for the package \$(BLUE)\$(PACKAGE)\$(BOLD) and its dependencies + @echo \$(WHITE) +endef + +all : $pkg_list + @\$(call fin_message ) +EOF +) > $MKFILE + + cat $MKFILE.tmp >> $MKFILE + echo "${tab_}Creating Makefile... ${BOLD}DONE${OFF}" + + rm $MKFILE.tmp + +} diff --git a/BLFS/libs/func_packages b/BLFS/libs/func_packages new file mode 100644 index 0000000..edf403a --- /dev/null +++ b/BLFS/libs/func_packages @@ -0,0 +1,129 @@ +#!/bin/bash +# +# $Id$ +# +set -e + +#-----------------------# +generate_packages() { # Master packages file +#-----------------------# + local pkg_id file + + > packages.tmp + + # Extract Id and path for sect1 files + for file in `find $BLFS_XML -name "*.xml"` ; do + pkg_id=`grep "sect1 id" $file | sed -e 's/> packages.tmp + done + + # IDs clean-up (unuseful pages or commented-out packages, could be more) + sed -i '/template/d;/ntroduction/d;/preface/d' packages.tmp + sed -i '/courier.xml/d' packages.tmp + sed -i '/nautilus-media.xml/d;/gal.xml/d;/gpdf.xml/d;/gv.xml/d' packages.tmp + + # Add header with meta-packages pseudo Id +{ + cat << EOF + +=== GNOME META-PACKAGES === +# GNOME base packages +gnome-core $BLFS_XML +# All GNOME packages +gnome-full $BLFS_XML + +=== KDE META-PACKAGES === +# KDE base packages +kde-core $BLFS_XML +# All KDE packages +kde-full $BLFS_XML +# All KDE packages plus Koffice +kde-koffice $BLFS_XML + +=== INDIVIDUAL PACKAGES === + +EOF +} > packages + + # Dump packages list + sort packages.tmp >> packages + + # Clean up + rm packages.tmp +} + +# Pre-made *.dep files for meta-packages + +#--------------------------# +generate_gnome_core() { # GNOME core +#--------------------------# + local line base_xml package + + > gnome-core.dep.tmp + + for line in `grep "xi:include" $BLFS_XML/gnome/core/core.xml` ; do + base_xml=`echo $line | sed 's/^.*href="//;s/".*//'` + package=`grep "gnome/core/$base_xml" packages | cut -f1` + [[ -n "$package" ]] && echo $package >> gnome-core.dep.tmp + done + + tac gnome-core.dep.tmp > libs/gnome-core.dep + rm gnome-core.dep.tmp +} + +#--------------------------# +generate_gnome_full() { # GNOME full +#--------------------------# + local line base_xml package + + echo "gnome-core" > gnome-full.dep.tmp + + for line in `grep "xi:include" $BLFS_XML/gnome/add/add.xml` ; do + base_xml=`echo $line | sed 's/^.*href="//;s/".*//'` + package=`grep "gnome/add/$base_xml" packages | cut -f1` + [[ -n "$package" ]] && echo $package >> gnome-full.dep.tmp + done + + tac gnome-full.dep.tmp > libs/gnome-full.dep + rm gnome-full.dep.tmp +} + +#--------------------------# +generate_kde_core() { # KDE core +#--------------------------# + local line base_xml package + + > kde-core.dep.tmp + + for line in `grep "xi:include" $BLFS_XML/kde/core/core.xml` ; do + base_xml=`echo $line | sed 's/^.*href="//;s/".*//'` + package=`grep "kde/core/$base_xml" packages | cut -f1` + [[ -n "$package" ]] && echo $package >> kde-core.dep.tmp + done + + tac kde-core.dep.tmp > libs/kde-core.dep + rm kde-core.dep.tmp +} + +#--------------------------# +generate_kde_full() { # KDE full +#--------------------------# + local line base_xml package + + echo "kde-core" > kde-full.dep.tmp + + for line in `grep "xi:include" $BLFS_XML/kde/add/add.xml` ; do + base_xml=`echo $line | sed 's/^.*href="//;s/".*//'` + package=`grep "kde/add/$base_xml" packages | cut -f1` + [[ -n "$package" ]] && echo $package >> kde-full.dep.tmp + done + + for line in `grep "xi:include" $BLFS_XML/kde/devel/devel.xml` ; do + base_xml=`echo $line | sed 's/^.*href="//;s/".*//'` + package=`grep "kde/devel/$base_xml" packages | cut -f1` + [[ -n "$package" ]] && echo $package >> kde-full.dep.tmp + done + + tac kde-full.dep.tmp > libs/kde-full.dep + rm kde-full.dep.tmp +} diff --git a/BLFS/libs/func_parser b/BLFS/libs/func_parser new file mode 100644 index 0000000..ed37b1e --- /dev/null +++ b/BLFS/libs/func_parser @@ -0,0 +1,149 @@ +#!/bin/bash +##### +# +# Parse the XML documents to create a 'package' book +# +# $Id$ +##### + + +#----------------------------# +generate_TARGET_xml() { # +#----------------------------# +: < + + + + + + + + + + Preface + + + + + + + + + + Installing $TARGET in Dependencies Build Order + +EOF +} > $TARGET-index.xml + + #--------------------- + # Dump $TARGET-index.xml.tmp in reverse order. + tac $TARGET-index.xml.tmp >> $TARGET-index.xml + rm $TARGET-index.xml.tmp + + #--------------------- + # Footer of $TARGET-index.xml +{ +cat << EOF + + + + + + + + + + +EOF +} >> $TARGET-index.xml + + echo "done" +} + + +#-------------------------# +generate_target_book() { # +#-------------------------# +: < from the xml files located in <$BLFS_XML>..." + xsltproc --xinclude --nonet \ + --stringparam mail_server $MAIL_SERVER \ + --stringparam xwindow $X11 \ + --stringparam base.dir HTML/ \ + ../libs/book.xsl \ + $TARGET-index.xml > xsltproc.log 2>&1 + mkdir HTML/{stylesheets,images} + cp ../$BLFS_XML/stylesheets/*.css HTML/stylesheets + cp ../$BLFS_XML/images/*.png HTML/images + cd HTML + sed -i -e "s@../stylesheets@stylesheets@g" *.html + sed -i -e "s@../images@images@g" *.html + for filename in `find . -name "*.html"` ; do + tidy -config ../../$BLFS_XML/tidy.conf $filename || true + sh ../../$BLFS_XML/obfuscate.sh $filename + sed -i -e "s@text/html@application/xhtml+xml@g" $filename + done + cd .. + echo "done" +} + + +#-------------------------# +create_build_scripts() { # +#-------------------------# +: <> xsltproc.log + + echo -en "\tGenerating the build scripts ..." + xsltproc --xinclude --nonet \ + -o ./scripts/ ../libs/scripts.xsl \ + $TARGET-index.xml >> xsltproc.log 2>&1 + echo "done" + # Make the scripts executable. + chmod -R +x scripts + +} diff --git a/BLFS/libs/scripts.xsl b/BLFS/libs/scripts.xsl new file mode 100644 index 0000000..391a65b --- /dev/null +++ b/BLFS/libs/scripts.xsl @@ -0,0 +1,373 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 00 + + + + 0 + + + + + + + + + + + SCRIPT is + + PACKAGE is + + FTPDIR is + + + + + + + #!/bin/sh set -e + + + + + SRC_ARCHIVE=$SRC_ARCHIVE + FTP_SERVER=$FTP_SERVER PACKAGE= + + PKG_DIR= + + + + + + + + + cd ~/sources/$PKG_DIR + rm -rf $UNPACKDIR + + + + + + + exit + + + + + + + + + + + + + mkdir -p ~/sources/$PKG_DIR + cd ~/sources/$PKG_DIR + + + + + + + + tar -xvf $PACKAGE > unpacked + UNPACKDIR=`head -n1 unpacked | sed 's@^./@@;s@/.*@@'` + cd $UNPACKDIR + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + cdparanoia + + + + docbk + + + + gc + + + + iso-codes + + + + jpeg + + + + lynx + + + + ntp + + + + openldap + + + + OOo + + + + pine + + + + portmap + + + + psutils + + + + qpopper + + + + qt-x11-free + + + + sendmail + + + + slib + + + + tcl + + + + tcp_wrappers + + + + tetex + + + + tidy + + + + tk + + + + unzip + + + + wireless_tools + + + + whois + + + + Xorg + + + + zip + + + + + + + - + + + + + + + + + + + + + + if [[ ! -f $PACKAGE ]] ; then + + if [[ -f $SRC_ARCHIVE/$PKG_DIR/$PACKAGE ]] ; then + cp $SRC_ARCHIVE/$PKG_DIR/$PACKAGE $PACKAGE + elif [[ -f $SRC_ARCHIVE/$PACKAGE ]] ; then + cp $SRC_ARCHIVE/$PACKAGE $PACKAGE else + + wget $FTP_SERVER/BLFS/conglomeration/$PKG_DIR/$PACKAGE + + + || \ wget + + + + + + + || \ wget + + + fi fi + + + echo " + + $PACKAGE" | md5sum -c - + + + + wget + + + + + + + + + + + + sudo sh -c " + + + + " + + + + + + + + # + + make -k + + || true + + + + + + + + + **EDITME + + EDITME** + + + diff --git a/BLFS/packages.sh b/BLFS/packages.sh new file mode 100755 index 0000000..af649e8 --- /dev/null +++ b/BLFS/packages.sh @@ -0,0 +1,97 @@ +#!/bin/bash +# +# $Id$ +# +set -e + +declare -r SVN="svn://svn.linuxfromscratch.org" + +BLFS_XML=$1 # Book directory +DOC_MODE=$2 # Action to take, only update at the moment + +#--------------------- +# packages module +source libs/func_packages +[[ $? > 0 ]] && echo -e "\n\tERROR: func_packages did not load..\n" && exit + +#----------------------------# +BOOK_Source() { # +#----------------------------# +: < /dev/null + svn up + popd 1> /dev/null + echo -e "\n\tBook sources updated." + else + echo -e "\n\tLooks like $BLFS_XML is not a svn working copy." + echo -e "\tSkipping BLFS sources update.\n" + fi + ;; + + get ) + [[ ! -d $BLFS_XML ]] && mkdir -pv $BLFS_XML + svn co $SVN/BLFS/trunk/BOOK $BLFS_XML 2>&1 + ;; + * ) + echo -e "\n\tUnknown option ${DOC_MODE} ignored.\n" + ;; + esac + fi +} + +BOOK_Source $BLFS_XML $DOC_MODE + +echo -en "\n\tGenerating packages file ..." +generate_packages +echo "done." + +echo -en "\tGenerating gnome-core dependencies list ..." +generate_gnome_core +echo "done." + +echo -en "\tGenerating gnome-full dependencies list ..." +generate_gnome_full +echo "done." + +echo -en "\tGenerating kde-core dependencies list ..." +generate_kde_core +echo "done." + +echo -en "\tGenerating kde-full dependencies list ..." +generate_kde_full +echo -e "done.\n" +