File: rules

package info (click to toggle)
phcpack 2.4.90%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 142,196 kB
  • sloc: ada: 945,280; cpp: 214,980; ansic: 59,304; python: 51,902; makefile: 3,660; lisp: 444; javascript: 352
file content (103 lines) | stat: -rwxr-xr-x 3,083 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
#!/usr/bin/make -f

command = $(shell /bin/sh -c "command -v $(1)")

ifneq (,$(call command, pybuild))
DH_OPTIONS += --buildsystem=pybuild
PYBUILD_BUILD_DIRS := $(shell pybuild --system distutils --print {build_dir})
endif

%:
	dh $@ $(DH_OPTIONS)

# With gcc-11 -fstack-protector-strong:
# gnatbind -n -static use_c2phc -o use_c2phc_binder.adb
# raised STORAGE_ERROR : stack overflow or erroneous memory access
DEB_BUILD_MAINT_OPTIONS = hardening=+all,-stackprotectorstrong optimize=-lto

# drop back to C++14 (https://github.com/janverschelde/PHCpack/issues/55)
DEB_CXXFLAGS_MAINT_APPEND = -std=gnu++14

DPKG_EXPORT_BUILDFLAGS = 1
include /usr/share/dpkg/buildflags.mk
# This line has no effect during architecture-independent builds:
include $(wildcard /usr/share/ada/packaging.mk)

export PYBUILD_DIR = src/Python/PHCpy

override_dh_auto_build-arch:
	@echo "+------------------+"
	@echo "| building PHCpack |"
	@echo "+------------------+"
	gprbuild $(GPRBUILDFLAGS) src/Ada/Main/main.gpr
	$(MAKE) -C src/doc man
ifeq (,$(filter nopython, $(DEB_BUILD_PROFILES)))
	@echo "+----------------+"
	@echo "| building PHCpy |"
	@echo "+----------------+"
	mv src/bin/phc src/bin/phc.bak
	cd src/Ada/Main && gprclean main.gpr # so we can recompile with -fPIC
	mv src/bin/phc.bak src/bin/phc
	gprbuild $(GPRBUILDFLAGS) src/Ada/Main/phclib.gpr
	pybuild --build
	cp src/lib/libPHCpack.so $(PYBUILD_DIR) # for building docs
	for dir in $(PYBUILD_BUILD_DIRS);        \
		do cp src/lib/libPHCpack.so $$dir; \
	done
ifeq (,$(filter nodoc, $(DEB_BUILD_PROFILES)))
	@echo "+---------------------+"
	@echo "| building PHCpy docs |"
	@echo "+---------------------+"
	$(MAKE) -C src/Python/PHCpy/doc html
endif
endif

ifeq (,$(filter nodoc, $(DEB_BUILD_PROFILES)))
override_dh_auto_build-indep:
	@echo "+-----------------------+"
	@echo "| building PHCpack docs |"
	@echo "+-----------------------+"
	$(MAKE) -C src/doc html
endif

# skip upstream test suite for now
# https://github.com/janverschelde/PHCpack/issues/41
# override_dh_auto_test:
#	$(MAKE) -C src/Objects testall

execute_before_dh_octave_version: DESCRIPTION

execute_after_dh_auto_install-indep: DESCRIPTION
	@echo "+-----------------+"
	@echo "| building PHClab |"
	@echo "+-----------------+"

	cp --update --reflink=auto src/Octave/COPYING.txt COPYING

	mkdir --parents inst
	cp --update --reflink=auto src/Octave/*.m debian/PKG_ADD inst

	dh_auto_install --buildsystem=octave

include /usr/share/dpkg/pkg-info.mk
DESCRIPTION: debian/DESCRIPTION.in
	sed -e "s/@VERSION@/$(DEB_VERSION_UPSTREAM)/" \
	    -e "s/@DATE@/$(shell date -u -I -d@$(SOURCE_DATE_EPOCH))/" $< > $@

override_dh_dwz:
# avoid the following:
# dwz: ./dwz.c:12035: adjust_exprloc: Assertion `refd != NULL &&
#   !refd->die_remove' failed.

override_dh_octave_substvar:
	dh_octave_substvar -poctave-phclab

override_dh_clean:
	dh_clean -Xbak

execute_after_dh_auto_clean:
	gprclean src/Ada/Main/main.gpr || true
	gprclean src/Ada/Main/phclib.gpr || true
	$(MAKE) -C src/Python/PHCpy/doc clean
	$(MAKE) -C src/doc clean
	dh_auto_clean --buildsystem=octave || true