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_JAVA_HOME
= "";
77 $main::OO_SDK_JAVA_HOME_SUGGESTION
= searchprog
("javac");
78 $main::javaVersion
= "1.6";
80 $main::SDK_AUTO_DEPLOYMENT
= "";
81 $main::SDK_AUTO_DEPLOYMENT_SUGGESTION
= "YES";
83 $main::OO_SDK_OUTPUT_DIR_SUGGESTION
= "$ENV{HOME}";
84 $main::OO_SDK_OUTPUT_DIR
= "";
85 $main::skipOutputDir
= 0;
89 if ( $main::operatingSystem
=~ m/darwin/ )
91 print " Used SDK = $main::OO_SDK_HOME\n\n";
93 $main::OFFICE_HOME_SUGGESTION
= searchMacOffice
();
94 while ( (! -d
"$main::OFFICE_HOME" ) ||
95 ((-d
"$main::OFFICE_HOME") && (! -d
"$main::OFFICE_HOME/Contents/MacOS")) )
97 print " Enter the Office installation directory [$main::OFFICE_HOME_SUGGESTION]: ";
98 $main::OFFICE_HOME
= readStdIn
();
99 chop($main::OFFICE_HOME
);
100 if ( $main::OFFICE_HOME
eq "" )
102 $main::OFFICE_HOME
= $main::OFFICE_HOME_SUGGESTION
;
105 if ( ! -d
"$main::OFFICE_HOME" )
107 $main::OFFICE_HOME
= "";
108 print " Error: An office installation is required, please specify the path to a valid installation.\n";
114 $main::OFFICE_HOME_SUGGESTION
= searchoffice
();
116 if ( $main::OFFICE_HOME_SUGGESTION
eq "" ) {
117 # prepare Office path
118 $main::OFFICE_HOME_SUGGESTION
= searchprog
("soffice");
121 if ( ! $main::OFFICE_HOME_SUGGESTION
eq "" )
123 my $tmpOffice = readlink "$main::OFFICE_HOME_SUGGESTION/soffice";
125 if ( $tmpOffice eq "" )
127 $tmpOffice = "$main::OFFICE_HOME_SUGGESTION/soffice";
130 my $offset = rindex($tmpOffice, "/program/soffice");
133 $main::OFFICE_HOME_SUGGESTION
= substr($tmpOffice, 0, $offset);
136 $offset = rindex($tmpOffice, "/soffice");
139 $main::OFFICE_HOME_SUGGESTION
= substr($tmpOffice, 0, $offset);
142 $main::OFFICE_HOME_SUGGESTION
= "";
147 while ( (! -d
"$main::OFFICE_HOME" ) ||
148 ((-d
"$main::OFFICE_HOME") && (! -d
"$main::OFFICE_HOME/program")) )
150 print " Enter the Office installation directory [$main::OFFICE_HOME_SUGGESTION]: ";
151 $main::OFFICE_HOME
= readStdIn
();
152 chop($main::OFFICE_HOME
);
153 if ( $main::OFFICE_HOME
eq "" )
155 $main::OFFICE_HOME
= $main::OFFICE_HOME_SUGGESTION
;
158 if ( ! -d
"$main::OFFICE_HOME" )
160 $main::OFFICE_HOME
= "";
161 print " Error: An office installation is required, please specify the path to a valid installation.\n";
164 # special work for a network installation, no program directory but a link to the soffice binary
165 if ( (! -d
"$main::OFFICE_HOME/program") && (-e
"$main::OFFICE_HOME/soffice") )
167 my $soserver = `ls -l $OFFICE_HOME_SUGGESTION/soffice | sed -n 's/.* -> //p'`;
168 $soserver= substr($soserver, 0, rindex($soserver, "program") - 1);
170 if ( ! -d
$soserver )
172 $main::OFFICE_HOME
= "";
173 print " Error: An office installation is required, please specify the path to a valid installation.\n";
176 $main::OFFICE_HOME
= $soserver;
183 # prepare GNU make path
184 while ( (!$main::correctVersion
) &&
185 ((! -d
"$main::OO_SDK_MAKE_HOME" ) ||
186 ((-d
"$main::OO_SDK_MAKE_HOME") && (! -e
"$main::OO_SDK_MAKE_HOME/$main::makeName"))) )
188 print " Enter GNU make ($main::makeVersion or higher) tools directory [$main::OO_SDK_MAKE_HOME_SUGGESTION]: ";
189 $main::OO_SDK_MAKE_HOME
= readStdIn
();
190 chop($main::OO_SDK_MAKE_HOME
);
191 if ( $main::OO_SDK_MAKE_HOME
eq "" )
193 $main::OO_SDK_MAKE_HOME
= $main::OO_SDK_MAKE_HOME_SUGGESTION
;
195 if ( (! -d
"$main::OO_SDK_MAKE_HOME") ||
196 ((-d
"$main::OO_SDK_MAKE_HOME") && (! -e
"$main::OO_SDK_MAKE_HOME/$main::makeName")) )
198 $main::OO_SDK_MAKE_HOME
= "";
199 print " Error: GNU make is required, please specify a GNU make tools directory.\n";
203 my $testVersion = `$OO_SDK_MAKE_HOME/$main::makeName --version`;
204 if ( $testVersion eq "")
206 print " Set the environment variable OO_SDK_MAKE_HOME to your GNU build tools directory.\n";
207 print " GNU make version $main::makeVersion can be obtained at ftp://ftp.gnu.org/gnu/make/\n";
210 if ($testVersion =~ m
#((\d+\.)+\d+)# )
214 $main::correctVersion
= testVersion
($main::makeVersion
, $testVersion, "$main::OO_SDK_MAKE_HOME/$main::makeName", 1);
215 if ( !$main::correctVersion
)
217 print " The '$main::makeName' command found at '$main::OO_SDK_MAKE_HOME' has a wrong version\n";
218 $main::OO_SDK_MAKE_HOME
= "";
225 $main::correctVersion
= 0;
226 while ( (!$main::correctVersion
) &&
227 ((! -d
"$main::OO_SDK_ZIP_HOME" ) ||
228 ((-d
"$main::OO_SDK_ZIP_HOME") && (! -e
"$main::OO_SDK_ZIP_HOME/zip"))) )
230 print " Enter zip ($main::zipVersion or higher) tool directory [$main::OO_SDK_ZIP_HOME_SUGGESTION]: ";
231 $main::OO_SDK_ZIP_HOME
= readStdIn
();
232 chop($main::OO_SDK_ZIP_HOME
);
233 if ( $main::OO_SDK_ZIP_HOME
eq "" )
235 $main::OO_SDK_ZIP_HOME
= $main::OO_SDK_ZIP_HOME_SUGGESTION
;
237 if ( (! -d
"$main::OO_SDK_ZIP_HOME") ||
238 ((-d
"$main::OO_SDK_ZIP_HOME") && (! -e
"$main::OO_SDK_ZIP_HOME/zip")) )
240 $main::OO_SDK_ZIP_HOME
= "";
241 print " Error: zip tool is required, please specify a zip tool directory.\n";
245 my $testVersion = `$OO_SDK_ZIP_HOME/zip -h 2>&1 | egrep Zip | head -n 1`;
246 $testVersion =~ s
#Zip ([\d.]+) .*#$1#go;
247 if ( $testVersion eq "")
249 print " Set the environment variable OO_SDK_ZIP_HOME to your zip tool directory.\n";
250 print " zip version $main::zipVersion can be obtained at ftp://www.info-zip.org/\n";
253 if ($testVersion =~ m
#((\d+\.)+\d+)# )
257 $main::correctVersion
= testVersion
($main::zipVersion
, $testVersion, "$main::OO_SDK_MAKE_HOME/zip", 1);
258 if ( !$main::correctVersion
)
260 print " The 'zip' command found at '$main::OO_SDK_ZIP_HOME' has a wrong version\n";
261 $main::OO_SDK_ZIP_HOME
= "";
268 $main::correctVersion
= 0;
269 while ( (!$main::correctVersion
) &&
270 ((! -d
"$main::OO_SDK_CAT_HOME" ) ||
271 ((-d
"$main::OO_SDK_CAT_HOME") && (! -e
"$main::OO_SDK_CAT_HOME/cat"))) )
273 print " Enter cat tool directory [$main::OO_SDK_CAT_HOME_SUGGESTION]: ";
274 $main::OO_SDK_CAT_HOME
= readStdIn
();
275 chop($main::OO_SDK_CAT_HOME
);
276 if ( $main::OO_SDK_CAT_HOME
eq "" )
278 $main::OO_SDK_CAT_HOME
= $main::OO_SDK_CAT_HOME_SUGGESTION
;
280 if ( (! -d
"$main::OO_SDK_CAT_HOME") ||
281 ((-d
"$main::OO_SDK_CAT_HOME") && (! -e
"$main::OO_SDK_CAT_HOME/cat")) )
283 $main::OO_SDK_CAT_HOME
= "";
284 print " Error: cat tool is required, please specify a cat tool directory.\n";
288 # NOTE: only Linux cat understands --version
292 $main::correctVersion
= 0;
293 while ( (!$main::correctVersion
) &&
294 ((! -d
"$main::OO_SDK_SED_HOME" ) ||
295 ((-d
"$main::OO_SDK_SED_HOME") && (! -e
"$main::OO_SDK_SED_HOME/sed"))) )
297 print " Enter sed tool directory [$main::OO_SDK_SED_HOME_SUGGESTION]: ";
298 $main::OO_SDK_SED_HOME
= readStdIn
();
299 chop($main::OO_SDK_SED_HOME
);
300 if ( $main::OO_SDK_SED_HOME
eq "" )
302 $main::OO_SDK_SED_HOME
= $main::OO_SDK_SED_HOME_SUGGESTION
;
304 if ( (! -d
"$main::OO_SDK_SED_HOME") ||
305 ((-d
"$main::OO_SDK_SED_HOME") && (! -e
"$main::OO_SDK_SED_HOME/sed")) )
307 $main::OO_SDK_SED_HOME
= "";
308 print " Error: sed tool is required, please specify a sed tool directory.\n";
312 # NOTE: only Linux sed understands --version
315 # prepare C++ compiler path
316 $main::correctVersion
= 0;
317 while ( (!$main::correctVersion
) &&
318 ((! -d
"$main::OO_SDK_CPP_HOME" ) ||
319 ((-d
"$main::OO_SDK_CPP_HOME") && (! -e
"$main::OO_SDK_CPP_HOME/$main::cpp"))) )
321 print " C++ compilers where for example a language binding exist:\n";
322 print " - Solaris, Sun WorkShop 6 update 1 C++ 5.2 2000/09/11 or higher\n";
323 print " - Linux, GNU C++ compiler, gcc version 4.0.1 or higher\n";
324 print " - MacOS, GNU C++ compiler, gcc version 4.0.1 or higher\n";
325 print " Enter the directory of the C++ compiler, the directory\n";
326 print " where the compiler is located (optional) [$main::OO_SDK_CPP_HOME_SUGGESTION]: ";
328 $main::OO_SDK_CPP_HOME
= readStdIn
();
329 chop($main::OO_SDK_CPP_HOME
);
330 if ( $main::OO_SDK_CPP_HOME
eq "" )
332 $main::OO_SDK_CPP_HOME
= $main::OO_SDK_CPP_HOME_SUGGESTION
;
335 if ( ! $main::OO_SDK_CPP_HOME
eq "" )
337 if ( (! -d
"$main::OO_SDK_CPP_HOME") ||
338 ((-d
"$main::OO_SDK_CPP_HOME") && (! -e
"$main::OO_SDK_CPP_HOME/$main::cppName")) )
340 print " Error: Could not find directory '$main::OO_SDK_CPP_HOME'.\n";
341 if ( skipChoice
("C++ compiler") == 1 )
343 $main::correctVersion
= 1;
345 $main::OO_SDK_CPP_HOME
= "";
349 if ( $main::cppName
eq "gcc" )
351 my $testVersion = `$OO_SDK_CPP_HOME/$main::cppName -dumpversion`;
352 if ( $testVersion eq "")
354 print " The '$main::cppName' command found at $main::OO_SDK_CPP_HOME/$main::cppName is not a ";
355 print " GNU compiler.\nSet the environment variable OO_SDK_CPP_HOME to your GNU build tools ";
356 print " directory.\nA GNU compiler version $main::cppVersion can be obtained at ";
357 print " ftp://ftp.gnu.org/gnu/gcc/\n";
360 $main::correctVersion
= testVersion
($main::cppVersion
, $testVersion, "$main::OO_SDK_CPP_HOME/$main::cppName", 1);
361 if ( !$main::correctVersion
)
363 print " The '$main::cppName' command found at '$main::OO_SDK_CPP_HOME' has a wrong version\n";
364 if ( skipChoice
("C++ compiler") == 1 )
366 $main::correctVersion
= 1;
369 $main::OO_SDK_CPP_HOME
= "";
376 # the C++ compiler is optional
377 $main::correctVersion
= 1;
383 $main::correctVersion
= 0;
385 # prepare Java suggestion (cut bin directory to be in the root of the Java SDK)
386 $main::offset
= rindex($main::OO_SDK_JAVA_HOME_SUGGESTION
, "/bin");
387 if ( $main::offset
!= -1 )
389 $main::OO_SDK_JAVA_HOME_SUGGESTION
= substr($main::OO_SDK_JAVA_HOME_SUGGESTION
, 0, $main::offset
);
392 while ( (!$main::correctVersion
) &&
393 ((! -d
"$main::OO_SDK_JAVA_HOME" ) ||
394 ((-d
"$main::OO_SDK_JAVA_HOME") && (! -e
"$main::OO_SDK_JAVA_HOME/bin/javac"))) )
396 print " Enter Java SDK (1.6 or higher) installation directory (optional) [$main::OO_SDK_JAVA_HOME_SUGGESTION]: ";
397 $main::OO_SDK_JAVA_HOME
= readStdIn
();
398 chop($main::OO_SDK_JAVA_HOME
);
399 if ( $main::OO_SDK_JAVA_HOME
eq "" )
401 $main::OO_SDK_JAVA_HOME
= $main::OO_SDK_JAVA_HOME_SUGGESTION
;
403 if ( ! $main::OO_SDK_JAVA_HOME
eq "" )
405 if ( (! -d
"$main::OO_SDK_JAVA_HOME") ||
406 ((-d
"$main::OO_SDK_JAVA_HOME") && (! -e
"$main::OO_SDK_JAVA_HOME/bin/javac")) )
408 print " Error: Could not find directory '$main::OO_SDK_JAVA_HOME' or '$main::OO_SDK_JAVA_HOME/bin/javac'.\n";
409 if ( skipChoice
("JAVA SDK") == 1 )
411 $main::correctVersion
= 1;
413 $main::OO_SDK_JAVA_HOME
= "";
417 my $testVersion = `$main::OO_SDK_JAVA_HOME/bin/java -version 2>&1 | egrep "java version" | head -n 1 | sed -e 's#.*version "##' | sed -e 's#".*##'`;
418 $testVersion =~ s
#([^\n]+)\n#$1#go;
420 $main::correctVersion
= testVersion
($main::javaVersion
, $testVersion, "$main::OO_SDK_JAVA_HOME/bin/java", 1);
421 if ( !$main::correctVersion
)
423 if ( skipChoice
("JAVA SDK") == 1 )
425 $main::correctVersion
= 1;
427 $main::OO_SDK_JAVA_HOME
= "";
432 # the Java SDK is optional
433 $main::correctVersion
= 1;
438 # prepare output directory (optional)
439 while ( (!$main::skipOutputDir
) &&
440 (! -d
"$main::OO_SDK_OUTPUT_DIR") )
442 print " Default output directory is in your HOME directory.\n";
443 print " Enter an existent directory if you prefer a different output directory (optional) [$main::OO_SDK_OUTPUT_DIR_SUGGESTION]: ";
445 $main::OO_SDK_OUTPUT_DIR
= readStdIn
();
447 chop($main::OO_SDK_OUTPUT_DIR
);
448 if ( $main::OO_SDK_OUTPUT_DIR
eq "" )
450 $main::OO_SDK_OUTPUT_DIR
= $main::OO_SDK_OUTPUT_DIR_SUGGESTION
;
452 if ( ! $main::OO_SDK_OUTPUT_DIR
eq "" )
454 if ( ! -d
"$main::OO_SDK_OUTPUT_DIR" )
456 print " Error: Could not find directory '$main::OO_SDK_OUTPUT_DIR'.\n";
457 if ( skipChoice
("optional output directory") == 1 )
459 $main::skipOutputDir
= 1;
461 $main::OO_SDK_OUTPUT_DIR
= "";
465 # the output directory is optional
466 $main::skipOutputDir
= 1;
470 # prepare auto deployment
471 while ( $main::SDK_AUTO_DEPLOYMENT
eq "" ||
472 ((! $main::SDK_AUTO_DEPLOYMENT
eq "YES") &&
473 (! $main::SDK_AUTO_DEPLOYMENT
eq "NO")) )
475 print " Automatic deployment of UNO components (YES/NO) [$main::SDK_AUTO_DEPLOYMENT_SUGGESTION]: ";
476 $main::SDK_AUTO_DEPLOYMENT
= uc <STDIN
>;
477 chop($main::SDK_AUTO_DEPLOYMENT
);
478 if ( $main::SDK_AUTO_DEPLOYMENT
eq "" )
480 $main::SDK_AUTO_DEPLOYMENT
= "YES";
484 prepareScriptFile
("setsdkenv_unix.sh.in", "setsdkenv_unix.sh");
485 chmod 0644, "$main::OO_SDK_CONFIG_HOME/$main::hostname/setsdkenv_unix.sh";
488 print " ************************************************************************\n";
489 print " * ... your SDK environment has been prepared.\n";
490 print " * For each time you want to use this configured SDK environment, you\n";
491 print " * have to run the \"setsdkenv_unix\" script file!\n";
492 print " * Alternatively can you source one of the scripts\n";
493 print " * \"$main::OO_SDK_CONFIG_HOME/$main::hostname/setsdkenv_unix.sh\"\n";
494 print " * to get an environment without starting a new shell.\n";
495 print " ************************************************************************\n\n";
503 while ( !( $skip eq "yes" || $skip eq "no") )
505 print " Do you want to skip the choice of the '$msg' (YES/NO): [YES] ";
508 if ( $skip eq "" ) { $skip = "yes"; } # default
509 if ( $skip eq "yes" )
522 my $resolvedpath = "$base/$link";
523 my $linktarget = readlink "$resolvedpath";
524 my $resolvedlink = "";
526 while ( $linktarget ne "") {
528 if ( $linktarget =~ m/^\/.*/ )
530 $resolvedpath = "$linktarget";
532 $resolvedpath = `cd $base/$linktarget; pwd`;
535 $base = dirname
("$resolvedpath");
537 $linktarget = readlink "$resolvedpath";
540 $resolvedlink = `cd $resolvedpath; pwd`;
542 return $resolvedlink;
548 my $tmpPath = `echo "\$PATH"`;
549 my @pathList = split(":" , $tmpPath);
552 if ( $_search eq "javac" )
554 if ( $main::operatingSystem
=~ m/darwin/ ) {
555 $progDir = resolveLink
("/System/Library/Frameworks/JavaVM.Framework/Versions", "CurrentJDK");
557 if ( -e
"$progDir/Home/bin/javac" )
559 return "$progDir/Home/bin";
563 if ( $main::operatingSystem
=~ m/solaris/ ) {
564 $progDir = resolveLink
("/usr/jdk", "latest");
565 if ( -e
"$progDir/bin/javac" )
567 return "$progDir/bin";
572 if ( $_search eq "gmake" && $main::operatingSystem
=~ m/solaris/ ) {
573 if ( -e
"/usr/sfw/bin/gmake" )
575 return "/usr/sfw/bin";
579 foreach $i (@pathList)
583 if ( -e
"$i/$_search" )
586 if ( index($i, "/") == 0 )
588 # # absolute path; leave unchanged
592 $progDir = `cd "$i"; pwd`;
602 if (-d
"/Applications/LibreOffice.app" ) {
603 return "/Applications/LibreOffice.app"
605 if (-d
"/Applications/OpenOffice.org.app" ) {
606 return "/Applications/OpenOffice.org.app"
608 if (-d
"/Applications/Oracle Open Office.app" ) {
609 return "/Applications/Oracle Open Office.app";
611 if (-d
"/Applications/StarOffice.app" ) {
612 return "/Applications/StarOffice.app";
614 if (-d
"/Applications/StarSuite.app" ) {
615 return "/Applications/StarSuite.app";
623 my $offset = rindex($main::sdkpath
, "/libreoffice");
624 my $tmpOffice = substr($main::sdkpath
, 0, $offset);
625 my $officepath = "$tmpOffice/libreoffice";
627 # if ( $main::OO_MINORVERSION > 0) {
628 # $officepath = "$officepath$main::OO_MINORVERSION";
631 # search corresponding office for this SDK
632 if (-d
$officepath && -e
"$officepath/program/soffice") {
636 my $tmpversion = $main::OO_MAJORVERSION
;
637 # if ( $main::OO_MINORVERSION > 0) {
638 # $tmpversion = "$tmpversion.$main::OO_MINORVERSION";
641 $officepath = "$tmpOffice/oracle_open_office$tmpversion";
642 if (-d
$officepath && -e
"$officepath/program/soffice") {
646 # Before trying versioned directories, check if the sdk is directly under
648 $officepath = $main::sdkpath
. "/..";
649 if (-d
$officepath && -e
"$officepath/program/soffice") {
653 my $tmpversion = $main::OO_MAJORVERSION
+ 6;
654 if ( $main::OO_MINORVERSION
> 0) {
655 $tmpversion = "$tmpversion.$main::OO_MINORVERSION";
658 $officepath = "$tmpOffice/staroffice$tmpversion";
659 if (-d
$officepath && -e
"$officepath/program/soffice") {
662 $officepath = "$tmpOffice/StarOffice$tmpversion";
663 if (-d
$officepath && -e
"$officepath/program/soffice") {
666 $officepath = "$tmpOffice/starsuite$tmpversion";
667 if (-d
$officepath && -e
"$officepath/program/soffice") {
670 $officepath = "$tmpOffice/StarSuite$tmpversion";
671 if (-d
$officepath && -e
"$officepath/program/soffice") {
676 # search other potential matching office versions
680 for $entry (glob($path.'*')) {
681 ## if the file is a directory
684 if ($entry =~ m
#(.+(o|O)ffice(\.org){0,1}(\d([\d\.]){0,2}))# ||
685 $entry =~ m
#(.+(s|S)uite(.*)(\d([\d\.]){0,2}))# )
689 $officepath = $entry;
701 my $tmpMustBeVersion = shift;
702 my $tmpTestVersion = shift;
703 my $toolName = shift;
704 # 1=check + message 2=check only
705 my $checkOnly = shift;
706 my @mustBeVersion = split(/\.|_|-/,$tmpMustBeVersion);
707 my @testVersion = split(/\.|_|-/,$tmpTestVersion);
708 my $length = $#mustBeVersion;
710 if ($#testVersion < $#mustBeVersion) {
711 $length = $#testVersion;
714 for ($i=0; $i <= $length; $i++ )
716 if ( $testVersion[$i] > $mustBeVersion[$i] )
718 return 1; # 1 indicates a correct version
721 if ( $testVersion[$i] < $mustBeVersion[$i] )
723 if ( $#checkOnly == 1 ) {
724 print " The command '$toolName' has the version $tmpTestVersion.\n";
725 print " The SDK requires at least the version $tmpMustBeVersion.\n";
731 return 1; # 1 indicates a correct version
736 my $tmpstdin = <STDIN
>;
737 if ( index($tmpstdin, "\$") != -1)
739 return `echo $tmpstdin`;
745 sub prepareScriptFile
()
747 my $inputFile = shift;
748 my $outputFile = shift;
750 if ( ! -d
"$main::OO_SDK_CONFIG_HOME/$main::hostname" )
752 system("mkdir -p $main::OO_SDK_CONFIG_HOME/$main::hostname");
755 open ( FILEIN
, "$main::sdkpath/$inputFile" ) || die "\nERROR: could not open '$main::sdkpath/$inputFile' for reading";
756 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";
760 $_ =~ s
#\@OO_SDK_NAME\@#$main::OO_SDK_NAME#go;
761 $_ =~ s
#\@OO_SDK_HOME\@#$main::OO_SDK_HOME#go;
762 $_ =~ s
#\@OFFICE_HOME\@#$main::OFFICE_HOME#go;
763 $_ =~ s
#\@OO_SDK_MAKE_HOME\@#$main::OO_SDK_MAKE_HOME#go;
764 $_ =~ s
#\@OO_SDK_ZIP_HOME\@#$main::OO_SDK_ZIP_HOME#go;
765 $_ =~ s
#\@OO_SDK_CAT_HOME\@#$main::OO_SDK_CAT_HOME#go;
766 $_ =~ s
#\@OO_SDK_SED_HOME\@#$main::OO_SDK_SED_HOME#go;
767 $_ =~ s
#\@OO_SDK_CPP_HOME\@#$main::OO_SDK_CPP_HOME#go;
768 $_ =~ s
#\@OO_SDK_JAVA_HOME\@#$main::OO_SDK_JAVA_HOME#go;
769 $_ =~ s
#\@SDK_AUTO_DEPLOYMENT\@#$main::SDK_AUTO_DEPLOYMENT#go;
770 $_ =~ s
#\@OO_SDK_OUTPUT_DIR\@#$main::OO_SDK_OUTPUT_DIR#go;