File: rules

package info (click to toggle)
slepc 3.10.1%2Bdfsg1-3
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 29,068 kB
  • sloc: ansic: 92,160; python: 4,121; makefile: 2,931; fortran: 1,694; f90: 1,442; sh: 285
file content (254 lines) | stat: -rwxr-xr-x 11,276 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
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
251
252
253
254
#!/usr/bin/make -f
# See debhelper(7) (uncomment to enable)
# output every command that modifies files on the build system.
#export DH_VERBOSE = 1

# see EXAMPLES in dpkg-buildflags(1) and read /usr/share/dpkg/*
DPKG_EXPORT_BUILDFLAGS = 1
include /usr/share/dpkg/default.mk

# see FEATURE AREAS in dpkg-buildflags(1)
#export DEB_BUILD_MAINT_OPTIONS = hardening=+all

# see ENVIRONMENT in dpkg-buildflags(1)
# package maintainers to append CFLAGS
#export DEB_CFLAGS_MAINT_APPEND  = -Wall -pedantic
# package maintainers to append LDFLAGS
#export DEB_LDFLAGS_MAINT_APPEND = -Wl,--as-needed

# Overriding this with "contrib" attempts to link with parmetis (unimplemented).
DEBIAN_DIST=main

DEB_SOURCE_PACKAGE := $(strip $(shell egrep '^Source: ' debian/control | cut -f 2 -d ':'))
DEB_VERSION := $(shell dpkg-parsechangelog -S Version)
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 -n -e 's/[\.\+]dfsg.*$$//p' )

export DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH)

SLEPC_REAL_ARCH=$(DEB_HOST_MULTIARCH)-real
SLEPC_COMPLEX_ARCH=$(DEB_HOST_MULTIARCH)-complex

# This defines the MPI implementation to use.  The easiest way to override this
# default is to specify while building, e.g. debian/rules SLEPC_MPI=lam binary.
# Again, only arch-dependent .debs are generated when you do this.
# Note that as of PETSc 2.3.0 this only specifies the name of the PETSc
# packages, the implementation is chosen by BuildSystem according to what's
# available at build time.
include /usr/share/mpi-default-dev/debian_defaults
SLEPC_MPI=$(ARCH_DEFAULT_MPI_IMPL)
SLEPC_MPI_DIR=/usr/lib/$(SLEPC_MPI)

# facilitate build-time testing (invoking OpenMPI) when building in a chroot (pbuilder or sbuild)
export OMPI_MCA_orte_rsh_agent=/bin/false

SLEPC_HDF5_FLAGS=$(shell if [ -e /usr/lib/libhdf5.so ]; then echo "--with-hdf5=1 --with-hdf5-dir=/usr"; fi)

# need correct build dir to perform tests, since SLEPc uses
# PETSC_ARCH rather SLEPC_ARCH in lib/slepc/conf/slepc_variables
# and at the same time the build dir is set in configure.py
# using python2's sys.platform to a specific string.
BUILDDIR_ARCH := $(shell python2 -c "import sys; print(sys.platform.replace('cygwin','mswin'))" )
SLEPC_REAL_BUILD_DIR=installed-arch-$(BUILDDIR_ARCH)-c-opt
SLEPC_COMPLEX_BUILD_DIR=installed-arch-$(BUILDDIR_ARCH)-c-opt-complex

# SLEPC_VERSION is used for the package names, library sonames, and
# /usr/lib/slepcdir subdirectory names.
export SLEPC_VERSION=$(DEB_STRIPPED_UPSTREAM_VERSION)$(SLEPC_EXT)
# use only major.minor as general soname (rather than major.minor.patch.build)
export SLEPC_SONAME_VERSION=$(shell echo $(SLEPC_VERSION) | awk 'BEGIN { FS="."}; {print $$1"."$$2 }')

# SLEPC_NAME is the install dir under /usr/lib and the base for package names
SLEPC_NAME=slepc$(SLEPC_SONAME_VERSION)
SLEPC_REAL_NAME=slepc-real$(SLEPC_SONAME_VERSION)
SLEPC_COMPLEX_NAME=slepc-complex$(SLEPC_SONAME_VERSION)

