From 796cd28b08d4f0a1fd1cf186fdb138dd0996ac9f Mon Sep 17 00:00:00 2001 From: Pierre Labastie Date: Thu, 2 Mar 2017 16:40:34 +0000 Subject: [PATCH] Merge trunk rev 3896: Unless explicitely set on the command line, the REV parameter in BLFS tools make is the same as the preceding used one. Formerly, it was set to sysv unless defined on the command line --- BLFS/Makefile | 84 ++++++++++++++++++++++++++++++------------- install-blfs-tools.sh | 11 +++--- 2 files changed, 66 insertions(+), 29 deletions(-) diff --git a/BLFS/Makefile b/BLFS/Makefile index bcf1da7..a190f9a 100644 --- a/BLFS/Makefile +++ b/BLFS/Makefile @@ -5,16 +5,6 @@ # $Id$ -ifeq ($(REV),) - REV = sysv -endif - -ifneq ($(REV),sysv) - ifneq ($(REV),systemd) - $(error The REV variable is $(REV), but can only be 'sysv' or 'systemd') - endif -endif - ifdef V Q = else @@ -25,21 +15,39 @@ endif LANG=C LC_ALL=C -# The right-hand side is updated by jhalfs -TRACKING_DIR = tracking-dir -TOPDIR=$(shell pwd) -BLFS_XML = $(TOPDIR)/blfs-xml -XSLDIR = $(TOPDIR)/xsl +# Makefile should reside in a directory where there are two subdirectories +# initially: +TOPDIR = $(shell pwd) +# the stylesheets +XSLDIR = $(TOPDIR)/xsl +# the menu program sources +MENU = $(TOPDIR)/menu -RENDERTMP = $(BLFS_XML)/tmp -BLFS_FULL = $(RENDERTMP)/blfs-full.xml -PACK_LIST = $(TOPDIR)/packages.xml -MENU = $(TOPDIR)/menu +# Those directories and files will be created and populated by make: +# directory of the book sources: +BLFS_XML = $(TOPDIR)/blfs-xml +# contains the REV used in the preceding call: +REVFILE = $(TOPDIR)/revision +# the list of packages: +PACK_LIST = $(TOPDIR)/packages.xml +# the generated menu input: CONFIG_CONFIG_IN = $(TOPDIR)/Config.in -CONFIG_OUT = $(TOPDIR)/configuration -BOOK_XML = $(TOPDIR)/book.xml -TRACKFILE = $(TRACKING_DIR)/instpkg.xml +# menu output: +CONFIG_OUT = $(TOPDIR)/configuration +# the linear book: +BOOK_XML = $(TOPDIR)/book.xml +RENDERTMP = $(BLFS_XML)/tmp +BLFS_FULL = $(RENDERTMP)/blfs-full.xml + +# The right-hand side is updated by jhalfs: +# Where the tracking file resides: +TRACKING_DIR = tracking-dir + +# Will be created by make, if not existent +TRACKFILE = $(TRACKING_DIR)/instpkg.xml + +# Initial content of the tracking file define INITIAL_TRACK \n\ \n\ @@ -52,9 +60,30 @@ endef SVN = svn://svn.linuxfromscratch.org/BLFS/trunk/BOOK ALLXML := $(filter-out $(RENDERTMP)/%, \ - $(wildcard $(BLFS_XML)/*.xml $(BLFS_XML)/*/*.xml $(BLFS_XML)/*/*/*.xml $(BLFS_XML)/*/*/*/*.xml $(BLFS_XML)/*/*/*/*/*.xml)) + $(shell if [ -d $(BLFS_XML) ]; then \ + find $(BLFS_XML) -name \*.xml; \ + fi)) ALLXSL := $(filter-out $(RENDERTMP)/%, \ - $(wildcard $(BLFS_XML)/*.xsl $(BLFS_XML)/*/*.xsl $(BLFS_XML)/*/*/*.xsl $(BLFS_XML)/*/*/*/*.xsl $(BLFS_XML)/*/*/*/*/*.xsl)) + $(shell if [ -d $(BLFS_XML) ]; then \ + find $(BLFS_XML) -name \*.xsl; \ + fi)) + +# Try to set the REV variable according to previous runs, except when +# set on the command line: +REV1 := $(shell if [ -f $(REVFILE) ] ; then cat $(REVFILE); fi) +ifneq ($(origin REV),command line) + ifdef REV1 + REV = $(REV1) + else + REV = not defined + endif +endif + +ifneq ($(REV),sysv) + ifneq ($(REV),systemd) + $(error The REV variable is $(REV), but can only be 'sysv' or 'systemd') + endif +endif $(BOOK_XML): $(CONFIG_OUT) $(Q)$(TOPDIR)/gen_pkg_book.sh $(TOPDIR) $(BLFS_FULL) @@ -106,6 +135,9 @@ $(TRACKING_DIR): $(XSLDIR)/specialCases.xsl: $(TOPDIR)/gen-special.sh $(BLFS_FULL) $(Q)$(TOPDIR)/gen-special.sh $(BLFS_FULL) $@ +ifneq ($(REV),$(REV1)) +$(BLFS_FULL): FORCE +endif $(BLFS_FULL): $(BLFS_XML) $(BLFS_XML)/general.ent $(ALLXML) $(ALLXSL) $(Q)[ -d $(RENDERTMP) ] || mkdir -p $(RENDERTMP) @echo "Adjusting for revision $(REV)..." @@ -117,6 +149,7 @@ $(BLFS_FULL): $(BLFS_XML) $(BLFS_XML)/general.ent $(ALLXML) $(ALLXSL) @echo "Validating the book..." $(Q)xmllint --nonet --noent --postvalid \ -o $@ $(RENDERTMP)/blfs-prof.xml + $(Q)echo $(REV) > $(REVFILE) all: update $(BOOK_XML) @@ -135,4 +168,5 @@ clean: rm -rf $(TOPDIR)/dependencies $(TOPDIR)/book-html $(TOPDIR)/scripts - $(MAKE) -C $(MENU) clean -.PHONY: clean all update $(CONFIG_OUT) +FORCE: +.PHONY: clean all update $(CONFIG_OUT) FORCE diff --git a/install-blfs-tools.sh b/install-blfs-tools.sh index d5329bf..45fa85f 100755 --- a/install-blfs-tools.sh +++ b/install-blfs-tools.sh @@ -11,12 +11,13 @@ BLFS_ROOT : where the installed tools will be installed, relative to $HOME. Must start with a '/' (default /blfs_root) BLFS_BRANCH_ID: development, branch-xxx, xxx (where xxx is a valid tag) (default development) +INIT_SYSTEM : which book do you want? 'sysv' or 'systemd' (default sysv) Examples: 1 - If you plan to use the tools to build BLFS on top of LFS, but you did not use jhalfs, or forgot to include the jhalfs-blfs tools: (as root) mkdir -p /var/lib/jhalfs/BLFS && chown -R /var/lib/jhalfs -(as user) ./install-blfs-tools.sh -2 - To install with only user privileges: +(as user) INIT_SYSTEM= ./install-blfs-tools.sh +2 - To install with only user privileges (default to sysv): TRACKING_DIR=$HOME/blfs_root/trackdir ./install-blfs-tools.sh inline_doc @@ -56,6 +57,7 @@ BLFS_TOOL='y' BUILDDIR=$(cd ~;pwd) BLFS_ROOT="${BLFS_ROOT:=/blfs_root}" TRACKING_DIR="${TRACKING_DIR:=/var/lib/jhalfs/BLFS}" +INIT_SYSTEM="${INIT_SYSTEM:=sysv}" [[ $VERBOSITY > 0 ]] && echo "${SD_BORDER}${nl_}" @@ -90,9 +92,9 @@ cp -r menu ${BUILDDIR}${BLFS_ROOT} cp $COMMON_DIR/progress_bar.sh ${BUILDDIR}${BLFS_ROOT} cp README.BLFS ${BUILDDIR}${BLFS_ROOT} [[ $VERBOSITY > 0 ]] && echo "... OK" -[[ $VERBOSITY > 0 ]] && echo -n Cleaning the ${BUILDDIR}${BLFS_ROOT} directory # Clean-up +[[ $VERBOSITY > 0 ]] && echo Cleaning the ${BUILDDIR}${BLFS_ROOT} directory make -C ${BUILDDIR}${BLFS_ROOT}/menu clean rm -rf ${BUILDDIR}${BLFS_ROOT}/libs/.svn rm -rf ${BUILDDIR}${BLFS_ROOT}/xsl/.svn @@ -112,9 +114,10 @@ sed -i s@tracking-dir@$TRACKING_DIR@ \ mkdir -p $TRACKING_DIR [[ $VERBOSITY > 0 ]] && echo "... OK" -[[ $VERBOSITY > 0 ]] && echo -n "Downloading and validating the book (may take some time)" +[[ $VERBOSITY > 0 ]] && echo "Downloading and validating the book (may take some time)" make -j1 -C $BUILDDIR$BLFS_ROOT \ TRACKING_DIR=$TRACKING_DIR \ + REV=$INIT_SYSTEM \ SVN=svn://svn.linuxfromscratch.org/BLFS/$BLFS_TREE \ $BUILDDIR$BLFS_ROOT/packages.xml [[ $VERBOSITY > 0 ]] && echo "... OK"