mirror of
https://github.com/chatmail/core.git
synced 2026-04-06 15:42:10 +03:00
cargo-zigbuild is replaced with a simple zig-cc wrapper.
cargo-zigbuild still tries to use i386-linux-musl triple,
while in zig 0.11 x86-linux-musl should be used [1].
This also gives us more control over compilation flags used
and prevents changes due to cargo-zigbuild upgrades,
as its version was not pinned.
[1] Merged PR "all: rename i386 to x86 "
<https://github.com/ziglang/zig/pull/13101>
53 lines
1.9 KiB
Bash
Executable File
53 lines
1.9 KiB
Bash
Executable File
#!/bin/sh
|
|
#
|
|
# Build statically linked deltachat-rpc-server using zig.
|
|
|
|
set -x
|
|
set -e
|
|
|
|
unset RUSTFLAGS
|
|
|
|
# Pin Rust version to avoid uncontrolled changes in the compiler and linker flags.
|
|
export RUSTUP_TOOLCHAIN=1.68.1
|
|
|
|
ZIG_VERSION=0.11.0-dev.2213+515e1c93e
|
|
|
|
# Download Zig
|
|
rm -fr "$ZIG_VERSION" "zig-linux-x86_64-$ZIG_VERSION.tar.xz"
|
|
wget "https://ziglang.org/builds/zig-linux-x86_64-$ZIG_VERSION.tar.xz"
|
|
tar xf "zig-linux-x86_64-$ZIG_VERSION.tar.xz"
|
|
export PATH="$PWD/zig-linux-x86_64-$ZIG_VERSION:$PATH"
|
|
|
|
rustup target add i686-unknown-linux-musl
|
|
CC="$PWD/scripts/zig-cc" \
|
|
TARGET_CC="$PWD/scripts/zig-cc" \
|
|
CARGO_TARGET_I686_UNKNOWN_LINUX_MUSL_LINKER="$PWD/scripts/zig-cc" \
|
|
LD="$PWD/scripts/zig-cc" \
|
|
ZIG_TARGET="x86-linux-musl" \
|
|
cargo build --release --target i686-unknown-linux-musl -p deltachat-rpc-server --features vendored
|
|
|
|
rustup target add armv7-unknown-linux-musleabihf
|
|
CC="$PWD/scripts/zig-cc" \
|
|
TARGET_CC="$PWD/scripts/zig-cc" \
|
|
CARGO_TARGET_ARMV7_UNKNOWN_LINUX_MUSLEABIHF_LINKER="$PWD/scripts/zig-cc" \
|
|
LD="$PWD/scripts/zig-cc" \
|
|
ZIG_TARGET="arm-linux-musleabihf" \
|
|
ZIG_CPU="generic+v7a+vfp3-d32+thumb2-neon" \
|
|
cargo build --release --target armv7-unknown-linux-musleabihf -p deltachat-rpc-server --features vendored
|
|
|
|
rustup target add x86_64-unknown-linux-musl
|
|
CC="$PWD/scripts/zig-cc" \
|
|
TARGET_CC="$PWD/scripts/zig-cc" \
|
|
CARGO_TARGET_X86_64_UNKNOWN_LINUX_MUSL_LINKER="$PWD/scripts/zig-cc" \
|
|
LD="$PWD/scripts/zig-cc" \
|
|
ZIG_TARGET="x86_64-linux-musl" \
|
|
cargo build --release --target x86_64-unknown-linux-musl -p deltachat-rpc-server --features vendored
|
|
|
|
rustup target add aarch64-unknown-linux-musl
|
|
CC="$PWD/scripts/zig-cc" \
|
|
TARGET_CC="$PWD/scripts/zig-cc" \
|
|
CARGO_TARGET_AARCH64_UNKNOWN_LINUX_MUSL_LINKER="$PWD/scripts/zig-cc" \
|
|
LD="$PWD/scripts/zig-cc" \
|
|
ZIG_TARGET="aarch64-linux-musl" \
|
|
cargo build --release --target aarch64-unknown-linux-musl -p deltachat-rpc-server --features vendored
|