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
= `$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_OR_URE
= "Office";
45 $main::OFFICE_OR_URE_SUGGESTION
= "Office";
47 $main::OFFICE_HOME
= "";
49 $main::OO_SDK_URE_HOME
= `cd $main::sdkpath/../ure-link && pwd`;
50 chomp($main::OO_SDK_URE_HOME
);
52 $main::OO_SDK_MAKE_HOME
= "";
53 $main::makeName
= "make";
54 if ( $main::operatingSystem
=~ m/solaris/ ||
55 $main::operatingSystem
=~ m/freebsd/ )
57 $main::makeName
= "gmake";
59 $main::OO_SDK_MAKE_HOME_SUGGESTION
= searchprog
($main::makeName
);
60 $main::makeVersion
= "3.79.1";
61 $main::correctVersion
= 0;
63 $main::OO_SDK_ZIP_HOME
= "";
64 $main::OO_SDK_ZIP_HOME_SUGGESTION
= searchprog
("zip");
65 $main::zipVersion
= "2.3";
67 $main::OO_SDK_CAT_HOME
= "";
68 $main::OO_SDK_CAT_HOME_SUGGESTION
= searchprog
("cat");
70 # $main::catVersion = "";
72 $main::OO_SDK_SED_HOME
= "";
73 $main::OO_SDK_SED_HOME_SUGGESTION
= searchprog
("sed");
75 # $main::sedVersion = "";
77 $main::OO_SDK_CPP_HOME
= "";
78 $main::cppName
= "gcc";
79 $main::cppVersion
= "4.0.1";
80 if ( $main::operatingSystem
=~ m/solaris/ )
82 $main::cppName
= "CC";
83 $main::cppVersion
= "5.2";
85 $main::OO_SDK_CC_55_OR_HIGHER
= "";
86 $main::OO_SDK_CPP_HOME_SUGGESTION
= searchprog
($main::cppName
);
88 $main::OO_SDK_JAVA_HOME
= "";
89 $main::OO_SDK_JAVA_BIN_DIR
= "bin";
90 if ( $main::operatingSystem
=~ m/darwin/ )
92 $main::OO_SDK_JAVA_BIN_DIR
="Commands";
94 $main::OO_SDK_JAVA_HOME_SUGGESTION
= searchprog
("javac");
95 $main::javaVersion
= "1.5.0_01";
97 $main::SDK_AUTO_DEPLOYMENT
= "";
98 $main::SDK_AUTO_DEPLOYMENT_SUGGESTION
= "YES";
100 $main::OO_SDK_OUTPUT_DIR_SUGGESTION
= "$ENV{HOME}";
101 $main::OO_SDK_OUTPUT_DIR
= "";
102 $main::skipOutputDir
= 0;
106 if ( $main::OFFICE_OR_URE
eq "Office" )
108 if ( $main::operatingSystem
=~ m/darwin/ )
110 # used for a SDK as part of the office installation
111 # $main::OFFICE_HOME = `cd $main::sdkpath/../../.. && pwd`;
112 # chomp($main::OFFICE_HOME);
113 # print " Used Office = $main::OFFICE_HOME\n";
114 print " Used SDK = $main::OO_SDK_HOME\n\n";
116 $main::OFFICE_HOME_SUGGESTION
= searchMacOffice
();
117 while ( (! -d
"$main::OFFICE_HOME" ) ||
118 ((-d
"$main::OFFICE_HOME") && (! -d
"$main::OFFICE_HOME/Contents/MacOS")) )
120 print " Enter the Office installation directory [$main::OFFICE_HOME_SUGGESTION]: ";
121 $main::OFFICE_HOME
= readStdIn
();
122 chop($main::OFFICE_HOME
);
123 if ( $main::OFFICE_HOME
eq "" )
125 $main::OFFICE_HOME
= $main::OFFICE_HOME_SUGGESTION
;
128 if ( ! -d
"$main::OFFICE_HOME" )
130 $main::OFFICE_HOME
= "";
131 print " Error: An office installation is required, please specify the path to a valid installation.\n";
135 if ( -d
"$main::OFFICE_HOME/Contents/ure-link" ) {
136 $main::OO_SDK_URE_HOME
= "$main::OFFICE_HOME/Contents/ure-link";
138 $main::OFFICE_HOME
= "";
139 $main::OO_SDK_URE_HOME
= "";
140 print " Error: no URE found in office installation, please specify the path to a valid installation.\n";
145 $main::OFFICE_HOME_SUGGESTION
= searchoffice
();
147 if ( $main::OFFICE_HOME_SUGGESTION
eq "" ) {
148 # prepare Office path
149 $main::OFFICE_HOME_SUGGESTION
= searchprog
("soffice");
152 if ( ! $main::OFFICE_HOME_SUGGESTION
eq "" )
154 my $tmpOffice = readlink "$main::OFFICE_HOME_SUGGESTION/soffice";
156 if ( $tmpOffice eq "" )
158 $tmpOffice = "$main::OFFICE_HOME_SUGGESTION/soffice";
161 my $offset = rindex($tmpOffice, "/program/soffice");
164 $main::OFFICE_HOME_SUGGESTION
= substr($tmpOffice, 0, $offset);
167 $offset = rindex($tmpOffice, "/soffice");
170 $main::OFFICE_HOME_SUGGESTION
= substr($tmpOffice, 0, $offset);
173 $main::OFFICE_HOME_SUGGESTION
= "";
178 while ( (! -d
"$main::OFFICE_HOME" ) ||
179 ((-d
"$main::OFFICE_HOME") && (! -d
"$main::OFFICE_HOME/program")) )
181 print " Enter the Office installation directory [$main::OFFICE_HOME_SUGGESTION]: ";
182 $main::OFFICE_HOME
= readStdIn
();
183 chop($main::OFFICE_HOME
);
184 if ( $main::OFFICE_HOME
eq "" )
186 $main::OFFICE_HOME
= $main::OFFICE_HOME_SUGGESTION
;
189 if ( ! -d
"$main::OFFICE_HOME" )
191 $main::OFFICE_HOME
= "";
192 print " Error: An office installation is required, please specify the path to a valid installation.\n";
195 # special work for a network installation, no prgram directory but a link to the soffice binary
196 if ( (! -d
"$main::OFFICE_HOME/program") && (-e
"$main::OFFICE_HOME/soffice") )
198 my $soserver = `ls -l $OFFICE_HOME_SUGGESTION/soffice | sed -n 's/.* -> //p'`;
199 $soserver= substr($soserver, 0, rindex($soserver, "program") - 1);
201 if ( ! -d
$soserver )
203 $main::OFFICE_HOME
= "";
204 print " Error: An office installation is required, please specify the path to a valid installation.\n";
207 $main::OFFICE_HOME
= $soserver;
217 $main::OO_SDK_URE_HOME_SUGGESTION
= "/opt/openoffice.org/ure";
218 $main::OO_SDK_URE_HOME_SUGGESTION
= "" unless
219 -e
"$main::OO_SDK_URE_HOME_SUGGESTION/bin/uno";
222 print " Enter the URE installation directory",
223 " [$main::OO_SDK_URE_HOME_SUGGESTION]: ";
224 $main::OO_SDK_URE_HOME
= readStdIn
();
225 chop $main::OO_SDK_URE_HOME
;
226 $main::OO_SDK_URE_HOME
= $main::OO_SDK_URE_HOME_SUGGESTION
if
227 $main::OO_SDK_URE_HOME
eq "" &&
228 $main::OO_SDK_URE_HOME_SUGGESTION
ne "";
229 last if -e
"$main::OO_SDK_URE_HOME/bin/uno";
230 print " Error: A valid URE installation is required.\n";
234 # prepare GNU make path
235 while ( (!$main::correctVersion
) &&
236 ((! -d
"$main::OO_SDK_MAKE_HOME" ) ||
237 ((-d
"$main::OO_SDK_MAKE_HOME") && (! -e
"$main::OO_SDK_MAKE_HOME/$main::makeName"))) )
239 print " Enter GNU make ($main::makeVersion or higher) tools directory [$main::OO_SDK_MAKE_HOME_SUGGESTION]: ";
240 $main::OO_SDK_MAKE_HOME
= readStdIn
();
241 chop($main::OO_SDK_MAKE_HOME
);
242 if ( $main::OO_SDK_MAKE_HOME
eq "" )
244 $main::OO_SDK_MAKE_HOME
= $main::OO_SDK_MAKE_HOME_SUGGESTION
;
246 if ( (! -d
"$main::OO_SDK_MAKE_HOME") ||
247 ((-d
"$main::OO_SDK_MAKE_HOME") && (! -e
"$main::OO_SDK_MAKE_HOME/$main::makeName")) )
249 $main::OO_SDK_MAKE_HOME
= "";
250 print " Error: GNU make is required, please specify a GNU make tools directory.\n";
254 my $testVersion = `$OO_SDK_MAKE_HOME/$main::makeName --version`;
255 if ( $testVersion eq "")
257 print " Set the environment variable OO_SDK_MAKE_HOME to your GNU build tools directory.\n";
258 print " GNU make version $main::makeVersion can be obtained at ftp://ftp.gnu.org/gnu/make/\n";
261 if ($testVersion =~ m
#((\d+\.)+\d+)# )
265 $main::correctVersion
= testVersion
($main::makeVersion
, $testVersion, "$main::OO_SDK_MAKE_HOME/$main::makeName", 1);
266 if ( !$main::correctVersion
)
268 print " The '$main::makeName' command found at '$main::OO_SDK_MAKE_HOME' has a wrong version\n";
269 $main::OO_SDK_MAKE_HOME
= "";
276 $main::correctVersion
= 0;
277 while ( (!$main::correctVersion
) &&
278 ((! -d
"$main::OO_SDK_ZIP_HOME" ) ||
279 ((-d
"$main::OO_SDK_ZIP_HOME") && (! -e
"$main::OO_SDK_ZIP_HOME/zip"))) )
281 print " Enter zip ($main::zipVersion or higher) tool directory [$main::OO_SDK_ZIP_HOME_SUGGESTION]: ";
282 $main::OO_SDK_ZIP_HOME
= readStdIn
();
283 chop($main::OO_SDK_ZIP_HOME
);
284 if ( $main::OO_SDK_ZIP_HOME
eq "" )
286 $main::OO_SDK_ZIP_HOME
= $main::OO_SDK_ZIP_HOME_SUGGESTION
;
288 if ( (! -d
"$main::OO_SDK_ZIP_HOME") ||
289 ((-d
"$main::OO_SDK_ZIP_HOME") && (! -e
"$main::OO_SDK_ZIP_HOME/zip")) )
291 $main::OO_SDK_ZIP_HOME
= "";
292 print " Error: zip tool is required, please specify a zip tool directory.\n";
296 my $testVersion = `$OO_SDK_ZIP_HOME/zip -h 2>&1 | egrep Zip | head -n 1`;
297 $testVersion =~ s
#Zip ([\d.]+) .*#$1#go;
298 if ( $testVersion eq "")
300 print " Set the environment variable OO_SDK_ZIP_HOME to your zip tool directory.\n";
301 print " zip version $main::zipVersion can be obtained at ftp://www.info-zip.org/\n";
304 if ($testVersion =~ m
#((\d+\.)+\d+)# )
308 $main::correctVersion
= testVersion
($main::zipVersion
, $testVersion, "$main::OO_SDK_MAKE_HOME/zip", 1);
309 if ( !$main::correctVersion
)
311 print " The 'zip' command found at '$main::OO_SDK_ZIP_HOME' has a wrong version\n";
312 $main::OO_SDK_ZIP_HOME
= "";
319 $main::correctVersion
= 0;
320 while ( (!$main::correctVersion
) &&
321 ((! -d
"$main::OO_SDK_CAT_HOME" ) ||
322 ((-d
"$main::OO_SDK_CAT_HOME") && (! -e
"$main::OO_SDK_CAT_HOME/cat"))) )
324 print " Enter cat tool directory [$main::OO_SDK_CAT_HOME_SUGGESTION]: ";
325 $main::OO_SDK_CAT_HOME
= readStdIn
();
326 chop($main::OO_SDK_CAT_HOME
);
327 if ( $main::OO_SDK_CAT_HOME
eq "" )
329 $main::OO_SDK_CAT_HOME
= $main::OO_SDK_CAT_HOME_SUGGESTION
;
331 if ( (! -d
"$main::OO_SDK_CAT_HOME") ||
332 ((-d
"$main::OO_SDK_CAT_HOME") && (! -e
"$main::OO_SDK_CAT_HOME/cat")) )
334 $main::OO_SDK_CAT_HOME
= "";
335 print " Error: cat tool is required, please specify a cat tool directory.\n";
339 # NOTE: only Linux cat understands --version
343 $main::correctVersion
= 0;
344 while ( (!$main::correctVersion
) &&
345 ((! -d
"$main::OO_SDK_SED_HOME" ) ||
346 ((-d
"$main::OO_SDK_SED_HOME") && (! -e
"$main::OO_SDK_SED_HOME/sed"))) )
348 print " Enter sed tool directory [$main::OO_SDK_SED_HOME_SUGGESTION]: ";
349 $main::OO_SDK_SED_HOME
= readStdIn
();
350 chop($main::OO_SDK_SED_HOME
);
351 if ( $main::OO_SDK_SED_HOME
eq "" )
353 $main::OO_SDK_SED_HOME
= $main::OO_SDK_SED_HOME_SUGGESTION
;
355 if ( (! -d
"$main::OO_SDK_SED_HOME") ||
356 ((-d
"$main::OO_SDK_SED_HOME") && (! -e
"$main::OO_SDK_SED_HOME/sed")) )
358 $main::OO_SDK_SED_HOME
= "";
359 print " Error: sed tool is required, please specify a sed tool directory.\n";
363 # NOTE: only Linux sed understands --version
366 # prepare C++ compiler path
367 $main::correctVersion
= 0;
368 while ( (!$main::correctVersion
) &&
369 ((! -d
"$main::OO_SDK_CPP_HOME" ) ||
370 ((-d
"$main::OO_SDK_CPP_HOME") && (! -e
"$main::OO_SDK_CPP_HOME/$main::cpp"))) )
372 print " C++ compilers where for example a language binding exist:\n";
373 print " - Solaris, Sun WorkShop 6 update 1 C++ 5.2 2000/09/11 or higher\n";
374 print " - Linux, GNU C++ compiler, gcc version 4.0.1 or higher\n";
375 print " - MacOS, GNU C++ compiler, gcc version 4.0.1 or higher\n";
376 print " Enter the directory of the C++ compiler, the directory\n";
377 print " where the compiler is located (optional) [$main::OO_SDK_CPP_HOME_SUGGESTION]: ";
379 $main::OO_SDK_CPP_HOME
= readStdIn
();
380 chop($main::OO_SDK_CPP_HOME
);
381 if ( $main::OO_SDK_CPP_HOME
eq "" )
383 $main::OO_SDK_CPP_HOME
= $main::OO_SDK_CPP_HOME_SUGGESTION
;
386 if ( ! $main::OO_SDK_CPP_HOME
eq "" )
388 if ( (! -d
"$main::OO_SDK_CPP_HOME") ||
389 ((-d
"$main::OO_SDK_CPP_HOME") && (! -e
"$main::OO_SDK_CPP_HOME/$main::cppName")) )
391 print " Error: Could not find directory '$main::OO_SDK_CPP_HOME'.\n";
392 if ( skipChoice
("C++ compiler") == 1 )
394 $main::correctVersion
= 1;
396 $main::OO_SDK_CPP_HOME
= "";
400 if ( $main::cppName
eq "gcc" )
402 my $testVersion = `$OO_SDK_CPP_HOME/$main::cppName -dumpversion`;
403 if ( $testVersion eq "")
405 print " The '$main::cppName' command found at $main::OO_SDK_CPP_HOME/$main::cppName is not a ";
406 print " GNU compiler.\nSet the environment variable OO_SDK_CPP_HOME to your GNU build tools ";
407 print " directory.\nA GNU compiler version $main::cppVersion can be obtained at ";
408 print " ftp://ftp.gnu.org/gnu/gcc/\n";
411 $main::correctVersion
= testVersion
($main::cppVersion
, $testVersion, "$main::OO_SDK_CPP_HOME/$main::cppName", 1);
412 if ( !$main::correctVersion
)
414 print " The '$main::cppName' command found at '$main::OO_SDK_CPP_HOME' has a wrong version\n";
415 if ( skipChoice
("C++ compiler") == 1 )
417 $main::correctVersion
= 1;
420 $main::OO_SDK_CPP_HOME
= "";
425 # for Solaris we have to check the version too
426 open(FILE
, "$OO_SDK_CPP_HOME/$main::cppName -V 2>&1 |");
428 my $testVersion = $lines[0];
429 if ( $testVersion eq "")
431 print " The '$main::cppName' command found at $main::OO_SDK_CPP_HOME/$main::cppName is not a ";
432 print " Solaris C++ compiler.\nSet the environment variable OO_SDK_CPP_HOME to your Solaris C++ compiler directory.\n";
435 if ($testVersion =~ m
#((\d+\.)+\d+)# )
439 $main::correctVersion
= testVersion
($main::cppVersion
, $testVersion, "$main::OO_SDK_CPP_HOME/$main::cppName", 1);
440 if ( !$main::correctVersion
)
442 print " The '$main::cppName' command found at '$main::OO_SDK_CPP_HOME' has a wrong version\n";
443 if ( skipChoice
("C++ compiler") == 1 )
445 $main::correctVersion
= 1;
448 $main::OO_SDK_CPP_HOME
= "";
450 $main::correctVersion
= testVersion
("5.5", $testVersion, "$main::OO_SDK_CPP_HOME/$main::cppName", 2);
451 if ( $main::correctVersion
) {
452 $main::OO_SDK_CC_55_OR_HIGHER
= $testVersion;
460 # the C++ compiler is optional
461 $main::correctVersion
= 1;
467 $main::correctVersion
= 0;
469 # prepare Java suggestion (cut bin or Commands directory to be in the root of the Java SDK)
470 $main::offset
= rindex($main::OO_SDK_JAVA_HOME_SUGGESTION
, "/$main::OO_SDK_JAVA_BIN_DIR");
471 if ( $main::offset
!= -1 )
473 $main::OO_SDK_JAVA_HOME_SUGGESTION
= substr($main::OO_SDK_JAVA_HOME_SUGGESTION
, 0, $main::offset
);
476 while ( (!$main::correctVersion
) &&
477 ((! -d
"$main::OO_SDK_JAVA_HOME" ) ||
478 ((-d
"$main::OO_SDK_JAVA_HOME") && (! -e
"$main::OO_SDK_JAVA_HOME/$main::OO_SDK_JAVA_BIN_DIR/javac"))) )
480 print " Enter Java SDK (1.5, recommendation is 1.6 or higher) installation directory (optional) [$main::OO_SDK_JAVA_HOME_SUGGESTION]: ";
481 $main::OO_SDK_JAVA_HOME
= readStdIn
();
482 chop($main::OO_SDK_JAVA_HOME
);
483 if ( $main::OO_SDK_JAVA_HOME
eq "" )
485 $main::OO_SDK_JAVA_HOME
= $main::OO_SDK_JAVA_HOME_SUGGESTION
;
487 if ( ! $main::OO_SDK_JAVA_HOME
eq "" )
489 if ( (! -d
"$main::OO_SDK_JAVA_HOME") ||
490 ((-d
"$main::OO_SDK_JAVA_HOME") && (! -e
"$main::OO_SDK_JAVA_HOME/$main::OO_SDK_JAVA_BIN_DIR/javac")) )
492 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";
493 if ( skipChoice
("JAVA SDK") == 1 )
495 $main::correctVersion
= 1;
497 $main::OO_SDK_JAVA_HOME
= "";
501 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#".*##'`;
502 $testVersion =~ s
#([^\n]+)\n#$1#go;
504 $main::correctVersion
= testVersion
($main::javaVersion
, $testVersion, "$main::OO_SDK_JAVA_HOME/$main::OO_SDK_JAVA_BIN_DIR/java", 1);
505 if ( !$main::correctVersion
)
507 if ( skipChoice
("JAVA SDK") == 1 )
509 $main::correctVersion
= 1;
511 $main::OO_SDK_JAVA_HOME
= "";
516 # the Java SDK is optional
517 $main::correctVersion
= 1;
522 # prepare output directory (optional)
523 while ( (!$main::skipOutputDir
) &&
524 (! -d
"$main::OO_SDK_OUTPUT_DIR") )
526 print " Default output directory is in your HOME directory.\n";
527 print " Enter an existent directory if you prefer a different output directory (optional) [$main::OO_SDK_OUTPUT_DIR_SUGGESTION]: ";
529 $main::OO_SDK_OUTPUT_DIR
= readStdIn
();
531 chop($main::OO_SDK_OUTPUT_DIR
);
532 if ( $main::OO_SDK_OUTPUT_DIR
eq "" )
534 $main::OO_SDK_OUTPUT_DIR
= $main::OO_SDK_OUTPUT_DIR_SUGGESTION
;
536 if ( ! $main::OO_SDK_OUTPUT_DIR
eq "" )
538 if ( ! -d
"$main::OO_SDK_OUTPUT_DIR" )
540 print " Error: Could not find directory '$main::OO_SDK_OUTPUT_DIR'.\n";
541 if ( skipChoice
("optional output directory") == 1 )
543 $main::skipOutputDir
= 1;
545 $main::OO_SDK_OUTPUT_DIR
= "";
549 # the output directory is optional
550 $main::skipOutputDir
= 1;
554 # prepare auto deployment
555 if ( $main::OFFICE_OR_URE
eq "Office" )
557 while ( $main::SDK_AUTO_DEPLOYMENT
eq "" ||
558 ((! $main::SDK_AUTO_DEPLOYMENT
eq "YES") &&
559 (! $main::SDK_AUTO_DEPLOYMENT
eq "NO")) )
561 print " Automatic deployment of UNO components (YES/NO) [$main::SDK_AUTO_DEPLOYMENT_SUGGESTION]: ";
562 $main::SDK_AUTO_DEPLOYMENT
= uc <STDIN
>;
563 chop($main::SDK_AUTO_DEPLOYMENT
);
564 if ( $main::SDK_AUTO_DEPLOYMENT
eq "" )
566 $main::SDK_AUTO_DEPLOYMENT
= "YES";
572 $main::SDK_AUTO_DEPLOYMENT
= "NO";
575 prepareScriptFile
("setsdkenv_unix.sh.in", "setsdkenv_unix.sh");
576 chmod 0644, "$main::OO_SDK_CONFIG_HOME/$main::hostname/setsdkenv_unix.sh";
579 print " ************************************************************************\n";
580 print " * ... your SDK environment has been prepared.\n";
581 print " * For each time you want to use this configured SDK environment, you\n";
582 print " * have to run the \"setsdkenv_unix\" script file!\n";
583 print " * Alternatively can you source one of the scripts\n";
584 print " * \"$main::OO_SDK_CONFIG_HOME/$main::hostname/setsdkenv_unix.sh\"\n";
585 print " * to get an environment without starting a new shell.\n";
586 print " ************************************************************************\n\n";
594 while ( !( $skip eq "yes" || $skip eq "no") )
596 print " Do you want to skip the choice of the '$msg' (YES/NO): [YES] ";
599 if ( $skip eq "" ) { $skip = "yes"; } # default
600 if ( $skip eq "yes" )
613 my $resolvedpath = "$base/$link";
614 my $linktarget = readlink "$resolvedpath";
615 my $resolvedlink = "";
617 while ( $linktarget ne "") {
619 if ( $linktarget =~ m/^\/.*/ )
621 $resolvedpath = "$linktarget";
623 $resolvedpath = `cd $base/$linktarget; pwd`;
626 $base = dirname
("$resolvedpath");
628 $linktarget = readlink "$resolvedpath";
631 $resolvedlink = `cd $resolvedpath; pwd`;
633 return $resolvedlink;
639 my $tmpPath = `echo "\$PATH"`;
640 my @pathList = split(":" , $tmpPath);
643 if ( $_search eq "javac" )
645 if ( $main::operatingSystem
=~ m/darwin/ ) {
646 $progDir = resolveLink
("/System/Library/Frameworks/JavaVM.Framework/Versions", "CurrentJDK");
648 if ( -e
"$progDir/$main::OO_SDK_JAVA_BIN_DIR/javac" )
650 return "$progDir/$main::OO_SDK_JAVA_BIN_DIR";
654 if ( $main::operatingSystem
=~ m/solaris/ ) {
655 $progDir = resolveLink
("/usr/jdk", "latest");
656 if ( -e
"$progDir/$main::OO_SDK_JAVA_BIN_DIR/javac" )
658 return "$progDir/$main::OO_SDK_JAVA_BIN_DIR";
663 if ( $_search eq "gmake" && $main::operatingSystem
=~ m/solaris/ ) {
664 if ( -e
"/usr/sfw/bin/gmake" )
666 return "/usr/sfw/bin";
670 foreach $i (@pathList)
674 if ( -e
"$i/$_search" )
677 if ( index($i, "/") == 0 )
679 # # absolute path; leave unchanged
683 $progDir = `cd "$i"; pwd`;
693 if (-d
"/Applications/LibreOffice.app" ) {
694 return "/Applications/LibreOffice.app"
696 if (-d
"/Applications/OpenOffice.org.app" ) {
697 return "/Applications/OpenOffice.org.app"
699 if (-d
"/Applications/Oracle Open Office.app" ) {
700 return "/Applications/Oracle Open Office.app";
702 if (-d
"/Applications/StarOffice.app" ) {
703 return "/Applications/StarOffice.app";
705 if (-d
"/Applications/StarSuite.app" ) {
706 return "/Applications/StarSuite.app";
714 my $offset = rindex($main::sdkpath
, "/libreoffice");
715 my $tmpOffice = substr($main::sdkpath
, 0, $offset);
716 my $officepath = "$tmpOffice/libreoffice";
718 # if ( $main::OO_MINORVERSION > 0) {
719 # $officepath = "$officepath$main::OO_MINORVERSION";
722 # search corresponding office for this SDK
723 if (-d
$officepath && -e
"$officepath/program/soffice") {
727 my $tmpversion = $main::OO_MAJORVERSION
;
728 # if ( $main::OO_MINORVERSION > 0) {
729 # $tmpversion = "$tmpversion.$main::OO_MINORVERSION";
732 $officepath = "$tmpOffice/oracle_open_office$tmpversion";
733 if (-d
$officepath && -e
"$officepath/program/soffice") {
737 # Before trying versioned directories, check if the sdk is directly under
739 $officepath = $main::sdkpath
. "/..";
740 if (-d
$officepath && -e
"$officepath/program/soffice") {
744 my $tmpversion = $main::OO_MAJORVERSION
+ 6;
745 if ( $main::OO_MINORVERSION
> 0) {
746 $tmpversion = "$tmpversion.$main::OO_MINORVERSION";
749 $officepath = "$tmpOffice/staroffice$tmpversion";
750 if (-d
$officepath && -e
"$officepath/program/soffice") {
753 $officepath = "$tmpOffice/StarOffice$tmpversion";
754 if (-d
$officepath && -e
"$officepath/program/soffice") {
757 $officepath = "$tmpOffice/starsuite$tmpversion";
758 if (-d
$officepath && -e
"$officepath/program/soffice") {
761 $officepath = "$tmpOffice/StarSuite$tmpversion";
762 if (-d
$officepath && -e
"$officepath/program/soffice") {
767 # search other potential matching office versions
771 for $entry (glob($path.'*')) {
772 ## if the file is a directory
775 if ($entry =~ m
#(.+(o|O)ffice(\.org){0,1}(\d([\d\.]){0,2}))# ||
776 $entry =~ m
#(.+(s|S)uite(.*)(\d([\d\.]){0,2}))# )
780 $officepath = $entry;
792 my $tmpMustBeVersion = shift;
793 my $tmpTestVersion = shift;
794 my $toolName = shift;
795 # 1=check + message 2=check only
796 my $checkOnly = shift;
797 my @mustBeVersion = split(/\.|_|-/,$tmpMustBeVersion);
798 my @testVersion = split(/\.|_|-/,$tmpTestVersion);
799 my $length = $#mustBeVersion;
801 if ($#testVersion < $#mustBeVersion) {
802 $length = $#testVersion;
805 for ($i=0; $i <= $length; $i++ )
807 if ( $testVersion[$i] > $mustBeVersion[$i] )
809 return 1; # 1 indicates a correct version
812 if ( $testVersion[$i] < $mustBeVersion[$i] )
814 if ( $#checkOnly == 1 ) {
815 print " The command '$toolName' has the version $tmpTestVersion.\n";
816 print " The SDK requires at least the version $tmpMustBeVersion.\n";
822 return 1; # 1 indicates a correct version
827 my $tmpstdin = <STDIN
>;
828 if ( index($tmpstdin, "\$") != -1)
830 return `echo $tmpstdin`;
836 sub prepareScriptFile
()
838 my $inputFile = shift;
839 my $outputFile = shift;
841 if ( ! -d
"$main::OO_SDK_CONFIG_HOME/$main::hostname" )
843 system("mkdir -p $main::OO_SDK_CONFIG_HOME/$main::hostname");
846 open ( FILEIN
, "$main::sdkpath/$inputFile" ) || die "\nERROR: could not open '$main::sdkpath/$inputFile' for reading";
847 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";
851 $_ =~ s
#\@OO_SDK_NAME\@#$main::OO_SDK_NAME#go;
852 $_ =~ s
#\@OO_SDK_HOME\@#$main::OO_SDK_HOME#go;
853 $_ =~ s
#\@OFFICE_HOME\@#$main::OFFICE_HOME#go;
854 $_ =~ s
#\@OO_SDK_URE_HOME\@#$main::OO_SDK_URE_HOME#go;
855 $_ =~ s
#\@OO_SDK_MAKE_HOME\@#$main::OO_SDK_MAKE_HOME#go;
856 $_ =~ s
#\@OO_SDK_ZIP_HOME\@#$main::OO_SDK_ZIP_HOME#go;
857 $_ =~ s
#\@OO_SDK_CAT_HOME\@#$main::OO_SDK_CAT_HOME#go;
858 $_ =~ s
#\@OO_SDK_SED_HOME\@#$main::OO_SDK_SED_HOME#go;
859 $_ =~ s
#\@OO_SDK_CPP_HOME\@#$main::OO_SDK_CPP_HOME#go;
860 $_ =~ s
#\@OO_SDK_CC_55_OR_HIGHER\@#$main::OO_SDK_CC_55_OR_HIGHER#go;
861 $_ =~ s
#\@OO_SDK_JAVA_HOME\@#$main::OO_SDK_JAVA_HOME#go;
862 $_ =~ s
#\@SDK_AUTO_DEPLOYMENT\@#$main::SDK_AUTO_DEPLOYMENT#go;
863 $_ =~ s
#\@OO_SDK_OUTPUT_DIR\@#$main::OO_SDK_OUTPUT_DIR#go;