Commit d77e1d8d authored by Michael Shigorin's avatar Michael Shigorin

drop autoconf, a few vars in .mk suffice

A major change in approach largely thanks to discussions with Alexey Cheusov but also well aligned with my own findings: autoconf doesn't let the variables to form an inheritance. And data flow described at http://www.altlinux.org/WhiteLabel (which in its turn was born thanks to Gavin Henrick of Diva Telecom and to Alexander Bokovoy of SaM-Solutions) is really dependent on the existence of such an inheritance. Also: - distro.mk += try() - "hide" special targets - fixed wrt distro/.{base,init,metaconf}, thx gns@ - README updates + added metaconf.mk + clarifications - updated pci.ids location for hdt
parent 9c883d39
# --- here
# 1. configure distro
# 2. configure subprofiles, prepare package lists/groups and hooks
# 3. build subprofiles
# 4. build image
# --- in BUILDDIR
# 3. build subprofiles and subsequently image
all help:
@echo '** available distribution targets:'
@echo $(DISTROS) | fmt -sw65 | column -t
include clean.mk
include distro.mk
......@@ -13,7 +18,6 @@ include iso.mk
ifndef BUILDDIR
BUILDDIR := $(shell realpath build || bin/mktmpdir mkimage-profiles.build)
endif
export BUILDDIR
ifdef DEBUG
GLOBAL_VERBOSE ?= 1
......@@ -21,11 +25,10 @@ SHELL += -x
endif
# 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))
ARCH ?= $(shell arch | sed 's/i686/i586/')
all:
@echo '** available distribution targets:'
@echo $(DISTROS) | fmt -sw65 | column -t
export ARCH BUILDDIR DEBUG GLOBAL_VERBOSE SHELL
$(DISTROS): %.iso: | profile/init distro/% boot/isolinux profile/populate iso
see also http://www.altlinux.org/Mkimage/Profiles/next;
quickstart:
make distclean server-light.iso
quickstart: make distclean server-light.iso
configurables: ~/.mkimage/metaconf.mk, see distro.mk
Концепция:
- метапрофиль служит репозиторием всего возможно нужного для
......@@ -9,7 +10,7 @@ make distclean server-light.iso
итоговый дистрибутив
Особенности:
- метапрофиль может быть полностью read-only
- метапрофиль может быть полностью read-only при сборке
- для сборки подыскивается предпочтительно tmpfs
- в профиль копируются только нужные объекты
......
- кратко описать каждый субпрофиль и каждую фичу
......@@ -24,17 +24,19 @@ include functions.mk
sub/%:
@$(call add,SUBPROFILES,$(@:sub/%=%))
distro/init:
# initalize config from scratch, put some sane defaults in
distro/.init:
@echo "** starting distro configuration build process"
@:> $(CONFIG)
@$(call try,MKIMAGE_PREFIX,/usr/share/mkimage)
@$(call try,GLOBAL_VERBOSE,)
distro/base: distro/init sub/stage1 use/syslinux use/syslinux/localboot.cfg
distro/.base: distro/.init sub/stage1 use/syslinux use/syslinux/localboot.cfg
@$(call set,KFLAVOUR,std-def)
@$(call set,IMAGE_INIT_LIST,+branding-$$(BRANDING)-release)
@$(call set,BRANDING,altlinux-desktop) ###
@$(call set,KERNEL_PACKAGES,kernel-image-$$(KFLAVOUR))
distro/installer: distro/base sub/install2 use/syslinux/install2.cfg
distro/installer: distro/.base sub/install2 use/syslinux/install2.cfg
@#$(call put,BRANDING=altlinux-sisyphus) ###
@$(call set,BASE_LISTS,base kernel)
@$(call set,INSTALL2_PACKAGES,installer-distro-server-light-stage2) ###
......@@ -51,9 +53,19 @@ distro/server-light: distro/server-base use/hdt
@$(call add,GROUPS,ipmi mysql-server dhcp-server mail-server)
@$(call add,GROUPS,monitoring diag-tools)
distro/minicd: distro/server-base
@$(call set,KFLAVOUR,std-ng) # we might need the most recent drivers
@$(call add,MAIN_PACKAGES,etcnet-full)
@$(call set,BRANDING,sisyphus-server-light)
# bootloader test target
distro/syslinux: distro/base use/syslinux/ui-gfxboot \
use/hdt use/memtest boot/isolinux
distro/syslinux: distro/.base use/syslinux/ui-gfxboot use/hdt use/memtest
# pick up release manager's config (TODO: distro-specific include as well?)
distro/.metaconf:
@if [ -s $(HOME)/.mkimage/metaconf.mk ]; then \
$(call put,-include $(HOME)/.mkimage/metaconf.mk); \
fi
boot/%: distro/init
boot/%: distro/.init
@$(call set,BOOTLOADER,$*)
use/hdt: use/syslinux
@$(call add,SYSLINUX_MODULES,hdt)
@$(call add,SYSLINUX_FILES,/usr/share/pci.ids)
# might be /usr/share/pci.ids if usig hwdatabase
@$(call add,SYSLINUX_FILES,/usr/share/misc/pci.ids)
......@@ -11,7 +11,7 @@ define put_body
printf '%s\n' '$(1)' >> "$(CONFIG)"; }
endef
# these two take two args
# these three take two args
# add() just appends an additive rule...
add = $(and $(1),$(2),$(add_body))
define add_body
......@@ -20,15 +20,22 @@ printf '%s += %s\n' '$(1)' '$(2)' >> "$(CONFIG)"; }
endef
# ...set() comments out any previous definition
# and then appends an assigning rule
# and then appends an assigning rule...
set = $(and $(1),$(2),$(set_body))
define set_body
{ $(log_body); \
subst 's|^$(1)[ ]*+*=.*$$|#& # overridden by $@|' "$(CONFIG)"; \
subst 's|^$(1)[ ]*[+?]*=.*$$|#& # overridden by $@|' "$(CONFIG)"; \
printf '%s = %s\n' '$(1)' '$(2)' >> "$(CONFIG)"; }
endef
# is there a way to set a global make var from a recipe?..
# try() appends a conditionally-assigning rule
try = $(and $(1),$(2),$(try_body))
define try_body
{ $(log_body); \
printf '%s ?= %s\n' '$(1)' '$(2)' >> "$(CONFIG)"; }
endef
# if the rule being executed isn't logged yet, log it
define log_body
{ grep -q '^# $@$$' "$(CONFIG)" || printf '# %s\n' '$@' >> "$(CONFIG)"; }
endef
......
include globals.mk
include functions.mk
include $(MKIMAGE_PREFIX)/config.mk
include $(GLOBAL_BUILDDIR)/.config.mk
include $(MKIMAGE_PREFIX)/config.mk
SUBDIRS = $(SUBPROFILES)
......@@ -12,13 +11,23 @@ MKI_PACK_RESULTS = isoboot:mkimage-profiles.iso
COPY_TREE = ./files
BOOT_TYPE = isolinux
ifeq "$(wildcard $(APTCONF))" ""
GLOBAL_HSH_APT_CONFIG = /etc/apt/apt.conf
else
GLOBAL_HSH_APT_CONFIG = $(APTCONF)
endif
include $(MKIMAGE_PREFIX)/targets.mk
all: prep copy-subdirs copy-tree run-scripts pack-image
# FIXME: scripts.d/?
prep: disk-info metadata
prep: debug disk-info metadata
debug:
@echo "TOPDIR=$(TOPDIR)"
@echo "ARCH=$(ARCH)"
@echo "GLOBAL_HSH_APT_CONFIG=$(GLOBAL_HSH_APT_CONFIG)"
disk-info:
@mkdir -p files/.disk
......
AC_INIT( [mkimage-profiles], [0.1], [http://bugzilla.altlinux.org] )
AC_ARG_WITH(aptconf,
AC_HELP_STRING([--with-aptconf=file],
[custom apt.conf location, e.g '--with-aptconf=/home/me/apt.conf']),
[
AC_MSG_CHECKING([apt.conf file])
if test -r "$with_aptconf" ; then
APTCONF="$with_aptconf"
AC_MSG_RESULT([$with_aptconf exists])
else
echo "WARNING: $with_aptconf missing, ignoring"
fi
],
[
APTCONF=/etc/apt/apt.conf
])
AC_ARG_WITH(mkimage,
AC_HELP_STRING([--with-mkimage=dir],
[custom mkimage prefix, e.g '--with-mkimage=/home/me/usr/share/mkimage']),
[
AC_MSG_CHECKING([mkimage])
if test -d "$with_mkimage/tools"; then
MKIMAGE_PREFIX="$with_mkimage"
AC_MSG_RESULT([$with_mkimage/tools exists])
fi
],
[
MKIMAGE_PREFIX='/usr/share/mkimage'
])
# with-kernel: provide two separate desktop/server default substs?
AC_SUBST(APTCONF)
AC_SUBST(MKIMAGE_PREFIX)
AC_SUBST(DISTRO)
AC_SUBST(LABEL)
AC_CONFIG_FILES([
globals.mk
])
AC_OUTPUT
export
MKIMAGE_PREFIX = @MKIMAGE_PREFIX@
GLOBAL_HSH_APT_CONFIG = @APTCONF@
GLOBAL_VERBOSE ?= 0
# adding boot/isolinux to prereqs is too late here,
# since profile/populate has already finished by now
#
# NB: /usr/bin/{i586,x86_64} are setarch(8) symlinks
iso:
@echo "** starting image build process"
@(cd $(BUILDDIR)/; autoconf; ./configure --with-aptconf=$(HOME)/apt/apt.conf) ###
$(MAKE) -C $(BUILDDIR)/ GLOBAL_BUILDDIR=$(BUILDDIR)
$(ARCH) $(MAKE) -C $(BUILDDIR)/ GLOBAL_BUILDDIR=$(BUILDDIR)
basesystem
kernel-image-std-def
#kernel-image-std-def
interactivesystem
apt-conf-sisyphus
......
kernel-modules-igb-std-def
#kernel-modules-igb-std-def
profile/init:
@echo "** BUILDDIR: $(BUILDDIR)"
@rsync -qaH --delete image.in/ "$(BUILDDIR)"/
@touch "$(BUILDDIR)"/.config.mk
@mkdir "$(BUILDDIR)"/.mki
@:> "$(BUILDDIR)"/.config.mk
@mkdir "$(BUILDDIR)"/.mki # mkimage toplevel marker
@type -t git >&/dev/null && \
cd $(BUILDDIR) && \
git init -q && \
git add . && \
git commit -qam 'init'
@rm -f build
@[ -w . ] \
&& ln -sf "$(BUILDDIR)" build \
|| echo "** profile directory readonly: skipping symlinks, env only"
@if [ -w . ]; then \
ln -sf "$(BUILDDIR)" build; \
else \
echo "** profile directory readonly: skipping symlinks, env only"; \
fi
profile/populate: profile/init
profile/populate: profile/init distro/.metaconf
@for dir in sub.in features.in pkg.in; do \
$(MAKE) -C $$dir; \
done
......
default: all
include ../globals.mk
include ../functions.mk
include $(MKIMAGE_PREFIX)/config.mk
include $(GLOBAL_BUILDDIR)/.config.mk
include $(GLOBAL_BUILDDIR)/functions.mk
include $(MKIMAGE_PREFIX)/config.mk
IMAGE_PACKAGES = $(KERNEL_PACKAGES) \
$(COMMON_PACKAGES) \
......
#!/bin/sh
# remove unused fonts
cd /usr/share/fonts/bitmap/misc/
rm -f *ja.* *ko.* han* gb* jis* k14* rk* *rk.* *kana* cl*
rm -f *ISO* *JIS* *KOI*
cd /usr/share/fonts/bitmap/misc/ &&
rm -f *ja.* *ko.* han* gb* jis* k14* rk* *rk.* *kana* cl* \
*ISO* *JIS* *KOI*
# TODO: sort out the rest of *x*
# drop unneeded translation
cd /usr/share/qt4/translations/
rm -f *_zh* *_ja*
cd /usr/share/qt4/translations/ &&
rm -f *_zh* *_ja*
# ...l10n...
cd /usr/share/X11/locale
rm -rf *[^C8]/ ja* ko* th* vi* zh* iso*
cd /usr/share/X11/locale &&
rm -rf *[^C8]/ ja* ko* th* vi* zh* iso*
# xkb
cd /usr/share/X11/xkb/symbols
rm -rf *_vndr jp kr th vn cn
cd /usr/share/X11/xkb/symbols &&
rm -rf *_vndr jp kr th vn cn
# gconv
cd /usr/lib*/gconv
rm -f CP* ISO* KOI* *JIS* T* HP* MAC*
cd /usr/lib*/gconv &&
rm -f CP* ISO* KOI* *JIS* T* HP* MAC*
# locales
cd /usr/lib*/locale
rm -rf ja_* ko_* th_* zh_*
cd /usr/lib*/locale &&
rm -rf ja_* ko_* th_* zh_*
:
......@@ -2,16 +2,16 @@
default: all
include ../globals.mk
include ../functions.mk
include $(MKIMAGE_PREFIX)/config.mk
include $(GLOBAL_BUILDDIR)/.config.mk
include $(GLOBAL_BUILDDIR)/functions.mk
include $(MKIMAGE_PREFIX)/config.mk
CHROOT_PACKAGES = apt-utils rsync
PACKAGES_EXPAND_METHOD=regexp
# TODO: map() list() onto these
IMAGE_PACKAGES = $(call list,.base) \
IMAGE_PACKAGES = $(KERNEL_PACKAGES) \
$(call list,.base) \
$(COMMON_PACKAGES) \
$(MAIN_PACKAGES) \
$(call list,$(BASE_LISTS)) \
......
include ../globals.mk
include ../functions.mk
include $(MKIMAGE_PREFIX)/config.mk
include $(GLOBAL_BUILDDIR)/.config.mk
include $(GLOBAL_BUILDDIR)/functions.mk
include $(MKIMAGE_PREFIX)/config.mk
CHROOT_PACKAGES = $(KERNEL_PACKAGES) $(STAGE1_PACKAGES) $(COMMON_PACKAGES)
......
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