[macppc] Unbreak x11/agar/agar

2020-06-13 Thread Charlene Wendling
Hi,

> http://build-failures.rhaalovely.net/powerpc/2020-05-26/x11/agar/agar.log

`rlwimi' needs a 32-bit integer to work with, taken from another
upstream for the same code [0].

Later it breaks with:

> cpuinfo.c:289:23: error: use of undeclared identifier 'IllegalInsn'
> cpuinfo.c:290:14: error: use of undeclared identifier 'jmpbuf'

It did not occur in this ifdef hell back in the gcc days, because unlike
clang, it does not define __ppc__. Dropping AltiVec support fixes the
issue.

With the below diff it builds on macppc, x11/agar/test runs fine.

Comments/feedback are welcome,

Charlène.


[0] https://github.com/DCurrent/openbor/pull/188


Index: Makefile
===
RCS file: /cvs/ports/x11/agar/agar/Makefile,v
retrieving revision 1.5
diff -u -p -u -p -r1.5 Makefile
--- Makefile23 Oct 2017 17:11:03 -  1.5
+++ Makefile14 Jun 2020 06:31:49 -
@@ -3,7 +3,7 @@
 COMMENT =  cross-platform widget toolkit
 
 PKGNAME =  agar-$V
-REVISION = 2
+REVISION = 3
 
 SHARED_LIBS +=  ag_au 0.0 # 5.0
 SHARED_LIBS +=  ag_core   0.0 # 5.0
@@ -28,6 +28,7 @@ LIB_DEPENDS = audio/libsndfile \
 CONFIGURE_ARGS +=  --with-gl=${X11BASE} \
--with-x=${X11BASE} \
--with-portaudio=${LOCALBASE} \
-   --with-sndfile=${LOCALBASE}
+   --with-sndfile=${LOCALBASE} \
+   --with-altivec=no
 
 .include 
Index: patches/patch-core_byteswap_h
===
RCS file: patches/patch-core_byteswap_h
diff -N patches/patch-core_byteswap_h
--- /dev/null   1 Jan 1970 00:00:00 -
+++ patches/patch-core_byteswap_h   14 Jun 2020 06:31:49 -
@@ -0,0 +1,23 @@
+$OpenBSD$
+
+powerpc fix for:
+unsupported inline asm: input with type 'int' matching output with type
+'u_int16_t' (aka 'unsigned short')
+
+Index: core/byteswap.h
+--- core/byteswap.h.orig
 core/byteswap.h
+@@ -37,11 +37,11 @@ AG_Swap16(Uint16 x)
+ static __inline__ Uint16
+ AG_Swap16(Uint16 x)
+ {
+-  Uint16 rv;
++  Uint32 rv;
+   __asm__("rlwimi %0,%2,8,16,23" :
+   "=&r" (rv) :
+   "0" (x >> 8), "r" (x));
+-  return (rv);
++  return (Uint16)(rv);
+ }
+ #else
+ static __inline__ Uint16
Index: pkg/PLIST
===
RCS file: /cvs/ports/x11/agar/agar/pkg/PLIST,v
retrieving revision 1.1.1.1
diff -u -p -u -p -r1.1.1.1 PLIST
--- pkg/PLIST   10 Oct 2016 09:33:17 -  1.1.1.1
+++ pkg/PLIST   14 Jun 2020 06:31:49 -
@@ -34,7 +34,6 @@ include/agar/agar/config/ag_debug_gui.h
 include/agar/agar/config/ag_legacy.h
 include/agar/agar/config/ag_network.h
 include/agar/agar/config/ag_threads.h
-include/agar/agar/config/altivec_cflags.h
 include/agar/agar/config/bindir.h
 include/agar/agar/config/clock_cflags.h
 include/agar/agar/config/clock_libs.h
@@ -406,22 +405,22 @@ include/agar/agar/vg/vg_text.h
 include/agar/agar/vg/vg_tool.h
 include/agar/agar/vg/vg_tools.h
 include/agar/agar/vg/vg_view.h
-lib/libag_au.a
+@static-lib lib/libag_au.a
 lib/libag_au.la
 @lib lib/libag_au.so.${LIBag_au_VERSION}
-lib/libag_core.a
+@static-lib lib/libag_core.a
 lib/libag_core.la
 @lib lib/libag_core.so.${LIBag_core_VERSION}
-lib/libag_dev.a
+@static-lib lib/libag_dev.a
 lib/libag_dev.la
 @lib lib/libag_dev.so.${LIBag_dev_VERSION}
-lib/libag_gui.a
+@static-lib lib/libag_gui.a
 lib/libag_gui.la
 @lib lib/libag_gui.so.${LIBag_gui_VERSION}
-lib/libag_math.a
+@static-lib lib/libag_math.a
 lib/libag_math.la
 @lib lib/libag_math.so.${LIBag_math_VERSION}
-lib/libag_vg.a
+@static-lib lib/libag_vg.a
 lib/libag_vg.la
 @lib lib/libag_vg.so.${LIBag_vg_VERSION}
 @man man/man3/AG_Anim.3



Re: [macppc] Unbreak x11/agar/agar

2020-06-16 Thread Christian Weisgerber
Charlene Wendling:

> > http://build-failures.rhaalovely.net/powerpc/2020-05-26/x11/agar/agar.log
> 
> `rlwimi' needs a 32-bit integer to work with, taken from another
> upstream for the same code [0].

