Skip to content

Update the Amazon Linux 2 and CentOS 7 RPM to support Swift 5.10 #283

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 43 additions & 0 deletions platforms/Linux/RPM/Amazonlinux/2/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,46 @@ RUN cd /tmp && yum-builddep -y optimization.spec
# fix python six
RUN mkdir -p /usr/local/lib/python3.7/site-packages/
RUN easy_install-3.7 six

ARG SWIFT_PLATFORM=amazonlinux2
ARG SWIFT_VERSION=5.8.1
ARG SWIFT_BRANCH=swift-${SWIFT_VERSION}-release
ARG SWIFT_TAG=swift-${SWIFT_VERSION}-RELEASE
ARG SWIFT_WEBROOT=https://download.swift.org
ARG SWIFT_PREFIX=/opt/swift/${SWIFT_VERSION}

ENV SWIFT_PLATFORM=$SWIFT_PLATFORM \
SWIFT_VERSION=$SWIFT_VERSION \
SWIFT_BRANCH=$SWIFT_BRANCH \
SWIFT_TAG=$SWIFT_TAG \
SWIFT_WEBROOT=$SWIFT_WEBROOT \
SWIFT_PREFIX=$SWIFT_PREFIX

RUN set -e; \
ARCH_NAME="$(rpm --eval '%{_arch}')"; \
url=; \
case "${ARCH_NAME##*-}" in \
'x86_64') \
OS_ARCH_SUFFIX=''; \
;; \
'aarch64') \
OS_ARCH_SUFFIX='-aarch64'; \
;; \
*) echo >&2 "error: unsupported architecture: '$ARCH_NAME'"; exit 1 ;; \
esac; \
SWIFT_WEBDIR="$SWIFT_WEBROOT/$SWIFT_BRANCH/$(echo $SWIFT_PLATFORM | tr -d .)$OS_ARCH_SUFFIX" \
&& SWIFT_BIN_URL="$SWIFT_WEBDIR/$SWIFT_TAG/$SWIFT_TAG-$SWIFT_PLATFORM$OS_ARCH_SUFFIX.tar.gz" \
&& SWIFT_SIG_URL="$SWIFT_BIN_URL.sig" \
&& echo $SWIFT_BIN_URL \
# - Download the GPG keys, Swift toolchain, and toolchain signature, and verify.
&& export GNUPGHOME="$(mktemp -d)" \
&& curl -fsSL "$SWIFT_BIN_URL" -o swift.tar.gz "$SWIFT_SIG_URL" -o swift.tar.gz.sig \
&& curl -fSsL https://swift.org/keys/all-keys.asc | gpg --import - \
&& gpg --batch --verify swift.tar.gz.sig swift.tar.gz \
# - Unpack the toolchain, set libs permissions, and clean up.
&& mkdir -p $SWIFT_PREFIX \
&& tar -xzf swift.tar.gz --directory $SWIFT_PREFIX --strip-components=1 \
&& chmod -R o+r $SWIFT_PREFIX/usr/lib/swift \
&& rm -rf "$GNUPGHOME" swift.tar.gz.sig swift.tar.gz

ENV PATH="${SWIFT_PREFIX}/usr/bin:${PATH}"

This file was deleted.

85 changes: 44 additions & 41 deletions platforms/Linux/RPM/Amazonlinux/2/swiftlang.spec
Original file line number Diff line number Diff line change
@@ -1,43 +1,44 @@
%include global.inc
%include metadata.inc

