]> git.proxmox.com Git - efi-boot-shim.git/blob - debian/rules
Update upstream commit hash in build
[efi-boot-shim.git] / debian / rules
1 #!/usr/bin/make -f
2
3 include /usr/share/dpkg/architecture.mk
4
5 # Other vendors, add your certs here. No sense in using
6 # dpkg-vendor --derives-from, because only Canonical-generated binaries will
7 # be signed with this key; so if you are building your own shim binary you
8 # should be building the other binaries also.
9 ifeq ($(shell dpkg-vendor --is ubuntu && echo yes),yes)
10 cert=debian/canonical-uefi-ca.der
11 distributor=ubuntu
12 COMMON_OPTIONS ?= ENABLE_SHIM_CERT=1 ENABLE_SBSIGN=1
13 else
14 cert=debian/debian-uefi-ca.der
15 distributor=debian
16 endif
17
18 deb_version := $(shell dpkg-parsechangelog | sed -ne "s/^Version: \(.*\)/\1/p")
19 upstream_version := $(shell echo $(deb_version) | sed -e "s/-[^-]*$$//")
20 plain_upstream_version := $(shell echo $(upstream_version) | sed -e "s/+dfsg.*//")
21
22 DBX_LIST = dbx.esl
23 DBX_HASHES = debian/$(distributor)-dbx.hashes
24 SBAT_IN = debian/sbat.$(distributor).csv.in
25 SBAT_DATA = data/sbat.$(distributor).csv
26
27 include /usr/share/dpkg/architecture.mk
28
29 ifeq ($(DEB_HOST_ARCH),amd64)
30 export EFI_ARCH := x64
31 endif
32 ifeq ($(DEB_HOST_ARCH),arm64)
33 export EFI_ARCH := aa64
34 endif
35 ifeq ($(DEB_HOST_ARCH),i386)
36 export EFI_ARCH := ia32
37 endif
38
39 COMMON_OPTIONS += \
40 RELEASE=$(plain_upstream_version) \
41 COMMIT_ID=657b2483ca6e9fcf2ad8ac7ee577ff546d24c3aa \
42 MAKELEVEL=0 \
43 ENABLE_HTTPBOOT=true \
44 VENDOR_CERT_FILE=$(cert) \
45 VENDOR_DBX_FILE=$(DBX_LIST) \
46 EFIDIR=$(distributor) \
47 CROSS_COMPILE=$(DEB_HOST_GNU_TYPE)- \
48 CC=$(DEB_HOST_GNU_TYPE)-gcc-12 \
49 $(NULL)
50
51 $(DBX_LIST): $(DBX_HASHES)
52 ./debian/generate_dbx_list $(EFI_ARCH) $< $@
53
54 $(SBAT_DATA): $(SBAT_IN)
55 rm -f $@
56 set -e; \
57 sed -e "s/@DEB_VERSION@/$(deb_version)/g" \
58 -e "s/@UPSTREAM_VERSION@/$(plain_upstream_version)/g" \
59 < $(SBAT_IN) > $(SBAT_DATA)
60 # If we have an empty $(SBAT_DATA), delete
61 if [ ! -s $(SBAT_DATA) ]; then rm -f $(SBAT_DATA); fi
62
63 %:
64 dh $@
65
66 override_dh_auto_clean:
67 dh_auto_clean -- MAKELEVEL=0
68 rm -f $(DBX_LIST) $(SBAT_DATA) sbat.*.csv BOOT*.CSV test-csv test-sbat test-str
69
70 override_dh_auto_build: $(DBX_LIST) $(SBAT_DATA)
71 dh_auto_build -- INSTALL=install $(COMMON_OPTIONS)
72
73 override_dh_auto_test: $(DBX_LIST) $(SBAT_DATA)
74 dh_auto_test -- INSTALL=install $(COMMON_OPTIONS)
75
76 override_dh_auto_install:
77 dh_auto_install --destdir=debian/tmp -- INSTALL=install $(COMMON_OPTIONS)
78 # Remove the copy of the source that's installed - we have git
79 # already...
80 rm -rf debian/tmp/usr
81 # And remove the extra removable-media copy of shim too, it's
82 # not needed for our build and causes debhelper to complain
83 rm -f debian/tmp/boot/efi/EFI/BOOT/BOOT*.EFI
84 ./debian/signing-template.generate
85 sha256sum *.efi
86
87 generate-gnu-efi:
88 git -C gnu-efi archive --prefix=gnu-efi/ HEAD | xz -9 \
89 > ../shim_$(plain_upstream_version).orig-gnu-efi.tar.xz