From a6024f476a83423a9a30f0a25b57955e204773b3 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Mon, 11 Dec 2023 10:58:10 +0100 Subject: [PATCH] subprojects: add openssl --- android/build.py | 1 - meson.build | 4 +++ python/build/libs.py | 8 ----- python/build/openssl.py | 78 ---------------------------------------- subprojects/.gitignore | 1 + subprojects/openssl.wrap | 15 ++++++++ 6 files changed, 20 insertions(+), 87 deletions(-) delete mode 100644 python/build/openssl.py create mode 100644 subprojects/openssl.wrap diff --git a/android/build.py b/android/build.py index 0babb3ad2..d7a97f23a 100755 --- a/android/build.py +++ b/android/build.py @@ -37,7 +37,6 @@ thirdparty_libs = [ wildmidi, gme, ffmpeg, - openssl, libnfs, ] diff --git a/meson.build b/meson.build index acd18de34..591ee3743 100644 --- a/meson.build +++ b/meson.build @@ -19,6 +19,7 @@ project( 'gtest:default_library=static', 'liburing:default_library=static', 'ogg:default_library=static', + 'openssl:default_library=static', 'opus:default_library=static', 'sqlite3:default_library=static', 'vorbis:default_library=static', @@ -36,6 +37,8 @@ project( 'sqlite3:warning_level=0', 'oggiopus:werror=false', 'ogg:warning_level=0', + 'openssl:werror=false', + 'openssl:warning_level=0', 'opus:werror=false', 'opus:warning_level=0', 'vorbis:warning_level=0', @@ -68,6 +71,7 @@ project( 'curl:smtp=disabled', 'curl:telnet=disabled', 'curl:tftp=disabled', + 'openssl:build_cli=false', 'opus:docs=disabled', 'opus:extra-programs=disabled', 'opus:tests=disabled', diff --git a/python/build/libs.py b/python/build/libs.py index a05ef112c..9f6f0a4f0 100644 --- a/python/build/libs.py +++ b/python/build/libs.py @@ -7,7 +7,6 @@ from build.meson import MesonProject from build.cmake import CmakeProject from build.autotools import AutotoolsProject from build.ffmpeg import FfmpegProject -from build.openssl import OpenSSLProject libmpdclient = MesonProject( 'https://www.musicpd.org/download/libmpdclient/2/libmpdclient-2.20.tar.xz', @@ -571,13 +570,6 @@ ffmpeg = FfmpegProject( ], ) -openssl = OpenSSLProject( - ('https://www.openssl.org/source/openssl-3.1.4.tar.gz', - 'https://artfiles.org/openssl.org/source/openssl-3.1.4.tar.gz'), - '840af5366ab9b522bde525826be3ef0fb0af81c6a9ebd84caa600fea1731eee3', - 'include/openssl/ossl_typ.h', -) - libnfs = AutotoolsProject( 'https://github.com/sahlberg/libnfs/archive/libnfs-5.0.2.tar.gz', '637e56643b19da9fba98f06847788c4dad308b723156a64748041035dcdf9bd3', diff --git a/python/build/openssl.py b/python/build/openssl.py deleted file mode 100644 index 8b0224598..000000000 --- a/python/build/openssl.py +++ /dev/null @@ -1,78 +0,0 @@ -import subprocess -from typing import Optional, Sequence, Union - -from build.makeproject import MakeProject -from .toolchain import AnyToolchain - -class OpenSSLProject(MakeProject): - def __init__(self, url: Union[str, Sequence[str]], md5: str, installed: str, - **kwargs): - MakeProject.__init__(self, url, md5, installed, install_target='install_dev', **kwargs) - - def get_make_args(self, toolchain: AnyToolchain) -> list[str]: - return MakeProject.get_make_args(self, toolchain) + [ - 'CC=' + toolchain.cc, - 'CFLAGS=' + toolchain.cflags, - 'CPPFLAGS=' + toolchain.cppflags, - 'AR=' + toolchain.ar, - 'RANLIB=' + toolchain.ranlib, - 'build_libs', - ] - - def get_make_install_args(self, toolchain: AnyToolchain) -> list[str]: - # OpenSSL's Makefile runs "ranlib" during installation - return MakeProject.get_make_install_args(self, toolchain) + [ - 'RANLIB=' + toolchain.ranlib, - ] - - def _build(self, toolchain: AnyToolchain) -> None: - src = self.unpack(toolchain, out_of_tree=False) - - # OpenSSL has a weird target architecture scheme with lots of - # hard-coded architectures; this table translates between our - # host triplet and the OpenSSL target - openssl_archs = { - # not using "android-*" because those OpenSSL targets want - # to know where the SDK is, but our own build scripts - # prepared everything already to look like a regular Linux - # build - 'armv7a-linux-androideabi': 'linux-generic32', - 'aarch64-linux-android': 'linux-aarch64', - 'i686-linux-android': 'linux-x86-clang', - 'x86_64-linux-android': 'linux-x86_64-clang', - - # generic Linux - 'arm-linux-gnueabihf': 'linux-generic32', - - # Windows - 'i686-w64-mingw32': 'mingw', - 'x86_64-w64-mingw32': 'mingw64', - - # Apple - 'x86_64-apple-darwin': 'darwin64-x86_64-cc', - 'aarch64-apple-darwin': 'darwin64-arm64-cc', - } - - configure = [ - './Configure', - 'no-shared', - 'no-module', - 'no-engine', - 'no-static-engine', - 'no-async', - 'no-tests', - 'no-makedepend', - '--libdir=lib', # no "lib64" on amd64, please - '--prefix=' + toolchain.install_prefix, - ] - - if toolchain.is_windows: - # workaround for build failures - configure.append('no-asm') - - if toolchain.host_triplet is not None: - configure.append(openssl_archs[toolchain.host_triplet]) - configure.append(f'--cross-compile-prefix={toolchain.host_triplet}-') - - subprocess.check_call(configure, cwd=src, env=toolchain.env) - self.build_make(toolchain, src) diff --git a/subprojects/.gitignore b/subprojects/.gitignore index d2bddb08b..07d4120fb 100644 --- a/subprojects/.gitignore +++ b/subprojects/.gitignore @@ -5,6 +5,7 @@ /flac-*/ /fmt-*/ /googletest-*/ +/openssl-*/ /opus-*/ /sqlite-*/ /libogg-*/ diff --git a/subprojects/openssl.wrap b/subprojects/openssl.wrap new file mode 100644 index 000000000..b69462f53 --- /dev/null +++ b/subprojects/openssl.wrap @@ -0,0 +1,15 @@ +[wrap-file] +directory = openssl-3.0.8 +source_url = https://www.openssl.org/source/openssl-3.0.8.tar.gz +source_filename = openssl-3.0.8.tar.gz +source_hash = 6c13d2bf38fdf31eac3ce2a347073673f5d63263398f1f69d0df4a41253e4b3e +patch_filename = openssl_3.0.8-2_patch.zip +patch_url = https://wrapdb.mesonbuild.com/v2/openssl_3.0.8-2/get_patch +patch_hash = e84b5fe469e681e3318184157a0c7c43d4cbacd078bb88f506e31569f8f75072 +source_fallback_url = https://github.com/mesonbuild/wrapdb/releases/download/openssl_3.0.8-2/openssl-3.0.8.tar.gz +wrapdb_version = 3.0.8-2 + +[provide] +libcrypto = libcrypto_dep +libssl = libssl_dep +openssl = openssl_dep