Skip to content

[build-script-impl] don't assume installation folders are created #39112

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 24 additions & 18 deletions utils/build-script-impl
Original file line number Diff line number Diff line change
Expand Up @@ -3267,10 +3267,12 @@ for host in "${ALL_HOSTS[@]}"; do

# Copy executables and shared libraries from the `host_install_destdir` to
# INSTALL_SYMROOT and run dsymutil on them.
(cd "${CURRENT_INSTALL_DIR}" &&
find ./"${CURRENT_PREFIX}" -perm -0111 -type f -print | \
filter_paths "${DARWIN_SYMROOT_PATH_FILTERS}" | \
cpio --insecure -pdm -v "${host_symroot}")
if [ -d "${CURRENT_INSTALL_DIR}" ]; then
(cd "${CURRENT_INSTALL_DIR}" &&
find ./"${CURRENT_PREFIX}" -perm -0111 -type f -print | \
filter_paths "${DARWIN_SYMROOT_PATH_FILTERS}" | \
cpio --insecure -pdm -v "${host_symroot}")
fi

dsymutil_path=
if [[ -n "${DARWIN_INSTALL_EXTRACT_SYMBOLS_USE_JUST_BUILT_DSYMUTIL}" ]]; then
Expand All @@ -3285,22 +3287,26 @@ for host in "${ALL_HOSTS[@]}"; do
# Tweak carefully the amount of parallelism -- dsymutil can be memory intensive and
# as such too many instance can exhaust the memory and slow down/panic the machine
printJSONStartTimestamp dsymutil
(cd "${host_symroot}" &&
find ./"${CURRENT_PREFIX}" -perm -0111 -type f -not -name "*.a" -not -name "*.py" -print | \
xargs -n 1 -P ${DSYMUTIL_JOBS} ${dsymutil_path})
if [ -d "${host_symroot}" ]; then
(cd "${host_symroot}" &&
find ./"${CURRENT_PREFIX}" -perm -0111 -type f -not -name "*.a" -not -name "*.py" -print | \
xargs -n 1 -P ${DSYMUTIL_JOBS} ${dsymutil_path})
fi
printJSONEndTimestamp dsymutil

# Strip executables, shared libraries and static libraries in
# `host_install_destdir`.
find "${CURRENT_INSTALL_DIR}${CURRENT_PREFIX}/" \
'(' -perm -0111 -or -name "*.a" ')' -type f -print | \
xargs -n 1 -P ${BUILD_JOBS} $(xcrun_find_tool strip) -S

# Codesign dylibs after strip tool
# rdar://45388785
find "${CURRENT_INSTALL_DIR}${CURRENT_PREFIX}/" \
'(' -name "*.dylib" ')' -type f -print | \
xargs -n 1 -P ${BUILD_JOBS} $(xcrun_find_tool codesign) -f -s -
if [ -d "${CURRENT_INSTALL_DIR}${CURRENT_PREFIX}/" ]; then
# Strip executables, shared libraries and static libraries in
# `host_install_destdir`.
find "${CURRENT_INSTALL_DIR}${CURRENT_PREFIX}/" \
'(' -perm -0111 -or -name "*.a" ')' -type f -print | \
xargs -n 1 -P ${BUILD_JOBS} $(xcrun_find_tool strip) -S

# Codesign dylibs after strip tool
# rdar://45388785
find "${CURRENT_INSTALL_DIR}${CURRENT_PREFIX}/" \
'(' -name "*.dylib" ')' -type f -print | \
xargs -n 1 -P ${BUILD_JOBS} $(xcrun_find_tool codesign) -f -s -
fi

{ set +x; } 2>/dev/null
fi
Expand Down