mirror of
https://github.com/signalapp/libsignal.git
synced 2024-09-20 03:52:17 +02:00
build multiarch server jar from make targets by default
This commit is contained in:
parent
08913fa09f
commit
3d1c45f15d
@ -70,7 +70,7 @@ ADD --chown=libsignal --chmod=755 --checksum=sha256:${RUSTUP_SHA} \
|
|||||||
RUN /tmp/rustup-init -y --profile minimal --default-toolchain "$(cat rust-toolchain)" \
|
RUN /tmp/rustup-init -y --profile minimal --default-toolchain "$(cat rust-toolchain)" \
|
||||||
&& rm -rf /tmp/rustup-init
|
&& rm -rf /tmp/rustup-init
|
||||||
|
|
||||||
RUN rustup target add armv7-linux-androideabi aarch64-linux-android i686-linux-android x86_64-linux-android
|
RUN rustup target add armv7-linux-androideabi aarch64-linux-android i686-linux-android x86_64-linux-android aarch64-unknown-linux-gnu
|
||||||
|
|
||||||
# Install the full set of tools now that the long setup steps are done.
|
# Install the full set of tools now that the long setup steps are done.
|
||||||
# Note that we temporarily hop back to root to do this.
|
# Note that we temporarily hop back to root to do this.
|
||||||
@ -80,6 +80,7 @@ USER root
|
|||||||
RUN apt-get install -y \
|
RUN apt-get install -y \
|
||||||
clang \
|
clang \
|
||||||
cmake \
|
cmake \
|
||||||
|
crossbuild-essential-arm64 \
|
||||||
git \
|
git \
|
||||||
gpg-agent \
|
gpg-agent \
|
||||||
libclang-dev \
|
libclang-dev \
|
||||||
|
@ -11,6 +11,7 @@ default: java_build
|
|||||||
|
|
||||||
DOCKER_IMAGE := libsignal-builder
|
DOCKER_IMAGE := libsignal-builder
|
||||||
DOCKER_TTY_FLAG := $$(test -t 0 && echo -it)
|
DOCKER_TTY_FLAG := $$(test -t 0 && echo -it)
|
||||||
|
CROSS_COMPILE_SERVER ?= -PcrossCompileServer
|
||||||
|
|
||||||
docker_image:
|
docker_image:
|
||||||
cd .. && $(DOCKER) build --build-arg UID=$$(id -u) --build-arg GID=$$(id -g) -t $(DOCKER_IMAGE) -f java/Dockerfile .
|
cd .. && $(DOCKER) build --build-arg UID=$$(id -u) --build-arg GID=$$(id -g) -t $(DOCKER_IMAGE) -f java/Dockerfile .
|
||||||
@ -20,7 +21,7 @@ java_build: docker_image
|
|||||||
$(DOCKER) run $(DOCKER_TTY_FLAG) --init --rm --user $$(id -u):$$(id -g) \
|
$(DOCKER) run $(DOCKER_TTY_FLAG) --init --rm --user $$(id -u):$$(id -g) \
|
||||||
--env LIBSIGNAL_TESTING_ENCLAVE_SECRET \
|
--env LIBSIGNAL_TESTING_ENCLAVE_SECRET \
|
||||||
-v `cd .. && pwd`/:/home/libsignal/src $(DOCKER_EXTRA) $(DOCKER_IMAGE) \
|
-v `cd .. && pwd`/:/home/libsignal/src $(DOCKER_EXTRA) $(DOCKER_IMAGE) \
|
||||||
sh -c "cd src/java; ./gradlew build"
|
sh -c "cd src/java; ./gradlew build $(CROSS_COMPILE_SERVER)"
|
||||||
|
|
||||||
publish_java: DOCKER_EXTRA = $(shell [ -L build ] && P=$$(readlink build) && echo -v $$P/:$$P )
|
publish_java: DOCKER_EXTRA = $(shell [ -L build ] && P=$$(readlink build) && echo -v $$P/:$$P )
|
||||||
publish_java: docker_image
|
publish_java: docker_image
|
||||||
@ -32,7 +33,7 @@ publish_java: docker_image
|
|||||||
-e ORG_GRADLE_PROJECT_signingPassword \
|
-e ORG_GRADLE_PROJECT_signingPassword \
|
||||||
-e ORG_GRADLE_PROJECT_signingKey \
|
-e ORG_GRADLE_PROJECT_signingKey \
|
||||||
$(DOCKER_IMAGE) \
|
$(DOCKER_IMAGE) \
|
||||||
sh -c "cd src/java; ./gradlew publish closeAndReleaseSonatypeStagingRepository"
|
sh -c "cd src/java; ./gradlew publish closeAndReleaseSonatypeStagingRepository $(CROSS_COMPILE_SERVER)"
|
||||||
|
|
||||||
# We could run these through Docker, but they would have the same result anyway.
|
# We could run these through Docker, but they would have the same result anyway.
|
||||||
|
|
||||||
|
@ -60,7 +60,7 @@ task makeJniLibrariesServer(type:Exec) {
|
|||||||
description 'Build the JNI libraries'
|
description 'Build the JNI libraries'
|
||||||
|
|
||||||
def debugLevelLogsFlag = hasProperty('debugLevelLogs') ? ['--debug-level-logs'] : []
|
def debugLevelLogsFlag = hasProperty('debugLevelLogs') ? ['--debug-level-logs'] : []
|
||||||
def target = hasProperty('crossCompileServer') ? 'server-all' : 'server'
|
def target = project.hasProperty('crossCompileServer') ? 'server-all' : 'server'
|
||||||
|
|
||||||
commandLine 'bash', './build_jni.sh', *debugLevelLogsFlag, target
|
commandLine 'bash', './build_jni.sh', *debugLevelLogsFlag, target
|
||||||
}
|
}
|
||||||
@ -75,7 +75,12 @@ task cleanJni(type: Delete) {
|
|||||||
delete fileTree('./android/src/main/jniLibs') {
|
delete fileTree('./android/src/main/jniLibs') {
|
||||||
include '**/*.so'
|
include '**/*.so'
|
||||||
}
|
}
|
||||||
delete fileTree('./shared/resources') {
|
delete fileTree('./client/src/main/resources') {
|
||||||
|
include '**/*.so'
|
||||||
|
include '**/*.dylib'
|
||||||
|
include '**/*.dll'
|
||||||
|
}
|
||||||
|
delete fileTree('./server/src/main/resources') {
|
||||||
include '**/*.so'
|
include '**/*.so'
|
||||||
include '**/*.dylib'
|
include '**/*.dylib'
|
||||||
include '**/*.dll'
|
include '**/*.dll'
|
||||||
|
@ -13,7 +13,8 @@ cd "${SCRIPT_DIR}"/..
|
|||||||
|
|
||||||
# These paths are relative to the root directory
|
# These paths are relative to the root directory
|
||||||
ANDROID_LIB_DIR=java/android/src/main/jniLibs
|
ANDROID_LIB_DIR=java/android/src/main/jniLibs
|
||||||
DESKTOP_LIB_DIR=java/shared/resources
|
DESKTOP_LIB_DIR=java/client/src/main/resources
|
||||||
|
SERVER_LIB_DIR=java/server/src/main/resources
|
||||||
|
|
||||||
export CARGO_PROFILE_RELEASE_DEBUG=1 # enable line tables
|
export CARGO_PROFILE_RELEASE_DEBUG=1 # enable line tables
|
||||||
export RUSTFLAGS="--cfg aes_armv8 --cfg polyval_armv8 ${RUSTFLAGS:-}" # Enable ARMv8 cryptography acceleration when available
|
export RUSTFLAGS="--cfg aes_armv8 --cfg polyval_armv8 ${RUSTFLAGS:-}" # Enable ARMv8 cryptography acceleration when available
|
||||||
@ -52,6 +53,7 @@ build_desktop_for_arch () {
|
|||||||
local CXX
|
local CXX
|
||||||
local CPATH
|
local CPATH
|
||||||
|
|
||||||
|
local lib_dir="${3}/"
|
||||||
local cpuarch="${1%%-*}"
|
local cpuarch="${1%%-*}"
|
||||||
case "$cpuarch" in
|
case "$cpuarch" in
|
||||||
x86_64)
|
x86_64)
|
||||||
@ -80,13 +82,19 @@ build_desktop_for_arch () {
|
|||||||
fi
|
fi
|
||||||
echo_then_run cargo build -p libsignal-jni -p libsignal-jni-testing --release ${FEATURES:+--features "${FEATURES[*]}"} --target "$1"
|
echo_then_run cargo build -p libsignal-jni -p libsignal-jni-testing --release ${FEATURES:+--features "${FEATURES[*]}"} --target "$1"
|
||||||
if [[ -z "${CARGO_BUILD_TARGET:-}" ]]; then
|
if [[ -z "${CARGO_BUILD_TARGET:-}" ]]; then
|
||||||
copy_built_library "target/${1}/release" signal_jni "${DESKTOP_LIB_DIR}/" "signal_jni_${suffix}"
|
copy_built_library "target/${1}/release" signal_jni "$lib_dir" "signal_jni_${suffix}"
|
||||||
copy_built_library "target/${1}/release" signal_jni_testing "${DESKTOP_LIB_DIR}/" "signal_jni_testing_${suffix}"
|
copy_built_library "target/${1}/release" signal_jni_testing "$lib_dir" "signal_jni_testing_${suffix}"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
while [ "${1:-}" != "" ]; do
|
while [ "${1:-}" != "" ]; do
|
||||||
case "${1:-}" in
|
case "${1:-}" in
|
||||||
|
desktop )
|
||||||
|
lib_dir=$DESKTOP_LIB_DIR
|
||||||
|
;;&
|
||||||
|
server | server-all )
|
||||||
|
lib_dir=$SERVER_LIB_DIR
|
||||||
|
;;&
|
||||||
desktop | server | server-all )
|
desktop | server | server-all )
|
||||||
# On Linux, cdylibs don't include public symbols from their dependencies,
|
# On Linux, cdylibs don't include public symbols from their dependencies,
|
||||||
# even if those symbols have been re-exported in the Rust source.
|
# even if those symbols have been re-exported in the Rust source.
|
||||||
@ -96,10 +104,10 @@ while [ "${1:-}" != "" ]; do
|
|||||||
FEATURES+=("testing-fns")
|
FEATURES+=("testing-fns")
|
||||||
host_triple=$(rustc -vV | sed -n 's|host: ||p')
|
host_triple=$(rustc -vV | sed -n 's|host: ||p')
|
||||||
if [[ "$1" == "server-all" ]]; then
|
if [[ "$1" == "server-all" ]]; then
|
||||||
build_desktop_for_arch x86_64-unknown-linux-gnu "$host_triple"
|
build_desktop_for_arch x86_64-unknown-linux-gnu "$host_triple" $lib_dir
|
||||||
build_desktop_for_arch aarch64-unknown-linux-gnu "$host_triple"
|
build_desktop_for_arch aarch64-unknown-linux-gnu "$host_triple" $lib_dir
|
||||||
else
|
else
|
||||||
build_desktop_for_arch "$host_triple" "$host_triple"
|
build_desktop_for_arch "$host_triple" "$host_triple" $lib_dir
|
||||||
fi
|
fi
|
||||||
exit
|
exit
|
||||||
;;
|
;;
|
||||||
|
@ -66,7 +66,6 @@ tasks.named('jar') {
|
|||||||
}
|
}
|
||||||
|
|
||||||
processResources {
|
processResources {
|
||||||
// TODO: Build a different variant of the JNI library for server.
|
|
||||||
dependsOn ':makeJniLibrariesDesktop'
|
dependsOn ':makeJniLibrariesDesktop'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user