[Lunar-commits] <lunar-iso> Corrected Makefiles and build scripts
Peter de Ridder
peter at lunar-linux.org
Thu Apr 11 00:32:14 CEST 2013
commit 0e9c86f6fb0de60e9d6897d8f596533d60e80bb6
Author: Peter de Ridder <peter at lunar-linux.org>
Date: Wed, 22 Aug 2012 15:26:34 -0700
URL: https://github.com/lunar-linux/lunar-iso/commit/0e9c86f6fb0de60e9d6897d8f596533d60e80bb6
Corrected Makefiles and build scripts
---
Makefile | +2/-2
mkfiles/bootstrap.mk | +15/-2
mkfiles/build.mk | +16/-3
mkfiles/download.mk | +10/-3
scripts/bootstrap-lunar-cache | +13/-4
scripts/chroot-build -> scripts/chroot-build
scripts/download-lunar-spool -> scripts/download-lunar-spool
template/etc/lunar/local/config | +1/-1
template/etc/lunar/local/optimizations.GCC_4_4 -> template/etc/lunar/local/optimizations.GCC_4_7
9 files changed, 57 insertions(+), 15 deletions(-)
--- a/Makefile
+++ b/Makefile
@@ -34,9 +34,9 @@ include mkfiles/download.mk
include mkfiles/build.mk
clean:
- rm -r $(ISO_TARGET) $(ISO_SOURCE)/{spool,cache}
+ rm -rf $(ISO_TARGET) $(ISO_SOURCE)/{spool,cache}
# Convenient target for development
chroot:
- $(ISO_SOURCE)/scripts/chroot-build su -
+ $(ISO_SOURCE)/scripts/chroot-build /bin/bash
--- a/mkfiles/bootstrap.mk
+++ b/mkfiles/bootstrap.mk
@@ -1,7 +1,9 @@
bootstrap: bootstrap-base bootstrap-lunar
-# file the target with the base file required
+
+# fill the target with the base file required
$(ISO_TARGET)/.base: $(ISO_TARGET)/.stamp
+ @echo bootstrap-base
@mkdir -p $(ISO_TARGET)/{bin,dev,etc,lib,mnt,proc,root,run,sbin,sys,tmp,usr,var} $(ISO_TARGET)/run/lock $(ISO_TARGET)/usr/{bin,include,lib,libexec,sbin,src,share} $(ISO_TARGET)/var/{cache,empty,lib,log,spool,state,tmp}
@ln -sf lib $(ISO_TARGET)/lib32
@ln -sf lib $(ISO_TARGET)/lib64
@@ -10,24 +12,35 @@ $(ISO_TARGET)/.base: $(ISO_TARGET)/.stamp
@ln -sf ../run/lock $(ISO_TARGET)/var/lock
@ln -sf ../run $(ISO_TARGET)/var/run
@cp -r $(ISO_SOURCE)/template/etc $(ISO_TARGET)
+ @echo MAKES=$(ISO_MAKES) > $(ISO_TARGET)/etc/lunar/local/optimizations.GNU_MAKE
@touch $@
bootstrap-base: $(ISO_TARGET)/.base
+
# bootstrap on a lunar host
$(ISO_SOURCE)/cache/.copied:
+ @echo bootstrap-lunar-cache
@$(ISO_SOURCE)/scripts/bootstrap-lunar-cache
@touch $@
+# note: use cat after grep to ignore the exit code of grep
$(ISO_TARGET)/.modules: $(ISO_SOURCE)/cache/.copied $(ISO_TARGET)/.stamp
- for archive in $(ISO_SOURCE)/cache/*-$(ISO_BUILD).tar.bz2 ; do \
+ @echo bootstrap-lunar
+ @for archive in $(ISO_SOURCE)/cache/*-$(ISO_BUILD).tar.bz2 ; do \
tar -xjf "$$archive" -C $(ISO_TARGET) || exit 1 ; \
done
+ @mkdir -p $(ISO_TARGET)/var/state/lunar
+ @touch $(ISO_TARGET)/var/state/lunar/packages.backup
+ @grep -w -v -F "`cut -d: -f1 $(ISO_SOURCE)/cache/packages`" $(ISO_TARGET)/var/state/lunar/packages.backup | cat > $(ISO_TARGET)/var/state/lunar/packages
+ @cat $(ISO_SOURCE)/cache/packages >> $(ISO_TARGET)/var/state/lunar/packages
+ @cp $(ISO_TARGET)/var/state/lunar/packages $(ISO_TARGET)/var/state/lunar/packages.backup
@touch $@
bootstrap-lunar: $(ISO_TARGET)/.modules
+# create the target directory
$(ISO_TARGET)/.stamp:
@mkdir -p $(ISO_TARGET)
@touch $@
--- a/mkfiles/build.mk
+++ b/mkfiles/build.mk
@@ -1,6 +1,9 @@
build: build-toolchain
+
+# generate the required cache files
$(ISO_TARGET)/.moonbase-build: $(ISO_TARGET)/.base $(ISO_TARGET)/.modules $(ISO_TARGET)/.moonbase-download
+ @echo build-moonbase
@$(ISO_SOURCE)/scripts/chroot-build lsh create_module_index
@$(ISO_SOURCE)/scripts/chroot-build lsh create_depends_cache
@$(ISO_SOURCE)/scripts/chroot-build lsh update_plugins
@@ -8,12 +11,22 @@ $(ISO_TARGET)/.moonbase-build: $(ISO_TARGET)/.base $(ISO_TARGET)/.modules $(ISO_
build-moonbase: $(ISO_TARGET)/.moonbase-build
-$(ISO_TARGET)/.toolchain: $(ISO_TARGET)/.moonbase-build
- yes n | lin -rc kernel-headers glibc binutils gcc binutils glibc
+
+# first build sequence to get the toolchain installed properly
+# note: xz is added. The package list is empty and thereby the xz plugin isn't installed.
+$(ISO_TARGET)/.toolchain: $(ISO_TARGET)/.moonbase-build $(ISO_TARGET)/.spool
+ @echo build-toolchain
+ @yes n | $(ISO_SOURCE)/scripts/chroot-build lin -rc kernel-headers glibc binutils gcc binutils glibc
@touch $@
build-toolchain: $(ISO_TARGET)/.toolchain
-$(ISO_TARGET)/.stage1: $(iso_target)/.toolchain
+
+# first time build all the require modules for a minimal system
+STAGE1_MODULES=acl attr bash bzip2 coreutils cracklib dialog diffutils e2fsprogs file findutils gawk gettext glib-2 gmp grep gzip installwatch less libcap libffi libmpc lunar make mpfr ncurses net-tools patch procps readline sed shadow tar util-linux wget xz zlib
+
+$(ISO_TARGET)/.stage1: $(ISO_TARGET)/.toolchain
+ yes n | $(ISO_SOURCE)/scripts/chroot-build lin -rc $(STAGE1_MODULES)
+ @touch $@
build-stage1: $(ISO_TARGET)/.stage1
--- a/mkfiles/download.mk
+++ b/mkfiles/download.mk
@@ -5,23 +5,28 @@ install-sources: install-spool
# download the moonbase
$(ISO_SOURCE)/spool/moonbase.tar.bz2: $(ISO_SOURCE)/spool/.stamp
+ @echo download-moonbase
@wget -O $@ "`lsh eval echo '$$MOONBASE_URL'`/moonbase.tar.bz2" \
|| { rm $@ ; exit 1 ; }
@touch $@
+# note: this installs an empty installed packages list
$(ISO_TARGET)/.moonbase-download: $(ISO_TARGET)/.stamp $(ISO_SOURCE)/spool/moonbase.tar.bz2
+ @echo install-moonbase
@mkdir -p $(ISO_TARGET)/var/lib/lunar/moonbase
@rm -r $(ISO_TARGET)/var/lib/lunar/moonbase
@tar -xjf $(ISO_SOURCE)/spool/moonbase.tar.bz2 -C $(ISO_TARGET)/var/lib/lunar moonbase/core moonbase/aliases
@mkdir -p $(ISO_TARGET)/var/lib/lunar/moonbase/zlocal
@mkdir -p $(ISO_TARGET)/var/state/lunar/moonbase
- @touch $(ISO_TARGET)/var/state/lunar/packages{,.backup}
+ @touch $(ISO_TARGET)/var/state/lunar/{packages,depends}{,.backup}
@touch $@
install-moonbase: $(ISO_TARGET)/.moonbase-download
-#download on a lunar host
+
+# download on a lunar host
$(ISO_SOURCE)/spool/.copied: $(ISO_TARGET)/.moonbase-download
+ @echo download-lunar
@$(ISO_SOURCE)/scripts/download-lunar-spool
@touch $@
@@ -30,6 +35,7 @@ download-lunar: $(ISO_SOURCE)/spool/.copied
# install the sources
$(ISO_TARGET)/.spool: $(ISO_SOURCE)/spool/.copied
+ @echo install-spool
@mkdir -p $(ISO_TARGET)/var/spool/lunar
@cp $(ISO_SOURCE)/spool/* $(ISO_TARGET)/var/spool/lunar/
@touch $@
@@ -37,6 +43,7 @@ $(ISO_TARGET)/.spool: $(ISO_SOURCE)/spool/.copied
install-spool: $(ISO_TARGET)/.spool
+# create the spool directory
$(ISO_SOURCE)/spool/.stamp:
- @mkdir $(ISO_SOURCE)/spool
+ @mkdir -p $(ISO_SOURCE)/spool
@touch $@
--- a/scripts/bootstrap-lunar-cache
+++ b/scripts/bootstrap-lunar-cache
@@ -1,6 +1,6 @@
#!/bin/bash
-BOOTSTRAP_MODULES="bash binutils bzip2 coreutils dialog diffutils file findutils gawk gcc glib-2 glibc grep gzip installwatch less lunar make patch procps readline sed util-linux xz zlib"
+BOOTSTRAP_MODULES="bash binutils bzip2 coreutils dialog diffutils file findutils flex gawk gcc glib-2 glibc grep gzip installwatch less lunar m4 make net-tools patch pbzip2 perl pkgconfig procps readline sed tar texinfo util-linux xz zlib"
mkdir -p "$ISO_SOURCE/cache"
@@ -27,7 +27,7 @@ for mod in $BOOTSTRAP_MODULES ; do
done
# make a unique list of module
-NEED_MODULES=`for mod in $NEED_MODULES ; do echo $mod ; done | sort -u`
+NEED_MODULES=`for mod in $NEED_MODULES ; do echo $mod ; done | sort -u | grep -v '^moonbase$'`
echo Required modules:
for mod in $NEED_MODULES ; do
@@ -36,9 +36,10 @@ done
for mod in $NEED_MODULES ; do
# check for cache file presence
- CACHE="$mod-$(lsh installed_version $mod)-$ISO_BUILD.tar.bz2"
+ MODULE_VERSION=`lsh installed_version $mod`
+ CACHE="$mod-$MODULE_VERSION-$ISO_BUILD.tar.bz2"
if [ ! -f "$ISO_SOURCE/cache/$CACHE" ] ; then
- cp "$LUNAR_CACHE/$CACHE" "$ISO_SOURCE/cache/$CACHE" || NEED_CACHE="$NEED_CACHE $mod"
+ cp "$LUNAR_CACHE/$CACHE" "$ISO_SOURCE/cache/$CACHE" && echo "$mod:$(date --date=@$(stat -c%Z $LUNAR_CACHE/$CACHE) +%Y%m%d):installed:$MODULE_VERSION:0KB" >> "$ISO_SOURCE/cache/packages" || NEED_CACHE="$NEED_CACHE $mod"
fi
done
@@ -59,7 +60,15 @@ if [ -n "$REBUILD_MANUAL" ] ; then
exit 1
fi
+OLD_ARCHIVE=`lunar set ACHIVE`
+lunar set ARCHIVE on
lin -c $NEED_CACHE
+OLD_ARCHIVE=${OLD_ARCHIVE#*=}
+if [ -z "$OLD_ARCHIVE" ] ; then
+ lunar unset ARCHIVE
+else
+ lunar set ARCHIVE $OLD_ARCHIVE
+fi
for mod in $NEED_CACHE ; do
# check for cache file presence
--- a/template/etc/lunar/local/config
+++ b/template/etc/lunar/local/config
@@ -1,5 +1,5 @@
FUZZY=off
- ARCHIVE=off
+ ARCHIVE=on
AUTOFIX=off
AUTOPRUNE=off
MAIL_REPORTS=off
More information about the Lunar-commits
mailing list