From 54891f96aef1666295bddd579b1158e74ac186da Mon Sep 17 00:00:00 2001 From: Leonid Bobrov Date: Wed, 24 Nov 2021 14:26:38 +0200 Subject: [PATCH] godot: add client and server export templates and headless editor both headless editor and export templates will be needed to package games made with godot as either source code available or proprietary binaries linked only against glibc remove -no-pie flag because 1 out of 5 binaries not being PIE causes xbps-src to error, it was a workaround for some linux distros that treat PIE binaries as shared libraries => https://github.com/godotengine/godot/pull/23542 background => https://github.com/godotengine/godot/pull/50737 pushed to master but forgot to merge it in 3.x remove clang from dependencies because without passing 'use_llvm=yes' to scons it's never used both 'release' and 'release_debug' client and server are needed for custom exports closes #34199 --- srcpkgs/godot/patches/pie.patch | 23 ++++++++++++++++++ srcpkgs/godot/template | 42 +++++++++++++++++++++++++-------- 2 files changed, 55 insertions(+), 10 deletions(-) create mode 100644 srcpkgs/godot/patches/pie.patch diff --git a/srcpkgs/godot/patches/pie.patch b/srcpkgs/godot/patches/pie.patch new file mode 100644 index 000000000000..08964951e66e --- /dev/null +++ b/srcpkgs/godot/patches/pie.patch @@ -0,0 +1,23 @@ +diff --git a/platform/x11/detect.py b/platform/x11/detect.py +index 56ef4b8e29..c5fd8f7811 100644 +--- a/platform/x11/detect.py ++++ b/platform/x11/detect.py +@@ -210,18 +210,6 @@ def configure(env): + env.Append(CCFLAGS=["-pipe"]) + env.Append(LINKFLAGS=["-pipe"]) + +- # Check for gcc version >= 6 before adding -no-pie +- version = get_compiler_version(env) or [-1, -1] +- if using_gcc(env): +- if version[0] >= 6: +- env.Append(CCFLAGS=["-fpie"]) +- env.Append(LINKFLAGS=["-no-pie"]) +- # Do the same for clang should be fine with Clang 4 and higher +- if using_clang(env): +- if version[0] >= 4: +- env.Append(CCFLAGS=["-fpie"]) +- env.Append(LINKFLAGS=["-no-pie"]) +- + ## Dependencies + + env.ParseConfig("pkg-config x11 --cflags --libs") diff --git a/srcpkgs/godot/template b/srcpkgs/godot/template index c38f3f8c525a..ef764ef07e07 100644 --- a/srcpkgs/godot/template +++ b/srcpkgs/godot/template @@ -1,21 +1,19 @@ # Template file for 'godot' pkgname=godot version=3.4 -revision=1 +revision=2 archs="x86_64* i686* aarch64* armv7* ppc64*" wrksrc="${pkgname}-${version}-stable" build_style=scons # Godot contains private copies of libraries # that already have been packaged elsewhere. -# Use builtin bullet for now as it's too old in repos (needs 2.89) -# Toggle to not use builtin once bullet has been updated -make_build_args="platform=x11 tools=yes target=release_debug dev=no progress=no - pulseaudio=no builtin_bullet=false builtin_libpng=false builtin_libvpx=false +make_build_args="dev=no progress=no pulseaudio=no + builtin_bullet=false builtin_libpng=false builtin_libvpx=false builtin_libwebp=false builtin_libogg=false builtin_libtheora=false builtin_opus=false builtin_libvorbis=false builtin_enet=false builtin_zlib=false builtin_freetype=false builtin_mbedtls=false builtin_miniupnpc=false builtin_pcre2=false" -hostmakedepends="pkg-config clang" +hostmakedepends="pkg-config" makedepends=" alsa-lib-devel freetype-devel glu-devel libXcursor-devel libXi-devel libXinerama-devel libXrender-devel libXrandr-devel libX11-devel @@ -42,15 +40,39 @@ pre_build() { export CXXFLAGS=" $CXXFLAGS " } +do_build() { + for tools in yes no; do + for target in release release_debug; do + for platform in x11 server; do + # tools provides editor functionality and we don't need it without debug capabilities + if [[${tools} != yes || ${target} != release]] + scons ${makejobs} ${make_build_args} CCFLAGS="$CFLAGS" LINKFLAGS="$LDFLAGS" tools=${tools} target=${target} platform=${platform} + fi + done + done + done +} + do_install() { vlicense LICENSE.txt vinstall ${FILESDIR}/godot.desktop 644 /usr/share/applications/ vinstall ${wrksrc}/icon.png 644 /usr/share/pixmaps/ godot.png case "$XBPS_TARGET_MACHINE" in - x86_64*|aarch64*) vbin bin/godot.x11.opt.tools.64 godot;; - ppc64le*) vbin bin/godot.x11.opt.tools.ppc64le godot;; - ppc64*) vbin bin/godot.x11.opt.tools.ppc64 godot;; - *) vbin bin/godot.x11.opt.tools.32 godot;; + x86_64*|aarch64*) _godot_arch=64;; + ppc64le*) _godot_arch=ppc64le;; + ppc64*) _godot_arch=ppc64;; + *) _godot_arch=32;; esac + + # editors, the headless one is necessary for packagers + # because it doesn't depend on X11 session when used from command line + vbin bin/godot.x11.opt.tools.$_godot_arch godot + vbin bin/godot_server.x11.opt.tools.$_godot_arch godot-headless + + # export templates + vbin bin/godot.x11.opt.$_godot_arch godot-client + vbin bin/godot.x11.opt.debug.$_godot_arch godot-client-debug + vbin bin/godot_server.x11.opt.$_godot_arch godot-server + vbin bin/godot_server.x11.opt.debug.$_godot_arch godot-server-debug }