Add Theora as a dependency in libretro builds

This commit is contained in:
刘皓 2025-05-03 13:46:17 -04:00
parent a0219e7c79
commit 23bc6625f1
No known key found for this signature in database
GPG key ID: 7901753DB465B711
8 changed files with 167 additions and 3 deletions

View file

@ -278,6 +278,14 @@ if is_libretro
'zlib': 'disabled',
}
global_dependencies += subproject('freetype', default_options: freetype_options).get_variable('freetype_dep')
theora_options = {
'cflags': global_args,
'cppflags': global_args,
'default_library': 'static',
'b_staticpic': use_pic,
}
global_dependencies += subproject('theora', default_options: theora_options).get_variable('theoradec')
else
physfs = dependency('physfs', version: '>=2.1', static: build_static)
openal = dependency('openal', static: build_static, method: 'pkg-config')

View file

@ -1,4 +1,4 @@
# Prevents FLAC's build system from trying to look for Ogg externally since Meson already handles that.
# Prevents FLAC from trying to look for Ogg externally since Meson already handles that.
--- a/src/libFLAC/include/private/ogg_decoder_aspect.h
+++ b/src/libFLAC/include/private/ogg_decoder_aspect.h

View file

@ -1,2 +1,2 @@
project('opengl-registry', 'c', meson_version: '>=1.3.0')
opengl_registry = declare_dependency(include_directories: 'api', dependencies: [subproject('egl-registry').get_variable('egl_registry')])
opengl_registry = declare_dependency(include_directories: 'api', dependencies: subproject('egl-registry').get_variable('egl_registry'))

View file

@ -0,0 +1,121 @@
# Prevents Theora from trying to look for Ogg externally since Meson already handles that.
--- a/include/theora/codec.h
+++ b/include/theora/codec.h
@@ -63,7 +63,7 @@
#if !defined(OGG_THEORA_CODEC_HEADER)
# define OGG_THEORA_CODEC_HEADER (1)
-# include <ogg/ogg.h>
+# include "../../../ogg/include/ogg/ogg.h"
#if defined(__cplusplus)
extern "C" {
--- a/include/theora/theora.h
+++ b/include/theora/theora.h
@@ -24,7 +24,7 @@ extern "C"
#include <stddef.h> /* for size_t */
-#include <ogg/ogg.h>
+#include "../../../ogg/include/ogg/ogg.h"
/** \file
* The libtheora pre-1.0 legacy C API.
--- a/include/theora/theoradec.h
+++ b/include/theora/theoradec.h
@@ -20,7 +20,7 @@
#if !defined(OGG_THEORA_THEORADEC_HEADER)
# define OGG_THEORA_THEORADEC_HEADER (1)
# include <stddef.h>
-# include <ogg/ogg.h>
+# include "../../../ogg/include/ogg/ogg.h"
# include "codec.h"
#if defined(__cplusplus)
--- a/include/theora/theoraenc.h
+++ b/include/theora/theoraenc.h
@@ -20,7 +20,7 @@
#if !defined(OGG_THEORA_THEORAENC_HEADER)
# define OGG_THEORA_THEORAENC_HEADER (1)
# include <stddef.h>
-# include <ogg/ogg.h>
+# include "../../../ogg/include/ogg/ogg.h"
# include "codec.h"
#if defined(__cplusplus)
--- a/lib/apiwrapper.h
+++ b/lib/apiwrapper.h
@@ -17,7 +17,7 @@
#if !defined(_apiwrapper_H)
# define _apiwrapper_H (1)
-# include <ogg/ogg.h>
+# include "../../ogg/include/ogg/ogg.h"
# include <theora/theora.h>
# include "theora/theoradec.h"
# include "theora/theoraenc.h"
--- a/lib/decode.c
+++ b/lib/decode.c
@@ -17,7 +17,7 @@
#include <stdlib.h>
#include <string.h>
-#include <ogg/ogg.h>
+#include "../../ogg/include/ogg/ogg.h"
#include "decint.h"
#if defined(OC_DUMP_IMAGES)
# include <stdio.h>
--- a/lib/dequant.c
+++ b/lib/dequant.c
@@ -17,7 +17,7 @@
#include <stdlib.h>
#include <string.h>
-#include <ogg/ogg.h>
+#include "../../ogg/include/ogg/ogg.h"
#include "dequant.h"
#include "decint.h"
--- a/lib/huffdec.c
+++ b/lib/huffdec.c
@@ -17,7 +17,7 @@
#include <stdlib.h>
#include <string.h>
-#include <ogg/ogg.h>
+#include "../../ogg/include/ogg/ogg.h"
#include "huffdec.h"
#include "decint.h"
--- a/lib/huffenc.c
+++ b/lib/huffenc.c
@@ -1,6 +1,6 @@
#include <stdlib.h>
#include <string.h>
-#include <ogg/ogg.h>
+#include "../../ogg/include/ogg/ogg.h"
#include "huffenc.h"
--- a/lib/mathops.h
+++ b/lib/mathops.h
@@ -1,6 +1,6 @@
#if !defined(_mathops_H)
# define _mathops_H (1)
-# include <ogg/ogg.h>
+# include "../../ogg/include/ogg/ogg.h"
# if __GNUC_PREREQ(3,4)
# include <limits.h>
--- a/lib/quant.c
+++ b/lib/quant.c
@@ -17,7 +17,7 @@
#include <stdlib.h>
#include <string.h>
-#include <ogg/ogg.h>
+#include "../../ogg/include/ogg/ogg.h"
#include "quant.h"
#include "decint.h"

View file

@ -0,0 +1,27 @@
project('theora', 'c', meson_version: '>=1.3.0')
theoradec = declare_dependency(
include_directories: 'include',
link_with: library(
'theoradec',
c_args: get_option('cflags'),
include_directories: 'include',
sources: [
'lib/apiwrapper.c',
'lib/bitpack.c',
'lib/decapiwrapper.c',
'lib/decinfo.c',
'lib/decode.c',
'lib/dequant.c',
'lib/fragment.c',
'lib/huffdec.c',
'lib/idct.c',
'lib/info.c',
'lib/internal.c',
'lib/quant.c',
'lib/state.c',
],
pic: get_option('b_staticpic'),
gnu_symbol_visibility: 'hidden',
),
)

View file

@ -0,0 +1,2 @@
option('cflags', type: 'array', value: [])
option('cppflags', type: 'array', value: [])

View file

@ -1,4 +1,4 @@
# Prevents Vorbis's build system from trying to look for Ogg externally since Meson already handles that.
# Prevents Vorbis from trying to look for Ogg externally since Meson already handles that.
--- a/CMakeLists.txt
+++ b/CMakeLists.txt

6
subprojects/theora.wrap Normal file
View file

@ -0,0 +1,6 @@
[wrap-git]
url = https://github.com/xiph/theora
revision = v1.2.0
depth = 1
patch_directory = theora
diff_files = theora-deps.patch