# debian binary package names
SLEPC_REAL_DEV_PACKAGE=lib$(SLEPC_REAL_NAME)-dev
SLEPC_REAL_PACKAGE=lib$(SLEPC_REAL_NAME)
SLEPC_COMPLEX_DEV_PACKAGE=lib$(SLEPC_COMPLEX_NAME)-dev
SLEPC_COMPLEX_PACKAGE=lib$(SLEPC_COMPLEX_NAME)
export SLEPC_DOC_PACKAGE=$(SLEPC_NAME)-doc
export SLEPC_DEV_EXAMPLE_PACKAGE=lib$(SLEPC_NAME)-dev-examples

# install into /usr/lib/slepcdir rather than /usr/lib/slepc 
# to allow /usr/lib/slepc to be configured by alternatives
export SLEPC_REAL_DIR_PREFIX=/usr/lib/slepcdir/$(SLEPC_NAME)/$(SLEPC_REAL_ARCH)
export SLEPC_COMPLEX_DIR_PREFIX=/usr/lib/slepcdir/$(SLEPC_NAME)/$(SLEPC_COMPLEX_ARCH)

export PACKAGE_REAL_INSTALL_DIR=debian/tmp/$(SLEPC_NAME)-real
PACKAGE_COMPLEX_INSTALL_DIR=debian/tmp/$(SLEPC_NAME)-complex

PETSC_SONAME_VERSION=$(SLEPC_SONAME_VERSION)
PETSC_DIR_BASE=/usr/lib/petscdir/petsc$(PETSC_SONAME_VERSION)
PETSC_DIR_REAL=$(PETSC_DIR_BASE)/$(SLEPC_REAL_ARCH)
PETSC_DIR_COMPLEX=$(PETSC_DIR_BASE)/$(SLEPC_COMPLEX_ARCH)

export SLEPC_DIR=$(CURDIR)

MPIEXEC_ALLOW_ROOT := mpiexec --oversubscribe --allow-run-as-root


# main packaging script based on dh7 syntax
%:
	dh $@ --with python2


override_dh_auto_clean:
	if [ -d $(SLEPC_REAL_BUILD_DIR) ]; then \
	dh_auto_clean -p$(SLEPC_REAL_DEV_PACKAGE) -p$(SLEPC_DOC_PACKAGE) -- \
	  SLEPC_DIR=$(CURDIR) PETSC_DIR=$(PETSC_DIR_REAL); \
	fi
	if [ -d $(SLEPC_COMPLEX_BUILD_DIR) ]; then \
	dh_auto_clean -p$(SLEPC_COMPLEX_DEV_PACKAGE) -- \
	  SLEPC_DIR=$(CURDIR) PETSC_DIR=$(PETSC_DIR_COMPLEX); \
	fi

override_dh_clean: override_dh_auto_clean
	dh_clean
	rm -rf installed-*
	rm -f lib/slepc/conf/slepcvariables
	find config -name *.pyc | xargs rm -f

# SLEPc differentiates different configurations (real, complex, etc)
# at build time from values in petscconf.h given by PETSC_DIR
override_dh_auto_configure:
	if PETSC_DIR=$(PETSC_DIR_REAL) \
          ./configure --prefix=$(SLEPC_REAL_DIR_PREFIX)  \
            --with-arpack=1 \
            --shared-library-extension=_real ; then \
	  : ; \
	else \
	  err=$$?; \
	  echo "real configure failed with exit value $$err"; \
	  echo "===== show real configure.log ====="; \
	  cat $(SLEPC_REAL_BUILD_DIR)/lib/slepc/conf/configure.log; \
	  echo "===== end real configure.log ====="; \
	  (exit $$err); \
	fi
	if PETSC_DIR=$(PETSC_DIR_COMPLEX) \
          ./configure --prefix=$(SLEPC_COMPLEX_DIR_PREFIX)  \
          --with-arpack=1 \
          --shared-library-extension=_complex ; then \
	  : ; \
	else \
	  err=$$?; \
	  echo "complex configure failed with exit value $$err"; \
	  echo "===== show complex configure.log ====="; \
	  cat $(SLEPC_COMPLEX_BUILD_DIR)/lib/slepc/conf/configure.log; \
	  echo "===== end complex configure.log ====="; \
	  (exit $$err); \
	fi

