| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
export DEB_CFLAGS_MAINT_PREPEND := -Wall -pipe |
| 9 |
|
| 10 |
include /usr/share/dpkg/architecture.mk |
| 11 |
|
| 12 |
PKG_DEB_TARGET_GNU_CPU=$(subst _,-,$(DEB_TARGET_GNU_CPU)) |
| 13 |
PKG_DEB_HOST_GNU_CPU=$(subst _,-,$(DEB_HOST_GNU_CPU)) |
| 14 |
|
| 15 |
%: |
| 16 |
dh $@ -Bbuild |
| 17 |
|
| 18 |
NATIVE_ARCHS=i386 amd64 arm64 |
| 19 |
|
| 20 |
export TARGET_CFLAGS = $(shell DEB_HOST_ARCH=$(DEB_TARGET_ARCH) dpkg-buildflags --get CFLAGS) |
| 21 |
export TARGET_CPPFLAGS = $(shell DEB_HOST_ARCH=$(DEB_TARGET_ARCH) dpkg-buildflags --get CPPFLAGS) |
| 22 |
|
| 23 |
ifeq ($(DEB_HOST_ARCH),$(DEB_TARGET_ARCH)) |
| 24 |
|
| 25 |
CONFIGURE_OPTIONS = \ |
| 26 |
--program-prefix=$(DEB_TARGET_GNU_CPU)-gnu- |
| 27 |
ARCHS=$(NATIVE_ARCHS) |
| 28 |
define d_a |
| 29 |
$(shell dpkg-architecture -f -a$1 -A$1 -q$2 2> /dev/null) |
| 30 |
endef |
| 31 |
else |
| 32 |
CONFIGURE_OPTIONS = \ |
| 33 |
--program-prefix=$(DEB_TARGET_GNU_CPU)-gnu- \ |
| 34 |
--build=$(DEB_BUILD_GNU_TYPE) \ |
| 35 |
--host=$(DEB_HOST_GNU_TYPE) \ |
| 36 |
--target=$(DEB_TARGET_GNU_TYPE) |
| 37 |
CROSSDEP=:$(DEB_TARGET_ARCH) |
| 38 |
ARCHS=$(DEB_TARGET_ARCH_CPU) |
| 39 |
|
| 40 |
export TARGET_CPPFLAGS += -I/usr/include -I/usr/include/$(DEB_TARGET_GNU_TYPE) -I/usr/include/$(DEB_TARGET_MULTIARCH) |
| 41 |
define d_a |
| 42 |
$($2) |
| 43 |
endef |
| 44 |
endif |
| 45 |
|
| 46 |
debian/control: debian/control.stamp |
| 47 |
debian/control.stamp: debian/control.in debian/control.native.in debian/control.target.in debian/rules |
| 48 |
sed -e 's/@crossdep@/$(CROSSDEP)/' < debian/control.in > debian/control |
| 49 |
echo "#Note: XXX this file is generated from .in files, see debian/rules" >> debian/control |
| 50 |
|
| 51 |
ifeq ($(DEB_HOST_GNU_CPU),$(DEB_TARGET_GNU_CPU)) |
| 52 |
cat debian/control.native.in >> debian/control |
| 53 |
endif |
| 54 |
|
| 55 |
$(foreach a,$(ARCHS), \ |
| 56 |
sed -e 's/@target@/$(subst _,-,$(call d_a,$a,DEB_TARGET_GNU_CPU)-gnu)/' \ |
| 57 |
-e 's/@debtarget@/$(call d_a,$a,DEB_TARGET_ARCH_CPU) GNU\/Hurd/' \ |
| 58 |
-e 's/@debhost@/any-$(call d_a,$a,DEB_HOST_ARCH_CPU)/' \ |
| 59 |
< debian/control.target.in >> debian/control ; ) |
| 60 |
|
| 61 |
touch $@ |
| 62 |
|
| 63 |
override_dh_auto_configure: |
| 64 |
dh_auto_configure -Bbuild -- \ |
| 65 |
--libexecdir=/usr/lib/mig/ \ |
| 66 |
$(CONFIGURE_OPTIONS) |
| 67 |
|
| 68 |
ifneq ($(DEB_HOST_GNU_TYPE),$(DEB_TARGET_GNU_TYPE)) |
| 69 |
build-arch: debian/control.stamp |
| 70 |
build-indep: |
| 71 |
build: build-indep build-arch |
| 72 |
endif |
| 73 |
|
| 74 |
override_dh_auto_install: |
| 75 |
dh_auto_install --destdir=debian/tmp |
| 76 |
|
| 77 |
override_dh_install: |
| 78 |
dh_install |
| 79 |
dh_install -pmig-$(PKG_DEB_TARGET_GNU_CPU)-gnu /usr/lib/mig/$(DEB_TARGET_GNU_CPU)-gnu-migcom |
| 80 |
dh_install -pmig-$(PKG_DEB_TARGET_GNU_CPU)-gnu /usr/bin/$(DEB_TARGET_GNU_CPU)-gnu-mig |
| 81 |
|
| 82 |
override_dh_gencontrol: |
| 83 |
dh_gencontrol -- -V"mig:host=mig-$(PKG_DEB_HOST_GNU_CPU)-gnu (>= \$${source:Upstream-Version})" |
| 84 |
|
| 85 |
override_dh_auto_clean: |
| 86 |
dh_auto_clean |
| 87 |
rm -rf debian/control.stamp |