|
| 1 | +%include metadata.inc |
| 2 | + |
| 3 | +%global debug_package %{nil} |
| 4 | + |
| 5 | +Name: %{package_name} |
| 6 | +Version: %{package_version} |
| 7 | +Release: 1%{?dist} |
| 8 | +Summary: %{package_summary} |
| 9 | +License: %{package_license} |
| 10 | +URL: %{package_url} |
| 11 | + |
| 12 | +Source0: https://github.com/apple/swift/archive/swift-%{swift_version}.tar.gz#/swift.tar.gz |
| 13 | +Source1: https://github.com/apple/swift-corelibs-libdispatch/archive/swift-%{swift_version}.tar.gz#/corelibs-libdispatch.tar.gz |
| 14 | +Source2: https://github.com/apple/swift-corelibs-foundation/archive/swift-%{swift_version}.tar.gz#/corelibs-foundation.tar.gz |
| 15 | +Source3: https://github.com/apple/swift-integration-tests/archive/swift-%{swift_version}.tar.gz#/swift-integration-tests.tar.gz |
| 16 | +Source4: https://github.com/apple/swift-corelibs-xctest/archive/swift-%{swift_version}.tar.gz#/corelibs-xctest.tar.gz |
| 17 | +Source5: https://github.com/apple/swift-package-manager/archive/swift-%{swift_version}.tar.gz#/package-manager.tar.gz |
| 18 | +Source6: https://github.com/apple/swift-llbuild/archive/swift-%{swift_version}.tar.gz#/llbuild.tar.gz |
| 19 | +Source7: https://github.com/apple/swift-cmark/archive/swift-%{swift_version}.tar.gz#/cmark.tar.gz |
| 20 | +Source8: https://github.com/apple/swift-xcode-playground-support/archive/swift-%{swift_version}.tar.gz#/swift-xcode-playground-support.tar.gz |
| 21 | +Source9: https://github.com/apple/sourcekit-lsp/archive/swift-%{swift_version}.tar.gz#/sourcekit-lsp.tar.gz |
| 22 | +Source10: https://github.com/apple/indexstore-db/archive/swift-%{swift_version}.tar.gz#/indexstore-db.tar.gz |
| 23 | +Source11: https://github.com/apple/llvm-project/archive/swift-%{swift_version}.tar.gz#/llvm-project.tar.gz |
| 24 | +Source12: https://github.com/apple/swift-tools-support-core/archive/swift-%{swift_version}.tar.gz#/swift-tools-support-core.tar.gz |
| 25 | +Source13: https://github.com/apple/swift-argument-parser/archive/%{swift_argument_parser_version}.tar.gz#/swift-argument-parser.tar.gz |
| 26 | +Source14: https://github.com/apple/swift-driver/archive/swift-%{swift_version}.tar.gz#/swift-driver.tar.gz |
| 27 | +Source15: https://github.com/unicode-org/icu/archive/release-%{icu_version}.tar.gz#/icu.tar.gz |
| 28 | +Source16: https://github.com/apple/swift-syntax/archive/swift-%{swift_version}.zip#/swift-syntax.tar.gz |
| 29 | +Source17: https://github.com/jpsim/Yams/archive/%{yams_version}.zip#/yams.tar.gz |
| 30 | +Source18: https://github.com/apple/swift-crypto/archive/refs/tags/%{swift_crypto_version}.tar.gz#/swift-crypto.tar.gz |
| 31 | +Source19: https://github.com/ninja-build/ninja/archive/refs/tags/v%{ninja_version}.tar.gz#/ninja.tar.gz |
| 32 | + |
| 33 | +Patch0: patches/swift-api-checker.patch |
| 34 | +Patch1: patches/hwasan_symbolize.patch |
| 35 | + |
| 36 | +BuildRequires: clang |
| 37 | +BuildRequires: cmake |
| 38 | +BuildRequires: curl-devel |
| 39 | +BuildRequires: gcc-c++ |
| 40 | +BuildRequires: git |
| 41 | +BuildRequires: glibc-static |
| 42 | +BuildRequires: libbsd-devel |
| 43 | +BuildRequires: libedit-devel |
| 44 | +BuildRequires: libicu-devel |
| 45 | +BuildRequires: libuuid-devel |
| 46 | +BuildRequires: libxml2-devel |
| 47 | +BuildRequires: ncurses-devel |
| 48 | +BuildRequires: pexpect |
| 49 | +BuildRequires: pkgconfig |
| 50 | +BuildRequires: procps-ng |
| 51 | +BuildRequires: python |
| 52 | +BuildRequires: python-devel |
| 53 | +BuildRequires: python-pkgconfig |
| 54 | +BuildRequires: python-six |
| 55 | +BuildRequires: python3-devel |
| 56 | +BuildRequires: rsync |
| 57 | +BuildRequires: sqlite-devel |
| 58 | +BuildRequires: swig |
| 59 | +BuildRequires: tzdata |
| 60 | +BuildRequires: uuid-devel |
| 61 | +BuildRequires: wget |
| 62 | +BuildRequires: which |
| 63 | + |
| 64 | +Requires: binutils |
| 65 | +Requires: gcc |
| 66 | +Requires: git |
| 67 | +Requires: glibc-static |
| 68 | +Requires: gzip |
| 69 | +Requires: libbsd |
| 70 | +Requires: libcurl |
| 71 | +Requires: libedit |
| 72 | +Requires: libicu |
| 73 | +Requires: libsqlite |
| 74 | +Requires: libstdc++-static |
| 75 | +Requires: libuuid |
| 76 | +Requires: libxml2 |
| 77 | +Requires: tar |
| 78 | +Requires: tzdata |
| 79 | + |
| 80 | +ExclusiveArch: x86_64 aarch64 |
| 81 | + |
| 82 | +%description |
| 83 | +Swift is a general-purpose programming language built using |
| 84 | +a modern approach to safety, performance, and software design |
| 85 | +patterns. |
| 86 | + |
| 87 | +The goal of the Swift project is to create the best available |
| 88 | +language for uses ranging from systems programming, to mobile |
| 89 | +and desktop apps, scaling up to cloud services. Most |
| 90 | +importantly, Swift is designed to make writing and maintaining |
| 91 | +correct programs easier for the developer. |
| 92 | + |
| 93 | +%prep |
| 94 | +%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 |
| 95 | +# The Swift build script requires directories to be named |
| 96 | +# in a specific way so renaming the source directories is |
| 97 | +# necessary |
| 98 | +mv swift-cmark-swift-%{swift_version} cmark |
| 99 | +mv swift-corelibs-foundation-swift-%{swift_version} swift-corelibs-foundation |
| 100 | +mv swift-corelibs-libdispatch-swift-%{swift_version} swift-corelibs-libdispatch |
| 101 | +mv swift-corelibs-xctest-swift-%{swift_version} swift-corelibs-xctest |
| 102 | +mv swift-integration-tests-swift-%{swift_version} swift-integration-tests |
| 103 | +mv swift-llbuild-swift-%{swift_version} llbuild |
| 104 | +mv swift-package-manager-swift-%{swift_version} swiftpm |
| 105 | +mv swift-swift-%{swift_version} swift |
| 106 | +mv swift-xcode-playground-support-swift-%{swift_version} swift-xcode-playground-support |
| 107 | +mv sourcekit-lsp-swift-%{swift_version} sourcekit-lsp |
| 108 | +mv indexstore-db-swift-%{swift_version} indexstore-db |
| 109 | +mv llvm-project-swift-%{swift_version} llvm-project |
| 110 | +mv swift-syntax-swift-%{swift_version} swift-syntax |
| 111 | +mv swift-tools-support-core-swift-%{swift_version} swift-tools-support-core |
| 112 | +mv swift-argument-parser-%{swift_argument_parser_version} swift-argument-parser |
| 113 | +mv swift-driver-swift-%{swift_version} swift-driver |
| 114 | +mv swift-crypto-%{swift_crypto_version} swift-crypto |
| 115 | +mv ninja-%{ninja_version} ninja |
| 116 | + |
| 117 | +# ICU |
| 118 | +mv icu-release-%{icu_version} icu |
| 119 | + |
| 120 | +# Yams |
| 121 | +mv Yams-%{yams_version} yams |
| 122 | + |
| 123 | +# Adjust python version swift-api-checker |
| 124 | +%patch0 -p1 |
| 125 | + |
| 126 | +# Adjust python version hwasan_symbolize |
| 127 | +%patch1 -p1 |
| 128 | + |
| 129 | +# Fix python to python3 |
| 130 | +ln -s /usr/bin/python3 /usr/bin/python |
| 131 | + |
| 132 | +%build |
| 133 | +export VERBOSE=1 |
| 134 | + |
| 135 | +# Run the build |
| 136 | +swift/utils/build-script --preset=buildbot_linux,no_test install_destdir=%{_builddir} installable_package=%{_builddir}/swift-%{version}-centos8.tar.gz |
| 137 | + |
| 138 | +%install |
| 139 | +mkdir -p %{buildroot}%{_libexecdir}/swift/ |
| 140 | +cp -r %{_builddir}/usr/* %{buildroot}%{_libexecdir}/swift |
| 141 | +mkdir -p %{buildroot}%{_bindir} |
| 142 | +ln -fs %{_libexecdir}/swift/bin/swift %{buildroot}%{_bindir}/swift |
| 143 | +ln -fs %{_libexecdir}/swift/bin/swiftc %{buildroot}%{_bindir}/swiftc |
| 144 | +ln -fs %{_libexecdir}/swift/bin/sourcekit-lsp %{buildroot}%{_bindir}/sourcekit-lsp |
| 145 | +mkdir -p %{buildroot}%{_mandir}/man1 |
| 146 | +cp %{_builddir}/usr/share/man/man1/swift.1 %{buildroot}%{_mandir}/man1/swift.1 |
| 147 | + |
| 148 | +%files |
| 149 | +%license swift/LICENSE.txt |
| 150 | +%{_bindir}/swift |
| 151 | +%{_bindir}/swiftc |
| 152 | +%{_bindir}/sourcekit-lsp |
| 153 | +%{_mandir}/man1/swift.1.gz |
| 154 | +%{_libexecdir}/swift/ |
| 155 | + |
| 156 | +%post -p /sbin/ldconfig |
| 157 | +%postun -p /sbin/ldconfig |
| 158 | + |
| 159 | +%changelog |
0 commit comments