#!/usr/bin/make -f PYVERS:= $(shell pyversions -v -r debian/control) \ $(shell py3versions -v -r debian/control) PYDEF:= $(shell py3versions -d -v) export DEB_BUILD_MAINT_OPTIONS = hardening=+all include /usr/share/dpkg/pkg-info.mk #export DH_VERBOSE=1 # process makefile dependencies with n jobs in parallel, if DEB_BUILD_OPTIONS # contains "parallel=n". (set -jn.) ifneq (,$(filter parallel=%,$(DEB_BUILD_OPTIONS))) MAKEFLAGS += -j$(patsubst parallel=%,%,$(filter parallel=%,$(DEB_BUILD_OPTIONS))) endif %: dh $@ --with python2,python3 build: build-arch build-indep ab-python%: dh_auto_build --builddirectory=build$* ac-python%: dh_auto_configure --builddirectory=build$* -- PYTHON=python$* at-python%: # Skip tests since they have numerical inaccuracy causing FTBFS on some architectures: $(MAKE) -C build$* ar-python%: rm -rf out$* rm -rf debian/tmp$* override_dh_auto_install: mkdir -p debian/tmp/usr/lib for i in ${PYVERS}; do \ echo $$i; \ $(MAKE) -C build$$i install DESTDIR=$(CURDIR)/debian/tmp$$i; \ ( cd debian/tmp$$i/usr/lib/*/gnucap[0-9]; mv c_python.so c_python$$i.so ); \ cp -r debian/tmp$$i/usr/lib/* debian/tmp/usr/lib; \ rm -rf "debian/tmp$$i/usr/lib/*"; \ done cd debian/tmp/usr/lib/*/gnucap[0-9]; ln -sf c_python${PYDEF}.so c_python.so mv debian/tmp${PYDEF}/usr/share debian/tmp/usr printf "0.0.0\n=====\n* initial release\n" > debian/tmp/usr/share/doc/gnucap-python/NEWS override_dh_auto_configure: $(PYVERS:%=ac-python%) override_dh_auto_build: $(PYVERS:%=ab-python%) override_dh_auto_test: $(PYVERS:%=at-python%) override_dh_clean: $(PYVERS:%=ar-python%) dh_clean rm -rf build* find . -name *.pyc -delete find . -name *.pyo -delete rm -f debian/tmp.* override_dh_shlibdeps: debian/tmp.lib dh_shlibdeps dh_numpy dh_numpy3 # inject extra library dependency cat $< >> debian/python-gnucap.substvars cat $< >> debian/python3-gnucap.substvars # dpkg-shlibdeps misses the dlopen in gnucap/__init__.py # "ctypes.PyDLL("@LIBGNUCAP_SONAME@", mode=ctypes.RTLD_GLOBAL)" # need to act on a dummy binary (tmp.out) instead debian/tmp.lib: debian/tmp.out dpkg-shlibdeps $< -O -pdlopen > $@ # create dummy binary, linked against gnucap debian/tmp.out: echo 'int main(){}' | gcc -lgnucap -x c - -o $@