From 2abad13022349eb6cb56a1709c393f2d4979db1b5787d80866194cd14e9e18d0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20Mail=C3=A4nder?= Date: Sat, 8 Aug 2020 09:43:19 +0000 Subject: [PATCH] Accepting request 824972 from home:StefanBruens:branches:games - Fix build on ix86 in combination with LTO, the bundled mbedtls from premake5 creates duplicate symbols from inline asm. Add avoid_duplicate_global_symbol_from_asm.patch - Add 0001-Fix-ODR-violation-for-ShaderModelRendererInternals.patch - Clean up dozens of unnecessary build dependencies. - Disable --with-system-mozjs38 option on systems which lack the mozjs38 package - Include the libmozjs38-ps-release.so binary on systems which lack the mozjs38 package - Require more build dependencies on systems which lack the mozjs38 package - Add 0001-fix-fcollada-error.patch to fix a build failure with gcc10 - Disable LTO on i586. - Add _constraints to avoid build failures due to OOM - Spec file cleanup: * Use https for Url and Source tags * Remove defattr * Remove __DATE__ mangling, handled by GCC + SOURCE_DATE_EPOCH * Remove support for Leap 42.x, unresolvable anyway - Update to 0.0.23b: See https://play0ad.com/re-release-of-0-a-d-alpha-23-ken-wood/ - Update to 0.0.23: See https://play0ad.com/new-release-0-a-d-alpha-23-ken-wood/ - Remove fix_abs_of_unsigned_char_on_arm.patch: upstreamed - Remove system-tinygettext.patch: Upstream thinks this might lead to problems See https://trac.wildfiregames.com/ticket/4192 - Add BuildReq libsodium and remove tinygettext to use shipped one - Keep fix_abs_of_unsigned_char_on_arm.patch intact and disable the conflicting/irrelevant hunk in the spec file - Revert the changes to use bundled mozjs38 on Leap 42.3 again (no changelog entry), it does not build on 42.3. Use fixed mozjs38 from distribution instead. - Add fix_abs_of_unsigned_char_on_arm.patch, fixes build on 32/64 bit ARM (and probably PPC) - Enable nvidia-texture-tools only on supported archs - Use system mozjs38, bundled one fails to build on TW - Remove special handling for Leap 42.1 - Pass compiler flags to bundled Collada - Stop depending on boost-devel (boo#1062766) - Build with system nvidia-texture-tools (boo#1053393) - Update to version 0.0.22: + Remake of many models, animations and textures, two new music tracks. + Configuration-free Multiplayer Hosting. + Capture the Relic Gamemode. + Aura and Heal Range Visualization. + Twelve new maps, including scripted enemies, rising water and a tutorial. + Espionage Technology, Team Bonuses and Hero Auras. + Petra AI Diplomacy and Attack Strategies. + Summary Screen Graphs. + Cinema Path Editing. + Buddy System. - Drop 0ad-desktop.patch: fixed upstream. - Install the upstream provided appdata.xml file. - Update to version 0.0.21 See: https://play0ad.com/new-release-0-a-d-alpha-21-ulysses/ - Add patch 0ad-desktop.patch because of rpmlint-error invalid- desktopfile invalid key URL - Drop patch fix-c++14-compat.patch because now in upstream - Rebase patch system-tinygettext.patch - Added system-tinygettext.patch - Removed code for other distributions from spec file, sine we just build for openSUSE. - Update License field and trim filler words from description. - Fixed build with gcc6 (Tumbleweed), added fix-c++14-compat.patch - Build with wxWidgets 3 and reenable dependency generation - Update to version 0.0.20 * New maps * Better graphics and Camera See https://play0ad.com/new-release-0-a-d-alpha-20-timosthenes/ - use changelog time instead of build time to fix build-compare - Update to version 0.0.19 - Use xz archive instead of gz - update to version 0.0.18 - use libminiupnpc-devel instead of builtin libminiupnpc - update to version 0.0.17 - use builtin libminiupnpc to work inspite of incompatible OS version - require same versioned data package - build using external libicu - Update to version 0.0.16. - Update to version 0.0.15. - Update to version 0.0.14. - Adhere to https://en.opensuse.org/SourceUrls - Update to version 0.0.13. - Added BuildRequires libXcursor-devel as they are not automatically installed for openSUSE > 12.2 - Update to 0.0.12 - Remove obsolete unused Debian build scripts - Update to 0.0.11 - New version number scheme - Remove fam/gamin dependency - Update to r11863 - Update to r11339 - Update to r10803 - Update to r10288 - Update to r9786 - libenet0-devel -> libenet-devel - Update to r9530 - libenet-devel -> libenet0-devel - Update to r9049 - wxGTK -> wxWidgets migration - Update to r8832 - Update to r8413 - Update to r7970 - Compile in Release mode - Initial package OBS-URL: https://build.opensuse.org/request/show/824972 OBS-URL: https://build.opensuse.org/package/show/games/0ad?expand=0&rev=103 --- ...ion-for-ShaderModelRendererInternals.patch | 89 +++++++++++++++++++ 0ad.changes | 11 ++- 0ad.spec | 44 ++++----- avoid_duplicate_global_symbol_from_asm.patch | 31 +++++++ 4 files changed, 146 insertions(+), 29 deletions(-) create mode 100644 0001-Fix-ODR-violation-for-ShaderModelRendererInternals.patch create mode 100644 avoid_duplicate_global_symbol_from_asm.patch diff --git a/0001-Fix-ODR-violation-for-ShaderModelRendererInternals.patch b/0001-Fix-ODR-violation-for-ShaderModelRendererInternals.patch new file mode 100644 index 0000000..f18face --- /dev/null +++ b/0001-Fix-ODR-violation-for-ShaderModelRendererInternals.patch @@ -0,0 +1,89 @@ +From d5ac9cf91b3e7e6c48c7baf961ebf78fad446a21 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Stefan=20Br=C3=BCns?= +Date: Mon, 3 Aug 2020 11:00:17 +0200 +Subject: [PATCH] Fix ODR violation for ShaderModelRendererInternals + +ShaderModelRendererInternals is defined twice, once by ModelRenderer.cpp +and once by HWLightingModelRenderer.cpp. Having both in the global +namespace is a violation of the C++ One-Definition-Rule. + +Move both definitions into their "parent" classes. +--- + source/renderer/HWLightingModelRenderer.cpp | 2 +- + source/renderer/HWLightingModelRenderer.h | 3 +-- + source/renderer/ModelRenderer.cpp | 2 +- + source/renderer/ModelRenderer.h | 4 +--- + 4 files changed, 4 insertions(+), 7 deletions(-) + +diff --git a/source/renderer/HWLightingModelRenderer.cpp b/source/renderer/HWLightingModelRenderer.cpp +index 97cb45c..66c83b0 100644 +--- a/source/renderer/HWLightingModelRenderer.cpp ++++ b/source/renderer/HWLightingModelRenderer.cpp +@@ -96,7 +96,7 @@ struct ShaderModel : public CModelRData + }; + + +-struct ShaderModelRendererInternals ++struct ShaderModelVertexRenderer::ShaderModelRendererInternals + { + bool cpuLighting; + +diff --git a/source/renderer/HWLightingModelRenderer.h b/source/renderer/HWLightingModelRenderer.h +index cd89f45..0b99c5d 100644 +--- a/source/renderer/HWLightingModelRenderer.h ++++ b/source/renderer/HWLightingModelRenderer.h +@@ -25,8 +25,6 @@ + + #include "renderer/ModelVertexRenderer.h" + +-struct ShaderModelRendererInternals; +- + /** + * Render animated models using a ShaderRenderModifier. + * This computes and binds per-vertex data; the modifier is responsible +@@ -48,6 +46,7 @@ public: + void RenderModel(const CShaderProgramPtr& shader, int streamflags, CModel* model, CModelRData* data); + + protected: ++ struct ShaderModelRendererInternals; + ShaderModelRendererInternals* m; + }; + +diff --git a/source/renderer/ModelRenderer.cpp b/source/renderer/ModelRenderer.cpp +index 49a86e4..037ce6b 100644 +--- a/source/renderer/ModelRenderer.cpp ++++ b/source/renderer/ModelRenderer.cpp +@@ -203,7 +203,7 @@ void ModelRenderer::BuildIndices( + * Separated into the source file to increase implementation hiding (and to + * avoid some causes of recompiles). + */ +-struct ShaderModelRendererInternals ++struct ShaderModelRenderer::ShaderModelRendererInternals + { + ShaderModelRendererInternals(ShaderModelRenderer* r) : m_Renderer(r) { } + +diff --git a/source/renderer/ModelRenderer.h b/source/renderer/ModelRenderer.h +index eff1b63..a3c7ecd 100644 +--- a/source/renderer/ModelRenderer.h ++++ b/source/renderer/ModelRenderer.h +@@ -245,9 +245,6 @@ public: + static void GenTangents(const CModelDefPtr& mdef, std::vector& newVertices, bool gpuSkinning); + }; + +- +-struct ShaderModelRendererInternals; +- + /** + * Implementation of ModelRenderer that loads the appropriate shaders for + * rendering each model, and that batches by shader (and by mesh and texture). +@@ -270,6 +267,7 @@ public: + virtual void Render(const RenderModifierPtr& modifier, const CShaderDefines& context, int cullGroup, int flags); + + private: ++ struct ShaderModelRendererInternals; + ShaderModelRendererInternals* m; + }; + +-- +2.27.0 + diff --git a/0ad.changes b/0ad.changes index 29b4255..9c6308b 100644 --- a/0ad.changes +++ b/0ad.changes @@ -1,5 +1,14 @@ ------------------------------------------------------------------- -Fri Aug 2 16:00:41 UTC 2020 - Simon Vogl +Mon Aug 3 08:24:07 UTC 2020 - Stefan BrĂ¼ns + +- Fix build on ix86 in combination with LTO, the bundled mbedtls + from premake5 creates duplicate symbols from inline asm. + Add avoid_duplicate_global_symbol_from_asm.patch +- Add 0001-Fix-ODR-violation-for-ShaderModelRendererInternals.patch +- Clean up dozens of unnecessary build dependencies. + +------------------------------------------------------------------- +Sun Aug 2 16:00:41 UTC 2020 - Simon Vogl - Disable --with-system-mozjs38 option on systems which lack the mozjs38 package - Include the libmozjs38-ps-release.so binary on systems which lack the mozjs38 package diff --git a/0ad.spec b/0ad.spec index 8be9c35..fccdd40 100644 --- a/0ad.spec +++ b/0ad.spec @@ -16,12 +16,12 @@ # -# Enable system mozjs38 only on openSUSE versions which provide it +# Enable system mozjs38 only on openSUSE versions which still provide it -%if 0%{?suse_version} <= 1520 -%bcond_without enable_system_mozjs38 +%if 0%{?suse_version} >= 1550 +%bcond_with system_mozjs %else -%bcond_with enable_system_mozjs38 +%bcond_without system_mozjs %endif # Enable NVTT only on arch supported by nvidia-texture-tools @@ -39,11 +39,13 @@ Summary: A real-time strategy game of ancient warfare License: GPL-2.0-or-later AND LGPL-3.0-or-later AND CC-BY-SA-3.0 AND MIT AND ISC AND MPL-2.0 AND BSD-3-Clause Group: Amusements/Games/Strategy/Real Time URL: https://play0ad.com/ -#Source: http://sourceforge.net/projects/zero-ad/files/releases/%{name}-%{version}-alpha-unix-build.tar.xz -# SF is repeatedly not up to date. Let's use their site Source: https://releases.wildfiregames.com/%{name}-%{version}-alpha-unix-build.tar.xz -# PATCH-FIX-OPENSUSE +# PATCH-FIX-UPSTREAM +Patch0: avoid_duplicate_global_symbol_from_asm.patch +# PATCH-FIX-UPSTREAM -- https://trac.wildfiregames.com/changeset/23794/?format=diff Patch1: 0001-fix-fcollada-error.patch +# PATCH-FIX-UPSTREAM +Patch2: 0001-Fix-ODR-violation-for-ShaderModelRendererInternals.patch BuildRequires: cmake BuildRequires: gcc-c++ BuildRequires: libXcursor-devel @@ -52,7 +54,6 @@ BuildRequires: libboost_system-devel BuildRequires: libjpeg-devel BuildRequires: libminiupnpc-devel BuildRequires: libpng-devel -BuildRequires: nasm %if %{with enable_nvtt} BuildRequires: nvidia-texture-tools %endif @@ -67,23 +68,10 @@ BuildRequires: pkgconfig(libcurl) BuildRequires: pkgconfig(libenet) BuildRequires: pkgconfig(libsodium) >= 1.0.13 BuildRequires: pkgconfig(libxml-2.0) -%if %{with enable_system_mozjs38} +%if %{with system_mozjs} BuildRequires: pkgconfig(mozjs-38) %else -BuildRequires: ca-certificates -BuildRequires: coreutils -BuildRequires: fdupes -BuildRequires: libicu-devel -BuildRequires: patterns-devel-perl-devel_perl -BuildRequires: python-devel -BuildRequires: python-distribute -BuildRequires: python-xml -BuildRequires: python2-pip -BuildRequires: python2-setuptools -BuildRequires: readline-devel -BuildRequires: subversion -BuildRequires: zip -BuildRequires: pkgconfig(libffi) +BuildRequires: python2-xml BuildRequires: pkgconfig(nspr) %endif BuildRequires: pkgconfig(openal) @@ -102,12 +90,11 @@ flexible game engine. %prep %setup -q -n %{name}-%{version}-alpha +%patch0 -p1 %patch1 -p1 +%patch2 -p1 %build -%ifarch %ix86 -%define _lto_cflags %{nil} -%endif export CFLAGS="%{optflags}" # bundled Collada uses CCFLAGS export CCFLAGS="%{optflags}" @@ -122,7 +109,7 @@ build/workspaces/update-workspaces.sh \ %else --without-nvtt \ %endif -%if %{with enable_system_mozjs38} +%if %{with system_mozjs} --with-system-mozjs38 \ %endif @@ -135,9 +122,10 @@ install -Dm 0755 binaries/system/ActorEditor %{buildroot}%{_bindir}/ActorEditor install -Dm 0755 binaries/system/pyrogenesis %{buildroot}%{_bindir}/pyrogenesis install -Dm 0755 binaries/system/libCollada.so %{buildroot}%{_libdir}/%{name}/libCollada.so install -Dm 0755 binaries/system/libAtlasUI.so %{buildroot}%{_libdir}/%{name}/libAtlasUI.so -%if %{without enable_system_mozjs38} +%if %{without system_mozjs} install -Dm 0755 binaries/system/libmozjs38-ps-release.so %{buildroot}%{_libdir}/%{name}/libmozjs38-ps-release.so %endif + install -Dm 0644 build/resources/0ad.desktop %{buildroot}%{_datadir}/applications/%{name}.desktop install -Dm 0644 build/resources/0ad.appdata.xml %{buildroot}%{_datadir}/appdata/%{name}.appdata.xml install -Dm 0644 build/resources/0ad.png %{buildroot}%{_datadir}/pixmaps/%{name}.png diff --git a/avoid_duplicate_global_symbol_from_asm.patch b/avoid_duplicate_global_symbol_from_asm.patch new file mode 100644 index 0000000..b4e8c3a --- /dev/null +++ b/avoid_duplicate_global_symbol_from_asm.patch @@ -0,0 +1,31 @@ +From 6872cc5f672da6fce5facebf697415208fe34b12 Mon Sep 17 00:00:00 2001 +From: StefanBruens +Date: Fri, 1 Nov 2019 21:07:33 +0100 +Subject: [PATCH] Use local label in inline asm, avoid symbol duplication + +The global label "unsupported" may lead to duplicated symbols +when the function is inlined in multiple places. This may happen +in any case, but using LTO exposes this problem reliably. + +See https://github.com/ARMmbed/mbed-crypto/issues/312 +--- + build/premake/premake5/contrib/mbedtls/library/padlock.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/build/premake/premake5/contrib/mbedtls/library/padlock.c b/build/premake/premake5/contrib/mbedtls/library/padlock.c +index b85ff9cd2c..bb0a1ef419 100644 +--- a/build/premake/premake5/contrib/mbedtls/library/padlock.c ++++ b/build/premake/premake5/contrib/mbedtls/library/padlock.c +@@ -58,10 +58,10 @@ int mbedtls_padlock_has_support( int feature ) + "cpuid \n\t" + "cmpl $0xC0000001, %%eax \n\t" + "movl $0, %%edx \n\t" +- "jb unsupported \n\t" ++ "jb 1f \n\t" + "movl $0xC0000001, %%eax \n\t" + "cpuid \n\t" +- "unsupported: \n\t" ++ "1: \n\t" + "movl %%edx, %1 \n\t" + "movl %2, %%ebx \n\t" + : "=m" (ebx), "=m" (edx)