From 168d6257b41fe88fd1595cd91396b7b0f17a6766 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Thu, 21 Jan 2021 14:13:59 +0100 Subject: [PATCH] python/build/libs.py: build CURL with OpenSSL support Closes https://github.com/MusicPlayerDaemon/MPD/issues/1059 --- NEWS | 2 ++ android/build.py | 1 + python/build/libs.py | 9 ++++++- python/build/openssl.py | 55 +++++++++++++++++++++++++++++++++++++++++ python/build/project.py | 2 +- 5 files changed, 67 insertions(+), 2 deletions(-) create mode 100644 python/build/openssl.py diff --git a/NEWS b/NEWS index d24c90f8c..10c020fa8 100644 --- a/NEWS +++ b/NEWS @@ -10,6 +10,8 @@ ver 0.22.4 (not yet released) - ffmpeg: detect the output sample format * output - moveoutput: fix always_on and tag lost on move +* Android + - enable https:// support (via OpenSSL) ver 0.22.3 (2020/11/06) * playlist diff --git a/android/build.py b/android/build.py index 982160783..eb6600111 100755 --- a/android/build.py +++ b/android/build.py @@ -172,6 +172,7 @@ thirdparty_libs = [ wildmidi, gme, ffmpeg, + openssl, curl, libexpat, libnfs, diff --git a/python/build/libs.py b/python/build/libs.py index c17237c4b..517e892b3 100644 --- a/python/build/libs.py +++ b/python/build/libs.py @@ -7,6 +7,7 @@ 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 from build.boost import BoostProject 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( 'http://curl.haxx.se/download/curl-7.74.0.tar.xz', '999d5f2c403cf6e25d58319fdd596611e455dd195208746bc6e6d197a77e878b', @@ -399,7 +406,7 @@ curl = AutotoolsProject( '--disable-netrc', '--disable-progress-meter', '--disable-alt-svc', - '--without-ssl', '--without-gnutls', '--without-nss', '--without-libssh2', + '--without-gnutls', '--without-nss', '--without-libssh2', ], patches='src/lib/curl/patches', diff --git a/python/build/openssl.py b/python/build/openssl.py new file mode 100644 index 000000000..a7350e6ac --- /dev/null +++ b/python/build/openssl.py @@ -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) diff --git a/python/build/project.py b/python/build/project.py index b78c89238..a0cfa60ba 100644 --- a/python/build/project.py +++ b/python/build/project.py @@ -20,7 +20,7 @@ class Project: self.base = base 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 version is None: version = m.group(2)