File: rules

package info (click to toggle)
python-escript 5.0-3
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 87,772 kB
  • ctags: 49,550
  • sloc: python: 585,488; cpp: 133,173; ansic: 18,675; xml: 3,283; sh: 690; makefile: 215
file content (126 lines) | stat: -rwxr-xr-x 5,766 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
#!/usr/bin/make -f

PROJROOT=$(CURDIR)
BDEST=$(CURDIR)/debian/python-escript
BMDEST=$(CURDIR)/debian/python-escript-mpi
B3DEST=$(CURDIR)/debian/python3-escript
B3MDEST=$(CURDIR)/debian/python3-escript-mpi
DDEST=$(CURDIR)/debian/python-escript-doc
BUILD=$(CURDIR)/debian/tmp2
BUILDM=$(CURDIR)/debian/tmp2M
BUILD3=$(CURDIR)/debian/tmp3
BUILD3M=$(CURDIR)/debian/tmp3M
WORK=$(CURDIR)/debian/stage2
WORKM=$(CURDIR)/debian/stage2M
WORK3=$(CURDIR)/debian/stage3
WORK3M=$(CURDIR)/debian/stage3M

#thanks to the debian manual
# export DEB_BUILD_OPTIONS="parallel=10"
ifneq (,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
    parbuild=$(patsubst parallel=%,%,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
    sflags=-j$(parbuild)
else
    sflags=-j1
endif

%:
	dh $@  --with python2,python3,sphinxdoc -v

override_dh_clean:
	rm -rf build condif.log esys include lib release .sconf_tmp .sconsign.dblite config.log .sconf_temp
	rm -rf scons/templates/*.pyc
	rm -rf $(BDEST)
	rm -rf $(B3DEST)
	rm -rf $(BMDEST)
	rm -rf $(B3MDEST)
	rm -rf $(DDEST)
	rm -rf $(BUILD)
	rm -rf $(BUILDM)
	rm -rf $(BUILD3)
	rm -rf $(BUILD3M)
	rm -rf $(WORK)
	rm -rf $(WORKM)
	rm -rf $(WORK3)
	rm -rf $(WORK3M)
	rm -rf $(CURDIR)/debian/tmp/*
	rm -f debian/files
	rm -f debian/substvars
	dh_clean

override_dh_installchangelogs:
	dh_installchangelogs debian/changelog.trivial

override_dh_auto_build:
	#Build steps for py2
	mkdir -p $(WORK)
	if [ ! -f svn_version ];then echo "No svn_version file found"; exit 3;fi
	scons $(sflags) SVN_VERSION=`cat svn_version` build_dir=$(BUILD) verbose=on prefix=$(WORK) options_file=scons/templates/sid_options.py
	# extract the relevant .py files
	cd $(WORK); $(PROJROOT)/debian/utils/cppy.py $(PROJROOT); cd $(PROJROOT)
	cp $(PROJROOT)/doc/manpage/man1/run-escript.1 $(WORK)/run-escript2.man
	mv $(WORK)/bin/run-escript $(WORK)/bin/run-escript2
	find $(WORK) -name '*.pyc' -print0 | xargs -0 rm -f
	
	# build_steps for documentation 
	# depends on the py2 build so don't do anything here
	# which will overwrite changes made in the py2 build
	mkdir -p $(BUILD)
	scons $(sflags) SVN_VERSION=`cat svn_version` build_dir=$(BUILD) verbose=on prefix=$(WORK) options_file=scons/templates/sid_options.py docs
	find $(WORK) -name '*.pyc' -print0 | xargs -0 rm -f
	
	# Build steps for py2 with MPI	
	mkdir -p $(WORKM)
	if [ ! -f svn_version ];then echo "No svn_version file found"; exit 3;fi
	scons $(sflags) SVN_VERSION=`cat svn_version` build_dir=$(BUILDM)  cc_optim='-O3 -DOVERLORDPATH=\"/usr/lib/python-escript-mpi/\"' verbose=on prefix=$(WORKM) options_file=scons/templates/sid_mpi_options.py
	# extract the relevant .py files
	cd $(WORKM); $(PROJROOT)/debian/utils/cppy.py $(PROJROOT); cd $(PROJROOT)
	cp $(PROJROOT)/doc/manpage/man1/run-escript.1 $(WORKM)/run-escript2-mpi.man
	ln $(WORKM)/bin/run-escript $(WORKM)/bin/run-escript2-mpi
	find $(WORKM) -name '*.pyc' -print0| xargs -0 rm -f
	#rm -rf $(BUILDM)

	# Build steps for py3
	mkdir -p $(WORK3)
	if [ ! -f svn_version ];then echo "No svn_version file found"; exit 3;fi
	scons $(sflags) SVN_VERSION=`cat svn_version` build_dir=$(BUILD3) verbose=on prefix=$(WORK3) options_file=scons/templates/sid_py3_options.py
	# extract the relevant .py files
	cd $(WORK3); $(PROJROOT)/debian/utils/cppy.py $(PROJROOT); cd $(PROJROOT)
	cp $(PROJROOT)/doc/manpage/man1/run-escript.1 $(WORK3)/run-escript3.man
	ln $(WORK3)/bin/run-escript $(WORK3)/bin/run-escript3
	find $(WORK3) -name '*.pyc' -print0| xargs -0 rm -f
	#rm -rf $(BUILD3)

	# Build steps for py3 with MPI
	mkdir -p $(WORK3M)
	if [ ! -f svn_version ];then echo "No svn_version file found"; exit 3;fi
	scons $(sflags) SVN_VERSION=`cat svn_version` build_dir=$(BUILD3M)  cc_optim='-O3 -DOVERLORDPATH=\"/usr/lib/python-escript3-mpi/\"' verbose=on prefix=$(WORK3M) options_file=scons/templates/sid_py3_mpi_options.py
	# extract the relevant .py files
	cd $(WORK3M); $(PROJROOT)/debian/utils/cppy.py $(PROJROOT); cd $(PROJROOT)
	cp $(PROJROOT)/doc/manpage/man1/run-escript.1 $(WORK3M)/run-escript3-mpi.man
	ln $(WORK3M)/bin/run-escript $(WORK3M)/bin/run-escript3-mpi
	find $(WORK3M) -name '*.pyc' -print0| xargs -0 rm -f	
	#rm -rf $(BUILD3M)
	
	# fix paths in each package and
	# fix some external links in the doc package
	debian/utils/tweak.sh "$(WORK)" "$(WORKM)" "$(WORK3)" "$(WORK3M)"
	rm -f scons/templates/*.pyc
	rm -f site_scons/*.pyc
	rm -f utest.sh

override_dh_shlibdeps:
	# so libraries we just built are checked as well
	dh_shlibdeps -ppython-escript -Npython3-escript -Npython-escript-mpi -Npython3-escript-mpi -Npython-escript-doc -P$(BDEST) -l$(BDEST)/usr/lib/python-escript/lib
	dh_shlibdeps -ppython-escript-mpi -Npython3-escript -Npython-escript -Npython3-escript-mpi -Npython-escript-doc -P$(BMDEST) -l$(BMDEST)/usr/lib/python-escript-mpi/lib
	dh_shlibdeps -ppython3-escript -Npython-escript -Npython-escript-mpi -Npython3-escript-mpi -Npython-escript-doc -P$(B3DEST) -l$(B3DEST)/usr/lib/python3-escript/lib
	dh_shlibdeps -ppython3-escript-mpi -Npython3-escript -Npython-escript -Npython-escript-mpi -Npython-escript-doc -P$(B3MDEST) -l$(B3MDEST)/usr/lib/python3-escript-mpi/lib

override_dh_python2:
	dh_python2 -ppython-escript -Npython3-escript -Npython-escript-mpi -Npython3-escript-mpi -Npython-escript-doc --no-ext-rename usr/lib/python-escript/esys
	dh_python2 -ppython-escript-mpi -Npython3-escript -Npython-escript -Npython3-escript-mpi -Npython-escript-doc --no-ext-rename	usr/lib/python-escript-mpi/esys
	
override_dh_python3:
	dh_python3 -ppython3-escript -Npython-escript -Npython-escript-mpi -Npython3-escript-mpi -Npython-escript-doc --no-ext-rename	usr/lib/python3-escript/esys
	dh_python3 -ppython3-escript-mpi -Npython3-escript -Npython-escript -Npython-escript-mpi -Npython-escript-doc --no-ext-rename	usr/lib/python3-escript-mpi/esys