From 2cc81b7e752cd28da7f34999b193f1d11c9de63b Mon Sep 17 00:00:00 2001 From: Michael Shigorin Date: Wed, 8 Sep 2010 18:19:23 +0300 Subject: [PATCH] r/o profile build Building m-p-d stuff in-tree was plagued by accidental generated file commits, and it wasn't nice at all anyways. --- Makefile | 18 ++++++++++++++++++ clean.mk | 9 +-------- configure | 18 +++++++++--------- distro.mk | 6 +++--- image.in/configure.ac | 4 ++-- iso.mk | 4 ++-- pkg/Makefile | 2 ++ 7 files changed, 37 insertions(+), 24 deletions(-) diff --git a/Makefile b/Makefile index 95ad9317..579509b2 100644 --- a/Makefile +++ b/Makefile @@ -7,6 +7,12 @@ include clean.mk include distro.mk include iso.mk +# this could have come come from environment; +# if not, can be symlinked if r/w, or made anew +ifndef BUILDDIR +BUILDDIR := $(shell realpath build || bin/mktmpdir mkimage-profiles.build) +endif + # we can't use implicit rules for top-level targets, only for prereqs CONFIGS=$(shell sed -n 's,^distro/\([^:]\+\):.*$$,\1,p' distro.mk) DISTROS=$(addsuffix .iso,$(CONFIGS)) @@ -15,4 +21,16 @@ all: @echo '** available distribution targets:' @echo $(DISTROS) | fmt -sw65 | column -t +prep: + @echo "** BUILDDIR: $(BUILDDIR)" +# ls -ld $(BUILDDIR) + @rsync -qaH --delete image.in/ "$(BUILDDIR)"/image/ + @rm -f "$(BUILDDIR)"/.config.mk + @touch "$(BUILDDIR)"/.config.mk + @mkdir "$(BUILDDIR)"/.mki + @rm -f build + @[ -w . ] \ + && ln -sf "$(BUILDDIR)" build \ + || echo "** profile directory readonly: skipping symlinks, env only" + $(DISTROS): %.iso: | prep distro/% iso diff --git a/clean.mk b/clean.mk index a88d4819..4be39822 100644 --- a/clean.mk +++ b/clean.mk @@ -8,12 +8,5 @@ distclean: clean @[ -d build/ ] && \ make -C build/image $@ GLOBAL_BUILDDIR=$(shell readlink build) && \ rm -r $(shell readlink build) && \ - rm .config.mk build \ + rm build \ ||: - -# it can be symlinked if r/w (see configure); -# if not, then should come from environment -BUILDDIR ?= $(shell realpath build) - -prep: - @echo BUILDDIR: $(BUILDDIR) diff --git a/configure b/configure index d045f036..51d3d135 100755 --- a/configure +++ b/configure @@ -12,18 +12,18 @@ PARAMS="$@" # copy profiles there to configure a copy, not master tree # keeping profile itself completely readonly would be nice -export BUILDDIR="$(bin/mktmpdir mkimage-profiles.build)" +#export BUILDDIR="$(bin/mktmpdir mkimage-profiles.build)" #ls -ld $BUILDDIR #find image.in -type f -print0 | xargs -r0 cp -at "$BUILDDIR"/ -- -rsync -qaH --delete image.in/ "$BUILDDIR"/image/ +#rsync -qaH --delete image.in/ "$BUILDDIR"/image/ #rm -f "$BUILDDIR"/.config.mk -touch "$BUILDDIR"/.config.mk -mkdir "$BUILDDIR"/.mki -rm -f build -[ -w . ] \ -&& ln -sf "$BUILDDIR" build \ -|| echo "profile directory readonly: skipping symlinks, env only" +#touch "$BUILDDIR"/.config.mk +#mkdir "$BUILDDIR"/.mki +#rm -f build +#[ -w . ] \ +#&& ln -sf "$BUILDDIR" build \ +#|| echo "profile directory readonly: skipping symlinks, env only" # remember all those --with-*? we'll pass them downstream, honestly -echo "$PARAMS" > "$BUILDDIR"/.with +#echo "$PARAMS" > "$BUILDDIR"/.with diff --git a/distro.mk b/distro.mk index 882fba8e..a0a7cc9a 100644 --- a/distro.mk +++ b/distro.mk @@ -1,8 +1,8 @@ ### build up distribution's configuration CONFIG = $(BUILDDIR)/.config.mk -# ACHTUNG: don"t use ANY quotes ('/") for put() arguments! -# shell will get confused by ' or args get spammed with " +# NB: don"t use ANY quotes ('/") for put() arguments! +# shell will get confused by ' or args get spammed with " put = $(and $(1),$(put_body)) define put_body @printf '%s\n' '$(1)#=- $@' >> "$(CONFIG)"; @@ -18,7 +18,7 @@ init: :> $(CONFIG) $(call put,KFLAVOUR=std-def) ### $(call put,IMAGE_INIT_LIST=+branding-$$(BRANDING)-release) - #$(call put,STAGE1_PACKAGES=kernel-image-$$(KFLAVOUR)) + @#$(call put,STAGE1_PACKAGES=kernel-image-$$(KFLAVOUR)) $(call put,KERNEL_PACKAGES=kernel-image-$$(KFLAVOUR)) # NB: our */* are phony targets really, just for namespace diff --git a/image.in/configure.ac b/image.in/configure.ac index 14ad11ea..d0469bbf 100644 --- a/image.in/configure.ac +++ b/image.in/configure.ac @@ -7,7 +7,7 @@ AC_ARG_WITH(aptconf, AC_MSG_CHECKING([apt.conf file]) if test -r "$with_aptconf" ; then APTCONF="$with_aptconf" - AC_MSG_RESULT([** $with_aptconf exists]) + AC_MSG_RESULT([$with_aptconf exists]) else echo "WARNING: $with_aptconf missing, ignoring" fi @@ -23,7 +23,7 @@ AC_ARG_WITH(mkimage, AC_MSG_CHECKING([mkimage]) if test -d "$with_mkimage/tools"; then MKIMAGE_PREFIX="$with_mkimage" - AC_MSG_RESULT([** $with_mkimage/tools exists]) + AC_MSG_RESULT([$with_mkimage/tools exists]) fi ], [ diff --git a/iso.mk b/iso.mk index 06d4a40e..9db80398 100644 --- a/iso.mk +++ b/iso.mk @@ -5,6 +5,6 @@ pkgs: iso: pkgs @echo "** starting image build process" @### setup GLOBAL_BOOT_TYPE, etc - (cd $(BUILDDIR)/image; autoconf; ./configure --with-aptconf=/etc/apt/apt.conf.SS_64) ### - echo $(MAKE) -C $(BUILDDIR)/image GLOBAL_BUILDDIR=$(BUILDDIR) + (cd $(BUILDDIR)/image; autoconf; ./configure --with-aptconf=$(HOME)/apt/apt.conf) ### + $(MAKE) -C $(BUILDDIR)/image GLOBAL_BUILDDIR=$(BUILDDIR) @# check iso size diff --git a/pkg/Makefile b/pkg/Makefile index f948062b..6352eb92 100644 --- a/pkg/Makefile +++ b/pkg/Makefile @@ -11,12 +11,14 @@ pkgs: prep test $(if $(filter environment% file,$(origin $V)),\ $(shell cp -a $(addprefix lists/,$(value $V)) \ $(BUILDDIR)/pkg/lists/))) + @cp -a lists/.base $(BUILDDIR)/pkg/lists/ # moving this into pkgs spoils execution order (clobbers results) prep: mkdir -p $(BUILDDIR)/pkg/{lists,groups} # dump *_LISTS variables' values +# TODO: consider GLOBAL_VERBOSE? (currently not coming with .config.mk) test: @$(foreach V, \ $(filter %_LISTS,$(sort $(.VARIABLES))), \