annotate make/devkit/createMacosxDevkit9.sh @ 49578:7c82bb507446

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