python/build/libs.py: build CURL with OpenSSL support

Closes https://github.com/MusicPlayerDaemon/MPD/issues/1059
This commit is contained in:
Max Kellermann 2021-01-21 14:13:59 +01:00
parent 1afa33c3c7
commit 168d6257b4
5 changed files with 67 additions and 2 deletions

2
NEWS
View File

@ -10,6 +10,8 @@ ver 0.22.4 (not yet released)
- ffmpeg: detect the output sample format - ffmpeg: detect the output sample format
* output * output
- moveoutput: fix always_on and tag lost on move - moveoutput: fix always_on and tag lost on move
* Android
- enable https:// support (via OpenSSL)
ver 0.22.3 (2020/11/06) ver 0.22.3 (2020/11/06)
* playlist * playlist

View File

@ -172,6 +172,7 @@ thirdparty_libs = [
wildmidi, wildmidi,
gme, gme,
ffmpeg, ffmpeg,
openssl,
curl, curl,
libexpat, libexpat,
libnfs, libnfs,

View File

@ -7,6 +7,7 @@ from build.meson import MesonProject
from build.cmake import CmakeProject from build.cmake import CmakeProject
from build.autotools import AutotoolsProject from build.autotools import AutotoolsProject
from build.ffmpeg import FfmpegProject from build.ffmpeg import FfmpegProject
from build.openssl import OpenSSLProject
from build.boost import BoostProject from build.boost import BoostProject
libmpdclient = MesonProject( libmpdclient = MesonProject(
@ -376,6 +377,12 @@ ffmpeg = FfmpegProject(
], ],
) )
openssl = OpenSSLProject(
'https://www.openssl.org/source/openssl-3.0.0-alpha10.tar.gz',
'b1699acf2148db31f12edf5ebfdf12a92bfd3f0e60538d169710408a3cd3b138',
'include/openssl/ossl_typ.h',
)
curl = AutotoolsProject( curl = AutotoolsProject(
'http://curl.haxx.se/download/curl-7.74.0.tar.xz', 'http://curl.haxx.se/download/curl-7.74.0.tar.xz',
'999d5f2c403cf6e25d58319fdd596611e455dd195208746bc6e6d197a77e878b', '999d5f2c403cf6e25d58319fdd596611e455dd195208746bc6e6d197a77e878b',
@ -399,7 +406,7 @@ curl = AutotoolsProject(
'--disable-netrc', '--disable-netrc',
'--disable-progress-meter', '--disable-progress-meter',
'--disable-alt-svc', '--disable-alt-svc',
'--without-ssl', '--without-gnutls', '--without-nss', '--without-libssh2', '--without-gnutls', '--without-nss', '--without-libssh2',
], ],
patches='src/lib/curl/patches', patches='src/lib/curl/patches',

55
python/build/openssl.py Normal file
View File

@ -0,0 +1,55 @@
import subprocess
from build.makeproject import MakeProject
class OpenSSLProject(MakeProject):
def __init__(self, url, md5, installed,
**kwargs):
MakeProject.__init__(self, url, md5, installed, install_target='install_dev', **kwargs)
def get_make_args(self, toolchain):
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 build(self, toolchain):
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
# "toolchain_arch" (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
'arm-linux-androideabi': 'linux-generic32',
'aarch64-linux-android': 'linux-aarch64',
'i686-linux-android': 'linux-x86-clang',
'x86_64-linux-android': 'linux-x86_64-clang',
# Kobo
'arm-linux-gnueabihf': 'linux-generic32',
# Windows
'i686-w64-mingw32': 'mingw',
'x86_64-w64-mingw32': 'mingw64',
}
openssl_arch = openssl_archs[toolchain.arch]
subprocess.check_call(['./Configure',
'no-shared',
'no-module', 'no-engine', 'no-static-engine',
'no-async',
'no-tests',
'no-asm', # "asm" causes build failures on Windows
openssl_arch,
'--prefix=' + toolchain.install_prefix],
cwd=src, env=toolchain.env)
MakeProject.build(self, toolchain, src)

View File

@ -20,7 +20,7 @@ class Project:
self.base = base self.base = base
if name is None or version is None: if name is None or version is None:
m = re.match(r'^([-\w]+)-(\d[\d.]*[a-z]?[\d.]*)$', self.base) m = re.match(r'^([-\w]+)-(\d[\d.]*[a-z]?[\d.]*(?:-alpha\d+)?)$', self.base)
if name is None: name = m.group(1) if name is None: name = m.group(1)
if version is None: version = m.group(2) if version is None: version = m.group(2)