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 85 86 87
|
#!/usr/bin/make -f
#
# Based on the work by Marcus Brinkmann <brinkmd@debian.org>
# Rewritten by Guillem Jover <guillem@debian.org>
# Rewritten to use `dh' by Pino Toscano <pino@debian.org>
#
export DEB_CFLAGS_MAINT_PREPEND := -Wall -pipe
include /usr/share/dpkg/architecture.mk
PKG_DEB_TARGET_GNU_CPU=$(subst _,-,$(DEB_TARGET_GNU_CPU))
PKG_DEB_HOST_GNU_CPU=$(subst _,-,$(DEB_HOST_GNU_CPU))
%:
dh $@ -Bbuild
NATIVE_ARCHS=hurd-i386 hurd-amd64
export TARGET_CFLAGS = $(CFLAGS)
ifeq ($(DEB_HOST_ARCH),$(DEB_TARGET_ARCH))
# CPU compatibility is enough to cross-build trivially
CONFIGURE_OPTIONS = \
--program-prefix=$(DEB_TARGET_GNU_CPU)-gnu-
ARCHS=$(NATIVE_ARCHS)
define d_a
$(shell dpkg-architecture -f -a$1 -A$1 -q$2 2> /dev/null)
endef
export TARGET_CPPFLAGS = $(CPPFLAGS)
else
CONFIGURE_OPTIONS = \
--program-prefix=$(DEB_TARGET_GNU_CPU)-gnu- \
--build=$(DEB_BUILD_GNU_TYPE) \
--host=$(DEB_HOST_GNU_TYPE) \
--target=$(DEB_TARGET_GNU_TYPE)
CROSSDEP=:$(DEB_TARGET_ARCH)
ARCHS=$(DEB_TARGET_ARCH)
# The cross compiler at this stage does not have these in its standard include
export TARGET_CPPFLAGS = -I/usr/include -I/usr/include/$(DEB_TARGET_GNU_TYPE) -I/usr/include/$(DEB_TARGET_MULTIARCH) $(CPPFLAGS)
define d_a
$($2)
endef
endif
debian/control: debian/control.stamp
debian/control.stamp: debian/control.in debian/control.native.in debian/control.target.in debian/rules
sed -e 's/@crossdep@/$(CROSSDEP)/' < debian/control.in > debian/control
echo "#Note: XXX this file is generated from .in files, see debian/rules" >> debian/control
ifeq ($(DEB_HOST_GNU_CPU),$(DEB_TARGET_GNU_CPU))
cat debian/control.native.in >> debian/control
endif
$(foreach a,$(ARCHS), \
sed -e 's/@target@/$(subst _,-,$(call d_a,$a,DEB_TARGET_GNU_CPU)-gnu)/' \
-e 's/@debtarget@/$(call d_a,$a,DEB_TARGET_ARCH_CPU) GNU\/Hurd/' \
-e 's/@debhost@/any-$(call d_a,$a,DEB_HOST_ARCH_CPU)/' \
< debian/control.target.in >> debian/control ; )
touch $@
override_dh_auto_configure:
dh_auto_configure -Bbuild -- \
--libexecdir=/usr/lib/mig/ \
$(CONFIGURE_OPTIONS)
ifneq ($(DEB_HOST_GNU_TYPE),$(DEB_TARGET_GNU_TYPE))
build-arch: debian/control.stamp
build-indep:
build: build-indep build-arch
endif
override_dh_auto_install:
dh_auto_install --destdir=debian/tmp
override_dh_install:
dh_install
dh_install -pmig-$(PKG_DEB_TARGET_GNU_CPU)-gnu /usr/lib/mig/$(DEB_TARGET_GNU_CPU)-gnu-migcom
dh_install -pmig-$(PKG_DEB_TARGET_GNU_CPU)-gnu /usr/bin/$(DEB_TARGET_GNU_CPU)-gnu-mig
override_dh_gencontrol:
dh_gencontrol -- -V"mig:host=mig-$(PKG_DEB_HOST_GNU_CPU)-gnu (= \$${binary:Version})"
override_dh_auto_clean:
dh_auto_clean
rm -rf debian/control.stamp
|