File: rules

package info (click to toggle)
pyferret 7.6.5-10
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 138,136 kB
  • sloc: fortran: 240,609; ansic: 25,235; python: 24,026; sh: 1,618; makefile: 1,123; pascal: 569; csh: 307; awk: 18
file content (79 lines) | stat: -rwxr-xr-x 3,079 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
#!/usr/bin/make -f

# Uncomment this to turn on verbose mode.
export DH_VERBOSE=1

include /usr/share/debhelper/dh-fortran/fortran-support.mk

# magic debhelper rule
%:
	dh $@ 

# To aid reproducible builds
LC_ALL=C
export LC_ALL

ARCH:=$(shell dpkg-architecture -qDEB_HOST_MULTIARCH)
PYTHON_PLATFORM:=$(shell python3 -c 'import sysconfig; print(sysconfig.get_platform())')
LIBDIR:=/usr/lib/$(ARCH)
INSTALLDIR:=$(CURDIR)/debian/tmp

# FORT_VER:=$(shell basename $(shell readlink /usr/bin/$(FC_DEFAULT)))
FORT_VER:=gfortran-15

PY3:=$(shell py3versions -s)

override_dh_auto_build:
	cp debian/platform_specific.mk.debian.$(FORT_VER) platform_specific.mk.debian
	cp debian/ef_utility/platform_specific.mk.debian.$(FORT_VER) external_functions/ef_utility/platform_specific.mk.debian
	sed -e 's%@ARCH@%${ARCH}%' \
		-e 's%@PYTHON@%${PY3}%' \
                -e 's%@LIBDIR@%${LIBDIR}%' \
		-e 's%@CURDIR@%${CURDIR}%' \
                -e 's%@INSTALLDIR@%${INSTALLDIR}%' \
                < debian/site_specific.mk.in > site_specific.mk
	cp site_specific.mk external_functions/ef_utility

override_dh_auto_install:
	# Build and install 
	# Horrible hack breaks The Debian Way. I'm doing the build in the 'install' phase, as i'm installing into debian/tmp
	# Doing it any earlier, and dh_prep will remove debian/tmp. 
	# This means I'm also doing 'test' after the Install, not between during make & install. gack.
	for p in $(PY3) ; do \
		mkdir -p $(INSTALLDIR)/lib/$$p ; \
		m=`echo $$p | tr -d 'python'  ` ; \
		n=`echo $$p | tr -d 'python' | tr -d '.' ` ; \
                ln -s  $(CURDIR)/build/lib.$(PYTHON_PLATFORM)-cpython-$$n/pyferret/libpyferret.cpython-$$n-$(ARCH).so \
                   $(INSTALLDIR)/lib/$$p/libpyferret.so ; \
		$(MAKE) HOSTTYPE=debian PYTHON_EXE=$$p INSTALLDIR=debian/tmp-$$p clean all install ; \
		cp $(CURDIR)/install/local/lib/$$p/dist-packages/pyferret-7.65-py$$m-$(PYTHON_PLATFORM).egg/pyferret/libpyferret.cpython-$$n-$(ARCH).so \
			$(INSTALLDIR)/lib/$$p ; \
		done
	find debian \( -name '*.pyo' -o -name '*.pyc' \) -delete
	find debian -type d -name __pycache__ -delete
	dh_numpy3
	@echo "Now doing bench tests"
	# ln -s debian/pyferret3  $(INSTALLDIR)/lib/$(shell py3versions -d)/pyferret
	# First build necessary files
	for p in  $(shell py3versions -d) ; do \
		sed -e 's%@ARCH@%${ARCH}%' \
                -e 's%@LIBDIR@%${LIBDIR}%' \
		-e 's%@CURDIR@%${CURDIR}%' \
                -e "s%@PYTHON@%$$p%" \
		-e 's%@INSTALLDIR@%${INSTALLDIR}%' \
                < debian/site_specific.mk.in > site_specific.mk ; \
		PATH=$(INSTALLDIR)/lib/$$p:$(PATH) PYTHONPATH=$(INSTALLDIR)/lib/$$p/site-packages \
		$(MAKE) HOSTTYPE=debian PYTHON_EXE=$$p INSTALLDIR=debian/tmp-$$p clean all install ; \
		done

override_dh_auto_test:
	@echo "Dummy test, to avoid calling make. Do test later"

override_dh_auto_clean:
	# use system xpm.h, not supplied ones
	rm -f fer/gui/xpm*.h
	rm -rf ./build ./install
	find . -type l  -delete 
	find . -name '*.o' -o -name '*.so'  -delete
	[ ! -f platform_specific_flags.mk.debian ]  || $(MAKE)  clean HOSTTYPE=debian