| 1 |
DESTDIR= |
| 2 |
PREFIX=/usr/local |
| 3 |
DATADIR=$(PREFIX)/share |
| 4 |
VERSION:=1.08.$(shell date +%Y%m%d) |
| 5 |
releasedir=freedink-data-$(VERSION) |
| 6 |
SOURCE_DATE_EPOCH:=$(shell date -d$$(echo $(VERSION) | grep -Po '\d{8}')Z0000 +%s) |
| 7 |
|
| 8 |
all: |
| 9 |
@echo "No default action" |
| 10 |
|
| 11 |
install: |
| 12 |
# Copy game data |
| 13 |
|
| 14 |
# The final directory is '$PREFIX/share/dink/dink' ('dink' |
| 15 |
# twice), as there can be site-wide D-Mods such as |
| 16 |
# '$PREFIX/share/dink/island' |
| 17 |
install -d -m 755 $(DESTDIR)$(DATADIR)/dink |
| 18 |
|
| 19 |
# '-a' will preserve timestamps, which some distros prefer. It |
| 20 |
# will also preserve symlinks, which may be useful as there are |
| 21 |
# a few duplicate musics. Use a .zip archive for woe releases, |
| 22 |
# it will duplicate files but avoid creating empty files instead |
| 23 |
# of symlinks. |
| 24 |
cp -a dink $(DESTDIR)$(DATADIR)/dink/ |
| 25 |
|
| 26 |
# Tidy permissions |
| 27 |
find $(DESTDIR)$(DATADIR)/dink/dink/ -type d -print0 | xargs -0r chmod 755 |
| 28 |
find $(DESTDIR)$(DATADIR)/dink/dink/ -type f -print0 | xargs -0r chmod 644 |
| 29 |
|
| 30 |
# Release: |
| 31 |
# (Do this from a fresh Git checkout to avoid packaging temporary files) |
| 32 |
dist: update-gmo |
| 33 |
## Source release |
| 34 |
|
| 35 |
# Not using Git because that doesn't ship the .mo files |
| 36 |
# Plus that forbids testing uncommitted changes |
| 37 |
# git archive --format=tar.gz --prefix=$(releasedir)/ -o > $(releasedir).tar.gz HEAD \ |
| 38 |
# -- ChangeLog COPYING NEWS *.txt *.spec Makefile autobuild/ debian/ dink/ doc/ licenses/ soundtest/ src/ \ |
| 39 |
|
| 40 |
rm -rf $(releasedir) |
| 41 |
mkdir $(releasedir) |
| 42 |
chmod 00755 $(releasedir) |
| 43 |
umask 022; cp -dR ChangeLog COPYING NEWS *.txt *.spec Makefile autobuild/ debian/ dink/ doc/ licenses/ soundtest/ src/ $(releasedir) |
| 44 |
|
| 45 |
# Clean-up: |
| 46 |
# git files |
| 47 |
find $(releasedir)/ -name ".gitignore" -print0 | xargs -0r rm |
| 48 |
# backup files |
| 49 |
find $(releasedir)/ -name "*~" -print0 | xargs -0r rm |
| 50 |
# savegames |
| 51 |
find $(releasedir)/ -iname "save*.dat" -print0 | xargs -0r rm |
| 52 |
# cheat^Wdebugging tool |
| 53 |
rm -f $(releasedir)/dink/Story/key-67.c |
| 54 |
# debug mode output |
| 55 |
rm -f $(releasedir)/dink/DEBUG.TXT |
| 56 |
|
| 57 |
# Tarball: |
| 58 |
# Make it reproducible, not really needed, but fun and doesn't leak metadata |
| 59 |
# https://reproducible-builds.org/docs/archives/ |
| 60 |
# Though any update to this Makefile changes the release checksum... |
| 61 |
tar -c --sort=name \ |
| 62 |
--mtime="@$(SOURCE_DATE_EPOCH)" \ |
| 63 |
--owner=root --group=root --numeric-owner \ |
| 64 |
$(releasedir)/ | gzip -n > $(releasedir).tar.gz |
| 65 |
|
| 66 |
rm -rf $(releasedir) |
| 67 |
|
| 68 |
# Compile translation strings catalogs |
| 69 |
update-gmo: |
| 70 |
cd dink/l10n; \ |
| 71 |
for i in $$(ls ??.po | sed 's/\.po$$//'); do \ |
| 72 |
mkdir -p $$i/LC_MESSAGES; \ |
| 73 |
echo -n "$$i: "; \ |
| 74 |
msgfmt --statistics $$i.po -o $$i/LC_MESSAGES/dink.mo; \ |
| 75 |
done |
| 76 |
|
| 77 |
reprotest: |
| 78 |
reprotest \ |
| 79 |
'make dist VERSION=$(VERSION) && ./autobuild/freedink-data-woe.sh $(VERSION) \ |
| 80 |
&& chmod 644 \$(releasedir).tar.gz $(releasedir)-nosrc.zip' \ |
| 81 |
'$(releasedir).tar.gz $(releasedir)-nosrc.zip' |