Looking through the bulk build reports, this game sticks out as failing
all over the place.

Let's fix it.

* Limit luajit use to supported mainstream archs
* Apply gross zlib band aid to make it work on 32bit archs. No it can't
  just use base zlib, I've tried.
* Update to the latest version while I'm at it..

You can now play ToME on i386, powerpc and possibly sparc64.

Index: Makefile
===================================================================
RCS file: /home/vcs/cvs/openbsd/ports/games/tome4/Makefile,v
retrieving revision 1.7
diff -u -p -r1.7 Makefile
--- Makefile    31 May 2017 08:08:16 -0000      1.7
+++ Makefile    9 Aug 2017 21:53:50 -0000
@@ -5,7 +5,7 @@ COMMENT-data =  data for Tales of Maj'Eya
 
 # '
 
-V =            1.5.1
+V =            1.5.5
 PKGNAME-main = tome4-${V}
 PKGNAME-data = tome4-data-${V}
 CATEGORIES =   games x11
@@ -42,6 +42,10 @@ WANTLIB-data =
 COMPILER =     gcc
 COMPILER_LANGS =       c
 
+# Disable luajit support where broken and missing. See also lang/luajit
+.if ${MACHINE_ARCH} != "i386" && ${MACHINE_ARCH} != "amd64"
+CONFIGURE_ARGS += --lua=default
+.endif
 
 NO_TEST =      Yes
 
@@ -57,7 +61,7 @@ do-configure:
        sed -i 's/gcc /${CC} /g' ${WRKSRC}/build/te4core.lua
        ${SUBST_CMD} ${WRKSRC}/src/getself.c
        ${SUBST_CMD} ${WRKSRC}/premake4.lua
-       @cd ${WRKSRC} ; premake4 gmake
+       cd ${WRKSRC} ; premake4 ${CONFIGURE_ARGS} gmake
 
 do-install:
        ${INSTALL_PROGRAM} ${WRKSRC}/t-engine ${PREFIX}/bin/tome4
Index: distinfo
===================================================================
RCS file: /home/vcs/cvs/openbsd/ports/games/tome4/distinfo,v
retrieving revision 1.2
diff -u -p -r1.2 distinfo
--- distinfo    27 Mar 2017 18:28:29 -0000      1.2
+++ distinfo    9 Aug 2017 21:53:50 -0000
@@ -1,2 +1,2 @@
-SHA256 (t-engine4-src-1.5.1.tar.bz2) = 
er5VbR72iQ0WrlO4KSwQWSVDopR6QCS7mjtnARp00Lg=
-SIZE (t-engine4-src-1.5.1.tar.bz2) = 421336208
+SHA256 (t-engine4-src-1.5.5.tar.bz2) = 
A3zO5JMhPF4gdJ00gfVnbwUJlbtop7vYCu23fV17WGw=
+SIZE (t-engine4-src-1.5.5.tar.bz2) = 421330688
Index: patches/patch-src_zlib_zlib_h
===================================================================
RCS file: patches/patch-src_zlib_zlib_h
diff -N patches/patch-src_zlib_zlib_h
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ patches/patch-src_zlib_zlib_h       9 Aug 2017 21:53:50 -0000
@@ -0,0 +1,27 @@
+$OpenBSD$
+
+There is an ugly mishmash of base zlib and a newer internal copy in this game.
+
+To give 32 bit archs a fighting chance, make sure at least the struct layout is
+compatible.
+
+Without this fix, the screen will stay black since libpng can't load any
+assets.
+
+Index: src/zlib/zlib.h
+--- src/zlib/zlib.h.orig
++++ src/zlib/zlib.h
+@@ -85,11 +85,11 @@ struct internal_state;
+ typedef struct z_stream_s {
+     z_const Bytef *next_in;     /* next input byte */
+     uInt     avail_in;  /* number of bytes available at next_in */
+-    uLong    total_in;  /* total number of input bytes read so far */
++    z_off_t    total_in;  /* total number of input bytes read so far */
+ 
+     Bytef    *next_out; /* next output byte should be put there */
+     uInt     avail_out; /* remaining free space at next_out */
+-    uLong    total_out; /* total number of bytes output so far */
++    z_off_t    total_out; /* total number of bytes output so far */
+ 
+     z_const char *msg;  /* last error message, NULL if no error */
+     struct internal_state FAR *state; /* not visible by applications */

Reply via email to