make/devkit/createWindowsDevkit.sh
author iris
Mon, 09 Nov 2015 10:56:51 -0800
changeset 33978 85f795d2c0c9
parent 33029 06a8c5e5959b
child 36283 690f25ee7152
permissions -rw-r--r--
Merge
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
31124
5faf40426878 8087208: Add devkit creation script for windows
erikj
parents:
diff changeset
     1
#!/bin/bash
5faf40426878 8087208: Add devkit creation script for windows
erikj
parents:
diff changeset
     2
#
5faf40426878 8087208: Add devkit creation script for windows
erikj
parents:
diff changeset
     3
# Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
5faf40426878 8087208: Add devkit creation script for windows
erikj
parents:
diff changeset
     4
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5faf40426878 8087208: Add devkit creation script for windows
erikj
parents:
diff changeset
     5
#
5faf40426878 8087208: Add devkit creation script for windows
erikj
parents:
diff changeset
     6
# This code is free software; you can redistribute it and/or modify it
5faf40426878 8087208: Add devkit creation script for windows
erikj
parents:
diff changeset
     7
# under the terms of the GNU General Public License version 2 only, as
5faf40426878 8087208: Add devkit creation script for windows
erikj
parents:
diff changeset
     8
# published by the Free Software Foundation.  Oracle designates this
5faf40426878 8087208: Add devkit creation script for windows
erikj
parents:
diff changeset
     9
# particular file as subject to the "Classpath" exception as provided
5faf40426878 8087208: Add devkit creation script for windows
erikj
parents:
diff changeset
    10
# by Oracle in the LICENSE file that accompanied this code.
5faf40426878 8087208: Add devkit creation script for windows
erikj
parents:
diff changeset
    11
#
5faf40426878 8087208: Add devkit creation script for windows
erikj
parents:
diff changeset
    12
# This code is distributed in the hope that it will be useful, but WITHOUT
5faf40426878 8087208: Add devkit creation script for windows
erikj
parents:
diff changeset
    13
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
5faf40426878 8087208: Add devkit creation script for windows
erikj
parents:
diff changeset
    14
# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
5faf40426878 8087208: Add devkit creation script for windows
erikj
parents:
diff changeset
    15
# version 2 for more details (a copy is included in the LICENSE file that
5faf40426878 8087208: Add devkit creation script for windows
erikj
parents:
diff changeset
    16
# accompanied this code).
5faf40426878 8087208: Add devkit creation script for windows
erikj
parents:
diff changeset
    17
#
5faf40426878 8087208: Add devkit creation script for windows
erikj
parents:
diff changeset
    18
# You should have received a copy of the GNU General Public License version
5faf40426878 8087208: Add devkit creation script for windows
erikj
parents:
diff changeset
    19
# 2 along with this work; if not, write to the Free Software Foundation,
5faf40426878 8087208: Add devkit creation script for windows
erikj
parents:
diff changeset
    20
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
5faf40426878 8087208: Add devkit creation script for windows
erikj
parents:
diff changeset
    21
#
5faf40426878 8087208: Add devkit creation script for windows
erikj
parents:
diff changeset
    22
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
5faf40426878 8087208: Add devkit creation script for windows
erikj
parents:
diff changeset
    23
# or visit www.oracle.com if you need additional information or have any
5faf40426878 8087208: Add devkit creation script for windows
erikj
parents:
diff changeset
    24
# questions.
5faf40426878 8087208: Add devkit creation script for windows
erikj
parents:
diff changeset
    25
#
5faf40426878 8087208: Add devkit creation script for windows
erikj
parents:
diff changeset
    26
5faf40426878 8087208: Add devkit creation script for windows
erikj
parents:
diff changeset
    27
# This script copies parts of a Visual Studio 2013 installation into a devkit
5faf40426878 8087208: Add devkit creation script for windows
erikj
parents:
diff changeset
    28
# suitable for building OpenJDK and OracleJDK. Needs to run in Cygwin.
5faf40426878 8087208: Add devkit creation script for windows
erikj
parents:
diff changeset
    29
# erik.joelsson@oracle.com
5faf40426878 8087208: Add devkit creation script for windows
erikj
parents:
diff changeset
    30
5faf40426878 8087208: Add devkit creation script for windows
erikj
parents:
diff changeset
    31
VS_VERSION="2013"
5faf40426878 8087208: Add devkit creation script for windows
erikj
parents:
diff changeset
    32
VS_VERSION_NUM="12.0"
5faf40426878 8087208: Add devkit creation script for windows
erikj
parents:
diff changeset
    33
