forked from JuliaLang/julia
-
Notifications
You must be signed in to change notification settings - Fork 0
/
codesign.sh
executable file
·38 lines (33 loc) · 1018 Bytes
/
codesign.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#!/bin/sh
# This file is a part of Julia. License is MIT: https://julialang.org/license
# Codesign binary files for macOS.
usage() {
echo "Usage: ${0} MACOS_CODESIGN_IDENTITY FILE-OR-DIRECTORY"
exit 0
}
# Default codesign identity to `-` if not provided
if [ -z "${1}" ]; then
MACOS_CODESIGN_IDENTITY="-"
ENTITLEMENTS=""
else
MACOS_CODESIGN_IDENTITY="${1}"
ENTITLEMENTS="--entitlements $(dirname "${0}")/mac/app/Entitlements.plist"
fi
if [ "${#}" -eq 2 ]; then
if [ -f "${2}" ]; then
# Codesign only the given file
MACHO_FILES="${2}"
elif [ -d "${2}" ]; then
# Find all files in the given directory
MACHO_FILES=$(find "${2}" -type f -perm -0111 | cut -d: -f1)
else
usage
fi
else
usage
fi
echo "Codesigning with identity ${MACOS_CODESIGN_IDENTITY}"
for f in ${MACHO_FILES}; do
echo "Codesigning ${f}..."
codesign -s "${MACOS_CODESIGN_IDENTITY}" --option=runtime ${ENTITLEMENTS} -vvv --timestamp --deep --force "${f}"
done