forked from HW42/qubes-vmm-xen-stubdom-linux
-
-
Notifications
You must be signed in to change notification settings - Fork 19
/
Copy pathMakefile
71 lines (53 loc) · 2.39 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
.DEFAULT_GOAL = get-sources
.SECONDEXPANSION:
.PHONY: get-sources verify-sources clean clean-sources
SHELL := bash
include Makefile.vars
UNTRUSTED_SUFF := .UNTRUSTED
ifeq ($(FETCH_CMD),)
$(error "You can not run this Makefile without having FETCH_CMD defined")
endif
URLS := \
https://download.qemu.org/qemu-$(QEMU_VERSION).tar.xz.sig \
https://kernel.org/pub/linux/kernel/v$(firstword $(subst ., ,$(LINUX_VERSION))).x/linux-$(LINUX_VERSION).tar.sign \
https://busybox.net/downloads/busybox-$(BUSYBOX_VERSION).tar.bz2.sig \
https://www.freedesktop.org/software/pulseaudio/releases/pulseaudio-$(PULSEAUDIO_VERSION).tar.xz \
https://github.com/libusb/libusb/releases/download/v$(LIBUSB_VERSION)/libusb-$(LIBUSB_VERSION).tar.bz2
ALL_URLS := $(patsubst %.sign,%,$(patsubst %.sig,%,$(URLS))) $(filter %.sig, $(URLS)) $(filter %.sign, $(URLS))
ALL_FILES_TMP := $(notdir $(ALL_URLS))
ifneq ($(DISTFILES_MIRROR),)
ALL_URLS := $(addprefix $(DISTFILES_MIRROR),$(ALL_FILES_TMP))
endif
ALL_FILES := $(addprefix dl/,$(ALL_FILES_TMP))
$(filter %.sig, $(ALL_FILES)) $(filter %.sign, $(ALL_FILES)): dl/%:
@mkdir -p dl
@$(FETCH_CMD) $@ $(filter %/$*,$(ALL_URLS))
keys/%.gpg: $$(sort $$(wildcard keys/$$*/*.asc))
@cat $^ | gpg --dearmor >$@
dl/%: dl/%.sig keys/$$(firstword $$(subst -, ,$$*)).gpg
@$(FETCH_CMD) $@$(UNTRUSTED_SUFF) $(filter %/$*,$(ALL_URLS))
@gpgv --keyring $(word 2,$^) $< $@$(UNTRUSTED_SUFF) 2>/dev/null || \
{ echo "Wrong signature on $@$(UNTRUSTED_SUFF)!"; exit 1; }
@mv $@$(UNTRUSTED_SUFF) $@
dl/%: dl/%.sign keys/$$(firstword $$(subst -, ,$$*)).gpg
@$(FETCH_CMD) [email protected]$(UNTRUSTED_SUFF) $(filter %/$*,$(ALL_URLS)).xz
@if [ -f /usr/bin/qvm-run-vm ]; \
then qvm-run-vm --dispvm 2>/dev/null xzcat <[email protected]$(UNTRUSTED_SUFF) > $@$(UNTRUSTED_SUFF); \
else xzcat <[email protected]$(UNTRUSTED_SUFF) > $@$(UNTRUSTED_SUFF); fi
@rm -f [email protected]$(UNTRUSTED_SUFF)
@gpgv --keyring $(word 2,$^) $< $@$(UNTRUSTED_SUFF)|| \
{ echo "Wrong signature on $@$(UNTRUSTED_SUFF)!"; exit 1; }
@mv $@$(UNTRUSTED_SUFF) $@
dl/%: checksums/%.sha512
@$(FETCH_CMD) $@$(UNTRUSTED_SUFF) $(filter %/$*,$(ALL_URLS))
@sha512sum --status -c <(printf "$$(cat $<) -\n") <$@$(UNTRUSTED_SUFF) || \
{ echo "Wrong SHA512 checksum on $@$(UNTRUSTED_SUFF)!"; exit 1; }
@mv $@$(UNTRUSTED_SUFF) $@
get-sources: $(ALL_FILES)
git submodule update --init
verify-sources:
@true
clean:
$(MAKE) -f Makefile.stubdom clean
clean-sources:
rm -rf dl