Support for different arch-s and libc-s
This commit is contained in:
parent
ad79fb5cbf
commit
b8ce2c13dc
2 changed files with 13 additions and 4 deletions
|
@ -17,6 +17,12 @@ for building reqwest4j and Piped respectively)
|
||||||
4. Run the script: `./build.sh`
|
4. Run the script: `./build.sh`
|
||||||
(`bash build.sh` if you executed previous commands from bash)
|
(`bash build.sh` if you executed previous commands from bash)
|
||||||
|
|
||||||
|
You can set environment variables
|
||||||
|
`ARCH=x86_64|aarch64|armv7...`,
|
||||||
|
`LIBC=musl|gnu|musleabi|gnueabi`,
|
||||||
|
e.g. `ARCH=aarch64 ./build.sh`.
|
||||||
|
They default to x86_64 musl.
|
||||||
|
|
||||||
## How to start Piped
|
## How to start Piped
|
||||||
1. Edit config.properties
|
1. Edit config.properties
|
||||||
2. Change `/home/piped` in start.sh to directory
|
2. Change `/home/piped` in start.sh to directory
|
||||||
|
|
11
build.sh
11
build.sh
|
@ -2,6 +2,9 @@
|
||||||
# shellcheck source=patcher.sh
|
# shellcheck source=patcher.sh
|
||||||
|
|
||||||
WORKDIR=$(pwd)
|
WORKDIR=$(pwd)
|
||||||
|
ARCH="${ARCH:-x86_64}"
|
||||||
|
LIBC="${LIBC:-musl}"
|
||||||
|
TARGET="$ARCH-unknown-linux-$LIBC"
|
||||||
|
|
||||||
|
|
||||||
# ---
|
# ---
|
||||||
|
@ -76,11 +79,11 @@ cd_and_exec reqwest4j patch_reqwest4j
|
||||||
|
|
||||||
|
|
||||||
# ---
|
# ---
|
||||||
export RUSTFLAGS="-C target-feature=-crt-static"
|
[ "$LIBC" = "musl" ] && export RUSTFLAGS="-C target-feature=-crt-static"
|
||||||
|
|
||||||
title 'Building reqwest-jni'
|
title 'Building reqwest-jni'
|
||||||
cd_and_exec reqwest4j/reqwest-jni \
|
cd_and_exec reqwest4j/reqwest-jni \
|
||||||
cargo build --release --target x86_64-unknown-linux-musl
|
cargo build --release --target "$TARGET"
|
||||||
|
|
||||||
title 'Building reqwest4j without Rust library...'
|
title 'Building reqwest4j without Rust library...'
|
||||||
OLD_PATH="$PATH"
|
OLD_PATH="$PATH"
|
||||||
|
@ -109,12 +112,12 @@ cd_and_exec reqwest4j/build/libs \
|
||||||
REQJNI_NAME="libreqwest.so"
|
REQJNI_NAME="libreqwest.so"
|
||||||
REQJNI="$WORKDIR/$REQJNI_NAME"
|
REQJNI="$WORKDIR/$REQJNI_NAME"
|
||||||
|
|
||||||
cd_and_exec reqwest4j/reqwest-jni/target/x86_64-unknown-linux-musl/release \
|
cd_and_exec "reqwest4j/reqwest-jni/target/$TARGET/release" \
|
||||||
cp libreqwest_jni.so "$REQJNI"
|
cp libreqwest_jni.so "$REQJNI"
|
||||||
|
|
||||||
# Create JAR native libraries tree
|
# Create JAR native libraries tree
|
||||||
title '--Creating libraries directory tree'
|
title '--Creating libraries directory tree'
|
||||||
NATIVES="META-INF/natives/linux/x86_64"
|
NATIVES="META-INF/natives/linux/$ARCH"
|
||||||
mkdir -p "$NATIVES"
|
mkdir -p "$NATIVES"
|
||||||
|
|
||||||
# Move reqwest-jni to native libraries directory
|
# Move reqwest-jni to native libraries directory
|
||||||
|
|
Loading…
Add table
Reference in a new issue