diff --git a/test/1_stdlib/timeout.sh b/test/1_stdlib/timeout.sh index 1d1bfe490666d..b0a8f5049bca1 100755 --- a/test/1_stdlib/timeout.sh +++ b/test/1_stdlib/timeout.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash # timeout.sh diff --git a/utils/benchmark/build.sh b/utils/benchmark/build.sh index e857ac22ebcbf..809c9b29c2a27 100755 --- a/utils/benchmark/build.sh +++ b/utils/benchmark/build.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash if [[ -n "$LLVM_DIR" ]]; then BUILD_DIR="$LLVM_DIR/build" diff --git a/utils/build-script b/utils/build-script index d75e2ef04a2d4..44f2553b0fefb 100755 --- a/utils/build-script +++ b/utils/build-script @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/env python #===--- build-script - The ultimate tool for building Swift ----------------===# # ## This source file is part of the Swift.org open source project diff --git a/utils/build-script-impl b/utils/build-script-impl index e7267835034fe..420b82677f76f 100755 --- a/utils/build-script-impl +++ b/utils/build-script-impl @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash #===--- build-script-impl - Implementation details of build-script ---------===# # ## This source file is part of the Swift.org open source project @@ -171,6 +171,7 @@ KNOWN_SETTINGS=( sil-verify-all "0" "If enabled, run the sil verifier be run after every SIL pass" swift-enable-ast-verifier "1" "If enabled, and the assertions are enabled, the built Swift compiler will run the AST verifier every time it is invoked" swift-enable-target-linux "1" "Enable compiler support for targeting Linux" + swift-enable-target-freebsd "1" "Enable compiler support for targeting FreeBSD" swift-runtime-enable-dtrace "0" "Enable runtime dtrace support" swift-runtime-enable-leak-checker "0" "Enable leaks checking routines in the runtime" use-gold-linker "" "Enable using the gold linker" @@ -218,6 +219,9 @@ function set_deployment_target_based_options() { linux-x86_64) SWIFT_HOST_VARIANT_ARCH="x86_64" ;; + freebsd-x86_64) + SWIFT_HOST_VARIANT_ARCH="x86_64" + ;; macosx-* | iphoneos-* | iphonesimulator-* | \ appletvos-* | appletvsimulator-* | \ watchos-* | watchsimulator-*) @@ -741,6 +745,12 @@ case "$(uname -s)" in ) ;; + FreeBSD) + NATIVE_TOOLS_DEPLOYMENT_TARGETS=( + "freebsd-x86_64" + ) + ;; + *) echo "Unknown operating system" exit 1 @@ -812,6 +822,12 @@ case "$(uname -s)" in ) ;; + FreeBSD) + STDLIB_DEPLOYMENT_TARGETS=( + "freebsd-x86_64" + ) + ;; + *) echo "Unknown operating system" exit 1 @@ -898,6 +914,10 @@ for deployment_target in "${STDLIB_DEPLOYMENT_TARGETS[@]}"; do build_for_this_target=1 test_this_target=1 ;; + freebsd-*) + build_for_this_target=1 + test_this_target=1 + ;; macosx-*) build_for_this_target=$(not $SKIP_BUILD_OSX) test_this_target=$(not $SKIP_TEST_OSX) @@ -1644,6 +1664,23 @@ for deployment_target in "${NATIVE_TOOLS_DEPLOYMENT_TARGETS[@]}" "${CROSS_TOOLS_ "${LLDB_SOURCE_DIR}" ) ;; + FreeBSD) + cmake_options=( + "${cmake_options[@]}" + -DCMAKE_BUILD_TYPE:STRING="${LLDB_BUILD_TYPE}" + -DCMAKE_INSTALL_PREFIX:PATH="${INSTALL_PREFIX}" + -DLLDB_PATH_TO_LLVM_SOURCE:PATH="${LLVM_SOURCE_DIR}" + -DLLDB_PATH_TO_CLANG_SOURCE:PATH="${CLANG_SOURCE_DIR}" + -DLLDB_PATH_TO_SWIFT_SOURCE:PATH="${SWIFT_SOURCE_DIR}" + -DLLDB_PATH_TO_LLVM_BUILD:PATH="${llvm_build_dir}" + -DLLDB_PATH_TO_CLANG_BUILD:PATH="${llvm_build_dir}" + -DLLDB_PATH_TO_SWIFT_BUILD:PATH="${swift_build_dir}" + -DLLDB_PATH_TO_CMARK_BUILD:PATH="${cmark_build_dir}" + -DLLDB_IS_BUILDBOT_BUILD="${LLDB_IS_BUILDBOT_BUILD}" + -DLLDB_BUILD_DATE:STRING="\"${LLDB_BUILD_DATE}\"" + "${LLDB_SOURCE_DIR}" + ) + ;; Darwin) # Set up flags to pass to xcodebuild lldb_xcodebuild_options=( @@ -1796,7 +1833,7 @@ tests_busted () for deployment_target in "${STDLIB_DEPLOYMENT_TARGETS[@]}"; do case $deployment_target in - linux-* | macosx-*) + linux-* | freebsd-* | macosx-*) # OK, we can run tests directly. ;; iphoneos-* | iphonesimulator-* | appletvos-* | appletvsimulator-* | watchos-* | watchsimulator-*) @@ -1990,6 +2027,8 @@ for deployment_target in "${NATIVE_TOOLS_DEPLOYMENT_TARGETS[@]}" "${CROSS_TOOLS_ case "$(uname -s)" in Linux) ;; + FreeBSD) + ;; Darwin) set_lldb_build_mode pushd ${LLDB_SOURCE_DIR} @@ -2026,6 +2065,9 @@ for deployment_target in "${NATIVE_TOOLS_DEPLOYMENT_TARGETS[@]}" "${CROSS_TOOLS_ continue fi LIB_TARGET="linux" + if [[ `uname -s` == "FreeBSD" ]]; then + LIB_TARGET="freebsd" + fi if [[ `uname -s` == "Darwin" ]]; then LIB_TARGET="macosx" fi diff --git a/utils/darwin-installer-scripts/postinstall b/utils/darwin-installer-scripts/postinstall index af8d2cc73b63e..273073c826dd9 100755 --- a/utils/darwin-installer-scripts/postinstall +++ b/utils/darwin-installer-scripts/postinstall @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash #===--- postinstall - Creates symlink after installing xctoolchain ----------===# # ## This source file is part of the Swift.org open source project diff --git a/utils/omit-needless-words.py b/utils/omit-needless-words.py index c6a38e7077942..4a6f0f13d6b5a 100755 --- a/utils/omit-needless-words.py +++ b/utils/omit-needless-words.py @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/env python # This tool helps assess the impact of automatically applying # heuristics that omit 'needless' words from APIs imported from Clang diff --git a/utils/pygments/swift.py b/utils/pygments/swift.py index 93bf7aca33cf2..b626e53f22daa 100644 --- a/utils/pygments/swift.py +++ b/utils/pygments/swift.py @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/env python import re diff --git a/utils/recursive-lipo b/utils/recursive-lipo index 7d1c84840e846..e2a4a3cac3a9d 100755 --- a/utils/recursive-lipo +++ b/utils/recursive-lipo @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/env python import argparse import os.path diff --git a/utils/resolve-crashes.py b/utils/resolve-crashes.py index 34c33da3b2022..c6c7434659a52 100755 --- a/utils/resolve-crashes.py +++ b/utils/resolve-crashes.py @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/env python # A small utility to take the output of a Swift validation test run # where some compiler crashers have been fixed, and move them into the diff --git a/utils/sil-opt-verify-all-modules.py b/utils/sil-opt-verify-all-modules.py index 6588f198e8b8f..0bc6f9fed7400 100755 --- a/utils/sil-opt-verify-all-modules.py +++ b/utils/sil-opt-verify-all-modules.py @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/env python #===------------------------------------------------------------------------===# # # This source file is part of the Swift.org open source project diff --git a/utils/swift-stdlib-tool-substitute b/utils/swift-stdlib-tool-substitute index 7e6ed10acb582..bee61afc9b806 100755 --- a/utils/swift-stdlib-tool-substitute +++ b/utils/swift-stdlib-tool-substitute @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash #===--- swift-stdlib-tool - stand-in for the real swift-stdlib-tool --------===# # diff --git a/utils/toolchain-codesign b/utils/toolchain-codesign index 81c7b364d2689..2d8ba94ee246a 100755 --- a/utils/toolchain-codesign +++ b/utils/toolchain-codesign @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash #===--- toolchain-codesign - Creates code signed xctoolchain ---------------===# # ## This source file is part of the Swift.org open source project diff --git a/utils/toolchain-installer b/utils/toolchain-installer index 61f7a4fe294c5..f3e3902383df0 100755 --- a/utils/toolchain-installer +++ b/utils/toolchain-installer @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash #===--- toolchain-installer - Creates installer pkg for OS X ---------------===# # ## This source file is part of the Swift.org open source project diff --git a/utils/update-checkout b/utils/update-checkout index 3dd11af9a027e..94d952340607a 100755 --- a/utils/update-checkout +++ b/utils/update-checkout @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/env python #===--- update-checkout - Utility to update your local checkouts -----------===# # # This source file is part of the Swift.org open source project diff --git a/validation-test/SIL/Inputs/gen_parse_stdlib_tests.sh b/validation-test/SIL/Inputs/gen_parse_stdlib_tests.sh index 873abafe8f4d7..82665057976ec 100755 --- a/validation-test/SIL/Inputs/gen_parse_stdlib_tests.sh +++ b/validation-test/SIL/Inputs/gen_parse_stdlib_tests.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash process_count=17 process_id_max=$(($process_count - 1))