Skip to content

Commit

Permalink
Strip profiler or shim frameworks according to currently built archs
Browse files Browse the repository at this point in the history
  • Loading branch information
LeoNatan committed Oct 17, 2018
1 parent d7f0d65 commit 879af32
Showing 1 changed file with 17 additions and 0 deletions.
Expand Up @@ -31,6 +31,23 @@ if [ -e "${PROFILER_FRAMEWORK_PATH}" ]; then
mv "${CODESIGNING_FOLDER_PATH}"/Frameworks/"${PROFILER_FRAMEWORK_NAME}"/DTXProfilerShim "${CODESIGNING_FOLDER_PATH}"/Frameworks/"${PROFILER_FRAMEWORK_NAME}"/DTXProfiler
echo "Profiler framework not integrated: current build configuration “${CONFIGURATION}” is not included in the ALLOWED_CONFIGURATIONS list."
fi

EXTRACTED_ARCHS=()

for ARCH in $ARCHS
do
echo "Extracting $ARCH"
lipo -extract "${ARCH}" "${CODESIGNING_FOLDER_PATH}"/Frameworks/"${PROFILER_FRAMEWORK_NAME}"/DTXProfiler -o "${CODESIGNING_FOLDER_PATH}"/Frameworks/"${PROFILER_FRAMEWORK_NAME}"/DTXProfiler"-${ARCH}"
EXTRACTED_ARCHS+=("${CODESIGNING_FOLDER_PATH}"/Frameworks/"${PROFILER_FRAMEWORK_NAME}"/DTXProfiler"-${ARCH}")
done

echo "Merging extracted architectures: ${ARCHS}"
lipo -o "${CODESIGNING_FOLDER_PATH}"/Frameworks/"${PROFILER_FRAMEWORK_NAME}"/DTXProfiler"-merged" -create "${EXTRACTED_ARCHS[@]}"
rm "${EXTRACTED_ARCHS[@]}"

echo "Replacing original executable with thinned version"
rm "${CODESIGNING_FOLDER_PATH}"/Frameworks/"${PROFILER_FRAMEWORK_NAME}"/DTXProfiler
mv "${CODESIGNING_FOLDER_PATH}"/Frameworks/"${PROFILER_FRAMEWORK_NAME}"/DTXProfiler"-merged" "${CODESIGNING_FOLDER_PATH}"/Frameworks/"${PROFILER_FRAMEWORK_NAME}"/DTXProfiler

if [ -n "${EXPANDED_CODE_SIGN_IDENTITY}" ]; then
codesign -fs "${EXPANDED_CODE_SIGN_IDENTITY}" "${CODESIGNING_FOLDER_PATH}"/Frameworks/"${PROFILER_FRAMEWORK_NAME}" &> /dev/null
Expand Down

0 comments on commit 879af32

Please sign in to comment.