#!/usr/bin/make -f export DH_VERBOSE = 1 NUMJOBS = $(patsubst parallel=%,%,$(filter parallel=%,$(DEB_BUILD_OPTIONS))) # Force suffix on binaries to avoid special treatment of riscv64, ppc64le, ppc64, # ppcle and ppc in ./platform/x11/detect.py. Without this, the install calls below # fail to find the expected binaries. BITS = $(shell dpkg-architecture -q DEB_TARGET_ARCH_BITS) export DEB_BUILD_MAINT_OPTIONS = hardening=+all DPKG_EXPORT_BUILDFLAGS = 1 include /usr/share/dpkg/buildflags.mk # Link with libatomic on archs where it is needed. # See ifeq ($(DEB_HOST_ARCH),$(filter $(DEB_HOST_ARCH),armel riscv64)) export DEB_LDFLAGS_MAINT_APPEND += -Wl,--no-as-needed -latomic -Wl,--as-needed endif # The denoise module depends on OIDN which is x86_64 only (in the # vendored version). # Godot's own logic to disable it on other arches is a bit brittle # when it comes to cross-compiling currently. # See https://github.com/godotengine/godot/issues/47344 # The embree library used by raycast and lightmapper_cpu modules do # not build on s390x, disable on archs where it is not already building. ifneq ($(DEB_HOST_ARCH),$(filter $(DEB_HOST_ARCH),amd64 i386 armel armhf)) DISABLE_MODULES = module_denoise_enabled=no module_embree_enabled=no module_raycast_enabled=no module_lightmapper_cpu_enabled=no endif # replace "custom_build" with more useful Debian version info include /usr/share/dpkg/pkg-info.mk # provides DEB_VERSION export BUILD_NAME = debian${DEB_VERSION} include /usr/share/dpkg/architecture.mk # provides DEB_HOST_ARCH_BITS # Godot 3.x requires embree 3.x and mbedtls 2.x [0], but embree 4.x and # mbedtls 3.x are currently all that is available in unstable. rvo2 and # xatlas are not available within Debian. # [0] https://github.com/godotengine/godot/issues/100390 SCONS_OPTIONS = bits=$(DEB_HOST_ARCH_BITS) \ --jobs=$(NUMJOBS) \ import_env_vars=CCACHE_DIR \ CC="$(CC)" \ CXX="$(CXX)" \ CCFLAGS="$(CPPFLAGS)" \ CFLAGS="$(CFLAGS)" \ CXXFLAGS="$(CXXFLAGS)" \ LINKFLAGS="$(LDFLAGS)" \ builtin_bullet=no \ builtin_certs=no \ system_certs_path=/etc/ssl/certs/ca-certificates.crt \ builtin_embree=yes \ builtin_enet=no \ builtin_freetype=no \ builtin_libogg=no \ builtin_libpng=no \ builtin_libtheora=no \ builtin_libvorbis=no \ builtin_libvpx=no \ builtin_libwebp=no \ builtin_wslay=no \ builtin_mbedtls=yes \ builtin_miniupnpc=no \ builtin_opus=no \ builtin_pcre2=no \ builtin_recast=no \ builtin_rvo2=yes \ builtin_squish=no \ builtin_xatlas=yes \ builtin_zlib=no \ builtin_zstd=no \ use_static_cpp=no \ verbose=yes %: dh $@ override_dh_clean: scons -c arch=$(BITS) platform=server tools=yes target=release_debug $(SCONS_OPTIONS) $(DISABLE_MODULES) scons -c arch=$(BITS) platform=x11 tools=no target=release $(SCONS_OPTIONS) $(DISABLE_MODULES) scons -c arch=$(BITS) platform=x11 tools=yes target=release_debug $(SCONS_OPTIONS) $(DISABLE_MODULES) dh_clean override_dh_auto_build: dh_auto_build scons arch=$(BITS) platform=server tools=yes target=release_debug $(SCONS_OPTIONS) $(DISABLE_MODULES) scons arch=$(BITS) platform=x11 tools=no target=release $(SCONS_OPTIONS) $(DISABLE_MODULES) scons arch=$(BITS) platform=x11 tools=yes target=release_debug $(SCONS_OPTIONS) $(DISABLE_MODULES) override_dh_auto_install: echo "Installing binaries for $(BITS) bits architecture" install -D -m 400 $(CURDIR)/bin/godot.x11.opt.tools.$(BITS) $(CURDIR)/debian/godot3/usr/bin/godot3 install -D -m 400 $(CURDIR)/bin/godot.x11.opt.$(BITS) $(CURDIR)/debian/godot3-runner/usr/bin/godot3-runner install -D -m 400 $(CURDIR)/bin/godot_server.x11.opt.tools.$(BITS) $(CURDIR)/debian/godot3-server/usr/bin/godot3-server install -D -m 444 $(CURDIR)/misc/dist/linux/org.godotengine.Godot.desktop $(CURDIR)/debian/godot3/usr/share/applications/org.godotengine.Godot3.desktop install -D -m 444 $(CURDIR)/misc/dist/linux/org.godotengine.Godot.appdata.xml $(CURDIR)/debian/godot3/usr/share/metainfo/org.godotengine.Godot3.metainfo.xml install -D -m 444 $(CURDIR)/misc/dist/linux/org.godotengine.Godot.xml $(CURDIR)/debian/godot3/usr/share/mime/packages/org.godotengine.Godot3.xml install -D -m 644 $(CURDIR)/icon.svg $(CURDIR)/debian/godot3/usr/share/icons/hicolor/scalable/apps/godot3.svg install -D -m 444 $(CURDIR)/misc/dist/linux/godot.6 $(CURDIR)/debian/godot3/usr/share/man/man6/godot3.6 install -D -m 444 $(CURDIR)/misc/dist/linux/godot.6 $(CURDIR)/debian/godot3-runner/usr/share/man/man6/godot3-runner.6 sed -i 's/godot3/godot3-runner/' $(CURDIR)/debian/godot3-runner/usr/share/man/man6/godot3-runner.6 install -D -m 444 $(CURDIR)/misc/dist/linux/godot.6 $(CURDIR)/debian/godot3-server/usr/share/man/man6/godot3-server.6 sed -i 's/godot3/godot3-server/' $(CURDIR)/debian/godot3-server/usr/share/man/man6/godot3-server.6 dh_auto_install