From 71ae40adfc89fd452eddc165673594b1dc8e2cd2 Mon Sep 17 00:00:00 2001 From: Sebastian Scheibner Date: Mon, 11 Apr 2022 22:50:25 +0200 Subject: [PATCH] Updated Provide native lib for libsignal (markdown) --- Provide-native-lib-for-libsignal.md | 27 +++++++++++---------------- 1 file changed, 11 insertions(+), 16 deletions(-) diff --git a/Provide-native-lib-for-libsignal.md b/Provide-native-lib-for-libsignal.md index e29ce0a..3bf66a7 100644 --- a/Provide-native-lib-for-libsignal.md +++ b/Provide-native-lib-for-libsignal.md @@ -1,13 +1,8 @@ # Native libraries -Signal-cli depends on a [libsignal-client](https://github.com/signalapp/libsignal-client) library. It is a rust library and needs to be compiled for a specific processor architecture and operating system that it will be used on. - -Signal-cli releases include the pre-compiled binaries for x86_64 Linux (with a recent enough version of `glibc`, see [#643](https://github.com/AsamK/signal-cli/issues/643)), Windows and macOS. For other platforms the library needs to be compiled from source. - -##### zkgroup - -Note: prior to libsignal-client `v0.10.0` (i.e. prior to and including signal-cli `v0.9.2`) another rust library has been required - [zkgroup](https://github.com/signalapp/zkgroup/). See [older version of this page](https://github.com/AsamK/signal-cli/wiki/Provide-native-lib-for-libsignal/013fa8aeaf47cbc72750f0774ffc9880aa09fe0c#libzkgroup) for building instructions. +signal-cli depends on the [libsignal-client](https://github.com/signalapp/libsignal) library. It is a rust library and needs to be compiled for a specific processor architecture and operating system that it will be used on. +signal-cli releases include the pre-compiled binaries for x86_64 Linux (with a recent enough version of `glibc`, see [#643](https://github.com/AsamK/signal-cli/issues/643)), Windows and macOS. For other platforms the library needs to be compiled from source. ## Pre-built @@ -27,20 +22,20 @@ https://github.com/exquo/signal-libs-build/ #### Download libsignal-client source -Clone [libsignal-client](https://github.com/signalapp/libsignal-client) with `git`, or download the "Source code" file from the [releases page](https://github.com/signalapp/libsignal-client/releases/) (see below for choosing the version from the releases). +Clone [libsignal-client](https://github.com/signalapp/libsignal) with `git`, or download the "Source code" file from the [releases page](https://github.com/signalapp/libsignal/releases/) (see below for choosing the version from the releases). ##### Determine the required libsignal-client version -Every signal-cli release requires a specific version of libsignal-client. The version number is a part of a `signal-client-java-.jar` filename in signal-cli's `lib` directory. For instance, for signal-cli v0.9.2, the file is +Every signal-cli release requires a specific version of libsignal-client. The version number is a part of a `libsignal-client-.jar` filename in signal-cli's `lib` directory. For instance, for signal-cli v0.10.5, the file is - signal-cli-0.9.2/lib/signal-client-java-0.9.7.jar + signal-cli-0.10.5/lib/libsignal-client-0.15.0.jar This is the file path if you have downloaded a signal-cli release. If you have built signal-cli from source, the path will be - signal-cli/build/install/signal-cli/lib/signal-client-java-0.9.7.jar + signal-cli/build/install/signal-cli/lib/libsignal-client-0.15.0.jar -So the required libsignal-client version is `0.9.7`. +So the required libsignal-client version is `0.15.0`. ### Build @@ -49,7 +44,7 @@ Once everything is setup, navigate to the root of the libsignal-client codebase: ```sh $ cd java $ # Prevent building the android library -$ sed -i "s/, ':android'//" settings.gradle +$ sed -i "s/include ':android'//" java/settings.gradle $ ./build_jni.sh desktop ``` Then the native lib can be found in the libsignal-client sub-directory: `target/release/libsignal_jni.so` (the file extension will be `.dylib` on MacOS and `.dll` on Windows, instead of `.so`). @@ -57,15 +52,15 @@ Then the native lib can be found in the libsignal-client sub-directory: `target/ ### Using the new libsignal-client lib file -Once you have your library file, it can be bundled in the root of the `signal-client-java-*.jar` file (but only for one architecture at a time). +Once you have your library file, it can be bundled in the root of the `libsignal-client-*.jar` file (but only for one architecture at a time). First, the currently bundled file needs to be removed: - zip -d signal-cli/lib/signal-client-java-*.jar libsignal_jni.so + zip -d signal-cli/lib/libsignal-client-*.jar libsignal_jni.so For signal-cli to be able to use the newly compiled library file, it can either be bundled into the `.jar` file with - zip signal-cli/lib/signal-client-java-*.jar libsignal_jni.so + zip signal-cli/lib/libsignal-client-*.jar libsignal_jni.so or be placed on the Java library path (see below). Only if there is no bundled file will libsignal search the library path (`java.library.path`) for the `.dylib`/`.so`/`.dll` file.