summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorRyan Gonzalez2018-03-14 15:09:02 -0500
committerRyan Gonzalez2018-03-14 15:09:02 -0500
commit0fa1569e218cb0c5e8a1bd48367bd33af1ad27eb (patch)
tree6d2d99cee6cb2b8de5562a7e9716cf8410f245a4
parent0552fe45b8b0b0bd7e090a1fd327e9e171f8b272 (diff)
downloadaur-0fa1569e218cb0c5e8a1bd48367bd33af1ad27eb.tar.gz
Install SDK to a subdirectory, to avoid needing to use bubblewrap
-rw-r--r--.SRCINFO5
-rw-r--r--PKGBUILD61
2 files changed, 32 insertions, 34 deletions
diff --git a/.SRCINFO b/.SRCINFO
index 09029c2e319d..62f37777502f 100644
--- a/.SRCINFO
+++ b/.SRCINFO
@@ -1,11 +1,11 @@
pkgbase = swift-bin
pkgdesc = Official binary builds of the Swift programming language.
pkgver = 4.0.3
- pkgrel = 4
+ pkgrel = 5
url = https://swift.org
arch = x86_64
license = apache
- makedepends = qldv-git
+ makedepends = qldv
depends = icu55
depends = ncurses5-compat-libs
depends = libedit
@@ -17,7 +17,6 @@ pkgbase = swift-bin
depends = libxml2
depends = libcurl-compat
depends = patchelf
- depends = bubblewrap
provides = swift-language
provides = lldb
conflicts = lldb
diff --git a/PKGBUILD b/PKGBUILD
index 75706c423d13..4a5fcdcb1777 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -4,13 +4,13 @@
_version=4.0.3
pkgname=swift-bin
pkgver=${_version//-/.}
-pkgrel=4
+pkgrel=5
pkgdesc="Official binary builds of the Swift programming language."
arch=('x86_64')
url="https://swift.org"
license=('apache')
-depends=('icu55' 'ncurses5-compat-libs' 'libedit' 'python2' 'libutil-linux' 'libbsd' 'clang' 'python2-six' 'libxml2' 'libcurl-compat' 'patchelf' 'bubblewrap')
-makedepends=('qldv-git')
+depends=('icu55' 'ncurses5-compat-libs' 'libedit' 'python2' 'libutil-linux' 'libbsd' 'clang' 'python2-six' 'libxml2' 'libcurl-compat' 'patchelf')
+makedepends=('qldv')
conflicts=('lldb' 'swift-language-git')
options=('!strip')
validpgpkeys=('5E4DF843FB065D7F7E24FBA2EF5430F071E1B235')
@@ -24,50 +24,49 @@ sha256sums=('9adf64cabc7c02ea2d08f150b449b05e46bd42d6e542bf742b3674f5c37f0dbf'
'SKIP')
package() {
- tar -C "$pkgdir" -xf "swift-${_version}-RELEASE"*.tar.gz --strip 1
- mkdir -p "${pkgdir}/usr/lib/swift/arch"
+ target="${pkgdir}/usr/lib/swift"
+ mkdir -p "${target}"
+
+ # Copy extracted files
+ cp -Ppr "${srcdir}/swift-${_version}-RELEASE"*/usr/* "$target"
+ rm -rf "${target}/local"
# Permission fix
find "${pkgdir}" -type d -exec chmod 755 {} +
- # Remove all unnecessary stuff
- rm -rf "${pkgdir}/usr/local"
+ # Symlink binaries
+ mkdir -p "${pkgdir}/usr/bin"
+ for file in "${target}/bin/"*; do
+ ln -s ../lib/swift/bin/"`basename "$file"`" "${pkgdir}/usr/bin"
+ done
# Yuck! patching libedit and libcurl SONAMEs
- find "${pkgdir}/usr/bin" -type f -exec sed -i 's/libedit\.so\.2/libedit\.so\.0/g' {} \;
- find "${pkgdir}/usr/lib" -type f -exec sed -i 's/libedit\.so\.2/libedit\.so\.0/g' {} \;
- sed -i 's/libcurl\.so\.4/libcurl\.so\.3/g' "${pkgdir}/usr/lib/swift/linux/libFoundation.so"
+ find "${target}/bin" -type f -exec sed -i 's/libedit\.so\.2/libedit\.so\.0/g' {} \;
+ find "${target}/lib" -type f -exec sed -i 's/libedit\.so\.2/libedit\.so\.0/g' {} \;
+ sed -i 's/libcurl\.so\.4/libcurl\.so\.3/g' "${target}/lib/swift/linux/libFoundation.so"
# Patch the ld interpreter to avoid version warnings
- qldv "`qldv -find`" "${pkgdir}/usr/lib/swift/arch/ld.so"
- find "${pkgdir}/usr/bin" -type f -exec patchelf --set-interpreter '/usr/lib/swift/arch/ld.so' {} \;
-
- # Hack to ensure Swift runs patchelf on output files to fix the libcurl version warnings
- ln -sf "../../../bin/swift" "${pkgdir}/usr/lib/swift/arch/swiftc"
- rm "${pkgdir}/usr/bin/swiftc"
- echo '#!/bin/bash' > "${pkgdir}/usr/bin/swiftc"
- # bwrap is used to alias the original Clang as cc, then replace Clang with a wrapper script.
- echo 'bwrap --dev-bind / / --bind /usr/bin/clang /usr/bin/cc --bind /usr/lib/swift/arch/clang++ /usr/bin/clang++ /usr/lib/swift/arch/swiftc "$@"' >> "${pkgdir}/usr/bin/swiftc"
-
- echo '#!/bin/bash' > "${pkgdir}/usr/lib/swift/arch/clang++"
- echo '( exec -a clang++ cc "$@" ) && patchelf --set-interpreter /usr/lib/swift/arch/ld.so "${@: -1}"' >> "${pkgdir}/usr/lib/swift/arch/clang++"
+ qldv "`qldv -find`" "${target}/lib/ld.so"
+ find "${target}/bin" -type f -exec patchelf --set-interpreter '/usr/lib/swift/lib/ld.so' {} \;
- chmod +x "${pkgdir}/usr/bin/swiftc" "${pkgdir}/usr/lib/swift/arch/clang++"
+ # Hack to override Clang and ensure Swift runs patchelf on output files to fix the libcurl version warnings
+ echo '#!/bin/bash' > "${target}/bin/clang++"
+ echo '/usr/bin/clang++ "$@" && patchelf --set-interpreter /usr/lib/swift/lib/ld.so "${@: -1}"' >> "${target}/bin/clang++"
# Patch the module files
- sed -i 's|x86_64-linux-gnu/||' "${pkgdir}/usr/lib/swift/linux/x86_64/glibc.modulemap"
- sed -i 's|x86_64-linux-gnu/||' "${pkgdir}/usr/lib/swift_static/linux/static-stdlib-args.lnk"
+ sed -i 's|x86_64-linux-gnu/||' "${target}/lib/swift/linux/x86_64/glibc.modulemap"
+ sed -i 's|x86_64-linux-gnu/||' "${target}/lib/swift_static/linux/static-stdlib-args.lnk"
# Remove the six.py dumped in python's site packages
- rm "${pkgdir}/usr/lib/python2.7/site-packages/six.py"
- rm "${pkgdir}/usr/lib/python2.7/site-packages/six.pyc"
+ rm "${target}/lib/python2.7/site-packages/six.py"
+ rm "${target}/lib/python2.7/site-packages/six.pyc"
# Ensure the items have the right permissions..
# some tarballs from upstream seem to have the wrong ones
- find "${pkgdir}/usr/bin" -type f -exec chmod a+rx {} \;
- find "${pkgdir}/usr/lib" -type f -exec chmod a+r {} \;
+ find "${target}/bin" -type f -exec chmod a+rx {} \;
+ find "${target}/lib" -type f -exec chmod a+r {} \;
# Move license
- install -dm755 ${pkgdir}/usr/share/licenses/${pkgname}
- mv ${pkgdir}/usr/share/swift/LICENSE.txt ${pkgdir}/usr/share/licenses/${pkgname}
+ install -dm755 ${target}/share/licenses/${pkgname}
+ mv ${target}/share/swift/LICENSE.txt ${target}/share/licenses/${pkgname}
}