#!/usr/bin/make -f # See debhelper(7) (uncomment to enable) # output every command that modifies files on the build system. #export DH_VERBOSE = 1 # see EXAMPLES in dpkg-buildflags(1) and read /usr/share/dpkg/* DPKG_EXPORT_BUILDFLAGS = 1 include /usr/share/dpkg/default.mk DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH) DEB_SOURCE_PACKAGE := $(strip $(shell egrep '^Source: ' debian/control | cut -f 2 -d ':')) DEB_VERSION := $(shell dpkg-parsechangelog -S Version) DEB_NOEPOCH_VERSION := $(shell echo $(DEB_VERSION) | cut -d: -f2-) DEB_UPSTREAM_VERSION := $(shell echo $(DEB_NOEPOCH_VERSION) | sed 's/-[^-]*$$//') DEB_STRIPPED_UPSTREAM_VERSION = $(shell echo $(DEB_UPSTREAM_VERSION) | sed -e 's/[\.\+]dfsg.*$$//p' ) # SLEPC4PY_VERSION is used for the package names, library sonames, and # /usr/lib/petscdir subdirectory names. export SLEPC4PY_VERSION=$(DEB_STRIPPED_UPSTREAM_VERSION)$(SLEPC_EXT) # use only major.minor in general soname (rather than major.minor.patch.build) export SLEPC_BASE_VERSION=$(shell echo $(SLEPC4PY_VERSION) | awk 'BEGIN { FS="."}; {print $$1"."$$2 }') SLEPC_MAJOR_VERSION=$(shell echo $(SLEPC_BASE_VERSION) | sed "s/\..*//") SLEPC_MINOR_VERSION=$(shell echo $(SLEPC_BASE_VERSION) | sed "s/.*\.//") SLEPC_NEXT_VERSION=$(shell echo $(SLEPC_MAJOR_VERSION).$$(( $(SLEPC_MINOR_VERSION) + 1 )) ) PETSC_DIR_REAL=/usr/lib/petscdir/petsc$(SLEPC_BASE_VERSION)/$(DEB_HOST_MULTIARCH)-real SLEPC_DIR_REAL=/usr/lib/slepcdir/slepc$(SLEPC_BASE_VERSION)/$(DEB_HOST_MULTIARCH)-real PETSC_DIR_COMPLEX=/usr/lib/petscdir/petsc$(SLEPC_BASE_VERSION)/$(DEB_HOST_MULTIARCH)-complex SLEPC_DIR_COMPLEX=/usr/lib/slepcdir/slepc$(SLEPC_BASE_VERSION)/$(DEB_HOST_MULTIARCH)-complex # see FEATURE AREAS in dpkg-buildflags(1) #export DEB_BUILD_MAINT_OPTIONS = hardening=+all # see ENVIRONMENT in dpkg-buildflags(1) # package maintainers to append CFLAGS #export DEB_CFLAGS_MAINT_APPEND = -Wall -pedantic # package maintainers to append LDFLAGS #export DEB_LDFLAGS_MAINT_APPEND = -Wl,--as-needed # main packaging script based on dh7 syntax %: PYBUILD_NAME=slepc4py_real SLEPC_DIR=$(SLEPC_DIR_REAL) PETSC_DIR=$(PETSC_DIR_REAL) dh $@ --with python2,python3 --buildsystem=pybuild PYBUILD_NAME=slepc4py_complex SLEPC_DIR=$(SLEPC_DIR_COMPLEX) PETSC_DIR=$(PETSC_DIR_COMPLEX) dh $@ --with python3 --buildsystem=pybuild override_dh_clean: dh_clean rm -rf .eggs # nothing to build for arch-indep (docs, dummy package) override_dh_auto_build-indep: ; override_dh_auto_install-indep: ; override_dh_auto_build-arch: PYBUILD_NAME=slepc4py_real SLEPC_DIR=$(SLEPC_DIR_REAL) PETSC_DIR=$(PETSC_DIR_REAL) dh_auto_build -ppython-slepc4py -ppython3-slepc4py-real PYBUILD_NAME=slepc4py_complex SLEPC_DIR=$(SLEPC_DIR_COMPLEX) PETSC_DIR=$(PETSC_DIR_COMPLEX) dh_auto_build -ppython3-slepc4py-complex # slepc4py embeds the deep PETSC_DIR path as RPATH in its library. # Swap it out for a standard path, or else dh_shlibdeps gets confused chrpath -d .pybuild/*python*/build/slepc4py*/lib/SLEPc*.so override_dh_auto_install-arch: PYBUILD_NAME=slepc4py_real SLEPC_DIR=$(SLEPC_DIR_REAL) PETSC_DIR=$(PETSC_DIR_REAL) dh_auto_install -ppython-slepc4py -ppython3-slepc4py-real for p in debian/python3-slepc4py-real/usr/lib/python3*/dist-packages/slepc4py*; do \ mv $$p $$(dirname $$p)/$$( basename $$p | sed "s/slepc4py/slepc4py_real/"); \ done PYBUILD_NAME=slepc4py_complex SLEPC_DIR=$(SLEPC_DIR_COMPLEX) PETSC_DIR=$(PETSC_DIR_COMPLEX) dh_auto_install -ppython3-slepc4py-complex for p in debian/python3-slepc4py-complex/usr/lib/python3*/dist-packages/slepc4py*; do \ mv $$p $$(dirname $$p)/$$( basename $$p | sed "s/slepc4py/slepc4py_complex/"); \ done override_dh_installdocs-arch: dh_installdocs -a debian/README.Debian override_dh_installdocs-indep: dh_installdocs -i debian/README.Debian rm debian/python-slepc4py-docs/usr/share/doc/python-slepc4py-docs/usrman/_static/jquery*.js ln -sf /usr/share/javascript/jquery/jquery.js debian/python-slepc4py-docs/usr/share/doc/python-slepc4py-docs/usrman/_static/jquery.js rm debian/python-slepc4py-docs/usr/share/doc/python-slepc4py-docs/usrman/_static/underscore*.js ln -sf /usr/share/javascript/underscore/underscore.js debian/python-slepc4py-docs/usr/share/doc/python-slepc4py-docs/usrman/_static/underscore.js override_dh_python2: dh_python2 dh_numpy override_dh_python3: dh_python3 dh_numpy3 dh_python2 dh_numpy override_dh_compress: dh_compress -Xpdf override_dh_gencontrol: dh_gencontrol -- -Vpetsc4py:Depends="python-petsc4py (>= $(SLEPC_BASE_VERSION)), python-petsc4py (<< $(SLEPC_NEXT_VERSION))" \ -Vpetsc4py-real:Depends3="python3-petsc4py-real (>= $(SLEPC_BASE_VERSION)), python3-petsc4py-real (<< $(SLEPC_NEXT_VERSION))" \ -Vpetsc4py-complex:Depends3="python3-petsc4py-complex (>= $(SLEPC_BASE_VERSION)), python3-petsc4py-complex (<< $(SLEPC_NEXT_VERSION))" override_dh_installdeb: dh_installdeb for pkg in $$(dh_listpackages -a); do \ sed -i -e 's/__SLEPC4PY_VERSION__/$(SLEPC4PY_VERSION)/' debian/$$pkg/DEBIAN/*; \ done