File: rules

package info (click to toggle)
fckit 0.9.0-4
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, sid
  • size: 1,396 kB
  • sloc: f90: 6,093; python: 5,666; cpp: 1,786; sh: 597; pascal: 510; makefile: 66
file content (83 lines) | stat: -rwxr-xr-x 4,156 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
#!/usr/bin/make -f


# TODO:
#   - Flang version doesn't build. 

export DH_VERBOSE=1

AUTOGENERATED:= libfckit-dev.install

DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH)
GFORTRAN_VERSION:=$(shell basename $(shell readlink  /usr/bin/gfortran))
FLANG_VERSION:=$(shell basename $(shell readlink  /usr/bin/flang))

TMPDIR:=$(CURDIR)/debian/tmp
LIBDIR:=/usr/lib/$(DEB_HOST_MULTIARCH)
MODULEDIR:=$(LIBDIR)/fortran/$(GFORTRAN_VERSION)
# Test suite requires 4 processors. Fake it
export OMPI_MCA_rmaps_base_oversubscribe=1

PATCH_ON_32BIT_ARCH:= powerpc armel armhf i386 mipsel 
DO_PATCH:=     $(if $(filter $(DEB_TARGET_ARCH), $(PATCH_ON_32BIT_ARCH)), true, false)

BUILD_FLAGS = 

%:
	dh $@ --buildsystem=ecbuild

override_dh_auto_clean:
	dh_auto_clean
	rm -f $(patsubst %, debian/%, ${AUTOGENERATED})
	rm -rf debian/build-*

override_dh_auto_configure:
	for f in ${AUTOGENERATED} ; do \
		sed -e 's%@GFORTRAN_VERSION@%${GFORTRAN_VERSION}%g'   < debian/$$f.in  |  	\
		sed -e 's%@FLANG_VERSION@%${FLANG_VERSION}%g'   > debian/$$f ; \
                done
	$(DO_PATCH) && (patch -p1 < debian/patches/32-bit-mpi.patch ) || true
	dh_auto_configure --builddirectory=debian/build-gfortran -- \
			${BUILD_FLAGS} -DCMAKE_Fortran_COMPILER=/usr/bin/gfortran
	#dh_auto_configure --builddirectory=debian/build-flang -- \
#				${BUILD_FLAGS} -DCMAKE_Fortran_COMPILER=/usr/bin/flang

override_dh_auto_test:
	dh_auto_test --builddirectory=debian/build-gfortran
	@echo Skip flang tests for now

override_dh_auto_build:
	dh_auto_build --builddirectory=debian/build-gfortran
        # Fails to build with 201903 flang
	#dh_auto_build --builddirectory=debian/build-flang

override_dh_auto_install:
	dh_auto_install --builddirectory=debian/build-gfortran
	# dh_auto_build --builddirectory=debian/build-flang
	# Fixup cmake files. Hack. can we do better with patches to upstream ?
	sed -i -e 's%$${FCKIT_INSTALL_PREFIX}/libexec%/usr/bin%g'        	      $(TMPDIR)/$(LIBDIR)/cmake/fckit/fckit-import.cmake
	sed -i -e 's%${CURDIR}%/build/fckit/%g'     	        	      $(TMPDIR)/$(LIBDIR)/cmake/fckit/fckit-import.cmake
	sed -i -e 's%/usr/bin/python %/usr/bin/python3 %g'               	      $(TMPDIR)/$(LIBDIR)/cmake/fckit/fckit-import.cmake
	sed -i -e 's%fckit-fypp.py%fckit-fypp%' 		         	      $(TMPDIR)/$(LIBDIR)/cmake/fckit/fckit-import.cmake
	sed -i -e 's%fckit-eval.sh%fckit-eval%'                          	      $(TMPDIR)/$(LIBDIR)/cmake/fckit/fckit-import.cmake
	sed -i -e 's%fctest-generate-runner.py%fctest-generate-runner%'  	      $(TMPDIR)/$(LIBDIR)/cmake/fckit/fckit-import.cmake
	sed -i -e 's%/usr/lib/cmake%${LIBDIR}/cmake%g'  		 	      $(TMPDIR)/$(LIBDIR)/cmake/fckit/fckit-targets.cmake
	sed -i -e 's%$${_IMPORT_PREFIX}/lib/libfckit%${LIBDIR}/libfckit%g'            $(TMPDIR)/$(LIBDIR)/cmake/fckit/fckit-targets.cmake
	sed -i -e 's%$${_IMPORT_PREFIX}/include%/usr/include/${DEB_HOST_MULTIARCH}%g' $(TMPDIR)/$(LIBDIR)/cmake/fckit/fckit-targets.cmake
	sed -i -e 's%$${_IMPORT_PREFIX}/module%${MODULEDIR}%g' 			      $(TMPDIR)/$(LIBDIR)/cmake/fckit/fckit-targets.cmake
	# TODO: This will need work when flang is supported
	sed -i -e 's%libfckit.so.0d%libfckit-gfortran.so.0d%g'			      $(TMPDIR)/$(LIBDIR)/cmake/fckit/fckit-targets-release.cmake
	# rename those with script extensions
	mv $(TMPDIR)/usr/libexec/fckit-eval.sh $(TMPDIR)/usr/libexec/fckit-eval
	mv $(TMPDIR)/usr/libexec/fckit-fypp.py $(TMPDIR)/usr/libexec/fckit-fypp
	mv $(TMPDIR)/usr/libexec/fctest-generate-runner.py $(TMPDIR)/usr/libexec/fctest-generate-runner
	chmod -x $(TMPDIR)/$(LIBDIR)/cmake/fckit/*
	mv $(TMPDIR)/$(LIBDIR)/libfckit.so.0d $(TMPDIR)/$(LIBDIR)/libfckit-gfortran.so.0d
	rm $(TMPDIR)/$(LIBDIR)/libfckit.so 
	patchelf  --set-soname libfckit-gfortran.so.0d $(TMPDIR)/$(LIBDIR)/libfckit-gfortran.so.0d
	patchelf  --remove-rpath $(TMPDIR)/$(LIBDIR)/libfckit-gfortran.so.0d
	dh_link -p libfckit-dev $(LIBDIR)/libfckit-gfortran.so.0d $(LIBDIR)/fortran/$(GFORTRAN_VERSION)/libfckit.so
	dh_link -p libfckit-dev $(LIBDIR)/libfckit-gfortran.so.0d $(LIBDIR)/libfckit-gfortran.so

override_dh_dwz:
	@echo "Override dwz as it breaks on shlibs edited by patchelf"