File: rules

package info (click to toggle)
libsbml 5.20.5%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 117,108 kB
  • sloc: cpp: 469,781; xml: 364,270; ansic: 54,078; python: 12,540; makefile: 9,759; sh: 9,245; cs: 8,586; java: 8,151; perl: 6,133; ruby: 4,760; javascript: 1,605; php: 202; csh: 3
file content (153 lines) | stat: -rwxr-xr-x 5,567 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
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
#!/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
PY3=$(shell py3versions -d)
# 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

BIND_DOXYGEN := $(shell command -v doxygen | grep -q doxygen && echo 'yes')

ifdef BIND_DOXYGEN
ifeq ($(filter nodoc,$(DEB_BUILD_PROFILES)),)
CMAKE_OPTS += -DWITH_DOXYGEN:BOOL=ON
else
CMAKE_OPTS += -DWITH_DOXYGEN:BOOL=OFF
undefine BIND_DOXYGEN
endif
else
CMAKE_OPTS += -DWITH_DOXYGEN:BOOL=OFF
endif

ifneq ($(filter nocheck,$(DEB_BUILD_PROFILES)),)
CMAKE_OPTS += -DWITH_CHECK:BOOL=OFF
else
CMAKE_OPTS += -DWITH_CHECK:BOOL=ON
endif

ifneq (,$(filter $(DEB_HOST_ARCH), mips mipsel))
CMAKE_OPTS += -D'WITH_01_COMPILE:BOOL=ON'
endif

CMAKE_OPTS += -DPYTHON_EXECUTABLE=/usr/bin/${PY3}

CMAKE_OPTS += -DWITH_CSHARP:BOOL=OFF

export PYBUILD_NAME=libsbml

### let's do it ###

%:
	dh $@ --builddir=build --buildsystem=cmake --without autoreconf --no-parallel

execute_after_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

ifdef BIND_MATLAB
execute_before_dh_auto_configure:
	cat debian/control.matlab >> debian/control || true
endif

override_dh_auto_configure:
	dh_auto_configure -- $(CMAKE_OPTS)
	### The following command is a hack to get around Bug#1125648.
	### For some unkown reason, the value the LIBDIR installation directory
	### is wrong after the invokation of cmake. It is set to:
	### /<<PKGBUILDDIR>>/debian/tmp/<<PKGBUILDDIR>>/build/lib/<<ARCHTRIPLET>>
	### but should actually be:
	### /<<PKGBUILDDIR>>/debian/tmp/lib/<<ARCHTRIPLET>>
	sed -i build/CMakeCache.txt	\
            -e "s;^CMAKE_INSTALL_LIBDIR.*;CMAKE_INSTALL_LIBDIR:PATH=lib/$$DEB_BUILD_MULTIARCH;"

ifeq "$(DEB_HOST_ARCH)" "i386"
override_dh_auto_test:
	echo Skipping tests on i386
endif

execute_after_dh_auto_install:
ifeq (,$(findstring nodoc,$(DEB_BUILD_OPTIONS)))
	mkdir -p $(debtmp)/usr/share/libsbml/docs/
	sed 's#formatted/##g' docs/index.html.in > $(debtmp)/usr/share/libsbml/docs/index.html
endif
#	dh_auto_install -O--buildsystem=pybuild # unfortunately there is no setup.py
	set -x ; \
	for pyv in ${PY3} ; 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
	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 -l$(shell octave-config -p OCTLIBDIR)
	dh_octave_substvar --package=libsbml5-octave
	# 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
	find debian -type f -name "_form*" -delete
ifdef BIND_MATLAB
	dpkg-shlibdeps $(debtmp)/usr/lib/*.mex* -Tdebian/libsbml5-matlab.substvars
endif

execute_after_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

execute_before_dh_missing:
	find debian -name test.xml -delete
	rm -f debian/tmp/usr/share/libsbml/*.txt \
	      debian/tmp/usr/share/libsbml/README*

override_dh_dwz:
	echo "Skip dwz: Too few files for multifile optimization"

override_dh_shlibdeps:
	dh_shlibdeps -l$(shell octave-config -p OCTLIBDIR)

execute_after_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