#!/usr/bin/make -f # -*- makefile -*- # Makefile to build the openttd debian package. # Use debhelper default for all targets (but some are overridden below). binary binary-arch binary-indep build build-arch build-indep clean install install-arch install-indep: dh $@ include /usr/share/dpkg/architecture.mk # Introduced in dpkg 1.19.0 -include /usr/share/dpkg/buildtools.mk # Set by buildtools.mk to support cross-compilation, but provide a # default for older dpkg versions PKG_CONFIG ?= pkg-config ifneq ($(DEB_HOST_GNU_TYPE),$(DEB_BUILD_GNU_TYPE)) CROSS= --build $(DEB_BUILD_GNU_TYPE) --host $(DEB_HOST_GNU_TYPE) endif # This prevents linking uselessly to libicudata and silences a warning # in the build process. DEB_LDFLAGS_MAINT_APPEND="-Wl,-as-needed" # Enable all hardening options (since openttd offers a network-listening # service that handles untrusted data). DEB_BUILD_MAINT_OPTIONS=hardening=+all # Load buildflags (this uses dpkg-buildflags). Note that we don't export # them, but instead pass them to ./configure explicitly. include /usr/share/dpkg/buildflags.mk # Pass custom options to configure. Since it's not autoconf but a custom # script, some of the option names are slightly different. We also need # to be explicit about the dependencies, in case we're not running in a # clean build root. override_dh_auto_configure: ./configure $(CROSS) --prefix-dir=/usr --install-dir=debian/tmp --menu-group="Game;StrategyGame;" \ --without-allegro --with-zlib --with-sdl --with-png --with-freetype --with-fontconfig \ --with-icu-sort --without-icu-layout --with-liblzo2 --with-liblzma --without-iconv --with-xdg-basedir \ --disable-strip --pkg-config=$(PKG_CONFIG) \ CFLAGS="$(CFLAGS) $(CPPFLAGS)" \ CXXFLAGS="$(CXXFLAGS) $(CPPFLAGS)" \ LDFLAGS="$(LDFLAGS)" \ CFLAGS_BUILD="$(CFLAGS) $(CPPFLAGS)" \ CXXFLAGS_BUILD="$(CXXFLAGS) $(CPPFLAGS)" \ LDFLAGS_BUILD="$(LDFLAGS)" # Do some extra installation override_dh_auto_install: $(MAKE) install DO_NOT_INSTALL_CHANGELOG=1 DO_NOT_INSTALL_LICENSE=1 GRF=bin/baseset/openttd.grf GRF_BACKUP=debian/openttd.grf override_dh_auto_build: # Remove the prebuilt grf file, to force a rebuild from source # (but do keep a backup, so the clean rule can restore it as # required by the policy). [ -f "$(GRF_BACKUP)" ] || mv "$(GRF)" "$(GRF_BACKUP)" # Use dh_auto_build so it handles parallel building # automatically. ifneq (,$(filter terse,$(DEB_BUILD_OPTIONS))) dh_auto_build else dh_auto_build -- VERBOSE=1 endif override_dh_auto_clean: dh_auto_clean [ ! -f "$(GRF_BACKUP)" ] || mv "$(GRF_BACKUP)" "$(GRF)" # dh_strip automatically generates a -dbgsym package by default. Let it # include Replaces and Breaks headers against the previously manually # generated -dbg package. override_dh_strip: dh_strip --dbgsym-migration='openttd-dbg (<< 1.7.1-1~)'