/
githubmirror
/
fwupd
Обзор
Документация
Войти
/
githubmirror
/
fwupd
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
contrib/debian/rules
138 строк
5 KB
Peter Hutterer
ci: Support Rust cross-compilation for Debian builds
03 авг 2026, 11:23
03 авг 2026, 11:23
815b67c
Код
Авторство
О чём код?
#!/usr/bin/make -f # -*- makefile -*- export LC_ALL := C.UTF-8 export DEB_BUILD_MAINT_OPTIONS = hardening=+all export DEB_LDFLAGS_MAINT_STRIP=-Wl,-Bsymbolic-functions #GPGME needs this for proper building on 32 bit archs ifeq ($(DEB_HOST_ARCH_BITS),32) export DEB_CFLAGS_MAINT_APPEND = -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE endif DEB_BUILD_ARCH ?= $(shell dpkg-architecture -qDEB_BUILD_ARCH) DEB_HOST_ARCH ?= $(shell dpkg-architecture -qDEB_HOST_ARCH) CONFARGS = ifneq ($(CI),) CONFARGS += --werror -Db_coverage=true else CONFARGS += -Dsupported_build=enabled endif ifneq ($(DEB_BUILD_ARCH),$(DEB_HOST_ARCH)) CONFARGS += -Dtests=false CONFARGS += --cross-file=$(CURDIR)/debian/rust-cross.ini # Map Debian host architectures to Rust target triples. DEBIAN_RUST_TARGET_amd64 := x86_64-unknown-linux-gnu DEBIAN_RUST_TARGET_arm64 := aarch64-unknown-linux-gnu DEBIAN_RUST_TARGET_armhf := arm-unknown-linux-gnueabihf DEBIAN_RUST_TARGET_i386 := i686-unknown-linux-gnu DEBIAN_RUST_TARGET_riscv64 := riscv64gc-unknown-linux-gnu DEBIAN_RUST_TARGET_s390x := s390x-unknown-linux-gnu RUST_TARGET := $(DEBIAN_RUST_TARGET_$(DEB_HOST_ARCH)) ifeq ($(strip $(RUST_TARGET)),) $(error Unable to determine Rust target triple for host arch '$(DEB_HOST_ARCH)') endif endif ifneq ($(QUBES_OPTION),) CONFARGS += -Dqubes=true endif ifneq ($(filter nodoc,$(DEB_BUILD_PROFILES)),) CONFARGS += -Ddocs=disabled endif CONFARGS += -Dplugin_modem_manager=enabled ifeq (yes,$(shell dpkg-vendor --derives-from Ubuntu && echo yes)) CONFARGS += -Defi_os_dir=ubuntu -Dpassim=disabled else ifeq (yes,$(shell dpkg-vendor --derives-from Debian && echo yes)) CONFARGS += -Defi_os_dir=debian endif %: dh $@ --with gir --with python3 override_dh_auto_clean: rm -fr obj-* rm -fr debian/build override_dh_auto_configure: ifneq ($(DEB_BUILD_ARCH),$(DEB_HOST_ARCH)) printf '[binaries]\nrust = ['\''rustc'\'', '\''--target'\'', '\''$(RUST_TARGET)'\'']\n' \ >$(CURDIR)/debian/rust-cross.ini endif dh_auto_configure -- $(CONFARGS) override_dh_install: find debian/tmp/usr -type f -name "*a" -print | xargs rm -f sed -i 's,wheel,sudo,' debian/tmp/usr/share/polkit-1/rules.d/org.freedesktop.fwupd.rules dh_install dh_install -pfwupd $$(pkg-config --variable=systemdsystemunitdir systemd | sed s,^/,,) #install MSR conf if needed (depending on distro) [ ! -d debian/tmp/usr/lib/modules-load.d ] || dh_install -pfwupd usr/lib/modules-load.d [ ! -d debian/tmp/lib/modules-load.d ] || dh_install -pfwupd lib/modules-load.d [ ! -d debian/tmp/usr/share/fwupd/quirks.d ] || dh_install -pfwupd usr/share/fwupd/quirks.d #install docs (maybe) [ ! -d debian/tmp/usr/share/doc ] || dh_install -pfwupd-doc usr/share/doc #install devices-tests (maybe) [ ! -d debian/tmp/usr/share/fwupd/device-tests/ ] || dh_install -pfwupd-tests usr/share/fwupd/device-tests #install installed-tests (maybe) #These are in a generic looking directory because #that is where gnome-desktop-testing expects to #find them. for more information see: #https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=872458 [ ! -d debian/tmp/usr/share/installed-tests ] || dh_install -pfwupd-tests usr/share/installed-tests [ ! -d debian/tmp/usr/libexec/installed-tests/fwupd ] || dh_install -pfwupd-tests "usr/libexec/installed-tests/fwupd/*-test" [ ! -f debian/tmp/usr/share/fwupd/remotes.d/fwupd-tests.conf ] || dh_install -pfwupd-tests usr/share/fwupd/remotes.d/fwupd-tests.conf #/usr merge or not (make backporting easier) [ ! -d debian/tmp/lib/systemd ] || dh_install -pfwupd lib/systemd [ ! -d debian/tmp/usr/lib/systemd ] || dh_install -pfwupd usr/lib/systemd dh_missing -a --fail-missing #this is placed in fwupd-tests rm -f debian/fwupd/usr/share/fwupd/remotes.d/fwupd-tests.conf #use ieee-data rm -f debian/fwupd-tests/usr/share/installed-tests/fwupd/tests/oui.txt [ ! -d debian/fwupd-tests/usr/share/installed-tests/fwupd/tests ] || ln -s /usr/share/ieee-data/oui.txt debian/fwupd-tests/usr/share/installed-tests/fwupd/tests/oui.txt # avoid shipping an empty directory [ ! -d debian/fwupd/lib/systemd ] || find debian/fwupd/lib/systemd -type d -empty -delete [ ! -d debian/fwupd/usr/lib/systemd ] || find debian/fwupd/usr/lib/systemd -type d -empty -delete # the below step is automatic with debhelper >= 14 dh_installsysusers override_dh_python3: dh_python3 -pfwupd dh_python3 -pfwupd-tests /usr/share/installed-tests/fwupd dh_python3 -pfwupd-tests /usr/libexec/installed-tests/fwupd override_dh_gencontrol: if dpkg-vendor --derives-from ubuntu; then \ dh_gencontrol -- -Vrecommends:secureboot-db="secureboot-db,"; \ else \ dh_gencontrol -- -Vrecommends:secureboot-db=""; \ fi override_dh_strip_nondeterminism: dh_strip_nondeterminism -Xfirmware-example.xml.gz ifneq (yes,$(shell command -v valgrind >/dev/null 2>&1 && echo yes)) override_dh_auto_test: : endif override_dh_builddeb: dh_builddeb