diff options
author | Vladimir Glazounov <vg@openoffice.org> | 2009-01-21 17:47:03 +0000 |
---|---|---|
committer | Vladimir Glazounov <vg@openoffice.org> | 2009-01-21 17:47:03 +0000 |
commit | 270e8c2bebc324762c8865ac268cea7ba7fcb097 (patch) | |
tree | f472bc904a7f81775b765ec29f206edd7111bd73 /oowintool | |
parent | 802653f44f9a4c97558ea85cea12e15685a9f8a3 (diff) |
CWS-TOOLING: integrate CWS configuretoplevel
2009-01-19 15:47:39 +0100 rene r266508 : CWS-TOOLING: rebase CWS configuretoplevel to trunk@266428 (milestone: DEV300:m39)
2009-01-18 00:35:31 +0100 rene r266462 : #i10000# Mac OS X "of course" has other paths...
2009-01-16 13:24:23 +0100 rene r266415 : make OS2 use STLport...
2009-01-15 22:08:38 +0100 rene r266393 : STLport for FreeBSD
2009-01-15 01:23:51 +0100 rene r266333 : #i98048# harmonize STL default; default to *NOT* use STLport
2009-01-09 22:44:43 +0100 rene r266120 : #i97428# try to find out XLIB via pkg-config
2009-01-09 22:41:18 +0100 rene r266119 : #i97827# fail when we don't find make
2008-12-27 01:19:34 +0100 rene r265812 : add make (dis)clean; force /bin/sh as we source *Enc.Set.sh
2008-12-27 01:16:31 +0100 rene r265811 : fix makefile.rc for config.*/config_office move
2008-12-26 22:37:54 +0100 rene r265810 : #i91641# in some cases, we also need the -Xbootclasspath at the second javac call
2008-12-26 17:55:11 +0100 rene r265806 : actually commit Makefile.in
2008-12-25 19:24:24 +0100 rene r265803 : CWS-TOOLING: rebase CWS configuretoplevel to trunk@265758 (milestone: DEV300:m38)
2008-12-10 22:51:06 +0100 rene r265232 : #i96912# revert, cws swffixes02 has the right fix
2008-12-08 18:47:10 +0100 rene r265014 : xulrunner has no /plugin or /nspr
2008-12-08 17:51:28 +0100 rene r265013 : i96912# fix --with-system-mozilla
2008-12-05 13:05:55 +0100 rene r264903 : #i95339#
2008-12-04 17:53:53 +0100 rene r264865 : fix merge error
#i80238# add help for --with-epm
2008-12-04 17:44:28 +0100 rene r264864 : #i91641# fix build with JDKs already including a version of rhino which conflicts with our ancient one
2008-12-04 17:40:48 +0100 rene r264863 : i93429# check for sanity for expand.exe
2008-12-04 17:34:20 +0100 rene r264862 : config_office changes from m33 to m37
2008-12-04 17:28:55 +0100 rene r264861 : CWS-TOOLING: rebase CWS configuretoplevel to trunk@264807 (milestone: DEV300:m37)
2008-12-04 16:49:03 +0100 rene r264856 : fix cws. part 5
2008-12-04 16:45:06 +0100 rene r264855 : fix cws, part 4
2008-12-04 16:01:49 +0100 rene r264850 : fix cws, part 3
2008-12-04 15:14:12 +0100 rene r264848 : fix cws, part 2
Diffstat (limited to 'oowintool')
-rwxr-xr-x | oowintool | 391 |
1 files changed, 391 insertions, 0 deletions
diff --git a/oowintool b/oowintool new file mode 100755 index 000000000..0b4be43f9 --- /dev/null +++ b/oowintool @@ -0,0 +1,391 @@ +#!/usr/bin/perl -w + +use File::Copy; + +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 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`; + + return $key; +} + +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 - dump version of MSVC eg. 6.0\n"; + print " --msvc-copy-dlls <dest> - copy msvc[pr]??.dlls into <dest>/msvcp??/\n"; + print " --msvc-copy-instmsi <dest> - copy instmsia.exe, insmsiw.exe into <dest>\n"; + print " --msvc-productdir - dump productdir\n"; + print " --msvs-productdir - dump productdir\n"; + print " --dotnetsdk-dir - dump .Net SDK path\n"; + print " --csc-compilerdir - dump .Net SDK compiler path\n"; + print " --psdk-home - dump psdk install dir\n"; + print " --jdk-home - dump the jdk install dir\n"; + print " --nsis-dir - dump NSIS path\n"; + print " --help - 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_psdk_home() +{ + my ($value, $key); + $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/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); + } + 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 "psdk not found"; + + print cygpath ($value, 'w', $output_format); +} + +my %msvc_net_2003 = ( + 'ver' => '7.1', + 'key' => 'Microsoft/VisualStudio/7.1/Setup/VC/ProductDir', + 'instmsi_path' => '../Common7/Tools/Deployment/MsiRedist', + 'dll_path' => '../Visual Studio .NET Professional 2003 - English', + 'dll_suffix' => '71' +); +my %msvs_net_2003 = ( + 'ver' => '7.1', + 'key' => 'Microsoft/VisualStudio/7.1/Setup/VS/ProductDir', + 'instmsi_path' => 'Common7/Tools/Deployment/MsiRedist', + 'dll_path' => 'Visual Studio .NET Professional 2003 - English', + 'dll_suffix' => '71' +); +my %msvs_net_2003_ea = ( + 'ver' => '7.1', + 'key' => 'Microsoft/VisualStudio/7.1/Setup/VS/ProductDir', + 'instmsi_path' => 'Common7/Tools/Deployment/MsiRedist', + 'dll_path' => 'Visual Studio .NET Enterprise Architect 2003 - English', # testme ... + 'dll_suffix' => '71' +); +my %msvs_express_2005 = ( + 'ver' => '8.0', + 'key' => 'Microsoft/VCExpress/8.0/Setup/VS/ProductDir', + 'instmsi_path' => '../SDK/v2.0/BootStrapper/Packages/InstMSI', + 'dll_path' => '../SDK/v2.0/Bin', + 'dll_suffix' => '80' +); +my %msvc_express_2005 = ( + 'ver' => '8.0', + 'key' => 'Microsoft/VCExpress/8.0/Setup/VC/ProductDir', + 'instmsi_path' => '../SDK/v2.0/BootStrapper/Packages/InstMSI', + 'dll_path' => '../SDK/v2.0/Bin', + 'dll_suffix' => '80' +); +my %msvs_2005 = ( + 'ver' => '8.0', + 'key' => 'Microsoft/VisualStudio/8.0/Setup/VS/ProductDir', + 'instmsi_path' => 'SDK/v2.0/BootStrapper/Packages/InstMSI', + 'dll_path' => 'Visual Studio .NET Professional 2005 - English', + 'dll_suffix' => '80' +); +my %msvc_2005 = ( + 'ver' => '8.0', + 'key' => 'Microsoft/VisualStudio/8.0/Setup/VC/ProductDir', + 'instmsi_path' => '../SDK/v2.0/BootStrapper/Packages/InstMSI', + 'dll_path' => '../SDK/v2.0/Bin', + 'dll_suffix' => '80' +); +my %msvs_2008 = ( + 'ver' => '9.0', + 'key' => 'Microsoft/VisualStudio/9.0/Setup/VS/ProductDir', + 'instmsi_path' => '?', + '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', + 'instmsi_path' => '?', + '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', + 'instmsi_path' => '?', + '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', + 'instmsi_path' => '?', + 'dll_path' => 'redist/x86/Microsoft.VC90.CRT', + 'dll_suffix' => '90' +); + +sub find_msvs() +{ + my @ms_versions = ( \%msvs_2008, \%msvs_express_2008, \%msvs_2005, \%msvs_express_2005, \%msvs_net_2003_ea, \%msvs_net_2003 ); + + 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_2008, \%msvc_express_2008, \%msvc_2005, \%msvc_express_2005, \%msvc_net_2003 ); + + 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 $dir = cygpath (reg_get_value ("HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/.NETFramework/InstallRoot"), 'w', $output_format); + my $csc_exe = `/bin/find "$dir" -iname csc.exe | grep "v2\." | head -n 1`; + print `dirname $csc_exe`; +} + +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"); + print cygpath ($dir, 'w', $output_format); +} + +sub print_jdk_dir() +{ + my $dir = + 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 print_nsis_dir() +{ + my $dir = reg_get_value ("HKEY_LOCAL_MACHINE/SOFTWARE/NSIS/@"); + print cygpath ($dir, 'w', $output_format) if defined $dir; +} + +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 $ver = msvc_find_version('dll_path'); + defined $ver || return; + my $srcdir = (cygpath ($ver->{'product_dir'}, 'w', 'u') . '/' . + $ver->{'dll_path'}); + + 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_copy_instmsi($) +{ + my $dest = shift; + my $ver = msvc_find_version('instmsi_path'); + defined $ver || return; + my $srcdir = (cygpath ($ver->{'product_dir'}, 'w', 'u') . '/' . + $ver->{'instmsi_path'}); + + copy_dll ($srcdir, "instmsia.exe", + $dest); + copy_dll ($srcdir, "instmsiw.exe", + $dest); +} + +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 ); + } elsif ($opt eq '--msvc-copy-instmsi') { + my $dest = shift @commands; + defined $dest || die "copy-instmsi requires a destination directory"; + msvc_copy_instmsi( $dest ); + } 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 '--psdk-home') { + print_psdk_home(); + } elsif ($opt eq '--jdk-home') { + print_jdk_dir(); + } elsif ($opt eq '--nsis-dir') { + print_nsis_dir(); + } elsif ($opt eq '--help' || $opt eq '/?') { + print_syntax(); + } else { + print "Unknown option '$opt'\n"; + print_syntax(); + exit 1; + } +} + |