blob: 0fe0bba541f52ea27a960ed8f95336128d685613 (
plain)
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
|
export PATH=${PKG_BASE}/util:$PATH
find "${PKG_DEST}" -type f \( -perm -0100 -o -name '*.dylib' -o -name '*.so' \) -print0 | while read -r -d $'\0' bin; do
ENTITLEMENT=""
case "$(file "${bin}")" in (\
*': Mach-O fat file with '*([0-9])' architecture' |\
*': '*(setuid |setgid )'Mach-O 64-bit executable arm64' \
)
ENTITLEMENT="${PKG_BASE}/arch/${PKG_ARCH}/${PKG_CFTARG}/entitlement.xml"
;;
(\
*': Mach-O '?(64-bit )'dynamically linked shared library '@(acorn|arm64) |\
*': Mach-O '?(64-bit )'bundle '@(acorn|arm64) |\
*': '*(setuid |setgid )'Mach-O executable acorn' \
)
;;
(*) continue
;;
esac
if "${PKG_TARG}-otool" -hv "${bin}" | grep DYLIB_STUB &>/dev/null; then
continue; fi
if grep $'\xfa\xde\x0c\x01' "${bin}" &>/dev/null; then
continue; fi
if "${PKG_BASE}/util/ldid" -e "${bin}" >/dev/null 2>&1; then
continue; fi
perms=$(stat -f %p "${bin}" | sed -e s/^1//)
chmod 755 "${bin}"
echo "${PKG_BASE}/util/ldid" -S"${ENTITLEMENT}" "${bin}"
"${PKG_BASE}/util/ldid" -S"${ENTITLEMENT}" "${bin}"
chmod "${perms}" "${bin}"
done
|