subprojects: add openssl

This commit is contained in:
Max Kellermann 2023-12-11 10:58:10 +01:00
parent dfef30a737
commit a6024f476a
6 changed files with 20 additions and 87 deletions

View File

@ -37,7 +37,6 @@ thirdparty_libs = [
wildmidi,
gme,
ffmpeg,
openssl,
libnfs,
]

View File

@ -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',

View File

@ -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',

View File

@ -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)

View File

@ -5,6 +5,7 @@
/flac-*/
/fmt-*/
/googletest-*/
/openssl-*/
/opus-*/
/sqlite-*/
/libogg-*/

15
subprojects/openssl.wrap Normal file
View File

@ -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