#!/usr/bin/make -f # -*- makefile -*- # debian/rules for libsbml export DEB_BUILD_MAINT_OPTIONS = hardening=+all ### define the VARS ### include /usr/share/dpkg/default.mk version := $(DEB_VERSION_UPSTREAM) libpack := libsbml debtmp := $(CURDIR)/debian/tmp SRC_TMP := $(CURDIR)/SRC_TMP # Test for matlab CMAKE_OPTS := $(shell sed '/MATLAB/d' debian/cmake_opts) BIND_MATLAB := $(shell which matlab | grep -q matlab && echo 'yes') ifdef BIND_MATLAB CMAKE_OPTS := $(shell cat debian/cmake_opts) endif # seems we need to use debian/cmake_opts JDK_PATH:=$(shell readlink -f /usr/bin/javac | sed "s:/bin/javac::") JAVA_INCLUDE_PATH:=$(JDK_PATH)/include ifneq (,$(filter $(DEB_HOST_ARCH), mips mipsel)) CMAKE_OPTS += -D'WITH_01_COMPILE:BOOL=ON' endif ### let's do it ### DEB_COMPRESS_EXCLUDE = .pdf %: dh $@ --with python3,cli override_dh_auto_clean: ### the clean target of the libsbml makefile is highly b0rken ### ### the switch to cmake didn't result in great approvements ### ### still inline changes of files ### ### very ugly ### rm -rf build docs/formatted docs/src/doxygen-version-specific.txt docs/src/doxygen-config-cpp.txt \ docs/src/doxygen-config-csharp.txt docs/src/doxygen-config-perl.txt docs/src/doxygen-config-python.txt \ docs/src/java-substitutions/libsbmlConstants.java docs/src/libsbml-installation.html docs/src/perlmod/DoxyDocs.pm \ docs/src/perlmod/DoxyStructure.pm docs/src/perlmod/Makefile docs/src/perlmod/doxyrules.make \ src/bindings/matlab/runTests.log docs/src/doxygen-config-c.txt src/bindings/matlab/*.mex* docs/src/perlmod \ docs/src/doxygen_sqlite3.db docs/src/libsbml.py docs/src/common-text/libsbml-version.html find src/bindings -name "*.pyc" -delete override_dh_autoreconf: echo "autoreconf -f -i returns exit code 1 - skip this" override_dh_auto_configure: ifdef BIND_MATLAB cat debian/control.matlab >> debian/control || true endif mkdir -p build cd build ; cmake $(CMAKE_OPTS) ../ # skip this hack since it should work also without it # /bin/sh debian/bin/python_fix.sh override_dh_auto_build: # we need to mount proc # see https://lists.alioth.debian.org/pipermail/debian-med-packaging/2015-December/037461.html # and https://lists.alioth.debian.org/pipermail/debian-med-packaging/2015-December/037474.html ## its rather a bug in pbuilder if proc is not mounted ...# if mount | grep "^proc " ; then echo "proc mounted - fine"; else mount proc /proc -t proc ; fi cd build ; make override_dh_auto_test: ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS))) echo "no tests" endif override_dh_auto_install: cd build ; DESTDIR=../debian/tmp make install sed 's#formatted/##g' docs/index.html.in > $(debtmp)/usr/share/libsbml/docs/index.html dh_auto_install find $(debtmp)/usr -type f -name "*.js" -delete find $(debtmp)/usr -type f -name "*.md5" -delete find $(debtmp)/usr -type f -exec chmod 644 {} + for pyv in `py3versions -s` ; do \ test -e $(debtmp)/usr/lib/$${pyv}/site-packages && mv $(debtmp)/usr/lib/python$${pyv}/site-packages $(debtmp)/usr/lib/python$${pyv}/dist-packages || true ; \ done find $(debtmp)/usr/lib -name "*.mex*" -exec strip --strip-unneeded {} + || true find $(debtmp)/usr/lib -name "*.mex*" -exec strip --remove-section=.comment {} + || true dpkg-shlibdeps $(debtmp)/usr/lib/*/octave/site/oct/*/*.mex -Tdebian/libsbml5-octave.substvars dh_octave_substvar # for some reason the perl library ends up in # debian/tmp/usr/lib/$(DEB_HOST_ARCH)/$(DEB_HOST_ARCH)/perl5 # try to fix this set -x ; \ for madir in `find debian -name $(DEB_BUILD_MULTIARCH) -type d | sort | uniq` ; do \ if [ -d $${madir}/$(DEB_BUILD_MULTIARCH) ] ; then \ echo "Moving contents of wrong directory $${madir}/$(DEB_BUILD_MULTIARCH) into place" ; \ mv $${madir}/$(DEB_BUILD_MULTIARCH)/* $${madir} ; \ rmdir $${madir}/$(DEB_BUILD_MULTIARCH) ; \ fi ; \ done ifdef BIND_MATLAB dpkg-shlibdeps $(debtmp)/usr/lib/*.mex* -Tdebian/libsbml5-matlab.substvars endif override_dh_installexamples: dh_installexamples for pl in `grep -Rl '#![[:space:]]*/usr/bin/env[[:space:]]\+perl' debian/*/usr/*` ; do \ sed -i '1s?^#![[:space:]]*/usr/bin/env[[:space:]]\+perl?#!/usr/bin/perl?' $${pl} ; \ done override_dh_installchangelogs: dh_installchangelogs NEWS.txt override_dh_dwz: echo "Skip dwz: Too few files for multifile optimization" override_jh_installjavadoc: jh_installjavadoc rdfind -makesymlinks true -followsymlinks true \ $$(dpkg -L $$(apt-cache show default-jdk-doc | grep Depends \ | awk '{print $$2}') | grep /usr/share/doc/ \ | head -n1) \ debian/libsbml5-java/usr/share/doc/libsbml5-java/ ifeq ($(DH_VERBOSE),1) cat results.txt || /bin/true endif rm -f results.txt