VS_VERSION_NUM_NODOT="120"
5faf40426878 8087208: Add devkit creation script for windows
erikj
parents:
diff changeset
    34
SDK_VERSION="8.1"
33029
06a8c5e5959b 8139735: Switch compilers in JPRT for windows and linux
erikj
parents: 31124
diff changeset
    35
VS_VERSION_SP="SP4"
31124
5faf40426878 8087208: Add devkit creation script for windows
erikj
parents:
diff changeset
    36
5faf40426878 8087208: Add devkit creation script for windows
erikj
parents:
diff changeset
    37
SCRIPT_DIR="$(cd "$(dirname $0)" > /dev/null && pwd)"
5faf40426878 8087208: Add devkit creation script for windows
erikj
parents:
diff changeset
    38
BUILD_DIR="${SCRIPT_DIR}/../../build/devkit"
33029
06a8c5e5959b 8139735: Switch compilers in JPRT for windows and linux
erikj
parents: 31124
diff changeset
    39
DEVKIT_ROOT="${BUILD_DIR}/VS${VS_VERSION}${VS_VERSION_SP}-devkit"
31124
5faf40426878 8087208: Add devkit creation script for windows
erikj
parents:
diff changeset
    40
DEVKIT_BUNDLE="${DEVKIT_ROOT}.tar.gz"
5faf40426878 8087208: Add devkit creation script for windows
erikj
parents:
diff changeset
    41
5faf40426878 8087208: Add devkit creation script for windows
erikj
parents:
diff changeset
    42
echo "Creating devkit in $DEVKIT_ROOT"
5faf40426878 8087208: Add devkit creation script for windows
erikj
parents:
diff changeset
    43
5faf40426878 8087208: Add devkit creation script for windows
erikj
parents:
diff changeset
    44
MSVCR_DLL=Microsoft.VC${VS_VERSION_NUM_NODOT}.CRT/msvcr${VS_VERSION_NUM_NODOT}.dll
5faf40426878 8087208: Add devkit creation script for windows
erikj
parents:
diff changeset
    45
MSVCP_DLL=Microsoft.VC${VS_VERSION_NUM_NODOT}.CRT/msvcp${VS_VERSION_NUM_NODOT}.dll
5faf40426878 8087208: Add devkit creation script for windows
erikj
parents:
diff changeset
    46
5faf40426878 8087208: Add devkit creation script for windows
erikj
parents:
diff changeset
    47
################################################################################
5faf40426878 8087208: Add devkit creation script for windows
erikj
parents:
diff changeset
    48
# Copy Visual Studio files
5faf40426878 8087208: Add devkit creation script for windows
erikj
parents:
diff changeset
    49
5faf40426878 8087208: Add devkit creation script for windows
erikj
parents:
diff changeset
    50
eval VSNNNCOMNTOOLS="\"\${VS${VS_VERSION_NUM_NODOT}COMNTOOLS}\""
5faf40426878 8087208: Add devkit creation script for windows
erikj
parents:
diff changeset
    51
VS_INSTALL_DIR="$(cygpath "$VSNNNCOMNTOOLS/../..")"
5faf40426878 8087208: Add devkit creation script for windows
erikj
parents:
diff changeset
    52
echo "VS_INSTALL_DIR: $VS_INSTALL_DIR"
5faf40426878 8087208: Add devkit creation script for windows
erikj
parents:
diff changeset
    53
5faf40426878 8087208: Add devkit creation script for windows
erikj
parents:
diff changeset
    54
if [ ! -d $DEVKIT_ROOT/VC ]; then
5faf40426878 8087208: Add devkit creation script for windows
erikj
parents:
diff changeset
    55
    echo "Copying VC..."
5faf40426878 8087208: Add devkit creation script for windows
erikj
parents:
diff changeset
    56
    mkdir -p $DEVKIT_ROOT/VC/bin
5faf40426878 8087208: Add devkit creation script for windows
erikj
parents:
diff changeset
    57
    cp -r "$VS_INSTALL_DIR/VC/bin/amd64" $DEVKIT_ROOT/VC/bin/
5faf40426878 8087208: Add devkit creation script for windows
erikj
parents:
diff changeset
    58
    cp    "$VS_INSTALL_DIR/VC/bin/"*.* $DEVKIT_ROOT/VC/bin/
5faf40426878 8087208: Add devkit creation script for windows
erikj
parents:
diff changeset
    59
    cp -r "$VS_INSTALL_DIR/VC/bin/1033/" $DEVKIT_ROOT/VC/bin/
5faf40426878 8087208: Add devkit creation script for windows
erikj
parents:
diff changeset
    60
    mkdir -p $DEVKIT_ROOT/VC/lib
