#!/usr/bin/make -f export DEB_BUILD_MAINT_OPTIONS = hardening=+all # needed for the tests export DCMDICTPATH=$(shell ls /usr/share/libdcmtk*/dicom.dic | head -n 1) # Find all Python versions PYTHON2=$(shell pyversions -vrd) PYTHON3=$(shell py3versions -vrd) ALLPY=$(PYTHON2) $(PYTHON3) %: dh $@ --builddirectory=build --with python2,python3 # Base build: no wrappers override_dh_auto_configure-arch: dh_auto_configure -- \ -DBUILD_EXAMPLES=OFF \ -DBUILD_PYTHON_WRAPPERS=OFF -DBUILD_JAVASCRIPT_WRAPPERS=OFF override_dh_auto_build-nopy: dh_auto_build mv build build-nopy # Reconfigure base build for specific Python version and build wrappers # WARNING: Python2 and Python3 MUST be built sequentially since they use the # same build directory override_dh_auto_build-py: override_dh_auto_build-nopy set -e; \ for Python in $(ALLPY); do \ echo "=== Building for Python $${Python} ==="; \ cp -a build-nopy build; \ dh_auto_configure -- \ -DBUILD_EXAMPLES=OFF \ -DBUILD_PYTHON_WRAPPERS=ON -DBUILD_JAVASCRIPT_WRAPPERS=OFF \ -DPYTHON_EXECUTABLE=/usr/bin/python$${Python}; \ dh_auto_build; \ mv build build-py$${Python}; \ done override_dh_auto_build-arch: override_dh_auto_build-nopy override_dh_auto_build-py override_dh_auto_build-indep: dh_auto_configure --builddirectory=build-indep -- \ -DBUILD_EXAMPLES=OFF \ -DBUILD_PYTHON_WRAPPERS=ON -DBUILD_JAVASCRIPT_WRAPPERS=OFF \ -DPYTHON_EXECUTABLE=/usr/bin/python$(PYTHON3) mkdir -p documentation/_build cd documentation && doxygen find documentation/_build -name "*.md5" -delete # Run C++ tests only on base build override_dh_auto_test-arch-nopy: ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS))) ln -s build-nopy build cd build && ../tests/run --no-network -e ".*" rm build endif # Run Python tests only on python build # WARNING: Python2 and Python3 MUST be tested sequentially since they use the # same build directory override_dh_auto_test-arch-py: override_dh_auto_test-arch-nopy ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS))) set -e; \ for Python in $(ALLPY); do \ echo "=== Testing for Python $${Python} ==="; \ ln -s build-py$${Python} build; \ ln -sr ./build/wrappers/python ./build/odil; \ ln -sr ./wrappers/python/*.py ./build/odil; \ cd build && \ ../tests/run --no-network \ --nose nosetests$$(dpkg --compare-versions $${Python} ge 3 && echo "3") \ -E ".*"; \ cd ..; \ rm ./build/odil/*py; \ rm ./build/odil; \ rm build; \ done endif override_dh_auto_test-arch: override_dh_auto_test-arch-nopy override_dh_auto_test-arch-py override_dh_auto_install-arch-nopy: ln -s build-nopy build $(MAKE) -C build/src install DESTDIR=$(CURDIR)/debian/tmp rm build # WARNING: Python2 and Python3 MUST be installed sequentially since they use the # same build directory override_dh_auto_install-arch-py: override_dh_auto_install-arch-nopy set -e; \ for Python in $(ALLPY); do \ echo "=== Installing for Python $${Python} ==="; \ ln -s build-py$${Python} build; \ $(MAKE) -C build/wrappers/python install DESTDIR=$(CURDIR)/debian/tmp; \ rm build; \ done override_dh_auto_install-arch: override_dh_auto_install-arch-nopy override_dh_auto_install-arch-py override_dh_auto_install-indep: ln -s build-indep build $(MAKE) -C build/applications install DESTDIR=$(CURDIR)/debian/tmp rm build override_dh_install-arch: dh_install d-shlibmove \ --devunversioned \ --commit --multiarch --exclude-a --exclude-la \ --movedev debian/tmp/usr/include/* usr/include \ --override s/libboost_log.*-dev/libboost-log-dev/ \ debian/tmp/usr/lib/*.so override_dh_clean: dh_clean find tests -name "*pyc" -delete rm -rf build-nopy $(ALLPY:%=build-py%) build-indep documentation/_build override_dh_dwz: echo "Ignore dh_dwz due to 'dwz -q -- debian/python-odil/usr/lib/python2.7/dist-packages/odil/_odil.x86_64-linux-gnu.so returned exit code 1'" # These steps are not needed for arch-independent packages override_dh_auto_configure-indep: override_dh_auto_test-indep: