File: rules

package info (click to toggle)
ppp 2.5.2-1%2B1.2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 5,484 kB
  • sloc: ansic: 40,715; sh: 5,356; perl: 458; makefile: 453
file content (142 lines) | stat: -rwxr-xr-x 4,689 bytes parent folder | download | duplicates (2)
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
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
#!/usr/bin/make -f
# -*- mode: makefile; coding: utf-8 -*-

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

# Activate full hardening build flags
export DEB_BUILD_MAINT_OPTIONS := hardening=+all

PKD := $(abspath $(dir $(MAKEFILE_LIST)))

include /usr/share/dpkg/default.mk

DIR_PPP := $(CURDIR)/debian/ppp
DIR_PPP_DEV := $(CURDIR)/debian/ppp-dev
DIR_PPP_UDEB := $(CURDIR)/debian/ppp-udeb

PPP_PLUGIN_ABI = $(shell awk -F ' *= *' '/^VERSION / { print $$2 }' \
	build-deb/Makefile)
VERSION_DEBIAN := $(shell echo '$(DEB_VERSION)' | \
	perl -ne 'print $$1 if m{^(?:\d+:)?(?:\d.*)\-(\d+.*)$$};')
VERSION_ABI_PART := $(shell echo "$(VERSION_DEBIAN)" | \
	perl -ne 'print $$1 if m{^(^\d+)\+};')

CONFFLAGS = \
  --prefix=/usr \
  --libdir=/usr/lib \
  --disable-static \
  --with-logfile-dir=/var/log \
  --with-runtime-dir=/run/ \
  # end

CONFFLAGS_deb  = $(CONFFLAGS) \
  $(shell dpkg-buildflags --export=configure || true) \
  --enable-cbcp \
  --enable-multilink \
  --enable-systemd \
  # end

CONFFLAGS_udeb = $(CONFFLAGS) \
  $(subst -O2,-O2 -Os -fomit-frame-pointer,$(shell dpkg-buildflags --export=configure || true)) \
  --without-pam \
  --without-pcap \
  --disable-eaptls \
  --disable-microsoft-extensions \
  --disable-openssl-engine \
  --disable-peap \
  # end

##############################################################################
%:
	dh $@ --builddir=build-deb

build-deb/config.status:
	dh_auto_configure -- $(CONFFLAGS_deb)

build-udeb/config.status:
	rm -f pppd/pppdconf.h
	dh_auto_configure --builddir=build-udeb -- $(CONFFLAGS_udeb)
	perl -i -pe 's/^#define (HAVE_CRYPT_H|HAVE_SHADOW_H) .*//' build-udeb/pppd/config.h
	perl -i -pe 's/^(CRYPT_LIBS =).*/$$1/' build-udeb/pppd/Makefile
	perl -i -pe 's/^(SUBDIRS =).*/$$1 pppoe pppoatm/; s/^(pppd_plugin_LTLIBRARIES =).*//' build-udeb/pppd/plugins/Makefile

override_dh_auto_configure: build-deb/config.status build-udeb/config.status
	@if [ "$(PPP_PLUGIN_ABI)" != "$(DEB_VERSION_UPSTREAM)" ]; then \
	  echo; echo "**********"; \
	  echo "VERSION in Makefile must match upstream version."; \
	  echo "Upstream version is '$(DEB_VERSION_UPSTREAM)'"; \
	  echo "VERSION is '$(PPP_PLUGIN_ABI)'"; \
	  echo "Aborting the build."; \
	  echo "**********"; echo; \
	  exit 1; \
	fi
	@if [ -z "$(VERSION_ABI_PART)" ]; then \
	  echo; echo "**********"; \
	  echo "No ABI component found in the Debian revision field:"; \
	  echo "$(VERSION_ABI_PART)"; \
	  echo "Please see debian/README.source for more information."; \
	  echo "Aborting the build."; \
	  echo "**********"; echo; \
	  exit 1; \
	fi

build-deb/changelog:
	{ \
	  sed -ne "/^What's new in / {p; :1; n; /^For a list of the changes made during /q; p; b1}" README ; \
	  echo ; \
	  cat Changes-2.4 ; \
	  cat Changes-2.3 ; \
	} > $@

override_dh_auto_build:
	dh_auto_build
	dh_auto_build --builddir=build-udeb

override_dh_auto_install:
	dh_auto_install --destdir=debian/tmp
	dh_auto_install --builddir=build-udeb --destdir=debian/tmp-udeb

execute_after_dh_auto_install-indep:
	$(PKD)/gen_substvars_dev $(DEB_VERSION_UPSTREAM) $(VERSION_ABI_PART) \
		> $(DIR_PPP_DEV)/usr/share/ppp-dev/substvars
	pod2man --section=1p --utf8 debian/extra/dh_ppp \
		$(DIR_PPP_DEV)/usr/share/man/man1/dh_ppp.1p

execute_after_dh_install-arch:
	rm -f $(DIR_PPP)/usr/lib/pppd/*/*.*a $(DIR_PPP_UDEB)/usr/lib/pppd/*/*.*a
	cd $(DIR_PPP)/usr/lib/pppd/*/ && ln -s pppoe.so rp-pppoe.so

override_dh_installchangelogs: build-deb/changelog
	dh_installchangelogs build-deb/changelog

execute_after_dh_installexamples-arch:
	rm $(DIR_PPP)/usr/share/doc/ppp/examples/scripts/Makefile*
	# use our own version, not the upstream one
	mv $(DIR_PPP)/usr/share/doc/ppp/examples/autopppd \
		$(DIR_PPP)/usr/share/doc/ppp/examples/scripts/

execute_after_dh_lintian:
	install -D -p -m644 debian/ppp-udeb.lintian-overrides \
		$(DIR_PPP_UDEB)/usr/share/lintian/overrides/ppp-udeb

override_dh_perl:
	dh_perl -d --package=ppp-dev

execute_after_dh_fixperms-arch:
	chown root:dip \
		$(DIR_PPP)/etc/chatscripts/ \
		$(DIR_PPP)/etc/ppp/ \
		$(DIR_PPP)/etc/ppp/peers/ \
		$(DIR_PPP)/usr/sbin/pppd
	chmod 4754 $(DIR_PPP)/usr/sbin/pppd
	chmod 2750 $(DIR_PPP)/etc/ppp/peers/ $(DIR_PPP)/etc/chatscripts/

# Force dpkg-gensymbols to inspect pppd (it doesn't end .so) so that the
# symbols file is generated. This needs the SONAME hack that gets applied in
# debian/patches/pppd-soname-hack.patch to work. The -c2 below makes sure that
# the build fails if there are any discrepancies in the symbols file in order
# to catch ABI changes.
override_dh_makeshlibs:
	dh_makeshlibs --no-scripts --package=ppp -Xusr/lib/pppd/ -- -c2 -edebian/ppp/usr/sbin/pppd -V
	dh_makeshlibs --no-package=ppp