2 # This file is part of the LibreOffice project.
4 # This Source Code Form is subject to the terms of the Mozilla Public
5 # License, v. 2.0. If a copy of the MPL was not distributed with this
6 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 # This file incorporates work covered by the following license notice:
10 # Licensed to the Apache Software Foundation (ASF) under one or more
11 # contributor license agreements. See the NOTICE file distributed
12 # with this work for additional information regarding copyright
13 # ownership. The ASF licenses this file to you under the Apache
14 # License, Version 2.0 (the "License"); you may not use this file
15 # except in compliance with the License. You may obtain a copy of
16 # the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 # configure.pl - a perl script to set a minimal environment for the SDK.
20 # Copyright 2000, 2010 Oracle and/or its affiliates.
26 $main::hostname
= $ARGV[0];
27 $main::sdkpath
= $ARGV[1];
28 $main::OO_SDK_NAME
= $ARGV[2];
30 $main::OO_MAJORVERSION
=$main::OO_SDK_NAME
;
31 $main::OO_MINORVERSION
=$main::OO_SDK_NAME
;
32 $main::OO_MAJORVERSION
=~ s
#[^\d]+(\d).(\d).+#$1#go;
33 $main::OO_MINORVERSION
=~ s
#[^\d]+(\d).(\d).+#$2#go;
35 $main::OO_SDK_CONFIG_HOME
= "$ENV{HOME}/$main::OO_SDK_NAME";
37 $main::operatingSystem
= `/bin/sh $main::sdkpath/config.guess | cut -d"-" -f3,4`;
38 chomp ($main::operatingSystem
);
40 $main::OO_SDK_HOME
= $main::sdkpath
;
41 #$main::OO_SDK_HOME = "";
42 $main::OO_SDK_HOME_SUGGESTION
= $main::sdkpath
;
44 $main::OFFICE_HOME
= "";
46 $main::OO_SDK_MAKE_HOME
= "";
47 $main::makeName
= "make";
48 if ( $main::operatingSystem
=~ m/solaris/ ||
49 $main::operatingSystem
=~ m/freebsd/ )
51 $main::makeName
= "gmake";
53 $main::OO_SDK_MAKE_HOME_SUGGESTION
= searchprog
($main::makeName
);
54 $main::makeVersion
= "3.79.1";
55 $main::correctVersion
= 0;
57 $main::OO_SDK_ZIP_HOME
= "";
58 $main::OO_SDK_ZIP_HOME_SUGGESTION
= searchprog
("zip");
59 $main::zipVersion
= "2.3";
61 $main::OO_SDK_CAT_HOME
= "";
62 $main::OO_SDK_CAT_HOME_SUGGESTION
= searchprog
("cat");
64 # $main::catVersion = "";
66 $main::OO_SDK_SED_HOME
= "";
67 $main::OO_SDK_SED_HOME_SUGGESTION
= searchprog
("sed");
69 # $main::sedVersion = "";
71 $main::OO_SDK_CPP_HOME
= "";
72 $main::cppName
= "gcc";
73 $main::cppVersion
= "4.0.1";
74 $main::OO_SDK_CPP_HOME_SUGGESTION
= searchprog
($main::cppName
);
76 $main::OO_SDK_DOTNET_ROOT
= "";
77 $main::OO_SDK_DOTNET_ROOT_SUGGESTION
= dotnetToRoot
(searchprog
("dotnet") . "/dotnet");
78 $main::dotnetSdkVersion
= "8";
80 $main::OO_SDK_JAVA_HOME
= "";
81 $main::OO_SDK_JAVA_HOME_SUGGESTION
= searchprog
("javac");
82 $main::javaVersion
= "1.6";
84 $main::SDK_AUTO_DEPLOYMENT
= "";
85 $main::SDK_AUTO_DEPLOYMENT_SUGGESTION
= "YES";
87 $main::OO_SDK_OUTPUT_DIR_SUGGESTION
= "$ENV{HOME}";
88 $main::OO_SDK_OUTPUT_DIR
= "";
89 $main::skipOutputDir
= 0;
93 if ( $main::operatingSystem
=~ m/darwin/ )
95 print " Used SDK = $main::OO_SDK_HOME\n\n";
97 $main::OFFICE_HOME_SUGGESTION
= searchMacOffice
();
98 while ( (! -d
"$main::OFFICE_HOME" ) ||
99 ((-d
"$main::OFFICE_HOME") && (! -d
"$main::OFFICE_HOME/Contents/MacOS")) )
101 print " Enter the Office installation directory [$main::OFFICE_HOME_SUGGESTION]: ";
102 $main::OFFICE_HOME
= readStdIn
();
103 chop($main::OFFICE_HOME
);
104 if ( $main::OFFICE_HOME
eq "" )
106 $main::OFFICE_HOME
= $main::OFFICE_HOME_SUGGESTION
;
109 if ( ! -d
"$main::OFFICE_HOME" )
111 $main::OFFICE_HOME
= "";
112 print " Error: An office installation is required, please specify the path to a valid installation.\n";
118 $main::OFFICE_HOME_SUGGESTION
= searchoffice
();
120 if ( $main::OFFICE_HOME_SUGGESTION
eq "" ) {
121 # prepare Office path
122 $main::OFFICE_HOME_SUGGESTION
= searchprog
("soffice");
125 if ( ! $main::OFFICE_HOME_SUGGESTION
eq "" )
127 my $tmpOffice = readlink "$main::OFFICE_HOME_SUGGESTION/soffice";
129 if ( $tmpOffice eq "" )
131 $tmpOffice = "$main::OFFICE_HOME_SUGGESTION/soffice";
134 my $offset = rindex($tmpOffice, "/program/soffice");
137 $main::OFFICE_HOME_SUGGESTION
= substr($tmpOffice, 0, $offset);
140 $offset = rindex($tmpOffice, "/soffice");
143 $main::OFFICE_HOME_SUGGESTION
= substr($tmpOffice, 0, $offset);
146 $main::OFFICE_HOME_SUGGESTION
= "";
151 while ( (! -d
"$main::OFFICE_HOME" ) ||
152 ((-d
"$main::OFFICE_HOME") && (! -d
"$main::OFFICE_HOME/program")) )
154 print " Enter the Office installation directory [$main::OFFICE_HOME_SUGGESTION]: ";
155 $main::OFFICE_HOME
= readStdIn
();
156 chop($main::OFFICE_HOME
);
157 if ( $main::OFFICE_HOME
eq "" )
159 $main::OFFICE_HOME
= $main::OFFICE_HOME_SUGGESTION
;
162 if ( ! -d
"$main::OFFICE_HOME" )
164 $main::OFFICE_HOME
= "";
165 print " Error: An office installation is required, please specify the path to a valid installation.\n";
168 # special work for a network installation, no program directory but a link to the soffice binary
169 if ( (! -d
"$main::OFFICE_HOME/program") && (-e
"$main::OFFICE_HOME/soffice") )
171 my $soserver = `ls -l $OFFICE_HOME_SUGGESTION/soffice | sed -n 's/.* -> //p'`;
172 $soserver= substr($soserver, 0, rindex($soserver, "program") - 1);
174 if ( ! -d
$soserver )
176 $main::OFFICE_HOME
= "";
177 print " Error: An office installation is required, please specify the path to a valid installation.\n";
180 $main::OFFICE_HOME
= $soserver;
187 # prepare GNU make path
188 while ( (!$main::correctVersion
) &&
189 ((! -d
"$main::OO_SDK_MAKE_HOME" ) ||
190 ((-d
"$main::OO_SDK_MAKE_HOME") && (! -e
"$main::OO_SDK_MAKE_HOME/$main::makeName"))) )
192 print " Enter GNU make ($main::makeVersion or higher) tools directory [$main::OO_SDK_MAKE_HOME_SUGGESTION]: ";
193 $main::OO_SDK_MAKE_HOME
= readStdIn
();
194 chop($main::OO_SDK_MAKE_HOME
);
195 if ( $main::OO_SDK_MAKE_HOME
eq "" )
197 $main::OO_SDK_MAKE_HOME
= $main::OO_SDK_MAKE_HOME_SUGGESTION
;
199 if ( (! -d
"$main::OO_SDK_MAKE_HOME") ||
200 ((-d
"$main::OO_SDK_MAKE_HOME") && (! -e
"$main::OO_SDK_MAKE_HOME/$main::makeName")) )
202 $main::OO_SDK_MAKE_HOME
= "";
203 print " Error: GNU make is required, please specify a GNU make tools directory.\n";
207 my $testVersion = `$OO_SDK_MAKE_HOME/$main::makeName --version`;
208 if ( $testVersion eq "")
210 print " Set the environment variable OO_SDK_MAKE_HOME to your GNU build tools directory.\n";
211 print " GNU make version $main::makeVersion can be obtained at ftp://ftp.gnu.org/gnu/make/\n";
214 if ($testVersion =~ m
#((\d+\.)+\d+)# )
218 $main::correctVersion
= testVersion
($main::makeVersion
, $testVersion, "$main::OO_SDK_MAKE_HOME/$main::makeName", 1);
219 if ( !$main::correctVersion
)
221 print " The '$main::makeName' command found at '$main::OO_SDK_MAKE_HOME' has a wrong version\n";
222 $main::OO_SDK_MAKE_HOME
= "";
229 $main::correctVersion
= 0;
230 while ( (!$main::correctVersion
) &&
231 ((! -d
"$main::OO_SDK_ZIP_HOME" ) ||
232 ((-d
"$main::OO_SDK_ZIP_HOME") && (! -e
"$main::OO_SDK_ZIP_HOME/zip"))) )
234 print " Enter zip ($main::zipVersion or higher) tool directory [$main::OO_SDK_ZIP_HOME_SUGGESTION]: ";
235 $main::OO_SDK_ZIP_HOME
= readStdIn
();
236 chop($main::OO_SDK_ZIP_HOME
);
237 if ( $main::OO_SDK_ZIP_HOME
eq "" )
239 $main::OO_SDK_ZIP_HOME
= $main::OO_SDK_ZIP_HOME_SUGGESTION
;
241 if ( (! -d
"$main::OO_SDK_ZIP_HOME") ||
242 ((-d
"$main::OO_SDK_ZIP_HOME") && (! -e
"$main::OO_SDK_ZIP_HOME/zip")) )
244 $main::OO_SDK_ZIP_HOME
= "";
245 print " Error: zip tool is required, please specify a zip tool directory.\n";
249 my $testVersion = `$OO_SDK_ZIP_HOME/zip -h 2>&1 | grep -E Zip | head -n 1`;
250 $testVersion =~ s
#Zip ([\d.]+) .*#$1#go;
251 if ( $testVersion eq "")
253 print " Set the environment variable OO_SDK_ZIP_HOME to your zip tool directory.\n";
254 print " zip version $main::zipVersion can be obtained at ftp://www.info-zip.org/\n";
257 if ($testVersion =~ m
#((\d+\.)+\d+)# )
261 $main::correctVersion
= testVersion
($main::zipVersion
, $testVersion, "$main::OO_SDK_MAKE_HOME/zip", 1);
262 if ( !$main::correctVersion
)
264 print " The 'zip' command found at '$main::OO_SDK_ZIP_HOME' has a wrong version\n";
265 $main::OO_SDK_ZIP_HOME
= "";
272 $main::correctVersion
= 0;
273 while ( (!$main::correctVersion
) &&
274 ((! -d
"$main::OO_SDK_CAT_HOME" ) ||
275 ((-d
"$main::OO_SDK_CAT_HOME") && (! -e
"$main::OO_SDK_CAT_HOME/cat"))) )
277 print " Enter cat tool directory [$main::OO_SDK_CAT_HOME_SUGGESTION]: ";
278 $main::OO_SDK_CAT_HOME
= readStdIn
();
279 chop($main::OO_SDK_CAT_HOME
);
280 if ( $main::OO_SDK_CAT_HOME
eq "" )
282 $main::OO_SDK_CAT_HOME
= $main::OO_SDK_CAT_HOME_SUGGESTION
;
284 if ( (! -d
"$main::OO_SDK_CAT_HOME") ||
285 ((-d
"$main::OO_SDK_CAT_HOME") && (! -e
"$main::OO_SDK_CAT_HOME/cat")) )
287 $main::OO_SDK_CAT_HOME
= "";
288 print " Error: cat tool is required, please specify a cat tool directory.\n";
292 # NOTE: only Linux cat understands --version
296 $main::correctVersion
= 0;
297 while ( (!$main::correctVersion
) &&
298 ((! -d
"$main::OO_SDK_SED_HOME" ) ||
299 ((-d
"$main::OO_SDK_SED_HOME") && (! -e
"$main::OO_SDK_SED_HOME/sed"))) )
301 print " Enter sed tool directory [$main::OO_SDK_SED_HOME_SUGGESTION]: ";
302 $main::OO_SDK_SED_HOME
= readStdIn
();
303 chop($main::OO_SDK_SED_HOME
);
304 if ( $main::OO_SDK_SED_HOME
eq "" )
306 $main::OO_SDK_SED_HOME
= $main::OO_SDK_SED_HOME_SUGGESTION
;
308 if ( (! -d
"$main::OO_SDK_SED_HOME") ||
309 ((-d
"$main::OO_SDK_SED_HOME") && (! -e
"$main::OO_SDK_SED_HOME/sed")) )
311 $main::OO_SDK_SED_HOME
= "";
312 print " Error: sed tool is required, please specify a sed tool directory.\n";
316 # NOTE: only Linux sed understands --version
319 # prepare C++ compiler path
320 $main::correctVersion
= 0;
321 while ( (!$main::correctVersion
) &&
322 ((! -d
"$main::OO_SDK_CPP_HOME" ) ||
323 ((-d
"$main::OO_SDK_CPP_HOME") && (! -e
"$main::OO_SDK_CPP_HOME/$main::cpp"))) )
325 print " C++ compilers where for example a language binding exist:\n";
326 print " - Solaris, Sun WorkShop 6 update 1 C++ 5.2 2000/09/11 or higher\n";
327 print " - Linux, GNU C++ compiler, gcc version 4.0.1 or higher\n";
328 print " - MacOS, GNU C++ compiler, gcc version 4.0.1 or higher\n";
329 print " Enter the directory of the C++ compiler, the directory\n";
330 print " where the compiler is located (optional) [$main::OO_SDK_CPP_HOME_SUGGESTION]: ";
332 $main::OO_SDK_CPP_HOME
= readStdIn
();
333 chop($main::OO_SDK_CPP_HOME
);
334 if ( $main::OO_SDK_CPP_HOME
eq "" )
336 $main::OO_SDK_CPP_HOME
= $main::OO_SDK_CPP_HOME_SUGGESTION
;
339 if ( ! $main::OO_SDK_CPP_HOME
eq "" )
341 if ( (! -d
"$main::OO_SDK_CPP_HOME") ||
342 ((-d
"$main::OO_SDK_CPP_HOME") && (! -e
"$main::OO_SDK_CPP_HOME/$main::cppName")) )
344 print " Error: Could not find directory '$main::OO_SDK_CPP_HOME'.\n";
345 if ( skipChoice
("C++ compiler") == 1 )
347 $main::correctVersion
= 1;
349 $main::OO_SDK_CPP_HOME
= "";
353 if ( $main::cppName
eq "gcc" )
355 my $testVersion = `$OO_SDK_CPP_HOME/$main::cppName -dumpversion`;
356 if ( $testVersion eq "")
358 print " The '$main::cppName' command found at $main::OO_SDK_CPP_HOME/$main::cppName is not a ";
359 print " GNU compiler.\nSet the environment variable OO_SDK_CPP_HOME to your GNU build tools ";
360 print " directory.\nA GNU compiler version $main::cppVersion can be obtained at ";
361 print " ftp://ftp.gnu.org/gnu/gcc/\n";
364 $main::correctVersion
= testVersion
($main::cppVersion
, $testVersion, "$main::OO_SDK_CPP_HOME/$main::cppName", 1);
365 if ( !$main::correctVersion
)
367 print " The '$main::cppName' command found at '$main::OO_SDK_CPP_HOME' has a wrong version\n";
368 if ( skipChoice
("C++ compiler") == 1 )
370 $main::correctVersion
= 1;
373 $main::OO_SDK_CPP_HOME
= "";
380 # the C++ compiler is optional
381 $main::correctVersion
= 1;
385 # prepare .NET SDK path
386 $main::correctVersion
= 0;
387 while ( (!$main::correctVersion
) &&
388 ((! -d
"$main::OO_SDK_DOTNET_ROOT" ) ||
389 ((-d
"$main::OO_SDK_DOTNET_ROOT") && (! -e
"$main::OO_SDK_DOTNET_ROOT/dotnet"))) )
391 print " Enter .NET SDK (8 or higher) installation directory (optional) [$main::OO_SDK_DOTNET_ROOT_SUGGESTION]: ";
392 $main::OO_SDK_DOTNET_ROOT
= readStdIn
();
393 chop($main::OO_SDK_DOTNET_ROOT
);
394 if ( $main::OO_SDK_DOTNET_ROOT
eq "" )
396 $main::OO_SDK_DOTNET_ROOT
= $main::OO_SDK_DOTNET_ROOT_SUGGESTION
;
398 if ( ! $main::OO_SDK_DOTNET_ROOT
eq "" )
400 if ( (! -d
"$main::OO_SDK_DOTNET_ROOT") ||
401 ((-d
"$main::OO_SDK_DOTNET_ROOT") && (! -e
"$main::OO_SDK_DOTNET_ROOT/dotnet")) )
403 print " Error: Could not find directory '$main::OO_SDK_DOTNET_ROOT' or '$main::OO_SDK_DOTNET_ROOT/dotnet'.\n";
404 if ( skipChoice
(".NET SDK") == 1 )
406 $main::correctVersion
= 1;
408 $main::OO_SDK_DOTNET_ROOT
= "";
412 my $testVersion = `"$main::OO_SDK_DOTNET_ROOT/dotnet" --version | awk -F. '{ print $1 }'`;
414 $main::correctVersion
= testVersion
($main::dotnetSdkVersion
, $testVersion, "$main::OO_SDK_DOTNET_ROOT/dotnet", 1);
415 if ( !$main::correctVersion
)
417 print " The 'dotnet' command found at '$main::OO_SDK_DOTNET_ROOT' has a wrong version\n";
418 if ( skipChoice
(".NET SDK") == 1 )
420 $main::correctVersion
= 1;
422 $main::OO_SDK_DOTNET_ROOT
= "";
427 # the .NET SDK is optional
428 $main::correctVersion
= 1;
433 $main::correctVersion
= 0;
435 # prepare Java suggestion (cut bin directory to be in the root of the Java SDK)
436 $main::offset
= rindex($main::OO_SDK_JAVA_HOME_SUGGESTION
, "/bin");
437 if ( $main::offset
!= -1 )
439 $main::OO_SDK_JAVA_HOME_SUGGESTION
= substr($main::OO_SDK_JAVA_HOME_SUGGESTION
, 0, $main::offset
);
442 while ( (!$main::correctVersion
) &&
443 ((! -d
"$main::OO_SDK_JAVA_HOME" ) ||
444 ((-d
"$main::OO_SDK_JAVA_HOME") && (! -e
"$main::OO_SDK_JAVA_HOME/bin/javac"))) )
446 print " Enter Java SDK (1.6 or higher) installation directory (optional) [$main::OO_SDK_JAVA_HOME_SUGGESTION]: ";
447 $main::OO_SDK_JAVA_HOME
= readStdIn
();
448 chop($main::OO_SDK_JAVA_HOME
);
449 if ( $main::OO_SDK_JAVA_HOME
eq "" )
451 $main::OO_SDK_JAVA_HOME
= $main::OO_SDK_JAVA_HOME_SUGGESTION
;
453 if ( ! $main::OO_SDK_JAVA_HOME
eq "" )
455 if ( (! -d
"$main::OO_SDK_JAVA_HOME") ||
456 ((-d
"$main::OO_SDK_JAVA_HOME") && (! -e
"$main::OO_SDK_JAVA_HOME/bin/javac")) )
458 print " Error: Could not find directory '$main::OO_SDK_JAVA_HOME' or '$main::OO_SDK_JAVA_HOME/bin/javac'.\n";
459 if ( skipChoice
("JAVA SDK") == 1 )
461 $main::correctVersion
= 1;
463 $main::OO_SDK_JAVA_HOME
= "";
467 my $testVersion = `$main::OO_SDK_JAVA_HOME/bin/java -version 2>&1 | grep -E "java version" | head -n 1 | sed -e 's#.*version "##' | sed -e 's#".*##'`;
468 $testVersion =~ s
#([^\n]+)\n#$1#go;
470 $main::correctVersion
= testVersion
($main::javaVersion
, $testVersion, "$main::OO_SDK_JAVA_HOME/bin/java", 1);
471 if ( !$main::correctVersion
)
473 if ( skipChoice
("JAVA SDK") == 1 )
475 $main::correctVersion
= 1;
477 $main::OO_SDK_JAVA_HOME
= "";
482 # the Java SDK is optional
483 $main::correctVersion
= 1;
488 # prepare output directory (optional)
489 while ( (!$main::skipOutputDir
) &&
490 (! -d
"$main::OO_SDK_OUTPUT_DIR") )
492 print " Default output directory is in your HOME directory.\n";
493 print " Enter an existent directory if you prefer a different output directory (optional) [$main::OO_SDK_OUTPUT_DIR_SUGGESTION]: ";
495 $main::OO_SDK_OUTPUT_DIR
= readStdIn
();
497 chop($main::OO_SDK_OUTPUT_DIR
);
498 if ( $main::OO_SDK_OUTPUT_DIR
eq "" )
500 $main::OO_SDK_OUTPUT_DIR
= $main::OO_SDK_OUTPUT_DIR_SUGGESTION
;
502 if ( ! $main::OO_SDK_OUTPUT_DIR
eq "" )
504 if ( ! -d
"$main::OO_SDK_OUTPUT_DIR" )
506 print " Error: Could not find directory '$main::OO_SDK_OUTPUT_DIR'.\n";
507 if ( skipChoice
("optional output directory") == 1 )
509 $main::skipOutputDir
= 1;
511 $main::OO_SDK_OUTPUT_DIR
= "";
515 # the output directory is optional
516 $main::skipOutputDir
= 1;
520 # prepare auto deployment
521 while ( $main::SDK_AUTO_DEPLOYMENT
eq "" ||
522 ((! $main::SDK_AUTO_DEPLOYMENT
eq "YES") &&
523 (! $main::SDK_AUTO_DEPLOYMENT
eq "NO")) )
525 print " Automatic deployment of UNO components (YES/NO) [$main::SDK_AUTO_DEPLOYMENT_SUGGESTION]: ";
526 $main::SDK_AUTO_DEPLOYMENT
= uc <STDIN
>;
527 chop($main::SDK_AUTO_DEPLOYMENT
);
528 if ( $main::SDK_AUTO_DEPLOYMENT
eq "" )
530 $main::SDK_AUTO_DEPLOYMENT
= "YES";
534 prepareScriptFile
("setsdkenv_unix.sh.in", "setsdkenv_unix.sh");
535 chmod 0644, "$main::OO_SDK_CONFIG_HOME/$main::hostname/setsdkenv_unix.sh";
538 print " ************************************************************************\n";
539 print " * ... your SDK environment has been prepared.\n";
540 print " * For each time you want to use this configured SDK environment, you\n";
541 print " * have to run the \"setsdkenv_unix\" script file!\n";
542 print " * Alternatively can you source one of the scripts\n";
543 print " * \"$main::OO_SDK_CONFIG_HOME/$main::hostname/setsdkenv_unix.sh\"\n";
544 print " * to get an environment without starting a new shell.\n";
545 print " ************************************************************************\n\n";
553 while ( !( $skip eq "yes" || $skip eq "no") )
555 print " Do you want to skip the choice of the '$msg' (YES/NO): [YES] ";
558 if ( $skip eq "" ) { $skip = "yes"; } # default
559 if ( $skip eq "yes" )
572 my $resolvedpath = "$base/$link";
573 my $linktarget = readlink "$resolvedpath";
574 my $resolvedlink = "";
576 while ( $linktarget ne "") {
578 if ( $linktarget =~ m/^\/.*/ )
580 $resolvedpath = "$linktarget";
582 $resolvedpath = `cd $base/$linktarget; pwd`;
585 $base = dirname
("$resolvedpath");
587 $linktarget = readlink "$resolvedpath";
590 $resolvedlink = `cd $resolvedpath; pwd`;
592 return $resolvedlink;
598 my $tmpPath = `echo "\$PATH"`;
599 my @pathList = split(":" , $tmpPath);
602 if ( $_search eq "javac" )
604 if ( $main::operatingSystem
=~ m/darwin/ ) {
605 $progDir = resolveLink
("/System/Library/Frameworks/JavaVM.Framework/Versions", "CurrentJDK");
607 if ( -e
"$progDir/Home/bin/javac" )
609 return "$progDir/Home/bin";
613 if ( $main::operatingSystem
=~ m/solaris/ ) {
614 $progDir = resolveLink
("/usr/jdk", "latest");
615 if ( -e
"$progDir/bin/javac" )
617 return "$progDir/bin";
622 if ( $_search eq "gmake" && $main::operatingSystem
=~ m/solaris/ ) {
623 if ( -e
"/usr/sfw/bin/gmake" )
625 return "/usr/sfw/bin";
629 foreach $i (@pathList)
633 if ( -e
"$i/$_search" )
636 if ( index($i, "/") == 0 )
638 # # absolute path; leave unchanged
642 $progDir = `cd "$i"; pwd`;
652 if (-d
"/Applications/LibreOffice.app" ) {
653 return "/Applications/LibreOffice.app"
655 if (-d
"/Applications/OpenOffice.org.app" ) {
656 return "/Applications/OpenOffice.org.app"
658 if (-d
"/Applications/Oracle Open Office.app" ) {
659 return "/Applications/Oracle Open Office.app";
661 if (-d
"/Applications/StarOffice.app" ) {
662 return "/Applications/StarOffice.app";
664 if (-d
"/Applications/StarSuite.app" ) {
665 return "/Applications/StarSuite.app";
673 my $offset = rindex($main::sdkpath
, "/libreoffice");
674 my $tmpOffice = substr($main::sdkpath
, 0, $offset);
675 my $officepath = "$tmpOffice/libreoffice";
677 # if ( $main::OO_MINORVERSION > 0) {
678 # $officepath = "$officepath$main::OO_MINORVERSION";
681 # search corresponding office for this SDK
682 if (-d
$officepath && -e
"$officepath/program/soffice") {
686 my $tmpversion = $main::OO_MAJORVERSION
;
687 # if ( $main::OO_MINORVERSION > 0) {
688 # $tmpversion = "$tmpversion.$main::OO_MINORVERSION";
691 $officepath = "$tmpOffice/oracle_open_office$tmpversion";
692 if (-d
$officepath && -e
"$officepath/program/soffice") {
696 # Before trying versioned directories, check if the sdk is directly under
698 $officepath = $main::sdkpath
. "/..";
699 if (-d
$officepath && -e
"$officepath/program/soffice") {
703 my $tmpversion = $main::OO_MAJORVERSION
+ 6;
704 if ( $main::OO_MINORVERSION
> 0) {
705 $tmpversion = "$tmpversion.$main::OO_MINORVERSION";
708 $officepath = "$tmpOffice/staroffice$tmpversion";
709 if (-d
$officepath && -e
"$officepath/program/soffice") {
712 $officepath = "$tmpOffice/StarOffice$tmpversion";
713 if (-d
$officepath && -e
"$officepath/program/soffice") {
716 $officepath = "$tmpOffice/starsuite$tmpversion";
717 if (-d
$officepath && -e
"$officepath/program/soffice") {
720 $officepath = "$tmpOffice/StarSuite$tmpversion";
721 if (-d
$officepath && -e
"$officepath/program/soffice") {
726 # search other potential matching office versions
730 for $entry (glob($path.'*')) {
731 ## if the file is a directory
734 if ($entry =~ m
#(.+(o|O)ffice(\.org){0,1}(\d([\d\.]){0,2}))# ||
735 $entry =~ m
#(.+(s|S)uite(.*)(\d([\d\.]){0,2}))# )
739 $officepath = $entry;
749 my $dotnetExe = shift;
751 if (! -e
"$dotnetExe")
756 my $dotnetSdkVer = `"$dotnetExe" --version`;
757 chomp($dotnetSdkVer);
759 my $dotnetSdkDir = `"$dotnetExe" --list-sdks | grep $dotnetSdkVer | awk -F'[][]' '{print \$2}'`;
760 chomp($dotnetSdkDir);
762 my $dotnetRootDir = `dirname "$dotnetSdkDir"`;
763 chomp($dotnetRootDir);
765 if (! -d
"$dotnetRootDir")
770 return $dotnetRootDir;
775 my $tmpMustBeVersion = shift;
776 my $tmpTestVersion = shift;
777 my $toolName = shift;
778 # 1=check + message 2=check only
779 my $checkOnly = shift;
780 my @mustBeVersion = split(/\.|_|-/,$tmpMustBeVersion);
781 my @testVersion = split(/\.|_|-/,$tmpTestVersion);
782 my $length = $#mustBeVersion;
784 if ($#testVersion < $#mustBeVersion) {
785 $length = $#testVersion;
788 for ($i=0; $i <= $length; $i++ )
790 if ( $testVersion[$i] > $mustBeVersion[$i] )
792 return 1; # 1 indicates a correct version
795 if ( $testVersion[$i] < $mustBeVersion[$i] )
797 if ( $#checkOnly == 1 ) {
798 print " The command '$toolName' has the version $tmpTestVersion.\n";
799 print " The SDK requires at least the version $tmpMustBeVersion.\n";
805 return 1; # 1 indicates a correct version
810 my $tmpstdin = <STDIN
>;
811 if ( index($tmpstdin, "\$") != -1)
813 return `echo $tmpstdin`;
819 sub prepareScriptFile
()
821 my $inputFile = shift;
822 my $outputFile = shift;
824 if ( ! -d
"$main::OO_SDK_CONFIG_HOME/$main::hostname" )
826 system("mkdir -p $main::OO_SDK_CONFIG_HOME/$main::hostname");
829 open ( FILEIN
, "$main::sdkpath/$inputFile" ) || die "\nERROR: could not open '$main::sdkpath/$inputFile' for reading";
830 open ( FILEOUT
, ">$main::OO_SDK_CONFIG_HOME/$main::hostname/$outputFile" ) || die "\nERROR: could not open '$main::OO_SDK_CONFIG_HOME/$main::hostname/$outputFile' for writing";
834 $_ =~ s
#\@OO_SDK_NAME\@#$main::OO_SDK_NAME#go;
835 $_ =~ s
#\@OO_SDK_HOME\@#$main::OO_SDK_HOME#go;
836 $_ =~ s
#\@OFFICE_HOME\@#$main::OFFICE_HOME#go;
837 $_ =~ s
#\@OO_SDK_MAKE_HOME\@#$main::OO_SDK_MAKE_HOME#go;
838 $_ =~ s
#\@OO_SDK_ZIP_HOME\@#$main::OO_SDK_ZIP_HOME#go;
839 $_ =~ s
#\@OO_SDK_CAT_HOME\@#$main::OO_SDK_CAT_HOME#go;
840 $_ =~ s
#\@OO_SDK_SED_HOME\@#$main::OO_SDK_SED_HOME#go;
841 $_ =~ s
#\@OO_SDK_CPP_HOME\@#$main::OO_SDK_CPP_HOME#go;
842 $_ =~ s
#\@OO_SDK_DOTNET_ROOT\@#"$main::OO_SDK_DOTNET_ROOT"#go;
843 $_ =~ s
#\@OO_SDK_JAVA_HOME\@#$main::OO_SDK_JAVA_HOME#go;
844 $_ =~ s
#\@SDK_AUTO_DEPLOYMENT\@#$main::SDK_AUTO_DEPLOYMENT#go;
845 $_ =~ s
#\@OO_SDK_OUTPUT_DIR\@#$main::OO_SDK_OUTPUT_DIR#go;