Skip to content

Commit bb4b350

Browse files
committed
set up build environment for release executables, add checklist
1 parent ca1195c commit bb4b350

File tree

5 files changed

+84
-1
lines changed

5 files changed

+84
-1
lines changed

.swift-version

Lines changed: 0 additions & 1 deletion
This file was deleted.

Package.swift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,9 @@ let package = Package(
3838
dependencies: [
3939
"SwiftlyCore",
4040
"CLibArchive",
41+
],
42+
linkerSettings: [
43+
.linkedLibrary("z")
4144
]
4245
),
4346
.systemLibrary(

RELEASING.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Releasing swiftly
2+
3+
1. Check out the commit you wish to create a release for. Ensure no other local modifications or changes are present.
4+
5+
1. Ensure the version string in `Swiftly.swift` is accurate. If it is not, push another commit updating it to the proper value.
6+
7+
1. Create a tag on that commit with the format "x.y.z". Do not omit "z", even if its value is 0.
8+
9+
1. Build the executables for the release (do this once on an x86_64 machine and once on an aarch64 one):
10+
11+
- In the root of the `swiftly` repository, run the following command: `docker build -t <image name> -f scripts/build.dockerfile .`
12+
- Then, run `container_id=$(docker create <image name>)`
13+
- Retrieve the built swiftly executable with `docker cp "$container_id:/swiftly" <executable name>`
14+
- For ARM, the executable name should be `swiftly-aarch64-unknown-linux-gnu`
15+
- For x86_64, the executable name should be `swiftly-x86_64-unknown-linux-gnu`
16+
- Clean up the leftover container with `docker rm -v $container_id`
17+
- Clean up the leftover image with `docker rm -f <image name>`
18+
19+
1. Push the tag to `origin`.
20+
21+
1. Go to the GitHub page for the new tag, click edit tag, add an appropriate description, attach the prebuilt executables, and click "Publish Release".

scripts/build-libarchive.sh

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
#!/usr/bin/env bash
2+
3+
set -o errexit
4+
5+
# TODO detect platform
6+
LIBARCHIVE_VERSION=3.6.1
7+
8+
mkdir /tmp/archive-build
9+
pushd /tmp/archive-build
10+
curl --remote-name \
11+
--location \
12+
"https://github.com/libarchive/libarchive/releases/download/v$LIBARCHIVE_VERSION/libarchive-$LIBARCHIVE_VERSION.tar.gz"
13+
tar -xzf "libarchive-$LIBARCHIVE_VERSION.tar.gz"
14+
15+
cd "libarchive-$LIBARCHIVE_VERSION"
16+
./configure \
17+
--enable-shared=no \
18+
--with-pic \
19+
--without-nettle \
20+
--without-openssl \
21+
--without-lzo2 \
22+
--without-expat \
23+
--without-xml2 \
24+
--without-bz2lib \
25+
--without-libb2 \
26+
--without-iconv \
27+
--without-zstd \
28+
--without-lzma \
29+
--without-lz4 \
30+
--disable-acl \
31+
--disable-bsdtar \
32+
--disable-bsdcat
33+
make
34+
make install
35+
popd

scripts/build.dockerfile

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# Dockerfile used to build a statically-linked swiftly executable for generic GNU/Linux platforms.
2+
# See RELEASING.md for information on how to use this file.
3+
4+
FROM swiftlang/swift:nightly-amazonlinux2
5+
6+
# swiftly build depdenencies
7+
RUN yum install -y \
8+
curl \
9+
gcc \
10+
make
11+
12+
COPY . /tmp/swiftly
13+
WORKDIR /tmp/swiftly
14+
15+
RUN ./scripts/build-libarchive.sh
16+
17+
RUN swift build \
18+
--static-swift-stdlib \
19+
--configuration release
20+
21+
RUN mv .build/release/swiftly /swiftly
22+
RUN strip /swiftly
23+
24+
RUN /swiftly --version
25+
RUN ldd /swiftly

0 commit comments

Comments
 (0)