Codebase list gcc-9-doc / HEAD debian / rules
HEAD

Tree @HEAD (Download .tar.gz)

rules @HEADraw · history · blame

#!/usr/bin/make -f
# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1
#export DH_OPTIONS=-v

help: # Default target
.PHONY: help

ifneq (,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
	NUMJOBS = $(patsubst parallel=%,%,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
	MAKEFLAGS += -j$(NUMJOBS)
endif

DEBIAN_DIR := $(dir $(firstword $(MAKEFILE_LIST)))

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

GCC_VERSION  := $(DEB_VERSION_UPSTREAM)

####
# Simplified from debian/rules.conf of "gcc-5 (5.1.1-1)"
BASE_VERSION := $(shell echo $(GCC_VERSION) | sed -e 's/\([1-9]*\).*/\1/')

export GCC_VERSION
export BASE_VERSION

versioned-files:
	fs=`echo debian/*BV* | sort -u`; \
	for f in $$fs debian/source.lintian-overrides.in; do \
	  [ -f $$f ] || echo "CANNOT FIND $$f"; \
	  [ -f $$f ] || continue; \
	  f2=$$(echo $$f \
		| sed 's/BV/$(BASE_VERSION)/;s/\.in$$//'); \
	  sed -e 's/@BV@/$(BASE_VERSION)/g' \
	    $$f > $$f2; \
	  touch -r $$f $$f2; \
	done

clean-versioned-files:
	fs=`echo debian/*BV* | sort -u`; \
	for f in $$fs; do \
	  [ -f $$f ] || continue; \
	  f2=$$(echo $$f \
		| sed 's/BV/$(BASE_VERSION)/;s/\.in$$//'); \
	  sed -e 's/@BV@/$(BASE_VERSION)/g' \
	    $$f > $$f2; \
	  rm -f $$f2; \
	done

#
####


%:
	dh $@

override_dh_auto_build:
	$(MAKE) -f debian/Makefile

override_dh_auto_clean: clean-versioned-files
	$(MAKE) -f debian/Makefile clean

override_dh_auto_install: versioned-files

override_dh_installdocs:
	#dh_installdocs -pgcc-doc-base
	dh_installdocs --remaining-packages --link-doc=gcc-$(BASE_VERSION)-doc

# Gzipped PDFs often get mis-handled by browsers and/or servers.
# (Thankfully, policy only requires *plain text* documentation to be
# compressed.)
override_dh_compress:
	dh_compress -X.pdf

# XXX: Policy says this rule should download the latest, but there
# doesn't seem to be a good way to know what version uscan downloaded,
# so we don't do that yet.
#
# This behaviour is shared by all of the example implementations on
# <https://wiki.ubuntu.com/PackagingGuide/Basic#Changing_the_Original_Tarball>,
# though, so I (SamB) can't bring myself to feel very bad about it.

get-orig-source:
	# Have uscan grab upstream tarball
	uscan --noconf --force-download --download-version $(GCC_VERSION) \
	  --no-symlink --destdir=$(CURDIR) \
	  --check-dirname-regex='(PACKAGE|gcc-doc)(-.+)?' \
	  $(DEBIAN_DIR)/..

        # Distill the tarball to just the docs (and texi2pod)
	python3 $(DEBIAN_DIR)/extract-doc-tarball-from-upstream \
	  gcc-$(GCC_VERSION).tar.xz \
	  gcc-$(BASE_VERSION)-doc \
	  $(GCC_VERSION)

        # Delete the upstream tarball
	rm -f gcc-$(GCC_VERSION).tar.xz