1#!/bin/sh 2 3postProcessInDirectory() 4{ 5 cd "$1" 6 7 local unifdefOptions sedExpression 8 9 if [[ ${PLATFORM_NAME} == iphoneos ]]; then 10 unifdefOptions="-DTARGET_OS_EMBEDDED=1 -DTARGET_OS_IPHONE=1 -DTARGET_IPHONE_SIMULATOR=0"; 11 elif [[ ${PLATFORM_NAME} == iphonesimulator ]]; then 12 unifdefOptions="-DTARGET_OS_EMBEDDED=0 -DTARGET_OS_IPHONE=1 -DTARGET_IPHONE_SIMULATOR=1"; 13 else 14 unifdefOptions="-DTARGET_OS_EMBEDDED=0 -DTARGET_OS_IPHONE=0 -DTARGET_IPHONE_SIMULATOR=0"; 15 fi 16 17 if [[ ${PLATFORM_NAME} == iphone* ]]; then 18 sedExpression='s/ *WEBKIT_((CLASS_|ENUM_)?AVAILABLE|DEPRECATED)_MAC\([^)]+\)//g'; 19 else 20 sedExpression='s/WEBKIT_((CLASS_|ENUM_)?AVAILABLE|DEPRECATED)/NS_\1/g'; 21 fi 22 23 for header in $(find . -name '*.h' -type f); do 24 unifdef -B ${unifdefOptions} -o ${header}.unifdef ${header} 25 case $? in 26 0) 27 rm ${header}.unifdef 28 ;; 29 1) 30 mv ${header}{.unifdef,} 31 ;; 32 *) 33 exit 1 34 ;; 35 esac 36 37 if [[ ${header} == "./WebKitAvailability.h" ]]; then 38 continue 39 fi 40 41 sed -E -e "${sedExpression}" < ${header} > ${header}.sed 42 if cmp -s ${header} ${header}.sed; then 43 rm ${header}.sed 44 else 45 mv ${header}.sed ${header} 46 fi 47 done 48} 49 50postProcessInDirectory "${TARGET_BUILD_DIR}/${PUBLIC_HEADERS_FOLDER_PATH}" 51postProcessInDirectory "${TARGET_BUILD_DIR}/${PRIVATE_HEADERS_FOLDER_PATH}" 52