Bug 253924 - games/0ad: fix build on powerpc64le
Summary: games/0ad: fix build on powerpc64le
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: powerpc Any
: --- Affects Only Me
Assignee: Guido Falsi
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-03-01 00:52 UTC by Piotr Kubaj
Modified: 2021-03-05 18:53 UTC (History)
3 users (show)

See Also:
madpilot: maintainer-feedback+


Attachments
patch (8.87 KB, patch)
2021-03-01 00:52 UTC, Piotr Kubaj
no flags Details | Diff
v2 (8.31 KB, patch)
2021-03-01 10:00 UTC, Piotr Kubaj
pkubaj: maintainer-approval? (madpilot)
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Piotr Kubaj freebsd_committer freebsd_triage 2021-03-01 00:52:56 UTC
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.
Comment 1 Piotr Kubaj freebsd_committer freebsd_triage 2021-03-01 00:54:41 UTC
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.
Comment 2 Piotr Kubaj freebsd_committer freebsd_triage 2021-03-01 10:00:54 UTC
Created attachment 222900 [details]
v2

Corrected patch. Because of endianness issues, port still fails to build on powerpc64.
Comment 3 Guido Falsi freebsd_committer freebsd_triage 2021-03-01 10:21:49 UTC
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.
Comment 4 Guido Falsi freebsd_committer freebsd_triage 2021-03-01 10:24:59 UTC
BTW upstream stated this version should also work on arm64, but I'm unable to test that.
Comment 5 Piotr Kubaj freebsd_committer freebsd_triage 2021-03-01 13:08:50 UTC
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.
Comment 6 Piotr Kubaj freebsd_committer freebsd_triage 2021-03-01 15:34:27 UTC
I suppose aarch64 will need Debug.cpp fix too.
Comment 7 Guido Falsi freebsd_committer freebsd_triage 2021-03-01 20:22:37 UTC
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
Comment 8 Piotr Kubaj freebsd_committer freebsd_triage 2021-03-01 20:32:26 UTC
(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.
Comment 9 Guido Falsi freebsd_committer freebsd_triage 2021-03-05 09:40:52 UTC
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?
Comment 10 Piotr Kubaj freebsd_committer freebsd_triage 2021-03-05 09:55:43 UTC
(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
Comment 11 Guido Falsi freebsd_committer freebsd_triage 2021-03-05 10:03:51 UTC
Thanks. I'll commit this patch, including the sse2 fix discussed here, later.
Comment 12 commit-hook freebsd_committer freebsd_triage 2021-03-05 18:52:24 UTC
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
Comment 13 Guido Falsi freebsd_committer freebsd_triage 2021-03-05 18:53:06 UTC
Committed. Thanks!