File: rules

package info (click to toggle)
openturns 1.11-2
  • links: PTS, VCS
  • area: main
  • in suites: experimental
  • size: 64,144 kB
  • sloc: cpp: 202,072; python: 31,104; ansic: 8,352; makefile: 358; sh: 279; yacc: 123; lex: 43
file content (137 lines) | stat: -rwxr-xr-x 5,338 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
#!/usr/bin/make -f

ifeq ($(findstring parallel=,$(DEB_BUILD_OPTIONS)),)
	export DEB_BUILD_OPTIONS+=parallel=$(shell getconf _NPROCESSORS_ONLN)
endif
$(info DEB_BUILD_OPTIONS:$(origin DEB_BUILD_OPTIONS)=$(DEB_BUILD_OPTIONS))

ifneq (,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
	NUMJOBS = $(patsubst parallel=%,%,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
	test_makeflags = -j$(NUMJOBS)
endif

cppflags := $(shell dpkg-buildflags --get CPPFLAGS)
cflags := $(shell dpkg-buildflags --get CFLAGS) $(cppflags)
cxxflags := $(shell dpkg-buildflags --get CXXFLAGS) $(cppflags)
fflags := $(shell dpkg-buildflags --get FFLAGS)
ldflags := $(shell dpkg-buildflags --get LDFLAGS)
ldflags += -Wl,--as-needed

ifeq ($(shell dpkg --print-architecture),armel)
    cflags := $(subst -O2,-O1,$(cflags))
    cxxflags := $(subst -O2,-O1,$(cxxflags))
    fflags := $(subst -O2,-O1,$(fflags))
endif
ifeq ($(shell dpkg --print-architecture),armhf)
    cflags := $(subst -O2,-O1,$(cflags))
    cxxflags := $(subst -O2,-O1,$(cxxflags))
    fflags := $(subst -O2,-O1,$(fflags))
endif
ifneq (,$(findstring $(shell dpkg-architecture -qDEB_HOST_ARCH), i386 kfreebsd-i386 hurd-i386))
    cflags += -O0 -ffloat-store
    cxxflags += -ffloat-store
endif
ifneq (,$(findstring $(shell dpkg-architecture -qDEB_HOST_ARCH), i386 amd64 ia64))
    with_tbb := -DUSE_TBB:BOOL=ON
else
    with_tbb := -DUSE_TBB:BOOL=OFF
endif

# Disable NLopt_std tests on i386, it raises a roundoff-limited exception with AUGLAG_EQ algorithm
ifeq ($(shell dpkg --print-architecture),i386)
    test_discardflags := -E NLopt_std
endif

debRlib := $(CURDIR)/debian/tmp/usr/lib/R/site-library
export R_LIBS=$(debRlib)
PYVER = $(shell pyversions -d)
PY3VER = $(shell py3versions -d)
PYALL = $(PYVER) $(PY3VER)

BUILD_DATE = $(shell date --utc --date="@$(SOURCE_DATE_EPOCH)" "+%a, %d %b %Y %H:%M:%S %z")

%:
ifneq (,$(findstring $(shell dpkg-architecture -qDEB_HOST_ARCH), mips mipsel))
	$(error This package requires more than 1GB RAM; do not build on mips/mipsel)
endif
	dh $@ --buildsystem=cmake --with python2,python3 --parallel

debian/tmp/usr/lib/R/site-library/rot:
	-mkdir -p $(debRlib)
	R CMD INSTALL --library=$(debRlib) --built-timestamp='$(BUILD_DATE)' utils/rot_1.4.6.tar.gz

override_dh_auto_configure: debian/tmp/usr/lib/R/site-library/rot $(PYALL:python%=cmake-configure-%) \

cmake-configure-%:
	dh_auto_configure -Bbuild-python$* -- \
            $(with_tbb) \
            -Dot_configure_date:STRING='$(BUILD_DATE)' \
            -DUSE_SPHINX:BOOL=OFF \
            -DCMAKE_CXX_COMPILER:FILEPATH=/usr/bin/g++ \
            -DCMAKE_C_COMPILER:FILEPATH=/usr/bin/gcc \
            -DCMAKE_BUILD_TYPE:STRING=RelWithDebInfo \
            -DCMAKE_C_FLAGS_RELWITHDEBINFO:STRING='$(cflags)' \
            -DCMAKE_CXX_FLAGS_RELWITHDEBINFO:STRING='$(cxxflags)' \
            -DCMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO:STRING='$(ldflags)' \
            -DCMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO:STRING='$(ldflags)' \
            -DCMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO:STRING='$(ldflags)' \
            -DCMAKE_SKIP_INSTALL_RPATH:BOOL=ON \
            -DCMAKE_INSTALL_PREFIX:PATH=/usr \
            -DCMAKE_INSTALL_LIBDIR:PATH=/usr/lib \
            -DLIB_SOVERSION=0.12 \
            -DLIB_VERSION=0.12.0 \
            -DOPENTURNS_SYSCONFIG_PATH:PATH=/etc/openturns-1.11 \
            -DINSTALL_DESTDIR:PATH=$(CURDIR)/debian/tmp \
            -DLINK_PYTHON_LIBRARY:BOOL=OFF \
            -DPYTHON_EXECUTABLE:FILEPATH=/usr/bin/python$* \
            -DPYTHON_INCLUDE_DIR:PATH=$$(python$*-config --includes | sed -e 's/ .*//' -e 's/^-I//') \
            -DPYTHON_INCLUDE_DIR2:PATH=$$(python$*-config --includes | sed -e 's/ .*//' -e 's/^-I//') \
            -DPYTHON_LIBRARY:PATH=$$(python$*-config --ldflags | sed -e 's/ .*//' -e 's/^-L//')/libpython$*.so

override_dh_auto_build: $(PYALL:python%=cmake-build-%)

cmake-build-%:
	$(MAKE) $(test_makeflags) -C build-python$*/lib
	$(MAKE) -j1 -C build-python$*/python
	$(MAKE) $(test_makeflags) -C build-python$*

override_dh_auto_install: debian/tmp/usr/lib/R/site-library/rot $(PYALL:python%=cmake-install-%)

cmake-install-%:
	dh_auto_install -Bbuild-python$*
ifeq (,$(findstring nocheck,$(DEB_BUILD_OPTIONS)))
	LD_LIBRARY_PATH=$${LD_LIBRARY_PATH:+$${LD_LIBRARY_PATH}:}$(CURDIR)/debian/tmp/usr/lib \
	  CTEST_OUTPUT_ON_FAILURE=1 \
	  R_LIBS_SITE=$(CURDIR)/debian/tmp/usr/lib/R/site-library \
	  $(MAKE) $(test_makeflags) -C build-python$* test ARGS="$(test_makeflags) $(test_discardflags) -R pyinstallcheck"
endif

override_dh_makeshlibs:
	dh_makeshlibs -Xpyshared

override_dh_strip:
	dh_strip -plibopenturns0.12 -ppython-openturns -ppython3-openturns

override_dh_python2:
	dh_python2 -p python-openturns

override_dh_python3:
	dh_python3 -p python3-openturns

override_dh_compress:
	dh_compress -X.pdf -X.git -X.py

override_dh_auto_test: $(PYALL:python%=cmake-test-%)

cmake-test-%:
	# 'make test' does not build binary tests
ifeq (,$(findstring nocheck,$(DEB_BUILD_OPTIONS)))
	$(MAKE) $(test_makeflags) -C build-python$* tests
	LD_LIBRARY_PATH=$${LD_LIBRARY_PATH:+$${LD_LIBRARY_PATH}:}$(CURDIR)/debian/tmp/usr/lib \
	  CTEST_OUTPUT_ON_FAILURE=1 \
	  $(MAKE) -C build-python$* test ARGS="$(test_makeflags) $(test_discardflags) -R cppcheck"
endif

get-orig-source:
	uscan --force-download --verbose
	mv ../openturn*.tar.[gzbz2]* ../tarballs