Skip to content
This repository was archived by the owner on Aug 31, 2021. It is now read-only.

Commit e8dae12

Browse files
committed
[[ Bug ]] Sign iOS dylibs
1 parent d118bad commit e8dae12

File tree

2 files changed

+45
-0
lines changed

2 files changed

+45
-0
lines changed

builder/tools_builder.livecodescript

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -696,6 +696,44 @@ command toolsBuilderMakeAppBundle pVersion, pEdition, pPlatform
696696
end if
697697
end repeat
698698
end repeat
699+
700+
-- Sign any extension code resources
701+
local tExtensions
702+
put folders(tAppBundle & "/Contents/Tools/Extensions") into tExtensions
703+
repeat for each line tExtension in tExtensions
704+
local tCodeFolders
705+
put folders(tAppBundle & "/Contents/Tools/Extensions/" & tExtension & "/code") into tCodeFolders
706+
filter tCodeFolders with "*iphonesimulator*"
707+
if tCodeFolders is empty then next repeat
708+
709+
710+
repeat for each line tCodeFolder in tCodeFolders
711+
local tDylibs
712+
filter files(tAppBundle & "/Contents/Tools/Extensions/" & tExtension & "/code/" & tCodeFolder) \
713+
with "*.dylib" into tDylibs
714+
if tDylibs is empty then next repeat
715+
716+
repeat for each line tFile in tDylibs
717+
-- Ignore files that aren't dylibs
718+
local tFullPath
719+
put tAppBundle & "/Contents/Tools/Extensions/" & tExtension & "/code/" & tCodeFolder & "/" & tFile into tFullPath
720+
get shell("file" && escapeArg(tFullPath))
721+
if "Mach-O" is not among the words of it then next repeat
722+
723+
clearExtendedAttributes escapeArg(tFullPath)
724+
725+
-- Sign the extension
726+
-- The "--force" parameter strips the existing signature (which was
727+
-- made using a not-valid-for-distribution profile)
728+
builderLog "message", "Signing iOS extension" && "'" & tFullPath & "'"
729+
get shell("/usr/bin/codesign --sign" && word 2 of tSigningId && "--force --verbose=2" && escapeArg(tFullPath))
730+
if the result is not zero then
731+
builderLog "error", "Could not sign iOS extension:" && it
732+
throw "failure"
733+
end if
734+
end repeat
735+
end repeat
736+
end repeat
699737

700738
clearExtendedAttributes escapeArg(tAppBundle)
701739

tools/build-extension-ios.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,13 @@ fi
128128

129129
if [ $BUILD_DYLIB -eq 1 ]; then
130130
ln -sf "$PRODUCT_NAME.dylib" "$BUILT_PRODUCTS_DIR/$PRODUCT_NAME.ios-extension"
131+
OUTPUT=$(/usr/bin/codesign -f -s "$CODE_SIGN_IDENTITY" "$BUILT_PRODUCTS_DIR/$PRODUCT_NAME.dylib")
132+
RESULT=$?
133+
if [ $RESULT -ne 0 ]; then
134+
echo "Signing $BUILT_PRODUCTS_DIR/$PRODUCT_NAME.dylib failed:"
135+
echo $OUTPUT
136+
exit $RESULT
137+
fi
131138
else
132139
ln -sf "$PRODUCT_NAME.lcext" "$BUILT_PRODUCTS_DIR/$PRODUCT_NAME.ios-extension"
133140
fi

0 commit comments

Comments
 (0)