From 3a0f8ed85c54c81e0f39632eb0bdd629b186ec20 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20K=C3=BCrten?= Date: Thu, 15 Jun 2023 18:07:18 +0200 Subject: [PATCH] Document building of macOS headless jars and fix included native binaries on macOS --- briar-headless/README.md | 9 ++++++++- briar-headless/build.gradle | 3 ++- .../main/java/org/briarproject/briar/headless/Main.kt | 2 +- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/briar-headless/README.md b/briar-headless/README.md index f7aed1d71..8dbb9d4c1 100644 --- a/briar-headless/README.md +++ b/briar-headless/README.md @@ -9,7 +9,7 @@ or to develop your own user interface for it. The REST API peer comes as a `jar` file and needs a Java Runtime Environment (JRE) that supports at least Java 8. -It currently works only on GNU/Linux operating systems and on Windows. +It currently works on GNU/Linux operating systems, on Windows and on macOS. To build the `jar` file, you need to specify the combination of architecture and platform: @@ -17,6 +17,8 @@ To build the `jar` file, you need to specify the combination of architecture and $ ./gradlew --configure-on-demand briar-headless:aarch64LinuxJar $ ./gradlew --configure-on-demand briar-headless:armhfLinuxJar $ ./gradlew --configure-on-demand briar-headless:windowsJar + $ ./gradlew --configure-on-demand briar-headless:x86MacOsJar + $ ./gradlew --configure-on-demand briar-headless:aarch64MacOsJar You can start the peer (and its API server) like this: @@ -51,6 +53,11 @@ The answer is an empty JSON array, because you don't have any contacts. Note that the HTTP request sets an `Authorization` header with the bearer token. A missing or wrong token will result in a `401` response. +To run on macOS you will need to sign the native tor binaries included in the +jar file. To do so, extract the files in `aarch64` or `x86_64` depending on your +system architecture, sign them using `codesign` and replace the original files +in the jar files with the signed ones. + ## REST API ### Listing all contacts diff --git a/briar-headless/build.gradle b/briar-headless/build.gradle index 07b550018..ef7114943 100644 --- a/briar-headless/build.gradle +++ b/briar-headless/build.gradle @@ -96,7 +96,7 @@ void jarFactory(Jar jarTask, os, architecture, configuration) { } { it.duplicatesStrategy(DuplicatesStrategy.EXCLUDE) - if (os == "linux") { + if (os == "linux" || os == "macos") { String[] architectures = [ "aarch64", "armhf", @@ -107,6 +107,7 @@ void jarFactory(Jar jarTask, os, architecture, configuration) { exclude arch + "/obfs4proxy" exclude arch + "/tor" exclude arch + "/snowflake" + exclude arch + "/libevent-*.dylib" } } } diff --git a/briar-headless/src/main/java/org/briarproject/briar/headless/Main.kt b/briar-headless/src/main/java/org/briarproject/briar/headless/Main.kt index 410781441..7bcb380eb 100644 --- a/briar-headless/src/main/java/org/briarproject/briar/headless/Main.kt +++ b/briar-headless/src/main/java/org/briarproject/briar/headless/Main.kt @@ -28,7 +28,7 @@ import java.util.logging.Level.INFO import java.util.logging.Level.WARNING import java.util.logging.LogManager -private const val DEFAULT_PORT = 7000 +private val DEFAULT_PORT = if (isMac()) 7001 else 7000 private val DEFAULT_DATA_DIR = getProperty("user.home") + separator + ".briar" private class Main : CliktCommand(