[Libreoffice-commits] .: 4 commits - oowintool

Tor Lillqvist tml at kemper.freedesktop.org
Fri Mar 9 01:02:41 PST 2012


 oowintool |  145 ++++++++++++++++++++++++++++++--------------------------------
 1 file changed, 72 insertions(+), 73 deletions(-)

New commits:
commit dcc9096b857fa2b22eee1f4e025e82c0f4320f16
Author: Tor Lillqvist <tlillqvist at suse.com>
Date:   Fri Mar 9 10:35:20 2012 +0200

    Add mode lines, untabify, clean up indentation

diff --git a/oowintool b/oowintool
index 3515ccd..ce55e88 100755
--- a/oowintool
+++ b/oowintool
@@ -1,4 +1,4 @@
-#!/usr/bin/perl -w
+#!/usr/bin/perl -w # -*- tab-width: 4; cperl-indent-level: 4; indent-tabs-mode: nil -*-
 
 use File::Copy;
 
@@ -20,7 +20,7 @@ sub reg_get_value($)
     if ( defined $value ) {
         chomp ($value);
         $value =~ s|\r\n||;
-#    print "Value '$value' at '$key'\n";
+        # print "Value '$value' at '$key'\n";
     }
 
     return $value;
@@ -64,20 +64,20 @@ sub cygpath($$$)
     return $path if ( ! defined $path );
     # Strip trailing path separators
     if ($input_format eq 'u') {
-	$path =~ s|/*\s*$||;
+        $path =~ s|/*\s*$||;
     } else {
-	$path =~ s|\\*\s*$||;
+        $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;
+        $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;
+        $path =~ s|/cygdrive/([a-zA-Z])/|/$1/|g;
+        $path =~ s|/|\\|g;
     }
 
     return $path;
@@ -88,33 +88,34 @@ sub print_path($$)
     my ($path, $unix) = @_;
 
     $path = cygpath ($path, $unix, $output_format);
-    
+
     print $path;
 }
 
 sub print_windows_sdk_home()
 {
     my ($value, $key);
+
     $value = reg_get_value ('HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v6.1/InstallationFolder');
-    if (!defined $value)
-    {
+
+    if (!defined $value) {
         $value = reg_get_value ('HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v7.1/InstallationFolder');
-	}
-    if (!defined $value)
-    {
+    }
+
+    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)
-    {
-	    $key = reg_find_key ('HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/MicrosoftSDK/InstalledSDKs/*/Install Dir');
-	    $value = reg_get_value ($key);
-	}
-
-    defined $value || die "Windows Sdk not found";
+    }
+
+    if (!defined $value) {
+        $value = reg_get_value ('HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/MicrosoftSDK/Directories/Install Dir');
+    }
+
+    if (!defined $value) {
+        $key = reg_find_key ('HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/MicrosoftSDK/InstalledSDKs/*/Install Dir');
+        $value = reg_get_value ($key);
+    }
+
+    defined $value || die "Windows SDK not found";
 
     print cygpath ($value, 'w', $output_format);
 }
@@ -160,13 +161,12 @@ sub find_msvs()
 {
     my @ms_versions = ( \%msvs_2008, \%msvs_express_2008, \%msvs_2010 );
 
-    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;
-	}
+    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++";
 }
@@ -175,13 +175,12 @@ sub find_msvc()
 {
     my @ms_versions = ( \%msvc_2008, \%msvc_express_2008, \%msvc_2010 );
 
-    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;
-	}
+    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++";
 }
@@ -219,7 +218,7 @@ sub print_dotnetsdk_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);
+        print cygpath ($dir, 'w', $output_format);
     }
 }
 
@@ -228,9 +227,9 @@ 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");
+      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); 
 }
 
@@ -251,11 +250,11 @@ sub msvc_find_version($)
     my $checkpath = shift;
     my $ver = find_msvc();
     my $srcdir = (cygpath ($ver->{'product_dir'}, 'w', 'u') . '/' . 
-		  $ver->{$checkpath});
+          $ver->{$checkpath});
     -d $srcdir && return $ver;
     $ver = find_msvs();
     $srcdir = (cygpath ($ver->{'product_dir'}, 'w', 'u') . '/' . 
-		  $ver->{$checkpath});
+          $ver->{$checkpath});
     -d $srcdir && return $ver;
     return undef;
 }