5faf40426878 8087208: Add devkit creation script for windows
erikj
parents:
diff changeset
    61
    cp -r "$VS_INSTALL_DIR/VC/lib/amd64" $DEVKIT_ROOT/VC/lib/
5faf40426878 8087208: Add devkit creation script for windows
erikj
parents:
diff changeset
    62
    cp    "$VS_INSTALL_DIR/VC/lib/"*.* $DEVKIT_ROOT/VC/lib/
5faf40426878 8087208: Add devkit creation script for windows
erikj
parents:
diff changeset
    63
    cp -r "$VS_INSTALL_DIR/VC/include" $DEVKIT_ROOT/VC/
5faf40426878 8087208: Add devkit creation script for windows
erikj
parents:
diff changeset
    64
    mkdir -p $DEVKIT_ROOT/VC/atlmfc/lib
5faf40426878 8087208: Add devkit creation script for windows
erikj
parents:
diff changeset
    65
    cp -r "$VS_INSTALL_DIR/VC/atlmfc/include" $DEVKIT_ROOT/VC/atlmfc/
5faf40426878 8087208: Add devkit creation script for windows
erikj
parents:
diff changeset
    66
    cp -r "$VS_INSTALL_DIR/VC/atlmfc/lib/amd64" $DEVKIT_ROOT/VC/atlmfc/lib/
5faf40426878 8087208: Add devkit creation script for windows
erikj
parents:
diff changeset
    67
    cp    "$VS_INSTALL_DIR/VC/atlmfc/lib/"*.* $DEVKIT_ROOT/VC/atlmfc/lib/
5faf40426878 8087208: Add devkit creation script for windows
erikj
parents:
diff changeset
    68
    mkdir -p $DEVKIT_ROOT/VC/redist
5faf40426878 8087208: Add devkit creation script for windows
erikj
parents:
diff changeset
    69
    cp -r "$VS_INSTALL_DIR/VC/redist/x64" $DEVKIT_ROOT/VC/redist/
5faf40426878 8087208: Add devkit creation script for windows
erikj
parents:
diff changeset
    70
    cp -r "$VS_INSTALL_DIR/VC/redist/x86" $DEVKIT_ROOT/VC/redist/
5faf40426878 8087208: Add devkit creation script for windows
erikj
parents:
diff changeset
    71
    # The redist runtime libs are needed to run the compiler but may not be
5faf40426878 8087208: Add devkit creation script for windows
erikj
parents:
diff changeset
    72
    # installed on the machine where the devkit will be used.
5faf40426878 8087208: Add devkit creation script for windows
erikj
parents:
diff changeset
    73
    cp $DEVKIT_ROOT/VC/redist/x86/$MSVCR_DLL $DEVKIT_ROOT/VC/bin/
5faf40426878 8087208: Add devkit creation script for windows
erikj
parents:
diff changeset
    74
    cp $DEVKIT_ROOT/VC/redist/x86/$MSVCP_DLL $DEVKIT_ROOT/VC/bin/
5faf40426878 8087208: Add devkit creation script for windows
erikj
parents:
diff changeset
    75
    cp $DEVKIT_ROOT/VC/redist/x64/$MSVCR_DLL $DEVKIT_ROOT/VC/bin/amd64/
5faf40426878 8087208: Add devkit creation script for windows
erikj
parents:
diff changeset
    76
    cp $DEVKIT_ROOT/VC/redist/x64/$MSVCP_DLL $DEVKIT_ROOT/VC/bin/amd64/
5faf40426878 8087208: Add devkit creation script for windows
erikj
parents:
diff changeset
    77
fi
5faf40426878 8087208: Add devkit creation script for windows
erikj
parents:
diff changeset
    78
5faf40426878 8087208: Add devkit creation script for windows
erikj
parents:
diff changeset
    79
################################################################################
5faf40426878 8087208: Add devkit creation script for windows
erikj
parents:
diff changeset
    80
# Copy SDK files
5faf40426878 8087208: Add devkit creation script for windows
erikj
parents:
diff changeset
    81
5faf40426878 8087208: Add devkit creation script for windows
erikj
parents:
diff changeset
    82
PROGRAMFILES_X86="`env | sed -n 's/^ProgramFiles(x86)=//p'`"
5faf40426878 8087208: Add devkit creation script for windows
erikj
parents:
diff changeset
    83
SDK_INSTALL_DIR="$(cygpath "$PROGRAMFILES_X86/Windows Kits/$SDK_VERSION")"
5faf40426878 8087208: Add devkit creation script for windows
erikj
parents:
diff changeset
    84
