File: rules

package info (click to toggle)
dolfin 2016.2.0-2
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 45,112 kB
  • ctags: 22,978
  • sloc: cpp: 527,109; xml: 104,135; python: 27,898; makefile: 413; sh: 191
file content (162 lines) | stat: -rwxr-xr-x 7,280 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
154
155
156
157
158
159
160
161
162
#!/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 )) )

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

# Disable MPI on lam architectures
include /usr/share/mpi-default-dev/debian_defaults
ifeq ($(findstring $(DEB_BUILD_ARCH),$(OPENMPI_ARCHITECTURES)),)
ENABLE_MPI=OFF
else
ENABLE_MPI=ON
endif

BUILDDIR = $(CURDIR)/debian/build
DOLFIN_HOME = $(CURDIR)/$(DEB_SRCDIR)
USCAN_DESTDIR := $(CURDIR)
PYVERS := $(shell pyversions --requested debian/control | tac -s' ')
DEFAULT_PYVER := $(shell pyversions -d)

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

PETSC_DIR=/usr/lib/petscdir/$(PETSC_VERSION)-real
# SLEPc version must match PETSc
SLEPSC_DIR=/usr/lib/slepcdir/$(PETSC_VERSION)-real

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 DOLFIN_ENABLE_TRILINOS:BOOL=OFF \
	-D DOLFIN_ENABLE_HDF5:BOOL=ON \
	-D HDF5_C_COMPILER_EXECUTABLE:FILEPATH=/usr/bin/h5pcc \
	-D DOLFIN_ENABLE_VTK:BOOL=ON \
	-D DOLFIN_ENABLE_QT:BOOL=OFF \
	-D DOLFIN_ENABLE_PARMETIS:BOOL=OFF \
	-D DOLFIN_ENABLE_PASTIX:BOOL=OFF \
	-D DOLFIN_ENABLE_SCOTCH:BOOL=ON \
	-D DOLFIN_ENABLE_PETSC4PY:BOOL=ON \
	-D DOLFIN_ENABLE_SLEPC4PY:BOOL=ON \
	-D DOLFIN_ENABLE_SPHINX:BOOL=OFF \
	-D DOLFIN_ENABLE_DOCS:BOOL=OFF \
	-D DOLFIN_ENABLE_UNIT_TESTS:BOOL=OFF \
	-D SWIG_EXECUTABLE:FILEPATH=/usr/bin/swig \
	-D DOLFIN_ENABLE_MPI:BOOL=$(ENABLE_MPI) \
	-D PETSC_DIR:PATH=$(PETSC_DIR) \
	-D SLEPC_DIR:PATH=$(SLEPSC_DIR) \
	-D DOLFIN_LIB_DIR:PATH=lib/$(DEB_BUILD_MULTIARCH) \
	-D DOLFIN_PKGCONFIG_DIR:PATH=lib/$(DEB_BUILD_MULTIARCH)/pkgconfig \
	-D CMAKE_CXX_FLAGS:STRING="-fpermissive" \
	$(DOLFIN_HOME)

ifeq (,$(DISTRIBUTION))
        DISTRIBUTION := $(shell dpkg-parsechangelog --format rfc822 | sed -ne "s/^Distribution: //p")
endif

ifneq ($(DISTRIBUTION),$(findstring $(DISTRIBUTION),"squeeze wheezy lucid maverick natty oneiric precise quantal raring saucy"))
        DISTRIBUTION := sid
endif

ifneq (,$(findstring $(DISTRIBUTION),"raring saucy sid"))
        PYTHON_INCLUDE_DIR2 = /usr/include/$(DEB_BUILD_MULTIARCH)
        PYTHON_LIBRARY_DIR = /usr/lib/$(DEB_BUILD_MULTIARCH)
else
        PYTHON_INCLUDE_DIR2 = /usr/include
        PYTHON_LIBRARY_DIR = /usr/lib
endif

%:
	dh $@ --buildsystem=cmake \
	      --builddirectory=$(BUILDDIR)-$(DEFAULT_PYVER) \
	      --with python2 \
	      --parallel

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

override_dh_auto_clean:
	for v in $(PYVERS); do \
	   rm -rf $(BUILDDIR)-$$v; \
	done

