1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22#!/usr/bin/env bash
# On macOS, add this script as an early build phase to sign
# distributed dylibs. Make sure to disable "User Script Sandboxing"
# under "Build Settings" > "Build Options" in the Xcode target
# configuration.
set -euo pipefail
while read -r path; do
filename=$(basename "$path")
libname=$(echo "$filename" | cut -d. -f1)
codesign --remove-signature "$path"
codesign \
--timestamp \
--entitlements="${PROJECT_DIR}/core/dylib.entitlements" \
--sign "${EXPANDED_CODE_SIGN_IDENTITY}" \
-i "${PRODUCT_BUNDLE_IDENTIFIER}.${libname}" \
-o runtime \
"$path"
done < <(find "${PROJECT_DIR}/${PROJECT_NAME}/res" -name '*.dylib')