File: rules

package info (click to toggle)
gnucap 1%3A20230520-dev-1
  • links: PTS, VCS
  • area: main
  • in suites: experimental
  • size: 9,836 kB
  • sloc: cpp: 29,956; sh: 352; makefile: 139
file content (99 lines) | stat: -rwxr-xr-x 2,902 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
#!/usr/bin/make -f

export DEB_BUILD_MAINT_OPTIONS = hardening=+all optimize=+lto

include /usr/share/dpkg/pkg-info.mk

#export DH_VERBOSE=1
upstream_commit = $(shell v="$(DEB_VERSION_UPSTREAM)"; echo $${v\#\#*~})

# take from control? (how?)
SOVERSION = 0
SONAME = libgnucap.so.${SOVERSION}

UPSTREAM_REPO=git://git.savannah.gnu.org/gnucap.git
ORIG_TARBALL=../gnucap_${DEB_VERSION_UPSTREAM}.orig.tar.gz

DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH)

CFLAGS := $(shell dpkg-buildflags --get CFLAGS)
CPPFLAGS := $(shell dpkg-buildflags --get CPPFLAGS)
CXXFLAGS := $(shell dpkg-buildflags --get CXXFLAGS)
LDFLAGS := $(shell dpkg-buildflags --get LDFLAGS)

LN_S = ln -sf

WHICH_CXX = $(shell realpath `which g++`)
WHICH_CXX_PACKAGE = $(shell dpkg -S $(WHICH_CXX) | cut -f1 -d:)

libdir = /usr/lib/$(DEB_HOST_MULTIARCH)
pkglibdir = ${libdir}/gnucap${SOVERSION}

info:
	@echo ${LDFLAGS}
	@echo ${DEB_VERSION_UPSTREAM}
	@echo ${upstream_commit}
	@echo ${WHICH_CXX}
	@echo ${WHICH_CXX_PACKAGE}

%:
	dh $@

override_dh_auto_configure:
	dh_auto_configure -- --prefix=/usr --sysconfdir=/etc CXX=${WHICH_CXX}
	sed -e '/GNUCAP_PLUGPATH/s#gnucap"$$#gnucap'${SOVERSION}'"#' -i main/config.h

	sed -e '/^pkglibdir/s#=.*#='${pkglibdir}'#' -i main/gnucap.conf
	sed -e '/^pkglibdir/s#gnucap$$#gnucap'${SOVERSION}'#' -i apps/Makefile
	sed -e '/^plugindir/s#gnucap$$#gnucap'${SOVERSION}'#' -i apps/Makefile

	sed -i '/SYSTEMSTARTPATH/s/OS::getenv("PATH")/"\/etc"/' main/config.h

override_dh_gencontrol:
	# might become a hard dependency...
	echo misc:Recommends=${WHICH_CXX_PACKAGE} > debian/gnucap-common.substvars
	dh_gencontrol

override_dh_auto_clean:
	dh_auto_clean
	rm -f autotools
	# rm -f aclocal.m4 ar-lib compile config.guess config.sub depcomp install-sh missing
	rm -rf configure.ac
	rm -rf configure.gnu
	# rm -rf configure

# override_dh_installdocs:
# 	dh_installdocs
# 	# Remove LaTeX sources from HTML documentation:
# 	##rm debian/gnucap/usr/share/doc/gnucap/html/*.hi??
# 	# Remove un-necessary docs installed by upstream:
# 	#rm debian/gnucap/usr/share/doc/gnucap/COPYING
# 	#rm debian/gnucap/usr/share/doc/gnucap/INSTALL
# 	#rm debian/gnucap/usr/share/doc/gnucap/history

override_dh_compress:
	dh_compress -X.pdf -X.ckt

override_dh_autoreconf:
	-ln -s debian/autotools

	# stray rules in Make1. disable them
	sed -e '/^%/s/model$$/model_/' -i apps/Make1

	autotools/bootstrap

	# required for dh_auto_configure
	mv configure.gnu configure

# create tarball equivalent to upstream. use
# tar -xOzf ../gnucap-20171003.tar.gz | sort | sha1sum
# to check.
get-orig-source:
	@echo creating tarball from ${upstream_commit}
	[ -d .git ] && git archive ${upstream_commit} | \
	               gzip > $(ORIG_TARBALL) || :
	[ -d .git ] || git archive --format=tar \
		--remote=$(UPSTREAM_REPO) ${upstream_commit}  | \
	             tar -xzf > $(ORIG_TARBALL)

.PHONY: get-orig-source