]> git.saurik.com Git - apple/dyld.git/blob - build-scripts/generate-cache-config-header.sh
dyld-832.7.3.tar.gz
[apple/dyld.git] / build-scripts / generate-cache-config-header.sh
1 #!/bin/sh
2
3 /bin/echo "" > ${DERIVED_FILE_DIR}/dyld_cache_config.h
4
5 if [ -z "${ARM_SDK}" ]; then
6 # if iOS SDK not available, use MacOSX SDK
7 ARM_SDK=`xcrun -sdk macosx.internal --show-sdk-path`
8 fi
9
10 SHARED_REGION_FILE="${ARM_SDK}/usr/include/mach/shared_region.h"
11
12
13 if [ -r "${SHARED_REGION_FILE}" ]; then
14 /bin/echo -n "#define ARM_SHARED_REGION_START " >> ${DERIVED_FILE_DIR}/dyld_cache_config.h
15 awk '/define SHARED_REGION_BASE_ARM[ \t]/ { print $3;}' "${SHARED_REGION_FILE}" >> ${DERIVED_FILE_DIR}/dyld_cache_config.h
16 /bin/echo "" >> ${DERIVED_FILE_DIR}/dyld_cache_config.h
17
18 /bin/echo -n "#define ARM_SHARED_REGION_SIZE " >> ${DERIVED_FILE_DIR}/dyld_cache_config.h
19 awk '/define SHARED_REGION_SIZE_ARM[ \t]/ { print $3;}' "${SHARED_REGION_FILE}" >> ${DERIVED_FILE_DIR}/dyld_cache_config.h
20 /bin/echo "" >> ${DERIVED_FILE_DIR}/dyld_cache_config.h
21
22 /bin/echo -n "#define ARM64_SHARED_REGION_START " >> ${DERIVED_FILE_DIR}/dyld_cache_config.h
23 awk '/define SHARED_REGION_BASE_ARM64[ \t]/ { print $3;}' "${SHARED_REGION_FILE}" >> ${DERIVED_FILE_DIR}/dyld_cache_config.h
24 /bin/echo "" >> ${DERIVED_FILE_DIR}/dyld_cache_config.h
25
26 /bin/echo -n "#define ARM64_SHARED_REGION_SIZE " >> ${DERIVED_FILE_DIR}/dyld_cache_config.h
27 awk '/define SHARED_REGION_SIZE_ARM64[ \t]/ { print $3;}' "${SHARED_REGION_FILE}" >> ${DERIVED_FILE_DIR}/dyld_cache_config.h
28 /bin/echo "" >> ${DERIVED_FILE_DIR}/dyld_cache_config.h
29
30 grep SHARED_REGION_BASE_ARM64_32 "${SHARED_REGION_FILE}" > /dev/null 2>&1
31 if [ "$?" -eq "0" ]; then
32 /bin/echo -n "#define ARM64_32_SHARED_REGION_START " >> ${DERIVED_FILE_DIR}/dyld_cache_config.h
33 awk '/define SHARED_REGION_BASE_ARM64_32/ { print $3;}' "${SHARED_REGION_FILE}" >> ${DERIVED_FILE_DIR}/dyld_cache_config.h
34 /bin/echo "" >> ${DERIVED_FILE_DIR}/dyld_cache_config.h
35
36 /bin/echo -n "#define ARM64_32_SHARED_REGION_SIZE " >> ${DERIVED_FILE_DIR}/dyld_cache_config.h
37 awk '/define SHARED_REGION_SIZE_ARM64_32/ { print $3;}' "${SHARED_REGION_FILE}" >> ${DERIVED_FILE_DIR}/dyld_cache_config.h
38 /bin/echo "" >> ${DERIVED_FILE_DIR}/dyld_cache_config.h
39 fi
40 else
41 /bin/echo "ERROR: File needed to configure update_dyld_shared_cache does not exist '${SHARED_REGION_FILE}'"
42 exit 1
43 fi
44
45 if [ -r "${ARM_SDK}/AppleInternal/DirtyDataFiles/dirty-data-segments-order.txt" ]; then
46 mkdir -p "${DSTROOT}/${INSTALL_LOCATION}/usr/local/bin"
47 cp "${ARM_SDK}/AppleInternal/DirtyDataFiles/dirty-data-segments-order.txt" "${DSTROOT}/${INSTALL_LOCATION}/usr/local/bin"
48 fi
49 if [ -r "${ARM_SDK}/AppleInternal/OrderFiles/dylib-order.txt" ]; then
50 mkdir -p "${DSTROOT}/${INSTALL_LOCATION}/usr/local/bin"
51 cp "${ARM_SDK}/AppleInternal/OrderFiles/dylib-order.txt" "${DSTROOT}/${INSTALL_LOCATION}/usr/local/bin"
52 fi
53