oowintool (a77ce2d1) oowintool (edd74ba5)
1#!/usr/bin/perl -w
2# *************************************************************
3#
4# Licensed to the Apache Software Foundation (ASF) under one
5# or more contributor license agreements. See the NOTICE file
6# distributed with this work for additional information
7# regarding copyright ownership. The ASF licenses this file
8# to you under the Apache License, Version 2.0 (the

--- 9 unchanged lines hidden (view full) ---

18# specific language governing permissions and limitations
19# under the License.
20#
21# *************************************************************
22
23use File::Copy;
24
25my $output_format = 'u';
1#!/usr/bin/perl -w
2# *************************************************************
3#
4# Licensed to the Apache Software Foundation (ASF) under one
5# or more contributor license agreements. See the NOTICE file
6# distributed with this work for additional information
7# regarding copyright ownership. The ASF licenses this file
8# to you under the Apache License, Version 2.0 (the

--- 9 unchanged lines hidden (view full) ---

18# specific language governing permissions and limitations
19# under the License.
20#
21# *************************************************************
22
23use File::Copy;
24
25my $output_format = 'u';
26my $aoo32OnWin64 = 0;
26
27
28
27sub reg_get_value($)
28{
29 # it is believed that the registry moves keys around
30 # depending on OS version, this will de-mangle that
31 my $key = shift;
32 my $fhandle;
33 my $value;
34

--- 242 unchanged lines hidden (view full) ---

277 reg_get_value ("HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/.NETFramework/sdkInstallRootv1.1") ||
278 reg_get_value ("HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/.NETFramework/sdkInstallRootv2.0");
279 defined $dir || exit 1;
280 print cygpath ($dir, 'w', $output_format);
281}
282
283sub print_jdk_dir()
284{
29sub reg_get_value($)
30{
31 # it is believed that the registry moves keys around
32 # depending on OS version, this will de-mangle that
33 my $key = shift;
34 my $fhandle;
35 my $value;
36

--- 242 unchanged lines hidden (view full) ---

279 reg_get_value ("HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/.NETFramework/sdkInstallRootv1.1") ||
280 reg_get_value ("HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/.NETFramework/sdkInstallRootv2.0");
281 defined $dir || exit 1;
282 print cygpath ($dir, 'w', $output_format);
283}
284
285sub print_jdk_dir()
286{
285 my $dir =
286 reg_get_value ("HKEY_LOCAL_MACHINE/SOFTWARE/JavaSoft/Java\ Development\ Kit/1.8/JavaHome") ||
287 reg_get_value ("HKEY_LOCAL_MACHINE/SOFTWARE/JavaSoft/Java\ Development\ Kit/1.7/JavaHome") ||
288 reg_get_value ("HKEY_LOCAL_MACHINE/SOFTWARE/JavaSoft/Java\ Development\ Kit/1.6/JavaHome") ||
289 reg_get_value ("HKEY_LOCAL_MACHINE/SOFTWARE/JavaSoft/Java\ Development\ Kit/1.5/JavaHome") ||
290 reg_get_value ("HKEY_LOCAL_MACHINE/SOFTWARE/JavaSoft/Java\ Development\ Kit/1.4/JavaHome") ||
291 reg_get_value ("HKEY_LOCAL_MACHINE/SOFTWARE/JavaSoft/Java\ Development\ Kit/1.3/JavaHome");
292 if (defined $dir) {
293 print cygpath($dir, 'w', $output_format);
294 } else {
295 # Java 1.9 had to be different:
296 my $currentVersion = reg_get_value ("HKEY_LOCAL_MACHINE/SOFTWARE/JavaSoft/JDK/CurrentVersion");
297 defined $currentVersion || exit 1;
298 my $newDir = reg_get_value ("HKEY_LOCAL_MACHINE/SOFTWARE/JavaSoft/JDK/" . $currentVersion . "/JavaHome");
299 defined $newDir || exit 1;
300 print cygpath($newDir, 'w', $output_format);
287 my $softwareKey;
288 if ($aoo32OnWin64) {
289 $softwareKey = "HKEY_LOCAL_MACHINE/SOFTWARE/Wow6432Node/";
290 } else {
291 $softwareKey = "HKEY_LOCAL_MACHINE/SOFTWARE/";
301 }
292 }
293 # Java 1.9 had to be different:
294 my $currentVersion = reg_get_value ($softwareKey . "JavaSoft/JDK/CurrentVersion");
295 if (defined $currentVersion) {
296 my $newDir = reg_get_value ($softwareKey . "JavaSoft/JDK/" . $currentVersion . "/JavaHome");
297 if (defined $newDir) {
298 print cygpath($newDir, 'w', $output_format);
299 return;
300 }
301 }
302 my $dir =
303 reg_get_value ($softwareKey . "JavaSoft/Java\ Development\ Kit/1.8/JavaHome") ||
304 reg_get_value ($softwareKey . "JavaSoft/Java\ Development\ Kit/1.7/JavaHome") ||
305 reg_get_value ($softwareKey . "JavaSoft/Java\ Development\ Kit/1.6/JavaHome") ||
306 reg_get_value ($softwareKey . "JavaSoft/Java\ Development\ Kit/1.5/JavaHome") ||
307 reg_get_value ($softwareKey . "JavaSoft/Java\ Development\ Kit/1.4/JavaHome") ||
308 reg_get_value ($softwareKey . "JavaSoft/Java\ Development\ Kit/1.3/JavaHome");
309 defined $dir || exit 1;
310 print cygpath($dir, 'w', $output_format);
302}
303
304sub print_nsis_dir()
305{
306 my $dir = reg_get_value ("HKEY_LOCAL_MACHINE/SOFTWARE/NSIS/@");
307 print cygpath ($dir, 'w', $output_format) if defined $dir;
308}
309

--- 57 unchanged lines hidden (view full) ---

367 } else {
368 push @commands, $opt;
369 }
370}
371
372while (@commands) {
373 $opt = shift @commands;
374
311}
312
313sub print_nsis_dir()
314{
315 my $dir = reg_get_value ("HKEY_LOCAL_MACHINE/SOFTWARE/NSIS/@");
316 print cygpath ($dir, 'w', $output_format) if defined $dir;
317}
318

--- 57 unchanged lines hidden (view full) ---

376 } else {
377 push @commands, $opt;
378 }
379}
380
381while (@commands) {
382 $opt = shift @commands;
383
375 if (0) {
384 if ($opt eq '--aoo32-on-win64') {
385 $aoo32OnWin64 = 1;
376 } elsif ($opt eq '--msvc-ver') {
377 print_msvc_ver();
378 } elsif ($opt eq '--msvc-copy-dlls') {
379 my $dest = shift @commands;
380 defined $dest || die "copy-dlls requires a destination directory";
381 msvc_copy_dlls( $dest );
382 } elsif ($opt eq '--msvs-productdir') {
383 print_msvs_productdir();

--- 21 unchanged lines hidden ---
386 } elsif ($opt eq '--msvc-ver') {
387 print_msvc_ver();
388 } elsif ($opt eq '--msvc-copy-dlls') {
389 my $dest = shift @commands;
390 defined $dest || die "copy-dlls requires a destination directory";
391 msvc_copy_dlls( $dest );
392 } elsif ($opt eq '--msvs-productdir') {
393 print_msvs_productdir();

--- 21 unchanged lines hidden ---