| 1 |
#!/usr/bin/make -f |
| 2 |
|
| 3 |
export DEB_BUILD_MAINT_OPTIONS = hardening=+all |
| 4 |
|
| 5 |
include /usr/share/dpkg/default.mk |
| 6 |
|
| 7 |
PYTHON3 := $(shell py3versions --requested --version debian/control) |
| 8 |
FLAVOURS := $(PYTHON3) |
| 9 |
|
| 10 |
ifeq ($(DEB_HOST_ARCH_OS),linux) |
| 11 |
INDI = --with-indi |
| 12 |
endif |
| 13 |
|
| 14 |
ifeq ($(DEB_HOST_ARCH_OS),kfreebsd) |
| 15 |
LIBUSB = --without-libusb |
| 16 |
endif |
| 17 |
|
| 18 |
%: |
| 19 |
dh $@ --with python3,lua --buildsystem=autoconf |
| 20 |
|
| 21 |
override_dh_auto_configure-arch: |
| 22 |
set -ex; for x in $(FLAVOURS); do \ |
| 23 |
dh_auto_configure \ |
| 24 |
--builddirectory=build-$$x \ |
| 25 |
-- \ |
| 26 |
PYTHON_VERSION=$$x \ |
| 27 |
--with-perl-binding \ |
| 28 |
--with-python-binding \ |
| 29 |
--with-tcl-binding \ |
| 30 |
--with-tcl=/usr/lib/$(DEB_HOST_MULTIARCH) \ |
| 31 |
--with-lua-binding \ |
| 32 |
$(INDI) \ |
| 33 |
$(LIBUSB) \ |
| 34 |
; \ |
| 35 |
done |
| 36 |
$(MAKE) -f /usr/share/dh-lua/make/dh-lua.Makefile.multiple configure H= |
| 37 |
|
| 38 |
override_dh_auto_build-arch: |
| 39 |
set -ex; for x in $(FLAVOURS); do \ |
| 40 |
dh_auto_build \ |
| 41 |
--arch \ |
| 42 |
--builddirectory=build-$$x \ |
| 43 |
; \ |
| 44 |
done |
| 45 |
$(MAKE) -f /usr/share/dh-lua/make/dh-lua.Makefile.multiple build H= LBTL="libtool --tag=CC" |
| 46 |
|
| 47 |
# Build the docs |
| 48 |
override_dh_auto_configure-indep: |
| 49 |
dh_auto_configure --builddirectory=build-indep |
| 50 |
|
| 51 |
override_dh_auto_build-indep: |
| 52 |
dh_auto_build --indep --builddirectory=build-indep/doc -- doc |
| 53 |
find build-indep/doc -type f -name "*.md5" -delete |
| 54 |
|
| 55 |
override_dh_auto_test-arch: |
| 56 |
# skip tests on hurd |
| 57 |
ifeq ($(DEB_HOST_ARCH_OS),linux) |
| 58 |
set -ex; for x in $(FLAVOURS); do \ |
| 59 |
LC_ALL=C.UTF-8 \ |
| 60 |
PYTHON=/usr/bin/python$$x \ |
| 61 |
VERBOSE=1 \ |
| 62 |
dh_auto_test --arch --builddirectory=build-$$x; \ |
| 63 |
done |
| 64 |
endif |
| 65 |
|
| 66 |
# skip |
| 67 |
override_dh_auto_test-indep: |
| 68 |
|
| 69 |
override_dh_auto_install-arch: |
| 70 |
set -ex; for x in $(PYTHON3); do \ |
| 71 |
PYTHON=/usr/bin/python$$x \ |
| 72 |
dh_auto_install \ |
| 73 |
--arch \ |
| 74 |
--builddirectory=build-$$x \ |
| 75 |
--destdir=debian/tmp \ |
| 76 |
-- \ |
| 77 |
pyexecdir='$${pythondir}' \ |
| 78 |
pythondir=/usr/lib/python$$x/site-packages \ |
| 79 |
; \ |
| 80 |
so=`/usr/bin/python$$x -c "import sysconfig; print(sysconfig.get_config_var('EXT_SUFFIX') or sysconfig.get_config_var('SO'))"`; \ |
| 81 |
mkdir -p $(CURDIR)/debian/tmp/usr/lib/python3/dist-packages; \ |
| 82 |
mv debian/tmp/usr/lib/python$$x/site-packages/_Hamlib.so \ |
| 83 |
debian/tmp/usr/lib/python3/dist-packages/_Hamlib$$so; \ |
| 84 |
mv debian/tmp/usr/lib/python$$x/site-packages/Hamlib.py \ |
| 85 |
debian/tmp/usr/lib/python3/dist-packages; \ |
| 86 |
done |
| 87 |
# Remove python unused files. |
| 88 |
find debian/tmp -name '*.py[co]' -print0 | xargs -0 rm -fv |
| 89 |
find debian/tmp -name '*.la' -print0 | xargs -0 rm -fv |
| 90 |
# Install lua files |
| 91 |
$(MAKE) -f /usr/share/dh-lua/make/dh-lua.Makefile.multiple install H= LBTL="libtool --tag=CC" |
| 92 |
# Tweak tcl test file to use installed location |
| 93 |
sed -i -e '/installation directory/ s/^# //; /build directory/d' debian/tmp/usr/share/doc/hamlib/examples/tcltest.tcl |
| 94 |
|
| 95 |
override_dh_auto_install-indep: |
| 96 |
mkdir -p $(CURDIR)/debian/tmp/usr/share/doc/hamlib |
| 97 |
cp -r $(CURDIR)/build-indep/doc/html \ |
| 98 |
$(CURDIR)/debian/tmp/usr/share/doc/hamlib/ |
| 99 |
|
| 100 |
override_dh_install: |
| 101 |
# Remove unneeded files |
| 102 |
rm -fv debian/tmp/usr/share/doc/hamlib/ChangeLog |
| 103 |
rm -fv debian/tmp/usr/share/doc/hamlib/COPYING* |
| 104 |
rm -fv debian/tmp/usr/share/doc/hamlib/LICENSE |
| 105 |
rm -fv debian/tmp/usr/share/doc/hamlib/README* |
| 106 |
rm -fv debian/tmp/usr/include/lua*/lua-hamlib.h |
| 107 |
rm -fv debian/tmp/usr/lib/lua/*/Hamliblua.a |
| 108 |
rm -fv debian/tmp/usr/lib/lua/*/Hamliblua.so |
| 109 |
rm -fv debian/tmp/usr/lib/python*/site-packages/_Hamlib.a |
| 110 |
rm -fv debian/tmp/usr/lib/*/*.a |
| 111 |
rm -fv debian/tmp/usr/lib/*/*.la |
| 112 |
rm -fv debian/tmp/usr/lib/*/liblua*-hamlib.so |
| 113 |
rm -fv debian/tmp/usr/lib/*/pkgconfig/lua*-hamlib.pc |
| 114 |
rm -fv debian/tmp/usr/lib/*/tcl*/Hamlib/hamlibtcl.a |
| 115 |
dh_install |
| 116 |
# Remove duplicated lua test file. |
| 117 |
rm -f $(CURDIR)/debian/lua-hamlib/usr/share/doc/lua-hamlib/luatest.lua |
| 118 |
|
| 119 |
override_dh_installchangelogs: |
| 120 |
dh_installchangelogs NEWS |
| 121 |
|
| 122 |
ifneq ($(DEB_HOST_ARCH_OS), linux) |
| 123 |
override_dh_makeshlibs: |
| 124 |
# ignore disappearing symbols on non-Linux architectures |
| 125 |
dh_makeshlibs -- -c0 |
| 126 |
endif |
| 127 |
|
| 128 |
override_dh_auto_clean: |
| 129 |
dh_auto_clean |
| 130 |
# Remove python build dirs |
| 131 |
set -ex; for x in $(FLAVOURS); do \ |
| 132 |
if [ -d "build-$$x" ]; then \ |
| 133 |
rm -rf build-$$x; \ |
| 134 |
fi; \ |
| 135 |
done |
| 136 |
# Remove indep build |
| 137 |
if [ -d "build-indep" ]; then \ |
| 138 |
rm -rf build-indep; \ |
| 139 |
fi; |
| 140 |
# Remove changed upstream files which create problems |
| 141 |
# with dpkg-source. |
| 142 |
rm -f $(CURDIR)/doc/hamlib.info \ |
| 143 |
$(CURDIR)/doc/stamp-vti \ |
| 144 |
$(CURDIR)/doc/version.texi |
| 145 |
# Remove LUA dirs |
| 146 |
rm -rf $(CURDIR)/5.?-hamlib |
| 147 |
# find . -name '*.py[co]' -print0 | xargs -0 rm -f |