Here is an inline diff for updating libretro-pcsx-rearmed to r23,
released on March 14, 2022. r22 was released on Feb 4, 2015 so it has
been a while.

tag:
https://github.com/notaz/pcsx_rearmed/releases/tag/r23

One major change that r23 does is it now supports libchdr through git
submodules. I tweaked the port to link against emulators/libchdr which
provides -lchdr.

see:
https://github.com/notaz/pcsx_rearmed/issues/166

To test, I used retroarch to load several games in chd and zip formats.

Feedback and tests are welcome. OK?

Index: Makefile
===================================================================
RCS file: /cvs/ports/emulators/libretro-pcsx-rearmed/Makefile,v
retrieving revision 1.4
diff -u -p -u -p -r1.4 Makefile
--- Makefile    11 Mar 2022 18:59:37 -0000      1.4
+++ Makefile    10 May 2023 20:30:23 -0000
@@ -1,8 +1,7 @@
 COMMENT =      Sony PlayStation core for retroarch
 
-V =            22
+V =            23
 DISTNAME =     libretro-pcsx-rearmed-$V
-REVISION =     0
 
 GH_ACCOUNT =   notaz
 GH_PROJECT =   pcsx_rearmed
@@ -13,13 +12,18 @@ CATEGORIES =        emulators
 # GPLv2+, LGPLv2.1+
 PERMIT_PACKAGE =       Yes
 
-WANTLIB += m pthread z
+WANTLIB += chdr m pthread z
+
+LIB_DEPENDS =          emulators/libchdr
 
 USE_GMAKE =            Yes
 
 NO_TEST =              Yes
 
 MAKE_FILE =            Makefile.libretro
+
+pre-configure:
+       ${SUBST_CMD} ${WRKSRC}/Makefile
 
 do-install:
        ${INSTALL_DATA_DIR} ${PREFIX}/lib/libretro
Index: distinfo
===================================================================
RCS file: /cvs/ports/emulators/libretro-pcsx-rearmed/distinfo,v
retrieving revision 1.1.1.1
diff -u -p -u -p -r1.1.1.1 distinfo
--- distinfo    19 Oct 2016 07:47:21 -0000      1.1.1.1
+++ distinfo    10 May 2023 20:30:23 -0000
@@ -1,2 +1,2 @@
-SHA256 (libretro-pcsx-rearmed-22.tar.gz) = 
Z7Nplj9OaHtXF5eBlUwse9IDYEcNYNTfC3UvJFmvS2o=
-SIZE (libretro-pcsx-rearmed-22.tar.gz) = 1153355
+SHA256 (libretro-pcsx-rearmed-23.tar.gz) = 
iH6bXue4EV01CZxzA3K0FY/T4hWVWgbWjiCSizOWRq8=
+SIZE (libretro-pcsx-rearmed-23.tar.gz) = 1129836
Index: patches/patch-Makefile
===================================================================
RCS file: /cvs/ports/emulators/libretro-pcsx-rearmed/patches/patch-Makefile,v
retrieving revision 1.2
diff -u -p -u -p -r1.2 patch-Makefile
--- patches/patch-Makefile      11 Mar 2022 18:59:37 -0000      1.2
+++ patches/patch-Makefile      10 May 2023 20:30:23 -0000
@@ -1,10 +1,34 @@
---- Makefile.orig      Mon Oct 17 00:33:15 2016
-+++ Makefile   Mon Oct 17 00:33:40 2016
-@@ -240,9 +240,7 @@ libpcsxcore/gte_nf.o: libpcsxcore/gte.c
+unbundle libchdr and link against emulators/libchdr
+replace git usage with hardcoded revision
+
+Index: Makefile
+--- Makefile.orig
++++ Makefile
+@@ -150,17 +150,9 @@ endif
+ # cdrcimg
+ OBJS += plugins/cdrcimg/cdrcimg.o
+ #ifeq "$(CHD_SUPPORT)" "1"
+-OBJS += libchdr/src/libchdr_bitstream.o
+-OBJS += libchdr/src/libchdr_cdrom.o
+-OBJS += libchdr/src/libchdr_chd.o
+-OBJS += libchdr/src/libchdr_flac.o
+-OBJS += libchdr/src/libchdr_huffman.o
+-OBJS += libchdr/deps/lzma-19.00/src/Alloc.o 
libchdr/deps/lzma-19.00/src/Bra86.o libchdr/deps/lzma-19.00/src/BraIA64.o 
libchdr/deps/lzma-19.00/src/CpuArch.o libchdr/deps/lzma-19.00/src/Delta.o
+-OBJS += libchdr/deps/lzma-19.00/src/LzFind.o 
libchdr/deps/lzma-19.00/src/Lzma86Dec.o libchdr/deps/lzma-19.00/src/LzmaDec.o 
libchdr/deps/lzma-19.00/src/LzmaEnc.o libchdr/deps/lzma-19.00/src/Sort.o
+-CFLAGS += -DHAVE_CHD -Ilibchdr/include
++CFLAGS += -DHAVE_CHD -I${LOCALBASE}/include
+ libpcsxcore/cdriso.o: CFLAGS += -Wno-unused-function
+-libchdr/src/%.o: CFLAGS += -Wno-unused -Ilibchdr/deps/lzma-19.00/include
+-libchdr/deps/lzma-19.00/src/%.o: CFLAGS += -Wno-unused -D_7ZIP_ST 
-Ilibchdr/deps/lzma-19.00/include
++LDFLAGS += -L${LOCALBASE}/lib -lchdr
+ #endif
+ 
+ # dfinput
+@@ -270,9 +262,7 @@ libpcsxcore/gte_nf.o: libpcsxcore/gte.c
        $(CC) -c -o $@ $^ $(CFLAGS) -DFLAGLESS
  
  frontend/revision.h: FORCE
