2 # configure.pl - a perl script to set a minimal environment for the SDK.
4 # Copyright 2000, 2010 Oracle and/or its affiliates.
10 $main::hostname
= $ARGV[0];
11 $main::sdkpath
= $ARGV[1];
12 $main::OO_SDK_NAME
= $ARGV[2];
14 $main::OO_MAJORVERSION
=$main::OO_SDK_NAME
;
15 $main::OO_MINORVERSION
=$main::OO_SDK_NAME
;
16 $main::OO_MAJORVERSION
=~ s
#[^\d]+(\d).(\d).+#$1#go;
17 $main::OO_MINORVERSION
=~ s
#[^\d]+(\d).(\d).+#$2#go;
19 $main::OO_SDK_CONFIG_HOME
= "$ENV{HOME}/$main::OO_SDK_NAME";
21 $main::operatingSystem
= `$main::sdkpath/config.guess | cut -d"-" -f3,4`;
22 chomp ($main::operatingSystem
);
24 $main::OO_SDK_HOME
= $main::sdkpath
;
25 #$main::OO_SDK_HOME = "";
26 $main::OO_SDK_HOME_SUGGESTION
= $main::sdkpath
;
28 $main::OFFICE_OR_URE
= "Office";
29 $main::OFFICE_OR_URE_SUGGESTION
= "Office";
31 $main::OFFICE_HOME
= "";
33 $main::OO_SDK_URE_HOME
= `cd $main::sdkpath/../ure-link && pwd`;
34 chomp($main::OO_SDK_URE_HOME
);
36 $main::OO_SDK_MAKE_HOME
= "";
37 $main::makeName
= "make";
38 if ( $main::operatingSystem
=~ m/solaris/ ||
39 $main::operatingSystem
=~ m/freebsd/ )
41 $main::makeName
= "gmake";
43 $main::OO_SDK_MAKE_HOME_SUGGESTION
= searchprog
($main::makeName
);
44 $main::makeVersion
= "3.79.1";
45 $main::correctVersion
= 0;
47 $main::OO_SDK_ZIP_HOME
= "";
48 $main::OO_SDK_ZIP_HOME_SUGGESTION
= searchprog
("zip");
49 $main::zipVersion
= "2.3";
51 $main::OO_SDK_CPP_HOME
= "";
52 $main::cppName
= "gcc";
53 $main::cppVersion
= "4.0.1";
54 if ( $main::operatingSystem
=~ m/solaris/ )
56 $main::cppName
= "CC";
57 $main::cppVersion
= "5.2";
59 $main::OO_SDK_CC_55_OR_HIGHER
= "";
60 $main::OO_SDK_CPP_HOME_SUGGESTION
= searchprog
($main::cppName
);
62 $main::OO_SDK_JAVA_HOME
= "";
63 $main::OO_SDK_JAVA_BIN_DIR
= "bin";
64 if ( $main::operatingSystem
=~ m/darwin/ )
66 $main::OO_SDK_JAVA_BIN_DIR
="Commands";
68 $main::OO_SDK_JAVA_HOME_SUGGESTION
= searchprog
("javac");
69 $main::javaVersion
= "1.5.0_01";
71 $main::SDK_AUTO_DEPLOYMENT
= "";
72 $main::SDK_AUTO_DEPLOYMENT_SUGGESTION
= "YES";
74 $main::OO_SDK_OUTPUT_DIR_SUGGESTION
= "$ENV{HOME}";
75 $main::OO_SDK_OUTPUT_DIR
= "";
76 $main::skipOutputDir
= 0;
80 if ( $main::OFFICE_OR_URE
eq "Office" )
82 if ( $main::operatingSystem
=~ m/darwin/ )
84 # used for a SDK as part of the office installation
85 # $main::OFFICE_HOME = `cd $main::sdkpath/../../.. && pwd`;
86 # chomp($main::OFFICE_HOME);
87 # print " Used Office = $main::OFFICE_HOME\n";
88 print " Used SDK = $main::OO_SDK_HOME\n\n";
90 $main::OFFICE_HOME_SUGGESTION
= searchMacOffice
();
91 while ( (! -d
"$main::OFFICE_HOME" ) ||
92 ((-d
"$main::OFFICE_HOME") && (! -d
"$main::OFFICE_HOME/Contents/MacOS")) )
94 print " Enter the Office installation directory [$main::OFFICE_HOME_SUGGESTION]: ";
95 $main::OFFICE_HOME
= readStdIn
();
96 chop($main::OFFICE_HOME
);
97 if ( $main::OFFICE_HOME
eq "" )
99 $main::OFFICE_HOME
= $main::OFFICE_HOME_SUGGESTION
;
102 if ( ! -d
"$main::OFFICE_HOME" )
104 $main::OFFICE_HOME
= "";
105 print " Error: An office installation is required, please specify the path to a valid installation.\n";
109 if ( -d
"$main::OFFICE_HOME/Contents/ure-link" ) {
110 $main::OO_SDK_URE_HOME
= "$main::OFFICE_HOME/Contents/ure-link";
112 $main::OFFICE_HOME
= "";
113 $main::OO_SDK_URE_HOME
= "";
114 print " Error: no URE found in office installation, please specify the path to a valid installation.\n";
119 $main::OFFICE_HOME_SUGGESTION
= searchoffice
();
121 if ( $main::OFFICE_HOME_SUGGESTION
eq "" ) {
122 # prepare Office path
123 $main::OFFICE_HOME_SUGGESTION
= searchprog
("soffice");
126 if ( ! $main::OFFICE_HOME_SUGGESTION
eq "" )
128 my $tmpOffice = readlink "$main::OFFICE_HOME_SUGGESTION/soffice";
130 if ( $tmpOffice eq "" )
132 $tmpOffice = "$main::OFFICE_HOME_SUGGESTION/soffice";
135 my $offset = rindex($tmpOffice, "/program/soffice");
138 $main::OFFICE_HOME_SUGGESTION
= substr($tmpOffice, 0, $offset);
141 $offset = rindex($tmpOffice, "/soffice");
144 $main::OFFICE_HOME_SUGGESTION
= substr($tmpOffice, 0, $offset);
147 $main::OFFICE_HOME_SUGGESTION
= "";
152 while ( (! -d
"$main::OFFICE_HOME" ) ||
153 ((-d
"$main::OFFICE_HOME") && (! -d
"$main::OFFICE_HOME/program")) )
155 print " Enter the Office installation directory [$main::OFFICE_HOME_SUGGESTION]: ";
156 $main::OFFICE_HOME
= readStdIn
();
157 chop($main::OFFICE_HOME
);
158 if ( $main::OFFICE_HOME
eq "" )
160 $main::OFFICE_HOME
= $main::OFFICE_HOME_SUGGESTION
;
163 if ( ! -d
"$main::OFFICE_HOME" )
165 $main::OFFICE_HOME
= "";
166 print " Error: An office installation is required, please specify the path to a valid installation.\n";
169 # special work for a network installation, no prgram directory but a link to the soffice binary
170 if ( (! -d
"$main::OFFICE_HOME/program") && (-e
"$main::OFFICE_HOME/soffice") )
172 my $soserver = `ls -l $OFFICE_HOME_SUGGESTION/soffice | sed -n 's/.* -> //p'`;
173 $soserver= substr($soserver, 0, rindex($soserver, "program") - 1);
175 if ( ! -d
$soserver )
177 $main::OFFICE_HOME
= "";
178 print " Error: An office installation is required, please specify the path to a valid installation.\n";
181 $main::OFFICE_HOME
= $soserver;
191 $main::OO_SDK_URE_HOME_SUGGESTION
= "/opt/openoffice.org/ure";
192 $main::OO_SDK_URE_HOME_SUGGESTION
= "" unless
193 -e
"$main::OO_SDK_URE_HOME_SUGGESTION/bin/uno";
196 print " Enter the URE installation directory",
197 " [$main::OO_SDK_URE_HOME_SUGGESTION]: ";
198 $main::OO_SDK_URE_HOME
= readStdIn
();
199 chop $main::OO_SDK_URE_HOME
;
200 $main::OO_SDK_URE_HOME
= $main::OO_SDK_URE_HOME_SUGGESTION
if
201 $main::OO_SDK_URE_HOME
eq "" &&
202 $main::OO_SDK_URE_HOME_SUGGESTION
ne "";
203 last if -e
"$main::OO_SDK_URE_HOME/bin/uno";
204 print " Error: A valid URE installation is required.\n";
208 # prepare GNU make path
209 while ( (!$main::correctVersion
) &&
210 ((! -d
"$main::OO_SDK_MAKE_HOME" ) ||
211 ((-d
"$main::OO_SDK_MAKE_HOME") && (! -e
"$main::OO_SDK_MAKE_HOME/$main::makeName"))) )
213 print " Enter GNU make ($main::makeVersion or higher) tools directory [$main::OO_SDK_MAKE_HOME_SUGGESTION]: ";
214 $main::OO_SDK_MAKE_HOME
= readStdIn
();
215 chop($main::OO_SDK_MAKE_HOME
);
216 if ( $main::OO_SDK_MAKE_HOME
eq "" )
218 $main::OO_SDK_MAKE_HOME
= $main::OO_SDK_MAKE_HOME_SUGGESTION
;
220 if ( (! -d
"$main::OO_SDK_MAKE_HOME") ||
221 ((-d
"$main::OO_SDK_MAKE_HOME") && (! -e
"$main::OO_SDK_MAKE_HOME/$main::makeName")) )
223 $main::OO_SDK_MAKE_HOME
= "";
224 print " Error: GNU make is required, please specify a GNU make tools directory.\n";
228 my $testVersion = `$OO_SDK_MAKE_HOME/$main::makeName --version`;
229 if ( $testVersion eq "")
231 print " Set the environment variable OO_SDK_MAKE_HOME to your GNU build tools directory.\n";
232 print " GNU make version $main::makeVersion can be obtained at ftp://ftp.gnu.org/gnu/make/\n";
235 if ($testVersion =~ m
#((\d+\.)+\d+)# )
239 $main::correctVersion
= testVersion
($main::makeVersion
, $testVersion, "$main::OO_SDK_MAKE_HOME/$main::makeName", 1);
240 if ( !$main::correctVersion
)
242 print " The '$main::makeName' command found at '$main::OO_SDK_MAKE_HOME' has a wrong version\n";
243 $main::OO_SDK_MAKE_HOME
= "";
250 $main::correctVersion
= 0;
251 while ( (!$main::correctVersion
) &&
252 ((! -d
"$main::OO_SDK_ZIP_HOME" ) ||
253 ((-d
"$main::OO_SDK_ZIP_HOME") && (! -e
"$main::OO_SDK_ZIP_HOME/zip"))) )
255 print " Enter zip ($main::zipVersion or higher) tool directory [$main::OO_SDK_ZIP_HOME_SUGGESTION]: ";
256 $main::OO_SDK_ZIP_HOME
= readStdIn
();
257 chop($main::OO_SDK_ZIP_HOME
);
258 if ( $main::OO_SDK_ZIP_HOME
eq "" )
260 $main::OO_SDK_ZIP_HOME
= $main::OO_SDK_ZIP_HOME_SUGGESTION
;
262 if ( (! -d
"$main::OO_SDK_ZIP_HOME") ||
263 ((-d
"$main::OO_SDK_ZIP_HOME") && (! -e
"$main::OO_SDK_ZIP_HOME/zip")) )
265 $main::OO_SDK_ZIP_HOME
= "";
266 print " Error: zip tool is required, please specify a zip tool directory.\n";
270 my $testVersion = `$OO_SDK_ZIP_HOME/zip -h 2>&1 | egrep Zip | head -n 1`;
271 $testVersion =~ s
#Zip ([\d.]+) .*#$1#go;
272 if ( $testVersion eq "")
274 print " Set the environment variable OO_SDK_ZIP_HOME to your zip tool directory.\n";
275 print " zip version $main::zipVersion can be obtained at ftp://www.info-zip.org/\n";
278 if ($testVersion =~ m
#((\d+\.)+\d+)# )
282 $main::correctVersion
= testVersion
($main::zipVersion
, $testVersion, "$main::OO_SDK_MAKE_HOME/zip", 1);
283 if ( !$main::correctVersion
)
285 print " The 'zip' command found at '$main::OO_SDK_ZIP_HOME' has a wrong version\n";
286 $main::OO_SDK_ZIP_HOME
= "";
292 # prepare C++ compiler path
293 $main::correctVersion
= 0;
294 while ( (!$main::correctVersion
) &&
295 ((! -d
"$main::OO_SDK_CPP_HOME" ) ||
296 ((-d
"$main::OO_SDK_CPP_HOME") && (! -e
"$main::OO_SDK_CPP_HOME/$main::cpp"))) )
298 print " C++ compilers where for example a language binding exist:\n";
299 print " - Solaris, Sun WorkShop 6 update 1 C++ 5.2 2000/09/11 or higher\n";
300 print " - Linux, GNU C++ compiler, gcc version 4.0.1 or higher\n";
301 print " - MacOS, GNU C++ compiler, gcc version 4.0.1 or higher\n";
302 print " Enter the directory of the C++ compiler, the directory\n";
303 print " where the compiler is located (optional) [$main::OO_SDK_CPP_HOME_SUGGESTION]: ";
305 $main::OO_SDK_CPP_HOME
= readStdIn
();
306 chop($main::OO_SDK_CPP_HOME
);
307 if ( $main::OO_SDK_CPP_HOME
eq "" )
309 $main::OO_SDK_CPP_HOME
= $main::OO_SDK_CPP_HOME_SUGGESTION
;
312 if ( ! $main::OO_SDK_CPP_HOME
eq "" )
314 if ( (! -d
"$main::OO_SDK_CPP_HOME") ||
315 ((-d
"$main::OO_SDK_CPP_HOME") && (! -e
"$main::OO_SDK_CPP_HOME/$main::cppName")) )
317 print " Error: Could not find directory '$main::OO_SDK_CPP_HOME'.\n";
318 if ( skipChoice
("C++ compiler") == 1 )
320 $main::correctVersion
= 1;
322 $main::OO_SDK_CPP_HOME
= "";
326 if ( $main::cppName
eq "gcc" )
328 my $testVersion = `$OO_SDK_CPP_HOME/$main::cppName -dumpversion`;
329 if ( $testVersion eq "")
331 print " The '$main::cppName' command found at $main::OO_SDK_CPP_HOME/$main::cppName is not a ";
332 print " GNU compiler.\nSet the environment variable OO_SDK_CPP_HOME to your GNU build tools ";
333 print " directory.\nA GNU compiler version $main::cppVersion can be obtained at ";
334 print " ftp://ftp.gnu.org/gnu/gcc/\n";
337 $main::correctVersion
= testVersion
($main::cppVersion
, $testVersion, "$main::OO_SDK_CPP_HOME/$main::cppName", 1);
338 if ( !$main::correctVersion
)
340 print " The '$main::cppName' command found at '$main::OO_SDK_CPP_HOME' has a wrong version\n";
341 if ( skipChoice
("C++ compiler") == 1 )
343 $main::correctVersion
= 1;
346 $main::OO_SDK_CPP_HOME
= "";
351 # for Solaris we have to check the version too
352 open(FILE
, "$OO_SDK_CPP_HOME/$main::cppName -V 2>&1 |");
354 my $testVersion = $lines[0];
355 if ( $testVersion eq "")
357 print " The '$main::cppName' command found at $main::OO_SDK_CPP_HOME/$main::cppName is not a ";
358 print " Solaris C++ compiler.\nSet the environment variable OO_SDK_CPP_HOME to your Solaris C++ compiler directory.\n";
361 if ($testVersion =~ m
#((\d+\.)+\d+)# )
365 $main::correctVersion
= testVersion
($main::cppVersion
, $testVersion, "$main::OO_SDK_CPP_HOME/$main::cppName", 1);
366 if ( !$main::correctVersion
)
368 print " The '$main::cppName' command found at '$main::OO_SDK_CPP_HOME' has a wrong version\n";
369 if ( skipChoice
("C++ compiler") == 1 )
371 $main::correctVersion
= 1;
374 $main::OO_SDK_CPP_HOME
= "";
376 $main::correctVersion
= testVersion
("5.5", $testVersion, "$main::OO_SDK_CPP_HOME/$main::cppName", 2);
377 if ( $main::correctVersion
) {
378 $main::OO_SDK_CC_55_OR_HIGHER
= $testVersion;
386 # the C++ compiler is optional
387 $main::correctVersion
= 1;
393 $main::correctVersion
= 0;
395 # prepare Java suggestion (cut bin or Commands directory to be in the root of the Java SDK)
396 $main::offset
= rindex($main::OO_SDK_JAVA_HOME_SUGGESTION
, "/$main::OO_SDK_JAVA_BIN_DIR");
397 if ( $main::offset
!= -1 )
399 $main::OO_SDK_JAVA_HOME_SUGGESTION
= substr($main::OO_SDK_JAVA_HOME_SUGGESTION
, 0, $main::offset
);
402 while ( (!$main::correctVersion
) &&
403 ((! -d
"$main::OO_SDK_JAVA_HOME" ) ||
404 ((-d
"$main::OO_SDK_JAVA_HOME") && (! -e
"$main::OO_SDK_JAVA_HOME/$main::OO_SDK_JAVA_BIN_DIR/javac"))) )
406 print " Enter Java SDK (1.5, recommendation is 1.6 or higher) installation directory (optional) [$main::OO_SDK_JAVA_HOME_SUGGESTION]: ";
407 $main::OO_SDK_JAVA_HOME
= readStdIn
();
408 chop($main::OO_SDK_JAVA_HOME
);
409 if ( $main::OO_SDK_JAVA_HOME
eq "" )
411 $main::OO_SDK_JAVA_HOME
= $main::OO_SDK_JAVA_HOME_SUGGESTION
;
413 if ( ! $main::OO_SDK_JAVA_HOME
eq "" )
415 if ( (! -d
"$main::OO_SDK_JAVA_HOME") ||
416 ((-d
"$main::OO_SDK_JAVA_HOME") && (! -e
"$main::OO_SDK_JAVA_HOME/$main::OO_SDK_JAVA_BIN_DIR/javac")) )
418 print " Error: Could not find directory '$main::OO_SDK_JAVA_HOME' or '$main::OO_SDK_JAVA_HOME/$main::OO_SDK_JAVA_BIN_DIR/javac'.\n";
419 if ( skipChoice
("JAVA SDK") == 1 )
421 $main::correctVersion
= 1;
423 $main::OO_SDK_JAVA_HOME
= "";
427 my $testVersion = `$main::OO_SDK_JAVA_HOME/$main::OO_SDK_JAVA_BIN_DIR/java -version 2>&1 | egrep "java version" | head -n 1 | sed -e 's#.*version "##' | sed -e 's#".*##'`;
428 $testVersion =~ s
#([^\n]+)\n#$1#go;
430 $main::correctVersion
= testVersion
($main::javaVersion
, $testVersion, "$main::OO_SDK_JAVA_HOME/$main::OO_SDK_JAVA_BIN_DIR/java", 1);
431 if ( !$main::correctVersion
)
433 if ( skipChoice
("JAVA SDK") == 1 )
435 $main::correctVersion
= 1;
437 $main::OO_SDK_JAVA_HOME
= "";
442 # the Java SDK is optional
443 $main::correctVersion
= 1;
448 # prepare output directory (optional)
449 while ( (!$main::skipOutputDir
) &&
450 (! -d
"$main::OO_SDK_OUTPUT_DIR") )
452 print " Default output directory is in your HOME directory.\n";
453 print " Enter an existent directory if you prefer a different output directory (optional) [$main::OO_SDK_OUTPUT_DIR_SUGGESTION]: ";
455 $main::OO_SDK_OUTPUT_DIR
= readStdIn
();
457 chop($main::OO_SDK_OUTPUT_DIR
);
458 if ( $main::OO_SDK_OUTPUT_DIR
eq "" )
460 $main::OO_SDK_OUTPUT_DIR
= $main::OO_SDK_OUTPUT_DIR_SUGGESTION
;
462 if ( ! $main::OO_SDK_OUTPUT_DIR
eq "" )
464 if ( ! -d
"$main::OO_SDK_OUTPUT_DIR" )
466 print " Error: Could not find directory '$main::OO_SDK_OUTPUT_DIR'.\n";
467 if ( skipChoice
("optional output directory") == 1 )
469 $main::skipOutputDir
= 1;
471 $main::OO_SDK_OUTPUT_DIR
= "";
475 # the output directory is optional
476 $main::skipOutputDir
= 1;
480 # prepare auto deployment
481 if ( $main::OFFICE_OR_URE
eq "Office" )
483 while ( $main::SDK_AUTO_DEPLOYMENT
eq "" ||
484 ((! $main::SDK_AUTO_DEPLOYMENT
eq "YES") &&
485 (! $main::SDK_AUTO_DEPLOYMENT
eq "NO")) )
487 print " Automatic deployment of UNO components (YES/NO) [$main::SDK_AUTO_DEPLOYMENT_SUGGESTION]: ";
488 $main::SDK_AUTO_DEPLOYMENT
= uc <STDIN
>;
489 chop($main::SDK_AUTO_DEPLOYMENT
);
490 if ( $main::SDK_AUTO_DEPLOYMENT
eq "" )
492 $main::SDK_AUTO_DEPLOYMENT
= "YES";
498 $main::SDK_AUTO_DEPLOYMENT
= "NO";
501 prepareScriptFile
("setsdkenv_unix.sh.in", "setsdkenv_unix.sh", 1);
502 chmod 0644, "$main::OO_SDK_CONFIG_HOME/$main::hostname/setsdkenv_unix.sh";
504 prepareScriptFile
("setsdkenv_unix.csh.in", "setsdkenv_unix.csh", 2);
505 chmod 0644, "$main::OO_SDK_CONFIG_HOME/$main::hostname/setsdkenv_unix.csh";
508 print " ************************************************************************\n";
509 print " * ... your SDK environment has been prepared.\n";
510 print " * For each time you want to use this configured SDK environment, you\n";
511 print " * have to run the \"setsdkenv_unix\" script file!\n";
512 print " * Alternatively can you source one of the scripts\n";
513 print " * \"$main::OO_SDK_CONFIG_HOME/$main::hostname/setsdkenv_unix.sh\"\n";
514 print " * \"$main::OO_SDK_CONFIG_HOME/$main::hostname/setsdkenv_unix.csh\"\n";
515 print " * to get an environment without starting a new shell.\n";
516 print " ************************************************************************\n\n";
524 while ( !( $skip eq "yes" || $skip eq "no") )
526 print " Do you want to skip the choice of the '$msg' (YES/NO): [YES] ";
529 if ( $skip eq "" ) { $skip = "yes"; } # default
530 if ( $skip eq "yes" )
543 my $resolvedpath = "$base/$link";
544 my $linktarget = readlink "$resolvedpath";
545 my $resolvedlink = "";
547 while ( $linktarget ne "") {
549 if ( $linktarget =~ m/^\/.*/ )
551 $resolvedpath = "$linktarget";
553 $resolvedpath = `cd $base/$linktarget; pwd`;
556 $base = dirname
("$resolvedpath");
558 $linktarget = readlink "$resolvedpath";
561 $resolvedlink = `cd $resolvedpath; pwd`;
563 return $resolvedlink;
569 my $tmpPath = `echo "\$PATH"`;
570 my @pathList = split(":" , $tmpPath);
573 if ( $_search eq "javac" )
575 if ( $main::operatingSystem
=~ m/darwin/ ) {
576 $progDir = resolveLink
("/System/Library/Frameworks/JavaVM.Framework/Versions", "CurrentJDK");
578 if ( -e
"$progDir/$main::OO_SDK_JAVA_BIN_DIR/javac" )
580 return "$progDir/$main::OO_SDK_JAVA_BIN_DIR";
584 if ( $main::operatingSystem
=~ m/solaris/ ) {
585 $progDir = resolveLink
("/usr/jdk", "latest");
586 if ( -e
"$progDir/$main::OO_SDK_JAVA_BIN_DIR/javac" )
588 return "$progDir/$main::OO_SDK_JAVA_BIN_DIR";
593 if ( $_search eq "gmake" && $main::operatingSystem
=~ m/solaris/ ) {
594 if ( -e
"/usr/sfw/bin/gmake" )
596 return "/usr/sfw/bin";
600 foreach $i (@pathList)
604 if ( -e
"$i/$_search" )
607 if ( index($i, "/") == 0 )
609 # # absolute path; leave unchanged
613 $progDir = `cd "$i"; pwd`;
623 if (-d
"/Applications/LibreOffice.app" ) {
624 return "/Applications/LibreOffice.app"
626 if (-d
"/Applications/OpenOffice.org.app" ) {
627 return "/Applications/OpenOffice.org.app"
629 if (-d
"/Applications/Oracle Open Office.app" ) {
630 return "/Applications/Oracle Open Office.app";
632 if (-d
"/Applications/StarOffice.app" ) {
633 return "/Applications/StarOffice.app";
635 if (-d
"/Applications/StarSuite.app" ) {
636 return "/Applications/StarSuite.app";
644 my $offset = rindex($main::sdkpath
, "/libreoffice");
645 my $tmpOffice = substr($main::sdkpath
, 0, $offset);
646 my $officepath = "$tmpOffice/libreoffice";
648 # if ( $main::OO_MINORVERSION > 0) {
649 # $officepath = "$officepath$main::OO_MINORVERSION";
652 # search corresponding office for this SDK
653 if (-d
$officepath && -e
"$officepath/program/soffice") {
657 my $tmpversion = $main::OO_MAJORVERSION
;
658 # if ( $main::OO_MINORVERSION > 0) {
659 # $tmpversion = "$tmpversion.$main::OO_MINORVERSION";
662 $officepath = "$tmpOffice/oracle_open_office$tmpversion";
663 if (-d
$officepath && -e
"$officepath/program/soffice") {
667 my $tmpversion = $main::OO_MAJORVERSION
+ 6;
668 if ( $main::OO_MINORVERSION
> 0) {
669 $tmpversion = "$tmpversion.$main::OO_MINORVERSION";
672 $officepath = "$tmpOffice/staroffice$tmpversion";
673 if (-d
$officepath && -e
"$officepath/program/soffice") {
676 $officepath = "$tmpOffice/StarOffice$tmpversion";
677 if (-d
$officepath && -e
"$officepath/program/soffice") {
680 $officepath = "$tmpOffice/starsuite$tmpversion";
681 if (-d
$officepath && -e
"$officepath/program/soffice") {
684 $officepath = "$tmpOffice/StarSuite$tmpversion";
685 if (-d
$officepath && -e
"$officepath/program/soffice") {
690 # search other potential matching office versions
694 for $entry (glob($path.'*')) {
695 ## if the file is a directory
698 if ($entry =~ m
#(.+(o|O)ffice(\.org){0,1}(\d([\d\.]){0,2}))# ||
699 $entry =~ m
#(.+(s|S)uite(.*)(\d([\d\.]){0,2}))# )
703 $officepath = $entry;
715 my $tmpMustBeVersion = shift;
716 my $tmpTestVersion = shift;
717 my $toolName = shift;
718 # 1=check + message 2=check only
719 my $checkOnly = shift;
720 my @mustBeVersion = split(/\.|_|-/,$tmpMustBeVersion);
721 my @testVersion = split(/\.|_|-/,$tmpTestVersion);
722 my $length = $#mustBeVersion;
724 if ($#testVersion < $#mustBeVersion) {
725 $length = $#testVersion;
728 for ($i=0; $i <= $length; $i++ )
730 if ( @testVersion->[$i] > @mustBeVersion->[$i] )
732 return 1; # 1 indicates a correct version
735 if ( @testVersion->[$i] < @mustBeVersion->[$i] )
737 if ( $#checkOnly == 1 ) {
738 print " The command '$toolName' has the version $tmpTestVersion.\n";
739 print " The SDK requires at least the version $tmpMustBeVersion.\n";
745 return 1; # 1 indicates a correct version
750 my $tmpstdin = <STDIN
>;
751 if ( index($tmpstdin, "\$") != -1)
753 return `echo $tmpstdin`;
759 sub prepareScriptFile
()
761 my $inputFile = shift;
762 my $outputFile = shift;
765 my $shellMode = shift;
767 if ( ! -d
"$main::OO_SDK_CONFIG_HOME/$main::hostname" )
769 system("mkdir -p $main::OO_SDK_CONFIG_HOME/$main::hostname");
772 open ( FILEIN
, "$main::sdkpath/$inputFile" ) || die "\nERROR: could not open '$main::sdkpath/$inputFile' for reading";
773 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";
777 $_ =~ s
#\@OO_SDK_NAME\@#$main::OO_SDK_NAME#go;
778 $_ =~ s
#\@OO_SDK_HOME\@#$main::OO_SDK_HOME#go;
779 $_ =~ s
#\@OFFICE_HOME\@#$main::OFFICE_HOME#go;
780 $_ =~ s
#\@OO_SDK_URE_HOME\@#$main::OO_SDK_URE_HOME#go;
781 $_ =~ s
#\@OO_SDK_MAKE_HOME\@#$main::OO_SDK_MAKE_HOME#go;
782 $_ =~ s
#\@OO_SDK_ZIP_HOME\@#$main::OO_SDK_ZIP_HOME#go;
783 $_ =~ s
#\@OO_SDK_CPP_HOME\@#$main::OO_SDK_CPP_HOME#go;
784 $_ =~ s
#\@OO_SDK_CC_55_OR_HIGHER\@#$main::OO_SDK_CC_55_OR_HIGHER#go;
785 $_ =~ s
#\@OO_SDK_JAVA_HOME\@#$main::OO_SDK_JAVA_HOME#go;
786 $_ =~ s
#\@SDK_AUTO_DEPLOYMENT\@#$main::SDK_AUTO_DEPLOYMENT#go;
787 $_ =~ s
#\@OO_SDK_OUTPUT_DIR\@#$main::OO_SDK_OUTPUT_DIR#go;