Source0: https://github.com/apple/swift/archive/swift-%{swift_version}.tar.gz#/swift.tar.gz
Source1: https://github.com/apple/swift-corelibs-libdispatch/archive/swift-%{swift_version}.tar.gz#/corelibs-libdispatch.tar.gz
Source2: https://github.com/apple/swift-corelibs-foundation/archive/swift-%{swift_version}.tar.gz#/corelibs-foundation.tar.gz
Source3: https://github.com/apple/swift-integration-tests/archive/swift-%{swift_version}.tar.gz#/swift-integration-tests.tar.gz
Source4: https://github.com/apple/swift-corelibs-xctest/archive/swift-%{swift_version}.tar.gz#/corelibs-xctest.tar.gz
Source5: https://github.com/apple/swift-package-manager/archive/swift-%{swift_version}.tar.gz#/package-manager.tar.gz
Source6: https://github.com/apple/swift-llbuild/archive/swift-%{swift_version}.tar.gz#/llbuild.tar.gz
Source0: https://github.com/apple/indexstore-db/archive/swift-%{swift_version}.tar.gz#/indexstore-db.tar.gz
Source1: https://github.com/apple/llvm-project/archive/swift-%{swift_version}.tar.gz#/llvm-project.tar.gz
Source2: https://github.com/apple/sourcekit-lsp/archive/swift-%{swift_version}.tar.gz#/sourcekit-lsp.tar.gz
Source3: https://github.com/apple/swift-argument-parser/archive/%{swift_argument_parser_version}.tar.gz#/swift-argument-parser.tar.gz
Source4: https://github.com/apple/swift-asn1/archive/%{swift_asn1_version}.tar.gz#/swift-asn1.tar.gz
Source5: https://github.com/apple/swift-atomics/archive/%{swift_atomics_version}.tar.gz#/swift-atomics.tar.gz
Source6: https://github.com/apple/swift-certificates/archive/%{swift_certificates_version}.tar.gz#/swift-certificates.tar.gz
Source7: https://github.com/apple/swift-cmark/archive/swift-%{swift_version}.tar.gz#/cmark.tar.gz
Source8: https://github.com/apple/swift-xcode-playground-support/archive/swift-%{swift_version}.tar.gz#/swift-xcode-playground-support.tar.gz
Source9: https://github.com/apple/sourcekit-lsp/archive/swift-%{swift_version}.tar.gz#/sourcekit-lsp.tar.gz
Source10: https://github.com/apple/indexstore-db/archive/swift-%{swift_version}.tar.gz#/indexstore-db.tar.gz
Source11: https://github.com/apple/llvm-project/archive/swift-%{swift_version}.tar.gz#/llvm-project.tar.gz
Source12: https://github.com/apple/swift-tools-support-core/archive/swift-%{swift_version}.tar.gz#/swift-tools-support-core.tar.gz
Source13: https://github.com/apple/swift-argument-parser/archive/%{swift_argument_parser_version}.tar.gz#/swift-argument-parser.tar.gz
Source14: https://github.com/apple/swift-driver/archive/swift-%{swift_version}.tar.gz#/swift-driver.tar.gz
Source15: https://github.com/unicode-org/icu/archive/release-%{icu_version}.tar.gz#/icu.tar.gz
Source16: https://github.com/apple/swift-syntax/archive/swift-%{swift_version}.zip#/swift-syntax.tar.gz
Source17: https://github.com/jpsim/Yams/archive/%{yams_version}.tar.gz#/yams.tar.gz
Source18: https://github.com/apple/swift-crypto/archive/refs/tags/%{swift_crypto_version}.tar.gz#/swift-crypto.tar.gz
Source19: https://github.com/ninja-build/ninja/archive/refs/tags/v%{ninja_version}.tar.gz#/ninja.tar.gz
Source20: https://github.com/KitWare/CMake/archive/refs/tags/v%{cmake_version}.tar.gz#/cmake.tar.gz
Source21: https://github.com/apple/swift-atomics/archive/%{swift_atomics_version}.tar.gz#/swift-atomics.tar.gz
Source22: https://github.com/apple/swift-cmark/archive/swift-%{swift_version}-gfm.tar.gz#/swift-cmark-gfm.tar.gz
Source23: https://github.com/apple/swift-docc/archive/swift-%{swift_version}.tar.gz#/swift-docc.tar.gz
Source24: https://github.com/apple/swift-docc-render-artifact/archive/swift-%{swift_version}.tar.gz#/swift-docc-render-artifact.tar.gz
Source25: https://github.com/apple/swift-docc-symbolkit/archive/swift-%{swift_version}.tar.gz#/swift-docc-symbolkit.tar.gz
Source26: https://github.com/apple/swift-collections/archive/%{swift_collections_version}.tar.gz#/swift-collections.tar.gz
Source27: https://github.com/apple/swift-numerics/archive/%{swift_numerics_version}.tar.gz#/swift-numerics.tar.gz
Source28: https://github.com/apple/swift-system/archive/%{swift_system_version}.tar.gz#/swift-system.tar.gz
Source29: https://github.com/apple/swift-nio/archive/%{swift_nio_version}.tar.gz#/swift-nio.tar.gz
Source30: https://github.com/apple/swift-nio-ssl/archive/%{swift_nio_ssl_version}.tar.gz#/swift-nio-ssl.tar.gz
Source31: https://github.com/apple/swift-format/archive/swift-%{swift_version}.tar.gz#/swift-format.tar.gz
Source32: https://github.com/apple/swift-lmdb/archive/swift-%{swift_version}.tar.gz#/swift-lmdb.tar.gz
Source33: https://github.com/apple/swift-markdown/archive/swift-%{swift_version}.tar.gz#/swift-markdown.tar.gz
Source34: https://github.com/apple/swift-experimental-string-processing/archive/swift-%{swift_version}.tar.gz#/swift-experimental-string-processing.tar.gz
Source8: https://github.com/apple/swift-collections/archive/%{swift_collections_version}.tar.gz#/swift-collections.tar.gz
Source9: https://github.com/apple/swift-corelibs-foundation/archive/swift-%{swift_version}.tar.gz#/corelibs-foundation.tar.gz
Source10: https://github.com/apple/swift-corelibs-libdispatch/archive/swift-%{swift_version}.tar.gz#/corelibs-libdispatch.tar.gz
Source11: https://github.com/apple/swift-corelibs-xctest/archive/swift-%{swift_version}.tar.gz#/corelibs-xctest.tar.gz
Source12: https://github.com/apple/swift-crypto/archive/refs/tags/%{swift_crypto_version}.tar.gz#/swift-crypto.tar.gz
Source13: https://github.com/apple/swift-docc-render-artifact/archive/swift-%{swift_version}.tar.gz#/swift-docc-render-artifact.tar.gz
Source14: https://github.com/apple/swift-docc-symbolkit/archive/swift-%{swift_version}.tar.gz#/swift-docc-symbolkit.tar.gz
Source15: https://github.com/apple/swift-docc/archive/swift-%{swift_version}.tar.gz#/swift-docc.tar.gz
Source16: https://github.com/apple/swift-driver/archive/swift-%{swift_version}.tar.gz#/swift-driver.tar.gz
Source17: https://github.com/apple/swift-experimental-string-processing/archive/swift-%{swift_version}.tar.gz#/swift-experimental-string-proce
Source18: https://github.com/apple/swift-format/archive/swift-%{swift_version}.tar.gz#/swift-format.tar.gz
Source19: https://github.com/apple/swift-integration-tests/archive/swift-%{swift_version}.tar.gz#/swift-integration-tests.tar.gz
Source20: https://github.com/apple/swift-llbuild/archive/swift-%{swift_version}.tar.gz#/llbuild.tar.gz
Source21: https://github.com/apple/swift-llvm-bindings/archive/swift-%{swift_version}.tar.gz#/swift-llvm-bindings.tar.gz
Source22: https://github.com/apple/swift-lmdb/archive/swift-%{swift_version}.tar.gz#/swift-lmdb.tar.gz
Source23: https://github.com/apple/swift-markdown/archive/swift-%{swift_version}.tar.gz#/swift-markdown.tar.gz
Source24: https://github.com/apple/swift-nio-ssl/archive/%{swift_nio_ssl_version}.tar.gz#/swift-nio-ssl.tar.gz
Source25: https://github.com/apple/swift-nio/archive/%{swift_nio_version}.tar.gz#/swift-nio.tar.gz
Source26: https://github.com/apple/swift-numerics/archive/%{swift_numerics_version}.tar.gz#/swift-numerics.tar.gz
Source27: https://github.com/apple/swift-package-manager/archive/swift-%{swift_version}.tar.gz#/package-manager.tar.gz
Source28: https://github.com/apple/swift-syntax/archive/swift-%{swift_version}.zip#/swift-syntax.tar.gz
Source29: https://github.com/apple/swift-system/archive/%{swift_system_version}.tar.gz#/swift-system.tar.gz
Source30: https://github.com/apple/swift-tools-support-core/archive/swift-%{swift_version}.tar.gz#/swift-tools-support-core.tar.gz
Source31: https://github.com/apple/swift-xcode-playground-support/archive/swift-%{swift_version}.tar.gz#/swift-xcode-playground-support.tar.gz
Source32: https://github.com/apple/swift/archive/swift-%{swift_version}.tar.gz#/swift.tar.gz
Source33: https://github.com/jpsim/Yams/archive/%{yams_version}.tar.gz#/yams.tar.gz
Source34: https://github.com/KitWare/CMake/archive/refs/tags/v%{cmake_version}.tar.gz#/cmake.tar.gz
Source35: https://github.com/ninja-build/ninja/archive/refs/tags/v%{ninja_version}.tar.gz#/ninja.tar.gz
Source36: https://github.com/unicode-org/icu/archive/release-%{icu_version}.tar.gz#/icu.tar.gz

