File: rules

package info (click to toggle)
dolfin 2018.1.0.post1-18
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 28,768 kB
  • sloc: xml: 104,040; cpp: 98,856; python: 22,511; makefile: 204; sh: 182
file content (250 lines) | stat: -rwxr-xr-x 12,762 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
239
240
241
242
243
244
245
246
247
248
249
250
#!/usr/bin/make -f

DEB_SOURCE_PACKAGE := $(strip $(shell egrep '^Source: ' debian/control | cut -f 2 -d ':'))
DEB_VERSION := $(shell dpkg-parsechangelog | egrep '^Version:' | cut -f 2 -d ' ')
DEB_NOEPOCH_VERSION := $(shell echo $(DEB_VERSION) | cut -d: -f2-)
DEB_UPSTREAM_VERSION := $(shell echo $(DEB_NOEPOCH_VERSION) | sed 's/-[^-]*$$//')
DEB_STRIPPED_UPSTREAM_VERSION = $(shell echo $(DEB_UPSTREAM_VERSION) | sed -e 's/\+dfsg.*$$//p')

FENICS_RELEASE_VERSION=$(DEB_STRIPPED_UPSTREAM_VERSION)
FENICS_MAJOR_VERSION=$(shell echo $(FENICS_RELEASE_VERSION) | sed "s/^\([^.]*\)\..*$$/\1/")
FENICS_MINOR_VERSION=$(shell echo $(FENICS_RELEASE_VERSION) | sed "s/^\([^.]*\)\.\([^.]*\)\..*$$/\2/")
FENICS_VERSION=$(FENICS_MAJOR_VERSION).$(FENICS_MINOR_VERSION)
FENICS_NEXT_VERSION=$(FENICS_MAJOR_VERSION).$(shell echo $$(( $(FENICS_MINOR_VERSION) + 1 )) )

# dolfin has a strict dependency on the pybind11 version it was built against,
# if pybind11.h will be used in C++ code fragments in python scripts.
# Extract pybind11 version from pybind11-dev
PYBIND11_DEB_VERSION=$(shell dpkg -s pybind11-dev | awk '/Version:/ {print $$2}')
# extract the current pybind11 version X.Y.Z (drop epoch and debian package version)
PYBIND11_UPSTREAM_VERSION=$(shell echo $(PYBIND11_DEB_VERSION) | sed "s/^.[^:]*://; s/-[^-]*$$//")
PYBIND11_X_Y_VERSION=$(shell echo $(PYBIND11_UPSTREAM_VERSION) | sed "s/^\(.*\)\.\([^.]*\)$$/\1/")
PYBIND11_Z_VERSION=$(shell echo $(PYBIND11_UPSTREAM_VERSION) | sed "s/^\(.*\)\.\([^.]*\)$$/\2/")
PYBIND11_NEXT_UPSTREAM_VERSION=$(PYBIND11_X_Y_VERSION).$(shell echo $$(( $(PYBIND11_Z_VERSION) + 1 )) )

# Allow test programs that uses OpenMPI to run
export OMPI_MCA_plm_rsh_agent=/bin/false

DEB_BUILD_ARCH ?= $(shell dpkg-architecture -qDEB_BUILD_ARCH)
DEB_BUILD_MULTIARCH ?= $(shell dpkg-architecture -qDEB_BUILD_MULTIARCH)

include /usr/share/mpi-default-dev/debian_defaults
ENABLE_MPI=ON
ifeq ($(findstring $(DEB_BUILD_ARCH),$(OPENMPI_ARCHITECTURES)),)
MPIEXEC_PARAMS=
else
MPIEXEC_PARAMS=--oversubscribe
endif

DOLFIN_HOME = $(CURDIR)/$(DEB_SRCDIR)
USCAN_DESTDIR := $(CURDIR)
PY3VERS := $(shell py3versions --requested debian/control | tac -s' ')
PYVERS = $(PY3VERS)

BUILDDIR = obj-$(DEB_HOST_GNU_TYPE)
TESTDIR = build-tests

