Skip to content

Commit 4875106

Browse files
authored
Merge pull request moby#5069 from tonistiigi/archutil-riscv-unblock
archutil: update riscv binary
2 parents 4490066 + e8ab71b commit 4875106

File tree

1 file changed

+18
-7
lines changed

1 file changed

+18
-7
lines changed

hack/dockerfiles/archutil.Dockerfile

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,14 @@
11
# syntax=docker/dockerfile-upstream:master
2+
# check=error=true
23

34
ARG GO_VERSION=1.22
45
ARG ALPINE_VERSION=3.20
56
ARG DEBIAN_VERSION=trixie
67

8+
ARG BUILD_LOONG64=${TARGETPLATFORM#linux/amd64}
9+
ARG BUILD_LOONG64=${BUILD_LOONG64:+"unsupported"}
10+
ARG BUILD_LOONG64=${BUILD_LOONG64:-"supported"}
11+
712
FROM debian:${DEBIAN_VERSION}-slim AS base
813
RUN apt-get update && apt-get --no-install-recommends install -y git binutils \
914
gcc-x86-64-linux-gnu \
@@ -15,8 +20,7 @@ RUN apt-get update && apt-get --no-install-recommends install -y git binutils \
1520
binutils-s390x-linux-gnu \
1621
binutils-powerpc64le-linux-gnu \
1722
binutils-mips64el-linux-gnuabi64 \
18-
binutils-mips64-linux-gnuabi64 \
19-
binutils-loongarch64-linux-gnu
23+
binutils-mips64-linux-gnuabi64
2024
WORKDIR /src
2125

2226
FROM base AS exit-amd64
@@ -59,10 +63,16 @@ FROM base AS exit-mips64
5963
COPY util/archutil/fixtures/exit.mips64.s .
6064
RUN mips64-linux-gnuabi64-as --noexecstack -o exit.o exit.mips64.s && mips64-linux-gnuabi64-ld -o exit -s exit.o && mips64-linux-gnuabi64-strip --strip-unneeded exit
6165

62-
FROM base AS exit-loong64
66+
FROM base AS exit-loong64-base
67+
RUN apt-get --no-install-recommends install -y binutils-loongarch64-linux-gnu
6368
COPY util/archutil/fixtures/exit.loongarch64.s .
6469
RUN loongarch64-linux-gnu-as --noexecstack -o exit.o exit.loongarch64.s && loongarch64-linux-gnu-ld -o exit -s exit.o && loongarch64-linux-gnu-strip --strip-unneeded exit
6570

71+
FROM scratch AS exit-loong64-unsupported
72+
FROM scratch AS exit-loong64-supported
73+
COPY --from=exit-loong64-base /src/exit loong64
74+
FROM exit-loong64-${BUILD_LOONG64} AS exit-loong64
75+
6676
FROM scratch AS exits
6777
COPY --from=exit-amd64 /src/exit amd64
6878
COPY --from=exit-386 /src/exit 386
@@ -74,10 +84,11 @@ COPY --from=exit-ppc64 /src/exit ppc64
7484
COPY --from=exit-ppc64le /src/exit ppc64le
7585
COPY --from=exit-mips64le /src/exit mips64le
7686
COPY --from=exit-mips64 /src/exit mips64
77-
COPY --from=exit-loong64 /src/exit loong64
87+
COPY --from=exit-loong64 / /
7888

7989
FROM golang:${GO_VERSION}-alpine${ALPINE_VERSION} AS generate
8090
WORKDIR /go/src/github.com/moby/buildkit
91+
ARG BUILD_LOONG64
8192
RUN --mount=type=bind,target=.,rw \
8293
--mount=from=exits,target=./bin/archutil,rw <<EOT
8394
set -ex
@@ -92,8 +103,8 @@ RUN --mount=type=bind,target=.,rw \
92103
bin/archutil/ppc64 \
93104
bin/archutil/ppc64le \
94105
bin/archutil/mips64le \
95-
bin/archutil/mips64 \
96-
bin/archutil/loong64
106+
bin/archutil/mips64
107+
[ "${BUILD_LOONG64}" = "unsupported" ] || go run ./util/archutil/generate.go bin/archutil/loong64
97108
tree -nh bin/archutil
98109
cp bin/archutil/*_binary.go /out
99110
EOT
@@ -109,7 +120,7 @@ RUN --mount=type=bind,target=.,rw \
109120
if [ "$(ls -A /generated-files)" ]; then
110121
cp -rf /generated-files/* ./util/archutil
111122
fi
112-
diff=$(git status --porcelain)
123+
diff=$(git status --porcelain -- util/archutil)
113124
if [ -n "$diff" ]; then
114125
echo >&2 'ERROR: The result of archutil differs. Please update with "make archutil"'
115126
echo "$diff"

0 commit comments

Comments
 (0)