Skip to content

Commit 2ce4b57

Browse files
committed
Merge pull request #106 from linux-on-ibm-z/core-foundation-prefix
Add an option to specify the install prefix for CoreFoundation depend…
2 parents 206f746 + 36b2ef3 commit 2ce4b57

File tree

1 file changed

+20
-5
lines changed

1 file changed

+20
-5
lines changed

build_script.py

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ def build(args):
114114
build_dir = os.path.abspath(args.build_dir)
115115
foundation_build_dir = os.path.abspath(args.foundation_build_dir)
116116
core_foundation_build_dir = GenericUnixStrategy.core_foundation_build_dir(
117-
foundation_build_dir)
117+
foundation_build_dir, args.foundation_install_prefix)
118118
if args.libdispatch_build_dir:
119119
libdispatch_build_dir = os.path.abspath(args.libdispatch_build_dir)
120120
if args.libdispatch_src_dir:
@@ -201,7 +201,7 @@ def test(args):
201201
tests_path = os.path.join(SOURCE_DIR, "Tests", "Functional")
202202
foundation_build_dir = os.path.abspath(args.foundation_build_dir)
203203
core_foundation_build_dir = GenericUnixStrategy.core_foundation_build_dir(
204-
foundation_build_dir)
204+
foundation_build_dir, args.foundation_install_prefix)
205205

206206
run('SWIFT_EXEC={swiftc} '
207207
'BUILT_PRODUCTS_DIR={built_products_dir} '
@@ -246,7 +246,7 @@ def install(args):
246246
os.path.join(module_install_path, xctest_swiftdoc)))
247247

248248
@staticmethod
249-
def core_foundation_build_dir(foundation_build_dir):
249+
def core_foundation_build_dir(foundation_build_dir, foundation_install_prefix):
250250
"""
251251
Given the path to a swift-corelibs-foundation built product directory,
252252
return the path to CoreFoundation built products.
@@ -257,7 +257,8 @@ def core_foundation_build_dir(foundation_build_dir):
257257
include this extra path when linking the installed Swift's
258258
'usr/lib/swift/linux/libFoundation.so'.
259259
"""
260-
return os.path.join(foundation_build_dir, 'usr', 'lib', 'swift')
260+
return os.path.join(foundation_build_dir,
261+
foundation_install_prefix.strip("/"), 'lib', 'swift')
261262

262263

263264
def main(args=sys.argv[1:]):
@@ -320,13 +321,20 @@ def main(args=sys.argv[1:]):
320321
build_parser.add_argument(
321322
"--build-dir",
322323
help="Path to the output build directory. If not specified, a "
323-
"temporary directory is used",
324+
"temporary directory is used.",
324325
default=tempfile.mkdtemp())
325326
build_parser.add_argument(
326327
"--foundation-build-dir",
327328
help="Path to swift-corelibs-foundation build products, which "
328329
"the built XCTest.so will be linked against.",
329330
required=strategy.requires_foundation_build_dir())
331+
build_parser.add_argument(
332+
"--foundation-install-prefix",
333+
help="Path to the installation location for swift-corelibs-foundation "
334+
"build products ('%(default)s' by default); CoreFoundation "
335+
"dependencies are expected to be found under "
336+
"FOUNDATION_BUILD_DIR/FOUNDATION_INSTALL_PREFIX.",
337+
default="/usr")
330338
build_parser.add_argument(
331339
"--libdispatch-build-dir",
332340
help="Path to swift-corelibs-libdispatch build products, which "
@@ -394,6 +402,13 @@ def main(args=sys.argv[1:]):
394402
help="Path to swift-corelibs-foundation build products, which the "
395403
"tests will be linked against.",
396404
required=strategy.requires_foundation_build_dir())
405+
test_parser.add_argument(
406+
"--foundation-install-prefix",
407+
help="Path to the installation location for swift-corelibs-foundation "
408+
"build products ('%(default)s' by default); CoreFoundation "
409+
"dependencies are expected to be found under "
410+
"FOUNDATION_BUILD_DIR/FOUNDATION_INSTALL_PREFIX.",
411+
default="/usr")
397412

398413
install_parser = subparsers.add_parser(
399414
"install",

0 commit comments

Comments
 (0)