That's the correct fix.

(Although I have to wonder whether that handcrafted optimization
is even worth it, or whether the compiler will produce equivalent
code from the generic C code anyway.)

> Later it breaks with:
> 
> > cpuinfo.c:289:23: error: use of undeclared identifier 'IllegalInsn'
> > cpuinfo.c:290:14: error: use of undeclared identifier 'jmpbuf'

You could fix the #ifdef maze so this attempt at run-time Altivec
detection builds.

Even better, you could add code to query machdep.altivec via sysctl(3)
on OpenBSD.

-- 
Christian "naddy" Weisgerber  na...@mips.inka.de



Re: [macppc] Unbreak x11/agar/agar

2020-06-18 Thread Charlene Wendling
Hi,

On Tue, 16 Jun 2020 22:52:33 +0200
Christian Weisgerber wrote:

> Charlene Wendling:
> 
> > > http://build-failures.rhaalovely.net/powerpc/2020-05-26/x11/agar/agar.log
> > 
> > `rlwimi' needs a 32-bit integer to work with, taken from another
> > upstream for the same code [0].
> 
> That's the correct fix.
> 
> (Although I have to wonder whether that handcrafted optimization
> is even worth it, or whether the compiler will produce equivalent
> code from the generic C code anyway.)
> 
> > Later it breaks with:
> > 
> > > cpuinfo.c:289:23: error: use of undeclared identifier
> > > 'IllegalInsn' cpuinfo.c:290:14: error: use of undeclared
> > > identifier 'jmpbuf'
> 
> You could fix the #ifdef maze so this attempt at run-time Altivec
> detection builds.
> 
> Even better, you could add code to query machdep.altivec via sysctl(3)
> on OpenBSD.
> 
> -- 
> Christian "naddy" Weisgerber
> na...@mips.inka.de
> 

I did that in the attached diff. It appears that running agartest
freezes my PowerBook and trashed my filesystems without a trace
as soon as i start a benchmark, something i did not do originally.

I tried on my Mac mini G4, same result, but the machine is still
usable. With or without AltiVec that is.

I'm gone assessing damages^W^W reinstalling OpenBSD on the PowerBook
now, so i won't be able to test stuff before some days.

As such, the below diff moves HOMEPAGE to https, and at least updates
PLIST. I prefer to mark it BROKEN-powerpc.

Charlène.


Index: Makefile.inc
===
RCS file: /cvs/ports/x11/agar/Makefile.inc,v
retrieving revision 1.2
diff -u -p -u -p -r1.2 Makefile.inc
--- Makefile.inc13 Jul 2019 10:59:27 -  1.2
+++ Makefile.inc18 Jun 2020 15:11:36 -
@@ -1,11 +1,13 @@
 # $OpenBSD: Makefile.inc,v 1.2 2019/07/13 10:59:27 sthen Exp $
 
+BROKEN-powerpc =   agartest causes system freezes
+
 V ?=   1.5.0
 DISTNAME ?=agar-$V
 
 CATEGORIES ?=  x11
 
-HOMEPAGE ?=http://libagar.org/
+HOMEPAGE ?=https://libagar.org/
 
 # BSD
 PERMIT_PACKAGE ?=  Yes
Index: agar/Makefile
===
RCS file: /cvs/ports/x11/agar/agar/Makefile,v
retrieving revision 1.5
diff -u -p -u -p -r1.5 Makefile
--- agar/Makefile   23 Oct 2017 17:11:03 -  1.5
+++ agar/Makefile   18 Jun 2020 15:11:36 -
@@ -3,7 +3,7 @@
 COMMENT =  cross-platform widget toolkit
 
 PKGNAME =  agar-$V
-REVISION = 2
+REVISION = 3
 
 SHARED_LIBS +=  ag_au 0.0 # 5.0
 SHARED_LIBS +=  ag_core   0.0 # 5.0
Index: agar/pkg/PLIST
===
RCS file: /cvs/ports/x11/agar/agar/pkg/PLIST,v
retrieving revision 1.1.1.1
diff -u -p -u -p -r1.1.1.1 PLIST
--- agar/pkg/PLIST  10 Oct 2016 09:33:17 -  1.1.1.1
+++ agar/pkg/PLIST  18 Jun 2020 15:11:36 -
@@ -406,22 +406,22 @@ include/agar/agar/vg/vg_text.h
 include/agar/agar/vg/vg_tool.h
 include/agar/agar/vg/vg_tools.h
 include/agar/agar/vg/vg_view.h
-lib/libag_au.a
+@static-lib lib/libag_au.a
 lib/libag_au.la
 @lib lib/libag_au.so.${LIBag_au_VERSION}
-lib/libag_core.a
+@static-lib lib/libag_core.a
 lib/libag_core.la
 @lib lib/libag_core.so.${LIBag_core_VERSION}
-lib/libag_dev.a
+@static-lib lib/libag_dev.a
 lib/libag_dev.la
 @lib lib/libag_dev.so.${LIBag_dev_VERSION}
-lib/libag_gui.a
+@static-lib lib/libag_gui.a
 lib/libag_gui.la
 @lib lib/libag_gui.so.${LIBag_gui_VERSION}
-lib/libag_math.a
+@static-lib lib/libag_math.a
 lib/libag_math.la
 @lib lib/libag_math.so.${LIBag_math_VERSION}
-lib/libag_vg.a
+@static-lib lib/libag_vg.a
 lib/libag_vg.la
 @lib lib/libag_vg.so.${LIBag_vg_VERSION}
 @man man/man3/AG_Anim.3
Index: test/Makefile
===
RCS file: /cvs/ports/x11/agar/test/Makefile,v
retrieving revision 1.1.1.1
diff -u -p -u -p -r1.1.1.1 Makefile
--- test/Makefile   10 Oct 2016 09:33:17 -  1.1.1.1
+++ test/Makefile   18 Jun 2020 15:11:36 -
@@ -3,6 +3,7 @@
 COMMENT =  interactive test suite for agar
 
 PKGNAME =  agartest-$V
+REVISION = 0
 
 WANTLIB += GL SDL X11 Xinerama ag_core ag_dev ag_gui ag_math c
 WANTLIB += db fontconfig freetype jpeg m png pthread z








agar.ppc.diff
Description: Binary data


Re: [macppc] Unbreak x11/agar/agar

2020-06-20 Thread Christian Weisgerber
Charlene Wendling:

> > Even better, you could add code to query machdep.altivec via sysctl(3)
> > on OpenBSD.
> 
> I did that in the attached diff.

ok naddy@

> It appears that running agartest
> freezes my PowerBook and trashed my filesystems without a trace
> as soon as i start a benchmark, something i did not do originally.

Hmm, that's a kernel problem and not agar's fault, even if it
triggers the problem.

> As such, the below diff moves HOMEPAGE to https, and at least updates
> PLIST. I prefer to mark it BROKEN-powerpc.

I won't object to that.

-- 
Christian "naddy" Weisgerber  na...@mips.inka.de