override_dh_auto_build:
	dh_auto_build -p$(SLEPC_REAL_DEV_PACKAGE) -p$(SLEPC_DOC_PACKAGE) -- V=1 \
	  SLEPC_DIR=$(CURDIR) \
	  PETSC_DIR=$(PETSC_DIR_REAL) PETSC_ARCH=$(SLEPC_REAL_BUILD_DIR)
	dh_auto_build -p$(SLEPC_COMPLEX_DEV_PACKAGE)  -- V=1 \
	  SLEPC_DIR=$(CURDIR) \
	  PETSC_DIR=$(PETSC_DIR_COMPLEX) PETSC_ARCH=$(SLEPC_COMPLEX_BUILD_DIR)


# ia64 consistently times out during tests, so skip
ARCH_NO_TEST_LIST = ia64

empty :=
space := $(empty)$(empty)

# run tests, or not
RUNTEST=yes
ifneq (,$(findstring $(space)$(DEB_HOST_ARCH)$(space), $(space)$(ARCH_NO_TEST_LIST)$(space)))
  RUNTEST=no
endif

override_dh_auto_test:
	set -e; \
	if [ "$(RUNTEST)" = "no" ]; then \
	   echo Tests have been disabled on $(DEB_HOST_ARCH); \
	else \
	   dh_auto_test -p$(SLEPC_REAL_DEV_PACKAGE) -- \
		SLEPC_DIR=$(CURDIR) \
	  	PETSC_DIR=$(PETSC_DIR_REAL) PETSC_ARCH=$(SLEPC_REAL_BUILD_DIR) \
	  	LD_LIBRARY_PATH=$(LD_LIBRARY_PATH):$(CURDIR)/$(SLEPC_REAL_BUILD_DIR)/lib \
	  	MPIEXEC="$(MPIEXEC_ALLOW_ROOT)"; \
	   dh_auto_test -p$(SLEPC_COMPLEX_DEV_PACKAGE) -- \
		SLEPC_DIR=$(CURDIR) \
		PETSC_DIR=$(PETSC_DIR_COMPLEX) PETSC_ARCH=$(SLEPC_COMPLEX_BUILD_DIR) \
	  	LD_LIBRARY_PATH=$(LD_LIBRARY_PATH):$(CURDIR)/$(SLEPC_COMPLEX_BUILD_DIR)/lib \
	  	MPIEXEC="$(MPIEXEC_ALLOW_ROOT)" ; \
	fi

override_dh_auto_install:
	dh_auto_install -p$(SLEPC_REAL_DEV_PACKAGE) -p$(SLEPC_DOC_PACKAGE) \
	  --destdir=$(PACKAGE_REAL_INSTALL_DIR) --  \
	  SLEPC_DIR=$(CURDIR) \
	  PETSC_DIR=$(PETSC_DIR_REAL) PETSC_ARCH=$(SLEPC_REAL_BUILD_DIR)
	dh_auto_install -p$(SLEPC_COMPLEX_DEV_PACKAGE) --destdir=$(PACKAGE_COMPLEX_INSTALL_DIR) --  \
	  SLEPC_DIR=$(CURDIR) \
	  PETSC_DIR=$(PETSC_DIR_COMPLEX) PETSC_ARCH=$(SLEPC_COMPLEX_BUILD_DIR)

override_dh_install:
	dh_install -p$(SLEPC_REAL_PACKAGE) --sourcedir $(PACKAGE_REAL_INSTALL_DIR) --exclude=*html  $(SLEPC_REAL_DIR_PREFIX)/lib/libslepc_real.so.$(SLEPC_VERSION)  usr/lib/$(DEB_HOST_MULTIARCH)
	dh_install -p$(SLEPC_REAL_DEV_PACKAGE) --sourcedir $(PACKAGE_REAL_INSTALL_DIR) --autodest --exclude=*html --exclude=libslepc_real.so.$(SLEPC_VERSION) --exclude=conf/uninstall.py --exclude=share/slepc/examples --exclude=share/slepc/datafiles  usr
	
	dh_install -p$(SLEPC_COMPLEX_PACKAGE) --sourcedir $(PACKAGE_COMPLEX_INSTALL_DIR) --exclude=*html  $(SLEPC_COMPLEX_DIR_PREFIX)/lib/libslepc_complex.so.$(SLEPC_VERSION)  usr/lib/$(DEB_HOST_MULTIARCH)
	dh_install -p$(SLEPC_COMPLEX_DEV_PACKAGE) --sourcedir $(PACKAGE_COMPLEX_INSTALL_DIR) --autodest --exclude=*html --exclude=libslepc_complex.so.$(SLEPC_VERSION) --exclude=conf/uninstall.py --exclude=share/slepc/examples --exclude=share/slepc/datafiles  usr
	
	dh_install -p$(SLEPC_DEV_EXAMPLE_PACKAGE)

