2021-01-14 08:34:20 +00:00
|
|
|
#
|
|
|
|
# Helper module to build macOS version of various source ports
|
2024-01-02 08:55:22 +00:00
|
|
|
# Copyright (C) 2020-2024 Alexey Lysiuk
|
2021-01-14 08:34:20 +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/>.
|
|
|
|
#
|
|
|
|
|
2023-03-21 10:52:54 +00:00
|
|
|
import os
|
2023-11-03 11:10:02 +00:00
|
|
|
import shlex
|
2023-03-21 10:52:54 +00:00
|
|
|
import shutil
|
|
|
|
import subprocess
|
|
|
|
from pathlib import Path
|
2021-01-14 08:34:20 +00:00
|
|
|
|
2023-03-21 10:52:54 +00:00
|
|
|
from ..state import BuildState
|
|
|
|
from . import base
|
2021-01-14 08:34:20 +00:00
|
|
|
|
2023-03-21 10:52:54 +00:00
|
|
|
|
|
|
|
class Bzip2Target(base.MakeTarget):
|
2021-01-14 08:34:20 +00:00
|
|
|
def __init__(self, name='bzip2'):
|
|
|
|
super().__init__(name)
|
|
|
|
|
|
|
|
def prepare_source(self, state: BuildState):
|
|
|
|
state.download_source(
|
|
|
|
'https://sourceware.org/pub/bzip2/bzip2-1.0.8.tar.gz',
|
|
|
|
'ab5a03176ee106d3f0fa90e381da478ddae405918153cca248e682cd0c4a2269')
|
|
|
|
|
|
|
|
def detect(self, state: BuildState) -> bool:
|
2021-07-22 06:51:13 +00:00
|
|
|
return state.has_source_file('bzlib.h')
|
2021-01-14 08:34:20 +00:00
|
|
|
|
|
|
|
def configure(self, state: BuildState):
|
|
|
|
super().configure(state)
|
|
|
|
|
2021-08-05 06:59:49 +00:00
|
|
|
opts = state.options
|
2021-01-14 08:34:20 +00:00
|
|
|
# Add explicit targets in order to skip testing step that is incompatible with cross-compilation
|
|
|
|
opts['bzip2'] = None
|
|
|
|
opts['bzip2recover'] = None
|
|
|
|
# Copy compiler flags from environment to command line argument, they would be overridden by Makefile otherwise
|
|
|
|
cflags = 'CFLAGS'
|
2021-08-05 06:53:07 +00:00
|
|
|
opts[cflags] = state.environment[cflags] + ' -D_FILE_OFFSET_BITS=64 -O2'
|
2021-01-14 08:34:20 +00:00
|
|
|
|
|
|
|
def post_build(self, state: BuildState):
|
2022-08-28 06:51:13 +00:00
|
|
|
opts = state.options
|
|
|
|
opts['install'] = None
|
|
|
|
opts['PREFIX'] = state.install_path
|
2021-01-14 08:34:20 +00:00
|
|
|
|
2021-08-05 06:59:49 +00:00
|
|
|
self.install(state, state.options)
|
2021-01-14 08:34:20 +00:00
|
|
|
self.write_pc_file(state, description='bzip2 compression library', version='1.0.8', libs='-lbz2')
|
|
|
|
|
|
|
|
|
2023-03-21 10:52:54 +00:00
|
|
|
class FfiTarget(base.ConfigureMakeStaticDependencyTarget):
|
2021-01-14 08:34:20 +00:00
|
|
|
def __init__(self, name='ffi'):
|
|
|
|
super().__init__(name)
|
|
|
|
|
|
|
|
def prepare_source(self, state: BuildState):
|
|
|
|
state.download_source(
|
2021-07-03 12:53:59 +00:00
|
|
|
'https://github.com/libffi/libffi/releases/download/v3.4.2/libffi-3.4.2.tar.gz',
|
|
|
|
'540fb721619a6aba3bdeef7d940d8e9e0e6d2c193595bc243241b77ff9e93620')
|
2021-01-14 08:34:20 +00:00
|
|
|
|
|
|
|
def detect(self, state: BuildState) -> bool:
|
2021-07-22 06:51:13 +00:00
|
|
|
return state.has_source_file('libffi.pc.in')
|
2021-01-14 08:34:20 +00:00
|
|
|
|
|
|
|
def post_build(self, state: BuildState):
|
|
|
|
super().post_build(state)
|
|
|
|
|
|
|
|
for header in ('ffi.h', 'ffitarget.h'):
|
|
|
|
self.make_platform_header(state, header)
|
|
|
|
|
|
|
|
|
2023-03-21 10:52:54 +00:00
|
|
|
class FlacTarget(base.CMakeStaticDependencyTarget):
|
2021-01-14 08:34:20 +00:00
|
|
|
def __init__(self, name='flac'):
|
|
|
|
super().__init__(name)
|
2021-06-02 07:32:25 +00:00
|
|
|
|
2021-01-14 08:34:20 +00:00
|
|
|
def prepare_source(self, state: BuildState):
|
|
|
|
state.download_source(
|
2023-06-23 08:45:01 +00:00
|
|
|
'https://github.com/xiph/flac/releases/download/1.4.3/flac-1.4.3.tar.xz',
|
|
|
|
'6c58e69cd22348f441b861092b825e591d0b822e106de6eb0ee4d05d27205b70')
|
2021-01-14 08:34:20 +00:00
|
|
|
|
2021-06-02 07:32:25 +00:00
|
|
|
def configure(self, state: BuildState):
|
2021-08-05 06:59:49 +00:00
|
|
|
opts = state.options
|
|
|
|
opts['BUILD_CXXLIBS'] = 'NO'
|
|
|
|
opts['BUILD_EXAMPLES'] = 'NO'
|
2022-09-10 07:42:33 +00:00
|
|
|
opts['BUILD_PROGRAMS'] = 'NO'
|
|
|
|
opts['BUILD_TESTING'] = 'NO'
|
2021-08-05 06:59:49 +00:00
|
|
|
|
2021-06-02 07:32:25 +00:00
|
|
|
super().configure(state)
|
|
|
|
|
2021-01-14 08:34:20 +00:00
|
|
|
|
2023-03-21 10:52:54 +00:00
|
|
|
class GettextTarget(base.ConfigureMakeStaticDependencyTarget):
|
2021-01-14 08:34:20 +00:00
|
|
|
def __init__(self, name='gettext'):
|
|
|
|
super().__init__(name)
|
|
|
|
|
|
|
|
def prepare_source(self, state: BuildState):
|
|
|
|
state.download_source(
|
|
|
|
'https://ftp.gnu.org/gnu/gettext/gettext-0.21.tar.xz',
|
|
|
|
'd20fcbb537e02dcf1383197ba05bd0734ef7bf5db06bdb241eb69b7d16b73192')
|
|
|
|
|
|
|
|
def detect(self, state: BuildState) -> bool:
|
2021-07-22 06:51:13 +00:00
|
|
|
return state.has_source_file('gettext-runtime')
|
2021-01-14 08:34:20 +00:00
|
|
|
|
2021-08-05 06:59:49 +00:00
|
|
|
def configure(self, state: BuildState):
|
|
|
|
opts = state.options
|
|
|
|
opts['--enable-csharp'] = 'no'
|
|
|
|
opts['--enable-java'] = 'no'
|
|
|
|
opts['--enable-libasprintf'] = 'no'
|
|
|
|
|
|
|
|
super().configure(state)
|
|
|
|
|
2021-01-14 08:34:20 +00:00
|
|
|
|
2023-03-27 08:01:27 +00:00
|
|
|
class GlibTarget(base.MesonTarget):
|
2021-01-14 08:34:20 +00:00
|
|
|
def __init__(self, name='glib'):
|
|
|
|
super().__init__(name)
|
|
|
|
|
|
|
|
def prepare_source(self, state: BuildState):
|
|
|
|
state.download_source(
|
2022-08-30 13:13:42 +00:00
|
|
|
'https://download.gnome.org/sources/glib/2.72/glib-2.72.3.tar.xz',
|
2022-08-30 13:14:11 +00:00
|
|
|
'4a39a2f624b8512d500d5840173eda7fa85f51c109052eae806acece85d345f0',
|
|
|
|
patches='glib-fix-paths')
|
2021-01-14 08:34:20 +00:00
|
|
|
|
|
|
|
def detect(self, state: BuildState) -> bool:
|
2021-07-22 06:51:13 +00:00
|
|
|
return state.has_source_file('glib.doap')
|
2021-01-14 08:34:20 +00:00
|
|
|
|
|
|
|
def configure(self, state: BuildState):
|
2023-03-27 08:01:27 +00:00
|
|
|
# Additional frameworks are needed for proper detection of libintl
|
|
|
|
ld_key = 'LDFLAGS'
|
|
|
|
ld_value = '-framework CoreFoundation -framework Foundation'
|
|
|
|
env = state.environment
|
|
|
|
env[ld_key] = (env[ld_key] + ' ' + ld_value) if ld_key in env else ld_value
|
2021-01-14 08:34:20 +00:00
|
|
|
|
2023-03-27 08:01:27 +00:00
|
|
|
super().configure(state)
|
2021-01-14 08:34:20 +00:00
|
|
|
|
|
|
|
def post_build(self, state: BuildState):
|
2023-03-27 08:01:27 +00:00
|
|
|
super().post_build(state)
|
2021-07-04 09:39:07 +00:00
|
|
|
self.make_platform_header(state, '../lib/glib-2.0/include/glibconfig.h')
|
2021-01-14 08:34:20 +00:00
|
|
|
|
2021-07-04 09:38:35 +00:00
|
|
|
@staticmethod
|
2021-08-01 13:14:43 +00:00
|
|
|
def _process_pkg_config(pcfile: Path, line: str) -> str:
|
2021-07-04 09:38:35 +00:00
|
|
|
return 'exec_prefix=${prefix}\n' + line if line.startswith('libdir=') else line
|
|
|
|
|
2021-01-14 08:34:20 +00:00
|
|
|
|
2023-03-21 10:52:54 +00:00
|
|
|
class IconvTarget(base.ConfigureMakeStaticDependencyTarget):
|
2021-01-14 08:34:20 +00:00
|
|
|
def __init__(self, name='iconv'):
|
|
|
|
super().__init__(name)
|
|
|
|
|
|
|
|
def prepare_source(self, state: BuildState):
|
|
|
|
state.download_source(
|
2023-11-03 11:11:31 +00:00
|
|
|
'https://ftp.gnu.org/gnu/libiconv/libiconv-1.17.tar.gz',
|
|
|
|
'8f74213b56238c85a50a5329f77e06198771e70dd9a739779f4c02f65d971313')
|
2021-01-14 08:34:20 +00:00
|
|
|
|
|
|
|
def detect(self, state: BuildState) -> bool:
|
2021-07-22 06:51:13 +00:00
|
|
|
return state.has_source_file('include/iconv.h.in')
|
2021-01-14 08:34:20 +00:00
|
|
|
|
2021-08-05 06:59:49 +00:00
|
|
|
def configure(self, state: BuildState):
|
|
|
|
state.options['--enable-extra-encodings'] = 'yes'
|
|
|
|
super().configure(state)
|
|
|
|
|
2021-01-14 08:34:20 +00:00
|
|
|
|
|
|
|
class IntlTarget(GettextTarget):
|
|
|
|
def __init__(self, name='intl'):
|
|
|
|
super().__init__(name)
|
2021-08-14 09:31:34 +00:00
|
|
|
|
|
|
|
def configure(self, state: BuildState):
|
2022-08-28 07:02:10 +00:00
|
|
|
state.options['--localedir'] = '/usr/local/share/locale'
|
|
|
|
|
2021-08-14 12:59:39 +00:00
|
|
|
# There is no way to configure intl only, do this for the runtime
|
2021-01-14 08:34:20 +00:00
|
|
|
self.src_root = 'gettext-runtime'
|
2021-08-14 09:31:34 +00:00
|
|
|
super().configure(state)
|
|
|
|
|
|
|
|
def build(self, state: BuildState):
|
|
|
|
# Build intl only, avoid complete gettext runtime
|
|
|
|
self.src_root += '/intl'
|
|
|
|
super().build(state)
|
2021-01-14 08:34:20 +00:00
|
|
|
|
|
|
|
def post_build(self, state: BuildState):
|
2022-08-28 07:02:10 +00:00
|
|
|
opts = state.options
|
|
|
|
opts['install-exec-am'] = None
|
|
|
|
opts['install-nodist_includeHEADERS'] = None
|
|
|
|
|
2021-08-14 09:31:34 +00:00
|
|
|
# Install intl only, avoid complete gettext runtime
|
|
|
|
state.build_path /= self.src_root
|
2022-08-28 07:02:10 +00:00
|
|
|
self.install(state, state.options)
|
2021-01-14 08:34:20 +00:00
|
|
|
|
|
|
|
|
2023-03-21 10:52:54 +00:00
|
|
|
class LameTarget(base.ConfigureMakeStaticDependencyTarget):
|
2022-12-26 13:33:58 +00:00
|
|
|
def __init__(self, name='lame'):
|
|
|
|
super().__init__(name)
|
|
|
|
|
|
|
|
def prepare_source(self, state: BuildState):
|
|
|
|
state.download_source(
|
|
|
|
'https://sourceforge.net/projects/lame/files/lame/3.100/lame-3.100.tar.gz',
|
|
|
|
'ddfe36cab873794038ae2c1210557ad34857a4b6bdc515785d1da9e175b1da1e')
|
|
|
|
|
|
|
|
def detect(self, state: BuildState) -> bool:
|
|
|
|
return state.has_source_file('lame.spec')
|
|
|
|
|
|
|
|
|
2023-03-21 10:52:54 +00:00
|
|
|
class MoltenVKTarget(base.MakeTarget):
|
2021-01-14 08:34:20 +00:00
|
|
|
def __init__(self, name='moltenvk'):
|
|
|
|
super().__init__(name)
|
2021-08-05 06:59:49 +00:00
|
|
|
|
2021-01-14 08:34:20 +00:00
|
|
|
# Building for multiple architectures is handled internally
|
|
|
|
self.multi_platform = False
|
|
|
|
|
|
|
|
def prepare_source(self, state: BuildState):
|
|
|
|
state.download_source(
|
2024-10-03 08:49:54 +00:00
|
|
|
'https://github.com/KhronosGroup/MoltenVK/archive/refs/tags/v1.2.11.tar.gz',
|
|
|
|
'bfa115e283831e52d70ee5e13adf4d152de8f0045996cf2a33f0ac541be238b1')
|
2022-08-18 07:36:39 +00:00
|
|
|
|
|
|
|
def initialize(self, state: BuildState):
|
|
|
|
super().initialize(state)
|
|
|
|
self._make_dylib(state)
|
2021-01-14 08:34:20 +00:00
|
|
|
|
|
|
|
def detect(self, state: BuildState) -> bool:
|
2021-07-22 06:51:13 +00:00
|
|
|
return state.has_source_file('MoltenVKPackaging.xcodeproj')
|
2021-01-14 08:34:20 +00:00
|
|
|
|
|
|
|
def configure(self, state: BuildState):
|
2021-08-05 06:59:49 +00:00
|
|
|
state.options['macos'] = None
|
|
|
|
|
2021-01-14 08:34:20 +00:00
|
|
|
# Unset platform to avoid using specified macOS deployment target and SDK
|
|
|
|
# MoltenVK defines minimal OS version itself, and usually, it requires the very recent SDK
|
|
|
|
state.platform = None
|
|
|
|
|
|
|
|
super().configure(state)
|
|
|
|
|
|
|
|
def build(self, state: BuildState):
|
2022-06-10 06:34:48 +00:00
|
|
|
args = ['./fetchDependencies', '--macos']
|
|
|
|
if state.verbose:
|
|
|
|
args.append('-v')
|
2022-08-18 07:36:39 +00:00
|
|
|
subprocess.run(args, check=True, cwd=state.build_path, env=state.environment)
|
2021-01-14 08:34:20 +00:00
|
|
|
|
|
|
|
super().build(state)
|
|
|
|
|
|
|
|
def post_build(self, state: BuildState):
|
|
|
|
if state.xcode:
|
|
|
|
return
|
|
|
|
|
2021-07-22 06:51:13 +00:00
|
|
|
if state.install_path.exists():
|
2021-01-14 08:34:20 +00:00
|
|
|
shutil.rmtree(state.install_path)
|
|
|
|
|
2021-09-08 07:43:57 +00:00
|
|
|
include_path = state.install_path / 'include'
|
|
|
|
os.makedirs(include_path)
|
|
|
|
|
2021-07-22 06:51:13 +00:00
|
|
|
lib_path = state.install_path / 'lib'
|
2021-01-14 08:34:20 +00:00
|
|
|
os.makedirs(lib_path)
|
|
|
|
|
2021-07-22 06:51:13 +00:00
|
|
|
src_path = state.build_path / 'Package/Latest/MoltenVK'
|
2021-09-08 07:43:57 +00:00
|
|
|
shutil.copytree(src_path / 'include/MoltenVK', include_path / 'MoltenVK')
|
2021-09-01 08:34:35 +00:00
|
|
|
shutil.copy(state.build_path / 'LICENSE', state.install_path / 'apache2.txt')
|
2022-08-18 07:36:39 +00:00
|
|
|
shutil.copy(
|
2024-03-14 13:29:56 +00:00
|
|
|
src_path / 'static/MoltenVK.xcframework/macos-arm64_x86_64/libMoltenVK.a',
|
2022-08-18 07:36:39 +00:00
|
|
|
lib_path / 'libMoltenVK-static.a')
|
|
|
|
|
|
|
|
self._make_dylib(state)
|
|
|
|
|
|
|
|
def _make_dylib(self, state: BuildState):
|
|
|
|
lib_path = state.deps_path / self.name / 'lib'
|
|
|
|
static_lib_path = lib_path / 'libMoltenVK-static.a'
|
|
|
|
dynamic_lib_path = lib_path / 'libMoltenVK.dylib'
|
|
|
|
|
|
|
|
static_lib_time = os.stat(static_lib_path).st_mtime
|
|
|
|
dynamic_lib_time = os.stat(dynamic_lib_path).st_mtime if os.path.exists(dynamic_lib_path) else 0
|
|
|
|
|
|
|
|
if static_lib_time != dynamic_lib_time:
|
2024-02-23 11:08:51 +00:00
|
|
|
os.makedirs(state.lib_path, exist_ok=True)
|
|
|
|
|
2023-10-08 07:34:55 +00:00
|
|
|
args = [
|
2022-08-18 07:36:39 +00:00
|
|
|
'clang++',
|
|
|
|
'-stdlib=libc++',
|
|
|
|
'-dynamiclib',
|
|
|
|
'-arch', 'arm64',
|
|
|
|
'-arch', 'x86_64',
|
2024-03-14 13:29:39 +00:00
|
|
|
'-mmacosx-version-min=10.15',
|
2022-08-18 07:36:39 +00:00
|
|
|
'-compatibility_version', '1.0.0',
|
|
|
|
'-current_version', '1.0.0',
|
|
|
|
'-install_name', '@rpath/libMoltenVK.dylib',
|
|
|
|
'-framework', 'Metal',
|
|
|
|
'-framework', 'IOSurface',
|
|
|
|
'-framework', 'AppKit',
|
|
|
|
'-framework', 'QuartzCore',
|
|
|
|
'-framework', 'CoreGraphics',
|
|
|
|
'-framework', 'IOKit',
|
|
|
|
'-framework', 'Foundation',
|
|
|
|
'-o', dynamic_lib_path,
|
|
|
|
'-force_load', static_lib_path
|
2023-10-08 07:34:55 +00:00
|
|
|
]
|
2023-11-03 11:10:02 +00:00
|
|
|
args += shlex.split(state.linker_flags())
|
2023-10-08 07:34:55 +00:00
|
|
|
|
2022-08-18 07:36:39 +00:00
|
|
|
subprocess.run(args, check=True, env=state.environment)
|
|
|
|
os.utime(dynamic_lib_path, (static_lib_time, static_lib_time))
|
2021-01-14 08:34:20 +00:00
|
|
|
|
|
|
|
|
2023-03-21 10:52:54 +00:00
|
|
|
class Mpg123Target(base.CMakeStaticDependencyTarget):
|
2021-01-14 08:34:20 +00:00
|
|
|
def __init__(self, name='mpg123'):
|
|
|
|
super().__init__(name)
|
2021-06-01 09:51:30 +00:00
|
|
|
self.src_root = 'ports/cmake'
|
|
|
|
|
2021-01-14 08:34:20 +00:00
|
|
|
def prepare_source(self, state: BuildState):
|
|
|
|
state.download_source(
|
2024-11-07 10:18:30 +00:00
|
|
|
'https://www.mpg123.de/download/mpg123-1.32.9.tar.bz2',
|
|
|
|
'03b61e4004e960bacf2acdada03ed94d376e6aab27a601447bd4908d8407b291',
|
2024-08-09 12:55:12 +00:00
|
|
|
patches=('mpg123-have-fpu', 'mpg123-no-syn123'))
|
2021-01-14 08:34:20 +00:00
|
|
|
|
2021-08-05 06:59:49 +00:00
|
|
|
def configure(self, state: BuildState):
|
2022-07-20 08:04:50 +00:00
|
|
|
opts = state.options
|
|
|
|
opts['BUILD_LIBOUT123'] = 'NO'
|
|
|
|
opts['BUILD_PROGRAMS'] = 'NO'
|
2021-08-05 06:59:49 +00:00
|
|
|
|
2022-07-20 08:04:50 +00:00
|
|
|
super().configure(state)
|
2021-06-02 09:51:31 +00:00
|
|
|
|
2021-01-14 08:34:20 +00:00
|
|
|
|
2023-03-21 10:52:54 +00:00
|
|
|
class OggTarget(base.CMakeStaticDependencyTarget):
|
2021-01-14 08:34:20 +00:00
|
|
|
def __init__(self, name='ogg'):
|
|
|
|
super().__init__(name)
|
|
|
|
|
|
|
|
def prepare_source(self, state: BuildState):
|
|
|
|
state.download_source(
|
2021-06-04 06:43:22 +00:00
|
|
|
'https://github.com/xiph/ogg/releases/download/v1.3.5/libogg-1.3.5.tar.xz',
|
|
|
|
'c4d91be36fc8e54deae7575241e03f4211eb102afb3fc0775fbbc1b740016705')
|
2021-01-14 08:34:20 +00:00
|
|
|
|
|
|
|
|
2023-03-21 10:52:54 +00:00
|
|
|
class OpenALTarget(base.CMakeStaticDependencyTarget):
|
2021-01-14 08:34:20 +00:00
|
|
|
def __init__(self, name='openal'):
|
|
|
|
super().__init__(name)
|
|
|
|
|
|
|
|
def prepare_source(self, state: BuildState):
|
|
|
|
state.download_source(
|
2023-04-12 07:13:08 +00:00
|
|
|
'https://openal-soft.org/openal-releases/openal-soft-1.23.1.tar.bz2',
|
|
|
|
'796f4b89134c4e57270b7f0d755f0fa3435b90da437b745160a49bd41c845b21')
|
2021-01-14 08:34:20 +00:00
|
|
|
|
2021-08-05 06:59:49 +00:00
|
|
|
def configure(self, state: BuildState):
|
|
|
|
opts = state.options
|
|
|
|
opts['ALSOFT_EXAMPLES'] = 'NO'
|
|
|
|
opts['ALSOFT_UTILS'] = 'NO'
|
|
|
|
opts['LIBTYPE'] = 'STATIC'
|
|
|
|
|
|
|
|
super().configure(state)
|
|
|
|
|
2021-01-14 08:34:20 +00:00
|
|
|
|
2023-03-21 10:52:54 +00:00
|
|
|
class OpusTarget(base.CMakeStaticDependencyTarget):
|
2021-01-14 08:34:20 +00:00
|
|
|
def __init__(self, name='opus'):
|
|
|
|
super().__init__(name)
|
|
|
|
|
|
|
|
def prepare_source(self, state: BuildState):
|
2024-03-12 10:23:02 +00:00
|
|
|
# Temporary solution for lack of TLSv1.3 support in Apple Python
|
|
|
|
# The following URL cannot be retrieved using Python 3.9.6 from Xcode 15.x
|
|
|
|
# https://downloads.xiph.org/releases/opus/opus-1.5.1.tar.gz
|
|
|
|
# ssl.SSLError: [SSL: TLSV1_ALERT_PROTOCOL_VERSION] tlsv1 alert protocol version (_ssl.c:1129)
|
|
|
|
# >>> import ssl; print(ssl.OPENSSL_VERSION, ssl.HAS_TLSv1_3)
|
|
|
|
# LibreSSL 2.8.3 False
|
|
|
|
# TODO: remove this workaround when TLSv1.3 will be available in Python shipped with Xcode
|
2021-01-14 08:34:20 +00:00
|
|
|
state.download_source(
|
2024-04-18 14:48:33 +00:00
|
|
|
'https://ftp.osuosl.org/pub/xiph/releases/opus/opus-1.5.2.tar.gz',
|
|
|
|
'65c1d2f78b9f2fb20082c38cbe47c951ad5839345876e46941612ee87f9a7ce1')
|
2021-01-14 08:34:20 +00:00
|
|
|
|
2021-08-05 06:59:49 +00:00
|
|
|
def configure(self, state: BuildState):
|
|
|
|
state.options['PC_BUILD'] = 'floating-point'
|
|
|
|
super().configure(state)
|
|
|
|
|
2021-06-02 09:12:03 +00:00
|
|
|
@staticmethod
|
2021-08-01 13:14:43 +00:00
|
|
|
def _process_pkg_config(pcfile: Path, line: str) -> str:
|
2021-06-02 09:12:03 +00:00
|
|
|
cflags = 'Cflags:'
|
|
|
|
libs = 'Libs:'
|
|
|
|
|
2023-04-20 07:21:09 +00:00
|
|
|
if line.startswith(cflags):
|
2021-06-02 09:12:03 +00:00
|
|
|
return cflags + ' -I${includedir}/opus\n'
|
|
|
|
elif line.startswith(libs):
|
|
|
|
return libs + ' -L${libdir} -lopus\n'
|
|
|
|
|
|
|
|
return line
|
|
|
|
|
2021-01-14 08:34:20 +00:00
|
|
|
|
2023-03-21 10:52:54 +00:00
|
|
|
class PcreTarget(base.ConfigureMakeStaticDependencyTarget):
|
2021-01-14 08:34:20 +00:00
|
|
|
def __init__(self, name='pcre'):
|
|
|
|
super().__init__(name)
|
|
|
|
|
|
|
|
def prepare_source(self, state: BuildState):
|
|
|
|
state.download_source(
|
2021-07-03 12:43:43 +00:00
|
|
|
'https://ftp.pcre.org/pub/pcre/pcre-8.45.tar.bz2',
|
|
|
|
'4dae6fdcd2bb0bb6c37b5f97c33c2be954da743985369cddac3546e3218bffb8')
|
2021-01-14 08:34:20 +00:00
|
|
|
|
|
|
|
def detect(self, state: BuildState) -> bool:
|
2021-07-22 06:51:13 +00:00
|
|
|
return state.has_source_file('pcre.h.in')
|
2021-01-14 08:34:20 +00:00
|
|
|
|
2021-08-05 06:59:49 +00:00
|
|
|
def configure(self, state: BuildState):
|
|
|
|
opts = state.options
|
|
|
|
opts['--enable-unicode-properties'] = 'yes'
|
|
|
|
opts['--enable-cpp'] = 'no'
|
|
|
|
|
|
|
|
super().configure(state)
|
|
|
|
|
2021-07-03 12:49:16 +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/pcre-config')
|
2021-07-03 12:49:16 +00:00
|
|
|
|
2021-01-14 08:34:20 +00:00
|
|
|
|
2023-03-21 10:52:54 +00:00
|
|
|
class QuasiGlibTarget(base.CMakeStaticDependencyTarget):
|
2022-12-28 10:47:15 +00:00
|
|
|
def __init__(self, name='quasi-glib'):
|
|
|
|
super().__init__(name)
|
|
|
|
|
2022-12-31 08:46:59 +00:00
|
|
|
def prepare_source(self, state: BuildState):
|
|
|
|
state.source = state.patch_path / self.name
|
2022-12-28 10:47:15 +00:00
|
|
|
|
|
|
|
|
2023-03-21 10:52:54 +00:00
|
|
|
class SndFileTarget(base.CMakeStaticDependencyTarget):
|
2021-01-14 08:34:20 +00:00
|
|
|
def __init__(self, name='sndfile'):
|
|
|
|
super().__init__(name)
|
|
|
|
|
|
|
|
def prepare_source(self, state: BuildState):
|
|
|
|
state.download_source(
|
2023-08-14 06:45:39 +00:00
|
|
|
'https://github.com/libsndfile/libsndfile/releases/download/1.2.2/libsndfile-1.2.2.tar.xz',
|
|
|
|
'3799ca9924d3125038880367bf1468e53a1b7e3686a934f098b7e1d286cdb80e')
|
2021-01-14 08:34:20 +00:00
|
|
|
|
2021-08-05 06:59:49 +00:00
|
|
|
def configure(self, state: BuildState):
|
|
|
|
opts = state.options
|
2022-12-26 13:50:52 +00:00
|
|
|
opts['BUILD_EXAMPLES'] = 'NO'
|
|
|
|
opts['BUILD_PROGRAMS'] = 'NO'
|
2021-08-05 06:59:49 +00:00
|
|
|
opts['BUILD_TESTING'] = 'NO'
|
2022-12-26 13:50:52 +00:00
|
|
|
opts['ENABLE_CPACK'] = 'NO'
|
2021-08-05 06:59:49 +00:00
|
|
|
|
|
|
|
super().configure(state)
|
|
|
|
|
2021-01-14 08:34:20 +00:00
|
|
|
|
2023-03-21 10:52:54 +00:00
|
|
|
class VorbisTarget(base.CMakeStaticDependencyTarget):
|
2021-01-14 08:34:20 +00:00
|
|
|
def __init__(self, name='vorbis'):
|
|
|
|
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/vorbis/libvorbis-1.3.7.tar.xz',
|
2021-01-14 08:34:20 +00:00
|
|
|
'b33cc4934322bcbf6efcbacf49e3ca01aadbea4114ec9589d1b1e9d20f72954b')
|
|
|
|
|
|
|
|
|
2023-03-21 10:52:54 +00:00
|
|
|
class VpxTarget(base.ConfigureMakeDependencyTarget):
|
2021-01-14 08:34:20 +00:00
|
|
|
def __init__(self, name='vpx'):
|
|
|
|
super().__init__(name)
|
|
|
|
|
|
|
|
def prepare_source(self, state: BuildState):
|
|
|
|
state.download_source(
|
2024-06-01 08:47:43 +00:00
|
|
|
'https://github.com/webmproject/libvpx/archive/refs/tags/v1.14.1.tar.gz',
|
|
|
|
'901747254d80a7937c933d03bd7c5d41e8e6c883e0665fadcb172542167c7977')
|
2021-01-14 08:34:20 +00:00
|
|
|
|
2022-08-31 12:54:09 +00:00
|
|
|
def detect(self, state: BuildState) -> bool:
|
|
|
|
return state.has_source_file('vpxstats.h')
|
|
|
|
|
2021-01-14 08:34:20 +00:00
|
|
|
def configure(self, state: BuildState):
|
|
|
|
hosts = {
|
2024-03-14 13:29:39 +00:00
|
|
|
'x86_64': 'x86_64-darwin19-gcc',
|
2021-01-14 08:34:20 +00:00
|
|
|
'arm64': 'arm64-darwin20-gcc',
|
|
|
|
}
|
2021-08-05 06:59:49 +00:00
|
|
|
|
|
|
|
opts = state.options
|
|
|
|
opts['--disable-examples'] = None
|
|
|
|
opts['--disable-unit-tests'] = None
|
|
|
|
opts['--target'] = hosts[state.architecture()]
|
2021-01-14 08:34:20 +00:00
|
|
|
|
|
|
|
super().configure(state)
|
|
|
|
|
2022-08-31 13:00:08 +00:00
|
|
|
def clean_build_config(line: str):
|
|
|
|
cfg_prefix = 'static const char* const cfg = '
|
|
|
|
return f'{cfg_prefix}"";\n' if line.startswith(cfg_prefix) else line
|
|
|
|
|
|
|
|
self.update_text_file(state.build_path / 'vpx_config.c', clean_build_config)
|
|
|
|
|
2021-01-14 08:34:20 +00:00
|
|
|
|
2023-03-21 10:52:54 +00:00
|
|
|
class ZMusicTarget(base.CMakeStaticDependencyTarget):
|
2021-01-14 08:34:20 +00:00
|
|
|
def __init__(self, name='zmusic'):
|
|
|
|
super().__init__(name)
|
|
|
|
|
|
|
|
def prepare_source(self, state: BuildState):
|
|
|
|
state.download_source(
|
2024-10-10 06:56:14 +00:00
|
|
|
'https://github.com/ZDoom/ZMusic/archive/refs/tags/1.1.14.tar.gz',
|
|
|
|
'f04410fe4ea08136f37703e7715c27df4c8532ace1e721cf40c6f303a93acc54')
|
2021-01-14 08:34:20 +00:00
|
|
|
|
|
|
|
def detect(self, state: BuildState) -> bool:
|
2021-07-22 06:51:13 +00:00
|
|
|
return state.has_source_file('include/zmusic.h')
|
2021-08-05 06:59:49 +00:00
|
|
|
|
|
|
|
def configure(self, state: BuildState):
|
|
|
|
opts = state.options
|
|
|
|
opts['DYN_MPG123'] = 'OFF'
|
|
|
|
opts['DYN_SNDFILE'] = 'OFF'
|
|
|
|
|
|
|
|
super().configure(state)
|
2022-11-05 15:16:52 +00:00
|
|
|
|
|
|
|
def post_build(self, state: BuildState):
|
|
|
|
super().post_build(state)
|
|
|
|
|
|
|
|
# Fix full path to glib
|
|
|
|
link_libs_key = ' INTERFACE_LINK_LIBRARIES '
|
|
|
|
link_libs_value = r'"\$<LINK_ONLY:sndfile>;\$<LINK_ONLY:mpg123>;\$<LINK_ONLY:ZLIB::ZLIB>;glib-2.0"'
|
|
|
|
module_path = state.install_path / 'lib/cmake/ZMusic'
|
|
|
|
|
|
|
|
def update_cmake_libs(line: str):
|
|
|
|
return f'{link_libs_key}{link_libs_value}\n' if line.startswith(link_libs_key) else line
|
|
|
|
|
|
|
|
for kind in ('Full', 'Lite'):
|
|
|
|
self.update_text_file(module_path / f'ZMusic{kind}Targets.cmake', update_cmake_libs)
|