From f18ebde9519bb55e33d1091a8752c06240f31dd3 Mon Sep 17 00:00:00 2001 From: Bernhard B Date: Mon, 2 Oct 2023 19:01:09 +0200 Subject: [PATCH] fixed signal-cli-native build * due to different glibc versions, it is not possible to use the existing (prebuilt) libsignal_jni.so that get's shipped with the signal-cli binary distribution for the signal-cli native image build. So in order to make that work (again), we need to use our own libsignal_jni.so for the x86_64 build. see #412 --- Dockerfile | 8 +++++++ .../libsignal-client/signal-cli-native.patch | 23 +++++++++++++++++++ 2 files changed, 31 insertions(+) create mode 100644 ext/libraries/libsignal-client/signal-cli-native.patch diff --git a/Dockerfile b/Dockerfile index b7526f03..3983d4ef 100644 --- a/Dockerfile +++ b/Dockerfile @@ -19,6 +19,7 @@ ARG BUILD_VERSION_ARG ARG SIGNAL_CLI_NATIVE_PACKAGE_VERSION COPY ext/libraries/libsignal-client/v${LIBSIGNAL_CLIENT_VERSION} /tmp/libsignal-client-libraries +COPY ext/libraries/libsignal-client/signal-cli-native.patch /tmp/signal-cli-native.patch # use architecture specific libsignal_jni.so RUN arch="$(uname -m)"; \ @@ -76,6 +77,13 @@ RUN if [ "$(uname -m)" = "x86_64" ]; then \ && export PATH=/tmp/graalvm/bin:$PATH \ && cd /tmp/signal-cli-${SIGNAL_CLI_VERSION}-source \ && sed -i 's/Signal-Android\/5.22.3/Signal-Android\/5.51.7/g' src/main/java/org/asamk/signal/BaseConfig.java \ + && ./gradlew build \ + && ./gradlew installDist \ + && cd /tmp \ + && cp signal-cli-${SIGNAL_CLI_VERSION}-source/build/install/signal-cli/lib/libsignal-client-${LIBSIGNAL_CLIENT_VERSION}.jar libsignal-client.jar \ + && zip -qu libsignal-client.jar libsignal_jni.so \ + && cd /tmp/signal-cli-${SIGNAL_CLI_VERSION}-source \ + && git apply /tmp/signal-cli-native.patch \ && ./gradlew -q nativeCompile; \ elif [ "$(uname -m)" = "aarch64" ] ; then \ echo "Use native image from @morph027 (https://packaging.gitlab.io/signal-cli/) for arm64 - many thanks to @morph027" \ diff --git a/ext/libraries/libsignal-client/signal-cli-native.patch b/ext/libraries/libsignal-client/signal-cli-native.patch new file mode 100644 index 00000000..9e9bb72b --- /dev/null +++ b/ext/libraries/libsignal-client/signal-cli-native.patch @@ -0,0 +1,23 @@ +diff --git a/build.gradle.kts b/build.gradle.kts +index 0d89c075..fda49332 100644 +--- a/build.gradle.kts ++++ b/build.gradle.kts +@@ -43,6 +43,7 @@ dependencies { + implementation(libs.slf4j.jul) + implementation(libs.logback) + implementation(project(":lib")) ++ implementation(files("/tmp/libsignal-client.jar")) + } + + configurations { +@@ -51,6 +52,10 @@ configurations { + } + } + ++configurations.all { ++ exclude(group = "org.signal", module = "libsignal-client") ++} ++ + + tasks.withType().configureEach { + isPreserveFileTimestamps = false