File: rules

package info (click to toggle)
slepc 3.7.3%2Bdfsg1-5
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 23,788 kB
  • ctags: 100,221
  • sloc: ansic: 79,324; makefile: 3,897; python: 2,734; fortran: 1,139; f90: 225; sh: 100
file content (214 lines) | stat: -rwxr-xr-x 10,261 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
#!/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_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH)

# On Alpha, override this with debian/rules SLEPC_ARCH=linux_alpha_dec binary
# to build PETSc libs with the Compaq compilers, though that requires at least:
# libots, cpml-ev(5|6), cxml-ev(5|6), cfal and ccc.
# Note that only arch-dependent .debs are generated when you do this.
PETSC_ARCH=$(DEB_HOST_MULTIARCH)
SLEPC_ARCH=$(PETSC_ARCH)

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

SLEPC_BUILD_DIR=$(SLEPC_ARCH)-real
SLEPC_COMPLEX_BUILD_DIR=$(SLEPC_ARCH)-complex

# SLEPC_VERSION is used for the package names, library sonames, and
# /usr/lib/slepcdir subdirectory names.
SLEPC_VERSION=3.7.3$(SLEPC_EXT)
# use only major.minor as general soname (rather than major.minor.patch.build)
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_SONAME=slepc$(SLEPC_SONAME_VERSION)
SLEPC_NAME=slepc$(SLEPC_VERSION)
SLEPC_COMPLEX_SONAME=slepc-complex-$(SLEPC_SONAME_VERSION)
SLEPC_COMPLEX_NAME=slepc-complex-$(SLEPC_VERSION)

# debian binary package names
SLEPC_DEV_PACKAGE=$(SLEPC_NAME)-dev
SLEPC_VERSIONED_DEV_PACKAGE=lib$(SLEPC_NAME)-dev
SLEPC_VERSIONED_PACKAGE=lib$(SLEPC_NAME)
SLEPC_DOC_PACKAGE=$(SLEPC_NAME)-doc
SLEPC_COMPLEX_VERSIONED_DEV_PACKAGE=lib$(SLEPC_COMPLEX_NAME)-dev
SLEPC_COMPLEX_VERSIONED_PACKAGE=lib$(SLEPC_COMPLEX_NAME)

# install into /usr/lib/slepcdir rather than /usr/lib/slepc 
# to allow /usr/lib/slepc to be configured by alternatives
SLEPC_DIR_PREFIX=/usr/lib/slepcdir/$(SLEPC_VERSION)/$(SLEPC_ARCH)-real
SLEPC_COMPLEX_DIR_PREFIX=/usr/lib/slepcdir/$(SLEPC_VERSION)/$(SLEPC_ARCH)-complex

PACKAGE_INSTALL_BASEDIR=debian/tmp/$(SLEPC_NAME)-real
PACKAGE_INSTALL_DIR=$(PACKAGE_INSTALL_BASEDIR)/$(SLEPC_DIR_PREFIX)
PACKAGE_COMPLEX_INSTALL_BASEDIR=debian/tmp/$(SLEPC_NAME)-complex
PACKAGE_COMPLEX_INSTALL_DIR=$(PACKAGE_COMPLEX_INSTALL_BASEDIR)/$(SLEPC_COMPLEX_DIR_PREFIX)

PETSC_SONAME_VERSION=$(SLEPC_SONAME_VERSION)
PETSC_DIR=/usr/lib/petscdir/$(PETSC_SONAME_VERSION)
PETSC_DIR_REAL=$(PETSC_DIR)-real
PETSC_DIR_COMPLEX=$(PETSC_DIR)-complex
PETSC_VERSION=$(shell pkg-config --modversion PETSc)

export SLEPC_DIR=$(CURDIR)

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


override_dh_auto_clean:
	if [ -d $(SLEPC_BUILD_DIR) ]; then \
	dh_auto_clean -p$(SLEPC_VERSIONED_DEV_PACKAGE) -p$(SLEPC_DOC_PACKAGE) -- \
	  SLEPC_DIR=$(CURDIR) SLEPC_ARCH=$(SLEPC_BUILD_DIR); \
	fi
	if [ -d $(SLEPC_COMPLEX_BUILD_DIR) ]; then \
	dh_auto_clean -p$(SLEPC_COMPLEX_VERSIONED_DEV_PACKAGE) -- \
	  SLEPC_DIR=$(CURDIR) SLEPC_ARCH=$(SLEPC_COMPLEX_BUILD_DIR); \
	fi


