#!/usr/bin/make -f export DEB_BUILD_MAINT_OPTIONS = hardening=+all optimize=+lto include /usr/share/dpkg/pkg-info.mk #export DH_VERBOSE=1 upstream_commit = $(shell v="$(DEB_VERSION_UPSTREAM)"; echo $${v\#\#*~}) # take from control? (how?) SOVERSION = 0 SONAME = libgnucap.so.${SOVERSION} UPSTREAM_REPO=git://git.savannah.gnu.org/gnucap.git ORIG_TARBALL=../gnucap_${DEB_VERSION_UPSTREAM}.orig.tar.gz DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH) CFLAGS := $(shell dpkg-buildflags --get CFLAGS) CPPFLAGS := $(shell dpkg-buildflags --get CPPFLAGS) CXXFLAGS := $(shell dpkg-buildflags --get CXXFLAGS) LDFLAGS := $(shell dpkg-buildflags --get LDFLAGS) LN_S = ln -sf WHICH_CXX = $(shell realpath `which g++`) WHICH_CXX_PACKAGE = $(shell dpkg -S $(WHICH_CXX) | cut -f1 -d:) libdir = /usr/lib/$(DEB_HOST_MULTIARCH) pkglibdir = ${libdir}/gnucap${SOVERSION} info: @echo ${LDFLAGS} @echo ${DEB_VERSION_UPSTREAM} @echo ${upstream_commit} @echo ${WHICH_CXX} @echo ${WHICH_CXX_PACKAGE} %: dh $@ override_dh_auto_configure: dh_auto_configure -- --prefix=/usr --sysconfdir=/etc CXX=${WHICH_CXX} sed -e '/GNUCAP_PLUGPATH/s#gnucap"$$#gnucap'${SOVERSION}'"#' -i main/config.h sed -e '/^pkglibdir/s#=.*#='${pkglibdir}'#' -i main/gnucap.conf sed -e '/^pkglibdir/s#gnucap$$#gnucap'${SOVERSION}'#' -i apps/Makefile sed -e '/^plugindir/s#gnucap$$#gnucap'${SOVERSION}'#' -i apps/Makefile sed -i '/SYSTEMSTARTPATH/s/OS::getenv("PATH")/"\/etc"/' main/config.h override_dh_gencontrol: # might become a hard dependency... echo misc:Recommends=${WHICH_CXX_PACKAGE} > debian/gnucap-common.substvars dh_gencontrol override_dh_auto_clean: dh_auto_clean rm -f autotools # rm -f aclocal.m4 ar-lib compile config.guess config.sub depcomp install-sh missing rm -rf configure.ac rm -rf configure.gnu # rm -rf configure # override_dh_installdocs: # dh_installdocs # # Remove LaTeX sources from HTML documentation: # ##rm debian/gnucap/usr/share/doc/gnucap/html/*.hi?? # # Remove un-necessary docs installed by upstream: # #rm debian/gnucap/usr/share/doc/gnucap/COPYING # #rm debian/gnucap/usr/share/doc/gnucap/INSTALL # #rm debian/gnucap/usr/share/doc/gnucap/history override_dh_compress: dh_compress -X.pdf -X.ckt override_dh_autoreconf: -ln -s debian/autotools # stray rules in Make1. disable them sed -e '/^%/s/model$$/model_/' -i apps/Make1 autotools/bootstrap # required for dh_auto_configure mv configure.gnu configure # create tarball equivalent to upstream. use # tar -xOzf ../gnucap-20171003.tar.gz | sort | sha1sum # to check. get-orig-source: @echo creating tarball from ${upstream_commit} [ -d .git ] && git archive ${upstream_commit} | \ gzip > $(ORIG_TARBALL) || : [ -d .git ] || git archive --format=tar \ --remote=$(UPSTREAM_REPO) ${upstream_commit} | \ tar -xzf > $(ORIG_TARBALL) .PHONY: get-orig-source