Patch0: patches/hwasan_symbolize.patch

BuildRequires: clang
BuildRequires: curl-devel
Expand All @@ -59,13 +60,16 @@ BuildRequires: python-devel
BuildRequires: python-pkgconfig
BuildRequires: python-six
BuildRequires: python3-devel
BuildRequires: python3-psutil
BuildRequires: rsync
BuildRequires: sqlite-devel
BuildRequires: swig
BuildRequires: tzdata
BuildRequires: unzip
BuildRequires: uuid-devel
BuildRequires: wget
BuildRequires: which
BuildRequires: zip

Requires: binutils
Requires: gcc
Expand All @@ -91,7 +95,7 @@ ExclusiveArch: x86_64 aarch64
%include description.inc

%prep
%setup -q -c -n %{swift_source_location} -a 0 -a 1 -a 2 -a 3 -a 4 -a 5 -a 6 -a 7 -a 8 -a 9 -a 10 -a 11 -a 12 -a 13 -a 14 -a 15 -a 16 -a 17 -a 18 -a 19 -a 20 -a 21 -a 22 -a 23 -a 24 -a 25 -a 26 -a 27 -a 28 -a 29 -a 30 -a 31 -a 32 -a 33 -a 34
%setup -q -c -n %{swift_source_location} -a 0 -a 1 -a 2 -a 3 -a 4 -a 5 -a 6 -a 7 -a 8 -a 9 -a 10 -a 11 -a 12 -a 13 -a 14 -a 15 -a 16 -a 17 -a 18 -a 19 -a 20 -a 21 -a 22 -a 23 -a 24 -a 25 -a 26 -a 27 -a 28 -a 29 -a 30 -a 31 -a 32 -a 33 -a 34 -a 35 -a 36