#SLEPc cannot differentiate different configrations at build time 
# i.e. there is no SLEPC_ARCH, unlike PETSC_ARCH.
# So have to configure and build in one step
# Note SLEPc's ./configure refuses to allow additional (unknown) options
# so can't use dh_auto_configure
override_dh_auto_configure:

override_dh_auto_build:


override_dh_auto_test:
#	dh_auto_test -p$(SLEPC_DEBUG_PACKAGE) -- \
#	  SLEPC_DIR=$(CURDIR) PETSC_ARCH=$(SLEPC_DEBUG_BUILD_DIR) \
#	  LD_LIBRARY_PATH=$(LD_LIBRARY_PATH):$(CURDIR)/$(SLEPC_DEBUG_BUILD_DIR)/lib
#	dh_auto_test -p$(SLEPC_VERSIONED_DEV_PACKAGE) -- \
#	  SLEPC_DIR=$(CURDIR) PETSC_ARCH=$(SLEPC_BUILD_DIR) \
#	  LD_LIBRARY_PATH=$(LD_LIBRARY_PATH):$(CURDIR)/$(SLEPC_BUILD_DIR)/lib
#	dh_auto_test -p$(SLEPC_COMPLEX_VERSIONED_DEV_PACKAGE) -- \
#	  SLEPC_DIR=$(CURDIR) PETSC_ARCH=$(SLEPC_COMPLEX_BUILD_DIR) \
#	  LD_LIBRARY_PATH=$(LD_LIBRARY_PATH):$(CURDIR)/$(SLEPC_COMPLEX_BUILD_DIR)/lib
#	dh_auto_test -p$(SLEPC_COMPLEX_DEBUG_PACKAGE) -- \
#	  SLEPC_DIR=$(CURDIR) PETSC_ARCH=$(SLEPC_COMPLEX_DEBUG_BUILD_DIR) \
#	  LD_LIBRARY_PATH=$(LD_LIBRARY_PATH):$(CURDIR)/$(SLEPC_COMPLEX_DEBUG_BUILD_DIR)/lib


override_dh_auto_install:
	PETSC_DIR=$(PETSC_DIR_REAL) \
          ./configure --prefix=$(SLEPC_DIR_PREFIX)  \
            --with-arpack=1 \
            --shared-library-extension=_real
	dh_auto_build -p$(SLEPC_VERSIONED_DEV_PACKAGE) -p$(SLEPC_DOC_PACKAGE) -- \
            PETSC_DIR=$(PETSC_DIR_REAL)
	dh_auto_install -p$(SLEPC_VERSIONED_DEV_PACKAGE) -p$(SLEPC_DOC_PACKAGE) \
	  --destdir=$(PACKAGE_INSTALL_DIR) --  \
          SLEPC_INSTALLDIR=$(SLEPC_DIR_PREFIX) \
          SLEPC_DESTDIR=$(PACKAGE_INSTALL_DIR) \
          PETSC_DIR=$(PETSC_DIR_REAL)
	echo PACKAGE_INSTALL_DIR=$(PACKAGE_INSTALL_DIR)
	echo SLEPC_DIR_PREFIX=$(SLEPC_DIR_PREFIX)
