-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Add support to create xctoolchain with code sign #12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 6 commits
9e5e408
7885cc0
ffcfca6
4cd1a6f
970a0a2
4c0c8df
cba563c
cbb3bab
891f9e8
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -175,6 +175,14 @@ KNOWN_SETTINGS=( | |
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" | ||
darwin-toolchain-bundle-identifier "" "CFBundleIdentifier for xctoolchain info plist" | ||
darwin-toolchain-display-name "" "Display Name for xctoolcain info plist" | ||
darwin-toolchain-name "" "Directory name for xctoolchain" | ||
darwin-toolchain-version "" "Version for xctoolchain info plist and installer pkg" | ||
darwin-toolchain-application-cert "" "Application Cert name to codesign xctoolchain" | ||
darwin-toolchain-installer-cert "" "Installer Cert name to create installer pkg" | ||
darwin-toolchain-installer-package "" "The path to installer pkg" | ||
|
||
) | ||
|
||
function toupper() { | ||
|
@@ -2114,6 +2122,33 @@ if [[ "${INSTALLABLE_PACKAGE}" ]] ; then | |
echo "--- Copy swift-stdlib-tool ---" | ||
cp "${SWIFT_SOURCE_DIR}/utils/swift-stdlib-tool-substitute" "${INSTALL_DESTDIR}/${INSTALL_PREFIX}/bin/swift-stdlib-tool" | ||
fi | ||
|
||
#Create plist for xctoolchain | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Space after |
||
echo "-- Create Info.plist --" | ||
PLISTBUDDY_BIN="/usr/libexec/PlistBuddy" | ||
DARWIN_TOOLCHAIN_INSTALL_LOCATION="/Library/Developer/Toolchains/${DARWIN_TOOLCHAIN_NAME}.xctoolchain" | ||
if [[ -f "${INSTALL_DESTDIR}/${TOOLCHAIN_PREFIX}/Info.plist" ]] ; then | ||
echo "-- Removing: ${INSTALL_DESTDIR}/${TOOLCHAIN_PREFIX}/Info.plist" | ||
rm "${INSTALL_DESTDIR}/${TOOLCHAIN_PREFIX}/Info.plist" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You can unconditionally |
||
fi | ||
${PLISTBUDDY_BIN} -c "Add DisplayName string '${DARWIN_TOOLCHAIN_DISPLAY_NAME}'" "${INSTALL_DESTDIR}/${TOOLCHAIN_PREFIX}/Info.plist" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It would be best to factor out the plist name into a variable to avoid repetition. |
||
${PLISTBUDDY_BIN} -c "Add Version string '${DARWIN_TOOLCHAIN_VERSION}'" "${INSTALL_DESTDIR}/${TOOLCHAIN_PREFIX}/Info.plist" | ||
${PLISTBUDDY_BIN} -c "Add CFBundleIdentifier string '${DARWIN_TOOLCHAIN_BUNDLE_IDENTIFIER}'" "${INSTALL_DESTDIR}/${TOOLCHAIN_PREFIX}/Info.plist" | ||
${PLISTBUDDY_BIN} -c "Add ReportProblemURL string 'https://bugs.swift.org/'" "${INSTALL_DESTDIR}/${TOOLCHAIN_PREFIX}/Info.plist" | ||
${PLISTBUDDY_BIN} -c "Add OverrideEnvironment::DYLD_LIBRARY_PATH string '${DARWIN_TOOLCHAIN_INSTALL_LOCATION}/usr/lib'" "${INSTALL_DESTDIR}/${TOOLCHAIN_PREFIX}/Info.plist" | ||
chmod a+r "${INSTALL_DESTDIR}/${TOOLCHAIN_PREFIX}/Info.plist" | ||
|
||
if [[ "${DARWIN_TOOLCHAIN_APPLICATION_CERT}" ]] ; then | ||
echo "-- Codesign xctoolchain --" | ||
"${SWIFT_SOURCE_DIR}/utils/toolchain-codesign" "${DARWIN_TOOLCHAIN_APPLICATION_CERT}" "${INSTALL_DESTDIR}/${TOOLCHAIN_PREFIX}" | ||
fi | ||
if [[ "${DARWIN_TOOLCHAIN_INSTALLER_PACKAGE}" ]] ; then | ||
echo "-- Create Installer --" | ||
"${SWIFT_SOURCE_DIR}/utils/toolchain-installer" "${INSTALL_DESTDIR}/${TOOLCHAIN_PREFIX}" "${DARWIN_TOOLCHAIN_BUNDLE_IDENTIFIER}" \ | ||
"${DARWIN_TOOLCHAIN_INSTALLER_CERT}" "${DARWIN_TOOLCHAIN_INSTALLER_PACKAGE}" "${DARWIN_TOOLCHAIN_INSTALL_LOCATION}" \ | ||
"${DARWIN_TOOLCHAIN_VERSION}" | ||
fi | ||
|
||
(cd "${INSTALL_DESTDIR}" && | ||
tar -c -z -f "${INSTALLABLE_PACKAGE}" "${TOOLCHAIN_PREFIX/#\/}") | ||
else | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#!/bin/bash | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please add the license header (copy from |
||
|
||
DARWIN_TOOLCHAIN_APPLICATION_CERT=$1 | ||
TOOLCHAIN_PREFIX=$2 | ||
|
||
codesign -f --deep -s "${DARWIN_TOOLCHAIN_APPLICATION_CERT}" "${TOOLCHAIN_PREFIX}" |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#!/bin/bash | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please add the license header (copy from |
||
|
||
TOOLCHAIN_PREFIX=$1 | ||
DARWIN_BUNDLE_IDENTIFIER=$2 | ||
DARWIN_INSTALLER_CERT=$3 | ||
DARWIN_INSTALLER_PACKAGE=$4 | ||
DARWIN_TOOLCHAIN_INSTALL_LOCATION=$5 | ||
DARWIN_TOOLCHAIN_VERSION=$6 | ||
|
||
pkgbuild --root "${TOOLCHAIN_PREFIX}" --install-location "${DARWIN_TOOLCHAIN_INSTALL_LOCATION}" "${DARWIN_INSTALLER_PACKAGE}" \ | ||
--version "${DARWIN_TOOLCHAIN_VERSION}" --identifier "${DARWIN_BUNDLE_IDENTIFIER}" --sign "${DARWIN_INSTALLER_CERT}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you prefix the
%()
variables withdarwin_
as well?