Radish alpha
h
Radicle Heartwood Protocol & Stack
Radicle
Git (anonymous pull)
Log in to clone via SSH
build: Use zig for linux builds
cloudhead committed 2 years ago
commit faafd21a91931211432eb0f01f86adea04496610
parent eece90e9f7d4ef37058c0a18b7a7e404f799c2c3
2 files changed +4 -18
modified build/Dockerfile
@@ -7,7 +7,7 @@ COPY . .
# Copy cargo configuration we're going to use to specify compiler options.
RUN mkdir -p .cargo && cp build/config.toml .cargo/config.toml
# Install dependencies.
-
RUN apk update && apk add --no-cache mold clang git musl-dev minisign curl xz asciidoctor
+
RUN apk update && apk add --no-cache git musl-dev minisign curl xz asciidoctor
# Build man pages and strip metadata. Removes all comments, since they include
# non-reproducible information, such as version numbers.
RUN asciidoctor --doctype manpage --backend manpage --destination-dir . *.1.adoc && \
@@ -19,16 +19,6 @@ RUN rustup target add \
    x86_64-apple-darwin \
    aarch64-apple-darwin

-
# Linux x86_64 and aarch64 build.
-
ENV CC=clang C_INCLUDE_PATH=/usr/include/x86_64-linux-musl
-
RUN cargo build --locked --release \
-
    --target=x86_64-unknown-linux-musl \
-
    --target=aarch64-unknown-linux-musl \
-
    -p radicle-node \
-
    -p radicle-httpd \
-
    -p radicle-remote-helper \
-
    -p radicle-cli
-

# Install dependencies for cross-compiling to macOS.
# We use Zig as the linker to perform the compilation from a Linux host.
# Zig is not yet available on Debian, so we download the official binary.
@@ -48,10 +38,12 @@ RUN xz -d -c build/macos-sdk-11.3.tar.xz | tar -x
# This env var is used by `cargo-zigbuild` to find the SDK.
ENV SDKROOT /src/macos-sdk-11.3

-
# Darwin x86_64 and aarch64 build.
+
# Build binaries.
RUN cargo zigbuild --locked --release \
    --target=x86_64-apple-darwin \
    --target=aarch64-apple-darwin \
+
    --target=aarch64-unknown-linux-musl \
+
    --target=x86_64-unknown-linux-musl \
    -p radicle-node \
    -p radicle-httpd \
    -p radicle-remote-helper \
modified build/config.toml
@@ -1,18 +1,12 @@
[target.x86_64-unknown-linux-musl]
-
linker = "clang"
rustflags = [
-
    "-C", "link-arg=-fuse-ld=mold",
-
    "-C", "link-arg=--target=x86_64-unknown-linux-musl",
    "-C", "codegen-units=1",
    "-C", "incremental=false",
    "-C", "opt-level=3",
]

[target.aarch64-unknown-linux-musl]
-
linker = "clang"
rustflags = [
-
    "-C", "link-arg=-fuse-ld=mold",
-
    "-C", "link-arg=--target=aarch64-unknown-linux-musl",
    "-C", "codegen-units=1",
    "-C", "incremental=false",
    "-C", "opt-level=3",