--      @(git describe || echo) | sed -e 's/.*/#define REV "\0"/' > $@_
+-      @(git describe --always || echo) | sed -e 's/.*/#define REV "\0"/' > $@_
 -      @diff -q $@_ $@ > /dev/null 2>&1 || cp $@_ $@
 -      @rm $@_
 +      @echo '#define REV "0"' > $@
Index: patches/patch-libpcsxcore_cdriso_c
===================================================================
RCS file: patches/patch-libpcsxcore_cdriso_c
diff -N patches/patch-libpcsxcore_cdriso_c
--- patches/patch-libpcsxcore_cdriso_c  11 Mar 2022 18:59:37 -0000      1.2
+++ /dev/null   1 Jan 1970 00:00:00 -0000
@@ -1,23 +0,0 @@
-Fix conflict with uncompress2() provided by recent zlib releases.
-
-Index: libpcsxcore/cdriso.c
---- libpcsxcore/cdriso.c.orig
-+++ libpcsxcore/cdriso.c
-@@ -1082,7 +1082,7 @@ static int cdread_sub_mixed(FILE *f, unsigned int base
-       return ret;
- }
- 
--static int uncompress2(void *out, unsigned long *out_size, void *in, unsigned 
long in_size)
-+static int my_uncompress2(void *out, unsigned long *out_size, void *in, 
unsigned long in_size)
- {
-       static z_stream z;
-       int ret = 0;
-@@ -1161,7 +1161,7 @@ static int cdread_compressed(FILE *f, unsigned int bas
-       if (is_compressed) {
-               cdbuffer_size_expect = sizeof(compr_img->buff_raw[0]) << 
compr_img->block_shift;
-               cdbuffer_size = cdbuffer_size_expect;
--              ret = uncompress2(compr_img->buff_raw[0], &cdbuffer_size, 
compr_img->buff_compressed, size);
-+              ret = my_uncompress2(compr_img->buff_raw[0], &cdbuffer_size, 
compr_img->buff_compressed, size);
-               if (ret != 0) {
-                       SysPrintf("uncompress failed with %d for block %d, 
sector %d\n",
-                                       ret, block, sector);
Index: patches/patch-plugins_cdrcimg_cdrcimg_c
===================================================================
RCS file: patches/patch-plugins_cdrcimg_cdrcimg_c
diff -N patches/patch-plugins_cdrcimg_cdrcimg_c
--- patches/patch-plugins_cdrcimg_cdrcimg_c     11 Mar 2022 18:59:37 -0000      
1.2
+++ /dev/null   1 Jan 1970 00:00:00 -0000
@@ -1,23 +0,0 @@
-Fix conflict with uncompress2() provided by recent zlib releases.
-
-Index: plugins/cdrcimg/cdrcimg.c
---- plugins/cdrcimg/cdrcimg.c.orig
-+++ plugins/cdrcimg/cdrcimg.c
-@@ -98,7 +98,7 @@ static long CDRgetTD(unsigned char track, unsigned cha
-       return 0;
- }
- 
--int uncompress2(void *out, unsigned long *out_size, void *in, unsigned long 
in_size)
-+int my_uncompress2(void *out, unsigned long *out_size, void *in, unsigned 
long in_size)
- {
-       static z_stream z;
-       int ret = 0;
-@@ -199,7 +199,7 @@ static long CDRreadTrack(unsigned char *time)
-               ret = uncompress(cdbuffer->raw[0], &cdbuffer_size, 
cdbuffer->compressed, size);
-               break;
-       case CDRC_ZLIB2:
--              ret = uncompress2(cdbuffer->raw[0], &cdbuffer_size, 
cdbuffer->compressed, size);
-+              ret = my_uncompress2(cdbuffer->raw[0], &cdbuffer_size, 
cdbuffer->compressed, size);
-               break;
-       case CDRC_BZ:
-               ret = pBZ2_bzBuffToBuffDecompress((char *)cdbuffer->raw, 
(unsigned int *)&cdbuffer_size,
Index: pkg/PLIST
===================================================================
RCS file: /cvs/ports/emulators/libretro-pcsx-rearmed/pkg/PLIST,v
retrieving revision 1.2
diff -u -p -u -p -r1.2 PLIST
--- pkg/PLIST   11 Mar 2022 18:59:37 -0000      1.2
+++ pkg/PLIST   10 May 2023 20:30:23 -0000
@@ -1,2 +1,2 @@
 lib/libretro/
-lib/libretro/pcsx_rearmed_libretro.so
+@so lib/libretro/pcsx_rearmed_libretro.so

Reply via email to