Skip to content

Commit 13b8275

Browse files
chore: remove need for build & targetplatform in scripts
1 parent e57dbf8 commit 13b8275

File tree

3 files changed

+14
-24
lines changed

3 files changed

+14
-24
lines changed

Dockerfile

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,6 @@ ARG TARGET=aarch64-unknown-linux-musl
2424

2525
FROM rust-${TARGETPLATFORM//\//-} AS rust-cargo-build
2626

27-
# expose (used in ./setup.sh and ./build.sh)
28-
ARG BUILDPLATFORM
29-
ARG TARGETPLATFORM
30-
ARG TARGETARCH
31-
3227
COPY ./setup-env.sh .
3328
RUN --mount=type=cache,id=apt-cache,from=rust-base,target=/var/cache/apt,sharing=locked \
3429
--mount=type=cache,id=apt-lib,from=rust-base,target=/var/lib/apt,sharing=locked \
@@ -58,11 +53,6 @@ RUN --mount=type=cache,target=/build/${APPLICATION_NAME}/target \
5853
# Rust full build
5954
FROM rust-cargo-build AS rust-build
6055

61-
# expose (used in ./build.sh)
62-
ARG BUILDPLATFORM
63-
ARG TARGETPLATFORM
64-
ARG TARGETARCH
65-
6656
WORKDIR /build/${APPLICATION_NAME}
6757

6858
# now we copy in the source which is more prone to changes and build it

build.sh

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7,18 +7,18 @@ cpp_compiler="g++"
77
rust_flags="-Clink-self-contained=yes -Clinker=rust-lld"
88

99
case $TARGET in
10-
x86_64-unknown-linux-*)
11-
c_compiler="x86_64-linux-gnu-gcc-12"
12-
cpp_compiler="x86_64-linux-gnu-g++-12"
13-
;;
14-
aarch64-unknown-linux-*)
15-
c_compiler="aarch64-linux-gnu-gcc"
16-
cpp_compiler="aarch64-linux-gnu-g++"
17-
;;
18-
*)
19-
echo "INVALID CONFIGURATION"
20-
exit 1
21-
;;
10+
x86_64-unknown-linux-*)
11+
c_compiler="x86_64-linux-gnu-gcc-12"
12+
cpp_compiler="x86_64-linux-gnu-g++-12"
13+
;;
14+
aarch64-unknown-linux-*)
15+
c_compiler="aarch64-linux-gnu-gcc"
16+
cpp_compiler="aarch64-linux-gnu-g++"
17+
;;
18+
*)
19+
echo "INVALID CONFIGURATION"
20+
exit 1
21+
;;
2222
esac
2323

2424
# replace - with _ in the Rust target

setup-env.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
#!/usr/bin/env bash
22

33
dpkg_add_arch() {
4-
# mind the space between the [ and "
5-
if [[ "$BUILDPLATFORM" != "$TARGETPLATFORM" ]]; then
4+
# are we cross compiling?
5+
if ! dpkg-architecture -eq "$1"; then
66
dpkg --add-architecture $1
77
fi
88
apt-get update

0 commit comments

Comments
 (0)