#	make SLEPC_DIR=$(CURDIR)/$(PACKAGE_INSTALL_DIR) PETSC_DIR=$(PETSC_DIR_REAL) PETSC_ARCH="" LD_LIBRARY_PATH=$(LD_LIBRARY_PATH):$(CURDIR)/$(PACKAGE_INSTALL_DIR)/lib test
	
	PETSC_DIR=$(PETSC_DIR_COMPLEX) \
          ./configure --prefix=$(SLEPC_COMPLEX_DIR_PREFIX)  \
          --with-arpack=1 \
          --shared-library-extension=_complex
	dh_auto_build -p$(SLEPC_COMPLEX_VERSIONED_DEV_PACKAGE)  --  \
          PETSC_DIR=$(PETSC_DIR_COMPLEX)
	dh_auto_install -p$(SLEPC_COMPLEX_VERSIONED_DEV_PACKAGE) --destdir=$(PACKAGE_COMPLEX_INSTALL_DIR) --  \
          SLEPC_INSTALLDIR=$(SLEPC_COMPLEX_DIR_PREFIX) \
          SLEPC_DESTDIR=$(PACKAGE_COMPLEX_INSTALL_DIR) \
          PETSC_DIR=$(PETSC_DIR_COMPLEX)
	echo Note: standard SLEPc built-time tests only cover real number configurations, not complex numbers.


override_dh_install:
	dh_install -p$(SLEPC_VERSIONED_PACKAGE) --sourcedir $(PACKAGE_INSTALL_BASEDIR) --exclude=*html  $(SLEPC_DIR_PREFIX)/lib/libslepc_real.so.$(SLEPC_VERSION)  usr/lib/$(DEB_HOST_MULTIARCH)
	dh_install -p$(SLEPC_VERSIONED_DEV_PACKAGE) --sourcedir $(PACKAGE_INSTALL_BASEDIR) --autodest --exclude=*html --exclude=libslepc_real.so.$(SLEPC_VERSION)  usr
	dh_link -p$(SLEPC_VERSIONED_DEV_PACKAGE)  usr/lib/$(DEB_HOST_MULTIARCH)/libslepc_real.so.$(SLEPC_VERSION)  $(SLEPC_DIR_PREFIX)/lib/libslepc_real.so.$(SLEPC_VERSION)
	
	dh_install -p$(SLEPC_COMPLEX_VERSIONED_PACKAGE) --sourcedir $(PACKAGE_COMPLEX_INSTALL_BASEDIR) --exclude=*html  $(SLEPC_COMPLEX_DIR_PREFIX)/lib/libslepc_complex.so.$(SLEPC_VERSION)  usr/lib/$(DEB_HOST_MULTIARCH)
	dh_install -p$(SLEPC_COMPLEX_VERSIONED_DEV_PACKAGE) --sourcedir $(PACKAGE_COMPLEX_INSTALL_BASEDIR) --autodest --exclude=*html --exclude=libslepc_complex.so.$(SLEPC_VERSION)  usr
	dh_link -p$(SLEPC_COMPLEX_VERSIONED_DEV_PACKAGE)  usr/lib/$(DEB_HOST_MULTIARCH)/libslepc_complex.so.$(SLEPC_VERSION)  $(SLEPC_COMPLEX_DIR_PREFIX)/lib/libslepc_complex.so.$(SLEPC_VERSION)

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 examples in $$( find src -name *example* ); do \
	  dh_install -p$(SLEPC_DOC_PACKAGE) $$examples/* usr/share/doc/$(SLEPC_DOC_PACKAGE)/examples/$$(echo $$examples | sed "s/src\///; s/examples//" ); \
	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_VERSIONED_DEV_PACKAGE) $(SLEPC_DIR_PREFIX)/bin
	dh_python2 -p$(SLEPC_COMPLEX_VERSIONED_DEV_PACKAGE) $(SLEPC_COMPLEX_DIR_PREFIX)/bin

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_VERSIONED_PACKAGE)
	dh_strip -p$(SLEPC_COMPLEX_VERSIONED_PACKAGE)

override_dh_gencontrol:
	# SLEPc.pc depends on specific patch version of PETSc (as defined in PETSc.pc)
	dh_gencontrol -- -Vpetsc:dev="libpetsc$(PETSC_VERSION)-dev" -Vpetsc:complex-dev="libpetsc-complex-$(PETSC_VERSION)-dev"

DEB_SOURCE_PACKAGE = slepc
DEB_UPSTREAM_VERSION = $(shell dpkg-parsechangelog | sed -ne 's/^Version: \(.*\)-.*/\1/p')
DEB_STRIPPED_UPSTREAM_VERSION = $(shell echo $(DEB_UPSTREAM_VERSION) | sed -n -e 's/\.dfsg.*$$//p')
USCAN_DESTDIR := $(CURDIR)

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