-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
build Ubuntu release-specific images
- Loading branch information
1 parent
ba57231
commit 1f33c75
Showing
4 changed files
with
119 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,25 @@ | ||
#!/bin/bash | ||
set -e | ||
|
||
docker build . -t swift-cross-aarch64:__test | ||
for dockerfile in *.Dockerfile; do | ||
docker build -f $dockerfile -t swift-cross-aarch64:__test . | ||
|
||
# Test dynamically linked standard library | ||
docker run --rm \ | ||
-v=$PWD/Tests:/swift \ | ||
-w=/swift \ | ||
swift-cross-aarch64:__test \ | ||
/home/ubuntu/x86_64/swift/usr/bin/swift \ | ||
build -c release \ | ||
--destination aarch64-unknown-linux-gnu.json | ||
# Test dynamically linked standard library | ||
docker run --rm \ | ||
-v=$PWD/Tests:/swift \ | ||
-w=/swift \ | ||
swift-cross-aarch64:__test \ | ||
/home/ubuntu/x86_64/swift/usr/bin/swift \ | ||
build -c release \ | ||
--destination aarch64-unknown-linux-gnu.json | ||
|
||
# Test statically linked standard library | ||
docker run --rm \ | ||
-v=$PWD/Tests:/swift \ | ||
-w=/swift \ | ||
swift-cross-aarch64:__test \ | ||
/home/ubuntu/x86_64/swift/usr/bin/swift \ | ||
build -c release \ | ||
--destination aarch64-unknown-linux-gnu.static.json \ | ||
--static-swift-stdlib | ||
# Test statically linked standard library | ||
docker run --rm \ | ||
-v=$PWD/Tests:/swift \ | ||
-w=/swift \ | ||
swift-cross-aarch64:__test \ | ||
/home/ubuntu/x86_64/swift/usr/bin/swift \ | ||
build -c release \ | ||
--destination aarch64-unknown-linux-gnu.static.json \ | ||
--static-swift-stdlib | ||
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
FROM ubuntu:24.04 | ||
ENV DEBIAN_FRONTEND noninteractive | ||
SHELL ["/bin/bash", "-c"] | ||
|
||
ARG SWIFT_VERSION | ||
ARG UBUNTU_VERSION='ubuntu24.04' | ||
|
||
WORKDIR /home/ubuntu | ||
|
||
RUN apt update | ||
RUN apt -y install curl | ||
|
||
# Note: The Docker CLI does not print the correct URL to the console, but the actual | ||
# interpolated string passed to `curl` is correct. | ||
RUN curl "https://download.swift.org/\ | ||
swift-${SWIFT_VERSION}-release/\ | ||
${UBUNTU_VERSION//[.]/}/\ | ||
swift-${SWIFT_VERSION}-RELEASE/\ | ||
swift-${SWIFT_VERSION}-RELEASE-${UBUNTU_VERSION}.tar.gz" \ | ||
-o toolchain.tar.gz | ||
|
||
RUN curl "https://download.swift.org/\ | ||
swift-${SWIFT_VERSION}-release/\ | ||
${UBUNTU_VERSION//[.]/}-aarch64/\ | ||
swift-${SWIFT_VERSION}-RELEASE/\ | ||
swift-${SWIFT_VERSION}-RELEASE-${UBUNTU_VERSION}-aarch64.tar.gz" \ | ||
-o toolchain-aarch64.tar.gz | ||
|
||
RUN apt -y dist-upgrade | ||
|
||
# Install dependencies of the Swift toolchain | ||
RUN apt update | ||
RUN apt -y install \ | ||
binutils \ | ||
git \ | ||
gnupg2 \ | ||
libc6-dev \ | ||
libcurl4-openssl-dev \ | ||
libedit2 \ | ||
libgcc-9-dev \ | ||
libsqlite3-0 \ | ||
libstdc++-9-dev \ | ||
libxml2-dev \ | ||
libz3-dev \ | ||
pkg-config \ | ||
tzdata \ | ||
unzip \ | ||
zlib1g-dev | ||
|
||
# Install dependencies needed for AArch64 cross-compilation. For some reason, `apt` cannot | ||
# resolve the dependencies if we install them all at once. | ||
RUN apt -y install gcc-aarch64-linux-gnu | ||
RUN apt -y install libstdc++-12-dev-arm64-cross | ||
RUN apt -y install g++-multilib | ||
|
||
# Unpack the Swift toolchain for x86_64 | ||
WORKDIR /home/ubuntu/x86_64/${SWIFT_VERSION} | ||
|
||
RUN tar --strip-components=1 -xf /home/ubuntu/toolchain.tar.gz | ||
RUN rm /home/ubuntu/toolchain.tar.gz | ||
|
||
# Unpack the Swift toolchain for AArch64 | ||
WORKDIR /home/ubuntu/aarch64/${SWIFT_VERSION} | ||
|
||
RUN tar --strip-components=1 -xf /home/ubuntu/toolchain-aarch64.tar.gz | ||
RUN rm /home/ubuntu/toolchain-aarch64.tar.gz | ||
|
||
|
||
WORKDIR /home/ubuntu | ||
|
||
# See: | ||
# https://forums.swift.org/t/swift-runtime-unable-to-suspend-thread-when-compiling-in-qemu/67676/3 | ||
RUN rm /home/ubuntu/aarch64/${SWIFT_VERSION}/usr/lib/swift/clang | ||
RUN ln -s \ | ||
/home/ubuntu/x86_64/${SWIFT_VERSION}/usr/lib/swift/clang \ | ||
/home/ubuntu/aarch64/${SWIFT_VERSION}/usr/lib/swift/clang | ||
|
||
# Create symbolic links to the Swift toolchains, to make it easier to reference them | ||
RUN ln -s /home/ubuntu/aarch64/${SWIFT_VERSION} /home/ubuntu/aarch64/swift | ||
RUN ln -s /home/ubuntu/x86_64/${SWIFT_VERSION} /home/ubuntu/x86_64/swift |