diff options
author | susurri | 2023-10-26 09:10:02 +0000 |
---|---|---|
committer | susurri | 2023-10-26 09:10:02 +0000 |
commit | af2f7449e3edbe1668702b75b0124e5955b2c405 (patch) | |
tree | 10348389979076eff4065e6f61b4a983bac0978c | |
parent | 4a0f90547f7c4953a5288cd3b929b10788056410 (diff) | |
download | aur-af2f7449e3edbe1668702b75b0124e5955b2c405.tar.gz |
feat: support aarch64
use ubi9 binaries instead of centos7 and patchelf to fix ELF binaries
-rw-r--r-- | .SRCINFO | 16 | ||||
-rw-r--r-- | PKGBUILD | 36 |
2 files changed, 39 insertions, 13 deletions
@@ -1,18 +1,22 @@ pkgbase = swift-bin pkgdesc = Binary builds of the Swift programming language pkgver = 5.9.1 - pkgrel = 1 + pkgrel = 2 url = https://www.swift.org/ arch = x86_64 + arch = aarch64 license = apache - depends = libutil-linux + makedepends = patchelf + depends = util-linux-libs depends = libxml2 - depends = ncurses5-compat-libs - optdepends = python36: required for REPL + depends = ncurses + optdepends = python39: required for REPL provides = swift-language replaces = swift-language-bin options = !strip - source = https://download.swift.org/swift-5.9.1-release/centos7/swift-5.9.1-RELEASE/swift-5.9.1-RELEASE-centos7.tar.gz - sha256sums = 85f76d092e50794cafc45229d6534c02abb25f4f62f8d923c83b2e7c08a6eada + source_x86_64 = https://download.swift.org/swift-5.9.1-release/ubi9/swift-5.9.1-RELEASE/swift-5.9.1-RELEASE-ubi9.tar.gz + sha256sums_x86_64 = 283ac05130a3ecb4f251ef868dbc659ed301506add60d56f13bc98fb4c0d17ad + source_aarch64 = https://download.swift.org/swift-5.9.1-release/ubi9-aarch64/swift-5.9.1-RELEASE/swift-5.9.1-RELEASE-ubi9-aarch64.tar.gz + sha256sums_aarch64 = bc4cdd7fc703d36c41045a952dd31fb0aa915b81facabf2bff6f487ce0ca13de pkgname = swift-bin @@ -5,22 +5,37 @@ pkgname=swift-bin pkgver=5.9.1 -pkgrel=1 +pkgrel=2 pkgdesc="Binary builds of the Swift programming language" -arch=('x86_64') +arch=('x86_64' 'aarch64') url="https://www.swift.org/" license=('apache') -depends=('libutil-linux' 'libxml2' 'ncurses5-compat-libs') -optdepends=('python36: required for REPL') +depends=('util-linux-libs' 'libxml2' 'ncurses') +makedepends=('patchelf') +optdepends=('python39: required for REPL') options=('!strip') provides=('swift-language') replaces=('swift-language-bin') -source=("https://download.swift.org/swift-$pkgver-release/centos7/swift-$pkgver-RELEASE/swift-$pkgver-RELEASE-centos7.tar.gz") -sha256sums=('85f76d092e50794cafc45229d6534c02abb25f4f62f8d923c83b2e7c08a6eada') +source_x86_64=("https://download.swift.org/swift-$pkgver-release/ubi9/swift-$pkgver-RELEASE/swift-$pkgver-RELEASE-ubi9.tar.gz") +source_aarch64=("https://download.swift.org/swift-$pkgver-release/ubi9-aarch64/swift-$pkgver-RELEASE/swift-$pkgver-RELEASE-ubi9-aarch64.tar.gz") +sha256sums_x86_64=('283ac05130a3ecb4f251ef868dbc659ed301506add60d56f13bc98fb4c0d17ad') +sha256sums_aarch64=('bc4cdd7fc703d36c41045a952dd31fb0aa915b81facabf2bff6f487ce0ca13de') package() { + find_elf_only() { + find "${pkgdir}/usr/lib/swift" \ + -executable -type f \ + '(' -path '*/bin/*' -o -name '*.so*' ')' \ + -not '(' -name '*.py' -o -name 'hwasan_symbolize' ')' \ + "$@" + } + + _archsuffix="" + if [[ $CARCH == "aarch64" ]]; then + _archsuffix="-aarch64" + fi mkdir -p "${pkgdir}/usr/lib/swift" - cp -Ppr "${srcdir}/swift-$pkgver-RELEASE-centos7"/usr/* "${pkgdir}/usr/lib/swift" + cp -Ppr "${srcdir}/swift-$pkgver-RELEASE-ubi9${_archsuffix}"/usr/* "${pkgdir}/usr/lib/swift" # Symlink the desired binaries to /usr/bin mkdir -p "${pkgdir}/usr/bin" @@ -28,6 +43,13 @@ package() { ln -s "/usr/lib/swift/bin/$bin" "${pkgdir}/usr/bin/$bin" done + # Patch the binaries to use the changed ncurses names + patchelf=(patchelf) + for lib in ncurses panel form; do + patchelf+=(--replace-needed "lib${lib}.so.6" "lib${lib}w.so") + done + find_elf_only -exec "${patchelf[@]}" {} \; + install -dm755 "${pkgdir}/etc/ld.so.conf.d" echo '/usr/lib/swift/lib/swift/linux' >> "${pkgdir}/etc/ld.so.conf.d/swift.conf" } |