]> git.saurik.com Git - apple/dyld.git/blob - build-scripts/dyld_tests-build.sh
dyld-832.7.3.tar.gz
[apple/dyld.git] / build-scripts / dyld_tests-build.sh
1 #!/bin/sh
2
3 set -e
4
5 source $SRCROOT/build-scripts/include.sh
6
7 # Exit on failure
8
9 OBJROOT_DYLD_APP_CACHE_UTIL="${TARGET_TEMP_DIR}/Objects_Dyld_App_Cache_Util"
10 OBJROOT_RUN_STATIC="${TARGET_TEMP_DIR}/Objects_Run_Static"
11
12 SYMROOT=${BUILD_DIR}/${CONFIGURATION}${EFFECTIVE_PLATFORM_NAME}/dyld_tests
13 OBJROOT=${PROJECT_TEMP_DIR}/${CONFIGURATION}${EFFECTIVE_PLATFORM_NAME}
14 SDKROOT=${SDKROOT:-$(xcrun -sdk macosx.internal --show-sdk-path)}
15 DEPLOYMENT_TARGET_CLANG_FLAG_NAME=${DEPLOYMENT_TARGET_CLANG_FLAG_NAME:-"mmacosx-version-min"}
16 DERIVED_FILES_DIR=${DERIVED_FILES_DIR}
17 LDFLAGS="-L$BUILT_PRODUCTS_DIR"
18 #LLBUILD=$(xcrun --sdk $SDKROOT --find llbuild 2> /dev/null)
19 NINJA=${LLBUILD:-`xcrun --sdk $SDKROOT --find ninja 2> /dev/null`}
20 BUILD_TARGET=${ONLY_BUILD_TEST:-all}
21
22 if [ ! -z "$LLBUILD" ]; then
23 NINJA="$LLBUILD ninja build"
24 fi
25
26 OSVERSION="10.14"
27 if [ ! -z "$DEPLOYMENT_TARGET_CLANG_ENV_NAME" ]; then
28 OSVERSION=${!DEPLOYMENT_TARGET_CLANG_ENV_NAME}
29 fi
30
31 if [ -z "$SRCROOT" ]; then
32 echo "Error $$SRCROOT must be set"
33 fi
34
35 if [ -z "$ARCHS" ]; then
36 PLATFORM_NAME=${PLATFORM_NAME:macosx}
37 case "$PLATFORM_NAME" in
38 "watchos") ARCHS="armv7k arm64_32"
39 ;;
40 "appletvos") ARCHS="arm64"
41 ;;
42 *) ARCHS=${ARCHS_STANDARD}
43 ;;
44 esac
45 fi
46
47 if [ -z "$ARCHS" ]; then
48 ARCHS="x86_64"
49 fi
50
51 /bin/mkdir -p ${DERIVED_FILES_DIR}
52 TMPFILE=$(mktemp ${DERIVED_FILES_DIR}/config.ninja.XXXXXX)
53
54 echo "OBJROOT = $OBJROOT" >> $TMPFILE
55 echo "OSFLAG = $DEPLOYMENT_TARGET_CLANG_FLAG_NAME" >> $TMPFILE
56 echo "OSVERSION = $OSVERSION" >> $TMPFILE
57 echo "SDKROOT = $SDKROOT" >> $TMPFILE
58 echo "SRCROOT = $SRCROOT" >> $TMPFILE
59 echo "SYMROOT = $SYMROOT" >> $TMPFILE
60 echo "BUILT_PRODUCTS_DIR = $BUILT_PRODUCTS_DIR" >> $TMPFILE
61 echo "INSTALL_GROUP = $INSTALL_GROUP" >> $TMPFILE
62 echo "INSTALL_MODE_FLAG = $INSTALL_MODE_FLAG" >> $TMPFILE
63 echo "INSTALL_OWNER = $INSTALL_OWNER" >> $TMPFILE
64 echo "INSTALL_DIR = $INSTALL_DIR" >> $TMPFILE
65 echo "USER_HEADER_SEARCH_PATHS = $USER_HEADER_SEARCH_PATHS" >> $TMPFILE
66 echo "SYSTEM_HEADER_SEARCH_PATHS = $SYSTEM_HEADER_SEARCH_PATHS" >> $TMPFILE
67 echo "ARCHS = $ARCHS" >> $TMPFILE
68 echo "DERIVED_FILES_DIR = $DERIVED_FILES_DIR" >> $TMPFILE
69 echo "LDFLAGS = $LDFLAGS" >> $TMPFILE
70
71 /usr/bin/rsync -vc $TMPFILE ${DERIVED_FILES_DIR}/config.ninja
72 /bin/rm -f $TMPFILE
73
74 xcodebuild install -target run-static SDKROOT="${SDKROOT}" MACOSX_DEPLOYMENT_TARGET=${MACOSX_DEPLOYMENT_TARGET} OBJROOT="${OBJROOT_RUN_STATIC}" SRCROOT="${SRCROOT}" DSTROOT="${DSTROOT}" SYMROOT="${SYMROOT}" RC_ProjectSourceVersion="${RC_ProjectSourceVersion}" DISABLE_SDK_METADATA_PARSING=YES
75
76 xcodebuild install -target dyld_app_cache_util -sdk macosx.internal -configuration ${CONFIGURATION} MACOSX_DEPLOYMENT_TARGET=${MACOSX_DEPLOYMENT_TARGET} OBJROOT="${OBJROOT_DYLD_APP_CACHE_UTIL}" SRCROOT="${SRCROOT}" DSTROOT="${BUILT_PRODUCTS_DIR}" SYMROOT="${SYMROOT}" RC_ProjectSourceVersion="${RC_ProjectSourceVersion}" INSTALL_PATH="/host_tools" RC_ARCHS="${NATIVE_ARCH_ACTUAL}" DISABLE_SDK_METADATA_PARSING=YES
77
78 ${SRCROOT}/testing/build_ninja.py ${DERIVED_FILES_DIR}/config.ninja || exit_if_error $? "Generating build.ninja failed"
79 ${NINJA} -C ${DERIVED_FILES_DIR} ${BUILD_TARGET} || exit_if_error $? "Ninja build failed"