File: rules

package info (click to toggle)
libsbml 5.19.0%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 157,308 kB
  • sloc: cpp: 972,686; xml: 332,385; python: 128,188; cs: 57,289; ansic: 54,332; java: 27,244; makefile: 9,740; perl: 9,114; sh: 8,777; ruby: 4,760; javascript: 1,605; php: 202; csh: 3
file content (131 lines) | stat: -rwxr-xr-x 4,593 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
#!/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

export PYBUILD_NAME=libsbml

### 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) ../

override_dh_auto_build:
	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 -O--buildsystem=pybuild # unfortunately there is no setup.py
	set -x ; \
	for pyv in `py3versions -s` ; do \
	    if [ -d $(debtmp)/usr/lib/*/$${pyv}/site-packages/ ] ; then \
		mkdir -p $(debtmp)/usr/lib/$${pyv}/dist-packages ; \
		mv $(debtmp)/usr/lib/*/$${pyv}/site-packages/* $(debtmp)/usr/lib/$${pyv}/dist-packages ; \
	    fi ; \
	done
	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 {} +
	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_missing:
	find debian -name test.xml -delete
	rm -f debian/tmp/usr/share/libsbml/*.txt \
	      debian/tmp/usr/share/libsbml/README*
	dh_missing

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