Skip to content

Commit

Permalink
missing ld64-static-tgz target
Browse files Browse the repository at this point in the history
Signed-off-by: CrazyMax <[email protected]>
  • Loading branch information
crazy-max committed Jul 13, 2023
1 parent 75ff1e5 commit 2801eaf
Show file tree
Hide file tree
Showing 2 changed files with 71 additions and 28 deletions.
72 changes: 58 additions & 14 deletions docker-bake.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -175,20 +175,6 @@ target "_ld-base" {
}
}

target "ld64-tgz" {
inherits = ["_ld-base"]
target = "ld64-tgz"
output = ["./ld64-tgz"]
platforms = [
"linux/386",
"linux/amd64",
"linux/arm64",
"linux/arm/v6",
"linux/arm/v7"
]
cache-to = ["type=inline"]
}

variable "BINUTILS_VERSION_ONLY" {
default = ""
}
Expand Down Expand Up @@ -312,6 +298,64 @@ target "binutils-windows-386-alpine" {
cache-from = [join("", ["type=registry,ref=", binutilsTag(XX_REPO, BINUTILS_VERSION, BINUTILS_VERSION_ONLY, "windows-386")[0]])]
}

group "ld64-static-tgz" {
targets = [for v in ["linux-386", "linux-amd64", "linux-arm64", "linux-armv6", "linux-armv7"]: "ld64-${v}-tgz"]
}

target "ld64-tgz-base" {
inherits = ["_ld-base"]
target = "ld64-static-tgz"
platforms = [
"linux/386",
"linux/amd64",
"linux/arm64",
"linux/arm/v6",
"linux/arm/v7"
]
cache-to = ["type=inline"]
output = ["./ld64-tgz"]
}

target "ld64-linux-amd64-tgz" {
inherits = ["ld64-tgz-base"]
args = {
LD_TARGET = "linux-amd64"
}
cache-from = [join("", ["type=registry,ref=", binutilsTag(XX_REPO, BINUTILS_VERSION, "1", "linux-amd64")[0]])]
}

target "ld64-linux-arm64-tgz" {
inherits = ["ld64-tgz-base"]
args = {
LD_TARGET = "linux-arm64"
}
cache-from = [join("", ["type=registry,ref=", binutilsTag(XX_REPO, BINUTILS_VERSION, "1", "linux-arm64")[0]])]
}

target "ld64-linux-armv7-tgz" {
inherits = ["ld64-tgz-base"]
args = {
LD_TARGET = "linux-armv7"
}
cache-from = [join("", ["type=registry,ref=", binutilsTag(XX_REPO, BINUTILS_VERSION, "1", "linux-armv7")[0]])]
}

target "ld64-linux-armv6-tgz" {
inherits = ["ld64-tgz-base"]
args = {
LD_TARGET = "linux-armv6"
}
cache-from = [join("", ["type=registry,ref=", binutilsTag(XX_REPO, BINUTILS_VERSION, "1", "linux-armv6")[0]])]
}

target "ld64-linux-386-tgz" {
inherits = ["ld64-tgz-base"]
args = {
LD_TARGET = "linux-386"
}
cache-from = [join("", ["type=registry,ref=", binutilsTag(XX_REPO, BINUTILS_VERSION, "1", "linux-arm64")[0]])]
}

group "ld-static-tgz" {
targets = [for v in ["linux-arm64", "linux-amd64", "linux-riscv64", "linux-s390x", "linux-armv6", "linux-armv7", "linux-ppc64le", "linux-386", "windows-amd64", "windows-386"]: "ld-${v}-tgz"]
}
Expand Down
27 changes: 13 additions & 14 deletions src/ld/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,19 @@ RUN --mount=from=libtapi-static,source=/opt/libtapi,target=/opt/libtapi \
make -j $(nproc) -C ld64 && \
xx-verify --static ld64/src/ld/ld

FROM scratch AS ld64-signed-static
COPY --from=ld64-static / /
COPY --from=sigtool / /
COPY ld64.signed /

FROM --platform=$BUILDPLATFORM alpine AS ld64-tgz-build
WORKDIR /work
ARG TARGETOS TARGETARCH TARGETVARIANT
RUN --mount=from=ld64-signed-static \
mkdir /out-tgz && tar cvzf /out-tgz/ld64-signed-$TARGETOS-$TARGETARCH$TARGETVARIANT.tar.gz *

FROM scratch AS ld64-static-tgz
COPY --from=ld64-tgz-build /out-tgz/ /

FROM scratch AS ld64-static
COPY --from=ld64-static-base /work/cctools-port/cctools/ld64/src/ld/ld /ld64
Expand Down Expand Up @@ -136,20 +149,6 @@ FROM scratch AS sigtool
COPY --from=codesign-static / /
COPY --from=sigtool-base /work/sigtool/build/gensig /sigtool-gensig

FROM scratch AS ld64-signed-static
COPY --from=ld64-static / /
COPY --from=sigtool / /
COPY ld64.signed /

FROM --platform=$BUILDPLATFORM alpine AS ld64-tgz-build
WORKDIR /work
ARG TARGETOS TARGETARCH TARGETVARIANT
RUN --mount=from=ld64-signed-static \
mkdir /out-tgz && tar cvzf /out-tgz/ld64-signed-$TARGETOS-$TARGETARCH$TARGETVARIANT.tar.gz *

FROM scratch AS ld64-tgz
COPY --from=ld64-tgz-build /out-tgz/ /

FROM --platform=$BUILDPLATFORM alpine AS binutils-base0
RUN apk add --no-cache git clang lld zlib-dev gcc patch make musl-dev
WORKDIR /work
Expand Down

0 comments on commit 2801eaf

Please sign in to comment.