[Libreoffice-commits] .: configure.ac download Makefile.top oowintool

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Wed Dec 5 16:48:37 PST 2012


 Makefile.top |    9 -
 configure.ac |  229 ++++++++++++++++++++++++++++--
 download     |   81 ----------
 oowintool    |  438 -----------------------------------------------------------
 4 files changed, 209 insertions(+), 548 deletions(-)

New commits:
commit f9a687719960a6636186cbd2db917ad660139a11
Author: Peter Foley <pefoley2 at verizon.net>
Date:   Mon Dec 3 18:11:54 2012 -0500

    kill oowintool
    
    Change-Id: Ifb0c8a34ecb7b77a92fb67ca947b4ed46f51fd9a

diff --git a/Makefile.top b/Makefile.top
index 9d88c7c..42e134b 100644
--- a/Makefile.top
+++ b/Makefile.top
@@ -145,7 +145,7 @@ ifeq ($(BUILD_DMAKE),YES)
 endif
 	rm -fr config_host.mk config_build.mk aclocal.m4 autom4te.cache \
 	config.log config.status configure \
-	config_host.mk.last config_host.mk.stamp src.downloaded warn
+	config_host.mk.last config_host.mk.stamp warn
 	find $(SOLARENV)/gdb -name "*.pyc" -exec rm {} \;
 
 #
@@ -165,7 +165,6 @@ ifneq ($(DO_FETCH_TARBALLS),NO)
 include $(SRCDIR)/Makefile.fetch
 fetch: download
 fetch: get-submodules
-fetch: $(SRCDIR)/src.downloaded
 
 ifneq (,$(wildcard .git))
 get-submodules:
@@ -195,12 +194,6 @@ endif
 
 endif
 
-# TODO: This should be really in external/ module, I think.
-$(SRCDIR)/src.downloaded : $(SRCDIR)/download $(SRCDIR)/config_host.mk | download
-ifeq ($(COM),MSC)
-	$< && touch $@
-endif
-
 else
 fetch:
 	@echo "Automatic fetching of external tarballs is disabled."
diff --git a/configure.ac b/configure.ac
index b09f2c2..fc908e3 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2829,6 +2829,18 @@ AC_SUBST(XCRUN)
 dnl ===================================================================
 dnl Windows specific tests and stuff
 dnl ===================================================================
+
+reg_get_value()
+{
+	unset regvalue
+	_regvalue=`cat "/proc/registry/$1" 2> /dev/null`
+
+	if test $? -eq 0; then
+		regvalue=$_regvalue
+	fi
+}
+
+
 if test "$_os" = "WINNT" -a "$WITH_MINGW" != yes; then
     AC_MSG_CHECKING([whether to build a 64-bit LibreOffice])
     if test "$enable_64_bit" = "" -o "$enable_64_bit" = "no"; then
@@ -3029,12 +3041,44 @@ AC_SUBST(HAVE_LD_BSYMBOLIC_FUNCTIONS)
 dnl ===================================================================
 dnl  Check which Microsoft C/C++ or MinGW compiler is used for WINNT
 dnl ===================================================================
+find_msvs() {
+# find Visual Studio 2012/2010/2008
+for ver in 11.0 10.0 9.0; do
+	reg_get_value HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/VisualStudio/$ver/Setup/VS/ProductDir
+	if test -n "$regvalue"; then
+		vstest=$regvalue
+		break
+	fi
+	reg_get_value HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/VCExpress/$ver/Setup/VS/ProductDir
+	if test -n "$regvalue"; then
+		vstest=$regvalue
+		break
+	fi
+done
+}
+
+find_msvc() {
+# find Visual Studio 2012/2010/2008
+for ver in 11.0 10.0 9.0; do
+	reg_get_value HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/VisualStudio/$ver/Setup/VC/ProductDir
+		if test -n "$regvalue"; then
+			vctest=$regvalue
+			break
+		fi
+	reg_get_value HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/VCExpress/$ver/Setup/VC/ProductDir
+		if test -n "$regvalue"; then
+			vctest=$regvalue
+			break
+		fi
+done
+}
+
 SHOWINCLUDES_PREFIX=
 if test "$_os" = "WINNT"; then
     if test "$WITH_MINGW" != "yes"; then
         AC_MSG_CHECKING([for a friendly Microsoft C/C++ compiler installation path])
         if test -z "$with_cl_home"; then
-            vctest=`./oowintool --msvc-productdir`
+			find_msvc
             if test "$BITNESS_OVERRIDE" = ""; then
                 if test -x "$vctest/bin/cl.exe"; then
                     with_cl_home=$vctest
@@ -4099,7 +4143,6 @@ if test "$cross_compiling" = "yes"; then
         config.guess \
         config_host.mk.in \
         configure \
-        oowintool \
         bin/get_config_variables \
         solenv/bin/getcompver.awk \
         solenv/inc/langlist.mk \
