mirror of
https://github.com/ZDoom/zdoom-macos-deps.git
synced 2024-11-21 19:41:15 +00:00
aedi: make patching explicit
This commit is contained in:
parent
a3bafa7fc1
commit
f6f6aa13ed
9 changed files with 25 additions and 17 deletions
|
@ -59,10 +59,6 @@ class Builder(object):
|
||||||
|
|
||||||
del self._targets
|
del self._targets
|
||||||
|
|
||||||
patch_path = f'{state.root_path}patch/{self._target.name}.patch'
|
|
||||||
if os.path.exists(patch_path):
|
|
||||||
state.patch_path = patch_path
|
|
||||||
|
|
||||||
if arguments.build_path:
|
if arguments.build_path:
|
||||||
state.build_path = os.path.abspath(arguments.build_path)
|
state.build_path = os.path.abspath(arguments.build_path)
|
||||||
else:
|
else:
|
||||||
|
|
|
@ -36,7 +36,6 @@ class BuildState:
|
||||||
|
|
||||||
self.source = None
|
self.source = None
|
||||||
self.external_source = True
|
self.external_source = True
|
||||||
self.patch_path = None
|
|
||||||
|
|
||||||
self.build_path = None
|
self.build_path = None
|
||||||
self.native_build_path = None
|
self.native_build_path = None
|
||||||
|
@ -78,7 +77,7 @@ class BuildState:
|
||||||
args = ('git', 'checkout', '-b', branch, 'origin/' + branch)
|
args = ('git', 'checkout', '-b', branch, 'origin/' + branch)
|
||||||
subprocess.run(args, cwd=self.source, check=True)
|
subprocess.run(args, cwd=self.source, check=True)
|
||||||
|
|
||||||
def download_source(self, url: str, checksum: str):
|
def download_source(self, url: str, checksum: str, patches: [tuple, list, str] = None):
|
||||||
if self.external_source:
|
if self.external_source:
|
||||||
return
|
return
|
||||||
|
|
||||||
|
@ -88,7 +87,16 @@ class BuildState:
|
||||||
self._verify_checksum(checksum, data, filepath)
|
self._verify_checksum(checksum, data, filepath)
|
||||||
|
|
||||||
first_path_component, extract_path = self._unpack_source_package(filepath)
|
first_path_component, extract_path = self._unpack_source_package(filepath)
|
||||||
self._apply_source_patch(extract_path)
|
|
||||||
|
if not patches:
|
||||||
|
pass
|
||||||
|
elif isinstance(patches, str):
|
||||||
|
self._apply_source_patch(extract_path, patches)
|
||||||
|
elif isinstance(patches, (tuple, list)):
|
||||||
|
for patch in patches:
|
||||||
|
self._apply_source_patch(extract_path, patch)
|
||||||
|
else:
|
||||||
|
assert False
|
||||||
|
|
||||||
# Adjust source and build paths according to extracted source code
|
# Adjust source and build paths according to extracted source code
|
||||||
self.source = extract_path
|
self.source = extract_path
|
||||||
|
@ -154,15 +162,14 @@ class BuildState:
|
||||||
|
|
||||||
return first_path_component, extract_path
|
return first_path_component, extract_path
|
||||||
|
|
||||||
def _apply_source_patch(self, extract_path: str):
|
def _apply_source_patch(self, extract_path: str, patch: str):
|
||||||
if not self.patch_path:
|
patch_path = f'{self.root_path}patch/{patch}.diff'
|
||||||
return
|
|
||||||
|
|
||||||
assert os.path.exists(self.patch_path)
|
assert os.path.exists(patch_path)
|
||||||
|
|
||||||
# Check if patch is already applied
|
# Check if patch is already applied
|
||||||
test_arg = '--dry-run'
|
test_arg = '--dry-run'
|
||||||
args = ['patch', test_arg, '--strip=1', '--input=' + self.patch_path]
|
args = ['patch', test_arg, '--strip=1', '--input=' + patch_path]
|
||||||
|
|
||||||
if subprocess.call(args, cwd=extract_path) == 0:
|
if subprocess.call(args, cwd=extract_path) == 0:
|
||||||
# Patch wasn't applied yet, do it now
|
# Patch wasn't applied yet, do it now
|
||||||
|
|
|
@ -325,7 +325,8 @@ class OggTarget(CMakeStaticDependencyTarget):
|
||||||
def prepare_source(self, state: BuildState):
|
def prepare_source(self, state: BuildState):
|
||||||
state.download_source(
|
state.download_source(
|
||||||
'https://ftp.osuosl.org/pub/xiph/releases/ogg/libogg-1.3.4.tar.gz',
|
'https://ftp.osuosl.org/pub/xiph/releases/ogg/libogg-1.3.4.tar.gz',
|
||||||
'fe5670640bd49e828d64d2879c31cb4dde9758681bb664f9bdbf159a01b0c76e')
|
'fe5670640bd49e828d64d2879c31cb4dde9758681bb664f9bdbf159a01b0c76e',
|
||||||
|
patches='ogg-fix-compile')
|
||||||
|
|
||||||
def detect(self, state: BuildState) -> bool:
|
def detect(self, state: BuildState) -> bool:
|
||||||
return os.path.exists(state.source + 'ogg.pc.in')
|
return os.path.exists(state.source + 'ogg.pc.in')
|
||||||
|
|
|
@ -69,7 +69,8 @@ class MadTarget(ConfigureMakeStaticDependencyTarget):
|
||||||
def prepare_source(self, state: BuildState):
|
def prepare_source(self, state: BuildState):
|
||||||
state.download_source(
|
state.download_source(
|
||||||
'https://downloads.sourceforge.net/project/mad/libmad/0.15.1b/libmad-0.15.1b.tar.gz',
|
'https://downloads.sourceforge.net/project/mad/libmad/0.15.1b/libmad-0.15.1b.tar.gz',
|
||||||
'bbfac3ed6bfbc2823d3775ebb931087371e142bb0e9bb1bee51a76a6e0078690')
|
'bbfac3ed6bfbc2823d3775ebb931087371e142bb0e9bb1bee51a76a6e0078690',
|
||||||
|
patches='mad-support-arm64')
|
||||||
|
|
||||||
def detect(self, state: BuildState) -> bool:
|
def detect(self, state: BuildState) -> bool:
|
||||||
return os.path.exists(state.source + 'mad.h')
|
return os.path.exists(state.source + 'mad.h')
|
||||||
|
@ -156,7 +157,8 @@ class PortMidiTarget(CMakeTarget):
|
||||||
def prepare_source(self, state: BuildState):
|
def prepare_source(self, state: BuildState):
|
||||||
state.download_source(
|
state.download_source(
|
||||||
'https://downloads.sourceforge.net/project/portmedia/portmidi/217/portmidi-src-217.zip',
|
'https://downloads.sourceforge.net/project/portmedia/portmidi/217/portmidi-src-217.zip',
|
||||||
'08e9a892bd80bdb1115213fb72dc29a7bf2ff108b378180586aa65f3cfd42e0f')
|
'08e9a892bd80bdb1115213fb72dc29a7bf2ff108b378180586aa65f3cfd42e0f',
|
||||||
|
patches='portmidi-modernize-cmake')
|
||||||
|
|
||||||
def detect(self, state: BuildState) -> bool:
|
def detect(self, state: BuildState) -> bool:
|
||||||
return os.path.exists(state.source + 'pm_common/portmidi.h')
|
return os.path.exists(state.source + 'pm_common/portmidi.h')
|
||||||
|
@ -182,7 +184,8 @@ class SamplerateTarget(CMakeStaticDependencyTarget):
|
||||||
def prepare_source(self, state: BuildState):
|
def prepare_source(self, state: BuildState):
|
||||||
state.download_source(
|
state.download_source(
|
||||||
'https://github.com/libsndfile/libsamplerate/releases/download/0.2.1/libsamplerate-0.2.1.tar.bz2',
|
'https://github.com/libsndfile/libsamplerate/releases/download/0.2.1/libsamplerate-0.2.1.tar.bz2',
|
||||||
'f6323b5e234753579d70a0af27796dde4ebeddf58aae4be598e39b3cee00c90a')
|
'f6323b5e234753579d70a0af27796dde4ebeddf58aae4be598e39b3cee00c90a',
|
||||||
|
patches='samplerate-support-arm64')
|
||||||
|
|
||||||
def detect(self, state: BuildState) -> bool:
|
def detect(self, state: BuildState) -> bool:
|
||||||
return os.path.exists(state.source + 'samplerate.pc.in')
|
return os.path.exists(state.source + 'samplerate.pc.in')
|
||||||
|
@ -259,7 +262,8 @@ class Sdl2MixerTarget(ConfigureMakeStaticDependencyTarget):
|
||||||
def prepare_source(self, state: BuildState):
|
def prepare_source(self, state: BuildState):
|
||||||
state.download_source(
|
state.download_source(
|
||||||
'https://www.libsdl.org/projects/SDL_mixer/release/SDL2_mixer-2.0.4.tar.gz',
|
'https://www.libsdl.org/projects/SDL_mixer/release/SDL2_mixer-2.0.4.tar.gz',
|
||||||
'b4cf5a382c061cd75081cf246c2aa2f9df8db04bdda8dcdc6b6cca55bede2419')
|
'b4cf5a382c061cd75081cf246c2aa2f9df8db04bdda8dcdc6b6cca55bede2419',
|
||||||
|
patches='sdl2_mixer-fix-fluidsynth')
|
||||||
|
|
||||||
def configure(self, state: BuildState):
|
def configure(self, state: BuildState):
|
||||||
# Set LDFLAGS explicitly to help with FluidSynth and FLAC detection
|
# Set LDFLAGS explicitly to help with FluidSynth and FLAC detection
|
||||||
|
|
Loading…
Reference in a new issue