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.
This commit is contained in:
Michael Shigorin 2010-09-08 18:19:23 +03:00
parent d920c9904c
commit 2cc81b7e75
7 changed files with 37 additions and 24 deletions

View File

@ -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

View File

@ -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)

18
configure vendored
View File

@ -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

View File

@ -1,7 +1,7 @@
### build up distribution's configuration
CONFIG = $(BUILDDIR)/.config.mk
# ACHTUNG: don"t use ANY quotes ('/") for put() arguments!
# 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
@ -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

View File

@ -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
],
[

4
iso.mk
View File

@ -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

View File

@ -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))), \