Created attachment 222892 [details] patch Patch mostly taken from https://src.fedoraproject.org/rpms/0ad/raw/rawhide/f/0ad-ppc64.patch nvtt also needed patching for POWER on FreeBSD.
Note: it might be more correct to add -msse2 only on i386. While it does not break build on powerpc64le (and probably other architectures), it's only relevant on i386 and causes unnecessary warnings where SSE is not available. amd64 enables SSE2 by default anyway.
Created attachment 222900 [details] v2 Corrected patch. Because of endianness issues, port still fails to build on powerpc64.
I have no objection to your patches, I'd like to test them and integrate the sse change you suggest too. Will try to be fast.
BTW upstream stated this version should also work on arm64, but I'm unable to test that.
I have a arm64 notebook, but it doesn't run FreeBSD because there's no video driver yet, so I'd have to use software acceleration... I think mikael@ could test it, he does a lot for ARM.
I suppose aarch64 will need Debug.cpp fix too.
Upstream pointed out they also have a code review for powerpc support. Could you take a look? Just to keep differences at a minimum with their work. https://code.wildfiregames.com/D1619
(In reply to Guido Falsi from comment #7) This patch is quite outdated. E.g. it tries to add support for ppc to spidermonkey, but 0ad has already upgraded to newer spidermonkey with ppc support. It also patches nvtt for altivec support, but 0ad apparently bundles newer nvtt, because I didn't have to patch it for altivec.
I'm ok with this patch, but I have one question, your patch does not remove the BROKEN_powerpc64 flag. Is this intentional? should I remove it?
(In reply to Guido Falsi from comment #9) Yes, it's intentional. There are still endianness issues and big-endian build needs more fixes. For details, look at https://github.com/0ad/0ad/blob/A24/source/simulation2/serialization/BinarySerializer.cpp#L142
Thanks. I'll commit this patch, including the sse2 fix discussed here, later.
A commit references this bug: Author: madpilot Date: Fri Mar 5 18:51:33 UTC 2021 New revision: 567405 URL: https://svnweb.freebsd.org/changeset/ports/567405 Log: - Import patches for powerpc64le - Force the -msse2 option only for i386 where it is actually needed PR: 253924 Submitted by: pkubaj@ Changes: head/games/0ad/Makefile head/games/0ad/files/patch-build_premake_premake5.lua head/games/0ad/files/patch-libraries_source_nvtt_src_src_nvcore_Debug.cpp head/games/0ad/files/patch-source_lib_byte__order.h head/games/0ad/files/patch-source_lib_sysdep_arch.h head/games/0ad/files/patch-source_lib_sysdep_arch_ppc64_ppc64.cpp head/games/0ad/files/patch-source_ps_GameSetup_HWDetect.cpp
Committed. Thanks!