summarylogtreecommitdiffstats
path: root/PKGBUILD
diff options
context:
space:
mode:
authorRyan Gonzalez2019-03-02 12:56:32 -0600
committerRyan Gonzalez2019-03-02 12:56:32 -0600
commit342913398bdbe38321e0f978e6bc0a5641664cc1 (patch)
treebb30e5a7b5cf3c712cdf567e7dc6ae021a161e17 /PKGBUILD
parente2dc17aa5b89eefa9711a65aee9e310b3a3abbcc (diff)
downloadaur-342913398bdbe38321e0f978e6bc0a5641664cc1.tar.gz
Avoid polluting the ldconfig path
Diffstat (limited to 'PKGBUILD')
-rw-r--r--PKGBUILD48
1 files changed, 28 insertions, 20 deletions
diff --git a/PKGBUILD b/PKGBUILD
index 6de5f70bb2fd..7486cb42d2e1 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -4,12 +4,12 @@
_version=4.2.1
pkgname=swift-bin
pkgver=${_version//-/.}
-pkgrel=1
+pkgrel=2
pkgdesc="Official binary builds of the Swift programming language."
arch=('x86_64')
url="https://swift.org"
license=('apache')
-depends=('clang' 'icu' 'libbsd' 'libutil-linux' 'libxml2' 'python2')
+depends=('clang' 'icu62' 'libbsd' 'libutil-linux' 'libxml2' 'python2')
makedepends=('patchelf' 'rpmextract')
conflicts=('swift-language-git')
options=('!strip')
@@ -25,43 +25,51 @@ sha256sums=('9df46cd5601b4318496cfd79056def9af44b706269776f74cc0778fd03842a49'
package() {
cp -Ppr "${srcdir}"/{etc,usr} "${pkgdir}"
+ # Okay, so some hackery that you'll see soon needs to be explained a bit:
+ # These Swift binaries want libncurses.so.6 and family, but Arch provides them under
+ # libncursesw.so. An original copy of this package just symlinked the names, but then
+ # ldconfig picked them up, which lead to the wrong paths being placed into the initramfs...
+ # leaving an unbootable system.
+
+ # Ideally we'd be able to use patchelf --replace-needed, but that's not possible due to a glibc
+ # bug that cuases ldconfig to misread the SONAME and generate screwy symlinks:
+ # https://sourceware.org/bugzilla/show_bug.cgi?id=24294
+
+ # Therefore, instead we need to follow this process:
+ # - Replace /usr/lib/swift/linux from ld.so.conf.d with /usr/lib/swift/linux/export.
+ # - Symlink all the libraries in /usr/lib/swift/linux to /usr/lib/swift/linux/export.
+ # - Create the .so.6 symlinks in /usr/lib/swift/linux.
+
# Merge ld.so.conf.d files from the two packages
cat "${pkgdir}/etc/ld.so.conf.d/swift-lang-runtime.conf" >> \
"${pkgdir}/etc/ld.so.conf.d/swift-lang.conf"
rm "${pkgdir}/etc/ld.so.conf.d/swift-lang-runtime.conf"
+ sed -i 's|swift/linux|swift/linux/export|' "${pkgdir}/etc/ld.so.conf.d/swift-lang.conf"
- # Create the needed aliases for libncurses and libicu
- for lib in libncurses libpanel libform; do
- ln -s ../../${lib}w.so "${pkgdir}/usr/lib/swift/linux/${lib}.so.6"
+ # Create the exported so symlinks
+ mkdir -p "${pkgdir}/usr/lib/swift/linux/export"
+ for path in "${pkgdir}/usr/lib/swift/linux/"*.so; do
+ ln -s ../$(basename "$path") "${pkgdir}/usr/lib/swift/linux/export"
done
- for lib in libicudata libicui18n libicuuc; do
- ln -s ../../${lib}.so "${pkgdir}/usr/lib/swift/linux/${lib}.so.62"
+ # Create the needed aliases for libncurses
+ for lib in ncurses panel form; do
+ ln -s ../../lib${lib}w.so "${pkgdir}/usr/lib/swift/linux/lib${lib}.so.6"
done
# Merge libexec and lib
- # XXX: can't drop yet, moving it from libexec completely kills the REPL for some reason
+ # XXX: can't do this yet, moving it from libexec completely kills the REPL for some reason
# find "${pkgdir}" -executable -type f -exec sed -i 's|/usr/libexec|/////usr/lib|g' {} \;
# mv "${pkgdir}/usr/"{libexec/swift-lldb/*,lib/swift-lldb}
# rmdir "${pkgdir}/usr/libexec/swift-lldb"
# rmdir "${pkgdir}/usr/libexec"
# Make sure swift-lldb files pick up the symlinks from above
- find "${pkgdir}/usr/lib/swift-lldb" -executable -type f -exec \
- patchelf --set-rpath '/usr/lib/swift/linux' {} \;
- # XXX: remove once libexec is dropped
- find "${pkgdir}/usr/libexec/swift-lldb" -executable -type f -exec \
+ # XXX: remove libexec once it is dropped
+ find "${pkgdir}/usr/"{lib,libexec}/swift-lldb -executable -type f -exec \
patchelf --set-rpath '/usr/lib/swift/linux' {} \;
patchelf --set-rpath '/usr/lib/swift/linux' "${pkgdir}/usr/bin/swift-build-tool"
- # Patch the libicu _62 symbols to _63
- for path in "${pkgdir}/usr/lib/swift/linux/"{libswiftCore,libFoundation}.so; do
- sed -i 's/\([Uu][A-Za-z0-9_]*\)_62/\1_63/g' "$path"
- done
-
- # Symlink sourcekit
- ln -s swift-lldb/libsourcekitdInProc.so "${pkgdir}/usr/lib/libsourcekitdInProc.so"
-
# Rename the LICENSE file directory
mv "${pkgdir}/usr/share/licenses/swift-"{lang,bin}