@@ -266,12 +265,12 @@ sub msvc_copy_dlls($)
     my $ver = msvc_find_version('dll_path');
     defined $ver || return;
     my $srcdir = (cygpath ($ver->{'product_dir'}, 'w', 'u') . '/' . 
-		  $ver->{'dll_path'});
+          $ver->{'dll_path'});
 
     copy_dll ($srcdir, "msvcp" . $ver->{'dll_suffix'} . ".dll",
-	      $dest . $ver->{'dll_suffix'});
+          $dest . $ver->{'dll_suffix'});
     copy_dll ($srcdir, "msvcr" . $ver->{'dll_suffix'} . ".dll",
-	      $dest . $ver->{'dll_suffix'});
+          $dest . $ver->{'dll_suffix'});
     if ($ver->{'dll_suffix'} == 90) {
         copy_dll ($srcdir, "msvcm" . $ver->{'dll_suffix'} . ".dll",
                   $dest . $ver->{'dll_suffix'});
@@ -309,11 +308,11 @@ my @commands = ();
 my $opt;
 while (@ARGV) {
     $opt = shift @ARGV;
-    
+
     if ($opt eq '-w' || $opt eq '-u') {
-	$output_format = substr($opt, 1, 1);
+        $output_format = substr($opt, 1, 1);
     } else {
-	push @commands, $opt;
+        push @commands, $opt;
     }
 }
 
@@ -322,37 +321,38 @@ while (@commands) {
 
     if (0) {
     } elsif ($opt eq '--msvc-ver') {
-	print_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 );
+        my $dest = shift @commands;
+        defined $dest || die "copy-dlls requires a destination directory";
+        msvc_copy_dlls( $dest );
     } elsif ($opt eq '--msvc-copy-msms') {
-	my $dest = shift @commands;
-	defined $dest || die "copy-msms requires a destination directory";
-	msvc_copy_msms( $dest, '' );
+        my $dest = shift @commands;
+        defined $dest || die "copy-msms requires a destination directory";
+        msvc_copy_msms( $dest, '' );
     } 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' );
+        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();
+        print_msvs_productdir();
     } elsif ($opt eq '--msvc-productdir') {
-	print_msvc_product_dir();
+        print_msvc_product_dir();
     } elsif ($opt eq '--dotnetsdk-dir') {
-	print_dotnetsdk_dir();
+        print_dotnetsdk_dir();
     } elsif ($opt eq '--csc-compilerdir') {
-	print_csc_compiler_dir();
+        print_csc_compiler_dir();
     } elsif ($opt eq '--windows-sdk-home') {
-	print_windows_sdk_home();
+        print_windows_sdk_home();
     } elsif ($opt eq '--jdk-home') {
-	print_jdk_dir();
+        print_jdk_dir();
     } elsif ($opt eq '--help' || $opt eq '/?') {
-	print_syntax();
+        print_syntax();
     } else {
-	print "Unknown option '$opt'\n";
-	print_syntax();
-	exit 1;
+        print "Unknown option '$opt'\n";
+        print_syntax();
+        exit 1;
     }
 }
 
+# vim:set shiftwidth=4 softtabstop=4 expandtab:
commit 5ce2c589081aaa6f5414c12cdabd8e96482430c3
Author: Tor Lillqvist <tlillqvist at suse.com>
Date:   Fri Mar 9 10:26:09 2012 +0200

    Look for Windows SDK v7.1, too

diff --git a/oowintool b/oowintool
index a0ca4f6..3515ccd 100755
--- a/oowintool
+++ b/oowintool
@@ -98,6 +98,10 @@ sub print_windows_sdk_home()
     $value = reg_get_value ('HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v6.1/InstallationFolder');
     if (!defined $value)
     {
+        $value = reg_get_value ('HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v7.1/InstallationFolder');
+	}
+    if (!defined $value)
+    {
         $value = reg_get_value ('HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/CurrentInstallFolder');
 	}
     if (!defined $value)
commit 2a2c05e99c47297a8793a54728af8355149d897a
Author: Tor Lillqvist <tlillqvist at suse.com>
Date:   Fri Mar 9 10:22:44 2012 +0200

    Redirect error message we aren't interested in to /dev/null

diff --git a/oowintool b/oowintool
index 7dff692..a0ca4f6 100755
--- a/oowintool
+++ b/oowintool
@@ -32,7 +32,7 @@ sub reg_find_key($)
     # depending on OS version, this will de-mangle that
     my $key = shift;
     $key =~ s| |\\ |;
-    $key = `cd /proc/registry/ ; ls $key`;
+    $key = `cd /proc/registry/ ; ls $key 2>/dev/null`;
 
     return $key;
 }
commit e655c33a3c51a0848f98cefefdc0a8358527ecf5
Author: Tor Lillqvist <tlillqvist at suse.com>
Date:   Fri Mar 9 10:18:44 2012 +0200

    Bin leftover old crack: There is no "platformsdk" under the MSVC folder

diff --git a/oowintool b/oowintool
index 7c74ae0..7dff692 100755
--- a/oowintool
+++ b/oowintool
@@ -109,11 +109,6 @@ sub print_windows_sdk_home()
 	    $key = reg_find_key ('HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/MicrosoftSDK/InstalledSDKs/*/Install Dir');
 	    $value = reg_get_value ($key);
 	}
-    if (!defined $value)
-    {
-        my $dir = cygpath (find_msvc()->{'product_dir'}, 'w', $output_format);
-		$value = `/bin/find "$dir" -iname platformsdk | head -n 1`;
-    }
 
     defined $value || die "Windows Sdk not found";
 


More information about the Libreoffice-commits mailing list