[swift-dev] Build and install custom toolchain?

Mish Awadah mawadah at apple.com
Wed Dec 9 18:18:23 CST 2015


Hi Kevin,

Here’s what I’ve done in the past to build a toolchain using the build script. 

function build_osx_package() {

    YEAR=$(date +"%Y")
    MONTH=$(date +"%m")
    DAY=$(date +"%d")
    TOOLCHAIN_VERSION="swift-SNAPSHOT-${YEAR}-${MONTH}-${DAY}-a"
    ARCHIVE_DIR="${TOOLCHAIN_VERSION}-${BUILD_NUMBER}"
    ARCHIVE="${TOOLCHAIN_VERSION}-osx.tar.gz"
    SYM_ARCHIVE="${TOOLCHAIN_VERSION}-osx-symbols.tar.gz"
    BUNDLE_IDENTIFIER="org.swift.${YEAR}${MONTH}${DAY}"
    DISPLAY_NAME="Swift Development Snapshot"
    TOOLCHAIN_NAME="${TOOLCHAIN_VERSION}"

    SWIFT_SOURCE_ROOT="${SRC_DIR}"
    SWIFT_BUILD_ROOT="${SRC_DIR}/build"
    SWIFT_INSTALLABLE_PACKAGE="${SRC_DIR}/${ARCHIVE}"
    SWIFT_INSTALL_DIR="${SRC_DIR}/swift-nightly-install"
    SWIFT_INSTALL_SYMROOT="${SRC_DIR}/swift-nightly-symroot"
    SWIFT_TOOLCHAIN_DIR="/Applications/Xcode.app/Contents/Developer/Toolchains/${TOOLCHAIN_NAME}.xctoolchain"
    SYMBOLS_PACKAGE="${SRC_DIR}/${SYM_ARCHIVE}"

    ./swift/utils/build-script --preset="buildbot_osx_package" install_destdir="${SWIFT_INSTALL_DIR}" installable_package="${SWIFT_INSTALLABLE_PACKAGE}" install_toolchain_dir="${SWIFT_TOOLCHAIN_DIR}" install_symroot="${SWIFT_INSTALL_SYMROOT}" symbols_package="${SYMBOLS_PACKAGE}" darwin_toolchain_bundle_identifier="${BUNDLE_IDENTIFIER}" darwin_toolchain_display_name="${DISPLAY_NAME}" darwin_toolchain_xctoolchain_name="${TOOLCHAIN_NAME}" darwin_toolchain_version="${TOOLCHAIN_VERSION}"
}

HTH,
- mish

> On Dec 9, 2015, at 2:32 PM, Kevin Ballard via swift-dev <swift-dev at swift.org> wrote:
> 
> Is there an easy way to build and install my own toolchain into /Library/Developer/Toolchains? I assume there must be some automated way to construct the package installer, but nothing immediately leaps out at me. It looks like build-script can create a root, but that seems to be for BNI, which isn't helpful.
> 
> The reason for doing this here is I have a Vim plugin that lets me execute Swift scripts from vim buffers, and it supports using the swift from any given Xcode. I want to teach it how to find swift in /Library/Developer/Toolchains instead, which requires that I actually install a toolchain there (teaching it how to use the build folder from my swift checkout is doable, but that's not very portable).
> 
> -Kevin Ballard
> _______________________________________________
> swift-dev mailing list
> swift-dev at swift.org
> https://lists.swift.org/mailman/listinfo/swift-dev



More information about the swift-dev mailing list