| 1 |
#!/usr/bin/make -f |
| 2 |
# Uncomment this to turn on verbose mode. |
| 3 |
#export DH_VERBOSE=1 |
| 4 |
#export DH_OPTIONS=-v |
| 5 |
|
| 6 |
help: # Default target |
| 7 |
.PHONY: help |
| 8 |
|
| 9 |
ifneq (,$(filter parallel=%,$(DEB_BUILD_OPTIONS))) |
| 10 |
NUMJOBS = $(patsubst parallel=%,%,$(filter parallel=%,$(DEB_BUILD_OPTIONS))) |
| 11 |
MAKEFLAGS += -j$(NUMJOBS) |
| 12 |
endif |
| 13 |
|
| 14 |
DEBIAN_DIR := $(dir $(firstword $(MAKEFILE_LIST))) |
| 15 |
|
| 16 |
include /usr/share/dpkg/pkg-info.mk |
| 17 |
|
| 18 |
GCC_VERSION := $(DEB_VERSION_UPSTREAM) |
| 19 |
|
| 20 |
#### |
| 21 |
# Simplified from debian/rules.conf of "gcc-5 (5.1.1-1)" |
| 22 |
BASE_VERSION := $(shell echo $(GCC_VERSION) | sed -e 's/\([1-9]*\)\..*/\1/') |
| 23 |
|
| 24 |
export GCC_VERSION |
| 25 |
export BASE_VERSION |
| 26 |
|
| 27 |
versioned-files: |
| 28 |
fs=`echo debian/*BV* | sort -u`; \ |
| 29 |
for f in $$fs debian/source.lintian-overrides.in; do \ |
| 30 |
[ -f $$f ] || echo "CANNOT FIND $$f"; \ |
| 31 |
[ -f $$f ] || continue; \ |
| 32 |
f2=$$(echo $$f \ |
| 33 |
| sed 's/BV/$(BASE_VERSION)/;s/\.in$$//'); \ |
| 34 |
sed -e 's/@BV@/$(BASE_VERSION)/g' \ |
| 35 |
$$f > $$f2; \ |
| 36 |
touch -r $$f $$f2; \ |
| 37 |
done |
| 38 |
|
| 39 |
clean-versioned-files: |
| 40 |
fs=`echo debian/*BV* | sort -u`; \ |
| 41 |
for f in $$fs; do \ |
| 42 |
[ -f $$f ] || continue; \ |
| 43 |
f2=$$(echo $$f \ |
| 44 |
| sed 's/BV/$(BASE_VERSION)/;s/\.in$$//'); \ |
| 45 |
sed -e 's/@BV@/$(BASE_VERSION)/g' \ |
| 46 |
$$f > $$f2; \ |
| 47 |
rm -f $$f2; \ |
| 48 |
done |
| 49 |
|
| 50 |
# |
| 51 |
#### |
| 52 |
|
| 53 |
|
| 54 |
%: |
| 55 |
dh $@ |
| 56 |
|
| 57 |
override_dh_auto_build: |
| 58 |
$(MAKE) -f debian/Makefile |
| 59 |
|
| 60 |
override_dh_auto_clean: clean-versioned-files |
| 61 |
$(MAKE) -f debian/Makefile clean |
| 62 |
|
| 63 |
override_dh_auto_install: versioned-files |
| 64 |
|
| 65 |
override_dh_installdocs: |
| 66 |
#dh_installdocs -pgcc-doc-base |
| 67 |
dh_installdocs --remaining-packages --link-doc=gcc-$(BASE_VERSION)-doc |
| 68 |
|
| 69 |
# Gzipped PDFs often get mis-handled by browsers and/or servers. |
| 70 |
# (Thankfully, policy only requires *plain text* documentation to be |
| 71 |
# compressed.) |
| 72 |
override_dh_compress: |
| 73 |
dh_compress -X.pdf |
| 74 |
|
| 75 |
# XXX: Policy says this rule should download the latest, but there |
| 76 |
# doesn't seem to be a good way to know what version uscan downloaded, |
| 77 |
# so we don't do that yet. |
| 78 |
# |
| 79 |
# This behaviour is shared by all of the example implementations on |
| 80 |
# <https://wiki.ubuntu.com/PackagingGuide/Basic#Changing_the_Original_Tarball>, |
| 81 |
# though, so I (SamB) can't bring myself to feel very bad about it. |
| 82 |
|
| 83 |
get-orig-source: |
| 84 |
# Have uscan grab upstream tarball |
| 85 |
uscan --noconf --force-download --download-version $(GCC_VERSION) \ |
| 86 |
--no-symlink --destdir=$(CURDIR) \ |
| 87 |
--check-dirname-regex='(PACKAGE|gcc-doc)(-.+)?' \ |
| 88 |
$(DEBIAN_DIR)/.. |
| 89 |
|
| 90 |
# Distill the tarball to just the docs (and texi2pod) |
| 91 |
python3 $(DEBIAN_DIR)/extract-doc-tarball-from-upstream \ |
| 92 |
gcc-$(GCC_VERSION).tar.xz \ |
| 93 |
gcc-$(BASE_VERSION)-doc \ |
| 94 |
$(GCC_VERSION) |
| 95 |
|
| 96 |
# Delete the upstream tarball |
| 97 |
rm -f gcc-$(GCC_VERSION).tar.xz |