Thursday, July 29, 2021

[macppc] Unbreak lang/gforth

Hi,

After the libffi fix i've just sent to ports@ and that is needed on top
of that diff, gforth needs some tweaks to build on macppc.

By default it runs out of memory. So i tried to

- use i386 patches: it runs out of memory
- build everything with -O1: it runs out of memory
- build everything with -O0: preforth segfaults

Finally, i managed to make it with ports-gcc and building with -O0 due to
memory usage [0]. It's also _way_ faster to build than with base-clang.

No REVISION bump is needed, it's broken since base-clang's introduction,
_SYSTEM_VERSION-powerpc has been bumped since then, and this diff only
impacts macppc.

The test suite is very light, so i tried several example of forth code
found on the web without issues.

Comments/feedback are welcome,

Charlène.


[0] https://bin.charlenew.xyz/gforth-0.7.3p3.log


Index: Makefile
===================================================================
RCS file: /cvs/ports/lang/gforth/Makefile,v
retrieving revision 1.25
diff -u -p -u -p -r1.25 Makefile
--- Makefile 12 Jul 2019 20:47:18 -0000 1.25
+++ Makefile 29 Jul 2021 14:09:53 -0000
@@ -42,6 +42,17 @@ SUBST_VARS += KERNEL V
PATCH_LIST = patch-* patch_i386-*
.endif

+# With base-clang on powerpc it either run out of memory with i386 patches or
+# -O1. Using -O0 makes preforth segfault. Use ports-gcc instead.
+MODULES += gcc4
+MODGCC4_ARCHS = powerpc
+MODGCC4_LANGS = c
+
+# We still need -O0 due to high memory usage though.
+.if ${MACHINE_ARCH} == "powerpc"
+CFLAGS += -O0
+.endif
+
.include <bsd.port.arch.mk>

# The filename of the gForth kernel is based on the wordsize

No comments:

Post a Comment