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
|
#!/usr/bin/make -f
#export DH_VERBOSE=1
PKD := $(abspath $(dir $(MAKEFILE_LIST)))
PKG := $(word 2,$(shell dpkg-parsechangelog -l$(PKD)/changelog | grep ^Source))
UVER := $(shell dpkg-parsechangelog | sed -rne 's,^Version: ([^-]+).*,\1,p')
DTYPE := +dfsg
VER ?= $(subst $(DTYPE),,$(UVER))
BUILD_DATE := $(shell dpkg-parsechangelog --show-field=Date)
DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
DEB_HOST_ARCH_CPU ?= $(shell dpkg-architecture -qDEB_HOST_ARCH_CPU)
ifeq ($(DEB_HOST_ARCH_CPU),i386)
MARCH_FLAG :="i686"
else
MARCH_FLAG :="x86-64"
endif
%:
dh $@
override_dh_auto_configure:
dh_auto_configure -- \
-DBINDIR=games \
-DDATADIR=share/games/spring \
-DLIBDIR=lib/spring \
-DAI_LIBS_DIR=lib/spring \
-DAI_DATA_DIR=share/games/spring \
-DAI_FIND_QUIETLY=FALSE \
-DJAVA_FIND_REQUIRED=TRUE \
-DCMAKE_BUILD_TYPE=RELWITHDEBINFO \
-DMARCH_FLAG=$(MARCH_FLAG) \
-DPRD_JSONCPP_INTERNAL=FALSE
override_dh_auto_build:
# Reproducible: these files get packed in .sdz (= .zip) files
find cont/base -type f -exec touch --date='$(BUILD_DATE)' {} \;
find cont/base -type f -exec chmod 0644 {} \;
# Ensure that we build against system libraries of minizip
find rts/lib/minizip tools/pr-downloader/src/lib/minizip -type f -not -name 'CMakeLists.txt' -delete
dh_auto_build
cd $(CURDIR)/obj-$(DEB_HOST_GNU_TYPE)/test && make tests
override_dh_installchangelogs:
dh_installchangelogs doc/changelog.txt
override_dh_auto_install:
dh_auto_install
# Remove empty directories
find $(CURDIR) -type d -empty -delete
.PHONY: get-orig-source
## http://wiki.debian.org/onlyjob/get-orig-source
get-orig-source: $(PKG)_$(VER)$(DTYPE).orig.tar.xz $(info I: $(PKG)_$(VER)$(DTYPE))
@
$(PKG)_$(VER)$(DTYPE).orig.tar.xz:
@echo "# Downloading..."
uscan --noconf --verbose --rename --destdir=$(CURDIR) --check-dirname-level=0 --force-download --download-version $(VER) $(PKD)
$(if $(wildcard $(PKG)-$(VER)),$(error $(PKG)-$(VER) exist, aborting..))
@echo "# Extracting..."
mkdir $(PKG)-$(VER) \
&& tar -xf $(PKG)_$(VER).orig.tar.* --directory $(PKG)-$(VER) --strip-components 1 \
|| $(RM) -r $(PKG)-$(VER)
@echo "# Cleaning-up..."
cd $(PKG)-$(VER) \
&& $(RM) -r -v \
cont/fonts/FreeSansBold.otf \
cont/fonts/COPYING \
installer \
include/AL \
include/SDL2 \
include/GL \
tools/pr-downloader/src/lib/jsoncpp \
rts/spring.exe.manifest \
AI/Wrappers/JavaOO/jlib/*.jar
@echo "# Packing..."
find -L "$(PKG)-$(VER)" -xdev -type f -print | sort \
| XZ_OPT="-6v" tar -caf "$(PKG)_$(VER)$(DTYPE).orig.tar.xz" -T- --owner=root --group=root --mode=a+rX \
&& $(RM) -r "$(PKG)-$(VER)"
|