File: rules

package info (click to toggle)
quantlib-swig 1.20-1
  • links: PTS
  • area: main
  • in suites: bullseye
  • size: 96,756 kB
  • sloc: cpp: 1,609,780; cs: 80,844; java: 66,214; python: 25,969; sh: 750; makefile: 299
file content (238 lines) | stat: -rwxr-xr-x 7,960 bytes parent folder | download | duplicates (2)
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
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
#! /usr/bin/make -f
#                                                       -*- makefile -*-
# debian/rules file for the Debian Linux quantlib-swig package
# Copyright (C) 2001 - 2019 by Dirk Eddelbuettel <edd@debian.org>

#package	:= $(shell grep Package debian/control | sed 's/^Package: //')
pypackage	= quantlib-python
rbpackage	= quantlib-ruby
rrpackage	= quantlib-r
version		:= $(shell head -1 debian/changelog | \
			perl -nle 'm/\S+\s+\((\S+)\)/ && print $$1')
pydeb		:= $(CURDIR)/debian/$(pypackage)
rbdeb		:= $(CURDIR)/debian/$(rbpackage)
rrdeb		:= $(CURDIR)/debian/$(rrpackage)

#arch 		:= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
## edd 01 Nov 2005 use DEB_BUILD_ARCH_CPU, not DEB_BUILD_GNU_TYPE
##                 updated rules throughout
arch		:= $(shell dpkg-architecture -qDEB_BUILD_ARCH_CPU)
cpu		:= $(shell dpkg-architecture -qDEB_HOST_GNU_CPU)

PYTHONS  	:= $(shell py3versions -s)
RUBY		:= ruby

#export DH_VERBOSE=1

## edd 29 Nov 2001	Default to g++
cxxcompiler	= g++

## edd 14 Jan 2003	no longer change g++ as g++-3.2 is now default
# 			but use g++-3.0 on ia64
#ifneq "$(findstring $(arch), ia64)" ""
#cxxcompiler	= g++-3.0
#endif

## edd 01 Feb 2002  	allow -ffunction-sections on hppa
## edd 26 Oct 2007      turn strict aliasing warning off
## edd 01 May 2011      add -fpermissive as g++ is more of a stickler
## edd 06 May 2011      remove -fpermissive with QL 1.1 betas
## edd 09 Sep 2018      bringing over a few extra settings for hppa
#compilerflags	= -O2 -Wall -Wno-strict-aliasing -DBOOST_NO_AUTO_PTR
## edd 07 Aug 2019      turning optimisation off or else linking (with lto) fails
compilerflags	= -O0 -g0 -Wall -Wno-strict-aliasing -DBOOST_NO_AUTO_PTR
ifeq ($(cpu),hppa)
compilerflags   = -O0 -g0 -mlong-calls -ffunction-sections --param ggc-min-expand=20 -DBOOST_NO_AUTO_PTR
#cxxcompiler	= g++-3.0
endif

## edd 18 May 2002	no optimisation or debugging on baby systems
## edd 14 May 2005	don't do it on mipsel or mips either
## edd 01 Jun 2007      no longer activate this on mips/mipsel
## edd 26 Jun 2007 	use cpu test, not arch test -- thanks to Riku via #430709
## edd 26 Oct 2007      s390+powerpc also die, so add'em (and remove mips(el), see next item)
## edd 27 May 2012      added mips/mipsel/armel/armhf here too
## edd 11 Mar 2015      remove powerpc and armhf from the list as they built on Ubuntu (cf
##                      https://launchpad.net/ubuntu/+source/quantlib-swig/1.5-1ubuntu1) and #779720)
##                      also remove mips, mipsel as they are getting taken care of below
#ifneq "$(findstring $(cpu), m68k arm armeb s390 powerpc armel armhf mips mipsel)" ""
ifneq "$(findstring $(cpu), m68k arm armeb s390 armel)" ""
compilerflags   = -O0 -g0 -DBOOST_NO_AUTO_PTR
endif

## edd 26 Oct 2007      really reset mips/mips to -O2 (see #419742)
## edd 27 May 2012      move to previos section
## edd 06 Dec 2014      patch by Dejan Latinovic (see #772028) to add -mxgot
## edd 23 Jun 2016      patch by Daniel Knezevic (see #827979) to add gcc-min-expand=20
## edd 29 Sep 2018      adding mips64el here as well as it recently timed out
ifneq "$(findstring $(cpu), mipsel mips mips64el)" ""
#compilerflags   = -O2 -g0
compilerflags   = -O0 -g0 -mxgot --param ggc-min-expand=20 -DBOOST_NO_AUTO_PTR
endif

## edd 21 Aug 2018      i386 now seems to be hosted on amd64
ifneq "$(findstring $(arch), i386)" ""
compilerflags   = -O0 -g0 --param ggc-min-expand=20 -DBOOST_NO_AUTO_PTR
endif

## edd 22 Aug 2018      trying to help a few other systems with their memory exhaustion
ifneq "$(findstring $(cpu), hurd-i386 kfreebsd-i386 m68k powerpc x32)" ""
compilerflags   = -O0 -g0 --param ggc-min-expand=20 -DBOOST_NO_AUTO_PTR
endif


## edd 25 Dec 2002  g++-3.2 for s390

#ifneq "$(findstring $(arch), s390)" ""
#cxxcompiler	= g++-3.2
#endif

upstream: get-orig-source
get-orig-source:
	        lynx http://quantlib.org

