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 72 73 74 75 76 77 78 79 80 81 82 83 84
|
#!/usr/bin/make -f
export DH_OPTIONS
DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
DEB_HOST_GNU_CPU ?= $(shell dpkg-architecture -qDEB_HOST_GNU_CPU)
DEB_HOST_ARCH_CPU ?= $(shell dpkg-architecture -qDEB_HOST_GNU_CPU)
DEB_HOST_ARCH ?= $(shell dpkg-architecture -qDEB_HOST_ARCH)
# Calculating musl based architecture
MUSL_ARCH=$(DEB_HOST_GNU_CPU)
MUSL_TRIPLE=$(DEB_HOST_GNU_CPU)-linux-musl
ifneq (,$(findstring armel,$(DEB_HOST_ARCH)))
MUSL_ARCH=arm
MUSL_TRIPLE=arm-linux-musleabi
endif
ifneq (,$(findstring armhf,$(DEB_HOST_ARCH)))
MUSL_ARCH=armhf
MUSL_TRIPLE=arm-linux-musleabihf
endif
ifeq ($(DEB_HOST_ARCH_CPU),i386)
MUSL_ARCH=i386
MUSL_TRIPLE=i386-linux-musl
endif
ifneq (,$(findstring ppc64el,$(DEB_HOST_ARCH)))
export DEB_CFLAGS_MAINT_APPEND += -mlong-double-64
endif
export MUSL_ARCH
export MUSL_TRIPLE
# Cross build support
ifeq ($(DEB_BUILD_GNU_TYPE),$(DEB_HOST_GNU_TYPE))
CC ?= cc
else
CC=$(DEB_HOST_GNU_TYPE)-gcc
CROSS_COMPILE=$(DEB_HOST_GNU_TYPE)-
export CROSS_COMPILE
endif
export CC
export DEB_BUILD_MAINT_OPTIONS = hardening=+all
# Substitue control file variables debending on the debian libc type
# If musl is the native libc, we can provide libc and depend on linux-libc-dev
ifneq (,$(findstring musl-linux-,$(DEB_HOST_ARCH)))
GENCTRL_OPTIONS = -Vlibc-dev:Provides=libc-dev -Vlinux-libc-dev:Depends=linux-libc-dev
else
GENCTRL_OPTIONS = -Vlinux-musl-dev:Recommends=linux-musl-dev
endif
%:
dh $@
debian/scripts/$(MUSL_TRIPLE).path: debian/scripts/config.path.in
sed 's/@MUSL_TRIPLE@/$(MUSL_TRIPLE)/g' $< > $@
cp debian/scripts/$(MUSL_TRIPLE).path debian/scripts/ld-musl-$(MUSL_ARCH).path
override_dh_auto_configure: debian/scripts/$(MUSL_TRIPLE).path
dh_auto_configure -- --libdir=/usr/lib/$(MUSL_TRIPLE) --includedir=/usr/include/$(MUSL_TRIPLE) --host=$(DEB_HOST_GNU_TYPE) --enable-gcc-wrapper --enable-debug
override_dh_fixperms:
dh_fixperms --exclude libc.so
override_dh_gencontrol:
dh_gencontrol -- $(GENCTRL_OPTIONS)
override_dh_clean:
rm -f debian/musl-dev.postinst debian/musl-dev.postrm
dh_clean
override_dh_installdeb:
sed 's/@MUSL_TRIPLE@/$(MUSL_TRIPLE)/g' \
debian/musl-dev.postinst.in > debian/musl-dev.postinst
sed 's/@MUSL_TRIPLE@/$(MUSL_TRIPLE)/g' \
debian/musl-dev.postrm.in > debian/musl-dev.postrm
dh_installdeb
override_dh_installchangelogs:
dh_installchangelogs WHATSNEW
|