echo "SDK_INSTALL_DIR: $SDK_INSTALL_DIR"
5faf40426878 8087208: Add devkit creation script for windows
erikj
parents:
diff changeset
    85
5faf40426878 8087208: Add devkit creation script for windows
erikj
parents:
diff changeset
    86
if [ ! -d $DEVKIT_ROOT/$SDK_VERSION ]; then
5faf40426878 8087208: Add devkit creation script for windows
erikj
parents:
diff changeset
    87
    echo "Copying SDK..."
5faf40426878 8087208: Add devkit creation script for windows
erikj
parents:
diff changeset
    88
    mkdir -p $DEVKIT_ROOT/$SDK_VERSION/bin
5faf40426878 8087208: Add devkit creation script for windows
erikj
parents:
diff changeset
    89
    cp -r "$SDK_INSTALL_DIR/bin/x64" $DEVKIT_ROOT/$SDK_VERSION/bin/
5faf40426878 8087208: Add devkit creation script for windows
erikj
parents:
diff changeset
    90
    cp -r "$SDK_INSTALL_DIR/bin/x86" $DEVKIT_ROOT/$SDK_VERSION/bin/
5faf40426878 8087208: Add devkit creation script for windows
erikj
parents:
diff changeset
    91
    mkdir -p $DEVKIT_ROOT/$SDK_VERSION/lib
5faf40426878 8087208: Add devkit creation script for windows
erikj
parents:
diff changeset
    92
    cp -r "$SDK_INSTALL_DIR/lib/"winv*/um/x64 $DEVKIT_ROOT/$SDK_VERSION/lib/
5faf40426878 8087208: Add devkit creation script for windows
erikj
parents:
diff changeset
    93
    cp -r "$SDK_INSTALL_DIR/lib/"winv*/um/x86 $DEVKIT_ROOT/$SDK_VERSION/lib/
5faf40426878 8087208: Add devkit creation script for windows
erikj
parents:
diff changeset
    94
    cp -r "$SDK_INSTALL_DIR/include" $DEVKIT_ROOT/$SDK_VERSION/
5faf40426878 8087208: Add devkit creation script for windows
erikj
parents:
diff changeset
    95
fi
5faf40426878 8087208: Add devkit creation script for windows
erikj
parents:
diff changeset
    96
5faf40426878 8087208: Add devkit creation script for windows
erikj
parents:
diff changeset
    97
################################################################################
5faf40426878 8087208: Add devkit creation script for windows
erikj
parents:
diff changeset
    98
# Generate devkit.info
5faf40426878 8087208: Add devkit creation script for windows
erikj
parents:
diff changeset
    99
5faf40426878 8087208: Add devkit creation script for windows
erikj
parents:
diff changeset
   100
echo-info() {
5faf40426878 8087208: Add devkit creation script for windows
erikj
parents:
diff changeset
   101
    echo "$1" >> $DEVKIT_ROOT/devkit.info
5faf40426878 8087208: Add devkit creation script for windows
erikj
parents:
diff changeset
   102
}
5faf40426878 8087208: Add devkit creation script for windows
erikj
parents:
diff changeset
   103
5faf40426878 8087208: Add devkit creation script for windows
erikj
parents:
diff changeset
   104
echo "Generating devkit.info..."
5faf40426878 8087208: Add devkit creation script for windows
erikj
parents:
diff changeset
   105
rm -f $DEVKIT_ROOT/devkit.info
5faf40426878 8087208: Add devkit creation script for windows
erikj
parents:
diff changeset
   106
echo-info "# This file describes to configure how to interpret the contents of this devkit"
33029
06a8c5e5959b 8139735: Switch compilers in JPRT for windows and linux
erikj
parents: 31124
diff changeset
   107
echo-info "DEVKIT_NAME=\"Microsoft Visual Studio $VS_VERSION $VS_VERSION_SP (devkit)\""
31124
5faf40426878 8087208: Add devkit creation script for windows
erikj
parents:
diff changeset
   108
echo-info "DEVKIT_VS_VERSION=\"$VS_VERSION\""
5faf40426878 8087208: Add devkit creation script for windows
erikj
parents:
diff changeset
   109
echo-info ""
5faf40426878 8087208: Add devkit creation script for windows
erikj
parents:
diff changeset
   110
echo-info "DEVKIT_TOOLCHAIN_PATH_x86=\"\$DEVKIT_ROOT/VC/bin:\$DEVKIT_ROOT/$SDK_VERSION/bin/x86\""
5faf40426878 8087208: Add devkit creation script for windows
erikj
parents:
diff changeset
   111
