]> git.proxmox.com Git - efi-boot-shim.git/blame - debian/rules
Switch to using gcc-12
[efi-boot-shim.git] / debian / rules
CommitLineData
c86d9dac
SL
1#!/usr/bin/make -f
2
aa19fc4d
HG
3include /usr/share/dpkg/architecture.mk
4
21ebe035
SL
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.
9ifeq ($(shell dpkg-vendor --is ubuntu && echo yes),yes)
10 cert=debian/canonical-uefi-ca.der
c3fa7299 11 distributor=ubuntu
e914483c 12COMMON_OPTIONS ?= ENABLE_SHIM_CERT=1 ENABLE_SBSIGN=1
21ebe035
SL
13else
14 cert=debian/debian-uefi-ca.der
c3fa7299 15 distributor=debian
21ebe035
SL
16endif
17
9b014236
SM
18deb_version := $(shell dpkg-parsechangelog | sed -ne "s/^Version: \(.*\)/\1/p")
19upstream_version := $(shell echo $(deb_version) | sed -e "s/-[^-]*$$//")
20plain_upstream_version := $(shell echo $(upstream_version) | sed -e "s/+dfsg.*//")
2e0a83e1 21
55d55457 22DBX_LIST = dbx.esl
23DBX_HASHES = debian/$(distributor)-dbx.hashes
2e0a83e1
SM
24SBAT_IN = debian/sbat.$(distributor).csv.in
25SBAT_DATA = data/sbat.$(distributor).csv
6cf246a5 26
9bfbee89 27include /usr/share/dpkg/architecture.mk
1d945f76 28
5d42729f
MTL
29ifeq ($(DEB_HOST_ARCH),amd64)
30export EFI_ARCH := x64
cebae05a
SL
31endif
32ifeq ($(DEB_HOST_ARCH),arm64)
3802e1ad 33export EFI_ARCH := aa64
5d42729f 34endif
21efb35c
SL
35ifeq ($(DEB_HOST_ARCH),i386)
36export EFI_ARCH := ia32
37endif
5d42729f 38
e914483c 39COMMON_OPTIONS += \
ae8c2e79 40 RELEASE=$(plain_upstream_version) \
85b40923 41 COMMIT_ID=XXXX \
c3fa7299 42 MAKELEVEL=0 \
f42b58fc 43 ENABLE_HTTPBOOT=true \
c3fa7299 44 VENDOR_CERT_FILE=$(cert) \
6cf246a5 45 VENDOR_DBX_FILE=$(DBX_LIST) \
c3fa7299 46 EFIDIR=$(distributor) \
aa19fc4d 47 CROSS_COMPILE=$(DEB_HOST_GNU_TYPE)- \
65f161ee 48 CC=$(DEB_HOST_GNU_TYPE)-gcc-12 \
c3fa7299
MTL
49 $(NULL)
50
a4273971 51$(DBX_LIST): $(DBX_HASHES)
de3def7f 52 ./debian/generate_dbx_list $(EFI_ARCH) $< $@
6cf246a5 53
2e0a83e1
SM
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
c86d9dac 63%:
f320bcac 64 dh $@
693c3089 65
62a4fa2d
MTL
66override_dh_auto_clean:
67 dh_auto_clean -- MAKELEVEL=0
e4bcc019 68 rm -f $(DBX_LIST) $(SBAT_DATA) sbat.*.csv BOOT*.CSV test-csv test-sbat test-str
ee22d425 69
2e0a83e1 70override_dh_auto_build: $(DBX_LIST) $(SBAT_DATA)
d6b0fa52 71 dh_auto_build -- INSTALL=install $(COMMON_OPTIONS)
21ebe035 72
b947ca6a
SM
73override_dh_auto_test: $(DBX_LIST) $(SBAT_DATA)
74 dh_auto_test -- INSTALL=install $(COMMON_OPTIONS)
75
f841331c 76override_dh_auto_install:
d6b0fa52 77 dh_auto_install --destdir=debian/tmp -- INSTALL=install $(COMMON_OPTIONS)
bcc26d6d
SM
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
f7add225 84 ./debian/signing-template.generate
a42e843a 85 sha256sum *.efi
9b014236
SM
86
87generate-gnu-efi:
88 git -C gnu-efi archive --prefix=gnu-efi/ HEAD | xz -9 \
3139bb35 89 > ../shim_$(plain_upstream_version).orig-gnu-efi.tar.xz