annotate make/devkit/createSolarisDevkit.sh @ 49088:54b423e1c4cf

8153294: Solaris devkit uses linker from system instead of in devkit Reviewed-by: tbell, ihse
author erikj
date Fri, 16 Feb 2018 11:49:27 -0800
parents 83c270cae5e1
children
rev   line source
erikj@34595 1 #!/bin/bash
erikj@34595 2 #
erikj@34595 3 # Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
erikj@34595 4 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
erikj@34595 5 #
erikj@34595 6 # This code is free software; you can redistribute it and/or modify it
erikj@34595 7 # under the terms of the GNU General Public License version 2 only, as
erikj@34595 8 # published by the Free Software Foundation. Oracle designates this
erikj@34595 9 # particular file as subject to the "Classpath" exception as provided
erikj@34595 10 # by Oracle in the LICENSE file that accompanied this code.
erikj@34595 11 #
erikj@34595 12 # This code is distributed in the hope that it will be useful, but WITHOUT
erikj@34595 13 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
erikj@34595 14 # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
erikj@34595 15 # version 2 for more details (a copy is included in the LICENSE file that
erikj@34595 16 # accompanied this code).
erikj@34595 17 #
erikj@34595 18 # You should have received a copy of the GNU General Public License version
erikj@34595 19 # 2 along with this work; if not, write to the Free Software Foundation,
erikj@34595 20 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
erikj@34595 21 #
erikj@34595 22 # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
erikj@34595 23 # or visit www.oracle.com if you need additional information or have any
erikj@34595 24 # questions.
erikj@34595 25 #
erikj@34595 26
erikj@34595 27 # This script creates a devkit for building OpenJDK on Solaris by copying
erikj@34595 28 # part of a Solaris Studio installation and cretaing a sysroot by installing
erikj@34595 29 # a limited set of system packages. It is assumed that a suitable pkg
erikj@34595 30 # publisher is configured for the system where the script is executed.
erikj@34595 31 #
erikj@34595 32 # The Solaris Studio installation must contain at least these packages:
erikj@34595 33 # developer/solarisstudio-124/backend 12.4-1.0.6.0 i--
erikj@34595 34 # developer/solarisstudio-124/c++ 12.4-1.0.10.0 i--
erikj@34595 35 # developer/solarisstudio-124/cc 12.4-1.0.4.0 i--
erikj@34595 36 # developer/solarisstudio-124/library/c++-libs 12.4-1.0.10.0 i--
erikj@34595 37 # developer/solarisstudio-124/library/math-libs 12.4-1.0.0.1 i--
erikj@34595 38 # developer/solarisstudio-124/library/studio-gccrt 12.4-1.0.0.1 i--
erikj@34595 39 # developer/solarisstudio-124/studio-common 12.4-1.0.0.1 i--
erikj@34595 40 # developer/solarisstudio-124/studio-ja 12.4-1.0.0.1 i--
erikj@34595 41 # developer/solarisstudio-124/studio-legal 12.4-1.0.0.1 i--
erikj@34595 42 # developer/solarisstudio-124/studio-zhCN 12.4-1.0.0.1 i--
erikj@34595 43 # In particular backend 12.4-1.0.6.0 contains a critical patch for the sparc
erikj@34595 44 # version.
erikj@34595 45 #
erikj@34595 46 # erik.joelsson@oracle.com
erikj@34595 47
erikj@34595 48 USAGE="$0 <Solaris Studio installation> <Path to gnu make binary>"
erikj@34595 49
erikj@34595 50 if [ "$1" = "" ] || [ "$2" = "" ]; then
erikj@34595 51 echo $USAGE
erikj@34595 52 exit 1
erikj@34595 53 fi
erikj@34595 54
erikj@34595 55 SOLARIS_STUDIO_VERSION=12u4
erikj@34595 56 SOLARIS_VERSION=11u1
erikj@34595 57 case `uname -p` in
erikj@34595 58 i*)
erikj@34595 59 ARCH=x86
erikj@34595 60 ;;
erikj@34595 61 sparc*)
erikj@34595 62 ARCH=sparc
erikj@34595 63 ;;
erikj@34595 64 esac
erikj@34595 65
erikj@34595 66 SOLARIS_STUDIO_SRC=$1
erikj@34595 67 GNU_MAKE=$2
erikj@34595 68
erikj@34595 69 SCRIPT_DIR="$(cd "$(dirname $0)" > /dev/null && pwd)"
erikj@34595 70 BUILD_DIR="${SCRIPT_DIR}/../../build/devkit"
erikj@34595 71
erikj@34595 72 DEVKIT_NAME=SS${SOLARIS_STUDIO_VERSION}-Solaris${SOLARIS_VERSION}
erikj@34595 73 DEVKIT_ROOT=${BUILD_DIR}/${DEVKIT_NAME}
erikj@34595 74 BUNDLE_NAME=${DEVKIT_NAME}.tar.gz
erikj@34595 75 BUNDLE=${BUILD_DIR}/${BUNDLE_NAME}
erikj@49088 76 INSTALL_ROOT=${BUILD_DIR}/install-root-$SOLARIS_VERSION
erikj@49088 77 INSTALL_ROOT_TOOLS=${BUILD_DIR}/install-root-tools-$SOLARIS_VERSION
erikj@34595 78 SYSROOT=${DEVKIT_ROOT}/sysroot
erikj@34595 79 SOLARIS_STUDIO_SUBDIR=SS${SOLARIS_STUDIO_VERSION}
erikj@34595 80 SOLARIS_STUDIO_DIR=${DEVKIT_ROOT}/${SOLARIS_STUDIO_SUBDIR}
erikj@34595 81
erikj@34595 82 # Extract the publisher from the system
erikj@34595 83 if [ -z "${PUBLISHER_URI}" ]; then
erikj@34595 84 PUBLISHER_URI="$(pkg publisher solaris | grep URI | awk '{ print $3 }')"
erikj@34595 85 fi
erikj@34595 86
erikj@34595 87 if [ ! -d $INSTALL_ROOT ]; then
erikj@34595 88 echo "Creating $INSTALL_ROOT and installing packages"
erikj@34595 89 pkg image-create $INSTALL_ROOT
erikj@34595 90 pkg -R $INSTALL_ROOT set-publisher -P -g ${PUBLISHER_URI} solaris
erikj@34595 91 pkg -R $INSTALL_ROOT install --accept $(cat solaris11.1-package-list.txt)
erikj@34595 92 else
erikj@34595 93 echo "Skipping installing packages"
erikj@34595 94 fi
erikj@34595 95
erikj@49088 96 # Since we have implicitly been running 11.2 tools for a long time, we need
erikj@49088 97 # to pick them for the tools dir in the devkit. Create a separate install-root
erikj@49088 98 # for it.
erikj@49088 99 if [ ! -d $INSTALL_ROOT_TOOLS ]; then
erikj@49088 100 echo "Creating $INSTALL_ROOT_TOOLS and installing packages"
erikj@49088 101 pkg image-create $INSTALL_ROOT_TOOLS
erikj@49088 102 pkg -R $INSTALL_ROOT_TOOLS set-publisher -P -g ${PUBLISHER_URI} solaris
erikj@49088 103 sudo pkg -R $INSTALL_ROOT_TOOLS install --accept \
erikj@49088 104 entire@0.5.11-0.175.2.5.0.5.0 \
erikj@49088 105 system/linker \
erikj@49088 106 developer/base-developer-utilities \
erikj@49088 107 developer/gnu-binutils
erikj@49088 108 else
erikj@49088 109 echo "Skipping installing tools packages"
erikj@49088 110 fi
erikj@49088 111
erikj@34595 112 if [ ! -d $SYSROOT ]; then
erikj@34595 113 echo "Copying from $INSTALL_ROOT to $SYSROOT"
erikj@34595 114 mkdir -p $SYSROOT
erikj@34595 115 cp -rH $INSTALL_ROOT/lib $SYSROOT/
erikj@49088 116 mkdir $SYSROOT/usr
erikj@34595 117 cp -rH $INSTALL_ROOT/usr/lib $SYSROOT/usr/
erikj@34595 118 cp -rH $INSTALL_ROOT/usr/include $SYSROOT/usr/
erikj@34595 119 pkg -R $INSTALL_ROOT list > $SYSROOT/pkg-list.txt
erikj@34595 120 else
erikj@34595 121 echo "Skipping copying to $SYSROOT"
erikj@34595 122 fi
erikj@34595 123
erikj@49088 124 if [ ! -d $DEVKIT_ROOT/tools ]; then
erikj@49088 125 echo "Copying from $INSTALL_ROOT_TOOLS to $DEVKIT_ROOT/tools"
erikj@49088 126 # Some of the tools in sysroot are needed in the OpenJDK build. We need
erikj@49088 127 # to copy them into a tools dir, including their specific libraries.
erikj@49088 128 mkdir -p $DEVKIT_ROOT/tools/usr/bin/sparcv9 $DEVKIT_ROOT/tools/lib/sparcv9 \
erikj@49088 129 $DEVKIT_ROOT/tools/usr/gnu/bin
erikj@49088 130 cp $INSTALL_ROOT_TOOLS/usr/bin/{ar,nm,strip,ld,ldd} \
erikj@49088 131 $DEVKIT_ROOT/tools/usr/bin/
erikj@49088 132 cp $INSTALL_ROOT_TOOLS/usr/bin/sparcv9/{ar,nm,strip,ld,ldd} \
erikj@49088 133 $DEVKIT_ROOT/tools/usr/bin/sparcv9/
erikj@49088 134 cp $INSTALL_ROOT_TOOLS/usr/sbin/dtrace $DEVKIT_ROOT/tools/usr/bin/
erikj@49088 135 cp $INSTALL_ROOT_TOOLS/usr/sbin/sparcv9/dtrace $DEVKIT_ROOT/tools/usr/bin/sparcv9/
erikj@49088 136 cp -rH $INSTALL_ROOT_TOOLS/usr/gnu/bin/* $DEVKIT_ROOT/tools/usr/gnu/bin/
erikj@49088 137 cp $INSTALL_ROOT_TOOLS/lib/{libelf.so*,libld.so*,liblddbg.so*} \
erikj@49088 138 $DEVKIT_ROOT/tools/lib/
erikj@49088 139 cp $INSTALL_ROOT_TOOLS/lib/sparcv9/{libelf.so*,libld.so*,liblddbg.so*} \
erikj@49088 140 $DEVKIT_ROOT/tools/lib/sparcv9/
erikj@49088 141 for t in $(ls $DEVKIT_ROOT/tools/usr/gnu/bin); do
erikj@49088 142 if [ -f $DEVKIT_ROOT/tools/usr/gnu/bin/$t ]; then
erikj@49088 143 ln -s ../gnu/bin/$t $DEVKIT_ROOT/tools/usr/bin/g$t
erikj@49088 144 fi
erikj@49088 145 done
erikj@49088 146 else
erikj@49088 147 echo "Skipping copying to tools dir $DEVKIT_ROOT/tools"
erikj@49088 148 fi
erikj@49088 149
erikj@34595 150 if [ ! -d $SOLARIS_STUDIO_DIR ]; then
erikj@34595 151 echo "Copying Solaris Studio from $SOLARIS_STUDIO_SRC"
erikj@49088 152 mkdir -p ${SOLARIS_STUDIO_DIR}
erikj@49088 153 cp -rH $SOLARIS_STUDIO_SRC/. ${SOLARIS_STUDIO_DIR}/
erikj@34595 154 # Solaris Studio 12.4 requires /lib/libmmheap.so.1 to run, but this lib is not
erikj@34595 155 # installed by default on all Solaris systems. Sneak it in from the sysroot to
erikj@34595 156 # make it run OOTB on more systems.
erikj@34595 157 cp $SYSROOT/lib/libmmheap.so.1 $SOLARIS_STUDIO_DIR/lib/compilers/sys/
erikj@34595 158 else
erikj@34595 159 echo "Skipping copying of Solaris Studio"
erikj@34595 160 fi
erikj@34595 161
erikj@34595 162 echo "Copying gnu make to $DEVKIT_ROOT/bin"
erikj@49088 163 cp $GNU_MAKE $DEVKIT_ROOT/tools/usr/bin/
erikj@49088 164 if [ ! -e $DEVKIT_ROOT/tools/usr/bin/gmake ]; then
erikj@49088 165 ln -s make $DEVKIT_ROOT/tools/usr/bin/gmake
erikj@34595 166 fi
erikj@34595 167
erikj@34595 168 # Create the devkit.info file
erikj@34595 169 echo Creating devkit.info
erikj@34595 170 INFO_FILE=$DEVKIT_ROOT/devkit.info
erikj@34595 171 rm -f $INFO_FILE
erikj@34595 172 echo "# This file describes to configure how to interpret the contents of this devkit" >> $INFO_FILE
erikj@34595 173 echo "DEVKIT_NAME=\"Solaris Studio $SOLARIS_STUDIO_VERSION - Solaris $SOLARIS_VERSION - $ARCH\"" >> $INFO_FILE
erikj@34595 174 echo "DEVKIT_TOOLCHAIN_PATH=\"\$DEVKIT_ROOT/$SOLARIS_STUDIO_SUBDIR/bin:\$DEVKIT_ROOT/bin\"" >> $INFO_FILE
erikj@49088 175 echo "DEVKIT_EXTRA_PATH=\"\$DEVKIT_ROOT/tools/usr/bin\"" >> $INFO_FILE
erikj@34595 176 echo "DEVKIT_SYSROOT=\"\$DEVKIT_ROOT/sysroot\"" >> $INFO_FILE
erikj@34595 177
erikj@34595 178 if [ ! -e $BUNDLE ]; then
erikj@34595 179 echo "Creating $BUNDLE from $DEVKIT_ROOT"
erikj@34595 180 cd $DEVKIT_ROOT/..
erikj@34595 181 tar zcf $BUNDLE $DEVKIT_NAME
erikj@34595 182 else
erikj@34595 183 echo "Skipping creation of $BUNDLE"
erikj@34595 184 fi