On Sat, 30 Jan 2021 20:40:58 +0100
Charlene Wendling <[email protected]> wrote:
> Hi,
>
> On top of failing with `-fno-common', xmj does not work at all, here
> on my amd64 machine:
>
> $ doas pkg_add xmj
> $ xmj
> Segmentation Fault
>
> So, here is an update for the 20 years old xmj 1.0, to 2020's 1.16.
> There are major upstream changes, notably they dropped Imake (yay!),
> and xmj is now gtk+2 based. This fixes the -fno-common failure ootb.
>
> Port changes:
>
> - Update license marker, refresh WANTLIB (ports-lib-depends-check is
> happy)
> - Use up to date HOMEPAGE and MASTER_SITES (found out thanks to
> Macports and repology)
> - Requires gmake.
> - Install the manpages
>
>
> Testing:
>
> - It builds fine on macppc (vanilla clang) and amd64 (modified with
> naddy's patch)
> - The runtime is great on these 2 platforms. I tried networked games
> without issues.
>
> Comments/feedback are welcome,
>
> Charlène.
^ edited; i was looking at my backlog and took into account what sthen
told me about MAKE_FLAGS, making the diff way smaller :)
I accidentally built xmj with gcc and met the infamous "C99 styled
declarations in for loops" error, so it will require gnu99 on base-gcc
archs. This still builds and works fine with clang on macppc and amd64,
with that flag, so i have not brought bsd.port.arch.mk.
Index: Makefile
===================================================================
RCS file: /cvs/ports/games/xmj/Makefile,v
retrieving revision 1.25
diff -u -p -u -p -r1.25 Makefile
--- Makefile 12 Jul 2019 20:46:27 -0000 1.25
+++ Makefile 5 Feb 2021 01:50:14 -0000
@@ -2,22 +2,37 @@
COMMENT= Mahjongg game for X11
-DISTNAME= xmj
-PKGNAME= xmj-1.0
-REVISION = 3
+DISTNAME= mj-1.16-src
+PKGNAME= x${DISTNAME:S/-src$//}
+
CATEGORIES= games
-# BSD
+HOMEPAGE= https://mahjong.julianbradfield.org/
+
+# GPLv2
PERMIT_PACKAGE= Yes
-WANTLIB= X11 Xau Xdmcp Xext c xcb
+WANTLIB += X11 Xcomposite Xcursor Xdamage Xext Xfixes Xi Xinerama
+WANTLIB += Xrandr Xrender atk-1.0 c cairo fontconfig freetype
+WANTLIB += gdk-x11-2.0 gdk_pixbuf-2.0 gio-2.0 glib-2.0 gobject-2.0
+WANTLIB += gtk-x11-2.0 harfbuzz intl m pango-1.0 pangocairo-1.0
+WANTLIB += pangoft2-1.0 z
+
+MASTER_SITES= ${HOMEPAGE}/Source/
+
+LIB_DEPENDS= x11/gtk+2
+
+MAKE_FLAGS+= CC="${CC}" EXTRA_CFLAGS="${CFLAGS}" CDEBUGFLAGS=
+# The final '/' matters
+FAKE_FLAGS+= DESTDIR="${WRKINST}${PREFIX}/"
+
+USE_GMAKE= Yes
-CONFIGURE_STYLE=imake noman
NO_TEST= Yes
-pre-configure:
- @perl -pi -e 's,_height=,_height ,g;' \
- -e 's,_width=,_width ,g' $i \
- ${WRKSRC}/tiles/c*
+# base-gcc fix for "c99 initial declarations in for loops" error
+CFLAGS+= -std=gnu99
+
+INSTALL_TARGET= install install.man
.include <bsd.port.mk>
Index: distinfo
===================================================================
RCS file: /cvs/ports/games/xmj/distinfo,v
retrieving revision 1.4
diff -u -p -u -p -r1.4 distinfo
--- distinfo 18 Jan 2015 03:14:04 -0000 1.4
+++ distinfo 5 Feb 2021 01:50:14 -0000
@@ -1,2 +1,2 @@
-SHA256 (xmj.tar.gz) = EGcUMVIKBYSp3BJHqnYPM988WHP7G7IVgN//NK7xhyg=
-SIZE (xmj.tar.gz) = 52255
+SHA256 (mj-1.16-src.tar.gz) = wl6YSPSfcGNeXjugy1l5nlvBSalfeGYhuZaWtmeHop0=
+SIZE (mj-1.16-src.tar.gz) = 403981
Index: patches/patch-Imakefile
===================================================================
RCS file: patches/patch-Imakefile
diff -N patches/patch-Imakefile
--- patches/patch-Imakefile 27 Oct 2007 13:32:05 -0000 1.1
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,9 +0,0 @@
-$OpenBSD: patch-Imakefile,v 1.1 2007/10/27 13:32:05 ajacoutot Exp $
---- Imakefile.orig Fri May 5 16:46:04 1989
-+++ Imakefile Sat Oct 27 15:15:14 2007
-@@ -4,4 +4,4 @@ LOCAL_LIBRARIES = $(XLIB)
- OBJS = bicons.o cicons.o cicons1.o cicons2.o cicons3.o cicons4.o \
- cicons5.o event.o icons.o mj.o nicons.o
-
--ComplexProgramTarget(xmj)
-+ComplexProgramTargetNoMan(xmj)
Index: patches/patch-event_c
===================================================================
RCS file: patches/patch-event_c
diff -N patches/patch-event_c
--- patches/patch-event_c 19 Apr 2017 22:02:45 -0000 1.1
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,11 +0,0 @@
-$OpenBSD: patch-event_c,v 1.1 2017/04/19 22:02:45 espie Exp $
---- event.c.orig Thu Apr 20 00:00:59 2017
-+++ event.c Thu Apr 20 00:01:22 2017
-@@ -599,6 +599,7 @@ void board_num_proc()
- place_tiles(FALSE);
- }
-
-+void
- msg_event_proc(event)
- XEvent *event;
- {
Index: pkg/PLIST
===================================================================
RCS file: /cvs/ports/games/xmj/pkg/PLIST,v
retrieving revision 1.2
diff -u -p -u -p -r1.2 PLIST
--- pkg/PLIST 7 Apr 2002 01:54:49 -0000 1.2
+++ pkg/PLIST 5 Feb 2021 01:50:14 -0000
@@ -1,2 +1,7 @@
@comment $OpenBSD: PLIST,v 1.2 2002/04/07 01:54:49 naddy Exp $
-bin/xmj
+@bin bin/mj-player
+@bin bin/mj-server
+@bin bin/xmj
+@man man/man1/mj-player.1
+@man man/man1/mj-server.1
+@man man/man1/xmj.1