Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
#!/bin/sh
set -e
if [ -z "${CONFIGURATION}" ]; then
CONFIGURATION=debug
fi
# Create the development toolchain.
PLATFORM_KEY=linux-x86_64
PLATFORM_NAME=linux
DSO_SUFFIX=so
DSTROOT=$(echo ~/public/swift-project/build/Ninja-ReleaseAssert/swift-dev)
rm -rf "${DSTROOT}"
mkdir -p "${DSTROOT}/usr/bin"
# Install the `swift` provided binaries.
rsync -ar \
--link-dest ~/public/swift-project/build/Ninja-ReleaseAssert/swift-${PLATFORM_KEY}/bin/ \
~/public/swift-project/build/Ninja-ReleaseAssert/swift-${PLATFORM_KEY}/bin/swift \
~/public/swift-project/build/Ninja-ReleaseAssert/swift-${PLATFORM_KEY}/bin/swiftc \
~/public/swift-project/build/Ninja-ReleaseAssert/swift-${PLATFORM_KEY}/bin/swift-demangle \
"${DSTROOT}/usr/bin"
if [ "${PLATFORM_NAME}" != "macosx" ]; then
rsync -ar \
--link-dest ~/public/swift-project/build/Ninja-ReleaseAssert/swift-${PLATFORM_KEY}/bin/ \
~/public/swift-project/build/Ninja-ReleaseAssert/swift-${PLATFORM_KEY}/bin/swift-autolink-extract \
"${DSTROOT}/usr/bin"
fi
# Install the `swiftpm` provided binaries.
rsync -ar \
--link-dest ~/public/swift-project/build/Ninja-ReleaseAssert/swiftpm-${PLATFORM_KEY}/${CONFIGURATION}/ \
~/public/swift-project/build/Ninja-ReleaseAssert/swiftpm-${PLATFORM_KEY}/${CONFIGURATION}/swift-build \
~/public/swift-project/build/Ninja-ReleaseAssert/swiftpm-${PLATFORM_KEY}/${CONFIGURATION}/swift-package \
~/public/swift-project/build/Ninja-ReleaseAssert/swiftpm-${PLATFORM_KEY}/${CONFIGURATION}/swift-test \
"${DSTROOT}/usr/bin/"
# Install the `llbuild` provided binaries.
rsync -ar \
--link-dest ~/public/swift-project/build/Ninja-ReleaseAssert/llbuild-${PLATFORM_KEY}/bin/ \
~/public/swift-project/build/Ninja-ReleaseAssert/llbuild-${PLATFORM_KEY}/bin/swift-build-tool \
"${DSTROOT}/usr/bin/"
# Install fake versions of `lldb`.
for path in lldb lldb-3.9.0 lldb-argdumper lldb-server lldb-server-3.9.0 lldb-mi lldb-mi-3.9.0 repl_swift; do
rsync -ar $(which false) "${DSTROOT}/usr/bin/${path}"
done
# Install the `swiftpm` runtime libraries.
mkdir -p "${DSTROOT}/usr/lib/swift/pm/"
rsync -ar \
--link-dest ~/public/swift-project/build/Ninja-ReleaseAssert/swiftpm-${PLATFORM_KEY}/${CONFIGURATION}/ \
~/public/swift-project/build/Ninja-ReleaseAssert/swiftpm-${PLATFORM_KEY}/${CONFIGURATION}/libPackageDescription.${DSO_SUFFIX} \
~/public/swift-project/build/Ninja-ReleaseAssert/swiftpm-${PLATFORM_KEY}/${CONFIGURATION}/PackageDescription.swiftmodule \
"${DSTROOT}/usr/lib/swift/pm/"
# Install the `clang` runtime data.
if [ "${PLATFORM_NAME}" = "macosx" ]; then
rsync -ar \
--link-dest ~/public/swift-project/build/Ninja-ReleaseAssert/llvm-${PLATFORM_KEY}/lib/ \
~/public/swift-project/build/Ninja-ReleaseAssert/llvm-${PLATFORM_KEY}/lib/libclang.${DSO_SUFFIX} \
"${DSTROOT}/usr/lib/"
fi
# Install the standard libraries.
mkdir -p "${DSTROOT}/usr/lib/swift/${PLATFORM_NAME}/"
rsync -a \
--link-dest ~/public/swift-project/build/Ninja-ReleaseAssert/swift-${PLATFORM_KEY}/lib/swift/${PLATFORM_NAME}/ \
$(ls ~/public/swift-project/build/Ninja-ReleaseAssert/swift-${PLATFORM_KEY}/lib/swift/${PLATFORM_NAME}/*.${DSO_SUFFIX} | \
grep -v SwiftPrivate | \
grep -v StdlibUnittest | \
grep -v SwiftReflectionTest | \
grep -v SwiftExperimental) \
"${DSTROOT}/usr/lib/swift/${PLATFORM_NAME}/"
rsync -a \
--link-dest ~/public/swift-project/build/Ninja-ReleaseAssert/swift-${PLATFORM_KEY}/lib/swift/${PLATFORM_NAME}/ \
$(ls ~/public/swift-project/build/Ninja-ReleaseAssert/swift-${PLATFORM_KEY}/lib/swift/${PLATFORM_NAME}/x86_64/*.o | \
grep -v SwiftPrivate | \
grep -v StdlibUnittest | \
grep -v SwiftReflectionTest | \
grep -v SwiftExperimental) \
"${DSTROOT}/usr/lib/swift/${PLATFORM_NAME}/x86_64/"
rsync -a \
--link-dest ~/public/swift-project/build/Ninja-ReleaseAssert/swift-${PLATFORM_KEY}/lib/swift/${PLATFORM_NAME}/x86_64/ \
$(ls ~/public/swift-project/build/Ninja-ReleaseAssert/swift-${PLATFORM_KEY}/lib/swift/${PLATFORM_NAME}/x86_64/*.swiftdoc | \
grep -v SwiftPrivate | \
grep -v StdlibUnittest | \
grep -v SwiftReflectionTest | \
grep -v SwiftExperimental) \
"${DSTROOT}/usr/lib/swift/${PLATFORM_NAME}/x86_64/"
rsync -a \
--link-dest ~/public/swift-project/build/Ninja-ReleaseAssert/swift-${PLATFORM_KEY}/lib/swift/${PLATFORM_NAME}/x86_64/ \
$(ls ~/public/swift-project/build/Ninja-ReleaseAssert/swift-${PLATFORM_KEY}/lib/swift/${PLATFORM_NAME}/x86_64/*.swiftmodule | \
grep -v SwiftPrivate | \
grep -v StdlibUnittest | \
grep -v SwiftReflectionTest | \
grep -v SwiftExperimental) \
"${DSTROOT}/usr/lib/swift/${PLATFORM_NAME}/x86_64/"
if [ "${PLATFORM_NAME}" = "macosx" ]; then
rsync -a \
--link-dest ~/public/swift-project/build/Ninja-ReleaseAssert/swift-${PLATFORM_KEY}/lib/swift/${PLATFORM_NAME}/x86_64/ \
$(ls ~/public/swift-project/build/Ninja-ReleaseAssert/swift-${PLATFORM_KEY}/lib/swift/${PLATFORM_NAME}/x86_64/*.apinotesc | \
grep -v SwiftPrivate | \
grep -v StdlibUnittest | \
grep -v SwiftReflectionTest | \
grep -v SwiftExperimental) \
"${DSTROOT}/usr/lib/swift/${PLATFORM_NAME}/x86_64/"
fi
if [ "${PLATFORM_NAME}" = "macosx" ]; then
rsync -ar \
--link-dest ~/public/swift-project/build/Ninja-ReleaseAssert/swift-${PLATFORM_KEY}/lib/sourcekitd.framework/ \
~/public/swift-project/build/Ninja-ReleaseAssert/swift-${PLATFORM_KEY}/lib/sourcekitd.framework/ \
"${DSTROOT}/usr/lib/sourcekitd.framework/"
fi
if [ "${PLATFORM_NAME}" != "macosx" ]; then
rsync -a \
--link-dest ~/public/swift-project/build/Ninja-ReleaseAssert/swift-${PLATFORM_KEY}/lib/swift/${PLATFORM_NAME}/ \
~/public/swift-project/build/Ninja-ReleaseAssert/swift-${PLATFORM_KEY}/lib/swift/${PLATFORM_NAME}/x86_64/*.modulemap \
"${DSTROOT}/usr/lib/swift/${PLATFORM_NAME}/x86_64/"
rsync -ar \
--link-dest ~/public/swift-project/build/Ninja-ReleaseAssert/foundation-${PLATFORM_KEY}/Foundation/usr/ \
~/public/swift-project/build/Ninja-ReleaseAssert/foundation-${PLATFORM_KEY}/Foundation/usr/ \
"${DSTROOT}/usr/"
rsync -ar \
--link-dest ~/public/swift-project/build/Ninja-ReleaseAssert/foundation-${PLATFORM_KEY}/Foundation/ \
~/public/swift-project/build/Ninja-ReleaseAssert/foundation-${PLATFORM_KEY}/Foundation/libFoundation.so \
"${DSTROOT}/usr/lib/swift/${PLATFORM_NAME}/"
rsync -ar \
--link-dest ~/public/swift-project/build/Ninja-ReleaseAssert/foundation-${PLATFORM_KEY}/Foundation/ \
~/public/swift-project/build/Ninja-ReleaseAssert/foundation-${PLATFORM_KEY}/Foundation/Foundation.swiftdoc \
~/public/swift-project/build/Ninja-ReleaseAssert/foundation-${PLATFORM_KEY}/Foundation/Foundation.swiftmodule \
"${DSTROOT}/usr/lib/swift/${PLATFORM_NAME}/x86_64/"
rsync -ar \
--link-dest ~/public/swift-project/build/Ninja-ReleaseAssert/xctest-${PLATFORM_KEY}/ \
~/public/swift-project/build/Ninja-ReleaseAssert/xctest-${PLATFORM_KEY}/libXCTest.so \
"${DSTROOT}/usr/lib/swift/${PLATFORM_NAME}/"
rsync -ar \
--link-dest ~/public/swift-project/build/Ninja-ReleaseAssert/xctest-${PLATFORM_KEY}/ \
~/public/swift-project/build/Ninja-ReleaseAssert/xctest-${PLATFORM_KEY}/XCTest.swiftdoc \
~/public/swift-project/build/Ninja-ReleaseAssert/xctest-${PLATFORM_KEY}/XCTest.swiftmodule \
"${DSTROOT}/usr/lib/swift/${PLATFORM_NAME}/x86_64/"
fi
# Install the `clang` symlink.
rsync -ar \
~/public/swift-project/build/Ninja-ReleaseAssert/swift-${PLATFORM_KEY}/lib/swift/clang \
"${DSTROOT}/usr/lib/swift/clang"
rsync -ar \
--link-dest ~/public/swift-project/build/Ninja-ReleaseAssert/swift-${PLATFORM_KEY}/lib/swift/shims/ \
~/public/swift-project/build/Ninja-ReleaseAssert/swift-${PLATFORM_KEY}/lib/swift/shims/ \
"${DSTROOT}/usr/lib/swift/shims/"
# Install other runtime libraries.
#
# These are only built on Darwin by default, currently.
if [ "${PLATFORM_NAME}" = "macosx" ]; then
rsync -a \
--link-dest ~/public/swift-project/build/Ninja-ReleaseAssert/swift-${PLATFORM_KEY}/lib/ \
~/public/swift-project/build/Ninja-ReleaseAssert/swift-${PLATFORM_KEY}/lib/lib*Demangle.${DSO_SUFFIX} \
"${DSTROOT}/usr/lib/"
fi
# Copy over `swift-stdlib-tool`.
if [ "${PLATFORM_NAME}" = "macosx" ]; then
cp $(xcrun --find swift-stdlib-tool) \
"${DSTROOT}/usr/bin/"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.