override_dh_auto_configure:
	for v in $(PYVERS); do \
	dh_auto_configure --builddirectory=$(BUILDDIR)-$$v -- \
	   -D PYTHON_EXECUTABLE:FILEPATH=/usr/bin/$$v \
	   -D PYTHON_LIBRARY:FILEPATH=$(PYTHON_LIBRARY_DIR)/lib$$v.so \
	   -D PYTHON_INCLUDE_DIR:PATH=/usr/include/$$v \
	   -D PYTHON_INCLUDE_DIR2:PATH=$(PYTHON_INCLUDE_DIR2)/$$v \
	   -- $(CMAKE_OPTS) ;\
	done

override_dh_auto_build:
	for v in $(PYVERS); do \
	   dh_auto_build --builddirectory=$(BUILDDIR)-$$v; \
	done

override_dh_auto_install:
	for v in $(PYVERS); do \
	   dh_auto_install --builddirectory=$(BUILDDIR)-$$v; \
	done
	dh_numpy
	sed -i "s/-Werror=format-security//g" $(CURDIR)/debian/tmp/usr/lib/$(DEB_BUILD_MULTIARCH)/pkgconfig/dolfin.pc
	sed -i "s/-g -O2//g" $(CURDIR)/debian/tmp/usr/lib/$(DEB_BUILD_MULTIARCH)/pkgconfig/dolfin.pc
	sed -i "s/-D_FORTIFY_SOURCE=2//g" $(CURDIR)/debian/tmp/usr/lib/$(DEB_BUILD_MULTIARCH)/pkgconfig/dolfin.pc
	sed -i "s/-frounding-math//g" $(CURDIR)/debian/tmp/usr/lib/$(DEB_BUILD_MULTIARCH)/pkgconfig/dolfin.pc
	sed -i "s/-Wformat//g" $(CURDIR)/debian/tmp/usr/lib/$(DEB_BUILD_MULTIARCH)/pkgconfig/dolfin.pc
	sed -i "s/-Wno-deprecated//g" $(CURDIR)/debian/tmp/usr/lib/$(DEB_BUILD_MULTIARCH)/pkgconfig/dolfin.pc
	sed -i "s|-I/usr/local/include||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
	sed -i "s/-Wdate-time//g" $(CURDIR)/debian/tmp/usr/lib/$(DEB_BUILD_MULTIARCH)/pkgconfig/dolfin.pc

# set petsc:Depends to something like "libpetsc3.7.5-dev, libslepc3.7.3-dev, python-petsc4py (>= 3.7), python-petsc4py (<<3.8), python-slepc4py (>= 3.7), python-slepc4py (<<3.8)"
PETSC_DEV_DEPENDS="libpetsc$(PETSC_UPSTREAM_VERSION)-dev [!kfreebsd-amd64 !kfreebsd-i386], libslepc$(SLEPC_UPSTREAM_VERSION)-dev [!kfreebsd-amd64 !kfreebsd-i386]"
# slepc4py version must match petsc4py (using the PETSc minor version, not the patch release)
PETSC4PY_DEPENDS=python-petsc4py (>= $(PETSC_VERSION)), python-petsc4py (<< $(PETSC_VERSION_NEXT)), python-slepc4py (>= $(PETSC_VERSION)), python-slepc4py (<< $(PETSC_VERSION_NEXT))
override_dh_gencontrol:
	# We have a tight dependency on swig - #675207
	set -e; \
	swig_version=$$(dpkg-query -W swig3.0 | cut -f 2 | cut -d- -f 1); \
	next_swig_version="$${swig_version%.*}.$$(($${swig_version##*.} + 1))"; \
	echo "swig:Depends=swig3.0 (>= $$swig_version), swig3.0 (<< $$next_swig_version~)" >> debian/python-dolfin.substvars
	echo "petsc4py:Depends=$(PETSC4PY_DEPENDS)" >> debian/python-dolfin.substvars
	dh_gencontrol -- -Vpetsc:Depends=$(PETSC_DEV_DEPENDS) -Vsource:Next-Upstream-Version=$(FENICS_NEXT_VERSION)~

override_dh_strip:
	dh_strip -a --package=libdolfin$(FENICS_VERSION) --dbg-package=libdolfin$(FENICS_VERSION)-dbg -Xpython
	dh_strip -a --package=python-dolfin --dbg-package=python-dolfin-dbg

override_dh_installman:
	dh_installman


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