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 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99
|
#!/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
wget -N -O $@ 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 .pc && quilt pop -a
version="$$(cat ../puzzles.tar.version)" && \
upstream_commit="$${version#*.}" && \
git tag -m "Upstream version $$version" "upstream/$$version" \
"$$upstream_commit" && \
git deborig --version "$$version" && \
git merge "$$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
|