2021-05-01 08:54:52 +00:00
|
|
|
#
|
|
|
|
# Helper module to build macOS version of various source ports
|
2022-01-11 09:43:29 +00:00
|
|
|
# Copyright (C) 2020-2022 Alexey Lysiuk
|
2021-05-01 08:54:52 +00:00
|
|
|
#
|
|
|
|
# This program is free software: you can redistribute it and/or modify
|
|
|
|
# it under the terms of the GNU General Public License as published by
|
|
|
|
# the Free Software Foundation, either version 3 of the License, or
|
|
|
|
# (at your option) any later version.
|
|
|
|
#
|
|
|
|
# This program is distributed in the hope that it will be useful,
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
# GNU General Public License for more details.
|
|
|
|
#
|
|
|
|
# You should have received a copy of the GNU General Public License
|
|
|
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
#
|
|
|
|
|
2021-08-01 10:16:14 +00:00
|
|
|
import glob
|
|
|
|
|
2021-05-01 08:54:52 +00:00
|
|
|
from .base import *
|
|
|
|
|
|
|
|
|
2021-08-01 10:16:14 +00:00
|
|
|
class BrotliTarget(CMakeStaticDependencyTarget):
|
|
|
|
def __init__(self, name='brotli'):
|
|
|
|
super().__init__(name)
|
|
|
|
|
|
|
|
def prepare_source(self, state: BuildState):
|
|
|
|
state.download_source(
|
|
|
|
'https://github.com/google/brotli/archive/refs/tags/v1.0.9.tar.gz',
|
|
|
|
'f9e8d81d0405ba66d181529af42a3354f838c939095ff99930da6aa9cdf6fe46')
|
|
|
|
|
|
|
|
def post_build(self, state: BuildState):
|
|
|
|
super().post_build(state)
|
|
|
|
|
|
|
|
dylib_pattern = str(state.install_path / 'lib/*.dylib')
|
|
|
|
for dylib in glob.iglob(dylib_pattern):
|
|
|
|
os.unlink(dylib)
|
|
|
|
|
|
|
|
archive_suffix = '-static.a'
|
|
|
|
archive_pattern = str(state.install_path / f'lib/*{archive_suffix}')
|
|
|
|
for archive in glob.iglob(archive_pattern):
|
|
|
|
no_suffix_name = archive.replace(archive_suffix, '.a')
|
|
|
|
os.rename(archive, no_suffix_name)
|
|
|
|
|
2021-08-01 13:01:02 +00:00
|
|
|
@staticmethod
|
2021-08-01 13:14:43 +00:00
|
|
|
def _process_pkg_config(pcfile: Path, line: str) -> str:
|
2021-08-01 13:01:02 +00:00
|
|
|
return line.replace('-R${libdir} ', '') if line.startswith('Libs:') else line
|
|
|
|
|
2021-08-01 10:16:14 +00:00
|
|
|
|
2021-05-01 08:54:52 +00:00
|
|
|
class DumbTarget(CMakeStaticDependencyTarget):
|
|
|
|
def __init__(self, name='dumb'):
|
|
|
|
super().__init__(name)
|
|
|
|
|
|
|
|
def prepare_source(self, state: BuildState):
|
|
|
|
state.download_source(
|
|
|
|
'https://github.com/kode54/dumb/archive/2.0.3.tar.gz',
|
|
|
|
'99bfac926aeb8d476562303312d9f47fd05b43803050cd889b44da34a9b2a4f9')
|
|
|
|
|
|
|
|
def detect(self, state: BuildState) -> bool:
|
2021-07-22 06:51:13 +00:00
|
|
|
return state.has_source_file('include/dumb.h')
|
2021-05-01 08:54:52 +00:00
|
|
|
|
2021-08-05 06:59:49 +00:00
|
|
|
def configure(self, state: BuildState):
|
|
|
|
opts = state.options
|
|
|
|
opts['BUILD_ALLEGRO4'] = 'NO'
|
|
|
|
opts['BUILD_EXAMPLES'] = 'NO'
|
|
|
|
|
|
|
|
super().configure(state)
|
|
|
|
|
2021-05-01 08:54:52 +00:00
|
|
|
@staticmethod
|
2021-08-01 13:14:43 +00:00
|
|
|
def _process_pkg_config(pcfile: Path, line: str) -> str:
|
2021-06-20 11:44:18 +00:00
|
|
|
return 'Libs: -L${libdir} -ldumb\n' if line.startswith('Libs:') else line
|
2021-05-01 08:54:52 +00:00
|
|
|
|
|
|
|
|
2021-06-05 08:57:04 +00:00
|
|
|
class FmtTarget(CMakeStaticDependencyTarget):
|
|
|
|
def __init__(self, name='fmt'):
|
|
|
|
super().__init__(name)
|
|
|
|
|
|
|
|
def prepare_source(self, state: BuildState):
|
|
|
|
state.download_source(
|
2022-06-20 07:29:45 +00:00
|
|
|
'https://github.com/fmtlib/fmt/archive/refs/tags/8.1.1.tar.gz',
|
|
|
|
'3d794d3cf67633b34b2771eb9f073bde87e846e0d395d254df7b211ef1ec7346')
|
2021-06-05 08:57:04 +00:00
|
|
|
|
2021-08-05 06:59:49 +00:00
|
|
|
def configure(self, state: BuildState):
|
|
|
|
opts = state.options
|
|
|
|
opts['FMT_DOC'] = 'NO'
|
|
|
|
opts['FMT_TEST'] = 'NO'
|
|
|
|
|
|
|
|
super().configure(state)
|
|
|
|
|
2021-06-05 08:57:04 +00:00
|
|
|
|
2021-06-19 08:40:17 +00:00
|
|
|
class LzmaTarget(CMakeStaticDependencyTarget):
|
|
|
|
def __init__(self, name='lzma'):
|
|
|
|
super().__init__(name)
|
|
|
|
|
|
|
|
def prepare_source(self, state: BuildState):
|
|
|
|
state.download_source(
|
|
|
|
'https://tukaani.org/xz/xz-5.2.5.tar.gz',
|
|
|
|
'f6f4910fd033078738bd82bfba4f49219d03b17eb0794eb91efbae419f4aba10',
|
|
|
|
patches='lzma-add-cmake')
|
|
|
|
|
|
|
|
def detect(self, state: BuildState) -> bool:
|
2021-07-22 06:51:13 +00:00
|
|
|
return state.has_source_file('src/liblzma/liblzma.pc.in')
|
2021-06-19 08:40:17 +00:00
|
|
|
|
|
|
|
def post_build(self, state: BuildState):
|
|
|
|
super().post_build(state)
|
|
|
|
|
|
|
|
self.write_pc_file(state, 'liblzma.pc', name='liblzma',
|
|
|
|
description='General purpose data compression library',
|
|
|
|
version='5.2.5', libs='-llzma')
|
|
|
|
|
|
|
|
|
2021-05-01 08:54:52 +00:00
|
|
|
class MadTarget(ConfigureMakeStaticDependencyTarget):
|
|
|
|
def __init__(self, name='mad'):
|
|
|
|
super().__init__(name)
|
|
|
|
|
|
|
|
def prepare_source(self, state: BuildState):
|
|
|
|
state.download_source(
|
|
|
|
'https://downloads.sourceforge.net/project/mad/libmad/0.15.1b/libmad-0.15.1b.tar.gz',
|
2021-06-01 07:18:38 +00:00
|
|
|
'bbfac3ed6bfbc2823d3775ebb931087371e142bb0e9bb1bee51a76a6e0078690',
|
|
|
|
patches='mad-support-arm64')
|
2021-05-01 08:54:52 +00:00
|
|
|
|
|
|
|
def detect(self, state: BuildState) -> bool:
|
2021-07-22 06:51:13 +00:00
|
|
|
return state.has_source_file('mad.h')
|
2021-05-01 08:54:52 +00:00
|
|
|
|
2021-08-05 06:59:49 +00:00
|
|
|
def configure(self, state: BuildState):
|
|
|
|
state.options['--enable-fpm'] = '64bit'
|
|
|
|
super().configure(state)
|
|
|
|
|
2021-05-01 08:54:52 +00:00
|
|
|
def post_build(self, state: BuildState):
|
|
|
|
super().post_build(state)
|
|
|
|
self.write_pc_file(state, description='MPEG Audio Decoder', version='0.15.1b')
|
|
|
|
|
|
|
|
|
|
|
|
class MikmodTarget(ConfigureMakeStaticDependencyTarget):
|
|
|
|
def __init__(self, name='mikmod'):
|
|
|
|
super().__init__(name)
|
|
|
|
|
|
|
|
def prepare_source(self, state: BuildState):
|
|
|
|
state.download_source(
|
|
|
|
'https://downloads.sourceforge.net/project/mikmod/libmikmod/3.3.11.1/libmikmod-3.3.11.1.tar.gz',
|
|
|
|
'ad9d64dfc8f83684876419ea7cd4ff4a41d8bcd8c23ef37ecb3a200a16b46d19')
|
|
|
|
|
|
|
|
def detect(self, state: BuildState) -> bool:
|
2021-07-22 06:51:13 +00:00
|
|
|
return state.has_source_file('libmikmod.pc.in')
|
2021-05-01 08:54:52 +00:00
|
|
|
|
|
|
|
def post_build(self, state: BuildState):
|
|
|
|
super().post_build(state)
|
2021-07-22 06:51:13 +00:00
|
|
|
self.update_config_script(state.install_path / 'bin/libmikmod-config')
|
2021-05-01 08:54:52 +00:00
|
|
|
|
|
|
|
|
|
|
|
class ModPlugTarget(ConfigureMakeStaticDependencyTarget):
|
|
|
|
def __init__(self, name='modplug'):
|
|
|
|
super().__init__(name)
|
|
|
|
|
|
|
|
def prepare_source(self, state: BuildState):
|
|
|
|
state.download_source(
|
|
|
|
'https://downloads.sourceforge.net/project/modplug-xmms/libmodplug/0.8.9.0/libmodplug-0.8.9.0.tar.gz',
|
|
|
|
'457ca5a6c179656d66c01505c0d95fafaead4329b9dbaa0f997d00a3508ad9de')
|
|
|
|
|
|
|
|
def detect(self, state: BuildState) -> bool:
|
2021-07-22 06:51:13 +00:00
|
|
|
return state.has_source_file('libmodplug.pc.in')
|
2021-05-01 08:54:52 +00:00
|
|
|
|
|
|
|
@staticmethod
|
2021-08-01 13:14:43 +00:00
|
|
|
def _process_pkg_config(pcfile: Path, line: str) -> str:
|
2021-05-01 08:54:52 +00:00
|
|
|
libs_private = 'Libs.private:'
|
|
|
|
|
|
|
|
if line.startswith(libs_private):
|
|
|
|
return libs_private + ' -lc++\n'
|
|
|
|
|
|
|
|
return line
|
|
|
|
|
|
|
|
|
|
|
|
class OpusFileTarget(ConfigureMakeStaticDependencyTarget):
|
|
|
|
def __init__(self, name='opusfile'):
|
|
|
|
super().__init__(name)
|
|
|
|
|
|
|
|
def prepare_source(self, state: BuildState):
|
|
|
|
state.download_source(
|
2021-05-31 08:46:13 +00:00
|
|
|
'https://ftp.osuosl.org/pub/xiph/releases/opus/opusfile-0.12.tar.gz',
|
2021-05-01 08:54:52 +00:00
|
|
|
'118d8601c12dd6a44f52423e68ca9083cc9f2bfe72da7a8c1acb22a80ae3550b')
|
|
|
|
|
|
|
|
def detect(self, state: BuildState) -> bool:
|
2021-07-22 06:51:13 +00:00
|
|
|
return state.has_source_file('opusfile.pc.in')
|
2021-05-01 08:54:52 +00:00
|
|
|
|
2021-08-05 06:59:49 +00:00
|
|
|
def configure(self, state: BuildState):
|
|
|
|
state.options['--enable-http'] = 'no'
|
|
|
|
super().configure(state)
|
|
|
|
|
2021-05-01 08:54:52 +00:00
|
|
|
|
2021-06-07 06:56:53 +00:00
|
|
|
class PngTarget(CMakeStaticDependencyTarget):
|
2021-05-01 08:54:52 +00:00
|
|
|
def __init__(self, name='png'):
|
|
|
|
super().__init__(name)
|
|
|
|
|
|
|
|
def prepare_source(self, state: BuildState):
|
|
|
|
state.download_source(
|
|
|
|
'https://downloads.sourceforge.net/libpng/libpng-1.6.37.tar.xz',
|
|
|
|
'505e70834d35383537b6491e7ae8641f1a4bed1876dbfe361201fc80868d88ca')
|
|
|
|
|
2021-08-05 06:59:49 +00:00
|
|
|
def configure(self, state: BuildState):
|
|
|
|
opts = state.options
|
|
|
|
opts['PNG_ARM_NEON'] = 'on'
|
|
|
|
opts['PNG_SHARED'] = 'OFF'
|
|
|
|
|
|
|
|
super().configure(state)
|
|
|
|
|
2021-05-01 08:54:52 +00:00
|
|
|
def post_build(self, state: BuildState):
|
|
|
|
super().post_build(state)
|
2021-07-22 06:51:13 +00:00
|
|
|
self.update_config_script(state.install_path / 'bin/libpng16-config')
|
2021-05-01 08:54:52 +00:00
|
|
|
|
|
|
|
|
|
|
|
class PortMidiTarget(CMakeTarget):
|
|
|
|
def __init__(self, name='portmidi'):
|
|
|
|
super().__init__(name)
|
|
|
|
|
|
|
|
def prepare_source(self, state: BuildState):
|
|
|
|
state.download_source(
|
|
|
|
'https://downloads.sourceforge.net/project/portmedia/portmidi/217/portmidi-src-217.zip',
|
2021-06-01 07:18:38 +00:00
|
|
|
'08e9a892bd80bdb1115213fb72dc29a7bf2ff108b378180586aa65f3cfd42e0f',
|
|
|
|
patches='portmidi-modernize-cmake')
|
2021-05-01 08:54:52 +00:00
|
|
|
|
|
|
|
def post_build(self, state: BuildState):
|
2021-07-22 06:51:13 +00:00
|
|
|
if state.install_path.exists():
|
2021-05-01 08:54:52 +00:00
|
|
|
shutil.rmtree(state.install_path)
|
|
|
|
|
2021-07-22 06:51:13 +00:00
|
|
|
include_path = state.install_path / 'include'
|
2021-05-01 08:54:52 +00:00
|
|
|
os.makedirs(include_path)
|
2021-07-22 06:51:13 +00:00
|
|
|
shutil.copy(state.source / 'pm_common/portmidi.h', include_path)
|
|
|
|
shutil.copy(state.source / 'porttime/porttime.h', include_path)
|
2021-05-01 08:54:52 +00:00
|
|
|
|
2021-07-22 06:51:13 +00:00
|
|
|
lib_path = state.install_path / 'lib'
|
2021-05-01 08:54:52 +00:00
|
|
|
os.makedirs(lib_path)
|
2021-07-22 06:51:13 +00:00
|
|
|
shutil.copy(state.build_path / 'libportmidi_s.a', lib_path / 'libportmidi.a')
|
2021-05-01 08:54:52 +00:00
|
|
|
|
|
|
|
|
|
|
|
class SamplerateTarget(CMakeStaticDependencyTarget):
|
|
|
|
def __init__(self, name='samplerate'):
|
|
|
|
super().__init__(name)
|
|
|
|
|
|
|
|
def prepare_source(self, state: BuildState):
|
|
|
|
state.download_source(
|
|
|
|
'https://github.com/libsndfile/libsamplerate/releases/download/0.2.1/libsamplerate-0.2.1.tar.bz2',
|
2021-08-02 07:53:23 +00:00
|
|
|
'f6323b5e234753579d70a0af27796dde4ebeddf58aae4be598e39b3cee00c90a')
|
2021-05-01 08:54:52 +00:00
|
|
|
|
2021-08-02 07:54:06 +00:00
|
|
|
def post_build(self, state: BuildState):
|
|
|
|
super().post_build(state)
|
|
|
|
|
|
|
|
def update_linker_flags(line: str):
|
|
|
|
link_var = ' INTERFACE_LINK_LIBRARIES '
|
|
|
|
return None if line.startswith(link_var) else line
|
|
|
|
|
|
|
|
cmake_module = state.install_path / 'lib/cmake/SampleRate/SampleRateTargets.cmake'
|
|
|
|
self.update_text_file(cmake_module, update_linker_flags)
|
|
|
|
|
2021-05-01 08:54:52 +00:00
|
|
|
|
|
|
|
class Sdl2Target(CMakeStaticDependencyTarget):
|
|
|
|
def __init__(self, name='sdl2'):
|
|
|
|
super().__init__(name)
|
|
|
|
|
|
|
|
def prepare_source(self, state: BuildState):
|
|
|
|
state.download_source(
|
2022-04-30 09:41:42 +00:00
|
|
|
'https://libsdl.org/release/SDL2-2.0.22.tar.gz',
|
|
|
|
'fe7cbf3127882e3fc7259a75a0cb585620272c51745d3852ab9dd87960697f2e',
|
2021-12-04 13:13:02 +00:00
|
|
|
patches=('sdl2-no-updaterev', 'sdl2-no-gamecontroller+corehaptic'))
|
2021-05-01 08:54:52 +00:00
|
|
|
|
2021-10-31 09:21:53 +00:00
|
|
|
FRAMEWORKS = '-framework AudioToolbox -framework AVFoundation -framework Carbon' \
|
|
|
|
' -framework Cocoa -framework CoreAudio -framework CoreVideo -framework ForceFeedback' \
|
|
|
|
' -framework Foundation -framework IOKit -framework Metal -framework QuartzCore'
|
|
|
|
LINKER_FLAGS = ' -L${libdir} -lSDL2 ' + FRAMEWORKS + os.linesep
|
2021-09-12 07:55:57 +00:00
|
|
|
|
2021-08-05 06:59:49 +00:00
|
|
|
def configure(self, state: BuildState):
|
2021-09-12 07:56:41 +00:00
|
|
|
state.options['SDL_STATIC_PIC'] = 'YES'
|
2021-09-12 07:55:57 +00:00
|
|
|
super().configure(state)
|
2021-05-01 08:54:52 +00:00
|
|
|
|
|
|
|
def post_build(self, state: BuildState):
|
|
|
|
super().post_build(state)
|
|
|
|
|
2021-09-08 09:06:55 +00:00
|
|
|
def update_sdl2_config(_: Path, line: str):
|
|
|
|
if line.startswith('# '):
|
|
|
|
return None
|
|
|
|
elif line.startswith(' echo -I'):
|
|
|
|
return ' echo -I${prefix}/include/SDL2 -D_THREAD_SAFE\n'
|
|
|
|
elif line.startswith(' echo -L'):
|
2021-05-01 08:54:52 +00:00
|
|
|
return ' echo' + Sdl2Target.LINKER_FLAGS
|
|
|
|
|
|
|
|
return line
|
|
|
|
|
2021-07-22 06:51:13 +00:00
|
|
|
self.update_config_script(state.install_path / 'bin/sdl2-config', update_sdl2_config)
|
2021-06-05 09:07:54 +00:00
|
|
|
|
|
|
|
def update_targets_cmake(line: str):
|
2021-12-04 11:46:32 +00:00
|
|
|
libs = ' INTERFACE_LINK_LIBRARIES '
|
|
|
|
return f'{libs}"{Sdl2Target.FRAMEWORKS}"\n' if line.startswith(libs) else line
|
2021-06-04 06:51:19 +00:00
|
|
|
|
2021-06-05 09:07:54 +00:00
|
|
|
for suffix in ('', '-release'):
|
2022-01-19 10:10:46 +00:00
|
|
|
file_path = state.install_path / f'lib/cmake/SDL2/SDL2staticTargets{suffix}.cmake'
|
2021-06-05 09:07:54 +00:00
|
|
|
self.update_text_file(file_path, update_targets_cmake)
|
2021-05-01 08:54:52 +00:00
|
|
|
|
|
|
|
@staticmethod
|
2021-08-01 13:14:43 +00:00
|
|
|
def _process_pkg_config(pcfile: Path, line: str) -> str:
|
2021-05-01 08:54:52 +00:00
|
|
|
libs = 'Libs:'
|
|
|
|
|
|
|
|
if line.startswith(libs):
|
|
|
|
return libs + Sdl2Target.LINKER_FLAGS
|
|
|
|
|
|
|
|
return line
|
|
|
|
|
|
|
|
|
|
|
|
class Sdl2ImageTarget(ConfigureMakeStaticDependencyTarget):
|
|
|
|
def __init__(self, name='sdl2_image'):
|
|
|
|
super().__init__(name)
|
|
|
|
|
|
|
|
def prepare_source(self, state: BuildState):
|
|
|
|
state.download_source(
|
|
|
|
'https://www.libsdl.org/projects/SDL_image/release/SDL2_image-2.0.5.tar.gz',
|
|
|
|
'bdd5f6e026682f7d7e1be0b6051b209da2f402a2dd8bd1c4bd9c25ad263108d0')
|
|
|
|
|
|
|
|
def detect(self, state: BuildState) -> bool:
|
2021-07-22 06:51:13 +00:00
|
|
|
return state.has_source_file('SDL2_image.pc.in')
|
2021-05-01 08:54:52 +00:00
|
|
|
|
|
|
|
@staticmethod
|
2021-08-01 13:14:43 +00:00
|
|
|
def _process_pkg_config(pcfile: Path, line: str) -> str:
|
2021-05-01 08:54:52 +00:00
|
|
|
return line + 'Requires.private: libwebp\n' if line.startswith('Requires:') else line
|
|
|
|
|
|
|
|
|
|
|
|
class Sdl2MixerTarget(ConfigureMakeStaticDependencyTarget):
|
|
|
|
def __init__(self, name='sdl2_mixer'):
|
|
|
|
super().__init__(name)
|
|
|
|
|
|
|
|
def prepare_source(self, state: BuildState):
|
|
|
|
state.download_source(
|
|
|
|
'https://www.libsdl.org/projects/SDL_mixer/release/SDL2_mixer-2.0.4.tar.gz',
|
2021-06-01 07:18:38 +00:00
|
|
|
'b4cf5a382c061cd75081cf246c2aa2f9df8db04bdda8dcdc6b6cca55bede2419',
|
|
|
|
patches='sdl2_mixer-fix-fluidsynth')
|
2021-05-01 08:54:52 +00:00
|
|
|
|
|
|
|
def configure(self, state: BuildState):
|
2021-08-05 06:59:49 +00:00
|
|
|
state.options['--enable-music-mod-mikmod'] = 'yes'
|
|
|
|
|
2021-05-01 08:54:52 +00:00
|
|
|
# Set LDFLAGS explicitly to help with FluidSynth and FLAC detection
|
2021-08-05 06:53:07 +00:00
|
|
|
state.environment['LDFLAGS'] = state.run_pkg_config('--libs', 'fluidsynth')
|
2021-05-01 08:54:52 +00:00
|
|
|
|
|
|
|
super().configure(state)
|
|
|
|
|
|
|
|
def detect(self, state: BuildState) -> bool:
|
2021-07-22 06:51:13 +00:00
|
|
|
return state.has_source_file('SDL2_mixer.pc.in')
|
2021-05-01 08:54:52 +00:00
|
|
|
|
|
|
|
@staticmethod
|
2021-08-01 13:14:43 +00:00
|
|
|
def _process_pkg_config(pcfile: Path, line: str) -> str:
|
2021-05-01 08:54:52 +00:00
|
|
|
if line.startswith('Requires:'):
|
|
|
|
return line + 'Requires.private: fluidsynth libmikmod libmodplug libmpg123 opusfile vorbisfile\n'
|
|
|
|
|
|
|
|
return line
|
|
|
|
|
|
|
|
|
|
|
|
class Sdl2NetTarget(ConfigureMakeStaticDependencyTarget):
|
|
|
|
def __init__(self, name='sdl2_net'):
|
|
|
|
super().__init__(name)
|
|
|
|
|
|
|
|
def prepare_source(self, state: BuildState):
|
|
|
|
state.download_source(
|
|
|
|
'https://www.libsdl.org/projects/SDL_net/release/SDL2_net-2.0.1.tar.gz',
|
|
|
|
'15ce8a7e5a23dafe8177c8df6e6c79b6749a03fff1e8196742d3571657609d21')
|
|
|
|
|
|
|
|
def detect(self, state: BuildState) -> bool:
|
2021-07-22 06:51:13 +00:00
|
|
|
return state.has_source_file('SDL2_net.pc.in')
|
2021-05-01 08:54:52 +00:00
|
|
|
|
|
|
|
|
|
|
|
class SodiumTarget(ConfigureMakeStaticDependencyTarget):
|
|
|
|
def __init__(self, name='sodium'):
|
|
|
|
super().__init__(name)
|
|
|
|
|
|
|
|
def prepare_source(self, state: BuildState):
|
|
|
|
state.download_source(
|
|
|
|
'https://download.libsodium.org/libsodium/releases/libsodium-1.0.18.tar.gz',
|
|
|
|
'6f504490b342a4f8a4c4a02fc9b866cbef8622d5df4e5452b46be121e46636c1')
|
|
|
|
|
|
|
|
def detect(self, state: BuildState) -> bool:
|
2021-07-22 06:51:13 +00:00
|
|
|
return state.has_source_file('libsodium.pc.in')
|
2021-05-01 08:54:52 +00:00
|
|
|
|
|
|
|
|
2021-06-19 10:09:14 +00:00
|
|
|
class TiffTarget(CMakeStaticDependencyTarget):
|
|
|
|
def __init__(self, name='tiff'):
|
|
|
|
super().__init__(name)
|
|
|
|
|
|
|
|
def prepare_source(self, state: BuildState):
|
|
|
|
state.download_source(
|
|
|
|
'https://download.osgeo.org/libtiff/tiff-4.3.0.tar.gz',
|
|
|
|
'0e46e5acb087ce7d1ac53cf4f56a09b221537fc86dfc5daaad1c2e89e1b37ac8',
|
|
|
|
patches='tiff-remove-useless')
|
|
|
|
|
2021-08-05 06:59:49 +00:00
|
|
|
def configure(self, state: BuildState):
|
|
|
|
opts = state.options
|
|
|
|
opts['cxx'] = 'NO'
|
|
|
|
opts['lzma'] = 'YES'
|
|
|
|
|
|
|
|
super().configure(state)
|
|
|
|
|
2021-06-19 10:09:14 +00:00
|
|
|
@staticmethod
|
2021-08-01 13:14:43 +00:00
|
|
|
def _process_pkg_config(pcfile: Path, line: str) -> str:
|
2021-06-19 10:09:14 +00:00
|
|
|
version = 'Version:'
|
|
|
|
cflags = 'Cflags:'
|
|
|
|
libs = 'Libs:'
|
|
|
|
|
|
|
|
if line.startswith(version):
|
|
|
|
return version + ' 4.3.0\n'
|
|
|
|
elif line.startswith(cflags):
|
|
|
|
return cflags + ' -I${includedir}\nRequires.private: libjpeg liblzma libwebp libzstd zlib\n'
|
|
|
|
elif line.startswith(libs):
|
|
|
|
return libs + ' -L${libdir} -ltiff\n'
|
|
|
|
|
|
|
|
return line
|
|
|
|
|
|
|
|
|
2021-09-08 07:36:56 +00:00
|
|
|
class VulkanHeadersTarget(CMakeStaticDependencyTarget):
|
|
|
|
def __init__(self, name='vulkan-headers'):
|
|
|
|
super().__init__(name)
|
|
|
|
|
|
|
|
def prepare_source(self, state: BuildState):
|
|
|
|
state.download_source(
|
|
|
|
# Version should match with the current MoltenVK release
|
2022-06-09 06:44:23 +00:00
|
|
|
'https://github.com/KhronosGroup/Vulkan-Headers/archive/refs/tags/v1.3.216.tar.gz',
|
|
|
|
'93f9a70ed9e956f3e0a1b41b71b6d030428cc3509e7e2b38d0ea6ba89b09f71e')
|
2021-09-08 07:36:56 +00:00
|
|
|
|
|
|
|
|
2021-09-08 07:49:49 +00:00
|
|
|
class VulkanLoaderTarget(CMakeStaticDependencyTarget):
|
|
|
|
def __init__(self, name='vulkan-loader'):
|
|
|
|
super().__init__(name)
|
|
|
|
|
|
|
|
def prepare_source(self, state: BuildState):
|
|
|
|
state.download_source(
|
|
|
|
# Version should match with the current MoltenVK release
|
2022-06-09 06:45:59 +00:00
|
|
|
'https://github.com/KhronosGroup/Vulkan-Loader/archive/refs/tags/v1.3.216.tar.gz',
|
|
|
|
'006de2ee5bad4ef797ce4c25df166e09f2e5dd136e99cb507da313aa86770c00')
|
2021-09-08 07:49:49 +00:00
|
|
|
|
|
|
|
def configure(self, state: BuildState):
|
|
|
|
state.options['BUILD_STATIC_LOADER'] = 'YES'
|
|
|
|
super().configure(state)
|
|
|
|
|
|
|
|
|
2021-05-01 08:54:52 +00:00
|
|
|
class WebpTarget(CMakeStaticDependencyTarget):
|
|
|
|
def __init__(self, name='webp'):
|
|
|
|
super().__init__(name)
|
|
|
|
|
2021-08-05 06:59:49 +00:00
|
|
|
def prepare_source(self, state: BuildState):
|
|
|
|
state.download_source(
|
|
|
|
'https://storage.googleapis.com/downloads.webmproject.org/releases/webp/libwebp-1.2.0.tar.gz',
|
|
|
|
'2fc8bbde9f97f2ab403c0224fb9ca62b2e6852cbc519e91ceaa7c153ffd88a0c')
|
|
|
|
|
|
|
|
def configure(self, state: BuildState):
|
|
|
|
opts = state.options
|
2021-05-01 08:54:52 +00:00
|
|
|
opts['WEBP_BUILD_ANIM_UTILS'] = 'NO'
|
|
|
|
opts['WEBP_BUILD_CWEBP'] = 'NO'
|
|
|
|
opts['WEBP_BUILD_DWEBP'] = 'NO'
|
|
|
|
opts['WEBP_BUILD_GIF2WEBP'] = 'NO'
|
|
|
|
opts['WEBP_BUILD_IMG2WEBP'] = 'NO'
|
|
|
|
opts['WEBP_BUILD_VWEBP'] = 'NO'
|
|
|
|
opts['WEBP_BUILD_WEBPINFO'] = 'NO'
|
|
|
|
opts['WEBP_BUILD_WEBPMUX'] = 'NO'
|
|
|
|
opts['WEBP_BUILD_EXTRAS'] = 'NO'
|
|
|
|
|
2021-08-05 06:59:49 +00:00
|
|
|
super().configure(state)
|
2021-06-19 08:59:25 +00:00
|
|
|
|
2021-06-20 11:43:40 +00:00
|
|
|
def post_build(self, state: BuildState):
|
|
|
|
super().post_build(state)
|
|
|
|
|
2021-07-22 06:51:13 +00:00
|
|
|
shutil.copytree(state.install_path / 'share/WebP/cmake', state.install_path / 'lib/cmake/WebP')
|
2021-06-20 11:43:40 +00:00
|
|
|
self.keep_module_target(state, 'WebP::webp')
|
|
|
|
|
2021-06-19 08:59:25 +00:00
|
|
|
|
2021-09-03 08:32:52 +00:00
|
|
|
class XmpTarget(ConfigureMakeStaticDependencyTarget):
|
|
|
|
def __init__(self, name='xmp'):
|
|
|
|
super().__init__(name)
|
|
|
|
|
|
|
|
def prepare_source(self, state: BuildState):
|
|
|
|
state.download_source(
|
|
|
|
'https://sourceforge.net/projects/xmp/files/libxmp/4.5.0/libxmp-4.5.0.tar.gz',
|
|
|
|
'7847d262112d14e8442f44e5ac6ed9ddbca54c251284720b563c852b31f26e75')
|
|
|
|
|
|
|
|
def detect(self, state: BuildState) -> bool:
|
|
|
|
return state.has_source_file('libxmp.pc.in')
|
|
|
|
|
|
|
|
def configure(self, state: BuildState):
|
|
|
|
state.options['--enable-static'] = None
|
|
|
|
super().configure(state)
|
|
|
|
|
|
|
|
|
2021-06-19 08:59:25 +00:00
|
|
|
class ZstdTarget(CMakeStaticDependencyTarget):
|
|
|
|
def __init__(self, name='zstd'):
|
|
|
|
super().__init__(name)
|
|
|
|
self.src_root = 'build/cmake'
|
|
|
|
|
|
|
|
def prepare_source(self, state: BuildState):
|
|
|
|
state.download_source(
|
|
|
|
'https://github.com/facebook/zstd/releases/download/v1.5.0/zstd-1.5.0.tar.gz',
|
|
|
|
'5194fbfa781fcf45b98c5e849651aa7b3b0a008c6b72d4a0db760f3002291e94')
|
|
|
|
|
2021-08-05 06:59:49 +00:00
|
|
|
def configure(self, state: BuildState):
|
|
|
|
opts = state.options
|
|
|
|
opts['ZSTD_BUILD_PROGRAMS'] = 'NO'
|
|
|
|
opts['ZSTD_BUILD_SHARED'] = 'NO'
|
|
|
|
|
|
|
|
super().configure(state)
|