Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Build static library for JavaScriptCore before linking framework
https://bugs.webkit.org/show_bug.cgi?id=263697 <rdar://113641596> Reviewed by Elliott Williams. This change introduces a libJavaScriptCore.a target, which is then used to link JavaScriptCore.framework. By configuring the project to build this way, there is no need to duplicate the list of sources between both targets. When JSC_USE_STATIC_LINKING=YES, the jsc binary is linked to libJavaScriptCore.a instead of to JavaScriptCore.framework. * Source/JavaScriptCore/API/JSWrapperMap.h: * Source/JavaScriptCore/API/ObjCCallbackFunction.h: - Fix header include paths to work with static library. * Source/JavaScriptCore/Configurations/BaseTarget.xcconfig: Copy from Source/JavaScriptCore/Configurations/JSC.xcconfig. - Extract common variables from JavaScriptCore.xcconfig that are shared with libJavaScriptCore.xcconfig. * Source/JavaScriptCore/Configurations/Base.xcconfig: - Extract linker variables from JavaScriptCore.xcconfig that are shared with JSC.xcconfig. - Note that `-fobjc-link-runtime` replaces `-lobjc -framework CoreFoundation -framework Foundation`. * Source/JavaScriptCore/Configurations/JSC.xcconfig: (JSC_USE_STATIC_LINKING): Add. - Set to the same boolean value as ENABLE_LIBFUZZER (which will default to NO), but make it a separate variable to allow this behavior to be overriden via xcodebuild. - Configure OTHER_LDFLAGS to statically link libJavaScriptCore.a when JSC_USE_STATIC_LINKING=YES, else use dynamic linking (default) to JavaScriptCore.framework. * Source/JavaScriptCore/Configurations/JavaScriptCore.xcconfig: - Extract shared variables into BaseTarget.xcconfig. - Move build related variables into libJavaScriptCore.xcconfig. * Source/JavaScriptCore/Configurations/libJavaScriptCore.xcconfig: Add. - Move build-related variables from JavaScriptCore.xcconfig. * Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj: - Add new xcconfig files to project. - Add libJavaScriptCore.a target and use libJavaScriptCore.xcconfig as its base. - Move from JavaScriptCore framework target to libJavaScriptCore target: - Custom Build Rules. - Compile Sources. - Target Dependencies. - Copy Profiling Data build phase script. - Add target dependency on libJavaScriptCore to JavaScriptCore. - Add JavaScriptCoreFramework.cpp source file to JavaScriptCore framework target. - Remove all items from "Link Binary with Libraries" for JavaScriptCore and jsc targets (except libedit.dylib on jsc) since this is handled via OTHER_LDFLAGS in xcconfig files now. * Source/JavaScriptCore/JavaScriptCoreFramework.cpp: Add. - Xcode requires at least one source file to compile to link a framework so create an empty one. Canonical link: https://commits.webkit.org/270226@main
- Loading branch information
Showing
9 changed files
with
258 additions
and
87 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
// Copyright (C) 2009-2023 Apple Inc. All rights reserved. | ||
// | ||
// Redistribution and use in source and binary forms, with or without | ||
// modification, are permitted provided that the following conditions | ||
// are met: | ||
// 1. Redistributions of source code must retain the above copyright | ||
// notice, this list of conditions and the following disclaimer. | ||
// 2. Redistributions in binary form must reproduce the above copyright | ||
// notice, this list of conditions and the following disclaimer in the | ||
// documentation and/or other materials provided with the distribution. | ||
// | ||
// THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY | ||
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | ||
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR | ||
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, | ||
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, | ||
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR | ||
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY | ||
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | ||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
|
||
#include "../../../Configurations/Version.xcconfig" | ||
|
||
GCC_PREFIX_HEADER = JavaScriptCorePrefix.h; | ||
GCC_PREPROCESSOR_DEFINITIONS = $(inherited) $(ENABLE_LLVM_PROFILE_GENERATION) PAS_BMALLOC_HIDDEN; | ||
GCC_SYMBOLS_PRIVATE_EXTERN = YES; | ||
OTHER_CFLAGS = $(inherited) -fno-slp-vectorize --system-header-prefix=unicode/ -D__STDC_WANT_LIB_EXT1__=1; | ||
HEADER_SEARCH_PATHS = "${BUILT_PRODUCTS_DIR}/DerivedSources/JavaScriptCore" $(HEADER_SEARCH_PATHS); | ||
PRODUCT_NAME = JavaScriptCore; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
44 changes: 44 additions & 0 deletions
44
Source/JavaScriptCore/Configurations/libJavaScriptCore.xcconfig
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
// Copyright (C) 2009-2023 Apple Inc. All rights reserved. | ||
// | ||
// Redistribution and use in source and binary forms, with or without | ||
// modification, are permitted provided that the following conditions | ||
// are met: | ||
// 1. Redistributions of source code must retain the above copyright | ||
// notice, this list of conditions and the following disclaimer. | ||
// 2. Redistributions in binary form must reproduce the above copyright | ||
// notice, this list of conditions and the following disclaimer in the | ||
// documentation and/or other materials provided with the distribution. | ||
// | ||
// THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY | ||
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | ||
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR | ||
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, | ||
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, | ||
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR | ||
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY | ||
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | ||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
|
||
#include "BaseTarget.xcconfig" | ||
|
||
CLANG_OPTIMIZATION_PROFILE_FILE = $(BUILT_PRODUCTS_DIR)/DerivedSources/JavaScriptCore/JavaScriptCore.profdata; | ||
WK_COMPRESSED_OPTIMIZATION_PROFILE_FILE = $(WK_COMPRESSED_OPTIMIZATION_PROFILE_FILE_$(USE_INTERNAL_SDK)); | ||
WK_COMPRESSED_OPTIMIZATION_PROFILE_FILE_YES = $(WK_WEBKITADDITIONS_HEADERS_FOLDER_PATH)/Profiling/JavaScriptCore.profdata.compressed; | ||
|
||
CLANG_USE_OPTIMIZATION_PROFILE = $(CLANG_USE_OPTIMIZATION_PROFILE_$(USE_INTERNAL_SDK)_$(CONFIGURATION)_$(WK_PLATFORM_NAME)); | ||
CLANG_USE_OPTIMIZATION_PROFILE_YES_Release_macosx = YES; | ||
CLANG_USE_OPTIMIZATION_PROFILE_YES_Release_iphoneos = YES; | ||
CLANG_USE_OPTIMIZATION_PROFILE_YES_Production_macosx = YES; | ||
CLANG_USE_OPTIMIZATION_PROFILE_YES_Production_iphoneos = YES; | ||
|
||
CLANG_INSTRUMENT_FOR_OPTIMIZATION_PROFILING = $(CLANG_INSTRUMENT_FOR_OPTIMIZATION_PROFILING_$(ENABLE_LLVM_PROFILE_GENERATION)); | ||
CLANG_INSTRUMENT_FOR_OPTIMIZATION_PROFILING_ENABLE_LLVM_PROFILE_GENERATION = YES; | ||
|
||
SKIP_INSTALL = YES; | ||
|
||
STRIP_INSTALLED_PRODUCT = NO; | ||
|
||
EXCLUDED_SOURCE_FILE_NAMES = $(inherited); | ||
EXCLUDED_SOURCE_FILE_NAMES[sdk=iphone*] = $(inherited) framework.sb; |
Oops, something went wrong.