r2780 - in jhalfs/branches/experimental/BLFS: . libs

georgeb at linuxfromscratch.org georgeb at linuxfromscratch.org
Mon Jun 12 17:56:08 PDT 2006


Author: georgeb
Date: 2006-06-12 18:56:07 -0600 (Mon, 12 Jun 2006)
New Revision: 2780

Modified:
   jhalfs/branches/experimental/BLFS/blfs-parser.sh
   jhalfs/branches/experimental/BLFS/libs/constants.inc
   jhalfs/branches/experimental/BLFS/libs/func_makefile
   jhalfs/branches/experimental/BLFS/libs/func_parser
Log:
Early work on makefile generation.. DO NOT run the makefile yet

Modified: jhalfs/branches/experimental/BLFS/blfs-parser.sh
===================================================================
--- jhalfs/branches/experimental/BLFS/blfs-parser.sh	2006-06-12 20:57:57 UTC (rev 2779)
+++ jhalfs/branches/experimental/BLFS/blfs-parser.sh	2006-06-13 00:56:07 UTC (rev 2780)
@@ -34,8 +34,13 @@
 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)
 #-------------------------#
@@ -117,3 +122,4 @@
 generate_TARGET_xml
 generate_target_book
 create_build_scripts
+generate_Makefile
\ No newline at end of file

Modified: jhalfs/branches/experimental/BLFS/libs/constants.inc
===================================================================
--- jhalfs/branches/experimental/BLFS/libs/constants.inc	2006-06-12 20:57:57 UTC (rev 2779)
+++ jhalfs/branches/experimental/BLFS/libs/constants.inc	2006-06-13 00:56:07 UTC (rev 2780)
@@ -33,3 +33,8 @@
 # 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\"`"

Modified: jhalfs/branches/experimental/BLFS/libs/func_makefile
===================================================================
--- jhalfs/branches/experimental/BLFS/libs/func_makefile	2006-06-12 20:57:57 UTC (rev 2779)
+++ jhalfs/branches/experimental/BLFS/libs/func_makefile	2006-06-13 00:56:07 UTC (rev 2780)
@@ -4,3 +4,139 @@
 #
 # $Id$
 #####
+
+# TEMPORARY VARIABLES.. development use only
+declare MKFILE=devMakefile
+declare PREV_PACKAGE=""
+SCRIPT_ROOT=jhalfs
+BUILD_SCRIPTS=scripts
+TRACKING_DIR=/var/lib/jhalfs/BLFS
+BUILDDIR=~/TRIAL
+LOGDIR=$BUILDDIR/logs
+
+#----------------------------------#
+__wrt_target() {                   # Create target and initialize log file
+#----------------------------------#
+  local i=$1
+  local PREV=$2
+(
+cat << EOF
+
+$i:  $PREV
+	@\$(call echo_message, Building)
+EOF
+) >> $MKFILE.tmp
+}
+
+
+
+#----------------------------------#
+__write_build_cmd() {              # Some scripts must be run as root..
+#----------------------------------#
+  local this_script=$1
+  local file=$2
+(
+cat << EOF
+	@( time { export LFS=\$(MOUNT_PT) && ${BUILD_SCRIPTS}/$file >>\$(LOGDIR)/$this_script 2>&1 ; } ) 2>>\$(LOGDIR)/$this_script
+EOF
+) >> $MKFILE.tmp
+}
+
+#----------------------------------#
+__wrt_touch() {                    #
+#----------------------------------#
+(
+cat << EOF
+	@touch  \$@ && \\
+	touch /var/lib/jhalfs/BLFS/${1#*-} \\
+	sleep .25 && \\
+	echo -e "\n\n "\$(BOLD)Target \$(BLUE)\$@ \$(BOLD)OK && \\
+	echo --------------------------------------------------------------------------------\$(WHITE)
+EOF
+) >> $MKFILE.tmp
+}
+
+
+#----------------------------#
+__write_entry() {            #
+#----------------------------#
+  local pkg_name=$1
+
+  echo "${tab_}${tab_} entry for <$pkg_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 "${pkg_name}" "$PREV_PACKAGE"
+  __write_build_cmd "${pkg_name}" "${pkg_name}"
+
+  # Include a touch of the target name so make can check
+  # if it's already been made.
+  __wrt_touch "${pkg_name}"
+  #
+  #--------------------------------------------------------------------#
+  #              >>>>>>>> END OF Makefile ENTRY <<<<<<<<               #
+  #--------------------------------------------------------------------#
+
+}
+
+#----------------------------#
+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
+
+SRC= /sources
+MOUNT_PT= $BUILDDIR
+LOGDIR= $LOGDIR
+
+BOLD= ""
+RED= ""
+GREEN= ""
+ORANGE= ""
+BLUE= ""
+WHITE= ""
+
+define echo_message
+  @echo \$(BOLD)
+  @echo --------------------------------------------------------------------------------
+  @echo \$(BOLD)\$(1) target \$(BLUE)\$@\$(BOLD)
+  @echo \$(WHITE)
+endef
+
+all : $pkg_list
+
+EOF
+) > $MKFILE
+
+ 
+  cat $MKFILE.tmp >> $MKFILE
+
+  echo "${tab_}Creating Makefile... ${BOLD}DONE${OFF}"
+
+}

Modified: jhalfs/branches/experimental/BLFS/libs/func_parser
===================================================================
--- jhalfs/branches/experimental/BLFS/libs/func_parser	2006-06-12 20:57:57 UTC (rev 2779)
+++ jhalfs/branches/experimental/BLFS/libs/func_parser	2006-06-13 00:56:07 UTC (rev 2780)
@@ -98,15 +98,13 @@
 inline_doc
 
   local filename # output filename
-
-  echo -en  "\tGenerating the HTML book ..."
+  echo -en  "\tGenerating the HTML book for <$TARGET> 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
@@ -145,4 +143,7 @@
            -o ./scripts/ ../libs/scripts.xsl \
            $TARGET-index.xml >> xsltproc.log 2>&1
   echo "done"
+    # Make the scripts executable.
+  chmod -R +x scripts
+
 }




More information about the alfs-log mailing list