Commit 2cc81b7e authored by Michael Shigorin's avatar Michael Shigorin

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.
parent d920c990
...@@ -7,6 +7,12 @@ include clean.mk ...@@ -7,6 +7,12 @@ include clean.mk
include distro.mk include distro.mk
include iso.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 # we can't use implicit rules for top-level targets, only for prereqs
CONFIGS=$(shell sed -n 's,^distro/\([^:]\+\):.*$$,\1,p' distro.mk) CONFIGS=$(shell sed -n 's,^distro/\([^:]\+\):.*$$,\1,p' distro.mk)
DISTROS=$(addsuffix .iso,$(CONFIGS)) DISTROS=$(addsuffix .iso,$(CONFIGS))
...@@ -15,4 +21,16 @@ all: ...@@ -15,4 +21,16 @@ all:
@echo '** available distribution targets:' @echo '** available distribution targets:'
@echo $(DISTROS) | fmt -sw65 | column -t @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 $(DISTROS): %.iso: | prep distro/% iso
...@@ -8,12 +8,5 @@ distclean: clean ...@@ -8,12 +8,5 @@ distclean: clean
@[ -d build/ ] && \ @[ -d build/ ] && \
make -C build/image $@ GLOBAL_BUILDDIR=$(shell readlink build) && \ make -C build/image $@ GLOBAL_BUILDDIR=$(shell readlink build) && \
rm -r $(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)
...@@ -12,18 +12,18 @@ PARAMS="$@" ...@@ -12,18 +12,18 @@ PARAMS="$@"
# copy profiles there to configure a copy, not master tree # copy profiles there to configure a copy, not master tree
# keeping profile itself completely readonly would be nice # 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 #ls -ld $BUILDDIR
#find image.in -type f -print0 | xargs -r0 cp -at "$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 #rm -f "$BUILDDIR"/.config.mk
touch "$BUILDDIR"/.config.mk #touch "$BUILDDIR"/.config.mk
mkdir "$BUILDDIR"/.mki #mkdir "$BUILDDIR"/.mki
rm -f build #rm -f build
[ -w . ] \ #[ -w . ] \
&& ln -sf "$BUILDDIR" build \ #&& ln -sf "$BUILDDIR" build \
|| echo "profile directory readonly: skipping symlinks, env only" #|| echo "profile directory readonly: skipping symlinks, env only"
# remember all those --with-*? we'll pass them downstream, honestly # remember all those --with-*? we'll pass them downstream, honestly
echo "$PARAMS" > "$BUILDDIR"/.with #echo "$PARAMS" > "$BUILDDIR"/.with
### build up distribution's configuration ### build up distribution's configuration
CONFIG = $(BUILDDIR)/.config.mk 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 " # shell will get confused by ' or args get spammed with "
put = $(and $(1),$(put_body)) put = $(and $(1),$(put_body))
define put_body define put_body
...@@ -18,7 +18,7 @@ init: ...@@ -18,7 +18,7 @@ init:
:> $(CONFIG) :> $(CONFIG)
$(call put,KFLAVOUR=std-def) ### $(call put,KFLAVOUR=std-def) ###
$(call put,IMAGE_INIT_LIST=+branding-$$(BRANDING)-release) $(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)) $(call put,KERNEL_PACKAGES=kernel-image-$$(KFLAVOUR))
# NB: our */* are phony targets really, just for namespace # NB: our */* are phony targets really, just for namespace
......
...@@ -7,7 +7,7 @@ AC_ARG_WITH(aptconf, ...@@ -7,7 +7,7 @@ AC_ARG_WITH(aptconf,
AC_MSG_CHECKING([apt.conf file]) AC_MSG_CHECKING([apt.conf file])
if test -r "$with_aptconf" ; then if test -r "$with_aptconf" ; then
APTCONF="$with_aptconf" APTCONF="$with_aptconf"
AC_MSG_RESULT([** $with_aptconf exists]) AC_MSG_RESULT([$with_aptconf exists])
else else
echo "WARNING: $with_aptconf missing, ignoring" echo "WARNING: $with_aptconf missing, ignoring"
fi fi
...@@ -23,7 +23,7 @@ AC_ARG_WITH(mkimage, ...@@ -23,7 +23,7 @@ AC_ARG_WITH(mkimage,
AC_MSG_CHECKING([mkimage]) AC_MSG_CHECKING([mkimage])
if test -d "$with_mkimage/tools"; then if test -d "$with_mkimage/tools"; then
MKIMAGE_PREFIX="$with_mkimage" MKIMAGE_PREFIX="$with_mkimage"
AC_MSG_RESULT([** $with_mkimage/tools exists]) AC_MSG_RESULT([$with_mkimage/tools exists])
fi fi
], ],
[ [
......
...@@ -5,6 +5,6 @@ pkgs: ...@@ -5,6 +5,6 @@ pkgs:
iso: pkgs iso: pkgs
@echo "** starting image build process" @echo "** starting image build process"
@### setup GLOBAL_BOOT_TYPE, etc @### setup GLOBAL_BOOT_TYPE, etc
(cd $(BUILDDIR)/image; autoconf; ./configure --with-aptconf=/etc/apt/apt.conf.SS_64) ### (cd $(BUILDDIR)/image; autoconf; ./configure --with-aptconf=$(HOME)/apt/apt.conf) ###
echo $(MAKE) -C $(BUILDDIR)/image GLOBAL_BUILDDIR=$(BUILDDIR) $(MAKE) -C $(BUILDDIR)/image GLOBAL_BUILDDIR=$(BUILDDIR)
@# check iso size @# check iso size
...@@ -11,12 +11,14 @@ pkgs: prep test ...@@ -11,12 +11,14 @@ pkgs: prep test
$(if $(filter environment% file,$(origin $V)),\ $(if $(filter environment% file,$(origin $V)),\
$(shell cp -a $(addprefix lists/,$(value $V)) \ $(shell cp -a $(addprefix lists/,$(value $V)) \
$(BUILDDIR)/pkg/lists/))) $(BUILDDIR)/pkg/lists/)))
@cp -a lists/.base $(BUILDDIR)/pkg/lists/
# moving this into pkgs spoils execution order (clobbers results) # moving this into pkgs spoils execution order (clobbers results)
prep: prep:
mkdir -p $(BUILDDIR)/pkg/{lists,groups} mkdir -p $(BUILDDIR)/pkg/{lists,groups}
# dump *_LISTS variables' values # dump *_LISTS variables' values
# TODO: consider GLOBAL_VERBOSE? (currently not coming with .config.mk)
test: test:
@$(foreach V, \ @$(foreach V, \
$(filter %_LISTS,$(sort $(.VARIABLES))), \ $(filter %_LISTS,$(sort $(.VARIABLES))), \
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment