summaryrefslogtreecommitdiff
path: root/user/bearssl
diff options
context:
space:
mode:
Diffstat (limited to 'user/bearssl')
-rw-r--r--user/bearssl/APKBUILD42
-rw-r--r--user/bearssl/bearssl-brssl-dynamic.patch13
2 files changed, 55 insertions, 0 deletions
diff --git a/user/bearssl/APKBUILD b/user/bearssl/APKBUILD
new file mode 100644
index 000000000..1f40633b7
--- /dev/null
+++ b/user/bearssl/APKBUILD
@@ -0,0 +1,42 @@
+# Maintainer: Laurent Bercot <ska-adelie@skarnet.org>
+# Contributor: Laurent Bercot <ska-adelie@skarnet.org>
+pkgname=bearssl
+pkgver=0.6
+pkgrel=0
+pkgdesc="The BearSSL implementation of the SSL/TLS protocol"
+url="https://bearssl.org/"
+arch="all"
+license="MIT"
+builddir="$srcdir/$pkgname-$pkgver"
+subpackages="$pkgname-dev"
+source="https://bearssl.org/$pkgname-$pkgver.tar.gz"
+
+# not using the brssl dynamic patch atm, because the ABI can change,
+# and bearssl's author recommends against using the .so atm.
+
+build() {
+ cd "$builddir"
+ make \
+ CC=gcc \
+ LD=gcc \
+ LDDLL=gcc \
+ LDDLLFLAGS="-shared -Wl,-soname,libbearssl.so.${pkgver%%.*}" \
+ D=".so.$pkgver"
+}
+
+package() {
+ mkdir -p -m 0755 -- "$pkgdir"/bin "$pkgdir"/lib "$pkgdir"/usr/include "$pkgdir"/usr/lib
+ cp -f "$builddir/build/brssl" "$pkgdir/bin/"
+ cp -f "$builddir"/inc/* "$pkgdir/usr/include/"
+ cp -f "$builddir/build/libbearssl.a" "$pkgdir/usr/lib/"
+ cp -f "$builddir/build/libbearssl.so.$pkgver" "$pkgdir/lib/"
+ ln -sf "libbearssl.so.$pkgver" "$pkgdir/lib/libbearssl.so.${pkgver%%.*}"
+ ln -sf "libbearssl.so.${pkgver%%.*}" "$pkgdir/lib/libbearssl.so"
+}
+
+check() {
+ cd "$builddir/build"
+ ./testx509 && ./testcrypto all
+}
+
+sha512sums="f9ed25683cfc6c4abe7f1203a2b82ed101ee4c9e0f9ab60755b6a09c8d1e8e4f64d413624e7bb9c4b0033f909a2e4568a1d916cc6ce4736222900691e1f8359a bearssl-0.6.tar.gz"
diff --git a/user/bearssl/bearssl-brssl-dynamic.patch b/user/bearssl/bearssl-brssl-dynamic.patch
new file mode 100644
index 000000000..e41bb138e
--- /dev/null
+++ b/user/bearssl/bearssl-brssl-dynamic.patch
@@ -0,0 +1,13 @@
+--- bearssl-0.5.old/mk/Rules.mk
++++ bearssl-0.5/mk/Rules.mk
+@@ -49,8 +49,8 @@
+ $(BEARSSLDLL): $(OBJDIR) $(OBJ)
+ $(LDDLL) $(LDDLLFLAGS) $(LDDLLOUT)$(BEARSSLDLL) $(OBJ)
+
+-$(BRSSL): $(BEARSSLLIB) $(OBJBRSSL)
+- $(LD) $(LDFLAGS) $(LDOUT)$(BRSSL) $(OBJBRSSL) $(BEARSSLLIB)
++$(BRSSL): $(BEARSSLDLL) $(OBJBRSSL)
++ $(LD) $(LDFLAGS) $(LDOUT)$(BRSSL) $(OBJBRSSL) $(BEARSSLDLL)
+
+ $(TESTCRYPTO): $(BEARSSLLIB) $(OBJTESTCRYPTO)
+ $(LD) $(LDFLAGS) $(LDOUT)$(TESTCRYPTO) $(OBJTESTCRYPTO) $(BEARSSLLIB)