31124
|
1 |
#!/bin/bash
|
|
2 |
#
|
|
3 |
# Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
|
|
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 a Visual Studio 2013 installation into a devkit
|
|
28 |
# suitable for building OpenJDK and OracleJDK. Needs to run in Cygwin.
|
|
29 |
# erik.joelsson@oracle.com
|
|
30 |
|
|
31 |
VS_VERSION="2013"
|
|
32 |
VS_VERSION_NUM="12.0"
|
|
33 |
VS_VERSION_NUM_NODOT="120"
|
|
34 |
SDK_VERSION="8.1"
|
|
35 |
|
|
36 |
SCRIPT_DIR="$(cd "$(dirname $0)" > /dev/null && pwd)"
|
|
37 |
BUILD_DIR="${SCRIPT_DIR}/../../build/devkit"
|
|
38 |
DEVKIT_ROOT="${BUILD_DIR}/VS${VS_VERSION}-devkit"
|
|
39 |
DEVKIT_BUNDLE="${DEVKIT_ROOT}.tar.gz"
|
|
40 |
|
|
41 |
echo "Creating devkit in $DEVKIT_ROOT"
|
|
42 |
|
|
43 |
MSVCR_DLL=Microsoft.VC${VS_VERSION_NUM_NODOT}.CRT/msvcr${VS_VERSION_NUM_NODOT}.dll
|
|
44 |
MSVCP_DLL=Microsoft.VC${VS_VERSION_NUM_NODOT}.CRT/msvcp${VS_VERSION_NUM_NODOT}.dll
|
|
45 |
|
|
46 |
################################################################################
|
|
47 |
# Copy Visual Studio files
|
|
48 |
|
|
49 |
eval VSNNNCOMNTOOLS="\"\${VS${VS_VERSION_NUM_NODOT}COMNTOOLS}\""
|
|
50 |
VS_INSTALL_DIR="$(cygpath "$VSNNNCOMNTOOLS/../..")"
|
|
51 |
echo "VS_INSTALL_DIR: $VS_INSTALL_DIR"
|
|
52 |
|
|
53 |
if [ ! -d $DEVKIT_ROOT/VC ]; then
|
|
54 |
echo "Copying VC..."
|
|
55 |
mkdir -p $DEVKIT_ROOT/VC/bin
|
|
56 |
cp -r "$VS_INSTALL_DIR/VC/bin/amd64" $DEVKIT_ROOT/VC/bin/
|
|
57 |
cp "$VS_INSTALL_DIR/VC/bin/"*.* $DEVKIT_ROOT/VC/bin/
|
|
58 |
cp -r "$VS_INSTALL_DIR/VC/bin/1033/" $DEVKIT_ROOT/VC/bin/
|
|
59 |
mkdir -p $DEVKIT_ROOT/VC/lib
|
|
60 |
cp -r "$VS_INSTALL_DIR/VC/lib/amd64" $DEVKIT_ROOT/VC/lib/
|
|
61 |
cp "$VS_INSTALL_DIR/VC/lib/"*.* $DEVKIT_ROOT/VC/lib/
|
|
62 |
cp -r "$VS_INSTALL_DIR/VC/include" $DEVKIT_ROOT/VC/
|
|
63 |
mkdir -p $DEVKIT_ROOT/VC/atlmfc/lib
|
|
64 |
cp -r "$VS_INSTALL_DIR/VC/atlmfc/include" $DEVKIT_ROOT/VC/atlmfc/
|
|
65 |
cp -r "$VS_INSTALL_DIR/VC/atlmfc/lib/amd64" $DEVKIT_ROOT/VC/atlmfc/lib/
|
|
66 |
cp "$VS_INSTALL_DIR/VC/atlmfc/lib/"*.* $DEVKIT_ROOT/VC/atlmfc/lib/
|
|
67 |
mkdir -p $DEVKIT_ROOT/VC/redist
|
|
68 |
cp -r "$VS_INSTALL_DIR/VC/redist/x64" $DEVKIT_ROOT/VC/redist/
|
|
69 |
cp -r "$VS_INSTALL_DIR/VC/redist/x86" $DEVKIT_ROOT/VC/redist/
|
|
70 |
# The redist runtime libs are needed to run the compiler but may not be
|
|
71 |
# installed on the machine where the devkit will be used.
|
|
72 |
cp $DEVKIT_ROOT/VC/redist/x86/$MSVCR_DLL $DEVKIT_ROOT/VC/bin/
|
|
73 |
cp $DEVKIT_ROOT/VC/redist/x86/$MSVCP_DLL $DEVKIT_ROOT/VC/bin/
|
|
74 |
cp $DEVKIT_ROOT/VC/redist/x64/$MSVCR_DLL $DEVKIT_ROOT/VC/bin/amd64/
|
|
75 |
cp $DEVKIT_ROOT/VC/redist/x64/$MSVCP_DLL $DEVKIT_ROOT/VC/bin/amd64/
|
|
76 |
fi
|
|
77 |
|
|
78 |
################################################################################
|
|
79 |
# Copy SDK files
|
|
80 |
|
|
81 |
PROGRAMFILES_X86="`env | sed -n 's/^ProgramFiles(x86)=//p'`"
|
|
82 |
SDK_INSTALL_DIR="$(cygpath "$PROGRAMFILES_X86/Windows Kits/$SDK_VERSION")"
|
|
83 |
echo "SDK_INSTALL_DIR: $SDK_INSTALL_DIR"
|
|
84 |
|
|
85 |
if [ ! -d $DEVKIT_ROOT/$SDK_VERSION ]; then
|
|
86 |
echo "Copying SDK..."
|
|
87 |
mkdir -p $DEVKIT_ROOT/$SDK_VERSION/bin
|
|
88 |
cp -r "$SDK_INSTALL_DIR/bin/x64" $DEVKIT_ROOT/$SDK_VERSION/bin/
|
|
89 |
cp -r "$SDK_INSTALL_DIR/bin/x86" $DEVKIT_ROOT/$SDK_VERSION/bin/
|
|
90 |
mkdir -p $DEVKIT_ROOT/$SDK_VERSION/lib
|
|
91 |
cp -r "$SDK_INSTALL_DIR/lib/"winv*/um/x64 $DEVKIT_ROOT/$SDK_VERSION/lib/
|
|
92 |
cp -r "$SDK_INSTALL_DIR/lib/"winv*/um/x86 $DEVKIT_ROOT/$SDK_VERSION/lib/
|
|
93 |
cp -r "$SDK_INSTALL_DIR/include" $DEVKIT_ROOT/$SDK_VERSION/
|
|
94 |
fi
|
|
95 |
|
|
96 |
################################################################################
|
|
97 |
# Generate devkit.info
|
|
98 |
|
|
99 |
echo-info() {
|
|
100 |
echo "$1" >> $DEVKIT_ROOT/devkit.info
|
|
101 |
}
|
|
102 |
|
|
103 |
echo "Generating devkit.info..."
|
|
104 |
rm -f $DEVKIT_ROOT/devkit.info
|
|
105 |
echo-info "# This file describes to configure how to interpret the contents of this devkit"
|
|
106 |
echo-info "DEVKIT_NAME=\"Microsoft Visual Studio $VS_VERSION (devkit)\""
|
|
107 |
echo-info "DEVKIT_VS_VERSION=\"$VS_VERSION\""
|
|
108 |
echo-info ""
|
|
109 |
echo-info "DEVKIT_TOOLCHAIN_PATH_x86=\"\$DEVKIT_ROOT/VC/bin:\$DEVKIT_ROOT/$SDK_VERSION/bin/x86\""
|
|
110 |
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\""
|
|
111 |
echo-info "DEVKIT_VS_LIB_x86=\"\$DEVKIT_ROOT/VC/lib;\$DEVKIT_ROOT/VC/atlmfc/lib;\$DEVKIT_ROOT/$SDK_VERSION/lib/x86\""
|
|
112 |
echo-info "DEVKIT_MSVCR_DLL_x86=\"\$DEVKIT_ROOT/VC/redist/x86/$MSVCR_DLL\""
|
|
113 |
echo-info "DEVKIT_MSVCP_DLL_x86=\"\$DEVKIT_ROOT/VC/redist/x86/$MSVCP_DLL\""
|
|
114 |
echo-info ""
|
|
115 |
echo-info "DEVKIT_TOOLCHAIN_PATH_x86_64=\"\$DEVKIT_ROOT/VC/bin/amd64:\$DEVKIT_ROOT/$SDK_VERSION/bin/x64:\$DEVKIT_ROOT/$SDK_VERSION/bin/x86\""
|
|
116 |
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\""
|
|
117 |
echo-info "DEVKIT_VS_LIB_x86_64=\"\$DEVKIT_ROOT/VC/lib/amd64;\$DEVKIT_ROOT/VC/atlmfc/lib/amd64;\$DEVKIT_ROOT/$SDK_VERSION/lib/x64\""
|
|
118 |
echo-info "DEVKIT_MSVCR_DLL_x86_64=\"\$DEVKIT_ROOT/VC/redist/x64/$MSVCR_DLL\""
|
|
119 |
echo-info "DEVKIT_MSVCP_DLL_x86_64=\"\$DEVKIT_ROOT/VC/redist/x64/$MSVCP_DLL\""
|
|
120 |
|
|
121 |
################################################################################
|
|
122 |
# Copy this script
|
|
123 |
|
|
124 |
echo "Copying this script..."
|
|
125 |
cp $0 $DEVKIT_ROOT/
|
|
126 |
|
|
127 |
################################################################################
|
|
128 |
# Create bundle
|
|
129 |
|
|
130 |
echo "Creating bundle: $DEVKIT_BUNDLE"
|
|
131 |
(cd "$DEVKIT_ROOT" && tar zcf "$DEVKIT_BUNDLE" .)
|