# The Swift build script requires directories to be named
# in a specific way so renaming the source directories is
Expand All @@ -103,9 +107,10 @@ mv llvm-project-swift-%{swift_version} llvm-project
mv ninja-%{ninja_version} ninja
mv sourcekit-lsp-swift-%{swift_version} sourcekit-lsp
mv swift-argument-parser-%{swift_argument_parser_version} swift-argument-parser
mv swift-asn1-%{swift_asn1_version} swift-asn1
mv swift-atomics-%{swift_atomics_version} swift-atomics
mv swift-certificates-%{swift_certificates_version} swift-certificates
mv swift-cmark-swift-%{swift_version} cmark
mv swift-cmark-swift-%{swift_version}-gfm swift-cmark-gfm
mv swift-collections-%{swift_collections_version} swift-collections
mv swift-corelibs-foundation-swift-%{swift_version} swift-corelibs-foundation
mv swift-corelibs-libdispatch-swift-%{swift_version} swift-corelibs-libdispatch
Expand All @@ -115,9 +120,11 @@ mv swift-docc-render-artifact-swift-%{swift_version} swift-docc-render-artifact
mv swift-docc-swift-%{swift_version} swift-docc
mv swift-docc-symbolkit-swift-%{swift_version} swift-docc-symbolkit
mv swift-driver-swift-%{swift_version} swift-driver
mv swift-experimental-string-processing-swift-%{swift_version} swift-experimental-string-processing
mv swift-format-swift-%{swift_version} swift-format
mv swift-integration-tests-swift-%{swift_version} swift-integration-tests
mv swift-llbuild-swift-%{swift_version} llbuild
mv swift-llvm-bindings-swift-%{swift_version} swift-llvm-bindings
mv swift-lmdb-swift-%{swift_version} swift-lmdb
mv swift-markdown-swift-%{swift_version} swift-markdown
mv swift-nio-%{swift_nio_version} swift-nio
Expand All @@ -130,10 +137,6 @@ mv swift-system-%{swift_system_version} swift-system
mv swift-tools-support-core-swift-%{swift_version} swift-tools-support-core
mv swift-xcode-playground-support-swift-%{swift_version} swift-xcode-playground-support
mv Yams-%{yams_version} yams
mv swift-experimental-string-processing-swift-%{swift_version} swift-experimental-string-processing

