27 # This script copies part of an Xcode installer into a devkit suitable |
27 # This script copies part of an Xcode installer into a devkit suitable |
28 # for building OpenJDK and OracleJDK. The installation .dmg files for Xcode |
28 # for building OpenJDK and OracleJDK. The installation .dmg files for Xcode |
29 # and the aux tools need to be available. |
29 # and the aux tools need to be available. |
30 # erik.joelsson@oracle.com |
30 # erik.joelsson@oracle.com |
31 |
31 |
32 USAGE="$0 <Xcode.dmg> <XQuartz.dmg> [<auxtools.dmg>]" |
32 USAGE="$0 <Xcode.dmg> <XQuartz.dmg> <gnu make binary> [<auxtools.dmg>]" |
33 |
33 |
34 if [ "$1" = "" ] || [ "$2" = "" ]; then |
34 if [ "$1" = "" ] || [ "$2" = "" ]; then |
35 echo $USAGE |
35 echo $USAGE |
36 exit 1 |
36 exit 1 |
37 fi |
37 fi |
38 |
38 |
39 XCODE_DMG="$1" |
39 XCODE_DMG="$1" |
40 XQUARTZ_DMG="$2" |
40 XQUARTZ_DMG="$2" |
41 AUXTOOLS_DMG="$3" |
41 GNU_MAKE="$3" |
|
42 AUXTOOLS_DMG="$4" |
42 |
43 |
43 SCRIPT_DIR="$(cd "$(dirname $0)" > /dev/null && pwd)" |
44 SCRIPT_DIR="$(cd "$(dirname $0)" > /dev/null && pwd)" |
44 BUILD_DIR="${SCRIPT_DIR}/../../build/devkit" |
45 BUILD_DIR="${SCRIPT_DIR}/../../build/devkit" |
45 |
46 |
46 # Mount XCODE_DMG |
47 # Mount XCODE_DMG |
50 hdiutil attach $XCODE_DMG |
51 hdiutil attach $XCODE_DMG |
51 |
52 |
52 # Find the version of Xcode |
53 # Find the version of Xcode |
53 XCODE_VERSION="$(/Volumes/Xcode/Xcode.app/Contents/Developer/usr/bin/xcodebuild -version \ |
54 XCODE_VERSION="$(/Volumes/Xcode/Xcode.app/Contents/Developer/usr/bin/xcodebuild -version \ |
54 | awk '/Xcode/ { print $2 }' )" |
55 | awk '/Xcode/ { print $2 }' )" |
|
56 SDK_VERSION="MacOSX10.9" |
|
57 if [ ! -e "/Volumes/Xcode/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/${SDK_VERSION}.sdk" ]; then |
|
58 echo "Expected SDK version not found: ${SDK_VERSION}" |
|
59 exit 1 |
|
60 fi |
55 |
61 |
56 DEVKIT_ROOT="${BUILD_DIR}/Xcode${XCODE_VERSION}-devkit" |
62 DEVKIT_ROOT="${BUILD_DIR}/Xcode${XCODE_VERSION}-${SDK_VERSION}" |
57 DEVKIT_BUNDLE="${DEVKIT_ROOT}.tar.gz" |
63 DEVKIT_BUNDLE="${DEVKIT_ROOT}.tar.gz" |
58 |
64 |
59 echo "Xcode version: $XCODE_VERSION" |
65 echo "Xcode version: $XCODE_VERSION" |
60 echo "Creating devkit in $DEVKIT_ROOT" |
66 echo "Creating devkit in $DEVKIT_ROOT" |
61 |
67 |
69 # Trim out some seemingly unneeded parts to save space. |
75 # Trim out some seemingly unneeded parts to save space. |
70 rm -rf $DEVKIT_ROOT/Xcode.app/Contents/Applications |
76 rm -rf $DEVKIT_ROOT/Xcode.app/Contents/Applications |
71 rm -rf $DEVKIT_ROOT/Xcode.app/Contents/Developer/Platforms/iPhone* |
77 rm -rf $DEVKIT_ROOT/Xcode.app/Contents/Developer/Platforms/iPhone* |
72 rm -rf $DEVKIT_ROOT/Xcode.app/Contents/Developer/Documentation |
78 rm -rf $DEVKIT_ROOT/Xcode.app/Contents/Developer/Documentation |
73 rm -rf $DEVKIT_ROOT/Xcode.app/Contents/Developer/usr/share/man |
79 rm -rf $DEVKIT_ROOT/Xcode.app/Contents/Developer/usr/share/man |
74 if [ -e $DEVKIT_ROOT/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk ]; then |
80 ( cd $DEVKIT_ROOT/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs \ |
75 rm -rf $DEVKIT_ROOT/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk |
81 && rm -rf `ls | grep -v ${SDK_VERSION}` ) |
76 rm -rf $DEVKIT_ROOT/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/share/man |
82 rm -rf $DEVKIT_ROOT/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/${SDK_VERSION}.sdk/usr/share/man |
77 fi |
|
78 |
83 |
79 hdiutil detach /Volumes/Xcode |
84 hdiutil detach /Volumes/Xcode |
80 |
85 |
81 ################################################################################ |
86 ################################################################################ |
82 # Copy Freetype into sysroot |
87 # Copy Freetype into sysroot |
89 rm -rf /tmp/XQuartz |
94 rm -rf /tmp/XQuartz |
90 pkgutil --expand /Volumes/XQuartz-*/XQuartz.pkg /tmp/XQuartz/ |
95 pkgutil --expand /Volumes/XQuartz-*/XQuartz.pkg /tmp/XQuartz/ |
91 rm -rf /tmp/x11 |
96 rm -rf /tmp/x11 |
92 mkdir /tmp/x11 |
97 mkdir /tmp/x11 |
93 cd /tmp/x11 |
98 cd /tmp/x11 |
94 cat /tmp/XQuartz-*/x11.pkg/Payload | gunzip -dc |cpio -i |
99 cat /tmp/XQuartz/x11.pkg/Payload | gunzip -dc | cpio -i |
95 |
100 |
|
101 mkdir -p $DEVKIT_ROOT/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/X11/include/ |
|
102 mkdir -p $DEVKIT_ROOT/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/X11/lib/ |
96 cp -RH opt/X11/include/freetype2 \ |
103 cp -RH opt/X11/include/freetype2 \ |
97 $DEVKIT_ROOT/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include/ |
104 $DEVKIT_ROOT/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/X11/include/ |
98 cp -RH opt/X11/include/ft2build.h \ |
105 cp -RH opt/X11/include/ft2build.h \ |
99 $DEVKIT_ROOT/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include/ |
106 $DEVKIT_ROOT/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/X11/include/ |
100 cp -RH opt/X11/lib/libfreetype.* \ |
107 cp -RH opt/X11/lib/libfreetype.* \ |
101 $DEVKIT_ROOT/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/lib/ |
108 $DEVKIT_ROOT/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/X11/lib/ |
102 |
109 |
103 cd - |
110 cd - |
104 |
111 |
105 hdiutil detach /Volumes/XQuartz-* |
112 hdiutil detach /Volumes/XQuartz-* |
|
113 |
|
114 ################################################################################ |
|
115 # Copy gnu make |
|
116 mkdir -p $DEVKIT_ROOT/bin |
|
117 cp $GNU_MAKE $DEVKIT_ROOT/bin |
106 |
118 |
107 ################################################################################ |
119 ################################################################################ |
108 # Optionally copy PackageMaker |
120 # Optionally copy PackageMaker |
109 |
121 |
110 if [ -e "$AUXTOOLS_DMG" ]; then |
122 if [ -e "$AUXTOOLS_DMG" ]; then |
127 } |
139 } |
128 |
140 |
129 echo "Generating devkit.info..." |
141 echo "Generating devkit.info..." |
130 rm -f $DEVKIT_ROOT/devkit.info |
142 rm -f $DEVKIT_ROOT/devkit.info |
131 echo-info "# This file describes to configure how to interpret the contents of this devkit" |
143 echo-info "# This file describes to configure how to interpret the contents of this devkit" |
|
144 echo-info "# The parameters used to create this devkit were:" |
|
145 echo-info "# $*" |
132 echo-info "DEVKIT_NAME=\"Xcode $XCODE_VERSION (devkit)\"" |
146 echo-info "DEVKIT_NAME=\"Xcode $XCODE_VERSION (devkit)\"" |
133 echo-info "DEVKIT_TOOLCHAIN_PATH=\"\$DEVKIT_ROOT/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin:\$DEVKIT_ROOT/Xcode.app/Contents/Developer/usr/bin\"" |
147 echo-info "DEVKIT_TOOLCHAIN_PATH=\"\$DEVKIT_ROOT/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin:\$DEVKIT_ROOT/Xcode.app/Contents/Developer/usr/bin\"" |
134 echo-info "DEVKIT_SYSROOT=\"\$DEVKIT_ROOT/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk\"" |
148 echo-info "DEVKIT_SYSROOT=\"\$DEVKIT_ROOT/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk\"" |
135 echo-info "DEVKIT_EXTRA_PATH=\"\$DEVKIT_ROOT/PackageMaker.app/Contents/MacOS:\$DEVKIT_TOOLCHAIN_PATH\"" |
149 echo-info "DEVKIT_EXTRA_PATH=\"\$DEVKIT_ROOT/bin:\$DEVKIT_ROOT/PackageMaker.app/Contents/MacOS:\$DEVKIT_TOOLCHAIN_PATH\"" |
136 |
150 |
137 ################################################################################ |
151 ################################################################################ |
138 # Copy this script |
152 # Copy this script |
139 |
153 |
140 echo "Copying this script..." |
154 echo "Copying this script..." |