Skip to content

Commit 8935b89

Browse files
authored
Merge pull request #20824 from compnerd/static-foundation
build-script: build static version of Foundation
2 parents 68f7cf6 + 69e2018 commit 8935b89

File tree

1 file changed

+21
-4
lines changed

1 file changed

+21
-4
lines changed

utils/build-script-impl

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1180,6 +1180,7 @@ SWIFTSYNTAX_SOURCE_DIR="${WORKSPACE}/swift-syntax"
11801180
SKSTRESSTESTER_SOURCE_DIR="${WORKSPACE}/swift-stress-tester/SourceKitStressTester"
11811181
XCTEST_SOURCE_DIR="${WORKSPACE}/swift-corelibs-xctest"
11821182
FOUNDATION_SOURCE_DIR="${WORKSPACE}/swift-corelibs-foundation"
1183+
FOUNDATION_STATIC_SOURCE_DIR="${WORKSPACE}/swift-corelibs-foundation"
11831184
LIBDISPATCH_SOURCE_DIR="${WORKSPACE}/swift-corelibs-libdispatch"
11841185
LIBDISPATCH_STATIC_SOURCE_DIR="${WORKSPACE}/swift-corelibs-libdispatch"
11851186
LIBICU_SOURCE_DIR="${WORKSPACE}/icu"
@@ -1230,6 +1231,9 @@ if [[ ! "${SKIP_BUILD_LIBDISPATCH}" ]] ; then
12301231
fi
12311232
if [[ ! "${SKIP_BUILD_FOUNDATION}" ]] ; then
12321233
PRODUCTS=("${PRODUCTS[@]}" foundation)
1234+
if [[ -z "${SKIP_BUILD_STATIC_FOUNDATION}" ]] ; then
1235+
PRODUCTS=("${PRODUCTS[@]}" foundation_static)
1236+
fi
12331237
fi
12341238
if [[ ! "${SKIP_BUILD_LLBUILD}" ]] ; then
12351239
PRODUCTS=("${PRODUCTS[@]}" llbuild)
@@ -1571,7 +1575,7 @@ function build_directory_bin() {
15711575
xctest)
15721576
echo "${root}/${XCTEST_BUILD_TYPE}/bin"
15731577
;;
1574-
foundation)
1578+
foundation|foundation_static)
15751579
echo "${root}/${FOUNDATION_BUILD_TYPE}/bin"
15761580
;;
15771581
libdispatch|libdispatch_static)
@@ -1716,7 +1720,7 @@ function cmake_config_opt() {
17161720
xctest)
17171721
echo "--config ${XCTEST_BUILD_TYPE}"
17181722
;;
1719-
foundation)
1723+
foundation|foundation_static)
17201724
echo "--config ${FOUNDATION_BUILD_TYPE}"
17211725
;;
17221726
libdispatch|libdispatch_static)
@@ -2604,7 +2608,7 @@ for host in "${ALL_HOSTS[@]}"; do
26042608
esac
26052609

26062610
;;
2607-
foundation)
2611+
foundation|foundation_static)
26082612
# The configuration script requires knowing about XCTest's
26092613
# location for building and running the tests. Note that XCTest
26102614
# is not yet built at this point.
@@ -2625,8 +2629,12 @@ for host in "${ALL_HOSTS[@]}"; do
26252629
-DICU_INCLUDE_DIR:PATH=${ICU_ROOT}/include
26262630
-DICU_UC_LIBRARIES:FILEPATH=${ICU_LIBDIR}/libicuucswift.so
26272631
-DICU_UC_LIBRARY:FILEPATH=${ICU_LIBDIR}/libicuucswift.so
2632+
-DICU_UC_LIBRARY_DEBUG:FILEPATH=${ICU_LIBDIR}/libicuucswift.so
2633+
-DICU_UC_LIBRARY_RELEASE:FILEPATH=${ICU_LIBDIR}/libicuucswift.so
26282634
-DICU_I18N_LIBRARIES:FILEPATH=${ICU_LIBDIR}/libicui18nswift.so
26292635
-DICU_I18N_LIBRARY:FILEPATH=${ICU_LIBDIR}/libicui18nswift.so
2636+
-DICU_I18N_LIBRARY_DEBUG:FILEPATH=${ICU_LIBDIR}/libicui18nswift.so
2637+
-DICU_I18N_LIBRARY_RELEASE:FILEPATH=${ICU_LIBDIR}/libicui18nswift.so
26302638
)
26312639
else
26322640
LIBICU_BUILD_ARGS=()
@@ -2662,6 +2670,8 @@ for host in "${ALL_HOSTS[@]}"; do
26622670
# NOTE(compnerd) we disable tests because XCTest is not ready
26632671
# yet, but we will reconfigure when the time comes.
26642672
-DENABLE_TESTING:BOOL=NO
2673+
2674+
-DBUILD_SHARED_LIBS=$([[ ${product} == foundation_static ]] && echo "NO" || echo "YES")
26652675
)
26662676

26672677
;;
@@ -3225,8 +3235,12 @@ for host in "${ALL_HOSTS[@]}"; do
32253235
-DICU_INCLUDE_DIR:PATH=${ICU_ROOT}/include
32263236
-DICU_UC_LIBRARIES:FILEPATH=${ICU_LIBDIR}/libicuucswift.so
32273237
-DICU_UC_LIBRARY:FILEPATH=${ICU_LIBDIR}/libicuucswift.so
3238+
-DICU_UC_LIBRARY_DEBUG:FILEPATH=${ICU_LIBDIR}/libicuucswift.so
3239+
-DICU_UC_LIBRARY_RELEASE:FILEPATH=${ICU_LIBDIR}/libicuucswift.so
32283240
-DICU_I18N_LIBRARIES:FILEPATH=${ICU_LIBDIR}/libicui18nswift.so
32293241
-DICU_I18N_LIBRARY:FILEPATH=${ICU_LIBDIR}/libicui18nswift.so
3242+
-DICU_I18N_LIBRARY_DEBUG:FILEPATH=${ICU_LIBDIR}/libicui18nswift.so
3243+
-DICU_I18N_LIBRARY_RELEASE:FILEPATH=${ICU_LIBDIR}/libicui18nswift.so
32303244
)
32313245
else
32323246
LIBICU_BUILD_ARGS=()
@@ -3266,6 +3280,9 @@ for host in "${ALL_HOSTS[@]}"; do
32663280
results_targets=( "test" )
32673281
executable_target=("TestFoundation")
32683282
;;
3283+
foundation_static)
3284+
continue
3285+
;;
32693286
libdispatch)
32703287
if [[ "${SKIP_TEST_LIBDISPATCH}" ]]; then
32713288
continue
@@ -3518,7 +3535,7 @@ for host in "${ALL_HOSTS[@]}"; do
35183535
esac
35193536

35203537
;;
3521-
foundation)
3538+
foundation|foundation_static)
35223539
# FIXME: Foundation doesn't build from the script on OS X
35233540
if [[ ${host} == "macosx"* ]]; then
35243541
echo "Skipping Foundation on OS X -- use the Xcode project instead"

0 commit comments

Comments
 (0)