mirror of
https://github.com/ZDoom/zdoom-macos-deps.git
synced 2024-11-26 05:41:14 +00:00
build script: quakespasm is based on genetic make target
This commit is contained in:
parent
90c5a0cbbf
commit
4cf2925a48
1 changed files with 29 additions and 25 deletions
54
build.py
54
build.py
|
@ -470,9 +470,10 @@ class DevilutionXTarget(CMakeTarget):
|
||||||
opts['CMAKE_EXE_LINKER_FLAGS'] += extra_linker_args
|
opts['CMAKE_EXE_LINKER_FLAGS'] += extra_linker_args
|
||||||
|
|
||||||
|
|
||||||
class QuakespasmTarget(Target):
|
class QuakespasmTarget(MakeTarget):
|
||||||
def __init__(self, name='quakespasm'):
|
def __init__(self, name='quakespasm'):
|
||||||
super().__init__(name)
|
super().__init__(name)
|
||||||
|
self.src_root = 'Quake'
|
||||||
|
|
||||||
def prepare_source(self, builder: 'Builder'):
|
def prepare_source(self, builder: 'Builder'):
|
||||||
builder.checkout_git('https://git.code.sf.net/p/quakespasm/quakespasm')
|
builder.checkout_git('https://git.code.sf.net/p/quakespasm/quakespasm')
|
||||||
|
@ -480,32 +481,35 @@ class QuakespasmTarget(Target):
|
||||||
def detect(self, builder: 'Builder') -> bool:
|
def detect(self, builder: 'Builder') -> bool:
|
||||||
return os.path.exists(builder.source_path + os.sep + 'Quakespasm.txt')
|
return os.path.exists(builder.source_path + os.sep + 'Quakespasm.txt')
|
||||||
|
|
||||||
def configure(self, builder: 'Builder'):
|
def initialize(self, builder: 'Builder'):
|
||||||
os.makedirs(builder.build_path, exist_ok=True)
|
|
||||||
Builder.symlink_directory(builder.source_path, builder.build_path)
|
|
||||||
|
|
||||||
def build(self, builder: 'Builder'):
|
|
||||||
assert not builder.xcode
|
|
||||||
|
|
||||||
# TODO: Use macOS specific Makefile which requires manual application bundle creation
|
# TODO: Use macOS specific Makefile which requires manual application bundle creation
|
||||||
args = (
|
opts = self.options
|
||||||
'make', '-j', builder.jobs,
|
opts['USE_SDL2'] = '1'
|
||||||
'USE_SDL2=1', 'USE_CODEC_FLAC=1', 'USE_CODEC_OPUS=1', 'USE_CODEC_MIKMOD=1', 'USE_CODEC_UMX=1',
|
opts['USE_CODEC_FLAC'] = '1'
|
||||||
# Use CPUFLAGS instead of CFLAGS to avoid discarding of the latter if we specify them at command line
|
opts['USE_CODEC_OPUS'] = '1'
|
||||||
f'CPUFLAGS=-I{builder.include_path} -I{builder.include_path}opus',
|
opts['USE_CODEC_MIKMOD'] = '1'
|
||||||
# Use main() alias to workaround executable linking without macOS launcher
|
opts['USE_CODEC_UMX'] = '1'
|
||||||
# TODO: Specify full paths for all libraries
|
# TODO: Setup sdl2-config
|
||||||
f'LDFLAGS=-L{builder.lib_path} -lopus -lopusfile -Wl,-alias -Wl,_SDL_main -Wl,_main',
|
opts['SDL_CFLAGS'] = f'-I{builder.include_path}SDL2'
|
||||||
# TODO: Setup sdl2-config
|
opts['SDL_LIBS'] = f'{builder.lib_path}libSDL2.a'
|
||||||
f'SDL_CFLAGS=-I{builder.include_path}SDL2',
|
opts['COMMON_LIBS'] = '-framework AudioToolbox -framework Carbon -framework Cocoa -framework CoreAudio' \
|
||||||
f'SDL_LIBS={builder.lib_path}libSDL2.a',
|
' -framework CoreVideo -framework ForceFeedback -framework IOKit -framework OpenGL'
|
||||||
'COMMON_LIBS=-framework AudioToolbox -framework Carbon -framework Cocoa -framework CoreAudio'
|
|
||||||
' -framework CoreVideo -framework ForceFeedback -framework IOKit -framework OpenGL',
|
|
||||||
# TODO: Enable use of custom macOS SDK and deployment target
|
|
||||||
)
|
|
||||||
work_path = builder.build_path + 'Quake'
|
|
||||||
|
|
||||||
subprocess.check_call(args, cwd=work_path)
|
self._update_env('CFLAGS', f'-I{builder.include_path}opus')
|
||||||
|
# Use main() alias to workaround executable linking without macOS launcher
|
||||||
|
self._update_env('LDFLAGS', f'-Wl,-alias -Wl,_SDL_main -Wl,_main')
|
||||||
|
|
||||||
|
for name in ('opus', 'opusfile'):
|
||||||
|
self._update_env('LDFLAGS', f'{builder.lib_path}lib{name}.a')
|
||||||
|
|
||||||
|
# TODO: Specify full paths for remaining libraries
|
||||||
|
|
||||||
|
def configure(self, builder: 'Builder'):
|
||||||
|
super().configure(builder)
|
||||||
|
|
||||||
|
# Copy linker flags from enviroment to command line argument, they would be overridden by Makefile otherwise
|
||||||
|
ldflags = 'LDFLAGS'
|
||||||
|
self.options[ldflags] = self.environment[ldflags]
|
||||||
|
|
||||||
|
|
||||||
# Case insensitive dictionary class from
|
# Case insensitive dictionary class from
|
||||||
|
|
Loading…
Reference in a new issue