diff options
author | Jason A. Donenfeld <Jason@zx2c4.com> | 2016-08-09 20:42:37 +0200 |
---|---|---|
committer | Jason A. Donenfeld <Jason@zx2c4.com> | 2016-08-10 00:47:09 +0200 |
commit | 5eb758e4a3aa8f6ec60313abbcd8cf2b2bc481e1 (patch) | |
tree | 24d0a0c7caa04408c606f5b4de317ef43c53da51 /src/tests/qemu | |
parent | fd063f387ae3512adb5c4b0432db3278bc00b23b (diff) |
qemu: lock distfiles
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Diffstat (limited to 'src/tests/qemu')
-rw-r--r-- | src/tests/qemu/Makefile | 53 |
1 files changed, 34 insertions, 19 deletions
diff --git a/src/tests/qemu/Makefile b/src/tests/qemu/Makefile index 3e5fa46..781fcca 100644 --- a/src/tests/qemu/Makefile +++ b/src/tests/qemu/Makefile @@ -31,7 +31,7 @@ endef define file_download = $(DISTFILES_PATH)/$(1): mkdir -p $(DISTFILES_PATH) - $(DOWNLOAD) $$@ $(MIRROR)$(1) || $(DOWNLOAD) $$@ $(2)$(1) + flock -x $$@.lock -c '[ -f $$@ ] && exit 0; $(DOWNLOAD) $$@ $(MIRROR)$(1) || $(DOWNLOAD) $$@ $(2)$(1)' endef ifeq ($(findstring -rc,$(KERNEL_VERSION)),) @@ -100,27 +100,30 @@ $(BUILD_PATH)/init-cpio-spec.txt: echo "file /lib/libc.so $(MUSL_PATH)/lib/libc.so 755 0 0" >> $@ echo "slink /lib/ld-linux.so.1 libc.so 777 0 0" >> $@ -$(KERNEL_PATH): $(KERNEL_TAR) +$(KERNEL_PATH)/.installed: $(KERNEL_TAR) mkdir -p $(BUILD_PATH) tar -C $(BUILD_PATH) -xf $< sed -i "/^if INET\$$/a source \"net/wireguard/Kconfig\"" $(KERNEL_PATH)/net/Kconfig sed -i "/^obj-\$$(CONFIG_NET).*:=/a obj-\$$(CONFIG_WIREGUARD) += wireguard/" $(KERNEL_PATH)/net/Makefile ln -sf $(shell readlink -f ../..) $(KERNEL_PATH)/net/wireguard + touch $@ -$(KERNEL_PATH)/.config: kernel.config | $(KERNEL_PATH) +$(KERNEL_PATH)/.config: kernel.config | $(KERNEL_PATH)/.installed cp kernel.config $(KERNEL_PATH)/minimal.config printf 'CONFIG_NR_CPUS=$(NR_CPUS)\nCONFIG_INITRAMFS_SOURCE="$(BUILD_PATH)/init-cpio-spec.txt"\n' >> $(KERNEL_PATH)/minimal.config $(MAKE) -C $(KERNEL_PATH) ARCH=x86_64 tinyconfig cd $(KERNEL_PATH) && scripts/kconfig/merge_config.sh -n .config minimal.config -[ "$(DEBUG_KERNEL)" = "yes" ] && ( cd $(KERNEL_PATH) && scripts/kconfig/merge_config.sh -n .config $(PWD)/debug.config ) -$(KERNEL_BZIMAGE): $(KERNEL_PATH) $(KERNEL_PATH)/.config $(BUILD_PATH)/init-cpio-spec.txt $(MUSL_PATH)/lib/libc.so $(IPERF_PATH)/src/iperf3 $(BUILD_PATH)/tools/wg $(IPUTILS_PATH)/ping $(BASH_PATH)/bash $(IPROUTE2_PATH)/ip/ip $(IPTABLES_PATH)/iptables/xtables-multi $(BUILD_PATH)/init ../netns.sh $(WIREGUARD_SOURCES) $(TOOLS_SOURCES) +$(KERNEL_BZIMAGE): $(KERNEL_PATH)/.installed $(KERNEL_PATH)/.config $(BUILD_PATH)/init-cpio-spec.txt $(MUSL_PATH)/lib/libc.so $(IPERF_PATH)/src/iperf3 $(BUILD_PATH)/tools/wg $(IPUTILS_PATH)/ping $(BASH_PATH)/bash $(IPROUTE2_PATH)/ip/ip $(IPTABLES_PATH)/iptables/xtables-multi $(BUILD_PATH)/init ../netns.sh $(WIREGUARD_SOURCES) $(TOOLS_SOURCES) $(MAKE) -C $(KERNEL_PATH) -$(BUILD_PATH)/include/linux: | $(KERNEL_PATH) +$(BUILD_PATH)/include/linux/.installed: | $(KERNEL_PATH)/.installed $(MAKE) -C $(KERNEL_PATH) INSTALL_HDR_PATH=$(BUILD_PATH) headers_install + touch $@ -$(MUSL_PATH)/lib/libc.so: $(MUSL_TAR) | $(BUILD_PATH)/include/linux +$(MUSL_PATH)/lib/libc.so: $(MUSL_TAR) | $(BUILD_PATH)/include/linux/.installed + flock -x $<.lock true tar -C $(BUILD_PATH) -xf $< cd $(MUSL_PATH) && ./configure --prefix=/ --disable-static CFLAGS="$(CFLAGS)" $(MAKE) -C $(MUSL_PATH) @@ -132,24 +135,28 @@ $(MUSL_CC): $(MUSL_PATH)/lib/libc.so printf '#!/bin/sh\nexec "$(CC)" "$$@" -specs "$(BUILD_PATH)/musl-gcc.specs"\n' > $(BUILD_PATH)/musl-gcc chmod +x $(BUILD_PATH)/musl-gcc -$(IPERF_PATH): $(IPERF_TAR) +$(IPERF_PATH)/.installed: $(IPERF_TAR) + flock -x $<.lock true tar -C $(BUILD_PATH) -xf $< sed -i '1s/^/#include <stdint.h>/' $(IPERF_PATH)/src/cjson.h $(IPERF_PATH)/src/timer.h sed -i -r 's/-p?g//g' $(IPERF_PATH)/src/Makefile* + touch $@ -$(IPERF_PATH)/src/iperf3: $(IPERF_PATH) $(MUSL_CC) +$(IPERF_PATH)/src/iperf3: $(IPERF_PATH)/.installed $(MUSL_CC) cd $(IPERF_PATH) && CC="$(MUSL_CC)" CFLAGS="$(CFLAGS) -D_GNU_SOURCE" ./configure --prefix=/ --host=$(CHOST) --enable-static --disable-shared $(MAKE) -C $(IPERF_PATH) strip -s $@ -$(LIBMNL_PATH): $(LIBMNL_TAR) +$(LIBMNL_PATH)/.installed: $(LIBMNL_TAR) + flock -x $<.lock true tar -C $(BUILD_PATH) -xf $< + touch $@ -$(LIBMNL_PATH)/src/.libs/libmnl.a: $(LIBMNL_PATH) $(MUSL_CC) +$(LIBMNL_PATH)/src/.libs/libmnl.a: $(LIBMNL_PATH)/.installed $(MUSL_CC) cd $(LIBMNL_PATH) && CC="$(MUSL_CC)" CFLAGS="$(CFLAGS)" ./configure --prefix=/ --host=$(CHOST) --enable-static --disable-shared $(MAKE) -C $(LIBMNL_PATH) -$(BUILD_PATH)/tools/wg: $(MUSL_CC) $(TOOLS_SOURCES) $(LIBMNL_PATH)/src/.libs/libmnl.a | $(BUILD_PATH)/include/linux +$(BUILD_PATH)/tools/wg: $(MUSL_CC) $(TOOLS_SOURCES) $(LIBMNL_PATH)/src/.libs/libmnl.a | $(BUILD_PATH)/include/linux/.installed cp -pr ../../uapi.h ../../tools $(BUILD_PATH)/ $(MAKE) -C $(BUILD_PATH)/tools clean CC="$(MUSL_CC)" CFLAGS="$(CFLAGS)" LDFLAGS="$(LDFLAGS) -L$(LIBMNL_PATH)/src/.libs" $(MAKE) -C $(BUILD_PATH)/tools LIBMNL_CFLAGS="-I$(LIBMNL_PATH)/include" LIBMNL_LDLIBS="-lmnl" wg @@ -159,39 +166,47 @@ $(BUILD_PATH)/init: init.c $(MUSL_CC) $(MUSL_CC) -o $@ $< strip -s $@ -$(IPUTILS_PATH): $(IPUTILS_TAR) +$(IPUTILS_PATH)/.installed: $(IPUTILS_TAR) + flock -x $<.lock true tar -C $(BUILD_PATH) -xf $< + touch $@ -$(IPUTILS_PATH)/ping: $(IPUTILS_PATH) $(MUSL_CC) | $(BUILD_PATH)/include/linux +$(IPUTILS_PATH)/ping: $(IPUTILS_PATH)/.installed $(MUSL_CC) | $(BUILD_PATH)/include/linux/.installed $(MAKE) -C $(IPUTILS_PATH) CC="$(MUSL_CC)" USE_CAP=no USE_IDN=no USE_NETTLE=no USE_CRYPTO=no ping strip -s $@ -$(BASH_PATH): $(BASH_TAR) +$(BASH_PATH)/.installed: $(BASH_TAR) + flock -x $<.lock true tar -C $(BUILD_PATH) -xf $< + touch $@ -$(BASH_PATH)/bash: $(BASH_PATH) $(MUSL_CC) | $(BUILD_PATH)/include/linux +$(BASH_PATH)/bash: $(BASH_PATH)/.installed $(MUSL_CC) | $(BUILD_PATH)/include/linux/.installed cd $(BASH_PATH) && CC="$(MUSL_CC)" CFLAGS="$(CFLAGS)" ./configure --prefix=/ --host=$(CHOST) --without-bash-malloc --disable-debugger --disable-help-builtin --disable-history --disable-multibyte --disable-progcomp --disable-readline --disable-mem-scramble $(MAKE) -C $(BASH_PATH) strip -s $@ -$(IPROUTE2_PATH): $(IPROUTE2_TAR) +$(IPROUTE2_PATH)/.installed: $(IPROUTE2_TAR) + flock -x $<.lock true tar -C $(BUILD_PATH) -xf $< sed -i '/ARPD/d' $(IPROUTE2_PATH)/Makefile sed -i 's/arpd.8//' $(IPROUTE2_PATH)/man/man8/Makefile sed -i 's/m_ipt.o//;s/[^ ]*_bpf.o//' $(IPROUTE2_PATH)/tc/Makefile sed -i '/#include <linux\/in\.h>/d;/#include <linux\/in6\.h>/d' $(IPROUTE2_PATH)/include/libiptc/ipt_kernel_headers.h $(IPROUTE2_PATH)/include/linux/if_bridge.h $(IPROUTE2_PATH)/include/linux/netfilter.h $(IPROUTE2_PATH)/include/linux/xfrm.h printf 'TC_CONFIG_XT=n\nTC_CONFIG_ATM=n\nTC_CONFIG_IPSET=n\nIP_CONFIG_SETNS=y\n' > $(IPROUTE2_PATH)/Config + touch $@ -$(IPROUTE2_PATH)/ip/ip: $(IPROUTE2_PATH) $(MUSL_CC) | $(BUILD_PATH)/include/linux +$(IPROUTE2_PATH)/ip/ip: $(IPROUTE2_PATH)/.installed $(MUSL_CC) | $(BUILD_PATH)/include/linux/.installed CFLAGS="$(CFLAGS)" $(MAKE) -C $(IPROUTE2_PATH) PREFIX=/ CC="$(MUSL_CC)" strip -s $(IPROUTE2_PATH)/ip/ip $(IPROUTE2_PATH)/misc/ss -$(IPTABLES_PATH): $(IPTABLES_TAR) +$(IPTABLES_PATH)/.installed: $(IPTABLES_TAR) + flock -x $<.lock true tar -C $(BUILD_PATH) -xf $< rm -f $(IPTABLES_PATH)/include/linux/{kernel,types}.h sed -i -e "/nfnetlink=[01]/s:=[01]:=0:" -e "/nfconntrack=[01]/s:=[01]:=0:" $(IPTABLES_PATH)/configure + touch $@ -$(IPTABLES_PATH)/iptables/xtables-multi: $(IPTABLES_PATH) $(MUSL_CC) $(LIBMNL_PATH)/src/.libs/libmnl.a | $(KERNEL_PATH) +$(IPTABLES_PATH)/iptables/xtables-multi: $(IPTABLES_PATH)/.installed $(MUSL_CC) $(LIBMNL_PATH)/src/.libs/libmnl.a | $(KERNEL_PATH)/.installed cd $(IPTABLES_PATH) && PKG_CONFIG_LIBDIR="$(LIBMNL_PATH)" CC="$(MUSL_CC)" CFLAGS="$(CFLAGS)" ./configure --prefix=/ --host=$(CHOST) --enable-static --disable-shared --disable-nftables --disable-bpf-compiler --disable-nfsynproxy --disable-libipq --with-kernel=$(KERNEL_PATH) $(MAKE) -C $(IPTABLES_PATH) |