author | herrick |
Thu, 28 Mar 2019 13:49:38 -0400 | |
branch | JDK-8200758-branch |
changeset 57292 | 7a683c461b80 |
parent 53993 | 271f75d4b494 |
permissions | -rw-r--r-- |
48755 | 1 |
#!/bin/bash |
2 |
# |
|
53993
271f75d4b494
8219986: Change to Xcode 10.1 for building on Macosx at Oracle
erikj
parents:
48755
diff
changeset
|
3 |
# Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved. |
48755 | 4 |
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
5 |
# |
|
6 |
# This code is free software; you can redistribute it and/or modify it |
|
7 |
# under the terms of the GNU General Public License version 2 only, as |
|
8 |
# published by the Free Software Foundation. Oracle designates this |
|
9 |
# particular file as subject to the "Classpath" exception as provided |
|
10 |
# by Oracle in the LICENSE file that accompanied this code. |
|
11 |
# |
|
12 |
# This code is distributed in the hope that it will be useful, but WITHOUT |
|
13 |
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
14 |
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
15 |
# version 2 for more details (a copy is included in the LICENSE file that |
|
16 |
# accompanied this code). |
|
17 |
# |
|
18 |
# You should have received a copy of the GNU General Public License version |
|
19 |
# 2 along with this work; if not, write to the Free Software Foundation, |
|
20 |
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
|
21 |
# |
|
22 |
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
|
23 |
# or visit www.oracle.com if you need additional information or have any |
|
24 |
# questions. |
|
25 |
# |
|
26 |
||
27 |
# This script copies parts of an Xcode installation into a devkit suitable |
|
28 |
# for building OpenJDK and OracleJDK. The installation Xcode_X.X.xip needs |
|
29 |
# to be either installed or extracted using for example Archive Utility. |
|
30 |
# The easiest way to accomplish this is to right click the file in Finder |
|
31 |
# and choose "Open With -> Archive Utility", or possible typing |
|
32 |
# "open Xcode_9.2.xip" in a terminal. |
|
33 |
# erik.joelsson@oracle.com |
|
34 |
||
35 |
USAGE="$0 <Xcode.app>" |
|
36 |
||
37 |
if [ "$1" = "" ]; then |
|
38 |
echo $USAGE |
|
39 |
exit 1 |
|
40 |
fi |
|
41 |
||
42 |
XCODE_APP="$1" |
|
43 |
XCODE_APP_DIR_NAME="${XCODE_APP##*/}" |
|
44 |
||
45 |
SCRIPT_DIR="$(cd "$(dirname $0)" > /dev/null && pwd)" |
|
46 |
BUILD_DIR="${SCRIPT_DIR}/../../build/devkit" |
|
47 |
||
48 |
# Find the version of Xcode |
|
49 |
XCODE_VERSION="$($XCODE_APP/Contents/Developer/usr/bin/xcodebuild -version \ |
|
50 |
| awk '/Xcode/ { print $2 }' )" |
|
53993
271f75d4b494
8219986: Change to Xcode 10.1 for building on Macosx at Oracle
erikj
parents:
48755
diff
changeset
|
51 |
SDK_VERSION="$(ls $XCODE_APP/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs \ |
271f75d4b494
8219986: Change to Xcode 10.1 for building on Macosx at Oracle
erikj
parents:
48755
diff
changeset
|
52 |
| grep [0-9] | sort -r | head -n1 | sed 's/\.sdk//')" |
48755 | 53 |
|
54 |
DEVKIT_ROOT="${BUILD_DIR}/Xcode${XCODE_VERSION}-${SDK_VERSION}" |
|
55 |
DEVKIT_BUNDLE="${DEVKIT_ROOT}.tar.gz" |
|
56 |
||
57 |
echo "Xcode version: $XCODE_VERSION" |
|
53993
271f75d4b494
8219986: Change to Xcode 10.1 for building on Macosx at Oracle
erikj
parents:
48755
diff
changeset
|
58 |
echo "SDK version: $SDK_VERSION" |
48755 | 59 |
echo "Creating devkit in $DEVKIT_ROOT" |
60 |
||
61 |
mkdir -p $DEVKIT_ROOT |
|
62 |
||
63 |
################################################################################ |
|
64 |
# Copy the relevant parts of Xcode.app, removing things that are both big and |
|
65 |
# unecessary for our purposes, without building an impossibly long exclude list. |
|
66 |
# |
|
67 |
# Not including WatchSimulator.platform makes ibtool crashes in some situations. |
|
68 |
# It doesn't seem to matter which extra platform is included, but that is the |
|
69 |
# smallest one. |
|
70 |
||
71 |
EXCLUDE_DIRS=" \ |
|
72 |
Contents/_CodeSignature \ |
|
73 |
$XCODE_APP_DIR_NAME/Contents/Applications \ |
|
74 |
$XCODE_APP_DIR_NAME/Contents/Resources \ |
|
75 |
$XCODE_APP_DIR_NAME/Contents/Library \ |
|
76 |
$XCODE_APP_DIR_NAME/Contents/XPCServices \ |
|
77 |
$XCODE_APP_DIR_NAME/Contents/OtherFrameworks \ |
|
78 |
$XCODE_APP_DIR_NAME/Contents/Developer/Documentation \ |
|
79 |
$XCODE_APP_DIR_NAME/Contents/Developer/usr/share \ |
|
80 |
$XCODE_APP_DIR_NAME/Contents/Developer/usr/libexec/git-core \ |
|
81 |
$XCODE_APP_DIR_NAME/Contents/Developer/usr/bin/git* \ |
|
82 |
$XCODE_APP_DIR_NAME/Contents/Developer/usr/bin/svn* \ |
|
83 |
$XCODE_APP_DIR_NAME/Contents/Developer/usr/lib/libgit* \ |
|
84 |
$XCODE_APP_DIR_NAME/Contents/Developer/usr/lib/libsvn* \ |
|
85 |
$XCODE_APP_DIR_NAME/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/share/man \ |
|
86 |
$XCODE_APP_DIR_NAME/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/${SDK_VERSION}.sdk/usr/share/man \ |
|
87 |
$XCODE_APP_DIR_NAME/Contents/Developer/Platforms/MacOSX.platform/Developer/usr/share/man \ |
|
88 |
$XCODE_APP_DIR_NAME/Contents/Developer/Platforms/MacOSX.platform/usr \ |
|
89 |
$XCODE_APP_DIR_NAME/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/share/man \ |
|
90 |
$XCODE_APP_DIR_NAME/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift* \ |
|
91 |
$XCODE_APP_DIR_NAME/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift* \ |
|
92 |
$XCODE_APP_DIR_NAME/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/sourcekitd.framework \ |
|
93 |
$XCODE_APP_DIR_NAME/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/libexec/swift* \ |
|
94 |
$XCODE_APP_DIR_NAME/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/swift* \ |
|
95 |
$XCODE_APP_DIR_NAME/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/arc \ |
|
96 |
Platforms/AppleTVSimulator.platform \ |
|
97 |
Platforms/iPhoneSimulator.platform \ |
|
98 |
$XCODE_APP_DIR_NAME/Contents/SharedFrameworks/LLDB.framework \ |
|
99 |
$XCODE_APP_DIR_NAME/Contents/SharedFrameworks/ModelIO.framework \ |
|
100 |
$XCODE_APP_DIR_NAME/Contents/SharedFrameworks/XCSUI.framework \ |
|
101 |
$XCODE_APP_DIR_NAME/Contents/SharedFrameworks/SceneKit.framework \ |
|
102 |
$XCODE_APP_DIR_NAME/Contents/SharedFrameworks/XCBuild.framework \ |
|
103 |
$XCODE_APP_DIR_NAME/Contents/SharedFrameworks/GPUTools.framework \ |
|
104 |
$(cd $XCODE_APP/.. && ls -d $XCODE_APP_DIR_NAME/Contents/Developer/Platforms/* \ |
|
105 |
| grep -v MacOSX.platform | grep -v WatchSimulator.platform) \ |
|
106 |
" |
|
107 |
||
108 |
for ex in $EXCLUDE_DIRS; do |
|
109 |
EXCLUDE_ARGS+="--exclude=$ex " |
|
110 |
done |
|
111 |
||
112 |
echo "Copying Xcode.app..." |
|
113 |
echo rsync -rlH $INCLUDE_ARGS $EXCLUDE_ARGS "$XCODE_APP" $DEVKIT_ROOT/ |
|
114 |
rsync -rlH $INCLUDE_ARGS $EXCLUDE_ARGS "$XCODE_APP" $DEVKIT_ROOT/ |
|
115 |
||
116 |
################################################################################ |
|
117 |
||
118 |
echo-info() { |
|
119 |
echo "$1" >> $DEVKIT_ROOT/devkit.info |
|
120 |
} |
|
121 |
||
122 |
echo "Generating devkit.info..." |
|
123 |
rm -f $DEVKIT_ROOT/devkit.info |
|
124 |
echo-info "# This file describes to configure how to interpret the contents of this devkit" |
|
125 |
echo-info "DEVKIT_NAME=\"Xcode $XCODE_VERSION (devkit)\"" |
|
126 |
echo-info "DEVKIT_TOOLCHAIN_PATH=\"\$DEVKIT_ROOT/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin:\$DEVKIT_ROOT/Xcode.app/Contents/Developer/usr/bin\"" |
|
127 |
echo-info "DEVKIT_SYSROOT=\"\$DEVKIT_ROOT/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/$SDK_VERSION.sdk\"" |
|
128 |
echo-info "DEVKIT_EXTRA_PATH=\"\$DEVKIT_TOOLCHAIN_PATH\"" |
|
129 |
||
130 |
################################################################################ |
|
131 |
# Copy this script |
|
132 |
||
133 |
echo "Copying this script..." |
|
134 |
cp $0 $DEVKIT_ROOT/ |
|
135 |
||
136 |
################################################################################ |
|
137 |
# Create bundle |
|
138 |
||
139 |
echo "Creating bundle..." |
|
140 |
GZIP=$(command -v pigz) |
|
141 |
if [ -z "$GZIP" ]; then |
|
142 |
GZIP="gzip" |
|
143 |
fi |
|
144 |
(cd $DEVKIT_ROOT && tar c - . | $GZIP - > "$DEVKIT_BUNDLE") |