From c187cceab3c8d829fcbe3ae7e74bec3ac0153c1e Mon Sep 17 00:00:00 2001
From: Britney Fransen <brfransen@gmail.com>
Date: Wed, 19 Apr 2023 12:05:19 -0400
Subject: libsignal-client: initial inclusion

---
 linhes/libsignal-client/PKGBUILD | 59 ++++++++++++++++++++++++++++++++++++++++
 1 file changed, 59 insertions(+)
 create mode 100644 linhes/libsignal-client/PKGBUILD

diff --git a/linhes/libsignal-client/PKGBUILD b/linhes/libsignal-client/PKGBUILD
new file mode 100644
index 0000000..6b0e791
--- /dev/null
+++ b/linhes/libsignal-client/PKGBUILD
@@ -0,0 +1,59 @@
+# Maintainer: <asamk@gmx.de>
+
+pkgname=libsignal-client
+_pkgname=libsignal
+_libname=libsignal_jni
+pkgver=0.22.0
+pkgrel=1
+pkgdesc='Library for the Signal Protocol.'
+url="https://github.com/signalapp/${_pkgname}"
+depends=('gcc-libs')
+makedepends=('cargo' 'gradle' 'git' 'zip' 'protobuf' 'cmake' 'clang' 'jdk17-openjdk')
+options=(!lto)
+arch=('i686' 'x86_64' 'armv6h' 'armv7h' 'aarch64')
+license=('GPL3')
+source=(
+    "${_pkgname}-${pkgver}.tar.gz::https://github.com/signalapp/${_pkgname}/archive/refs/tags/v$pkgver.tar.gz"
+)
+
+sha512sums=('9483c8d302728d6caa123f1fb9a977c7cb3aea09ecd1d2cfb3b19f2f2c66f884c41e37642c89db4eeeb0d607fddf281ba27ba4bd0a90e43b972d0cbc607e1483')
+
+prepare() {
+  tar xf "${_pkgname}-$pkgver.tar.gz"
+  cd "${_pkgname}-${pkgver}"
+
+  # Use the default system rust toolchain
+  # rm -f rust-toolchain
+
+  # Do not build the android library
+  sed -i "s/include ':android', ':android:benchmarks'//" java/settings.gradle
+  sed -i "s/cargo build/cargo build --frozen/" java/build_jni.sh
+
+  cargo fetch --locked --target "$(rustc -vV | awk '/^host: / {print $2}')"
+}
+
+build() {
+  cd "${_pkgname}-${pkgver}/java"
+
+  export RUSTUP_TOOLCHAIN=stable
+  export CARGO_TARGET_DIR=target
+  ./build_jni.sh desktop
+  gradle --no-daemon assemble
+
+  zip -d "client/build/libs/libsignal-client-${pkgver}.jar" "${_libname}.so"
+}
+
+check() {
+  cd "${_pkgname}-${pkgver}"
+  export RUSTUP_TOOLCHAIN=stable
+  cargo test --frozen
+}
+
+package() {
+  cd "${_pkgname}-${pkgver}"
+
+  install -m755 -d "${pkgdir}/usr/share/java/${pkgname}" "${pkgdir}/usr/lib"
+
+  install -Dm644 "java/client/build/libs/libsignal-client-${pkgver}.jar" "$pkgdir/usr/share/java/$pkgname/$pkgname.jar"
+  install -Dm644 "target/release/${_libname}.so" "$pkgdir/usr/lib/"
+}
-- 
cgit v0.12

