2018-08-12 02:26:38 +00:00
|
|
|
#!/usr/bin/make -f
|
2018-08-06 01:49:45 +00:00
|
|
|
# 2018 Luke Shumaker
|
2018-08-06 00:09:42 +00:00
|
|
|
|
2018-08-12 21:56:54 +00:00
|
|
|
# Runtime/user options #########################################################
|
2018-08-12 02:26:38 +00:00
|
|
|
GITREV ?= systemd/master
|
|
|
|
WORKDIR ?= $(CURDIR)/workdir
|
2018-08-06 00:09:42 +00:00
|
|
|
|
2018-08-12 21:56:54 +00:00
|
|
|
################################################################################
|
|
|
|
# Main #
|
|
|
|
################################################################################
|
|
|
|
|
2018-08-12 02:26:38 +00:00
|
|
|
# Configure Make ###############################################################
|
2018-08-12 21:56:54 +00:00
|
|
|
|
2018-08-12 02:26:38 +00:00
|
|
|
.ONESHELL:
|
2018-08-12 21:56:54 +00:00
|
|
|
SHELL = bash
|
|
|
|
.SHELLFLAGS = -veE -o pipefail -c
|
|
|
|
.SILENT:
|
|
|
|
|
2018-08-12 02:26:38 +00:00
|
|
|
.DELETE_ON_ERROR:
|
|
|
|
.SECONDARY:
|
2018-08-12 21:56:54 +00:00
|
|
|
|
|
|
|
.DEFAULT_GOAL = check
|
2018-08-12 01:58:39 +00:00
|
|
|
|
2018-08-12 02:26:38 +00:00
|
|
|
################################################################################
|
2018-08-12 21:56:54 +00:00
|
|
|
|
2018-08-12 02:26:38 +00:00
|
|
|
.PHONY: FORCE
|
|
|
|
|
2018-08-12 21:56:54 +00:00
|
|
|
# git ##########################################################################
|
2018-08-12 02:26:38 +00:00
|
|
|
${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
|
2018-08-12 21:56:54 +00:00
|
|
|
( cd $< && git rev-parse --verify '${GITREV}' ) | sed 's/^/COMMIT=/' | ./write-ifchanged '$@'
|
2018-08-12 02:26:38 +00:00
|
|
|
-include ${WORKDIR}/.COMMIT.mk
|
|
|
|
|
2018-08-12 23:11:11 +00:00
|
|
|
check: ${WORKDIR}/build-232/pkgdest
|
|
|
|
check: ${WORKDIR}/build-$(COMMIT)/pkgdest
|
|
|
|
.PHONY: check
|
|
|
|
|
2018-08-12 21:56:54 +00:00
|
|
|
# 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 -- '$@'
|
|
|
|
cp -- '$(filter %.raw,$^)' '$@'
|
|
|
|
./osi-mk --edit $(addprefix --module=,$(filter osi-mk.d/%.sh,$^)) '$@'
|
|
|
|
./osi-run '$@' <<-'EOF'
|
|
|
|
#!/usr/bin/env bash
|
|
|
|
script --return --quiet --command 'sudo librechroot make' /dev/null
|
|
|
|
EOF
|
|
|
|
|
|
|
|
# build systemd ################################################################
|
|
|
|
|
|
|
|
# build systemd 232
|
|
|
|
${WORKDIR}/build-232/build.raw: ${WORKDIR}/build.raw
|
2018-08-12 22:49:35 +00:00
|
|
|
${WORKDIR}/build-232/build.raw: osi-mk.d/testuser.sh
|
2018-08-12 02:26:38 +00:00
|
|
|
${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 -- '$@'
|
2018-08-12 22:16:27 +00:00
|
|
|
mkdir -p -- '$(@D)'
|
2018-08-12 21:56:54 +00:00
|
|
|
cp -- '$(filter %.raw,$^)' '$@'
|
2018-08-06 01:56:44 +00:00
|
|
|
./osi-mk \
|
2018-08-12 21:56:54 +00:00
|
|
|
--edit \
|
|
|
|
$(addprefix --module=,$(filter osi-mk.d/%.sh,$^)) \
|
2018-08-12 22:16:27 +00:00
|
|
|
--directory='${WORKDIR}/systemd.git:/home/testuser/packages/srcdest/systemd' \
|
|
|
|
--directory='abs/systemd-232:/home/testuser/packages/abs/systemd' \
|
2018-08-12 02:26:38 +00:00
|
|
|
'$@'
|
|
|
|
${WORKDIR}/build-232/build.log: %/build.log: %/build.raw
|
2018-08-12 23:18:05 +00:00
|
|
|
./osi-run '$<' <<-EOF |& tee '$@'
|
2018-08-06 00:09:42 +00:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
set -ex
|
2018-08-10 00:22:41 +00:00
|
|
|
cd ~/packages/abs/systemd
|
2018-08-12 23:38:41 +00:00
|
|
|
# sync on rebuild because the downgrade in [repo] will confuse chcleanup
|
|
|
|
script --return --quiet --command 'sudo librechroot sync' /dev/null
|
2018-08-10 00:22:41 +00:00
|
|
|
script --return --quiet --command 'sudo libremakepkg' /dev/null
|
|
|
|
EOF
|
2018-08-12 02:26:38 +00:00
|
|
|
|
2018-08-12 21:56:54 +00:00
|
|
|
# build the code under test
|
|
|
|
${WORKDIR}/build-$(COMMIT)/build.raw: ${WORKDIR}/build.raw
|
2018-08-12 22:49:35 +00:00
|
|
|
${WORKDIR}/build-$(COMMIT)/build.raw: osi-mk.d/testuser.sh
|
2018-08-12 02:26:38 +00:00
|
|
|
${WORKDIR}/build-$(COMMIT)/build.raw: abs/systemd $(wildcard abs/systemd/*)
|
|
|
|
${WORKDIR}/build-$(COMMIT)/build.raw: | ${WORKDIR}/systemd.git
|
2018-08-12 21:56:54 +00:00
|
|
|
${WORKDIR}/build-$(COMMIT)/build.raw: ${WORKDIR}/.COMMIT.mk
|
2018-08-12 02:26:38 +00:00
|
|
|
rm -f -- '$@'
|
|
|
|
mkdir -p -- '$(@D)'
|
2018-08-12 22:16:27 +00:00
|
|
|
cp -- '$(filter %.raw,$^)' '$@'
|
2018-08-10 00:22:41 +00:00
|
|
|
./osi-mk \
|
2018-08-12 21:56:54 +00:00
|
|
|
--edit \
|
|
|
|
$(addprefix --module=,$(filter osi-mk.d/%.sh,$^)) \
|
2018-08-12 22:16:27 +00:00
|
|
|
--directory='${WORKDIR}/systemd.git:/home/testuser/packages/srcdest/systemd' \
|
|
|
|
--directory='abs/systemd:/home/testuser/packages/abs/systemd' \
|
2018-08-12 02:26:38 +00:00
|
|
|
'$@'
|
|
|
|
${WORKDIR}/build-$(COMMIT)/build.log: %/build.log: %/build.raw
|
2018-08-12 23:18:05 +00:00
|
|
|
./osi-run '$<' <<-EOF |& tee '$@'
|
2018-08-10 00:22:41 +00:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
set -ex
|
2018-08-06 00:09:42 +00:00
|
|
|
cd ~/packages/abs/systemd
|
2018-08-12 01:56:00 +00:00
|
|
|
sed 's:@COMMIT@:${COMMIT}:' < PKGBUILD.in > PKGBUILD
|
2018-08-10 00:22:41 +00:00
|
|
|
script --return --quiet --command 'sudo libremakepkg' /dev/null
|
2018-08-06 00:09:42 +00:00
|
|
|
EOF
|
2018-08-12 02:26:38 +00:00
|
|
|
|
|
|
|
%/pkgdest: %/build.log
|
|
|
|
rm -rf -- '$@'
|
|
|
|
./osi-extract '$*/build.raw' /home/testuser/packages/pkgdest '$@'
|
2018-08-12 23:18:05 +00:00
|
|
|
test -d '$@'
|
|
|
|
touch '$@'
|