aoqi@0: # aoqi@0: # Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. aoqi@0: # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. aoqi@0: # aoqi@0: # This code is free software; you can redistribute it and/or modify it aoqi@0: # under the terms of the GNU General Public License version 2 only, as aoqi@0: # published by the Free Software Foundation. aoqi@0: # aoqi@0: # This code is distributed in the hope that it will be useful, but WITHOUT aoqi@0: # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or aoqi@0: # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License aoqi@0: # version 2 for more details (a copy is included in the LICENSE file that aoqi@0: # accompanied this code). aoqi@0: # aoqi@0: # You should have received a copy of the GNU General Public License version aoqi@0: # 2 along with this work; if not, write to the Free Software Foundation, aoqi@0: # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. aoqi@0: # aoqi@0: # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA aoqi@0: # or visit www.oracle.com if you need additional information or have any aoqi@0: # questions. aoqi@0: # aoqi@0: # aoqi@0: aoqi@0: # This shell script builds a vm.def file for the current VM variant. aoqi@0: # The .def file exports vtbl symbols which allow the Serviceability aoqi@0: # Agent to run on Windows. See make/windows/projectfiles/*/vm.def aoqi@0: # for more information. aoqi@0: # aoqi@0: # The script expects to be executed in the directory containing all of aoqi@0: # the object files. aoqi@0: aoqi@0: # Note that we currently do not have a way to set HotSpotMksHome in aoqi@0: # the batch build, but so far this has not seemed to be a problem. The aoqi@0: # reason this environment variable is necessary is that it seems that aoqi@0: # Windows truncates very long PATHs when executing shells like MKS's aoqi@0: # sh, and it has been found that sometimes `which sh` fails. aoqi@0: if [ "x$HOTSPOTMKSHOME" != "x" ]; then aoqi@0: MKS_HOME="$HOTSPOTMKSHOME" aoqi@0: else aoqi@0: SH=`which sh` aoqi@0: MKS_HOME=`dirname "$SH"` aoqi@0: fi aoqi@0: aoqi@0: AWK="$MKS_HOME/awk.exe" aoqi@0: if [ ! -e $AWK ]; then aoqi@0: AWK="$MKS_HOME/gawk.exe" aoqi@0: fi aoqi@0: GREP="$MKS_HOME/grep.exe" aoqi@0: SORT="$MKS_HOME/sort.exe" aoqi@0: UNIQ="$MKS_HOME/uniq.exe" aoqi@0: CAT="$MKS_HOME/cat.exe" aoqi@0: RM="$MKS_HOME/rm.exe" aoqi@0: DUMPBIN="link.exe /dump" aoqi@0: aoqi@0: if [ "$1" = "-nosa" ]; then aoqi@0: echo EXPORTS > vm.def aoqi@0: echo "" aoqi@0: echo "***" aoqi@0: echo "*** Not building SA: BUILD_WIN_SA != 1" aoqi@0: echo "*** C++ Vtables NOT included in vm.def" aoqi@0: echo "*** This jvm.dll will NOT work properly with SA." aoqi@0: echo "***" aoqi@0: echo "*** When in doubt, set BUILD_WIN_SA=1, clean and rebuild." aoqi@0: echo "***" aoqi@0: echo "" aoqi@0: exit aoqi@0: fi aoqi@0: aoqi@0: echo "EXPORTS" > vm1.def aoqi@0: aoqi@0: # When called from IDE the first param should contain the link version, otherwise may be nill aoqi@0: if [ "x$1" != "x" ]; then aoqi@0: LD_VER="$1" aoqi@0: fi aoqi@0: aoqi@0: if [ "x$LD_VER" != "x800" -a "x$LD_VER" != "x900" -a "x$LD_VER" != "x1000" ]; then aoqi@0: $DUMPBIN /symbols *.obj | "$GREP" "??_7.*@@6B@" | "$GREP" -v "type_info" | "$AWK" '{print $7}' | "$SORT" | "$UNIQ" > vm2.def aoqi@0: else aoqi@0: # Can't use pipes when calling cl.exe or link.exe from IDE. Using transit file vm3.def aoqi@0: $DUMPBIN /OUT:vm3.def /symbols *.obj aoqi@0: "$CAT" vm3.def | "$GREP" "??_7.*@@6B@" | "$GREP" -v "type_info" | "$AWK" '{print $7}' | "$SORT" | "$UNIQ" > vm2.def aoqi@0: "$RM" -f vm3.def aoqi@0: fi aoqi@0: aoqi@0: "$CAT" vm1.def vm2.def > vm.def aoqi@0: "$RM" -f vm1.def vm2.def