Tuesday, September 24, 2024

UPDATE: ppsspp - FFmpeg

Fix building with newer FFmpeg.


Index: Makefile
===================================================================
RCS file: /cvs/ports/emulators/ppsspp/Makefile,v
retrieving revision 1.28
diff -u -p -u -p -r1.28 Makefile
--- Makefile 9 Jul 2024 14:42:43 -0000 1.28
+++ Makefile 25 Sep 2024 01:56:29 -0000
@@ -5,7 +5,7 @@ COMMENT = Sony PlayStation Portable emul

DISTNAME = ppsspp-$V
V = 1.17.1
-REVISION = 1
+REVISION = 2

SITES = https://github.com/hrydgard/ppsspp/releases/download/v$V/

@@ -49,6 +49,11 @@ CONFIGURE_ARGS = -DUSE_SYSTEM_FFMPEG=ON
-DUSE_DISCORD=OFF \
-DUSE_WAYLAND_WSI=OFF \
-DUSING_EGL=OFF
+
+# workaround for CMake test, to be removed when fixed
+CXXFLAGS += -I${LOCALBASE}/include
+LDFLAGS += -L${LOCALBASE}/lib
+CONFIGURE_ENV = LDFLAGS="${LDFLAGS}"

DEBUG_PACKAGES = ${BUILD_PACKAGES}

Index: patches/patch-CMakeLists_txt
===================================================================
RCS file: /cvs/ports/emulators/ppsspp/patches/patch-CMakeLists_txt,v
retrieving revision 1.15
diff -u -p -u -p -r1.15 patch-CMakeLists_txt
--- patches/patch-CMakeLists_txt 27 Apr 2024 10:57:29 -0000 1.15
+++ patches/patch-CMakeLists_txt 25 Sep 2024 01:56:29 -0000
@@ -1,10 +1,21 @@
+- ffmpeg: Improved fix for checking if const AVCodec* is necessary
+ 930b7f644d74c74d9e58bf8e5300bf9ea9fb78a9
+
- Honor CFLAGS and DEBUG
- Use system libpng on arm platforms

Index: CMakeLists.txt
--- CMakeLists.txt.orig
+++ CMakeLists.txt
-@@ -385,13 +385,13 @@ if(NOT MSVC)
+@@ -117,6 +117,7 @@ if(NOT IOS)
+ endif()
+
+ include(ccache)
++include(CheckCXXSourceCompiles)
+ include(GNUInstallDirs)
+
+ add_definitions(-DASSETS_DIR="${CMAKE_INSTALL_FULL_DATADIR}/ppsspp/assets/")
+@@ -385,13 +386,13 @@ if(NOT MSVC)
endif()
endif()

@@ -22,7 +33,31 @@ Index: CMakeLists.txt
set(CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO} -O2 -g -D_NDEBUG")

# Enable checking printf-like format strings (also works for logging functions)
-@@ -1147,7 +1147,7 @@ else()
+@@ -949,6 +950,23 @@ if(USE_FFMPEG)
+ endif()
+
+ find_package(FFmpeg REQUIRED avcodec avformat avutil swresample swscale)
++ # Check if we need to use avcodec_(alloc|free)_frame instead of av_frame_(alloc|free)
++ # Check if we need to use const AVCodec
++ set(CMAKE_REQUIRED_LIBRARIES avcodec;avformat)
++ set(CMAKE_REQUIRED_FLAGS "-pedantic -Wall -Werror -Wno-unused-variable")
++ check_cxx_source_compiles("extern \"C\" {
++ #include <libavcodec/avcodec.h>
++ #include <libavformat/avformat.h>
++ }
++ static AVCodecContext *s_codec_context = NULL;
++ int main() {
++ const AVCodec *codec = avcodec_find_encoder(s_codec_context->codec_id);
++ return 0;
++ }
++ " HAVE_LIBAVCODEC_CONST_AVCODEC FAIL_REGEX "invalid conversion")
++
++ # Check if we need to use avcodec_alloc_context3 instead of stream->codec
++ # Check if we need to use av_frame_get_buffer instead of avcodec_default_get_buffer
+ endif(USE_FFMPEG)
+
+ find_package(ZLIB)
+@@ -1147,7 +1165,7 @@ else()
endif()

# Arm platforms require at least libpng17.
@@ -31,3 +66,21 @@ Index: CMakeLists.txt
set(PNG_REQUIRED_VERSION 1.7)
else()
set(PNG_REQUIRED_VERSION 1.6)
+@@ -2020,6 +2038,7 @@ add_library(${CoreLibName} ${CoreLinkType}
+ Core/ELF/PrxDecrypter.h
+ Core/ELF/ParamSFO.cpp
+ Core/ELF/ParamSFO.h
++ Core/FFMPEGCompat.h
+ Core/FileSystems/tlzrc.cpp
+ Core/FileSystems/BlobFileSystem.cpp
+ Core/FileSystems/BlobFileSystem.h
+@@ -2354,6 +2373,9 @@ target_compile_features(${CoreLibName} PUBLIC cxx_std_
+
+ if(FFmpeg_FOUND)
+ target_compile_definitions(${CoreLibName} PRIVATE USE_FFMPEG=1)
++ if (HAVE_LIBAVCODEC_CONST_AVCODEC)
++ target_compile_definitions(${CoreLibName} PRIVATE HAVE_LIBAVCODEC_CONST_AVCODEC=1)
++ endif()
+ set_target_properties(${CoreLibName} PROPERTIES NO_SYSTEM_FROM_IMPORTED true)
+ target_include_directories(${CoreLibName} BEFORE PUBLIC ${FFmpeg_INCLUDE_avcodec})
+ target_link_libraries(${CoreLibName}
Index: patches/patch-Core_AVIDump_cpp
===================================================================
RCS file: patches/patch-Core_AVIDump_cpp
diff -N patches/patch-Core_AVIDump_cpp
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ patches/patch-Core_AVIDump_cpp 25 Sep 2024 01:56:29 -0000
@@ -0,0 +1,17 @@
+- ffmpeg: Improved fix for checking if const AVCodec* is necessary
+ 930b7f644d74c74d9e58bf8e5300bf9ea9fb78a9
+
+Index: Core/AVIDump.cpp
+--- Core/AVIDump.cpp.orig
++++ Core/AVIDump.cpp
+@@ -45,9 +45,7 @@ extern "C" {
+ #define av_frame_free avcodec_free_frame
+

No comments:

Post a Comment