From 84f32169ed730eb0244ef01c59aea892ba1d3895 Mon Sep 17 00:00:00 2001 From: Timothy Beyer Date: Mon, 27 Jun 2022 15:09:34 +0800 Subject: emulators/libretro-pcsx2: Fix 32-bit / i386 build PR: 264219 --- emulators/libretro-pcsx2/Makefile | 55 ++++++++++++++-------- .../patch-3rdparty_wxwidgets3.0_UsewxWidgets.cmake | 9 +++- .../libretro-pcsx2/files/patch-libretro_main.cpp | 30 ++++++++++++ 3 files changed, 73 insertions(+), 21 deletions(-) create mode 100644 emulators/libretro-pcsx2/files/patch-libretro_main.cpp diff --git a/emulators/libretro-pcsx2/Makefile b/emulators/libretro-pcsx2/Makefile index 779c89f7d839..e0edd23fb64e 100644 --- a/emulators/libretro-pcsx2/Makefile +++ b/emulators/libretro-pcsx2/Makefile @@ -1,7 +1,8 @@ -# $FreeBSD$ +# Created by: Timothy Beyer PORTNAME= libretro-pcsx2 PORTVERSION= 0.20201030 +PORTREVISION= 1 CATEGORIES= emulators games MAINTAINER= beyert@cs.ucr.edu @@ -10,7 +11,7 @@ COMMENT= Standalone port of pcsx2 to libretro LICENSE= GPLv3 LICENSE_FILE= ${WRKSRC}/COPYING.GPLv3 -ONLY_FOR_ARCHS= >i386 amd64 +ONLY_FOR_ARCHS= amd64 i386 LIB_DEPENDS= libcdio.so:sysutils/libcdio \ libharfbuzz.so:print/harfbuzz \ @@ -18,31 +19,28 @@ LIB_DEPENDS= libcdio.so:sysutils/libcdio \ libportaudio.so:audio/portaudio \ libSoundTouch.so:audio/soundtouch -USES= cmake compiler:c++11-lib +USES= cmake compiler:c++11-lib -CPPFLAGS+= -I${LOCALBASE}/include/wx-3.0 -USE_CXXSTD= c++11 -#LDFLAGS+= -L${LOCALBASE}/lib -I/usr/lib -USE_LDCONFIG= yes +.include + +CPPFLAGS+= -I${LOCALBASE}/include/wx-3.0 +USE_CXXSTD= c++11 +USE_LDCONFIG= yes CMAKE_CPP_FLAGS= ${CPPFLAGS} CMAKE_PREFIX_PATH= ${LOCALBASE}/include/wx-3.0 -CMAKE_C_FLAGS= ${CFLAGS} +CMAKE_C_FLAGS= ${CFLAGS} CMAKE_CXX_FLAGS= ${CFLAGS} -CMAKE_ARGS+= -DLIBRETRO=yes -CMAKE_ARGS+= -Dgtk_INCLUDE_DIR="${LOCALBASE}/include/gtk-3.0" \ - -DwxWidgets_INCLUDE_DIRS="${LOCALBASE}/include/wx-3.0" +CMAKE_ARGS+= -DLIBRETRO=yes +CMAKE_ARGS+= -Dgtk_INCLUDE_DIR="${LOCALBASE}/include/gtk-3.0" \ + -DwxWidgets_INCLUDE_DIRS="${LOCALBASE}/include/wx-3.0" # lib depends on devel/ccache WITH_CCACHE_BUILD= yes HAVE_GTK3= true -#USES= gnome xorg gl sdl dos2unix cmake:insource iconv gettext linux:c7 pkgconfig -#USE_LINUX= libaio -USE_WX= 3.0+ -#USE_XORG= ice x11 xv xext xxf86vm xtst xrandr xi -USE_GL= gl glew glu +USE_WX= 3.0+ +USE_GL= gl glew glu USE_GNOME= glib20 -#USE_SDL= sdl2 MAKE_JOBS_UNSAFE= yes @@ -53,13 +51,30 @@ GH_TAGNAME= 1251fa4 PLIST_FILES= lib/libretro/pcsx2_libretro.so +.if ${ARCH} == i386 +LDFLAGS+= -Wl,-z,notext +.endif + post-patch: - ${CP} files/3rdparty_wxwidgets3.0_src_unix_fswatcher__kqueue.cpp \ + @${CP} files/3rdparty_wxwidgets3.0_src_unix_fswatcher__kqueue.cpp \ ${WRKSRC}/3rdparty/wxwidgets3.0/src/unix/fswatcher_kqueue.cpp +.if ${ARCH} == i386 + @${REINPLACE_CMD} 's|-D_FILE_OFFSET_BITS=64|-D_FILE_OFFSET_BITS=32|' \ + ${WRKSRC}/3rdparty/wxwidgets3.0/UsewxWidgets.cmake +.endif +# filename.cpp first to have 2u + @${REINPLACE_CMD} -e 's|\[0u\]|[0]|' -e 's|\[1u\]|[1]|' \ + -e 's|\[2u\]|[2]|' \ + ${WRKSRC}/3rdparty/wxwidgets3.0/include/wx/filename.h \ + ${WRKSRC}/3rdparty/wxwidgets3.0/src/common/cmdline.cpp \ + ${WRKSRC}/3rdparty/wxwidgets3.0/src/common/fileconf.cpp \ + ${WRKSRC}/3rdparty/wxwidgets3.0/src/common/filefn.cpp \ + ${WRKSRC}/3rdparty/wxwidgets3.0/src/common/filename.cpp \ + ${WRKSRC}/3rdparty/wxwidgets3.0/src/common/variant.cpp do-install: - ${MKDIR} ${STAGEDIR}/${PREFIX}/lib/libretro; + @${MKDIR} ${STAGEDIR}/${PREFIX}/lib/libretro; ${INSTALL_LIB} ${WRKDIR}/.build/pcsx2/pcsx2_libretro.so \ ${STAGEDIR}/${PREFIX}/lib/libretro; -.include +.include diff --git a/emulators/libretro-pcsx2/files/patch-3rdparty_wxwidgets3.0_UsewxWidgets.cmake b/emulators/libretro-pcsx2/files/patch-3rdparty_wxwidgets3.0_UsewxWidgets.cmake index 96b899de88ec..84b8ad354f6d 100644 --- a/emulators/libretro-pcsx2/files/patch-3rdparty_wxwidgets3.0_UsewxWidgets.cmake +++ b/emulators/libretro-pcsx2/files/patch-3rdparty_wxwidgets3.0_UsewxWidgets.cmake @@ -1,6 +1,13 @@ --- 3rdparty/wxwidgets3.0/UsewxWidgets.cmake.orig 2020-10-29 23:31:05 UTC +++ 3rdparty/wxwidgets3.0/UsewxWidgets.cmake -@@ -11,7 +11,7 @@ if(UNIX) +@@ -5,13 +5,13 @@ set(wxWidgets_LIBRARIES wxwidgets) + set(wxWidgets_CXX_FLAGS) + + include_directories(SYSTEM ${wxWidgets_INCLUDE_DIRS}) +-add_definitions(-DwxUSE_GUI=0 -D_FILE_OFFSET_BITS=64) ++add_definitions(-DwxUSE_GUI=0 -D_FILE_OFFSET_BITS=64 -DwxSIZE_T_IS_UINT) + if(UNIX) + add_definitions(-DwxUSE_UNIX -D__UNIX__) if(APPLE) add_definitions(-D__DARWIN__) else() diff --git a/emulators/libretro-pcsx2/files/patch-libretro_main.cpp b/emulators/libretro-pcsx2/files/patch-libretro_main.cpp new file mode 100644 index 000000000000..b6a069f7bec1 --- /dev/null +++ b/emulators/libretro-pcsx2/files/patch-libretro_main.cpp @@ -0,0 +1,30 @@ +--- libretro/main.cpp.orig 2020-10-29 23:31:05 UTC ++++ libretro/main.cpp +@@ -148,6 +148,7 @@ static void RetroLog_DoWriteLn(const wxString& fmt) + RetroLog_DoWrite(fmt + L"\n"); + } + ++/* + static const IConsoleWriter ConsoleWriter_Libretro = + { + RetroLog_DoWrite, +@@ -160,6 +161,7 @@ static const IConsoleWriter ConsoleWriter_Libretro = + + 0, // instance-level indentation (should always be 0) + }; ++*/ + + static std::vector disk_images; + static int image_index = 0; +@@ -244,9 +246,11 @@ void retro_init(void) + if (environ_cb(RETRO_ENVIRONMENT_GET_LOG_INTERFACE, &log)) + { + log_cb = log.log; ++/* + #if 0 + Console_SetActiveHandler(ConsoleWriter_Libretro); + #endif ++*/ + } + + // pcsx2 = new Pcsx2App; -- cgit v1.2.3