Skip to content

Commit a665ba6

Browse files
authored
Merge pull request #34248 from akyrtzi/build-parser-lib-no-install
[utils/build-parser-lib] Add '--no-install' option to skip installing.
2 parents 4f49b6a + 771738c commit a665ba6

File tree

1 file changed

+17
-11
lines changed

1 file changed

+17
-11
lines changed

utils/build-parser-lib

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ class Builder(object):
7474
shell.call(command, env=env, dry_run=self.dry_run, echo=self.verbose)
7575

7676
def configure(self, enable_debuginfo, instrumentation=None, profile_data=None):
77+
environment = {}
7778
cmake_args = [self.toolchain.cmake, "-G", "Ninja"]
7879
cmake_args += ["-DCMAKE_MAKE_PROGRAM=" + self.ninja_path]
7980

@@ -90,6 +91,7 @@ class Builder(object):
9091
"-DCMAKE_OSX_DEPLOYMENT_TARGET=" + deployment_version,
9192
"-DSWIFT_DARWIN_DEPLOYMENT_VERSION_OSX=" + deployment_version,
9293
]
94+
environment["SDKROOT"] = "macosx"
9395

9496
elif self.host == "linux":
9597
host_triple = "%s-unknown-linux" % (self.arch)
@@ -252,7 +254,7 @@ class Builder(object):
252254
"-DSWIFT_INCLUDE_TESTS=FALSE",
253255
]
254256
cmake_args += [os.path.join(SWIFT_SOURCE_ROOT, "llvm-project", "llvm")]
255-
self.call(cmake_args)
257+
self.call(cmake_args, env=environment)
256258

257259
def build_target(self, build_dir, target, env=None):
258260
invocation = [self.toolchain.cmake, "--build", build_dir]
@@ -441,6 +443,7 @@ Example invocations:
441443
help="space-separated list of architectures to build for. (default = %s)"
442444
% default_architectures,
443445
)
446+
option("--no-install", store_true, help="disable install step")
444447
option(
445448
"--install-symroot", store_path, help="the path to install debug symbols into"
446449
)
@@ -467,7 +470,7 @@ Example invocations:
467470
parser = optbuilder.build()
468471
args = parser.parse_args()
469472

470-
if not args.install_destdir:
473+
if not args.install_destdir and not args.no_install:
471474
args.install_destdir = os.path.join(args.build_dir, "install")
472475

473476
swift_src_path = os.path.join(SWIFT_SOURCE_ROOT, "swift")
@@ -503,8 +506,9 @@ Example invocations:
503506
arch = architectures.pop(0)
504507
tmpargs = copy.copy(args)
505508
tmpargs.build_dir = os.path.join(objroot, arch, "obj")
506-
tmpargs.install_destdir = os.path.join(objroot, arch, "dst")
507-
tmpargs.install_prefix = "/"
509+
if not args.no_install:
510+
tmpargs.install_destdir = os.path.join(objroot, arch, "dst")
511+
tmpargs.install_prefix = "/"
508512

509513
native_build_dir = tmpargs.build_dir
510514
dst_dirs.append(tmpargs.install_destdir)
@@ -544,8 +548,9 @@ Example invocations:
544548

545549
for arch in architectures:
546550
args.build_dir = os.path.join(objroot, arch, "obj")
547-
args.install_destdir = os.path.join(objroot, arch, "dst")
548-
args.install_prefix = "/"
551+
if not args.no_install:
552+
args.install_destdir = os.path.join(objroot, arch, "dst")
553+
args.install_prefix = "/"
549554

550555
dst_dirs.append(args.install_destdir)
551556

@@ -559,11 +564,12 @@ Example invocations:
559564
)
560565
builder.run()
561566

562-
lipo = os.path.join(SWIFT_SOURCE_ROOT, "swift", "utils", "recursive-lipo")
563-
shell.call(
564-
[lipo, "-v", "--destination", os.path.join(dstroot, "./" + prefix)]
565-
+ dst_dirs
566-
)
567+
if not args.no_install:
568+
lipo = os.path.join(SWIFT_SOURCE_ROOT, "swift", "utils", "recursive-lipo")
569+
shell.call(
570+
[lipo, "-v", "--destination", os.path.join(dstroot, "./" + prefix)]
571+
+ dst_dirs
572+
)
567573

568574
if args.install_symroot:
569575
extract_symbols(dstroot, prefix, symroot, args.build_jobs)

0 commit comments

Comments
 (0)