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.

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. The Makefile, for a reason i can't explain, is not
  able to properly use path separators, so i forced them at definition
  time, which is easier to deal with that in the different install
  targets.
- Remove some hardcoded stuff (DESTDIR, CC, and -g flag), add our own
  default CFLAGS.
- Install the manpages

Note that this new version does not need fixes for clang 11.

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.


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    30 Jan 2021 19:24:33 -0000
@@ -2,22 +2,33 @@
 
 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_ENV+=     CC="${CC}" EXTRA_CFLAGS="${CFLAGS}"
+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*
+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    30 Jan 2021 19:24:33 -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-Makefile
===================================================================
RCS file: patches/patch-Makefile
diff -N patches/patch-Makefile
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ patches/patch-Makefile      30 Jan 2021 19:24:33 -0000
@@ -0,0 +1,41 @@
+$OpenBSD$
+
+Don't hardcode CC and PREFIX, ensure path separators are properly used,
+and don't build with -g
+
+Index: Makefile
+--- Makefile.orig
++++ Makefile
+@@ -52,10 +52,10 @@ TILESETPATH=NULL
+ # (Don't bother with this on Windows; I don't have an install target
+ # for Windows.)
+ # The binaries go into  $(DESTDIR)$(BINDIR)
+-DESTDIR = /usr/local/
+-BINDIR = bin
++DESTDIR ?= /usr/local/
++BINDIR = /bin
+ # The man pages go into $(DESTDIR)$(MANDIR)
+-MANDIR = man/man1
++MANDIR = /man/man1
+ # and the appropriate suffix is 1
+ MANSUFFIX = 1
+ 
+@@ -72,7 +72,7 @@ MGW=/home/jcb/MinGW
+ # makefile was made by stripping out most of an imake-generated file.
+ 
+ # It's best to use gcc if you can.
+-CC = gcc
++CC ?= cc
+ 
+ # C debugging and optimization flags. 
+ # In development, we turn on all reasonable warnings.
+@@ -85,8 +85,6 @@ CC = gcc
+ # just leave optimization switched off.
+ ifdef Warnings
+ CDEBUGFLAGS = -g -Wall -W -Wstrict-prototypes -Wmissing-prototypes
+-else
+-CDEBUGFLAGS = -g
+ endif
+ # The -Wconversion flag is also useful to detect (more than usual)
+ # abuse of enums, but it generates many superfluous warnings, so
+
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   30 Jan 2021 19:24:33 -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

Reply via email to