mirror of
https://github.com/ZDoom/zdoom-macos-deps.git
synced 2024-11-24 21:01:59 +00:00
build script: add sdl2 target
This commit is contained in:
parent
451b245de7
commit
da9c094ad3
3 changed files with 59 additions and 0 deletions
4
.gitignore
vendored
4
.gitignore
vendored
|
@ -44,6 +44,10 @@
|
|||
/deps/png/bin/png-fix-itxt
|
||||
/deps/png/bin/pngfix
|
||||
/deps/samplerate/bin/
|
||||
/deps/sdl2/include/SDL2/SDL_config_*.h
|
||||
/deps/sdl2/include/SDL2/SDL_copying.h
|
||||
/deps/sdl2/include/SDL2/SDL_test*.h
|
||||
/deps/sdl2/lib/cmake/
|
||||
/deps/sndfile/bin/
|
||||
/deps/sndfile/include/sndfile.hh
|
||||
/deps/sndfile/lib/cmake/
|
||||
|
|
39
build.py
39
build.py
|
@ -1249,6 +1249,44 @@ class SamplerateTarget(ConfigureMakeStaticDependencyTarget):
|
|||
return os.path.exists(builder.source_path + 'samplerate.pc.in')
|
||||
|
||||
|
||||
class Sdl2FileTarget(CMakeStaticDependencyTarget):
|
||||
def __init__(self, name='sdl2'):
|
||||
super().__init__(name)
|
||||
|
||||
def prepare_source(self, builder: 'Builder'):
|
||||
builder.download_source(
|
||||
'https://libsdl.org/release/SDL2-2.0.12.tar.gz',
|
||||
'349268f695c02efbc9b9148a70b85e58cefbbf704abd3e91be654db7f1e2c863')
|
||||
|
||||
def detect(self, builder: 'Builder') -> bool:
|
||||
return os.path.exists(builder.source_path + 'sdl2.pc.in')
|
||||
|
||||
LINKER_FLAGS = ' -L${libdir} -lSDL2'\
|
||||
' -framework AudioToolbox -framework AVFoundation -framework Carbon -framework Cocoa'\
|
||||
' -framework CoreAudio -framework CoreFoundation -framework CoreVideo'\
|
||||
' -framework ForceFeedback -framework Foundation -framework IOKit\n'
|
||||
|
||||
def post_build(self, builder: 'Builder'):
|
||||
super().post_build(builder)
|
||||
|
||||
def update_libs(line: str):
|
||||
if line.startswith(' echo -L${exec_prefix}/lib'):
|
||||
return ' echo' + Sdl2FileTarget.LINKER_FLAGS
|
||||
|
||||
return line
|
||||
|
||||
Target.update_prefix_shell_script(self.prefix + '/bin/sdl2-config', update_libs)
|
||||
|
||||
@staticmethod
|
||||
def _process_pkg_config(pcfile: str, line: str) -> str:
|
||||
libs_private = 'Libs.private:'
|
||||
|
||||
if line.startswith(libs_private):
|
||||
return libs_private + Sdl2FileTarget.LINKER_FLAGS
|
||||
|
||||
return line
|
||||
|
||||
|
||||
class SndFileTarget(CMakeStaticDependencyTarget):
|
||||
def __init__(self, name='sndfile'):
|
||||
super().__init__(name)
|
||||
|
@ -1643,6 +1681,7 @@ class Builder(object):
|
|||
PkgConfigTarget(),
|
||||
PngTarget(),
|
||||
SamplerateTarget(),
|
||||
Sdl2FileTarget(),
|
||||
SndFileTarget(),
|
||||
VorbisTarget(),
|
||||
VpxTarget(),
|
||||
|
|
16
patch/sdl2.patch
Normal file
16
patch/sdl2.patch
Normal file
|
@ -0,0 +1,16 @@
|
|||
--- a/src/video/cocoa/SDL_cocoawindow.m
|
||||
+++ b/src/video/cocoa/SDL_cocoawindow.m
|
||||
@@ -1813,6 +1813,13 @@
|
||||
This is no longer needed as of Mac OS X 10.15, according to bug 4822.
|
||||
*/
|
||||
NSProcessInfo *processInfo = [NSProcessInfo processInfo];
|
||||
+#if MAC_OS_X_VERSION_MAX_ALLOWED < 101000 /* NSOperatingSystemVersion added in the 10.10 SDK */
|
||||
+ typedef struct {
|
||||
+ NSInteger majorVersion;
|
||||
+ NSInteger minorVersion;
|
||||
+ NSInteger patchVersion;
|
||||
+ } NSOperatingSystemVersion;
|
||||
+#endif
|
||||
NSOperatingSystemVersion version = { 10, 15, 0 };
|
||||
if (![processInfo respondsToSelector:@selector(isOperatingSystemAtLeastVersion:)] ||
|
||||
![processInfo isOperatingSystemAtLeastVersion:version]) {
|
Loading…
Reference in a new issue