Skip to content

Instantly share code, notes, and snippets.

@joscdk

joscdk/PKGBUILD Secret

Created June 30, 2021 07:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save joscdk/dc817a45b05756b86a7c92e7a837ff5a to your computer and use it in GitHub Desktop.
Save joscdk/dc817a45b05756b86a7c92e7a837ff5a to your computer and use it in GitHub Desktop.
# Maintainer: Ryan Gonzalez <rymg19 at gmail dot com>
# Contributor: Frederic Bezies <fredbezies at gmail dot com>, youngunix <>
pkgname=swift-bin
pkgver=5.4.2
pkgrel=1
pkgdesc="Binary builds of the Swift programming language"
arch=('x86_64')
url="https://swift.org"
license=('apache')
depends=('libutil-linux' 'libxml2' 'python36')
makedepends=('patchelf' 'rpmextract')
options=('!strip')
provides=('swift-language')
replaces=('swift-language-bin')
source=("https://swift.org/builds/swift-$pkgver-release/centos8/swift-$pkgver-RELEASE/swift-$pkgver-RELEASE-centos8.tar.gz")
sha256sums=('48997efc0d3b5a87082609b2d2bab21e421e711427386def6b6e761e5491167f')
package() {
find_elf_only() {
find "${pkgdir}/usr/lib/swift" \
-executable -type f \
'(' -path '*/bin/*' -o -name '*.so*' ')' \
-not -name '*.py' \
"$@"
}
mkdir -p "${pkgdir}/usr/lib/swift"
cp -Ppr "${srcdir}/swift-$pkgver-RELEASE-centos8"/usr/* "${pkgdir}/usr/lib/swift"
# Symlink the desired binaries to /usr/bin
mkdir -p "${pkgdir}/usr/bin"
for bin in sourcekit-lsp swift swiftc; do
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"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment