make/devkit/createMacosxDevkit.sh
author dsamersoff
Thu, 24 Sep 2015 20:40:12 +0300
changeset 33263 c91d948ab638
parent 31123 2c85f4a793d1
child 33439 1a80e1d10cc4
permissions -rw-r--r--
8086134: Deadlock detection fails to attach to core file Summary: Test reimplemented for jtreg Reviewed-by: jbachorik
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
31123
2c85f4a793d1 8087193: Support building with devkits on Macosx
erikj
parents:
diff changeset
     1
#!/bin/bash
2c85f4a793d1 8087193: Support building with devkits on Macosx
erikj
parents:
diff changeset
     2
#
2c85f4a793d1 8087193: Support building with devkits on Macosx
erikj
parents:
diff changeset
     3
# Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
2c85f4a793d1 8087193: Support building with devkits on Macosx
erikj
parents:
diff changeset
     4
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
2c85f4a793d1 8087193: Support building with devkits on Macosx
erikj
parents:
diff changeset
     5
#
2c85f4a793d1 8087193: Support building with devkits on Macosx
erikj
parents:
diff changeset
     6
# This code is free software; you can redistribute it and/or modify it
2c85f4a793d1 8087193: Support building with devkits on Macosx
erikj
parents:
diff changeset
     7
# under the terms of the GNU General Public License version 2 only, as
2c85f4a793d1 8087193: Support building with devkits on Macosx
erikj
parents:
diff changeset
     8
# published by the Free Software Foundation.  Oracle designates this
2c85f4a793d1 8087193: Support building with devkits on Macosx
erikj
parents:
diff changeset
     9
# particular file as subject to the "Classpath" exception as provided
2c85f4a793d1 8087193: Support building with devkits on Macosx
erikj
parents:
diff changeset
    10
# by Oracle in the LICENSE file that accompanied this code.
2c85f4a793d1 8087193: Support building with devkits on Macosx
erikj
parents:
diff changeset
    11
#
2c85f4a793d1 8087193: Support building with devkits on Macosx
erikj
parents:
diff changeset
    12
# This code is distributed in the hope that it will be useful, but WITHOUT
2c85f4a793d1 8087193: Support building with devkits on Macosx
erikj
parents:
diff changeset
    13
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
2c85f4a793d1 8087193: Support building with devkits on Macosx
erikj
parents:
diff changeset
    14
# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
2c85f4a793d1 8087193: Support building with devkits on Macosx
erikj
parents:
diff changeset
    15
# version 2 for more details (a copy is included in the LICENSE file that
2c85f4a793d1 8087193: Support building with devkits on Macosx
erikj
parents:
diff changeset
    16
# accompanied this code).
2c85f4a793d1 8087193: Support building with devkits on Macosx
erikj
parents:
diff changeset
    17
#
2c85f4a793d1 8087193: Support building with devkits on Macosx
erikj
parents:
diff changeset
    18
# You should have received a copy of the GNU General Public License version
2c85f4a793d1 8087193: Support building with devkits on Macosx
erikj
parents:
diff changeset
    19
# 2 along with this work; if not, write to the Free Software Foundation,
2c85f4a793d1 8087193: Support building with devkits on Macosx
erikj
parents:
diff changeset
    20
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
2c85f4a793d1 8087193: Support building with devkits on Macosx
erikj
parents:
diff changeset
    21
#
2c85f4a793d1 8087193: Support building with devkits on Macosx
erikj
parents:
diff changeset
    22
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
2c85f4a793d1 8087193: Support building with devkits on Macosx
erikj
parents:
diff changeset
    23
# or visit www.oracle.com if you need additional information or have any
2c85f4a793d1 8087193: Support building with devkits on Macosx
erikj
parents:
diff changeset
    24
# questions.
2c85f4a793d1 8087193: Support building with devkits on Macosx
erikj
parents:
diff changeset
    25
#
2c85f4a793d1 8087193: Support building with devkits on Macosx
erikj
parents:
diff changeset
    26
2c85f4a793d1 8087193: Support building with devkits on Macosx
erikj
parents:
diff changeset
    27
# This script copies part of an Xcode installer into a devkit suitable
2c85f4a793d1 8087193: Support building with devkits on Macosx
erikj
parents:
diff changeset
    28
# for building OpenJDK and OracleJDK. The installation .dmg files for Xcode
2c85f4a793d1 8087193: Support building with devkits on Macosx
erikj
parents:
diff changeset
    29
# and the aux tools need to be available.
2c85f4a793d1 8087193: Support building with devkits on Macosx
erikj
parents:
diff changeset
    30
# erik.joelsson@oracle.com
2c85f4a793d1 8087193: Support building with devkits on Macosx
erikj
parents:
diff changeset
    31
2c85f4a793d1 8087193: Support building with devkits on Macosx
erikj
parents:
diff changeset
    32
USAGE="$0 <Xcode.dmg> <XQuartz.dmg> [<auxtools.dmg>]"
2c85f4a793d1 8087193: Support building with devkits on Macosx
erikj
parents:
diff changeset
    33
2c85f4a793d1 8087193: Support building with devkits on Macosx
erikj
parents:
diff changeset
    34
if [ "$1" = "" ] || [ "$2" = "" ]; then
2c85f4a793d1 8087193: Support building with devkits on Macosx
erikj
parents:
diff changeset
    35
    echo $USAGE
2c85f4a793d1 8087193: Support building with devkits on Macosx
erikj
parents:
diff changeset
    36
    exit 1
2c85f4a793d1 8087193: Support building with devkits on Macosx
erikj
parents:
diff changeset
    37
fi
2c85f4a793d1 8087193: Support building with devkits on Macosx
erikj
parents:
diff changeset
    38
2c85f4a793d1 8087193: Support building with devkits on Macosx
erikj
parents:
diff changeset
    39
XCODE_DMG="$1"
2c85f4a793d1 8087193: Support building with devkits on Macosx
erikj
parents:
diff changeset
    40
XQUARTZ_DMG="$2"
2c85f4a793d1 8087193: Support building with devkits on Macosx
erikj
parents:
diff changeset
    41
AUXTOOLS_DMG="$3"
2c85f4a793d1 8087193: Support building with devkits on Macosx
erikj
parents:
diff changeset
    42
2c85f4a793d1 8087193: Support building with devkits on Macosx
erikj
parents:
diff changeset
    43
SCRIPT_DIR="$(cd "$(dirname $0)" > /dev/null && pwd)"
2c85f4a793d1 8087193: Support building with devkits on Macosx
erikj
parents:
diff changeset
    44
BUILD_DIR="${SCRIPT_DIR}/../../build/devkit"
2c85f4a793d1 8087193: Support building with devkits on Macosx
erikj
parents:
diff changeset
    45
2c85f4a793d1 8087193: Support building with devkits on Macosx
erikj
parents:
diff changeset
    46
# Mount XCODE_DMG
2c85f4a793d1 8087193: Support building with devkits on Macosx
erikj
parents:
diff changeset
    47
if [ -e "/Volumes/Xcode" ]; then
2c85f4a793d1 8087193: Support building with devkits on Macosx
erikj
parents:
diff changeset
    48
    hdiutil detach /Volumes/Xcode
2c85f4a793d1 8087193: Support building with devkits on Macosx
erikj
parents:
diff changeset
    49
fi
2c85f4a793d1 8087193: Support building with devkits on Macosx
erikj
parents:
diff changeset
    50
hdiutil attach $XCODE_DMG
2c85f4a793d1 8087193: Support building with devkits on Macosx
erikj
parents:
diff changeset
    51
2c85f4a793d1 8087193: Support building with devkits on Macosx
erikj
parents:
diff changeset
    52
# Find the version of Xcode
2c85f4a793d1 8087193: Support building with devkits on Macosx
erikj
parents:
diff changeset
    53
XCODE_VERSION="$(/Volumes/Xcode/Xcode.app/Contents/Developer/usr/bin/xcodebuild -version \
2c85f4a793d1 8087193: Support building with devkits on Macosx
erikj
parents:
diff changeset
    54
    | awk '/Xcode/ { print $2 }' )"
2c85f4a793d1 8087193: Support building with devkits on Macosx
erikj
parents:
diff changeset
    55
2c85f4a793d1 8087193: Support building with devkits on Macosx
erikj
parents:
diff changeset
    56
DEVKIT_ROOT="${BUILD_DIR}/Xcode${XCODE_VERSION}-devkit"
2c85f4a793d1 8087193: Support building with devkits on Macosx
erikj
parents:
diff changeset
    57
DEVKIT_BUNDLE="${DEVKIT_ROOT}.tar.gz"
2c85f4a793d1 8087193: Support building with devkits on Macosx
erikj
parents:
diff changeset
    58
2c85f4a793d1 8087193: Support building with devkits on Macosx
erikj
parents:
diff changeset
    59
echo "Xcode version: $XCODE_VERSION"
2c85f4a793d1 8087193: Support building with devkits on Macosx
erikj
parents:
diff changeset
    60
echo "Creating devkit in $DEVKIT_ROOT"
2c85f4a793d1 8087193: Support building with devkits on Macosx
erikj
parents:
diff changeset
    61
2c85f4a793d1 8087193: Support building with devkits on Macosx
erikj
parents:
diff changeset
    62
################################################################################
2c85f4a793d1 8087193: Support building with devkits on Macosx
erikj
parents:
diff changeset
    63
# Copy files to root
2c85f4a793d1 8087193: Support building with devkits on Macosx
erikj
parents:
diff changeset
    64
mkdir -p $DEVKIT_ROOT
2c85f4a793d1 8087193: Support building with devkits on Macosx
erikj
parents:
diff changeset
    65
if [ ! -d $DEVKIT_ROOT/Xcode.app ]; then
2c85f4a793d1 8087193: Support building with devkits on Macosx
erikj
parents:
diff changeset
    66
    echo "Copying Xcode.app..."
2c85f4a793d1 8087193: Support building with devkits on Macosx
erikj
parents:
diff changeset
    67
    cp -RH "/Volumes/Xcode/Xcode.app" $DEVKIT_ROOT/
2c85f4a793d1 8087193: Support building with devkits on Macosx
erikj
parents:
diff changeset
    68
fi
2c85f4a793d1 8087193: Support building with devkits on Macosx
erikj
parents:
diff changeset
    69
# Trim out some seemingly unneeded parts to save space.
2c85f4a793d1 8087193: Support building with devkits on Macosx
erikj
parents:
diff changeset
    70
rm -rf $DEVKIT_ROOT/Xcode.app/Contents/Applications
2c85f4a793d1 8087193: Support building with devkits on Macosx
erikj
parents:
diff changeset
    71
rm -rf $DEVKIT_ROOT/Xcode.app/Contents/Developer/Platforms/iPhone*
2c85f4a793d1 8087193: Support building with devkits on Macosx
erikj
parents:
diff changeset
    72
rm -rf $DEVKIT_ROOT/Xcode.app/Contents/Developer/Documentation
2c85f4a793d1 8087193: Support building with devkits on Macosx
erikj
parents:
diff changeset
    73
rm -rf $DEVKIT_ROOT/Xcode.app/Contents/Developer/usr/share/man
2c85f4a793d1 8087193: Support building with devkits on Macosx
erikj
parents:
diff changeset
    74
if [ -e $DEVKIT_ROOT/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk ]; then
2c85f4a793d1 8087193: Support building with devkits on Macosx
erikj
parents:
diff changeset
    75
    rm -rf $DEVKIT_ROOT/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk
2c85f4a793d1 8087193: Support building with devkits on Macosx
erikj
parents:
diff changeset
    76
    rm -rf $DEVKIT_ROOT/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/share/man
2c85f4a793d1 8087193: Support building with devkits on Macosx
erikj
parents:
diff changeset
    77
fi
2c85f4a793d1 8087193: Support building with devkits on Macosx
erikj
parents:
diff changeset
    78
2c85f4a793d1 8087193: Support building with devkits on Macosx
erikj
parents:
diff changeset
    79
hdiutil detach /Volumes/Xcode
2c85f4a793d1 8087193: Support building with devkits on Macosx
erikj
parents:
diff changeset
    80
2c85f4a793d1 8087193: Support building with devkits on Macosx
erikj
parents:
diff changeset
    81
################################################################################
2c85f4a793d1 8087193: Support building with devkits on Macosx
erikj
parents:
diff changeset
    82
# Copy Freetype into sysroot
2c85f4a793d1 8087193: Support building with devkits on Macosx
erikj
parents:
diff changeset
    83
if [ -e "/Volumes/XQuartz-*" ]; then
2c85f4a793d1 8087193: Support building with devkits on Macosx
erikj
parents:
diff changeset
    84
    hdiutil detach /Volumes/XQuartz-*
2c85f4a793d1 8087193: Support building with devkits on Macosx
erikj
parents:
diff changeset
    85
fi
2c85f4a793d1 8087193: Support building with devkits on Macosx
erikj
parents:
diff changeset
    86
hdiutil attach $XQUARTZ_DMG
2c85f4a793d1 8087193: Support building with devkits on Macosx
erikj
parents:
diff changeset
    87
2c85f4a793d1 8087193: Support building with devkits on Macosx
erikj
parents:
diff changeset
    88
echo "Copying freetype..."
2c85f4a793d1 8087193: Support building with devkits on Macosx
erikj
parents:
diff changeset
    89
rm -rf /tmp/XQuartz
2c85f4a793d1 8087193: Support building with devkits on Macosx
erikj
parents:
diff changeset
    90
pkgutil --expand /Volumes/XQuartz-*/XQuartz.pkg /tmp/XQuartz/
2c85f4a793d1 8087193: Support building with devkits on Macosx
erikj
parents:
diff changeset
    91
rm -rf /tmp/x11
2c85f4a793d1 8087193: Support building with devkits on Macosx
erikj
parents:
diff changeset
    92
mkdir /tmp/x11
2c85f4a793d1 8087193: Support building with devkits on Macosx
erikj
parents:
diff changeset
    93
cd /tmp/x11
2c85f4a793d1 8087193: Support building with devkits on Macosx
erikj
parents:
diff changeset
    94
cat /tmp/XQuartz-*/x11.pkg/Payload | gunzip -dc |cpio -i
2c85f4a793d1 8087193: Support building with devkits on Macosx
erikj
parents:
diff changeset
    95
2c85f4a793d1 8087193: Support building with devkits on Macosx
erikj
parents:
diff changeset
    96
cp -RH opt/X11/include/freetype2 \
2c85f4a793d1 8087193: Support building with devkits on Macosx
erikj
parents:
diff changeset
    97
    $DEVKIT_ROOT/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include/
2c85f4a793d1 8087193: Support building with devkits on Macosx
erikj
parents:
diff changeset
    98
cp -RH opt/X11/include/ft2build.h \
2c85f4a793d1 8087193: Support building with devkits on Macosx
erikj
parents:
diff changeset
    99
    $DEVKIT_ROOT/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include/
2c85f4a793d1 8087193: Support building with devkits on Macosx
erikj
parents:
diff changeset
   100
cp -RH opt/X11/lib/libfreetype.* \
2c85f4a793d1 8087193: Support building with devkits on Macosx
erikj
parents:
diff changeset
   101
    $DEVKIT_ROOT/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/lib/
2c85f4a793d1 8087193: Support building with devkits on Macosx
erikj
parents:
diff changeset
   102
2c85f4a793d1 8087193: Support building with devkits on Macosx
erikj
parents:
diff changeset
   103
cd -
2c85f4a793d1 8087193: Support building with devkits on Macosx
erikj
parents:
diff changeset
   104
2c85f4a793d1 8087193: Support building with devkits on Macosx
erikj
parents:
diff changeset
   105
hdiutil detach /Volumes/XQuartz-*
2c85f4a793d1 8087193: Support building with devkits on Macosx
erikj
parents:
diff changeset
   106
2c85f4a793d1 8087193: Support building with devkits on Macosx
erikj
parents:
diff changeset
   107
################################################################################
2c85f4a793d1 8087193: Support building with devkits on Macosx
erikj
parents:
diff changeset
   108
# Optionally copy PackageMaker
2c85f4a793d1 8087193: Support building with devkits on Macosx
erikj
parents:
diff changeset
   109
2c85f4a793d1 8087193: Support building with devkits on Macosx
erikj
parents:
diff changeset
   110
if [ -e "$AUXTOOLS_DMG" ]; then
2c85f4a793d1 8087193: Support building with devkits on Macosx
erikj
parents:
diff changeset
   111
    if [ -e "/Volumes/Auxiliary Tools" ]; then
2c85f4a793d1 8087193: Support building with devkits on Macosx
erikj
parents:
diff changeset
   112
        hdiutil detach "/Volumes/Auxiliary Tools"
2c85f4a793d1 8087193: Support building with devkits on Macosx
erikj
parents:
diff changeset
   113
    fi
2c85f4a793d1 8087193: Support building with devkits on Macosx
erikj
parents:
diff changeset
   114
    hdiutil attach $AUXTOOLS_DMG
2c85f4a793d1 8087193: Support building with devkits on Macosx
erikj
parents:
diff changeset
   115
2c85f4a793d1 8087193: Support building with devkits on Macosx
erikj
parents:
diff changeset
   116
    echo "Copying PackageMaker.app..."
2c85f4a793d1 8087193: Support building with devkits on Macosx
erikj
parents:
diff changeset
   117
    cp -RH "/Volumes/Auxiliary Tools/PackageMaker.app" $DEVKIT_ROOT/
