#!/usr/bin/make -f # 2018 Luke Shumaker # Runtime/user options ######################################################### GITREV ?= systemd/master WORKDIR ?= workdir ################################################################################ # Main # ################################################################################ # Configure Make ############################################################### .ONESHELL: SHELL = bash .SHELLFLAGS = -veE -o pipefail -c .SILENT: .DELETE_ON_ERROR: .SECONDARY: .DEFAULT_GOAL = check ################################################################################ .PHONY: FORCE # git ########################################################################## ${WORKDIR}/systemd.git: FORCE mkdir -p -- '$(@D)' gitget bare https://git.parabola.nu/~lukeshu/systemd.git '$@' test -d '$@' touch '$@' ${WORKDIR}/.COMMIT.mk: ${WORKDIR}/systemd.git ( cd $< && git rev-parse --verify '${GITREV}' ) | sed 's/^/COMMIT=/' | ./write-ifchanged '$@' -include ${WORKDIR}/.COMMIT.mk check: ${WORKDIR}/build-232/pkgdest check: ${WORKDIR}/build-$(COMMIT)/pkgdest .PHONY: check # osi-mk base images ########################################################### ${WORKDIR}/base.raw: osi-mk.d/systemd-osi-run.sh ${WORKDIR}/base.raw: rm -f -- '$@' mkdir -p -- '$(@D)' ./osi-mk --size=4G --package='base' $(addprefix --module=,$(filter osi-mk.d/%.sh,$^)) '$@' ${WORKDIR}/build.raw: ${WORKDIR}/base.raw ${WORKDIR}/build.raw: osi-mk.d/libretools.sh ${WORKDIR}/build.raw: osi-mk.d/builddeps.sh ${WORKDIR}/build.raw: osi-mk.d/systemd-dhcpcd.sh ${WORKDIR}/build.raw: rm -f -- '$@' '$@.tmp' cp -- '$(filter %.raw,$^)' '$@.tmp' ./osi-mk --edit $(addprefix --module=,$(filter osi-mk.d/%.sh,$^)) '$@.tmp' ./osi-run '$@.tmp' <<-'EOF' #!/usr/bin/env bash set -ex libreblacklist update script --return --quiet --command 'sudo librechroot make' /dev/null EOF mv -T -- '$@.tmp' '$@' # build systemd ################################################################ # build systemd 232 ${WORKDIR}/build-232/build.raw: ${WORKDIR}/build.raw ${WORKDIR}/build-232/build.raw: osi-mk.d/testuser.sh ${WORKDIR}/build-232/build.raw: abs/systemd-232 $(wildcard abs/systemd-232/*) ${WORKDIR}/build-232/build.raw: | ${WORKDIR}/systemd.git ${WORKDIR}/build-232/build.raw: rm -f -- '$@' '$@.tmp' mkdir -p -- '$(@D)' cp -- '$(filter %.raw,$^)' '$@.tmp' ./osi-mk \ --edit \ $(addprefix --module=,$(filter osi-mk.d/%.sh,$^)) \ --directory='${WORKDIR}/systemd.git:/home/testuser/packages/srcdest/systemd' \ --directory='abs/systemd-232:/home/testuser/packages/abs/systemd' \ '$@.tmp' mv -T -- '$@.tmp' '$@' ${WORKDIR}/build-232/build.log: %/build.log: %/build.raw ./osi-run '$<' <<-EOF |& tee '$@.tmp' #!/usr/bin/env bash set -ex cd ~/packages/abs/systemd # sync on rebuild because the downgrade in [repo] will confuse chcleanup script --return --quiet --command 'sudo librechroot sync' /dev/null script --return --quiet --command 'sudo libremakepkg' /dev/null EOF mv -T -- '$@.tmp' '$@' # build the code under test ${WORKDIR}/build-$(COMMIT)/build.raw: ${WORKDIR}/build.raw ${WORKDIR}/build-$(COMMIT)/build.raw: osi-mk.d/testuser.sh ${WORKDIR}/build-$(COMMIT)/build.raw: abs/systemd $(wildcard abs/systemd/*) ${WORKDIR}/build-$(COMMIT)/build.raw: | ${WORKDIR}/systemd.git ${WORKDIR}/build-$(COMMIT)/build.raw: | ${WORKDIR}/.COMMIT.mk rm -f -- '$@' '$@.tmp' mkdir -p -- '$(@D)' cp -- '$(filter %.raw,$^)' '$@.tmp' ./osi-mk \ --edit \ $(addprefix --module=,$(filter osi-mk.d/%.sh,$^)) \ --directory='${WORKDIR}/systemd.git:/home/testuser/packages/srcdest/systemd' \ --directory='abs/systemd:/home/testuser/packages/abs/systemd' \ '$@.tmp' mv -T -- '$@.tmp' '$@' ${WORKDIR}/build-$(COMMIT)/build.log: %/build.log: %/build.raw ./osi-run '$<' <<-EOF |& tee '$@.tmp' #!/usr/bin/env bash set -ex cd ~/packages/abs/systemd sed 's:@COMMIT@:${COMMIT}:' < PKGBUILD.in > PKGBUILD script --return --quiet --command 'sudo libremakepkg' /dev/null EOF mv -T -- '$@.tmp' '$@' %/pkgdest: %/build.log rm -rf -- '$@' ./osi-extract '$*/build.raw' /home/testuser/packages/pkgdest '$@' test -d '$@' touch '$@'