#!/usr/bin/make -f # We require some bash features override SHELL := /bin/bash include /usr/share/dpkg/pkg-info.mk DEB_CFLAGS_MAINT_APPEND := -Wno-error=deprecated-declarations DEB_CPPFLAGS_MAINT_APPEND := -DDEBIAN_VERSION='\"$(DEB_VERSION)\"' DPKG_EXPORT_BUILDFLAGS := 1 include /usr/share/dpkg/architecture.mk include /usr/share/dpkg/buildflags.mk include /usr/share/dpkg/buildtools.mk LANGUAGES := en $(patsubst po/%.po,%,$(wildcard po/*.po)) # Files that have version strings substituted in the tarball but never in git VERSION_SUB_FILES := devel.but osx/Info.plist puzzles.but version.h %: dh $@ --without autoreconf CMAKE_OPTS := -DNAME_PREFIX=sgt- -DCMAKE_INSTALL_BINDIR=/usr/games override_dh_auto_configure: # In a cross-build, we need to first do a native build to generate the # icon files. In a fully native build this is done automatically. ifneq ($(DEB_BUILD_ARCH),$(DEB_HOST_ARCH)) mkdir -p obj-$(DEB_BUILD_GNU_TYPE) cd obj-$(DEB_BUILD_GNU_TYPE) && cmake $(CMAKE_OPTS) .. $(MAKE) -C obj-$(DEB_BUILD_GNU_TYPE) VERBOSE=$(if $(filter terse,$(DEB_BUILD_OPTIONS)),0,1) cp obj-$(DEB_BUILD_GNU_TYPE)/icons/*-icon.c icons/ endif dh_auto_configure -- $(CMAKE_OPTS) override_dh_auto_build: dh_auto_build cp obj-$(DEB_HOST_GNU_TYPE)/gamedesc.txt . $(MAKE) -f Makefile.doc BINPREFIX=sgt- # Disable running tests; they are quite slow and don't seem likely to catch # regressions. override_dh_auto_test: override_dh_installdocs: for lang in $(LANGUAGES); do \ dh_install html-$$lang/*.html usr/share/sgt-puzzles/help/$$lang \ || exit; \ done dh_installdocs override_dh_installman: for lang in $(LANGUAGES); do \ dh_installman --language=$${lang/en/C} man-$$lang/* || exit; \ done override_dh_auto_clean: ifneq ($(DEB_BUILD_ARCH),$(DEB_HOST_ARCH)) rm -rf obj-$(DEB_BUILD_GNU_TYPE) rm -f icons/*-icon.c endif dh_auto_clean rm -f gamedesc.txt $(MAKE) -f Makefile.doc clean FORCE: .PHONY: FORCE ../puzzles.tar.gz: FORCE curl -L -R -o $@ $(if $(wildcard $@),-z $@) https://www.chiark.greenend.org.uk/~sgtatham/puzzles/puzzles.tar.gz ../puzzles.tar.version: ../puzzles.tar.gz version="$$(tar -xOzf $< --wildcards '*/version.h' | \ sed -n 's/^\#define VER "Version \([^ ]*\)"$$/\1/p')" && \ test "$${version#*.}" != "$$version" && \ echo "$$version" > $@ # Updating to a new upstream includes a rebase which will often # require manual fixup. Split the commands into two targets so it's # possible to continue after that point. update-upstream: debian/rules update-upstream-1 debian/rules update-upstream-2 update-upstream-1: ../puzzles.tar.gz ../puzzles.tar.version test ! -d .pc || quilt pop -a version="$$(cat ../puzzles.tar.version)" && \ upstream_commit="$${version#*.}" && \ git tag -f -m "Upstream version $$version" "upstream/$$version" \ "$$upstream_commit" && \ git deborig --force --version "$$version" && \ git merge "upstream/$$version" update-upstream-2: QUILT_PATCHES=debian/patches quilt push 0001-Apply-version-string-substitutions-from-the-tarball.patch tar -xzf ../puzzles.tar.gz --strip-components=1 --wildcards \ $(addprefix '*/',$(VERSION_SUB_FILES)) quilt refresh quilt push -a .PHONY: update-upstream update-po: set +e; quilt unapplied >/dev/null && echo 'Patch series not fully applied'; test $$? -eq 1 dh_auto_configure -- $(CMAKE_OPTS) cp obj-$(DEB_HOST_GNU_TYPE)/gamedesc.txt . make -f Makefile.doc update-po quilt pop 0003-Add-German-translation-of-documentation.patch quilt refresh quilt pop 206_translate-docs.diff quilt refresh quilt push -a .PHONY: update-po