Skip to content

Commit

Permalink
Merge pull request swiftlang#102 from udp/freebsd
Browse files Browse the repository at this point in the history
FreeBSD build support.

This unblocks work on a FreeBSD port.
  • Loading branch information
tkremenek committed Dec 3, 2015
2 parents 61cc0d8 + 440a052 commit 511c436
Show file tree
Hide file tree
Showing 15 changed files with 58 additions and 16 deletions.
2 changes: 1 addition & 1 deletion test/1_stdlib/timeout.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash

# timeout.sh <seconds> <command...>

Expand Down
2 changes: 1 addition & 1 deletion utils/benchmark/build.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash

if [[ -n "$LLVM_DIR" ]]; then
BUILD_DIR="$LLVM_DIR/build"
Expand Down
2 changes: 1 addition & 1 deletion utils/build-script
Original file line number Diff line number Diff line change
@@ -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
Expand Down
46 changes: 44 additions & 2 deletions utils/build-script-impl
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -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-*)
Expand Down Expand Up @@ -741,6 +745,12 @@ case "$(uname -s)" in
)
;;

FreeBSD)
NATIVE_TOOLS_DEPLOYMENT_TARGETS=(
"freebsd-x86_64"
)
;;

*)
echo "Unknown operating system"
exit 1
Expand Down Expand Up @@ -812,6 +822,12 @@ case "$(uname -s)" in
)
;;

FreeBSD)
STDLIB_DEPLOYMENT_TARGETS=(
"freebsd-x86_64"
)
;;

*)
echo "Unknown operating system"
exit 1
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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=(
Expand Down Expand Up @@ -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-*)
Expand Down Expand Up @@ -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}
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion utils/darwin-installer-scripts/postinstall
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion utils/omit-needless-words.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion utils/pygments/swift.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/env python

import re

Expand Down
2 changes: 1 addition & 1 deletion utils/recursive-lipo
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/env python

import argparse
import os.path
Expand Down
2 changes: 1 addition & 1 deletion utils/resolve-crashes.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion utils/sil-opt-verify-all-modules.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/env python
#===------------------------------------------------------------------------===#
#
# This source file is part of the Swift.org open source project
Expand Down
2 changes: 1 addition & 1 deletion utils/swift-stdlib-tool-substitute
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash

#===--- swift-stdlib-tool - stand-in for the real swift-stdlib-tool --------===#
#
Expand Down
2 changes: 1 addition & 1 deletion utils/toolchain-codesign
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion utils/toolchain-installer
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion utils/update-checkout
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion validation-test/SIL/Inputs/gen_parse_stdlib_tests.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash

process_count=17
process_id_max=$(($process_count - 1))
Expand Down

0 comments on commit 511c436

Please sign in to comment.