| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
export DEB_BUILD_MAINT_OPTIONS := hardening=+all |
| 9 |
|
| 10 |
PKD := $(abspath $(dir $(MAKEFILE_LIST))) |
| 11 |
|
| 12 |
include /usr/share/dpkg/default.mk |
| 13 |
|
| 14 |
DIR_PPP := $(CURDIR)/debian/ppp |
| 15 |
DIR_PPP_DEV := $(CURDIR)/debian/ppp-dev |
| 16 |
DIR_PPP_UDEB := $(CURDIR)/debian/ppp-udeb |
| 17 |
|
| 18 |
PPP_PLUGIN_ABI = $(shell awk -F ' *= *' '/^VERSION / { print $$2 }' \ |
| 19 |
build-deb/Makefile) |
| 20 |
VERSION_DEBIAN := $(shell echo '$(DEB_VERSION)' | \ |
| 21 |
perl -ne 'print $$1 if m{^(?:\d+:)?(?:\d.*)\-(\d+.*)$$};') |
| 22 |
VERSION_ABI_PART := $(shell echo "$(VERSION_DEBIAN)" | \ |
| 23 |
perl -ne 'print $$1 if m{^(^\d+)\+};') |
| 24 |
|
| 25 |
CONFFLAGS = \ |
| 26 |
--prefix=/usr \ |
| 27 |
--libdir=/usr/lib \ |
| 28 |
--disable-static \ |
| 29 |
--with-logfile-dir=/var/log \ |
| 30 |
--with-runtime-dir=/run/ \ |
| 31 |
|
| 32 |
|
| 33 |
CONFFLAGS_deb = $(CONFFLAGS) \ |
| 34 |
$(shell dpkg-buildflags --export=configure || true) \ |
| 35 |
--enable-cbcp \ |
| 36 |
--enable-multilink \ |
| 37 |
--enable-systemd \ |
| 38 |
|
| 39 |
|
| 40 |
CONFFLAGS_udeb = $(CONFFLAGS) \ |
| 41 |
$(subst -O2,-O2 -Os -fomit-frame-pointer,$(shell dpkg-buildflags --export=configure || true)) \ |
| 42 |
--without-pam \ |
| 43 |
--without-pcap \ |
| 44 |
--disable-eaptls \ |
| 45 |
--disable-microsoft-extensions \ |
| 46 |
--disable-openssl-engine \ |
| 47 |
--disable-peap \ |
| 48 |
|
| 49 |
|
| 50 |
|
| 51 |
%: |
| 52 |
dh $@ --builddir=build-deb |
| 53 |
|
| 54 |
build-deb/config.status: |
| 55 |
dh_auto_configure -- $(CONFFLAGS_deb) |
| 56 |
|
| 57 |
build-udeb/config.status: |
| 58 |
rm -f pppd/pppdconf.h |
| 59 |
dh_auto_configure --builddir=build-udeb -- $(CONFFLAGS_udeb) |
| 60 |
perl -i -pe 's/^#define (HAVE_CRYPT_H|HAVE_SHADOW_H) .*//' build-udeb/pppd/config.h |
| 61 |
perl -i -pe 's/^(CRYPT_LIBS =).*/$$1/' build-udeb/pppd/Makefile |
| 62 |
perl -i -pe 's/^(SUBDIRS =).*/$$1 pppoe pppoatm/; s/^(pppd_plugin_LTLIBRARIES =).*//' build-udeb/pppd/plugins/Makefile |
| 63 |
|
| 64 |
override_dh_auto_configure: build-deb/config.status build-udeb/config.status |
| 65 |
@if [ "$(PPP_PLUGIN_ABI)" != "$(DEB_VERSION_UPSTREAM)" ]; then \ |
| 66 |
echo; echo "**********"; \ |
| 67 |
echo "VERSION in Makefile must match upstream version."; \ |
| 68 |
echo "Upstream version is '$(DEB_VERSION_UPSTREAM)'"; \ |
| 69 |
echo "VERSION is '$(PPP_PLUGIN_ABI)'"; \ |
| 70 |
echo "Aborting the build."; \ |
| 71 |
echo "**********"; echo; \ |
| 72 |
exit 1; \ |
| 73 |
fi |
| 74 |
@if [ -z "$(VERSION_ABI_PART)" ]; then \ |
| 75 |
echo; echo "**********"; \ |
| 76 |
echo "No ABI component found in the Debian revision field:"; \ |
| 77 |
echo "$(VERSION_ABI_PART)"; \ |
| 78 |
echo "Please see debian/README.source for more information."; \ |
| 79 |
echo "Aborting the build."; \ |
| 80 |
echo "**********"; echo; \ |
| 81 |
exit 1; \ |
| 82 |
fi |
| 83 |
|
| 84 |
build-deb/changelog: |
| 85 |
{ \ |
| 86 |
sed -ne "/^What's new in / {p; :1; n; /^For a list of the changes made during /q; p; b1}" README ; \ |
| 87 |
echo ; \ |
| 88 |
cat Changes-2.4 ; \ |
| 89 |
cat Changes-2.3 ; \ |
| 90 |
} > $@ |
| 91 |
|
| 92 |
override_dh_auto_build: |
| 93 |
dh_auto_build |
| 94 |
dh_auto_build --builddir=build-udeb |
| 95 |
|
| 96 |
override_dh_auto_install: |
| 97 |
dh_auto_install --destdir=debian/tmp |
| 98 |
dh_auto_install --builddir=build-udeb --destdir=debian/tmp-udeb |
| 99 |
|
| 100 |
execute_after_dh_auto_install-indep: |
| 101 |
$(PKD)/gen_substvars_dev $(DEB_VERSION_UPSTREAM) $(VERSION_ABI_PART) \ |
| 102 |
> $(DIR_PPP_DEV)/usr/share/ppp-dev/substvars |
| 103 |
pod2man --section=1p --utf8 debian/extra/dh_ppp \ |
| 104 |
$(DIR_PPP_DEV)/usr/share/man/man1/dh_ppp.1p |
| 105 |
|
| 106 |
execute_after_dh_install-arch: |
| 107 |
rm -f $(DIR_PPP)/usr/lib/pppd/*/*.*a $(DIR_PPP_UDEB)/usr/lib/pppd/*/*.*a |
| 108 |
cd $(DIR_PPP)/usr/lib/pppd/*/ && ln -s pppoe.so rp-pppoe.so |
| 109 |
|
| 110 |
override_dh_installchangelogs: build-deb/changelog |
| 111 |
dh_installchangelogs build-deb/changelog |
| 112 |
|
| 113 |
execute_after_dh_installexamples-arch: |
| 114 |
rm $(DIR_PPP)/usr/share/doc/ppp/examples/scripts/Makefile* |
| 115 |
|
| 116 |
mv $(DIR_PPP)/usr/share/doc/ppp/examples/autopppd \ |
| 117 |
$(DIR_PPP)/usr/share/doc/ppp/examples/scripts/ |
| 118 |
|
| 119 |
execute_after_dh_lintian: |
| 120 |
install -D -p -m644 debian/ppp-udeb.lintian-overrides \ |
| 121 |
$(DIR_PPP_UDEB)/usr/share/lintian/overrides/ppp-udeb |
| 122 |
|
| 123 |
override_dh_perl: |
| 124 |
dh_perl -d --package=ppp-dev |
| 125 |
|
| 126 |
execute_after_dh_fixperms-arch: |
| 127 |
chown root:dip \ |
| 128 |
$(DIR_PPP)/etc/chatscripts/ \ |
| 129 |
$(DIR_PPP)/etc/ppp/peers/ \ |
| 130 |
$(DIR_PPP)/usr/sbin/pppd |
| 131 |
chmod 4754 $(DIR_PPP)/usr/sbin/pppd |
| 132 |
chmod 2750 $(DIR_PPP)/etc/ppp/peers/ $(DIR_PPP)/etc/chatscripts/ |
| 133 |
|
| 134 |
|
| 135 |
|
| 136 |
|
| 137 |
|
| 138 |
|
| 139 |
override_dh_makeshlibs: |
| 140 |
dh_makeshlibs --no-scripts --package=ppp -Xusr/lib/pppd/ -- -c2 -edebian/ppp/usr/sbin/pppd -V |
| 141 |
dh_makeshlibs --no-package=ppp |