# Maintainer: fanjiang # Maintainer: soloturn@gmail.com # Contributor: Theo Tosini # Contributor: Gábor Sebestyén # Contributor: Andrew Sun _pkgname="swift-language" pkgname="$_pkgname-git" pkgver=2023.12.21a.r6.gf08f86c7161 pkgrel=1 pkgdesc="The Swift programming language, taken directly from the Apple repository" url="https://swift.org/" license=('Apache-2.0') arch=('x86_64') depends=('icu' 'libedit' 'libxml2' 'python' 'libbsd' 'ncurses' ) makedepends=( 'clang' 'cmake' 'git' 'lld' 'llvm' 'ninja' 'patch' 'python-six' 'rsync' 'swift-language' 'swig' ) provides=("$_pkgname") conflicts=("$_pkgname") source=( 'git+https://github.com/apple/swift' '0001-arch-aur-patches.patch' 'apple-indexstore-db'::'git+https://github.com/apple/indexstore-db' 'apple-llvm-project'::'git+https://github.com/apple/llvm-project' 'apple-sourcekit-lsp'::'git+https://github.com/apple/sourcekit-lsp' 'swift-argument-parser'::'git+https://github.com/apple/swift-argument-parser' 'swift-asn1'::'git+https://github.com/apple/swift-asn1' 'swift-atomics'::'git+https://github.com/apple/swift-atomics' 'swift-certificates'::'git+https://github.com/apple/swift-certificates' 'swift-cmark'::'git+https://github.com/apple/swift-cmark' 'swift-cmark'::'git+https://github.com/apple/swift-cmark' 'swift-collections'::'git+https://github.com/apple/swift-collections' 'swift-corelibs-foundation'::'git+https://github.com/apple/swift-corelibs-foundation' 'swift-corelibs-libdispatch'::'git+https://github.com/apple/swift-corelibs-libdispatch' 'swift-corelibs-xctest'::'git+https://github.com/apple/swift-corelibs-xctest' 'swift-crypto'::'git+https://github.com/apple/swift-crypto' 'swift-docc'::'git+https://github.com/apple/swift-docc' 'swift-docc-render-artifact'::'git+https://github.com/apple/swift-docc-render-artifact' 'swift-docc-symbolkit'::'git+https://github.com/apple/swift-docc-symbolkit' 'swift-driver'::'git+https://github.com/apple/swift-driver' 'swift-experimental-string-processing'::'git+https://github.com/apple/swift-experimental-string-processing' 'swift-format'::'git+https://github.com/apple/swift-format' 'swift-installer-scripts'::'git+https://github.com/apple/swift-installer-scripts' 'swift-integration-tests'::'git+https://github.com/apple/swift-integration-tests' 'swift-llbuild'::'git+https://github.com/apple/swift-llbuild' 'swift-llvm-bindings'::'git+https://github.com/apple/swift-llvm-bindings' 'swift-lmdb'::'git+https://github.com/apple/swift-lmdb' 'swift-markdown'::'git+https://github.com/apple/swift-markdown' 'swift-nio'::'git+https://github.com/apple/swift-nio' 'swift-nio-ssl'::'git+https://github.com/apple/swift-nio-ssl' 'swift-numerics'::'git+https://github.com/apple/swift-numerics' 'swift-package-manager'::'git+https://github.com/apple/swift-package-manager' 'swift-stress-tester'::'git+https://github.com/apple/swift-stress-tester' 'swift-syntax'::'git+https://github.com/apple/swift-syntax' 'swift-system'::'git+https://github.com/apple/swift-system' 'swift-tools-support-core'::'git+https://github.com/apple/swift-tools-support-core' 'swift-xcode-playground-support'::'git+https://github.com/apple/swift-xcode-playground-support' 'yams'::'git+https://github.com/jpsim/Yams' ) sha256sums=( 'SKIP' 'SKIP' 'SKIP' 'SKIP' 'SKIP' 'SKIP' 'SKIP' 'SKIP' 'SKIP' 'SKIP' 'SKIP' 'SKIP' 'SKIP' 'SKIP' 'SKIP' 'SKIP' 'SKIP' 'SKIP' 'SKIP' 'SKIP' 'SKIP' 'SKIP' 'SKIP' 'SKIP' 'SKIP' 'SKIP' 'SKIP' 'SKIP' 'SKIP' 'SKIP' 'SKIP' 'SKIP' 'SKIP' 'SKIP' 'SKIP' 'SKIP' 'SKIP' 'SKIP' ) # By default makepkg runs strip on binaries. This causes issues with the Swift REPL. # from https://github.com/RLovelett/swift-aur/blob/master/PKGBUILD # termux had no trouble up to now, strip all executables and shared objects: # https://github.com/termux/termux-packages/blob/master/scripts/build/termux_step_massage.sh#L24 # would be cool to not strip only the ones which really are necessary, but how? options=(!strip) prepare () { ln -sfP 'apple-indexstore-db' 'indexstore-db' ln -sfP 'apple-llvm-project' 'llvm-project' ln -sfP 'apple-sourcekit-lsp' 'sourcekit-lsp' ln -sfP 'swift-argument-parser' 'argument-parser' ln -sfP 'swift-asn1' 'asn1' ln -sfP 'swift-atomics' 'atomics' ln -sfP 'swift-certificates' 'certificates' ln -sfP 'swift-cmark' 'cmark' ln -sfP 'swift-cmark' 'cmark' ln -sfP 'swift-collections' 'collections' ln -sfP 'swift-corelibs-foundation' 'corelibs-foundation' ln -sfP 'swift-corelibs-libdispatch' 'corelibs-libdispatch' ln -sfP 'swift-corelibs-xctest' 'corelibs-xctest' ln -sfP 'swift-crypto' 'crypto' ln -sfP 'swift-docc' 'docc' ln -sfP 'swift-docc-render-artifact' 'docc-render-artifact' ln -sfP 'swift-docc-symbolkit' 'docc-symbolkit' ln -sfP 'swift-driver' 'driver' ln -sfP 'swift-experimental-string-processing' 'experimental-string-processing' ln -sfP 'swift-format' 'format' ln -sfP 'swift-installer-scripts' 'installer-scripts' ln -sfP 'swift-integration-tests' 'integration-tests' ln -sfP 'swift-llbuild' 'llbuild' ln -sfP 'swift-llvm-bindings' 'llvm-bindings' ln -sfP 'swift-lmdb' 'lmdb' ln -sfP 'swift-markdown' 'markdown' ln -sfP 'swift-nio' 'nio' ln -sfP 'swift-nio-ssl' 'nio-ssl' ln -sfP 'swift-numerics' 'numerics' ln -sfP 'swift-package-manager' 'package-manager' ln -sfP 'swift-stress-tester' 'stress-tester' ln -sfP 'swift-syntax' 'syntax' ln -sfP 'swift-system' 'system' ln -sfP 'swift-tools-support-core' 'tools-support-core' ln -sfP 'swift-xcode-playground-support' 'xcode-playground-support' ( cd swift && patch -Np1 -F100 -i "${srcdir:?}/0001-arch-aur-patches.patch" ) } pkgver() { cd "swift" git describe --long | sed -E 's/^[^0-9]+//;s/-([^0-9]+)/\1/;s/([^-]*-g)/r\1/;s/-/./g' } build() { # Fix /usr/include error find "$srcdir/swift/stdlib/public/SwiftShims" -type f -print0 | xargs -0 sed -i 's|/usr/include/x86_64-linux-gnu|/usr/include|g' find "$srcdir/llvm-project/clang" -type f -print0 | xargs -0 sed -i 's|/usr/include/x86_64-linux-gnu|/usr/include|g' find "$srcdir/llvm-project/clang-tools-extra" -type f -print0 | xargs -0 sed -i 's|/usr/include/x86_64-linux-gnu|/usr/include|g' local _build_options_test=( --dry-run --preset=buildbot_linux,no_test install_destdir="destdir" ) local _build_options=( --release --skip-early-swift-driver --skip-early-swiftsyntax ) "$srcdir/swift/utils/build-script" "${_build_options[@]}" } package() { DESTDIR="$pkgdir" cmake \ --install "$srcdir/build/Ninja-ReleaseAssert/cmark-linux-x86_64" \ --prefix "/usr/lib/swift" DESTDIR="$pkgdir" cmake \ --install "$srcdir/build/Ninja-ReleaseAssert/llvm-linux-x86_64" \ --prefix "/usr/lib/swift" DESTDIR="$pkgdir" cmake \ --install "$srcdir/build/Ninja-ReleaseAssert/swift-linux-x86_64" \ --prefix "/usr/lib/swift" } # vim:set ts=2 sw=2 et: