]> git.saurik.com Git - apple/security.git/blob - symbol_strip.sh
Security-54.1.9.tar.gz
[apple/security.git] / symbol_strip.sh
1 #!/bin/sh
2
3 if [ $# -ne 1 ]
4 then
5 echo "Export file name required."
6 exit 1
7 fi
8 expfile="$1"
9 expbase=`basename $expfile`
10
11 # Don't rerun this unless the file has been relinked
12 if [ "${BUILT_PRODUCTS_DIR}/${expbase}.timestamp" -nt "${BUILT_PRODUCTS_DIR}/${INNER_PRODUCT_SUBPATH}" ]; then
13 echo "${BUILT_PRODUCTS_DIR}/${INNER_PRODUCT_SUBPATH} is up to date."
14 exit 0
15 fi
16
17 echo "Scanning ${BUILT_PRODUCTS_DIR}/${INNER_PRODUCT_SUBPATH}"
18 ARCHS=`lipo -info "${BUILT_PRODUCTS_DIR}/${INNER_PRODUCT_SUBPATH}" | awk -F : '{print $3}'`
19 for arch in $ARCHS
20 do
21 echo "Generating exports file ${BUILT_PRODUCTS_DIR}/${expbase}_$arch"
22 nm -gp -arch $arch "${BUILT_PRODUCTS_DIR}/${INNER_PRODUCT_SUBPATH}" \
23 | egrep -v '^/| U _' \
24 | awk '{print $3}' \
25 | egrep '_(|tf|ti|C)(|Q[2-9])8Security|_(N|ZN|ZNK|ZTTN|ZTVN)8Security|^_(Sec|CSSM|Authorization)' \
26 | cat - "$expfile" \
27 | sort -u > "${BUILT_PRODUCTS_DIR}/${expbase}_$arch"
28 echo nmedit -s "${BUILT_PRODUCTS_DIR}/${expbase}_$arch" -arch $arch "${BUILT_PRODUCTS_DIR}/${INNER_PRODUCT_SUBPATH}"
29 nmedit -s "${BUILT_PRODUCTS_DIR}/${expbase}_$arch" -arch $arch "${BUILT_PRODUCTS_DIR}/${INNER_PRODUCT_SUBPATH}"
30 done
31 touch "${BUILT_PRODUCTS_DIR}/${expbase}.timestamp"