Re: FIX & UPDATE: games/tome4
Punting stupid problems along forever just gets worse and worse. In a decade, what will this mess look like? It's so complicated someone is going to break it in a different way. > On Wed, Aug 09, 2017 at 04:21:34PM -0600, Theo de Raadt wrote: > > That type of diff dissapoints me. Upstreams should be told to follow API, > > rather than ABI. > > The real upstream of this uLong nonsense is zlib.net. They're not going > to change it for me. And it wouldn't solve the issue of libpng linking > against the wrong zlib. > > Here is a different approach, filtering out all clashing symbols. > > This seems to work great and is pretty unobtrusive, even if it's not all > that elegant. > > 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 - 1.7 > +++ Makefile 11 Aug 2017 21:52:39 - > @@ -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 - 1.2 > +++ distinfo 11 Aug 2017 21:52:39 - > @@ -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-build_exclude-zlib_ld > === > RCS file: patches/patch-build_exclude-zlib_ld > diff -N patches/patch-build_exclude-zlib_ld > --- /dev/null 1 Jan 1970 00:00:00 - > +++ patches/patch-build_exclude-zlib_ld 11 Aug 2017 21:52:39 - > @@ -0,0 +1,28 @@ > +$OpenBSD$ > + > +Fix black screen on 32bit archs because of zlib struct size mismatch > affecting > +libpng and SDL2. > + > +Hide libz symbols of newer copy provided with the game. > + > + > +Index: build/exclude-zlib.ld > +--- build/exclude-zlib.ld.orig > build/exclude-zlib.ld > +@@ -0,0 +1,16 @@ > ++TOME { > ++local: > ++adler32; adler32_combine; compress; compress2; compressBound; > ++crc32; crc32_combine; deflate; deflateBound; deflateCopy; > ++deflateEnd; deflateInit2_; deflateInit_; deflateParams; > ++deflatePrime; deflateReset; deflateSetDictionary; > ++deflateSetHeader; deflateTune; get_crc_table; gzclearerr; > ++gzclose; gzdirect; gzdopen; gzeof; gzerror; gzflush; gzgetc; > ++gzgets; gzopen; gzprintf; gzputc; gzputs; gzread; gzrewind; > ++gzseek; gzsetparams; gztell; gzungetc; gzwrite; inflate; > ++inflateBack; inflateBackEnd; inflateBackInit_; inflateCopy; > ++inflateEnd; inflateGetHeader; inflateInit2_; inflateInit_; > ++inflatePrime; inflateReset; inflateSetDictionary; inflateSync; > ++inflateSyncPoint; inflate_fast; inflate_table; uncompress; > ++zError; zcalloc; zcfree; zlibCompileFlags; zlibVersion; > ++}; > Index: patches/patch-build_te4core_lua > === > RCS file: > /home/vcs/cvs/openbsd/ports/games/tome4/patches/patch-build_te4core_lua,v > retrieving revision 1.1.1.1 > diff -u -p -r1.1.1.1 patch-build_te4core_lua > --- patches/patch-build_te4core_lua 28 Dec 2016 18:34:57 - 1.1.1.1 > +++ patches/patch-build_te4core_lua 11 Aug 2017 21:52:39 - > @@ -1,6 +1,7 @@ > $OpenBSD: patch-build_te4core_lua,v 1.1.1.1 2016/12/28 18:34:57 awolk Exp $ > build/te4core.lua.orig Fri Dec 2 11:29:13 2016 > -+++ build/te4core.luaFri Dec 2 11:29:23 2016 > +Index: build/te4core.lua > +--- build/te4core.lua.orig > build/te4core.lua > @@ -40,7 +40,7 @@ project "TEngine" > links { "physfs", "lua".._OPTIONS.lua, "fov", "luasocket", > "luaprofiler", "lpeg", "tcodimport", "lxp",
Re: FIX & UPDATE: games/tome4
On Wed, Aug 09, 2017 at 04:21:34PM -0600, Theo de Raadt wrote: > That type of diff dissapoints me. Upstreams should be told to follow API, > rather than ABI. The real upstream of this uLong nonsense is zlib.net. They're not going to change it for me. And it wouldn't solve the issue of libpng linking against the wrong zlib. Here is a different approach, filtering out all clashing symbols. This seems to work great and is pretty unobtrusive, even if it's not all that elegant. Index: Makefile === RCS file: /home/vcs/cvs/openbsd/ports/games/tome4/Makefile,v retrieving revision 1.7 diff -u -p -r1.7 Makefile --- Makefile31 May 2017 08:08:16 - 1.7 +++ Makefile11 Aug 2017 21:52:39 - @@ -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 --- distinfo27 Mar 2017 18:28:29 - 1.2 +++ distinfo11 Aug 2017 21:52:39 - @@ -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-build_exclude-zlib_ld === RCS file: patches/patch-build_exclude-zlib_ld diff -N patches/patch-build_exclude-zlib_ld --- /dev/null 1 Jan 1970 00:00:00 - +++ patches/patch-build_exclude-zlib_ld 11 Aug 2017 21:52:39 - @@ -0,0 +1,28 @@ +$OpenBSD$ + +Fix black screen on 32bit archs because of zlib struct size mismatch affecting +libpng and SDL2. + +Hide libz symbols of newer copy provided with the game. + + +Index: build/exclude-zlib.ld +--- build/exclude-zlib.ld.orig build/exclude-zlib.ld +@@ -0,0 +1,16 @@ ++TOME { ++ local: ++ adler32; adler32_combine; compress; compress2; compressBound; ++ crc32; crc32_combine; deflate; deflateBound; deflateCopy; ++ deflateEnd; deflateInit2_; deflateInit_; deflateParams; ++ deflatePrime; deflateReset; deflateSetDictionary; ++ deflateSetHeader; deflateTune; get_crc_table; gzclearerr; ++ gzclose; gzdirect; gzdopen; gzeof; gzerror; gzflush; gzgetc; ++ gzgets; gzopen; gzprintf; gzputc; gzputs; gzread; gzrewind; ++ gzseek; gzsetparams; gztell; gzungetc; gzwrite; inflate; ++ inflateBack; inflateBackEnd; inflateBackInit_; inflateCopy; ++ inflateEnd; inflateGetHeader; inflateInit2_; inflateInit_; ++ inflatePrime; inflateReset; inflateSetDictionary; inflateSync; ++ inflateSyncPoint; inflate_fast; inflate_table; uncompress; ++ zError; zcalloc; zcfree; zlibCompileFlags; zlibVersion; ++}; Index: patches/patch-build_te4core_lua === RCS file: /home/vcs/cvs/openbsd/ports/games/tome4/patches/patch-build_te4core_lua,v retrieving revision 1.1.1.1 diff -u -p -r1.1.1.1 patch-build_te4core_lua --- patches/patch-build_te4core_lua 28 Dec 2016 18:34:57 - 1.1.1.1 +++ patches/patch-build_te4core_lua 11 Aug 2017 21:52:39 - @@ -1,6 +1,7 @@ $OpenBSD: patch-build_te4core_lua,v 1.1.1.1 2016/12/28 18:34:57 awolk Exp $ build/te4core.lua.orig Fri Dec 2 11:29:13 2016 -+++ build/te4core.lua Fri Dec 2 11:29:23 2016 +Index: build/te4core.lua +--- build/te4core.lua.orig build/te4core.lua @@ -40,7 +40,7 @@ project "TEngine" links { "physfs", "lua".._OPTIONS.lua, "fov", "luasocket", "luaprofiler", "lpeg", "tcodimport", "lxp", "expatstatic", "luamd5", "luazlib", "luabitop", "te4-bzip" } defines { "_DEFAULT_VIDEOMODE_FLAGS_='SDL_HWSURFACE|SDL_DOUBLEBUF'" } @@ -10,3 +11,11 @@ $OpenBSD: patch-build_te4core_lua,v 1.1. if _OPTIONS.relpath=="32" then linkoptions{"-Wl,-rpath -Wl,\\\$\$ORIGIN/lib "} end if _OPTIONS.relpath=="64" then linkoptions{"-Wl,-rpath
Re: FIX & UPDATE: games/tome4
That type of diff dissapoints me. Upstreams should be told to follow API, rather than ABI. >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 - 1.7 >+++ Makefile 9 Aug 2017 21:53:50 - >@@ -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 - 1.2 >+++ distinfo 9 Aug 2017 21:53:50 - >@@ -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 - >+++ patches/patch-src_zlib_zlib_h 9 Aug 2017 21:53:50 - >@@ -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 */ >+-uLongtotal_in; /* total number of input bytes read so far */ >++z_off_ttotal_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 */ >+-uLongtotal_out; /* total number of bytes output so far */ >++z_off_ttotal_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 */ > >
FIX & UPDATE: games/tome4
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 --- Makefile31 May 2017 08:08:16 - 1.7 +++ Makefile9 Aug 2017 21:53:50 - @@ -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 --- distinfo27 Mar 2017 18:28:29 - 1.2 +++ distinfo9 Aug 2017 21:53:50 - @@ -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 - +++ patches/patch-src_zlib_zlib_h 9 Aug 2017 21:53:50 - @@ -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 */ +-uLongtotal_in; /* total number of input bytes read so far */ ++z_off_ttotal_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 */ +-uLongtotal_out; /* total number of bytes output so far */ ++z_off_ttotal_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 */