summaryrefslogtreecommitdiff
path: root/Ports/openssl
diff options
context:
space:
mode:
authorRodrigo Tobar <rtobarc@gmail.com>2021-09-26 00:07:31 +0800
committerLinus Groh <mail@linusgroh.de>2021-10-05 15:35:48 +0100
commitdc03c559df4c5e76814e4d3e4c5657ebb6187d9b (patch)
tree6387347f537fae64f85a58901a81ba8b184f1e5c /Ports/openssl
parent80e70f95abc7cb585968b3f43fd170af3551dc52 (diff)
downloadserenity-dc03c559df4c5e76814e4d3e4c5657ebb6187d9b.zip
Ports: Compile OpenSSL with threads and as a shared library
By defining our own target platform in the OpenSSL compilation configuration we can now compile an OpenSSL shared library. We need to avoid symbol versioning though, as serenity's LibELF doesn't support this yet. We are now also compiling with threading support to allow using this from Python.
Diffstat (limited to 'Ports/openssl')
-rwxr-xr-xPorts/openssl/package.sh2
-rw-r--r--Ports/openssl/patches/serenity-configuration.patch33
-rw-r--r--Ports/openssl/patches/shared-info.patch16
3 files changed, 50 insertions, 1 deletions
diff --git a/Ports/openssl/package.sh b/Ports/openssl/package.sh
index 8b48fe7836..b91b1c9cd6 100755
--- a/Ports/openssl/package.sh
+++ b/Ports/openssl/package.sh
@@ -8,7 +8,7 @@ files="https://ftp.nluug.nl/security/openssl/openssl-${version}.tar.gz openssl-$
auth_type=sha256
depends=("zlib")
-configopts=("--prefix=/usr/local" "-DOPENSSL_SYS_SERENITY=1" "-DOPENSSL_USE_IPV6=0" "gcc" "zlib" "no-tests" "no-threads" "no-asm")
+configopts=("--prefix=/usr/local" "-DOPENSSL_SYS_SERENITY=1" "-DOPENSSL_USE_IPV6=0" "zlib" "threads" "no-tests" "no-asm" "serenity-generic")
configure() {
run ./"$configscript" "${configopts[@]}"
diff --git a/Ports/openssl/patches/serenity-configuration.patch b/Ports/openssl/patches/serenity-configuration.patch
new file mode 100644
index 0000000000..a6a9b15ac4
--- /dev/null
+++ b/Ports/openssl/patches/serenity-configuration.patch
@@ -0,0 +1,33 @@
+--- openssl-1.1.1k/Configurations/10-main.conf 2021-03-25 21:28:38.000000000 +0800
++++ openssl-1.1.1k/Configurations/10-main.conf 2021-09-26 00:05:04.340004623 +0800
+@@ -627,6 +627,30 @@
+ shared_extension => ".so",
+ },
+
++### Serenity
++ "serenity-generic" => {
++ inherit_from => [ "BASE_unix" ],
++ CC => "gcc",
++ CXX => "g++",
++ CFLAGS => picker(default => "-Wall",
++ debug => "-O0 -g",
++ release => "-O3"),
++ CXXFLAGS => picker(default => "-Wall",
++ debug => "-O0 -g",
++ release => "-O3"),
++ cflags => threads("-pthread"),
++ cxxflags => combine("-std=c++11", threads("-pthread")),
++ lib_cppflags => "-DOPENSSL_USE_NODELETE",
++ ex_libs => add("-ldl", threads("-pthread")),
++ bn_ops => "BN_LLONG RC4_CHAR",
++ thread_scheme => "pthreads",
++ dso_scheme => "dlfcn",
++ shared_target => "serenity-shared",
++ shared_cflag => "-fPIC",
++ shared_ldflag => sub { $disabled{pinshared} ? () : "-Wl,-znodelete" },
++ shared_extension => ".so.\$(SHLIB_VERSION_NUMBER)",
++ },
++
+ ####
+ #### Variety of LINUX:-)
+ ####
diff --git a/Ports/openssl/patches/shared-info.patch b/Ports/openssl/patches/shared-info.patch
new file mode 100644
index 0000000000..7921d871da
--- /dev/null
+++ b/Ports/openssl/patches/shared-info.patch
@@ -0,0 +1,16 @@
+--- openssl-1.1.1k/Configurations/shared-info.pl 2021-03-25 21:28:38.000000000 +0800
++++ openssl-1.1.1k/Configurations/shared-info.pl 2021-09-26 00:05:04.340004623 +0800
+@@ -34,6 +34,13 @@
+ shared_defflag => '-Wl,--version-script=',
+ };
+ },
++ 'serenity-shared' => {
++ shared_ldflag => '-shared',
++ shared_sonameflag => '-Wl,-soname=',
++ # -Map is not really what should be used here, but we need a flag that
++ # accepts a filename and that it's '-version-map'
++ shared_defflag => "-Wl,-Map=",
++ },
+ 'bsd-gcc-shared' => sub { return $shared_info{'linux-shared'}; },
+ 'bsd-shared' => sub {
+ return $shared_info{'gnu-shared'} if detect_gnu_ld();