| 1 |
#!/usr/bin/make -f |
| 2 |
|
| 3 |
ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS))) |
| 4 |
IGNORE_SPEED=yes |
| 5 |
export IGNORE_SPEED |
| 6 |
endif |
| 7 |
|
| 8 |
# https://wiki.debian.org/HardeningWalkthrough#Selecting_security_hardening_options |
| 9 |
export DEB_BUILD_MAINT_OPTIONS=hardening=+all |
| 10 |
include /usr/share/dpkg/buildflags.mk |
| 11 |
|
| 12 |
# makefile_include.mk does not support CPPFLAGS |
| 13 |
CFLAGS += $(shell dpkg-buildflags --get CPPFLAGS) |
| 14 |
|
| 15 |
export DESTDIR=$(CURDIR)/debian/tmp |
| 16 |
export PREFIX=/usr |
| 17 |
|
| 18 |
# see https://wiki.debian.org/Multiarch/Implementation |
| 19 |
DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH) |
| 20 |
export LIBPATH = $(PREFIX)/lib/$(DEB_HOST_MULTIARCH) |
| 21 |
|
| 22 |
export FORCE_SOURCE_DATE=1 |
| 23 |
|
| 24 |
%: |
| 25 |
dh $@ |
| 26 |
|
| 27 |
override_dh_auto_build-arch: |
| 28 |
echo "removing files built upstream" |
| 29 |
rm -rf pre_gen |
| 30 |
echo "Creating libtool executable" |
| 31 |
mkdir debian/libtool |
| 32 |
cp debian/configure.ac debian/libtool/ |
| 33 |
cd debian/libtool && LIBTOOLIZE='libtoolize -i' autoreconf -f -i |
| 34 |
dh_auto_configure --sourcedirectory=debian/libtool |
| 35 |
|
| 36 |
echo "Building libtommath" |
| 37 |
dh_auto_build --buildsystem=makefile -- -f makefile.shared LIBTOOL=$(CURDIR)/debian/libtool/libtool |
| 38 |
|
| 39 |
override_dh_auto_build-indep: |
| 40 |
echo "removing files built upstream" |
| 41 |
rm -f doc/bn.pdf |
| 42 |
|
| 43 |
echo "Building docs" |
| 44 |
$(MAKE) docs V=1 |
| 45 |
|
| 46 |
override_dh_auto_test-arch: |
| 47 |
ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS))) |
| 48 |
echo "compiling test programs" |
| 49 |
$(MAKE) -f makefile.shared LIBTOOL=$(CURDIR)/debian/libtool/libtool test_standalone |
| 50 |
echo "running test" |
| 51 |
./test |
| 52 |
endif |
| 53 |
|
| 54 |
override_dh_auto_test-indep: |
| 55 |
|
| 56 |
override_dh_auto_install-arch: |
| 57 |
$(MAKE) -f makefile.shared LIBTOOL=$(CURDIR)/debian/libtool/libtool install |
| 58 |
# remove libtool .la files |
| 59 |
find debian/tmp -name '*.la' -delete |
| 60 |
|
| 61 |
override_dh_auto_install-indep: |
| 62 |
|
| 63 |
override_dh_install-arch: |
| 64 |
dh_install --sourcedir=debian/tmp |
| 65 |
|
| 66 |
override_dh_clean: |
| 67 |
dh_clean doc/tommath.out demo/.libs/ demo/demo.lo libtommath.pc debian/libtool/ |
| 68 |
# move back the built doc shipped in tarball |
| 69 |
for i in $(CURDIR)/doc/*.pdf.dod; do if [ -e $$i ] ; then mv $$i $${i%%.dod}; fi; done |
| 70 |
|
| 71 |
override_dh_installchangelogs: |
| 72 |
dh_installchangelogs changes.txt |