Add wasm-openssl

This commit is contained in:
Martchus 2024-06-10 20:24:36 +02:00
parent 05c3959e26
commit 6e1a40f2d3
1 changed files with 82 additions and 0 deletions

82
openssl/wasm/PKGBUILD Normal file
View File

@ -0,0 +1,82 @@
# $Id$
# Maintainer: Martchus <martchus@gmx.net>
_pkgname=openssl
_pkgver=3.3.1
pkgname=wasm-$_pkgname
# use a pacman compatible version scheme
pkgver=${_pkgver/[a-z]/.${_pkgver//[0-9.]/}}
pkgrel=1
pkgdesc="The Open Source toolkit for Secure Sockets Layer and Transport Layer Security (wasm)"
arch=('any')
url='https://www.openssl.org'
license=('Apache-2.0')
options=('!strip' '!buildflags' 'staticlibs' '!emptydirs')
depends=('emscripten')
makedepends=('perl')
source=("https://www.openssl.org/source/openssl-${_pkgver}.tar.gz"{,.asc})
sha256sums=('777cd596284c883375a2a7a11bf5d2786fc5413255efab20c50d6ffe6d020b7e'
'SKIP')
validpgpkeys=('8657ABB260F056B1E5190839D9C4D26D0E604491'
'7953AC1FBC3DC8B3B292393ED5E9E43F7DF9EE8C'
'A21FAB74B0088AA361152586B8EF1A6BA9DA2D5C'
'EFC0A467D613CB83C7ED6D30D894E2CE8B3D79F5')
_sdk=/usr/lib/emscripten
_prefix=$_sdk/system
prepare() {
cd "${srcdir}/${_pkgname}-${_pkgver}"
}
build() {
cd "${srcdir}/${_pkgname}-${_pkgver}"
"$_sdk"/emconfigure ./Configure \
CROSS_COMPILE= \
--prefix="$_prefix" \
--openssldir="$_prefix" \
-Wl,--no-allow-shlib-undefined \
-Wl,--no-undefined \
no-tests \
no-asm \
no-async \
no-egd \
no-ktls \
no-module \
no-posix-io \
no-secure-memory \
no-shared \
no-sock \
no-stdio \
no-thread-pool \
no-threads \
no-ui-console \
no-weak-ssl-ciphers \
cc
# get rid of debug printing so the library doesn't depend on stdio (no-stdio and no-ui are not entirely sufficient)
sed -i -e 's/\#define TEST_ENG_OPENSSL_RC4_P_INIT//' crypto/engine/eng_openssl.c
# build only libraries
"$_sdk"/emmake make depend
"$_sdk"/emmake make build_libs
}
package() {
cd "$srcdir/$_pkgname-$_pkgver"
# install header files, libraries and license
for lib in libcrypto.a libssl.a; do
install -D -m0644 $lib "$pkgdir/$_prefix/lib/$lib"
done
for pc in libcrypto.pc libssl.pc openssl.pc; do
install -D -m0644 $pc "$pkgdir/$_prefix/lib/pkgconfig/$pc"
done
mkdir -p "$pkgdir/$_prefix/include"
cp -r include/openssl "$pkgdir/$_prefix/include"
# strip binaries
find "$pkgdir/$_prefix" -name 'lib*.a' -type f -exec "$_sdk/emstrip" -g {} \;
}