Codebase list libsbml / debian/5.12.0+dfsg-1 debian / rules
debian/5.12.0+dfsg-1

Tree @debian/5.12.0+dfsg-1 (Download .tar.gz)

rules @debian/5.12.0+dfsg-1raw · history · blame

#!/usr/bin/make -f
# -*- makefile -*-
# debian/rules for libsbml

### define the VARS ###
version := $(shell dpkg-parsechangelog | grep Version | cut -d\  -f2 | cut -d- -f1)
major := $(shell dpkg-parsechangelog | grep Version | cut -d\  -f2 | cut -d. -f1)
libpack := libsbml
debtmp := $(CURDIR)/debian/tmp
dbgpack := $(libpack)$(major)-dbg
SRC_TMP := $(CURDIR)/SRC_TMP
# Test for matlab
CMAKE_OPTS := $(shell sed '/MATLAB/d' debian/cmake_opts)
BIND_OCTAVE :=$(shell which otave-config | grep -q ocatve && echo 'yes')
ifdef BIND_OCTAVE
OCTAVE_PATH := $(shell octave-config --oct-site-dir)
endif
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

# This is the path to the javadoc jar, which doc/CMakeLists.txt doesn't find
CMAKE_OPTS += -DJava_JAVADOC_JAR=$(JDK_PATH)/lib/tools.jar -DJAVA_INCLUDE_PATH=$(JAVA_INCLUDE_PATH)

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-python2 --dbg-package=${dbgpack}

get-orig-source:
	uscan --verbose --download-current-version --force-download --repack --compression xz

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 changelog 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_auto_configure:
ifdef BIND_MATLAB
	cat debian/control.matlab >> debian/control || true
endif
	mkdir -p build
	cd build ; cmake $(CMAKE_OPTS) ../
	/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
	cp NEWS.txt changelog

override_dh_auto_test:
	echo "no tests"

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
	pyclean $(debtmp)/usr/lib/python*
	find $(debtmp)/usr -type f -name "*.js" -delete
	find $(debtmp)/usr -type f -name "*.md5" -delete
	find $(debtmp)/usr -type f -exec chmod 644 {} +
	test -e $(debtmp)/usr/lib/python2.7/site-packages && mv $(debtmp)/usr/lib/python2.7/site-packages $(debtmp)/usr/lib/python2.7/dist-packages || true
	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/*/*/*/*/*.mex -Tdebian/libsbml5-octave.substvars
ifdef BIND_MATLAB
	dpkg-shlibdeps $(debtmp)/usr/lib/*.mex* -Tdebian/libsbml5-matlab.substvars
endif