override_dh_installdocs:
	dh_installdocs --exclude=makefile
	# html docs for header files in include have been installed,
	# but dh_installdocs cannot exclude the .h (-X.h bans the .html files)
	# so remove the excess .h files
        # test if header docs were installed (in a binary-only build they won't be)
	if [ -d ./debian/$(SLEPC_DOC_PACKAGE)/usr/share/doc/$(SLEPC_DOC_PACKAGE)/include ]; then  \
	  find debian/$(SLEPC_DOC_PACKAGE)/usr/share/doc/$(SLEPC_DOC_PACKAGE)/include -name *.h -o -name *.h90 | xargs -r rm; \
	# make header docs "generic" (pointing to headers in preferred alternative /usr/include/slepc)  \
	  for hdoc in `find ./debian/$(SLEPC_DOC_PACKAGE)/usr/share/doc/$(SLEPC_DOC_PACKAGE)/include/ -name "*.html"`; do  \
	    h=`echo $${hdoc} | xargs basename | sed "s/.html//"`; \
	    hdir=`echo $${hdoc} | xargs dirname | sed "s|^.*/include||"`; \
	    sed "s|href=\"$${h}\"|href=\"/usr/include/slepc$${hdir}/$${h}\"|" -i $${hdoc};  \
	  done  \
	fi
	for exampledoc in `find src -name *.html`; do \
	  dh_install -p$(SLEPC_DEV_EXAMPLE_PACKAGE) $$exampledoc usr/share/doc/$(SLEPC_DEV_EXAMPLE_PACKAGE)/examples/`dirname $$exampledoc`; \
	done

# dh_installchangelogs can't handle a directory of changelog files, so skip them here
override_dh_installchangelogs:
	dh_installchangelogs --exclude=docs/changes

override_dh_python2:
	dh_python2
	dh_python2 -p$(SLEPC_REAL_DEV_PACKAGE) $(SLEPC_REAL_DIR_PREFIX)/bin
	dh_python2 -p$(SLEPC_COMPLEX_DEV_PACKAGE) $(SLEPC_COMPLEX_DIR_PREFIX)/bin
	dh_python2 -p$(SLEPC_DEV_EXAMPLE_PACKAGE) /usr/share/doc/$(SLEPC_DEV_EXAMPLE_PACKAGE)

override_dh_installdeb:
	dh_installdeb
	for pkg in $$(dh_listpackages -a); do \
	  sed -i -e 's/__SLEPC_SONAME_VERSION__/$(SLEPC_SONAME_VERSION)/; s/__SLEPC_VERSION__/$(SLEPC_VERSION)/; s/__DEB_HOST_MULTIARCH__/$(DEB_HOST_MULTIARCH)/' debian/$$pkg/DEBIAN/*; \
	done

override_dh_strip:
	dh_strip -p$(SLEPC_REAL_PACKAGE)
	dh_strip -p$(SLEPC_COMPLEX_PACKAGE)

override_dh_fixperms-indep:
	dh_fixperms
	chmod a-x debian/$(SLEPC_DEV_EXAMPLE_PACKAGE)/usr/share/doc/$(SLEPC_DEV_EXAMPLE_PACKAGE)/examples/config/*

override_dh_gencontrol:
	# SLEPc.pc depends on specific patch version of PETSc (as defined in PETSc.pc)
	samplemod=debian/$(SLEPC_REAL_DEV_PACKAGE)/$(SLEPC_REAL_DIR_PREFIX)/include/slepcsys.mod; \
	samplemodheader=$$(zcat $${samplemod} | head -n 1); \
	fcompiler=$$(echo $${samplemodheader} | awk '{print $$1}' | tr '[:upper:]' '[:lower:]'); \
	modversion=$$(echo $${samplemodheader} | awk '{print $$4}' | sed "s/'//g"); \
	dh_gencontrol -- -Vpetsc:dev="libpetsc-real$(PETSC_SONAME_VERSION)-dev" -Vpetsc:complex-dev="libpetsc-complex$(PETSC_SONAME_VERSION)-dev" -Vfortran-mod-version=$${fcompiler}-mod-$${modversion}

USCAN_DESTDIR := $(CURDIR)

get-orig-source:
	uscan --no-conf --verbose --download-current-version --repack