summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTor Lillqvist <tlillqvist@suse.com>2012-11-28 19:57:41 +0200
committerTor Lillqvist <tlillqvist@suse.com>2012-11-28 20:53:43 +0200
commit13fa5d94f287f6e6bba767bd491731667f921b48 (patch)
treeed06ba27183d0ec73973fd91b19428eb8cf31461
parentadcb31d12166a6117b2800eb3a7d32ace9efd9f7 (diff)
Make print_al_home more reliable
Change-Id: Ib979916a32a9a9ea8ae1e711559613e8b6b3dfe9
-rwxr-xr-xoowintool46
1 files changed, 30 insertions, 16 deletions
diff --git a/oowintool b/oowintool
index c7be35693c98..d92716994953 100755
--- a/oowintool
+++ b/oowintool
@@ -2,6 +2,7 @@
# -*- tab-width: 4; cperl-indent-level: 4; indent-tabs-mode: nil -*-
use File::Copy;
+use File::Glob;
my $output_format = 'u';
@@ -27,17 +28,6 @@ sub reg_get_value($)
return $value;
}
-sub reg_find_key($)
-{
- # it is believed that the registry moves keys around
- # depending on OS version, this will de-mangle that
- my $key = shift;
- $key =~ s| |\\ |;
- $key = `cd /proc/registry/ ; ls $key 2>/dev/null`;
-
- return $key;
-}
-
sub print_syntax()
{
print "oowintool [option] ...\n";
@@ -99,6 +89,7 @@ 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) {
@@ -108,10 +99,13 @@ sub print_windows_sdk_home()
$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);
+ # 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";
@@ -121,12 +115,32 @@ sub print_windows_sdk_home()
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);
- $key = reg_find_key ('HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/*/WinSDK-NetFx40Tools/InstallationFolder');
+ 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);
- print cygpath ($value, 'w', $output_format);
+ # 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 = (