echo-info "DEVKIT_VS_INCLUDE_x86=\"\$DEVKIT_ROOT/VC/include;\$DEVKIT_ROOT/VC/atlmfc/include;\$DEVKIT_ROOT/$SDK_VERSION/include/shared;\$DEVKIT_ROOT/$SDK_VERSION/include/um;\$DEVKIT_ROOT/$SDK_VERSION/include/winrt\""
5faf40426878 8087208: Add devkit creation script for windows
erikj
parents:
diff changeset
   112
echo-info "DEVKIT_VS_LIB_x86=\"\$DEVKIT_ROOT/VC/lib;\$DEVKIT_ROOT/VC/atlmfc/lib;\$DEVKIT_ROOT/$SDK_VERSION/lib/x86\""
5faf40426878 8087208: Add devkit creation script for windows
erikj
parents:
diff changeset
   113
echo-info "DEVKIT_MSVCR_DLL_x86=\"\$DEVKIT_ROOT/VC/redist/x86/$MSVCR_DLL\""
5faf40426878 8087208: Add devkit creation script for windows
erikj
parents:
diff changeset
   114
echo-info "DEVKIT_MSVCP_DLL_x86=\"\$DEVKIT_ROOT/VC/redist/x86/$MSVCP_DLL\""
5faf40426878 8087208: Add devkit creation script for windows
erikj
parents:
diff changeset
   115
echo-info ""
5faf40426878 8087208: Add devkit creation script for windows
erikj
parents:
diff changeset
   116
echo-info "DEVKIT_TOOLCHAIN_PATH_x86_64=\"\$DEVKIT_ROOT/VC/bin/amd64:\$DEVKIT_ROOT/$SDK_VERSION/bin/x64:\$DEVKIT_ROOT/$SDK_VERSION/bin/x86\""
5faf40426878 8087208: Add devkit creation script for windows
erikj
parents:
diff changeset
   117
echo-info "DEVKIT_VS_INCLUDE_x86_64=\"\$DEVKIT_ROOT/VC/include;\$DEVKIT_ROOT/VC/atlmfc/include;\$DEVKIT_ROOT/$SDK_VERSION/include/shared;\$DEVKIT_ROOT/$SDK_VERSION/include/um;\$DEVKIT_ROOT/$SDK_VERSION/include/winrt\""
5faf40426878 8087208: Add devkit creation script for windows
erikj
parents:
diff changeset
   118
echo-info "DEVKIT_VS_LIB_x86_64=\"\$DEVKIT_ROOT/VC/lib/amd64;\$DEVKIT_ROOT/VC/atlmfc/lib/amd64;\$DEVKIT_ROOT/$SDK_VERSION/lib/x64\""
5faf40426878 8087208: Add devkit creation script for windows
erikj
parents:
diff changeset
   119
echo-info "DEVKIT_MSVCR_DLL_x86_64=\"\$DEVKIT_ROOT/VC/redist/x64/$MSVCR_DLL\""
5faf40426878 8087208: Add devkit creation script for windows
erikj
parents:
diff changeset
   120
echo-info "DEVKIT_MSVCP_DLL_x86_64=\"\$DEVKIT_ROOT/VC/redist/x64/$MSVCP_DLL\""
5faf40426878 8087208: Add devkit creation script for windows
erikj
parents:
diff changeset
   121
5faf40426878 8087208: Add devkit creation script for windows
erikj
parents:
diff changeset
   122
################################################################################
5faf40426878 8087208: Add devkit creation script for windows
erikj
parents:
diff changeset
   123
# Copy this script
5faf40426878 8087208: Add devkit creation script for windows
erikj
parents:
diff changeset
   124
5faf40426878 8087208: Add devkit creation script for windows
erikj
parents:
diff changeset
   125
echo "Copying this script..."
5faf40426878 8087208: Add devkit creation script for windows
erikj
parents:
diff changeset
   126
cp $0 $DEVKIT_ROOT/
5faf40426878 8087208: Add devkit creation script for windows
erikj
parents:
diff changeset
   127
5faf40426878 8087208: Add devkit creation script for windows
erikj
parents:
diff changeset
   128
################################################################################
5faf40426878 8087208: Add devkit creation script for windows
erikj
parents:
diff changeset
   129
# Create bundle
5faf40426878 8087208: Add devkit creation script for windows
erikj
parents:
diff changeset
   130
5faf40426878 8087208: Add devkit creation script for windows
erikj
parents:
diff changeset
   131
echo "Creating bundle: $DEVKIT_BUNDLE"
5faf40426878 8087208: Add devkit creation script for windows
erikj
parents:
diff changeset
   132
(cd "$DEVKIT_ROOT" && tar zcf "$DEVKIT_BUNDLE" .)