build: build-arch build-indep
build-arch: build-stamp
build-indep: build-stamp
build-stamp:
	dh_testdir
	@echo "*** Running on arch $(arch) and cpu $(cpu)"

        # need to build the Makefile for R (and Ruby ?)
	./configure 	--prefix=/usr 				\
			--build $(arch)

        # $(MAKE)
	(cd Python && for python in $(PYTHONS); do		\
				CC="$(cxxcompiler)"		\
				CXX="$(cxxcompiler)" 		\
				CFLAGS="$(compilerflags)"	\
				CXXFLAGS="$(compilerflags)"	\
				$$python setup.py build;	\
			done					)

	# (cd Ruby &&						\
	# 		CC="$(cxxcompiler)"			\
	# 		CXX="$(cxxcompiler)"			\
	# 		CFLAGS="$(compilerflags)"		\
	# 		CXXFLAGS="$(compilerflags)"		\
	# 		$(RUBY) setup.rb build                  )

#	(cd R &&						\
#			CC="$(cxxcompiler)"			\
#			CXX="$(cxxcompiler)"			\
#			CFLAGS="$(compilerflags)"		\
#			CXXFLAGS="$(compilerflags)"		\
#			make					)

	touch build-stamp

test:	build test-stamp
test-stamp:
## edd 01 Nov 2005  run check only on i386
#ifeq "$(findstring $(arch), m68k arm)" ""
ifeq ($(cpu),i486)
        # -$(MAKE) test
	(cd Python && for python in $(PYTHONS); do		\
		$$python setup.py test;				\
		done						)
	#(cd Ruby && $(RUBY) setup.rb test 			)
endif
	touch test-stamp

clean:
	dh_testdir
	dh_testroot
	rm -f build-stamp test-stamp install-stamp
	-test -f Makefile && $(MAKE) realclean
	(cd Python && for python in $(PYTHONS); do 		\
			$$python setup.py clean --all;		\
			done &&					\
			rm -f QuantLib/*.pyc			)
#	(cd Ruby &&						\
#			rm -f quantlib_wrap.o QuantLibc.so 	)
	dh_clean

install: test install-stamp
install-stamp:
	dh_testdir
	dh_testroot
	dh_prep
	dh_installdirs	-p$(pypackage)	usr/share/$(pypackage)
        #$(MAKE) install PREFIX=$(debtmp)/usr
	(cd Python && 						\
		for python in $(PYTHONS); do			\
			$$python setup.py 			\
				install --prefix=$(pydeb)/usr 	\
					--install-layout=deb;	\
		done						)

        # edd 2005-Apr-14  copy swig file manually instead
	cp -vax SWIG/* 	$(pydeb)/usr/share/$(pypackage)/
	rm -fv 	Python/test/*.pyc
        # remove Docs installed by Python, we do that below
	rm -frv $(pydeb)/usr/share/doc/QuantLib-Python
        # remove .pyc which Lintian doesn't like
	rm -frv $(pydeb)/usr/lib/python*/site-packages/QuantLib/*.pyc
	rm -frv $(pydeb)/usr/lib/python3/dist-packages/QuantLib/__pycache__/

	#dh_installdirs -p$(rbpackage)	usr/share/$(rbpackage)
        ## $(MAKE) install PREFIX=$(debtmp)/usr
	#(cd Ruby &&							\
	#	CXX="$(cxxcompiler)" 					\
	#	CFLAGS="$(compilerflags)" 				\
	#	CXXFLAGS="$(compilerflags)" 				\
	#	$(RUBY) setup.rb install				\
	#		--prefix=$(rbdeb)/usr --debian                  )
        ## fix mode, lintian complain about 755 and no #! line
	#chmod 644 debian/$(rbpackage)/usr/lib/ruby/*/QuantLib.rb
        ## edd 2007-Dec-20  copy swig file manually instead as well
	#cp -vax SWIG/*	$(rbdeb)/usr/share/$(rbpackage)/
	#touch install-stamp

	#dh_installdirs -p$(rrpackage)	usr/lib/$(rrpackage) usr/share/$(rrpackage)
        ## $(MAKE) install PREFIX=$(debtmp)/usr
	#cp -vax R/QuantLib.so R/QuantLib.RData R/QuantLib.R R/README.txt $(rrdeb)/usr/lib/$(rrpackage)/
	#cp -vax SWIG/*	$(rrdeb)/usr/share/$(rrpackage)/

	touch install-stamp

binary-indep: build test install

binary-arch: build test install
	dh_testdir
	dh_testroot
#	dh_installdebconf
	dh_installdocs	-A	README.md News.md
	dh_installexamples -p$(pypackage) Python/test/ Python/examples/*.py
#	dh_installexamples -p$(rbpackage) Ruby/test/ Ruby/examples/*.rb
#	dh_installexamples -p$(rrpackage) R/examples/*.R
#	dh_installmenu
#	dh_installemacsen
#	dh_installpam
#	dh_installinit
#	dh_installcron
#	dh_installmanpages
#	dh_installinfo
#	dh_undocumented
	dh_installchangelogs -A	ChangeLog.txt
#	dh_link
	dh_compress
	dh_fixperms
	dh_strip
#	dh_suidregister
#	dh_pycentral	-p$(pypackage)
#	dh_python	-p$(pypackage)
	dh_python3
	dh_makeshlibs
	dh_installdeb
	dh_shlibdeps
	dh_gencontrol
	dh_md5sums
	dh_builddeb

source diff:
	@echo >&2 'source and diff are obsolete - use dpkg-source -b'; false

binary: binary-indep binary-arch
.PHONY: build clean binary-indep binary-arch binary install test