NPROC := $(shell nproc)
PARALLEL = $(subst parallel=,,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
N_CPU    = $(or $(PARALLEL),$(NPROC),1)
# MPI tests are set up to run on 3 processes. Spread them leanly over the available processors (don't have more than 2 tests using one processor).
# e.g. run 1 MPI test at a time over 1-3 processors, or 2 tests at a time over 4-6 processors, or 3 tests over 7-9 processors, etc.
N_MPI := 3
N_MPI_TESTS = $(shell echo $$(( ($(N_CPU)+$(N_MPI)-1)/$(N_MPI) )) )

# hyperelasticity fails (diverges) on all arches (pivot factors too large, not enough memory assigned)
# elastodynamics passes with dpkg-buildpackage but fails with pdebuild (on amd64). Unreliable, so skip.
ARCH_ALL_SKIP_MPI_TEST = demo_hyperelasticity_mpi demo_elastodynamics_mpi

# Some arches fail the same MPI tests
# e.g. cahn-hilliard, navier-stokes, elasticity, fails or exceeds allowed time
# So skip these tests on the failing arches
ARCH_SKIP_MPI_TEST_LIST = i386 mips64el ppc64el
ARCH_SKIP_MPI_TEST = demo_cahn-hilliard_mpi demo_navier-stokes_mpi demo_elasticity_mpi

# skip more MPI tests for some specific arches
ifeq (arm64, $(DEB_HOST_ARCH))
  ARCH_SPECIFIC_SKIP_MPI_TEST = demo_navier-stokes_mpi
else ifeq (mips, $(DEB_HOST_ARCH))
  ARCH_SPECIFIC_SKIP_MPI_TEST = demo_cahn-hilliard_mpi demo_stokes-iterative_mpi demo_ale_mpi demo_poisson-disc_mpi
else ifeq (mips64el, $(DEB_HOST_ARCH))
  ARCH_SPECIFIC_SKIP_MPI_TEST = demo_bcs_mpi demo_stokes-iterative_mpi demo_stokes-taylor-hood_mpi demo_curl-curl_mpi demo_contact-vi-tao_mpi
else ifeq (mipsel, $(DEB_HOST_ARCH))
  ARCH_SPECIFIC_SKIP_MPI_TEST = demo_cahn-hilliard_mpi demo_stokes-iterative_mpi demo_ale_mpi demo_poisson-disc_mpi
else ifeq (ppc64el, $(DEB_HOST_ARCH))
  ARCH_SPECIFIC_SKIP_MPI_TEST = demo_poisson_mpi demo_singular-poisson_mpi demo_sym-dirichlet-bc_mpi
else
  ARCH_SPECIFIC_SKIP_MPI_TEST =
endif

# m68k and mips need some help to pass serial tests
ifeq (m68k, $(DEB_HOST_ARCH))
  ARCH_SPECIFIC_SKIP_SERIAL_TEST = demo_auto-adaptive-poisson_serial demo_elasticity_serial
else ifeq (mips, $(DEB_HOST_ARCH))
  ARCH_SPECIFIC_SKIP_SERIAL_TEST = demo_cahn-hilliard_serial demo_hyperelasticity_serial
else
  ARCH_SPECIFIC_SKIP_SERIAL_TEST =
endif

# skip slow tests (> 500-1000 sec to complete)
ifeq (armel, $(DEB_HOST_ARCH))
  ARCH_SKIP_SLOW_TEST = demo_stokes-iterative_serial demo_auto-adaptive-navier-stokes_serial demo_hyperelasticity_serial demo_cahn-hilliard_serial
else ifeq (mips, $(DEB_HOST_ARCH))
  ARCH_SKIP_SLOW_TEST = demo_eigenvalue_serial demo_navier-stokes_serial demo_auto-adaptive-poisson_serial demo_stokes-taylor-hood_serial demo_auto-adaptive-navier-stokes_serial demo_curl-curl_serial demo_elasticity_serial demo_stokes-iterative_serial demo_eval_serial demo_sym-dirichlet-bc_serial demo_elastodynamics_serial demo_eigenvalue_mpi demo_navier-stokes_mpi demo_curl-curl_mpi demo_elasticity_mpi demo_elastodynamics_mpi demo_sym-dirichlet-bc_mpi
else ifeq (mips64el, $(DEB_HOST_ARCH))
  ARCH_SKIP_SLOW_TEST = demo_cahn-hilliard_serial demo_hyperelasticity_serial
else ifeq (mipsel, $(DEB_HOST_ARCH))
  ARCH_SKIP_SLOW_TEST = demo_cahn-hilliard_serial demo_hyperelasticity_serial
else ifeq (hppa, $(DEB_HOST_ARCH))
  ARCH_SKIP_SLOW_TEST = demo_cahn-hilliard_serial demo_hyperelasticity_serial
else ifeq (m68k, $(DEB_HOST_ARCH))
  ARCH_SKIP_SLOW_TEST = demo_cahn-hilliard_serial demo_hyperelasticity_serial
else ifeq (riscv64, $(DEB_HOST_ARCH))
  ARCH_SKIP_SLOW_TEST = demo_cahn-hilliard_serial demo_hyperelasticity_serial demo_cahn-hilliard_mpi demo_elastodynamics_mpi
else ifeq (sparc64, $(DEB_HOST_ARCH))
  ARCH_SKIP_SLOW_TEST = demo_cahn-hilliard_serial demo_hyperelasticity_serial demo_stokes-iterative_serial demo_cahn-hilliard_mpi demo_elastodynamics_mpi
else
  ARCH_SKIP_SLOW_TEST =
endif

# other arches fail or time out on too many tests, so skip all their MPI tests
ARCH_SKIP_ALL_MPI_TESTS_LIST=armel armhf i386 hppa m68k powerpc

# some arches just aren't keeping up at all, and fail non-MPI tests
ARCH_SKIP_ALL_TESTS_LIST = hurd-i386 m68k sh4

# extract PETSc version from petsc-dev
PETSC_DEB_VERSION=$(shell dpkg -s petsc-dev | awk '/Version:/ {print $2}')
# extract the current PETSc version
PETSC_UPSTREAM_VERSION=$(shell pkg-config --modversion PETSc)
# "Major" version is the first number in the upstream version (major.minor.release)
PETSC_MAJOR_VERSION=$(shell echo $(PETSC_UPSTREAM_VERSION) | sed "s/^\([^.]*\)\..*$$/\1/")
# "Minor" version is the second number in the upstream version (major.minor.release)
PETSC_MINOR_VERSION=$(shell echo $(PETSC_UPSTREAM_VERSION) | sed "s/^\([^.]*\)\.\([^.]*\)\..*$$/\2/")
PETSC_VERSION=$(PETSC_MAJOR_VERSION).$(PETSC_MINOR_VERSION)
PETSC_VERSION_NEXT=$(shell echo $(PETSC_MAJOR_VERSION).$$(($(PETSC_MINOR_VERSION)+1)))

SLEPC_UPSTREAM_VERSION=$(shell pkg-config --modversion SLEPc)
# SLEPc version must match PETSc
SLEPC_VERSION=$(PETSC_VERSION)
SLEPC_VERSION_NEXT=$(PETSC_VERSION_NEXT)

PETSC_DIR=/usr/lib/petscdir/petsc$(PETSC_VERSION)/$(DEB_HOST_MULTIARCH)-real
SLEPC_DIR=/usr/lib/slepcdir/slepc$(SLEPC_VERSION)/$(DEB_HOST_MULTIARCH)-real


DEB_CXXFLAGS := $(shell dpkg-buildflags --get CXXFLAGS)

CMAKE_OPTS := \
	-D CMAKE_BUILD_TYPE:STRING=RelWithDebInfo \
	-D BUILD_SHARED_LIBS:BOOL=ON \
	-D CMAKE_SKIP_RPATH:BOOL=ON \
	-D CMAKE_INSTALL_RPATH_USE_LINK_PATH:BOOL=OFF \
	-D PETSC_DIR:PATH=$(PETSC_DIR) \
	-D SLEPC_DIR:PATH=$(SLEPC_DIR) \
	-D DOLFIN_ENABLE_TRILINOS:BOOL=OFF \
	-D DOLFIN_ENABLE_HDF5:BOOL=ON \
	-D HDF5_C_COMPILER_EXECUTABLE:FILEPATH=/usr/bin/h5pcc \
	-D DOLFIN_ENABLE_PARMETIS:BOOL=OFF \
	-D DOLFIN_ENABLE_SCOTCH:BOOL=ON \
	-D DOLFIN_ENABLE_DOCS:BOOL=OFF \
	-D DOLFIN_ENABLE_MPI:BOOL=$(ENABLE_MPI) \
	-D MPIEXEC_PARAMS:STRING="$(MPIEXEC_PARAMS)" \
	-D CMAKE_CXX_FLAGS:STRING="-fpermissive" \
	-D DOLFIN_EXTRA_CXX_FLAGS:STRING="$(DEB_CXXFLAGS)" \
	$(DOLFIN_HOME)

%:
	dh $@ --buildsystem=cmake --with python3

override_dh_compress:
	dh_compress -X.py -X.cpp -X.h -X.pdf -X.ufl

override_dh_auto_clean:
	rm -rf $(INSTALLATION_BUILDDIR) $(TESTDIR)
	dh_auto_clean

override_dh_auto_configure:
	dh_auto_configure -- $(CMAKE_OPTS)

override_dh_auto_install:
	dh_auto_install
	dh_numpy3
	for v in $(PYVERS); do \
	    cd python; \
	    PATH=$(CURDIR)/debian/tmp/usr/bin:$$PATH \
	    CXXFLAGS="$(DEB_CXXFLAGS) -isystem $(CURDIR)/debian/tmp/usr/include" \
	    VERBOSE=1 \
	    $$v setup.py install --root=$(CURDIR)/debian/tmp --install-layout=deb; \
	done;
	chrpath -d $(CURDIR)/debian/tmp/usr/lib/python*/dist-packages/dolfin/*.so
	sed -i "s/-D_FORTIFY_SOURCE=2//g" $(CURDIR)/debian/tmp/usr/lib/$(DEB_BUILD_MULTIARCH)/pkgconfig/dolfin.pc
	sed -i "s|-DNDEBUG||g" $(CURDIR)/debian/tmp/usr/lib/$(DEB_BUILD_MULTIARCH)/pkgconfig/dolfin.pc

# make a separate copy of the build directory while testing, or else local flags (-I$(DOLFIN_HOME)) get written into dolfin.pc
INSTALLATION_BUILDDIR = installation-build
override_dh_auto_test-arch:
	case " $(ARCH_SKIP_ALL_TESTS_LIST) " in \
	  *\ $(DEB_HOST_ARCH)\ *) echo "ALL tests have been disabled on $(DEB_HOST_ARCH)";; \
	  *) set -e; \
	     cp -ra $(BUILDDIR) $(INSTALLATION_BUILDDIR); \
	     cd $(BUILDDIR); \
	     make -j$(N_CPU) unittests VERBOSE=1; \
	     make -j$(N_CPU) demos VERBOSE=1; \
	     case " $(ARCH_SKIP_MPI_TEST_LIST) " in \
	       *\ $(DEB_HOST_ARCH)\ *) IGNORE_MPI_TESTS="$(ARCH_ALL_SKIP_MPI_TEST) $(ARCH_SKIP_MPI_TEST) $(ARCH_SPECIFIC_SKIP_MPI_TEST)";; \
	       *) IGNORE_MPI_TESTS="$(ARCH_ALL_SKIP_MPI_TEST) $(ARCH_SPECIFIC_SKIP_MPI_TEST)";; \
	     esac; \
	     echo "set(CTEST_CUSTOM_TESTS_IGNORE $${IGNORE_MPI_TESTS} $(ARCH_SPECIFIC_SKIP_SERIAL_TEST) $(ARCH_SKIP_SLOW_TEST) )" >> CTestCustom.cmake; \
	     echo "Run C++ unit tests (serial)"; \
	     LD_LIBRARY_PATH=$(DOLFIN_HOME)/$(BUILDDIR)/dolfin:$${LD_LIBRARY_PATH} ctest --output-on-failure -R unittests; \
	     echo "Run C++ regressions tests (serial)"; \
	     LD_LIBRARY_PATH=$(DOLFIN_HOME)/$(BUILDDIR)/dolfin:$${LD_LIBRARY_PATH} ctest --output-on-failure -j$(N_CPU) -R demo -R serial; \
	     echo "Run C++ regression tests (MPI)"; \
	     case " $(ARCH_SKIP_ALL_MPI_TESTS_LIST) " in \
	       *\ $(DEB_HOST_ARCH)\ *) echo "MPI tests have been disabled on $(DEB_HOST_ARCH)";; \
	       *)  LD_LIBRARY_PATH=$(DOLFIN_HOME)/$(BUILDDIR)/dolfin:$${LD_LIBRARY_PATH} ctest --output-on-failure -j$(N_MPI_TESTS) -R demo -R mpi;; \
	     esac; \
	     cd ..; \
	     mv $(BUILDDIR) $(TESTDIR); \
	     mv $(INSTALLATION_BUILDDIR) $(BUILDDIR);; \
	esac

override_dh_auto_test-indep:

override_dh_install-indep:
	cd python/demo; \
	python3 generate-demo-files.py
	dh_install -X*.rst

override_dh_fixperms-indep:
	dh_fixperms
	chmod a-x debian/dolfin-doc/usr/share/dolfin/demo-python/*/*/*.py

# set petsc:Depends to something like "libpetsc-real3.8-dev, libslepc-real3.8-dev, python-petsc4py (>= 3.8), python-petsc4py (<< 3.9), python-slepc4py (>= 3.8), python-slepc4py (<< 3.9)"
PETSC_DEV_DEPENDS="libpetsc-real$(PETSC_VERSION)-dev | libpetsc$(PETSC_UPSTREAM_VERSION)-dev, libslepc-real$(SLEPC_VERSION)-dev | libslepc$(SLEPC_UPSTREAM_VERSION)-dev"
# slepc4py version must match petsc4py (using the PETSc minor version, not the patch release)
PETSC4PY_DEPENDS_PY3=python3-petsc4py (>= $(PETSC_VERSION)), python3-petsc4py (<< $(PETSC_VERSION_NEXT)), python3-slepc4py (>= $(SLEPC_VERSION)), python3-slepc4py (<< $(SLEPC_VERSION_NEXT))
override_dh_gencontrol:
	echo "python3-petsc4py:Depends=$(PETSC4PY_DEPENDS_PY3)" >> debian/python3-dolfin.substvars
	echo "python-petsc4py-alt:Depends=$(PETSC4PY_DEPENDS_PY3)" >> debian/libdolfin-dev.substvars
	dh_gencontrol -- -Vpetsc:Depends=$(PETSC_DEV_DEPENDS) -Vfenics:Upstream-Version=$(FENICS_VERSION) -Vfenics:Next-Upstream-Version=$(FENICS_NEXT_VERSION)~ \
	    -Vpybind11:Upstream-Version=$(PYBIND11_UPSTREAM_VERSION) -Vpybind11:Next-Upstream-Version=$(PYBIND11_NEXT_UPSTREAM_VERSION)

# dbgsym-migration was introduced for dolfin 2017.2 (don't update the version to a later version)
override_dh_strip:
	dh_strip --package=libdolfin$(FENICS_VERSION) --dbgsym-migration='libdolfin2017.2-dbg (<< 2017.2.0.post0-1~)' -Xpython
	dh_strip --package=python3-dolfin --dbgsym-migration='python3-dolfin-dbg (<< 2017.2.0.post0-1~)' -Xpython2

# python module so files are already stripped by setup.py (setuptools)
override_dh_dwz:
	dh_dwz -Xcpp.cpython

# https://stackoverflow.com/a/18793112/353337
override_dh_shlibdeps:
	dh_shlibdeps --dpkg-shlibdeps-params=--ignore-missing-info


.PHONY: get-orig-source override_dh_strip
get-orig-source:
	uscan --force-download --verbose --destdir $(USCAN_DESTDIR)