2c85f4a793d1 8087193: Support building with devkits on Macosx
erikj
parents:
diff changeset
   118
2c85f4a793d1 8087193: Support building with devkits on Macosx
erikj
parents:
diff changeset
   119
    hdiutil detach "/Volumes/Auxiliary Tools"
2c85f4a793d1 8087193: Support building with devkits on Macosx
erikj
parents:
diff changeset
   120
fi
2c85f4a793d1 8087193: Support building with devkits on Macosx
erikj
parents:
diff changeset
   121
2c85f4a793d1 8087193: Support building with devkits on Macosx
erikj
parents:
diff changeset
   122
################################################################################
2c85f4a793d1 8087193: Support building with devkits on Macosx
erikj
parents:
diff changeset
   123
# Generate devkit.info
2c85f4a793d1 8087193: Support building with devkits on Macosx
erikj
parents:
diff changeset
   124
2c85f4a793d1 8087193: Support building with devkits on Macosx
erikj
parents:
diff changeset
   125
echo-info() {
2c85f4a793d1 8087193: Support building with devkits on Macosx
erikj
parents:
diff changeset
   126
    echo "$1" >> $DEVKIT_ROOT/devkit.info
2c85f4a793d1 8087193: Support building with devkits on Macosx
erikj
parents:
diff changeset
   127
}
2c85f4a793d1 8087193: Support building with devkits on Macosx
erikj
parents:
diff changeset
   128
2c85f4a793d1 8087193: Support building with devkits on Macosx
erikj
parents:
diff changeset
   129
echo "Generating devkit.info..."
2c85f4a793d1 8087193: Support building with devkits on Macosx
erikj
parents:
diff changeset
   130
rm -f $DEVKIT_ROOT/devkit.info
2c85f4a793d1 8087193: Support building with devkits on Macosx
erikj
parents:
diff changeset
   131
echo-info "# This file describes to configure how to interpret the contents of this devkit"
2c85f4a793d1 8087193: Support building with devkits on Macosx
erikj
parents:
diff changeset
   132
echo-info "DEVKIT_NAME=\"Xcode $XCODE_VERSION (devkit)\""
2c85f4a793d1 8087193: Support building with devkits on Macosx
erikj
parents:
diff changeset
   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\""
2c85f4a793d1 8087193: Support building with devkits on Macosx
erikj
parents:
diff changeset
   134
echo-info "DEVKIT_SYSROOT=\"\$DEVKIT_ROOT/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk\""
2c85f4a793d1 8087193: Support building with devkits on Macosx
erikj
parents:
diff changeset
   135
echo-info "DEVKIT_EXTRA_PATH=\"\$DEVKIT_ROOT/PackageMaker.app/Contents/MacOS:\$DEVKIT_TOOLCHAIN_PATH\""
2c85f4a793d1 8087193: Support building with devkits on Macosx
erikj
parents:
diff changeset
   136
2c85f4a793d1 8087193: Support building with devkits on Macosx
erikj
parents:
diff changeset
   137
################################################################################
2c85f4a793d1 8087193: Support building with devkits on Macosx
erikj
parents:
diff changeset
   138
# Copy this script
2c85f4a793d1 8087193: Support building with devkits on Macosx
erikj
parents:
diff changeset
   139
2c85f4a793d1 8087193: Support building with devkits on Macosx
erikj
parents:
diff changeset
   140
echo "Copying this script..."
2c85f4a793d1 8087193: Support building with devkits on Macosx
erikj
parents:
diff changeset
   141
cp $0 $DEVKIT_ROOT/
2c85f4a793d1 8087193: Support building with devkits on Macosx
erikj
parents:
diff changeset
   142
2c85f4a793d1 8087193: Support building with devkits on Macosx
erikj
parents:
diff changeset
   143
################################################################################
2c85f4a793d1 8087193: Support building with devkits on Macosx
erikj
parents:
diff changeset
   144
# Create bundle
2c85f4a793d1 8087193: Support building with devkits on Macosx
erikj
parents:
diff changeset
   145
2c85f4a793d1 8087193: Support building with devkits on Macosx
erikj
parents:
diff changeset
   146
echo "Creating bundle..."
2c85f4a793d1 8087193: Support building with devkits on Macosx
erikj
parents:
diff changeset
   147
(cd $DEVKIT_ROOT && tar c - . | gzip - > "$DEVKIT_BUNDLE")