@@ -4697,7 +4740,146 @@ dnl that to mean Visual Studio .NET 2003 ? And does this also
 dnl in fact apply equally to what we actually support, i.e.
 dnl Visual Studio 2008 and 2010?)
 dnl ===================================================================
+find_csc() {
+if test $VCVER -eq 90; then
+	reg_get_value "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/NET Framework Setup/NDP/v3.5/InstallPath"
+	if test -n "$regvalue"; then
+		csctest=$regvalue
+		return
+	fi
+	reg_get_value HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/.NETFramework/InstallRoot
+	if test -n "$regvalue"; then
+		csctest=${regvalue}"v2.0.50727"
+	fi
+else
+	reg_get_value "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/NET Framework Setup/NDP/v4/Client/InstallPath"
+	if test -n "$regvalue"; then
+		csctest=$regvalue
+		break
+	fi
+fi
+}
+
+find_al() {
+for x in `ls /proc/registry/HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft\ SDKs/Windows`; do
+		reg_get_value "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/$x/WinSDK-NetFx40Tools/InstallationFolder"
+		if test -n "$regvalue" -a \( -f "$regvalue/al.exe" -o -f "$regvalue/bin/al.exe" \); then
+			altest=$regvalue
+			break
+		fi
+done
+}
+
+find_dotnetsdk() {
+for ver in 1.1 2.0; do
+	reg_get_value HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/.NETFramework/sdkInstallRootv$ver
+	if test -n "$regvalue"; then
+		frametest=$regvalue
+		break
+	fi
+done
+}
+
+find_winsdk() {
+reg_get_value "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Windows Kits/Installed Roots/KitsRoot"
+if test -n "$regvalue"; then
+	winsdktest=$regvalue
+	return
+fi
+reg_get_value "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/CurrentInstallFolder"
+if test -n "$regvalue"; then
+	winsdktest=$regvalue
+	return
+fi
+reg_get_value "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/MicrosoftSDK/Directories/Install Dir"
+if test -n "$regvalue"; then
+	winsdktest=$regvalue
+	return
+fi
+for x in `ls /proc/registry/HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/MicrosoftSDK/InstalledSDKs`; do
+	reg_get_value "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/MicrosoftSDK/InstalledSDKs/$x/Install Dir"
+	if test -n "$regvalue"; then
+		winsdktest=$regvalue
+		break
+	fi
+done
+}
+
+#TODO: move copy_* functions to external/ module once gbuildified
+copy_msms() {
+for ver in 9.0 10.0 11.0; do
+	reg_get_value HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/VisualStudio/$ver/Setup/VS/MSMDir
+	if test -n "$regvalue"; then
+		if test -e "$regvalue/Microsoft_VC${VCVER}_CRT_x86.msm"; then
+			msmdir=$regvalue
+			break
+		fi
+	fi
+done
+msmdir=`cygpath -d "$msmdir"`
+msmdir=`cygpath -u "$msmdir"`
+if test -z "$msmdir"; then
+	AC_MSG_ERROR([Merge modules not found])
+fi
+
+if test $VCVER -eq 90; then
+	cp $msmdir/policy_9_0_Microsoft_VC90_CRT_x86.msm ./external/msm90
+	if test $? -ne 0; then
+		AC_MSG_ERROR([Failed to copy merge modules])
+	fi
+fi
+cp $msmdir/Microsoft_VC${VCVER}_CRT_x86.msm ./external/msm${VCVER}
+if test $? -ne 0; then
+	AC_MSG_ERROR([Failed to copy merge modules])
+fi
+cp $msmdir/Microsoft_VC${VCVER}_CRT_x64.msm ./external/msm${VCVER}
+if test $? -ne 0; then
+	AC_MSG_WARN([Failed to copy x64 merge modules, installation will lack the 64-bit Explorer extension])
+fi
+}
+
+copy_msvc_dlls() {
+
+if test $CPUNAME == INTEL; then
+	vsarch=x86
+else
+	vsarch=amd64
+fi
+
+if test -f $with_cl_home/redist/$vsarch/Microsoft.VC${VCVER}.CRT/msvcp${VCVER}.dll; then
+	vsdlldir=$with_cl_home/redist/$vsarch/Microsoft.VC${VCVER}.CRT
+else
+	AC_MSG_ERROR([can't find VS dll $with_cl_home/redist/$vsarch/Microsoft.VC${VCVER}.CRT/msvcp${VCVER}.dll])
+fi
+
+cp $vsdlldir/msvcp${VCVER}.dll $vsdlldir/msvcr${VCVER}.dll ./external/msvcp${VCVER}
+
+if test $VCVER == 90; then
+	cp $vsdlldir/msvcm${VCVER}.dll $vsdlldir/Microsoft.VC90.CRT.manifest ./external/msvcp${VCVER}
+	if test $? -ne 0; then
+		AC_MSG_ERROR([Failed to copy VS dlls])
+	fi
+fi
+}
+
+copy_dbghelp_dll() {
+if test ! -f ./external/dbghelp/dbghelp.dll -a -f $TARFILE_LOCATION/$DBGHELP_DLL; then
+	cp $TARFILE_LOCATION/$DBGHELP_DLL ./external/dbghelp/dbghelp.dll;
+fi
+if test ! -f ./external/dbghelp/dbghelp.dll; then
+	echo "dbghelp.dll is missing in external/dbghelp/."
+    echo "Get it from the Microsoft site and put it there."
+    echo "(Note: Microsoft seems to enjoy changing the exact location of this file."
+    echo "You may have to search Microsoft's website.) Last time it was seen at:"
+    echo "<http://www.microsoft.com/downloads/release.asp?releaseid=30682>."
+    exit 1
+fi
+}
+
 if test "$build_os" = "cygwin"; then
+	copy_msvc_dlls
+	copy_dbghelp_dll
+
     dnl Check midl.exe
     AC_PATH_PROG(MIDL_PATH, midl.exe)
     if test -n "$MIDL_PATH"; then
@@ -4715,13 +4897,13 @@ if test "$build_os" = "cygwin"; then
         MIDL_PATH="$with_cl_home/../Common7/Tools/Bin"
     fi
     if test -z "$MIDL_PATH"; then
-        vstest=`./oowintool --msvs-productdir`
+        find_msvs
         if test -x "$vstest/Common7/Tools/Bin/midl.exe"; then
             MIDL_PATH="$vstest/Common7/Tools/Bin"
         fi
     fi
     if test -z "$MIDL_PATH"; then
-        winsdktest=`./oowintool --windows-sdk-home`
+		find_winsdk
         if test -x "$winsdktest/Bin/midl.exe"; then
             MIDL_PATH="$winsdktest/Bin"
         elif test -x "$winsdktest/Bin/$SDK_ARCH/midl.exe"; then
@@ -4750,7 +4932,7 @@ if test "$build_os" = "cygwin"; then
     if test -x "$with_csc_path/csc.exe"; then
         CSC_PATH="$with_csc_path"
     else
-       csctest=`./oowintool --csc-compilerdir`
+	   find_csc
        if test -x "$csctest/csc.exe"; then
            CSC_PATH="$csctest"
        fi
@@ -4778,7 +4960,7 @@ if test "$build_os" = "cygwin"; then
         AL_PATH="$with_al_path"
     fi
     if test -z "$AL_PATH"; then
-        winsdktest=`./oowintool --windows-sdk-home`
+        find_winsdk
         if test -x "$winsdktest/Bin/al.exe"; then
             AL_PATH="$winsdktest/Bin"
         elif test -x "$winsdktest/Bin/$SDK_ARCH/al.exe"; then
@@ -4786,7 +4968,7 @@ if test "$build_os" = "cygwin"; then
         fi
     fi
     if test -z "$AL_PATH"; then
-        altest=`./oowintool --al-home`
+        find_al
         if test -x "$altest/bin/al.exe"; then
             AL_PATH="$altest/bin"
         elif test -x "$altest/al.exe"; then
@@ -4812,13 +4994,13 @@ if test "$build_os" = "cygwin"; then
         DOTNET_FRAMEWORK_HOME="$with_dotnet_framework_home"
     fi
     if test -z "$DOTNET_FRAMEWORK_HOME"; then
-        frametest=`./oowintool --dotnetsdk-dir`
+		find_dotnetsdk
         if test -f "$frametest/lib/mscoree.lib"; then
             DOTNET_FRAMEWORK_HOME="$frametest"
         else
-            frametest=`./oowintool --windows-sdk-home`
-            if test -f "$frametest/lib/mscoree.lib" -o -f "$frametest/lib/win8/um/$SDK_ARCH/mscoree.lib"; then
-                DOTNET_FRAMEWORK_HOME="$frametest"
+			find_winsdk
+            if test -f "$winsdktest/lib/mscoree.lib" -o -f "$winsdktest/lib/win8/um/$SDK_ARCH/mscoree.lib"; then
+                DOTNET_FRAMEWORK_HOME="$winsdktest"
             fi
         fi
     fi
@@ -5803,9 +5985,10 @@ AC_SUBST([JITC_PROCESSOR_TYPE])
 
 if test $_os = "WINNT"; then
     AC_MSG_CHECKING([for Microsoft_VC${VCVER}_CRT_x86.msm])
-    if ./oowintool --msvc-find-msms; then
+	copy_msms
+    if test -n $msms_copied ; then
         AC_MSG_RESULT([yes])
-        SCPDEFS="$SCPDEFS -DWITH_VC"$VCVER"_REDIST"
+        SCPDEFS="$SCPDEFS -DWITH_VC${VCVER}_REDIST"
     else
         AC_MSG_RESULT([no])
     fi
@@ -5827,16 +6010,19 @@ if test "$SOLAR_JAVA" != ""; then
         fi
 
         if test -z "$with_jdk_home"; then
-
-            # Unfortunately apparently no way to find, if needed, the 64-bit
-            # JDK in the Registry from the 32-bit Perl oowintool
-
-            _jdk_home=`./oowintool --jdk-home`
+            # Currently only auto-detects 32-bit JDK
+			for ver in 1.7 1.6 1.5 1.4 1.3; do
+			reg_get_value "HKEY_LOCAL_MACHINE/SOFTWARE/JavaSoft/Java Development Kit/$ver/JavaHome"
+			if test -n "$regvalue"; then
+				_jdk_home=$regvalue
+				break
+			fi
+			done
             if test -f "$_jdk_home/lib/jvm.lib" -a -f "$_jdk_home/bin/java.exe"; then
                 with_jdk_home="$_jdk_home"
-                howfound="found by oowintool"
+                howfound="found automatically"
             else
-                AC_MSG_ERROR([No JDK found by oowintool, pass the --with-jdk-home option pointing to a $bitness JDK])
+                AC_MSG_ERROR([No JDK found, pass the --with-jdk-home option pointing to a $bitness JDK])
             fi
         else
             test "$build_os" = "cygwin" && with_jdk_home=`cygpath -u "$with_jdk_home"`
@@ -8824,7 +9010,8 @@ if test "$_os" = "WINNT"; then
     if test "$build_os" = "cygwin"; then
         if test -z "$with_windows_sdk_home"; then
             # This first line will detect a February 2003 Microsoft Platform SDK
-            WINDOWS_SDK_HOME=`./oowintool --windows-sdk-home`
+			find_winsdk
+            WINDOWS_SDK_HOME=$winsdktest
             # But there might be also an April 2005 PSDK, unfortunately MS changed
             # the registry entry. (we prefer the old version!?)
             if test -z "$WINDOWS_SDK_HOME"; then
diff --git a/download b/download
deleted file mode 100755
index 985443c..0000000
--- a/download
+++ /dev/null
@@ -1,81 +0,0 @@
-#!/usr/bin/env bash
-#*************************************************************************
-#
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-# 
-# Copyright 2000, 2010 Oracle and/or its affiliates.
-#
-# OpenOffice.org - a multi-platform office productivity suite
-#
-# This file is part of OpenOffice.org.
-#
-# OpenOffice.org is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Lesser General Public License version 3
-# only, as published by the Free Software Foundation.
-#
-# OpenOffice.org is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU Lesser General Public License version 3 for more details
-# (a copy is included in the LICENSE file that accompanied this code).
-#
-# You should have received a copy of the GNU Lesser General Public License
-# version 3 along with OpenOffice.org.  If not, see
-# <http://www.openoffice.org/license.html>
-# for a copy of the LGPLv3 License.
-#
-#*************************************************************************
-
-set -o pipefail
-
-# environment setup yet?
-if [ -z "$TARFILE_LOCATION" ]; then
-    . ./bin/get_config_variables TARFILE_LOCATION COM CPUNAME VCVER DBGHELP_DLL
-fi
-
-if [ "$COM" = "MSC" -a "$CPUNAME" = "INTEL" ]; then
-
-    # Windows builds need dbghelp.dll in external/dbghelp/
-    if [ ! -f ./external/dbghelp/dbghelp.dll -a -f $TARFILE_LOCATION/$DBGHELP_DLL ]; then
-        cp $TARFILE_LOCATION/$DBGHELP_DLL ./external/dbghelp/dbghelp.dll
-    fi
-    if [ ! -f ./external/dbghelp/dbghelp.dll ]; then
-        echo "dbghelp.dll is missing in external/dbghelp/."
-        echo "Get it from the Microsoft site and put it there."
-        echo "(Note: Microsoft seems to enjoy changing the exact location of this file."
-        echo "You may have to search Microsoft's website.) Last time it was seen at:"
-        echo "<http://www.microsoft.com/downloads/release.asp?releaseid=30682>."
-        exit 1
-    fi
-fi
-
-if [ "$COM" = "MSC" ]; then
-    if [ "$CPUNAME" = "INTEL" ]; then
-        ver=""
-    else
-        ver="-64"
-    fi
-    # use oowintool to copy CRT dlls and manifest
-    if ! ./oowintool --msvc-copy-dlls"$ver" ./external/msvcp ; then
-       echo "oowintool failed to copy CRT"
-       exit 1
-    fi
-
-    # use oowintool to copy VC redist merge modules
-    if ! ./oowintool --msvc-copy-msms"$ver" ./external/msm"$VCVER" ; then
-       echo "oowintool failed to copy merge modules"
-       exit 1
-    fi
-    if [ "$CPUNAME" = "INTEL" ]; then
-        if ! ./oowintool --msvc-copy-msms-64 ./external/msm"$VCVER" ; then
-           echo "WARNING: oowintool failed to copy x64 merge modules, installation will lack the 64-bit Explorer extension"
-        fi
-    fi
-fi
-
-# Local Variables:
-# tab-width: 4
-# indent-tabs-mode: nil
-# End:
-
-# vim:set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/oowintool b/oowintool
deleted file mode 100755
index 26221f0..0000000
--- a/oowintool
+++ /dev/null
@@ -1,438 +0,0 @@
-#!/usr/bin/perl -w
-# -*- tab-width: 4; cperl-indent-level: 4; indent-tabs-mode: nil -*-
-
-use File::Copy;
-use File::Glob;
-
-my $output_format = 'u';
-
-sub reg_get_value($)
-{
-    # it is believed that the registry moves keys around
-    # depending on OS version, this will de-mangle that
-    my $key = shift;
-    my $fhandle;
-    my $value;
-
-    open ($fhandle, "/proc/registry/$key") || return;
-    # reg keys have 0x00 0x5c at the end
-    $value = (split /\0/, <$fhandle>)[0];
-    close ($fhandle);
-
-    if ( defined $value ) {
-        chomp ($value);
-        $value =~ s|\r\n||;
-        # print "Value '$value' at '$key'\n";
-    }
-
-    return $value;
-}
-
-sub print_syntax()
-{
-    print "oowintool [option] ...\n";
-    print " encoding options\n";
-    print "   -w   - windows form\n";
-    print "   -u   - unix form (default)\n";
-    print " commands:\n";
-    print "   --msvc-ver                  - print version of MSVC eg. 6.0\n";
-    print "   --msvc-copy-dlls <dest>     - copy msvc[pr]??.dlls into <dest>/msvcp??/\n";
-    print "   --msvc-copy-dlls-64 <dest>  - copy x64 msvc[pr]??.dlls into <dest>/msvcp??/\n";
-    print "   --msvc-copy-msms <dest>     - copy mscrt merge modules to <dest>/msm90/\n";
-    print "   --msvc-copy-msms-64 <ds>    - copy the x64 mscrt merge modules to <ds>/msm90/\n";
-    print "   --msvc-productdir           - print productdir\n";
-    print "   --msvs-productdir           - print productdir\n";
-    print "   --dotnetsdk-dir             - print .NET SDK path\n";
-    print "   --csc-compilerdir           - print .NET SDK compiler path\n";
-    print "   --al-home                   - print AL.exe install dir\n";
-    print "   --windows-sdk-home          - print Windows SDK install dir\n";
-    print "   --jdk-home                  - print the jdk install dir\n";
-    print "   --help                      - print this message\n";
-}
-
-sub cygpath($$$)
-{
-    my ($path, $input_format, $format) = @_;
-
-    return $path if ( ! defined $path );
-    # Strip trailing path separators
-    if ($input_format eq 'u') {
-        $path =~ s|/*\s*$||;
-    } else {
-        $path =~ s|\\*\s*$||;
-    }
-
-    # 'Unterminated quoted string errors' from 'ash' when
-    # forking cygpath  so - reimplement cygpath in perl [ gack ]
-    if ($format eq 'u' && $input_format eq 'w') {
-        $path =~ s|\\|/|g;
-        $path =~ s|([a-zA-Z]):/|/cygdrive/$1/|g;
-    }
-    elsif ($format eq 'w' && $input_format eq 'u') {
-        $path =~ s|/cygdrive/([a-zA-Z])/|/$1/|g;
-        $path =~ s|/|\\|g;
-    }
-
-    return $path;
-}
-
-sub print_path($$)
-{
-    my ($path, $unix) = @_;
-
-    $path = cygpath ($path, $unix, $output_format);
-
-    print $path;
-}
-
-sub print_windows_sdk_home()
-{
-    my ($value, $key);
-
-    # This is for the Windows SDK 8 distributed with MSVS 2012
-    $value = reg_get_value ('HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Windows Kits/Installed Roots/KitsRoot');
-	
-	if (!defined $value) {
-        $value = reg_get_value ('HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/CurrentInstallFolder');
-    }
-    if (!defined $value) {
-        $value = reg_get_value ('HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/MicrosoftSDK/Directories/Install Dir');
-    }
-	
-    if (!defined $value) {
-        # Unclear whether we ever get here, don't the above match any
-        # recent Windows SDK?
-        foreach $key (File::Glob::bsd_glob('/proc/registry/HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/MicrosoftSDK/InstalledSDKs/*/Install Dir')) {
-            $value = reg_get_value ($key);
-            last if defined $value;
-        }
-    }
-
-    defined $value || die "Windows SDK not found";
-
-    print cygpath ($value, 'w', $output_format);
-}
-
-sub print_al_home()
-{
-    # Called by configure only if al.exe is not in the Windows SDK's
-    # bin folder, where it AFAIK always is in any recent Windows SDK,
-    # so whether this will ever be called is unclear...
-
-    my ($value, $key);
-
-    foreach $key (File::Glob::bsd_glob('/proc/registry/HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/*/WinSDK-NetFx40Tools/InstallationFolder')) {
-        $key =~ s!^/proc/registry/!!;
-        $value = reg_get_value ($key);
-
-        # Sigh, the same test that configure does for al.exe
-        # being either directly in it, or in a "bin" subdir... But on
-        # the other hand we don't want to be mislead by a registry key
-        # that matches the above but points to a directory that does
-        # in fact not contain an al.exe. For me, 
-        # HKLM/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v7.0A/WinSDK-NetFx40Tools/InstallationFolder
-        # contains
-        # c:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\bin\NETFX 4.0 Tools\
-        # but that then does not contain any al.exe.
-
-        if (-f "$value/bin/al.exe" || -f "$value/al.exe") {
-            print cygpath ($value, 'w', $output_format);
-            return;
-        }
-    }
-    die "Can't find al.exe";
-}
-
-my %msvs_2008 = (
-    'ver' => '9.0',
-    'key' => 'Microsoft/VisualStudio/9.0/Setup/VS/ProductDir',
-    'dll_path' => 'VC/redist/x86/Microsoft.VC90.CRT',
-    'dll_suffix' => '90'
-);
-my %msvc_2008 = (
-    'ver' => '9.0',
-    'key' => 'Microsoft/VisualStudio/9.0/Setup/VC/ProductDir',
-    'dll_path' => 'redist/x86/Microsoft.VC90.CRT',
-    'dll_suffix' => '90'
-);
-my %msvs_express_2008 = (
-    'ver' => '9.0',
-    'key' => 'Microsoft/VCExpress/9.0/Setup/VS/ProductDir',
-    'dll_path' => 'VC/redist/x86/Microsoft.VC90.CRT',
-    'dll_suffix' => '90'
-);
-my %msvc_express_2008 = (
-    'ver' => '9.0',
-    'key' => 'Microsoft/VCExpress/9.0/Setup/VC/ProductDir',
-    'dll_path' => 'redist/x86/Microsoft.VC90.CRT',
-    'dll_suffix' => '90'
-);
-my %msvs_2010 = (
-    'ver' => '10.0',
-    'key' => 'Microsoft/VisualStudio/10.0/Setup/VS/ProductDir',
-    'dll_path' => 'VC/redist/x86/Microsoft.VC100.CRT',
-    'dll_suffix' => '100'
-);
-my %msvc_2010 = (
-    'ver' => '10.0',
-    'key' => 'Microsoft/VisualStudio/10.0/Setup/VC/ProductDir',
-    'dll_path' => 'redist/x86/Microsoft.VC100.CRT',
-    'dll_suffix' => '100'
-);
-my %msvs_2012 = (
-    'ver' => '11.0',
-    'key' => 'Microsoft/VisualStudio/11.0/Setup/VS/ProductDir',
-    'dll_path' => 'VC/redist/x86/Microsoft.VC110.CRT',
-    'dll_suffix' => '110'
-);
-my %msvc_2012 = (
-    'ver' => '11.0',
-    'key' => 'Microsoft/VisualStudio/11.0/Setup/VC/ProductDir',
-    'dll_path' => 'redist/x86/Microsoft.VC110.CRT',
-    'dll_suffix' => '110'
-);
-
-sub find_msvs()
-{
-    my @ms_versions = ( \%msvs_2010, \%msvs_2012, \%msvs_2008, \%msvs_express_2008 );
-
-    for $ver (@ms_versions) {
-        my $install = reg_get_value ("HKEY_LOCAL_MACHINE/SOFTWARE/" . $ver->{'key'});
-        if (defined $install && $install ne '') {
-            $ver->{'product_dir'} = $install;
-            return $ver;
-        }
-    }
-    die "Can't find MS Visual Studio / VC++";
-}
-
-sub find_msvc()
-{
-    my @ms_versions = ( \%msvc_2010, \%msvc_2012, \%msvc_2008, \%msvc_express_2008 );
-
-    for $ver (@ms_versions) {
-        my $install = reg_get_value ("HKEY_LOCAL_MACHINE/SOFTWARE/" . $ver->{'key'});
-        if (defined $install && $install ne '') {
-            $ver->{'product_dir'} = $install;
-            return $ver;
-        }
-    }
-    die "Can't find MS Visual Studio / VC++";
-}
-
-sub print_msvc_ver()
-{
-    my $ver = find_msvc();
-    print $ver->{'ver'};
-}
-
-sub print_msvc_product_dir()
-{
-    my $ver = find_msvc();
-    print cygpath ($ver->{'product_dir'}, 'w', $output_format);
-}
-
-sub print_msvs_productdir()
-{
-    my $ver = find_msvs();
-    print cygpath ($ver->{'product_dir'}, 'w', $output_format);
-}
-
-sub print_csc_compiler_dir()
-{
-    my $csc_exe;
-    my $ver = find_msvc();
-    if ($ver->{'ver'} == "9.0") {
-        # We need to compile C# with the 3.5 or 2.0 compiler in order
-        # for the assemblies to be loadable by managed C++ code
-        # compiled with MSVC 2008.
-        $csc_exe =
-            reg_get_value ("HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/NET Framework Setup/NDP/v3.5/InstallPath") ||
-            reg_get_value ("HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/.NETFramework/InstallRoot") . "v2.0.50727";
-    } else {
-        # Is it enough to look for the 4.0 compiler?
-        $csc_exe =
-            reg_get_value ("HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/NET Framework Setup/NDP/v4/Client/InstallPath");
-    }
-    print cygpath ($csc_exe, 'w', $output_format);
-}
-
-sub print_dotnetsdk_dir()
-{
-    my $dir =
-          reg_get_value ("HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/.NETFramework/sdkInstallRootv1.1") ||
-          reg_get_value ("HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/.NETFramework/sdkInstallRootv2.0");
-    if ($dir) {
-        print cygpath ($dir, 'w', $output_format);
-    }
-}
-
-sub print_jdk_dir()
-{
-    my $dir =
-          reg_get_value ("HKEY_LOCAL_MACHINE/SOFTWARE/JavaSoft/Java\ Development\ Kit/1.7/JavaHome") ||
-          reg_get_value ("HKEY_LOCAL_MACHINE/SOFTWARE/JavaSoft/Java\ Development\ Kit/1.6/JavaHome") ||
-      reg_get_value ("HKEY_LOCAL_MACHINE/SOFTWARE/JavaSoft/Java\ Development\ Kit/1.5/JavaHome") ||
-      reg_get_value ("HKEY_LOCAL_MACHINE/SOFTWARE/JavaSoft/Java\ Development\ Kit/1.4/JavaHome") ||
-      reg_get_value ("HKEY_LOCAL_MACHINE/SOFTWARE/JavaSoft/Java\ Development\ Kit/1.3/JavaHome");
-    print cygpath($dir, 'w', $output_format);
-}
-
-sub copy_dll($$$)
-{
-    my ($src, $fname, $dest) = @_;
-
-    -f "$src/$fname" || die "can't find $src";
-    -d $dest || die "no directory $dest";
-
-    print STDERR "Copying $src/$fname to $dest\n";
-    copy ("$src/$fname", $dest) || die "copy failed: $!";
-    chmod (0755, "$dest/$fname") || die "failed to set dll executable: $!";
-}
-
-sub msvc_find_version($)
-{
-    my $checkpath = shift;
-    my $ver = find_msvc();
-    my $srcdir = (cygpath ($ver->{'product_dir'}, 'w', 'u') . '/' .
-          $ver->{$checkpath});
-    -d $srcdir && return $ver;
-    $ver = find_msvs();
-    $srcdir = (cygpath ($ver->{'product_dir'}, 'w', 'u') . '/' .
-          $ver->{$checkpath});
-    -d $srcdir && return $ver;
-    return undef;
-}
-
-sub msvc_copy_dlls($$)
-{
-    my $dest = shift;
-    my $arch = shift;
-    my $ver = msvc_find_version('dll_path');
-    defined $ver || return;
-    my $srcdir = (cygpath ($ver->{'product_dir'}, 'w', 'u') . '/' .
-          $ver->{'dll_path'});
-
-    $srcdir =~ s/x86/amd64/ if ($arch eq 'amd64');
-
-    copy_dll ($srcdir, "msvcp" . $ver->{'dll_suffix'} . ".dll",
-          $dest . $ver->{'dll_suffix'});
-    copy_dll ($srcdir, "msvcr" . $ver->{'dll_suffix'} . ".dll",
-          $dest . $ver->{'dll_suffix'});
-    if ($ver->{'dll_suffix'} == 90) {
-        copy_dll ($srcdir, "msvcm" . $ver->{'dll_suffix'} . ".dll",
-                  $dest . $ver->{'dll_suffix'});
-        copy_dll ($srcdir, "Microsoft.VC90.CRT.manifest", $dest . $ver->{'dll_suffix'});
-    }
-}
-
-sub msvc_find_msms()
-{
-    my $ver = find_msvc();
-    my $msm_path = (cygpath reg_get_value ("HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/VisualStudio/9.0/Setup/VS/MSMDir"), 'w', $output_format) ||
-	(cygpath reg_get_value ("HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/VisualStudio/10.0/Setup/VS/MSMDir"), 'w', $output_format) ||
-	(cygpath reg_get_value ("HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/VisualStudio/11.0/Setup/VS/MSMDir"), 'w', $output_format);
-    defined $msm_path || die "MSMDir not found";
-    return -e "$msm_path/Microsoft_VC".$ver->{'dll_suffix'}."_CRT_x86.msm" ? 0 : 1;
-}
-
-sub msvc_copy_msms($$)
-{
-    # $postfix is empty for x86, and '_x64' for x64
-    my ($dest, $postfix) = @_;
-
-    my $ver = find_msvc();
-    defined $ver || return;
-
-    my $msm_path = (cygpath reg_get_value ("HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/VisualStudio/9.0/Setup/VS/MSMDir"), 'w', $output_format) ||
-	(cygpath reg_get_value ("HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/VisualStudio/10.0/Setup/VS/MSMDir"), 'w', $output_format) ||
-	(cygpath reg_get_value ("HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/VisualStudio/11.0/Setup/VS/MSMDir"), 'w', $output_format);
-    defined $msm_path || die "MSMDir not found";
-	if ($ver->{'dll_suffix'} == 90) {
-	if ( $postfix eq "_x86" ) {
-	$postfix = ""
-	}
-    foreach $fname ("Microsoft_VC90_CRT_x86$postfix.msm", "policy_9_0_Microsoft_VC90_CRT_x86$postfix.msm") {
-        print STDERR "Copying $msm_path/$fname to $dest\n";
-        copy ("$msm_path/$fname", $dest) || die "copy failed: $!";
-    }
-	}
-	elsif ($ver->{'dll_suffix'} == 100) {
-    foreach $fname ("Microsoft_VC100_CRT$postfix.msm") {
-        print STDERR "Copying $msm_path/$fname to $dest\n";
-        copy ("$msm_path/$fname", $dest) || print "copy failed: $!\n";
-    }
-	}
-	else {
-	foreach $fname ("Microsoft_VC110_CRT$postfix.msm") {
-        print STDERR "Copying $msm_path/$fname to $dest\n";
-        copy ("$msm_path/$fname", $dest) || print "copy failed: $!\n";
-    }
-	}
-}
-
-if (!@ARGV) {
-    print_syntax();
-    exit 1;
-}
-
-my @commands = ();
-my $opt;
-while (@ARGV) {
-    $opt = shift @ARGV;
-
-    if ($opt eq '-w' || $opt eq '-u') {
-        $output_format = substr($opt, 1, 1);
-    } else {
-        push @commands, $opt;
-    }
-}
-
-while (@commands) {
-    $opt = shift @commands;
-
-    if (0) {
-    } elsif ($opt eq '--msvc-ver') {
-        print_msvc_ver();
-    } elsif ($opt eq '--msvc-copy-dlls') {
-        my $dest = shift @commands;
-        defined $dest || die "copy-dlls requires a destination directory";
-        msvc_copy_dlls( $dest, 'x86' );
-    } elsif ($opt eq '--msvc-copy-dlls-64') {
-        my $dest = shift @commands;
-        defined $dest || die "copy-dlls requires a destination directory";
-        msvc_copy_dlls( $dest, 'amd64' );
-    } elsif ($opt eq '--msvc-find-msms') {
-        exit msvc_find_msms();
-    } elsif ($opt eq '--msvc-copy-msms') {
-        my $dest = shift @commands;
-        defined $dest || die "copy-msms requires a destination directory";
-        msvc_copy_msms( $dest, '_x86' );
-    } elsif ($opt eq '--msvc-copy-msms-64') {
-        my $dest = shift @commands;
-        defined $dest || die "copy-msms-64 requires a destination directory";
-        msvc_copy_msms( $dest, '_x64' );
-    } elsif ($opt eq '--msvs-productdir') {
-        print_msvs_productdir();
-    } elsif ($opt eq '--msvc-productdir') {
-        print_msvc_product_dir();
-    } elsif ($opt eq '--dotnetsdk-dir') {
-        print_dotnetsdk_dir();
-    } elsif ($opt eq '--csc-compilerdir') {
-        print_csc_compiler_dir();
-    } elsif ($opt eq '--windows-sdk-home') {
-        print_windows_sdk_home();
-	} elsif ($opt eq '--al-home') {
-        print_al_home();
-    } elsif ($opt eq '--jdk-home') {
-        print_jdk_dir();
-    } elsif ($opt eq '--help' || $opt eq '/?') {
-        print_syntax();
-    } else {
-        print "Unknown option '$opt'\n";
-        print_syntax();
-        exit 1;
-    }
-}
-
-# vim:set shiftwidth=4 softtabstop=4 expandtab:


More information about the Libreoffice-commits mailing list