# Adjust python version hwasan_symbolize
%patch0 -p1

%build
export VERBOSE=1
Expand Down
35 changes: 33 additions & 2 deletions platforms/Linux/RPM/Centos/7/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,40 @@ RUN echo -e "Name: optimization\nVersion: optimization\nRelease: optimization\nS
RUN cat /tmp/swiftlang.spec | grep BuildRequires >> /tmp/optimization.spec
RUN echo -e "\n%description" >> /tmp/optimization.spec
# install the build requirements
RUN cd /tmp && yum-builddep -y optimization.spec
RUN cd /tmp && yum-builddep --enablerepo=centosplus -y optimization.spec

# Workaround to support clang-3.5 or a later version
RUN echo -e ". /opt/rh/sclo-git25/enable\n. /opt/rh/llvm-toolset-7/enable\n. /opt/rh/devtoolset-8/enable\n" >> $HOME/.bashrc
RUN echo -e ". /opt/rh/sclo-git25/enable\n. /opt/rh/devtoolset-8/enable\n" >> $HOME/.bashrc
RUN source $HOME/.bashrc
RUN sed -i -e 's/\*__block/\*__libc_block/g' /usr/include/unistd.h

ARG SWIFT_PLATFORM=centos7
ARG SWIFT_VERSION=5.8.1
ARG SWIFT_BRANCH=swift-${SWIFT_VERSION}-release
ARG SWIFT_TAG=swift-${SWIFT_VERSION}-RELEASE
ARG SWIFT_WEBROOT=https://download.swift.org
ARG SWIFT_PREFIX=/opt/swift/${SWIFT_VERSION}

ENV SWIFT_PLATFORM=$SWIFT_PLATFORM \
SWIFT_VERSION=$SWIFT_VERSION \
SWIFT_BRANCH=$SWIFT_BRANCH \
SWIFT_TAG=$SWIFT_TAG \
SWIFT_WEBROOT=$SWIFT_WEBROOT \
SWIFT_PREFIX=$SWIFT_PREFIX

RUN set -e; \
SWIFT_WEBDIR="$SWIFT_WEBROOT/$SWIFT_BRANCH/$(echo $SWIFT_PLATFORM | tr -d .)" \
&& SWIFT_BIN_URL="$SWIFT_WEBDIR/$SWIFT_TAG/$SWIFT_TAG-$SWIFT_PLATFORM.tar.gz" \
&& SWIFT_SIG_URL="$SWIFT_BIN_URL.sig" \
# - Download the GPG keys, Swift toolchain, and toolchain signature, and verify.
&& export GNUPGHOME="$(mktemp -d)" \
&& curl -fsSL "$SWIFT_BIN_URL" -o swift.tar.gz "$SWIFT_SIG_URL" -o swift.tar.gz.sig \
&& curl -fSsL https://swift.org/keys/all-keys.asc | gpg --import - \
&& gpg --batch --verify swift.tar.gz.sig swift.tar.gz \
# - Unpack the toolchain, set libs permissions, and clean up.
&& mkdir -p $SWIFT_PREFIX \
&& tar -xzf swift.tar.gz --directory $SWIFT_PREFIX --strip-components=1 \
&& chmod -R o+r $SWIFT_PREFIX/usr/lib/swift \
&& rm -rf "$GNUPGHOME" swift.tar.gz.sig swift.tar.gz

ENV PATH="${SWIFT_PREFIX}/usr/bin:${PATH}"
2 changes: 2 additions & 0 deletions platforms/Linux/RPM/Centos/7/docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,14 @@ services:

docker-setup:
image: centos-7-rpm-builder
platform: linux/amd64
build:
context: .
dockerfile: Dockerfile

common: &common
image: centos-7-rpm-builder
platform: linux/amd64
depends_on: [docker-setup]
# https://bugs.swift.org/browse/SR-15343
security_opt:
Expand Down
10 changes: 0 additions & 10 deletions platforms/Linux/RPM/Centos/7/patches/hwasan_symbolize.patch

This file was deleted.

Loading