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
|
#!/usr/bin/make -f
#export DH_VERBOSE=1
export DEB_BUILD_MAINT_OPTIONS = hardening=+all
CONTRIB_EXAMPLES = debian/mrtg-contrib/usr/share/doc/mrtg-contrib/examples/contrib
%:
dh $@
execute_after_dh_clean:
# Revert changes in hashbangs after building
for i in cfgmaker indexmaker mrtg; do \
sed -i 's/#! \/usr\/bin\/perl -w/#! \/home\/oetiker\/.plenv\/shims\/perl -w/' bin/$$i; \
done
# Searching for translations from MS Windows
execute_before_dh_auto_configure:
file debian/po/* | grep CRLF && \
{ echo -e "\n\nERROR: There is a translation with CRLF in debian/po/\n"; \
exit 1; } || true
# Using *-indep to avoid issues when building arch dependent binary only
execute_after_dh_install-indep:
# xlsummary depends on non-free software. See #293641.
rm -rf $(CONTRIB_EXAMPLES)/xlsummary
# Removing extra licensing files
find $(CONTRIB_EXAMPLES) -name COPYING -exec rm -f {} \;
# Fix hashbangs: c:\perl\bin
grep -Esri '#!c:\\perl\\bin' $(CONTRIB_EXAMPLES) | cut -d: -f1 | \
xargs sed -i 's/#!c:\\perl\\bin/#!\/usr\/bin\/perl/'
# Fix hashbangs: /usr/bin/ksh
grep -Esri '#!/usr/bin/ksh' $(CONTRIB_EXAMPLES) | cut -d: -f1 | \
xargs sed -i 's/#!\/usr\/bin\/ksh/#!\/bin\/ksh/'
# Fix all Unixes hashbangs with 'perl'
grep -Esr '^#!\/[a-z/]+perl[0-9]?' $(CONTRIB_EXAMPLES) | cut -d: -f1 | \
xargs sed -i 's/^#!\/[a-z/]\+perl[0-9]\?/#!\/usr\/bin\/perl/'
# Fix specific hashbang with 'perl'
grep -Esr '^#! /pkg/gnu/bin/perl' $(CONTRIB_EXAMPLES) | cut -d: -f1 | \
xargs sed -i 's/^#!\ \/pkg\/gnu\/bin\/perl/#!\/usr\/bin\/perl/'
# Convert all files to Unix EOL style
find $(CONTRIB_EXAMPLES) -type f -exec dos2unix -q {} \;
# Create symlinks for duplicate files
jdupes -rl $(CONTRIB_EXAMPLES)
execute_before_dh_fixperms-indep:
# There are several examples with wrong permissions for Unix, so
# changing all regular files to 644 is a good idea because they are
# examples only. Note that dh_fixperms will change some permissions
# again.
find $(CONTRIB_EXAMPLES) -type f -exec chmod 644 {} \;
override_dh_compress-indep:
dh_compress -Xexamples/
|