1a7e2c521SPedro Giffuni#!/usr/bin/perl -w 2b31e36b3SAndrew Rist# ************************************************************* 3b31e36b3SAndrew Rist# 4b31e36b3SAndrew Rist# Licensed to the Apache Software Foundation (ASF) under one 5b31e36b3SAndrew Rist# or more contributor license agreements. See the NOTICE file 6b31e36b3SAndrew Rist# distributed with this work for additional information 7b31e36b3SAndrew Rist# regarding copyright ownership. The ASF licenses this file 8b31e36b3SAndrew Rist# to you under the Apache License, Version 2.0 (the 9b31e36b3SAndrew Rist# "License"); you may not use this file except in compliance 10b31e36b3SAndrew Rist# with the License. You may obtain a copy of the License at 11b31e36b3SAndrew Rist# 12b31e36b3SAndrew Rist# http://www.apache.org/licenses/LICENSE-2.0 13b31e36b3SAndrew Rist# 14b31e36b3SAndrew Rist# Unless required by applicable law or agreed to in writing, 15b31e36b3SAndrew Rist# software distributed under the License is distributed on an 16b31e36b3SAndrew Rist# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17b31e36b3SAndrew Rist# KIND, either express or implied. See the License for the 18b31e36b3SAndrew Rist# specific language governing permissions and limitations 19b31e36b3SAndrew Rist# under the License. 20b31e36b3SAndrew Rist# 21b31e36b3SAndrew Rist# ************************************************************* 22cdf0e10cSrcweir 23cdf0e10cSrcweiruse File::Copy; 24cdf0e10cSrcweir 25cdf0e10cSrcweirmy $output_format = 'u'; 26*edd74ba5SDamjan Jovanovicmy $aoo32OnWin64 = 0; 27*edd74ba5SDamjan Jovanovic 28cdf0e10cSrcweir 29cdf0e10cSrcweirsub reg_get_value($) 30cdf0e10cSrcweir{ 31cdf0e10cSrcweir # it is believed that the registry moves keys around 32cdf0e10cSrcweir # depending on OS version, this will de-mangle that 33cdf0e10cSrcweir my $key = shift; 34cdf0e10cSrcweir my $fhandle; 35cdf0e10cSrcweir my $value; 36cdf0e10cSrcweir 37cdf0e10cSrcweir open ($fhandle, "/proc/registry/$key") || return; 38cdf0e10cSrcweir # reg keys have 0x00 0x5c at the end 39cdf0e10cSrcweir $value = (split /\0/, <$fhandle>)[0]; 40cdf0e10cSrcweir close ($fhandle); 41cdf0e10cSrcweir 42cdf0e10cSrcweir if ( defined $value ) { 43cdf0e10cSrcweir chomp ($value); 44cdf0e10cSrcweir $value =~ s|\r\n||; 45cdf0e10cSrcweir# print "Value '$value' at '$key'\n"; 46cdf0e10cSrcweir } 47cdf0e10cSrcweir 48cdf0e10cSrcweir return $value; 49cdf0e10cSrcweir} 50cdf0e10cSrcweir 51cdf0e10cSrcweirsub reg_find_key($) 52cdf0e10cSrcweir{ 53cdf0e10cSrcweir # it is believed that the registry moves keys around 54cdf0e10cSrcweir # depending on OS version, this will de-mangle that 55cdf0e10cSrcweir my $key = shift; 56cdf0e10cSrcweir $key =~ s| |\\ |; 57cdf0e10cSrcweir $key = `cd /proc/registry/ ; ls $key`; 58cdf0e10cSrcweir 59cdf0e10cSrcweir return $key; 60cdf0e10cSrcweir} 61cdf0e10cSrcweir 62cdf0e10cSrcweirsub print_syntax() 63cdf0e10cSrcweir{ 64cdf0e10cSrcweir print "oowintool [option] ...\n"; 65cdf0e10cSrcweir print " encoding options\n"; 66cdf0e10cSrcweir print " -w - windows form\n"; 67cdf0e10cSrcweir print " -u - unix form (default)\n"; 68cdf0e10cSrcweir print " commands:\n"; 69cdf0e10cSrcweir print " --msvc-ver - dump version of MSVC eg. 6.0\n"; 70cdf0e10cSrcweir print " --msvc-copy-dlls <dest> - copy msvc[pr]??.dlls into <dest>/msvcp??/\n"; 71cdf0e10cSrcweir print " --msvc-productdir - dump productdir\n"; 72cdf0e10cSrcweir print " --msvs-productdir - dump productdir\n"; 73cdf0e10cSrcweir print " --dotnetsdk-dir - dump .Net SDK path\n"; 74cdf0e10cSrcweir print " --csc-compilerdir - dump .Net SDK compiler path\n"; 75cdf0e10cSrcweir print " --psdk-home - dump psdk install dir\n"; 76cdf0e10cSrcweir print " --jdk-home - dump the jdk install dir\n"; 77cdf0e10cSrcweir print " --nsis-dir - dump NSIS path\n"; 78cdf0e10cSrcweir print " --help - this message\n"; 79cdf0e10cSrcweir} 80cdf0e10cSrcweir 81cdf0e10cSrcweirsub cygpath($$$) 82cdf0e10cSrcweir{ 83cdf0e10cSrcweir my ($path, $input_format, $format) = @_; 84cdf0e10cSrcweir 85cdf0e10cSrcweir return $path if ( ! defined $path ); 86cdf0e10cSrcweir # Strip trailing path separators 87cdf0e10cSrcweir if ($input_format eq 'u') { 88cdf0e10cSrcweir $path =~ s|/*\s*$||; 89cdf0e10cSrcweir } else { 90cdf0e10cSrcweir $path =~ s|\\*\s*$||; 91cdf0e10cSrcweir } 92cdf0e10cSrcweir 93cdf0e10cSrcweir # 'Unterminated quoted string errors' from 'ash' when 94cdf0e10cSrcweir # forking cygpath so - reimplement cygpath in perl [ gack ] 95cdf0e10cSrcweir if ($format eq 'u' && $input_format eq 'w') { 96cdf0e10cSrcweir $path =~ s|\\|/|g; 97cdf0e10cSrcweir $path =~ s|([a-zA-Z]):/|/cygdrive/$1/|g; 98cdf0e10cSrcweir } 99cdf0e10cSrcweir elsif ($format eq 'w' && $input_format eq 'u') { 100cdf0e10cSrcweir $path =~ s|/cygdrive/([a-zA-Z])/|/$1/|g; 101cdf0e10cSrcweir $path =~ s|/|\\|g; 102cdf0e10cSrcweir } 103cdf0e10cSrcweir 104cdf0e10cSrcweir return $path; 105cdf0e10cSrcweir} 106cdf0e10cSrcweir 107cdf0e10cSrcweirsub print_path($$) 108cdf0e10cSrcweir{ 109cdf0e10cSrcweir my ($path, $unix) = @_; 110cdf0e10cSrcweir 111cdf0e10cSrcweir $path = cygpath ($path, $unix, $output_format); 112cdf0e10cSrcweir 113cdf0e10cSrcweir print $path; 114cdf0e10cSrcweir} 115cdf0e10cSrcweir 116cdf0e10cSrcweirsub print_psdk_home() 117cdf0e10cSrcweir{ 118cdf0e10cSrcweir my ($value, $key); 119cdf0e10cSrcweir $value = reg_get_value ('HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v6.1/InstallationFolder'); 120cdf0e10cSrcweir if (!defined $value) 121cdf0e10cSrcweir { 122cdf0e10cSrcweir $value = reg_get_value ('HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/CurrentInstallFolder'); 12301d9dfefSHerbert Dürr } 124cdf0e10cSrcweir if (!defined $value) 125cdf0e10cSrcweir { 126cdf0e10cSrcweir $value = reg_get_value ('HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/MicrosoftSDK/Directories/Install Dir'); 12701d9dfefSHerbert Dürr } 128cdf0e10cSrcweir if (!defined $value) 129cdf0e10cSrcweir { 130cdf0e10cSrcweir $key = reg_find_key ('HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/MicrosoftSDK/InstalledSDKs/*/Install Dir'); 131cdf0e10cSrcweir $value = reg_get_value ($key); 13201d9dfefSHerbert Dürr } 133cdf0e10cSrcweir if (!defined $value) 134cdf0e10cSrcweir { 135cdf0e10cSrcweir my $dir = cygpath (find_msvc()->{'product_dir'}, 'w', $output_format); 136cdf0e10cSrcweir $value = `/bin/find "$dir" -iname platformsdk | head -n 1`; 137cdf0e10cSrcweir } 138cdf0e10cSrcweir 139cdf0e10cSrcweir defined $value || die "psdk not found"; 140cdf0e10cSrcweir 141cdf0e10cSrcweir print cygpath ($value, 'w', $output_format); 142cdf0e10cSrcweir} 143cdf0e10cSrcweir 144cdf0e10cSrcweirmy %msvc_net_2003 = ( 145cdf0e10cSrcweir 'ver' => '7.1', 146cdf0e10cSrcweir 'key' => 'Microsoft/VisualStudio/7.1/Setup/VC/ProductDir', 147cdf0e10cSrcweir 'dll_path' => '../Visual Studio .NET Professional 2003 - English', 148cdf0e10cSrcweir 'dll_suffix' => '71' 149cdf0e10cSrcweir); 150cdf0e10cSrcweirmy %msvs_net_2003 = ( 151cdf0e10cSrcweir 'ver' => '7.1', 152cdf0e10cSrcweir 'key' => 'Microsoft/VisualStudio/7.1/Setup/VS/ProductDir', 153cdf0e10cSrcweir 'dll_path' => 'Visual Studio .NET Professional 2003 - English', 154cdf0e10cSrcweir 'dll_suffix' => '71' 155cdf0e10cSrcweir); 156cdf0e10cSrcweirmy %msvs_net_2003_ea = ( 157cdf0e10cSrcweir 'ver' => '7.1', 158cdf0e10cSrcweir 'key' => 'Microsoft/VisualStudio/7.1/Setup/VS/ProductDir', 159cdf0e10cSrcweir 'dll_path' => 'Visual Studio .NET Enterprise Architect 2003 - English', # testme ... 160cdf0e10cSrcweir 'dll_suffix' => '71' 161cdf0e10cSrcweir); 162cdf0e10cSrcweirmy %msvs_express_2005 = ( 163cdf0e10cSrcweir 'ver' => '8.0', 164cdf0e10cSrcweir 'key' => 'Microsoft/VCExpress/8.0/Setup/VS/ProductDir', 165cdf0e10cSrcweir 'dll_path' => '../SDK/v2.0/Bin', 166cdf0e10cSrcweir 'dll_suffix' => '80' 167cdf0e10cSrcweir); 168cdf0e10cSrcweirmy %msvc_express_2005 = ( 169cdf0e10cSrcweir 'ver' => '8.0', 170cdf0e10cSrcweir 'key' => 'Microsoft/VCExpress/8.0/Setup/VC/ProductDir', 171cdf0e10cSrcweir 'dll_path' => '../SDK/v2.0/Bin', 172cdf0e10cSrcweir 'dll_suffix' => '80' 173cdf0e10cSrcweir); 174cdf0e10cSrcweirmy %msvs_2005 = ( 175cdf0e10cSrcweir 'ver' => '8.0', 176cdf0e10cSrcweir 'key' => 'Microsoft/VisualStudio/8.0/Setup/VS/ProductDir', 177cdf0e10cSrcweir 'dll_path' => 'Visual Studio .NET Professional 2005 - English', 178cdf0e10cSrcweir 'dll_suffix' => '80' 179cdf0e10cSrcweir); 180cdf0e10cSrcweirmy %msvc_2005 = ( 181cdf0e10cSrcweir 'ver' => '8.0', 182cdf0e10cSrcweir 'key' => 'Microsoft/VisualStudio/8.0/Setup/VC/ProductDir', 183cdf0e10cSrcweir 'dll_path' => '../SDK/v2.0/Bin', 184cdf0e10cSrcweir 'dll_suffix' => '80' 185cdf0e10cSrcweir); 186cdf0e10cSrcweirmy %msvs_2008 = ( 187cdf0e10cSrcweir 'ver' => '9.0', 188cdf0e10cSrcweir 'key' => 'Microsoft/VisualStudio/9.0/Setup/VS/ProductDir', 189cdf0e10cSrcweir 'dll_path' => 'VC/redist/x86/Microsoft.VC90.CRT', 190cdf0e10cSrcweir 'dll_suffix' => '90' 191cdf0e10cSrcweir); 192cdf0e10cSrcweirmy %msvc_2008 = ( 193cdf0e10cSrcweir 'ver' => '9.0', 194cdf0e10cSrcweir 'key' => 'Microsoft/VisualStudio/9.0/Setup/VC/ProductDir', 195cdf0e10cSrcweir 'dll_path' => 'redist/x86/Microsoft.VC90.CRT', 196cdf0e10cSrcweir 'dll_suffix' => '90' 197cdf0e10cSrcweir); 198cdf0e10cSrcweirmy %msvs_express_2008 = ( 199cdf0e10cSrcweir 'ver' => '9.0', 200cdf0e10cSrcweir 'key' => 'Microsoft/VCExpress/9.0/Setup/VS/ProductDir', 201cdf0e10cSrcweir 'dll_path' => 'VC/redist/x86/Microsoft.VC90.CRT', 202cdf0e10cSrcweir 'dll_suffix' => '90' 203cdf0e10cSrcweir); 204cdf0e10cSrcweirmy %msvc_express_2008 = ( 205cdf0e10cSrcweir 'ver' => '9.0', 206cdf0e10cSrcweir 'key' => 'Microsoft/VCExpress/9.0/Setup/VC/ProductDir', 207cdf0e10cSrcweir 'dll_path' => 'redist/x86/Microsoft.VC90.CRT', 208cdf0e10cSrcweir 'dll_suffix' => '90' 209cdf0e10cSrcweir); 210cdf0e10cSrcweir 211cdf0e10cSrcweirsub find_msvs() 212cdf0e10cSrcweir{ 213cdf0e10cSrcweir my @ms_versions = ( \%msvs_2008, \%msvs_express_2008, \%msvs_2005, \%msvs_express_2005, \%msvs_net_2003_ea, \%msvs_net_2003 ); 214cdf0e10cSrcweir 215cdf0e10cSrcweir for $ver (@ms_versions) 216cdf0e10cSrcweir { 217cdf0e10cSrcweir my $install = reg_get_value ("HKEY_LOCAL_MACHINE/SOFTWARE/" . $ver->{'key'}); 218cdf0e10cSrcweir if (defined $install && $install ne '') { 219cdf0e10cSrcweir $ver->{'product_dir'} = $install; 220cdf0e10cSrcweir return $ver; 221cdf0e10cSrcweir } 222adb6f5d8SDamjan Jovanovic $install = reg_get_value ("HKEY_LOCAL_MACHINE/SOFTWARE/Wow6432Node/" . $ver->{'key'}); 223adb6f5d8SDamjan Jovanovic if (defined $install && $install ne '') { 224adb6f5d8SDamjan Jovanovic $ver->{'product_dir'} = $install; 225adb6f5d8SDamjan Jovanovic return $ver; 226adb6f5d8SDamjan Jovanovic } 227cdf0e10cSrcweir } 228cdf0e10cSrcweir die "Can't find MS Visual Studio / VC++"; 229cdf0e10cSrcweir} 230cdf0e10cSrcweir 231cdf0e10cSrcweirsub find_msvc() 232cdf0e10cSrcweir{ 233cdf0e10cSrcweir my @ms_versions = ( \%msvc_2008, \%msvc_express_2008, \%msvc_2005, \%msvc_express_2005, \%msvc_net_2003 ); 234cdf0e10cSrcweir 235cdf0e10cSrcweir for $ver (@ms_versions) 236cdf0e10cSrcweir { 237cdf0e10cSrcweir my $install = reg_get_value ("HKEY_LOCAL_MACHINE/SOFTWARE/" . $ver->{'key'}); 238cdf0e10cSrcweir if (defined $install && $install ne '') { 239cdf0e10cSrcweir $ver->{'product_dir'} = $install; 240cdf0e10cSrcweir return $ver; 241cdf0e10cSrcweir } 242adb6f5d8SDamjan Jovanovic $install = reg_get_value("HKEY_LOCAL_MACHINE/SOFTWARE/Wow6432Node/" . $ver->{'key'}); 243adb6f5d8SDamjan Jovanovic if (defined $install && $install ne '') { 244adb6f5d8SDamjan Jovanovic $ver->{'product_dir'} = $install; 245adb6f5d8SDamjan Jovanovic return $ver; 246adb6f5d8SDamjan Jovanovic } 247cdf0e10cSrcweir } 248cdf0e10cSrcweir die "Can't find MS Visual Studio / VC++"; 249cdf0e10cSrcweir} 250cdf0e10cSrcweir 251cdf0e10cSrcweirsub print_msvc_ver() 252cdf0e10cSrcweir{ 253cdf0e10cSrcweir my $ver = find_msvc(); 254cdf0e10cSrcweir print $ver->{'ver'}; 255cdf0e10cSrcweir} 256cdf0e10cSrcweir 257cdf0e10cSrcweirsub print_msvc_product_dir() 258cdf0e10cSrcweir{ 259cdf0e10cSrcweir my $ver = find_msvc(); 260cdf0e10cSrcweir print cygpath ($ver->{'product_dir'}, 'w', $output_format); 261cdf0e10cSrcweir} 262cdf0e10cSrcweir 263cdf0e10cSrcweirsub print_msvs_productdir() 264cdf0e10cSrcweir{ 265cdf0e10cSrcweir my $ver = find_msvs(); 266cdf0e10cSrcweir print cygpath ($ver->{'product_dir'}, 'w', $output_format); 267cdf0e10cSrcweir} 268cdf0e10cSrcweir 269cdf0e10cSrcweirsub print_csc_compiler_dir() 270cdf0e10cSrcweir{ 271cdf0e10cSrcweir my $dir = cygpath (reg_get_value ("HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/.NETFramework/InstallRoot"), 'w', $output_format); 272cdf0e10cSrcweir my $csc_exe = `/bin/find "$dir" -iname csc.exe | grep "v2\." | head -n 1`; 273cdf0e10cSrcweir print `dirname $csc_exe`; 274cdf0e10cSrcweir} 275cdf0e10cSrcweir 276cdf0e10cSrcweirsub print_dotnetsdk_dir() 277cdf0e10cSrcweir{ 278cdf0e10cSrcweir my $dir = 279cdf0e10cSrcweir reg_get_value ("HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/.NETFramework/sdkInstallRootv1.1") || 280cdf0e10cSrcweir reg_get_value ("HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/.NETFramework/sdkInstallRootv2.0"); 281668ddc01SDamjan Jovanovic defined $dir || exit 1; 282cdf0e10cSrcweir print cygpath ($dir, 'w', $output_format); 283cdf0e10cSrcweir} 284cdf0e10cSrcweir 285cdf0e10cSrcweirsub print_jdk_dir() 286cdf0e10cSrcweir{ 287*edd74ba5SDamjan Jovanovic my $softwareKey; 288*edd74ba5SDamjan Jovanovic if ($aoo32OnWin64) { 289*edd74ba5SDamjan Jovanovic $softwareKey = "HKEY_LOCAL_MACHINE/SOFTWARE/Wow6432Node/"; 290*edd74ba5SDamjan Jovanovic } else { 291*edd74ba5SDamjan Jovanovic $softwareKey = "HKEY_LOCAL_MACHINE/SOFTWARE/"; 292a77ce2d1SDamjan Jovanovic } 293*edd74ba5SDamjan Jovanovic # Java 1.9 had to be different: 294*edd74ba5SDamjan Jovanovic my $currentVersion = reg_get_value ($softwareKey . "JavaSoft/JDK/CurrentVersion"); 295*edd74ba5SDamjan Jovanovic if (defined $currentVersion) { 296*edd74ba5SDamjan Jovanovic my $newDir = reg_get_value ($softwareKey . "JavaSoft/JDK/" . $currentVersion . "/JavaHome"); 297*edd74ba5SDamjan Jovanovic if (defined $newDir) { 298*edd74ba5SDamjan Jovanovic print cygpath($newDir, 'w', $output_format); 299*edd74ba5SDamjan Jovanovic return; 300*edd74ba5SDamjan Jovanovic } 301*edd74ba5SDamjan Jovanovic } 302*edd74ba5SDamjan Jovanovic my $dir = 303*edd74ba5SDamjan Jovanovic reg_get_value ($softwareKey . "JavaSoft/Java\ Development\ Kit/1.8/JavaHome") || 304*edd74ba5SDamjan Jovanovic reg_get_value ($softwareKey . "JavaSoft/Java\ Development\ Kit/1.7/JavaHome") || 305*edd74ba5SDamjan Jovanovic reg_get_value ($softwareKey . "JavaSoft/Java\ Development\ Kit/1.6/JavaHome") || 306*edd74ba5SDamjan Jovanovic reg_get_value ($softwareKey . "JavaSoft/Java\ Development\ Kit/1.5/JavaHome") || 307*edd74ba5SDamjan Jovanovic reg_get_value ($softwareKey . "JavaSoft/Java\ Development\ Kit/1.4/JavaHome") || 308*edd74ba5SDamjan Jovanovic reg_get_value ($softwareKey . "JavaSoft/Java\ Development\ Kit/1.3/JavaHome"); 309*edd74ba5SDamjan Jovanovic defined $dir || exit 1; 310*edd74ba5SDamjan Jovanovic print cygpath($dir, 'w', $output_format); 311cdf0e10cSrcweir} 312cdf0e10cSrcweir 313cdf0e10cSrcweirsub print_nsis_dir() 314cdf0e10cSrcweir{ 315cdf0e10cSrcweir my $dir = reg_get_value ("HKEY_LOCAL_MACHINE/SOFTWARE/NSIS/@"); 316cdf0e10cSrcweir print cygpath ($dir, 'w', $output_format) if defined $dir; 317cdf0e10cSrcweir} 318cdf0e10cSrcweir 319cdf0e10cSrcweirsub copy_dll($$$) 320cdf0e10cSrcweir{ 321cdf0e10cSrcweir my ($src, $fname, $dest) = @_; 322cdf0e10cSrcweir 323cdf0e10cSrcweir -f "$src/$fname" || die "can't find $src"; 324cdf0e10cSrcweir -d $dest || die "no directory $dest"; 325cdf0e10cSrcweir 326cdf0e10cSrcweir print STDERR "Copying $src/$fname to $dest\n"; 327cdf0e10cSrcweir copy ("$src/$fname", $dest) || die "copy failed: $!"; 328cdf0e10cSrcweir chmod (0755, "$dest/$fname") || die "failed to set dll executable: $!"; 329cdf0e10cSrcweir} 330cdf0e10cSrcweir 331cdf0e10cSrcweirsub msvc_find_version($) 332cdf0e10cSrcweir{ 333cdf0e10cSrcweir my $checkpath = shift; 334cdf0e10cSrcweir my $ver = find_msvc(); 335cdf0e10cSrcweir my $srcdir = (cygpath ($ver->{'product_dir'}, 'w', 'u') . '/' . 336cdf0e10cSrcweir $ver->{$checkpath}); 337cdf0e10cSrcweir -d $srcdir && return $ver; 338cdf0e10cSrcweir $ver = find_msvs(); 339cdf0e10cSrcweir $srcdir = (cygpath ($ver->{'product_dir'}, 'w', 'u') . '/' . 340cdf0e10cSrcweir $ver->{$checkpath}); 341cdf0e10cSrcweir -d $srcdir && return $ver; 342cdf0e10cSrcweir return undef; 343cdf0e10cSrcweir} 344cdf0e10cSrcweir 345cdf0e10cSrcweirsub msvc_copy_dlls($) 346cdf0e10cSrcweir{ 347cdf0e10cSrcweir my $dest = shift; 348cdf0e10cSrcweir my $ver = msvc_find_version('dll_path'); 349cdf0e10cSrcweir defined $ver || return; 350cdf0e10cSrcweir my $srcdir = (cygpath ($ver->{'product_dir'}, 'w', 'u') . '/' . 351cdf0e10cSrcweir $ver->{'dll_path'}); 352cdf0e10cSrcweir 353cdf0e10cSrcweir copy_dll ($srcdir, "msvcp" . $ver->{'dll_suffix'} . ".dll", 354cdf0e10cSrcweir $dest . $ver->{'dll_suffix'}); 355cdf0e10cSrcweir copy_dll ($srcdir, "msvcr" . $ver->{'dll_suffix'} . ".dll", 356cdf0e10cSrcweir $dest . $ver->{'dll_suffix'}); 357cdf0e10cSrcweir if ($ver->{'dll_suffix'} >= 90) { 358cdf0e10cSrcweir copy_dll ($srcdir, "msvcm" . $ver->{'dll_suffix'} . ".dll", 359cdf0e10cSrcweir $dest . $ver->{'dll_suffix'}); 360cdf0e10cSrcweir copy_dll ($srcdir, "Microsoft.VC90.CRT.manifest", $dest . $ver->{'dll_suffix'}); 361cdf0e10cSrcweir } 362cdf0e10cSrcweir} 363cdf0e10cSrcweir 364cdf0e10cSrcweirif (!@ARGV) { 365cdf0e10cSrcweir print_syntax(); 366cdf0e10cSrcweir exit 1; 367cdf0e10cSrcweir} 368cdf0e10cSrcweir 369cdf0e10cSrcweirmy @commands = (); 370cdf0e10cSrcweirmy $opt; 371cdf0e10cSrcweirwhile (@ARGV) { 372cdf0e10cSrcweir $opt = shift @ARGV; 373cdf0e10cSrcweir 374cdf0e10cSrcweir if ($opt eq '-w' || $opt eq '-u') { 375cdf0e10cSrcweir $output_format = substr($opt, 1, 1); 376cdf0e10cSrcweir } else { 377cdf0e10cSrcweir push @commands, $opt; 378cdf0e10cSrcweir } 379cdf0e10cSrcweir} 380cdf0e10cSrcweir 381cdf0e10cSrcweirwhile (@commands) { 382cdf0e10cSrcweir $opt = shift @commands; 383cdf0e10cSrcweir 384*edd74ba5SDamjan Jovanovic if ($opt eq '--aoo32-on-win64') { 385*edd74ba5SDamjan Jovanovic $aoo32OnWin64 = 1; 386cdf0e10cSrcweir } elsif ($opt eq '--msvc-ver') { 387cdf0e10cSrcweir print_msvc_ver(); 388cdf0e10cSrcweir } elsif ($opt eq '--msvc-copy-dlls') { 389cdf0e10cSrcweir my $dest = shift @commands; 390cdf0e10cSrcweir defined $dest || die "copy-dlls requires a destination directory"; 391cdf0e10cSrcweir msvc_copy_dlls( $dest ); 392cdf0e10cSrcweir } elsif ($opt eq '--msvs-productdir') { 393cdf0e10cSrcweir print_msvs_productdir(); 394cdf0e10cSrcweir } elsif ($opt eq '--msvc-productdir') { 395cdf0e10cSrcweir print_msvc_product_dir(); 396cdf0e10cSrcweir } elsif ($opt eq '--dotnetsdk-dir') { 397cdf0e10cSrcweir print_dotnetsdk_dir(); 398cdf0e10cSrcweir } elsif ($opt eq '--csc-compilerdir') { 399cdf0e10cSrcweir print_csc_compiler_dir(); 400cdf0e10cSrcweir } elsif ($opt eq '--psdk-home') { 401cdf0e10cSrcweir print_psdk_home(); 402cdf0e10cSrcweir } elsif ($opt eq '--jdk-home') { 403cdf0e10cSrcweir print_jdk_dir(); 404cdf0e10cSrcweir } elsif ($opt eq '--nsis-dir') { 405cdf0e10cSrcweir print_nsis_dir(); 406cdf0e10cSrcweir } elsif ($opt eq '--help' || $opt eq '/?') { 407cdf0e10cSrcweir print_syntax(); 408cdf0e10cSrcweir } else { 409cdf0e10cSrcweir print "Unknown option '$opt'\n"; 410cdf0e10cSrcweir print_syntax(); 411cdf0e10cSrcweir exit 1; 412cdf0e10cSrcweir } 413cdf0e10cSrcweir} 414cdf0e10cSrcweir 415