From 44fee7f025070505bb835987e1924ad26c2f1a86 Mon Sep 17 00:00:00 2001 From: finn Date: Sun, 27 Mar 2022 19:52:14 -0700 Subject: [PATCH] Add one musl targets (the arm ones don't build) --- .gitlab-ci.yml | 6 +++++- prepare-env.sh | 8 ++++---- rustflags.sh | 8 ++++++++ 3 files changed, 17 insertions(+), 5 deletions(-) create mode 100755 rustflags.sh diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 2345e5c..9f3cf8d 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -11,10 +11,14 @@ variables: matrix: - TARGET: - aarch64-unknown-linux-gnu + # - aarch64-unknown-linux-musl - arm-unknown-linux-gnueabi - arm-unknown-linux-gnueabihf + # - arm-unknown-linux-musleabihf - armv7-unknown-linux-gnueabihf + # - armv7-unknown-linux-musleabihf - x86_64-unknown-linux-gnu + - x86_64-unknown-linux-musl rules: - when: on_success @@ -28,7 +32,7 @@ compile: - git clone https://github.com/signalapp/libsignal-client - cd libsignal-client && git checkout "$libsignal_version" - rustup target add "${TARGET}" - - RUSTFLAGS='-C link-arg=-s' cargo build -p libsignal-jni --target "${TARGET}" --release --verbose + - RUSTFLAGS="$(../rustflags.sh)" cargo build -p libsignal-jni --target "${TARGET}" --release --verbose - cp -v target/${TARGET}/release/libsignal_jni.so ../libsignal_jni-${TARGET}.so artifacts: paths: diff --git a/prepare-env.sh b/prepare-env.sh index 52444e3..c02328b 100755 --- a/prepare-env.sh +++ b/prepare-env.sh @@ -5,16 +5,16 @@ apt-get update PACKAGES="git" case "${TARGET}" in - aarch64-unknown-linux-gnu) + aarch64-unknown-linux-gnu|aarch64-unknown-linux-musl) apt-get install -y "${PACKAGES}" {cpp,g++,gcc}-aarch64-linux-gnu ;; - arm-unknown-linux-gnueabi) + arm-unknown-linux-gnueabi|arm-unknown-linux-musleabi) apt-get install -y "${PACKAGES}" {cpp,g++,gcc}-arm-linux-gnueabi ;; - arm-unknown-linux-gnueabihf) + arm-unknown-linux-gnueabihf|arm-unknown-linux-musleabihf) apt-get install -y "${PACKAGES}" {cpp,g++,gcc}-arm-linux-gnueabihf ;; - armv7-unknown-linux-gnueabihf) + armv7-unknown-linux-gnueabihf|armv7-unknown-linux-musleabihf) apt-get install -y "${PACKAGES}" {cpp,g++,gcc}-arm-linux-gnueabihf ;; *) diff --git a/rustflags.sh b/rustflags.sh new file mode 100755 index 0000000..53b84e6 --- /dev/null +++ b/rustflags.sh @@ -0,0 +1,8 @@ +#!/bin/bash +flags="-C link-arg=-s" + +if [[ "${TARGET}" == *musl ]]; then + flags="${flags} -C target-feature=-crt-static" +fi + +echo "${flags}" \ No newline at end of file