summaryrefslogtreecommitdiff
path: root/oowintool
diff options
context:
space:
mode:
authorTor Lillqvist <tlillqvist@suse.com>2012-03-09 10:35:20 +0200
committerTor Lillqvist <tlillqvist@suse.com>2012-03-09 10:59:11 +0200
commitdcc9096b857fa2b22eee1f4e025e82c0f4320f16 (patch)
treed7d789739b1196a8784ed4a654bc7f277e1b2284 /oowintool
parent5ce2c589081aaa6f5414c12cdabd8e96482430c3 (diff)
Add mode lines, untabify, clean up indentation
Diffstat (limited to 'oowintool')
-rwxr-xr-xoowintool144
1 files changed, 72 insertions, 72 deletions
diff --git a/oowintool b/oowintool
index 3515ccd64a44..ce55e888c467 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: