summaryrefslogtreecommitdiff
path: root/odk/configure.pl
diff options
context:
space:
mode:
authorRüdiger Timm <rt@openoffice.org>2004-05-18 12:17:41 +0000
committerRüdiger Timm <rt@openoffice.org>2004-05-18 12:17:41 +0000
commitacbb1d7c621f6bd4e0f5d72d42e60ddeb2f550b1 (patch)
tree3f836c52e6a40376e64b529fdde102242b2f52e8 /odk/configure.pl
parent2760e28943205a882052c00adba9d6592da7de28 (diff)
INTEGRATION: CWS sdk13 (1.6.40); FILE MERGED
2004/05/13 12:19:38 jsc 1.6.40.4: #116705# improve office suggestion 2004/05/13 12:02:20 jsc 1.6.40.3: #116705# remove debug output 2004/05/12 10:04:25 jsc 1.6.40.2: RESYNC: (1.6-1.7); FILE MERGED 2004/05/11 12:16:46 jsc 1.6.40.1: #116705# ask for optional output directory
Diffstat (limited to 'odk/configure.pl')
-rw-r--r--odk/configure.pl205
1 files changed, 160 insertions, 45 deletions
diff --git a/odk/configure.pl b/odk/configure.pl
index b1978322a4af..d4fce89f09c7 100644
--- a/odk/configure.pl
+++ b/odk/configure.pl
@@ -6,6 +6,7 @@
use IO::File;
+$main::OO_SDK_NAME=readSDKName();
$main::currentWorkingDir = `pwd`;
chop ($main::currentWorkingDir);
$main::operatingSystem = `uname -s`;
@@ -14,8 +15,23 @@ $main::OO_SDK_HOME = "";
$main::OO_SDK_HOME_SUGGESTION = $main::currentWorkingDir;
$main::OFFICE_HOME = "";
-$main::OFFICE_HOME_SUGGESTION=`egrep "=file://" \$HOME/.sversionrc | tr -d \\\r | head -n 1 | sed -e 's#.*=file://##'`;
-chop ($main::OFFICE_HOME_SUGGESTION);
+$main::OFFICE_HOME_SUGGESTION = searchprog("soffice");
+$main::tmpOffice = readlink "$main::OFFICE_HOME_SUGGESTION/soffice";
+if ( ! $main::tmpOffice eq "" )
+{
+ my $offset = rindex($main::tmpOffice, "/program/soffice");
+ if ( $main::offset != -1 )
+ {
+ $main::OFFICE_HOME_SUGGESTION = substr($main::tmpOffice, 0, $offset);
+ } else
+ {
+ $offset = rindex($main::tmpOffice, "/soffice");
+ if ( $main::offset != -1 )
+ {
+ $main::OFFICE_HOME_SUGGESTION = substr($main::tmpOffice, 0, $offset);
+ }
+ }
+}
$main::OO_SDK_MAKE_HOME = "";
$main::OO_SDK_MAKE_HOME_SUGGESTION = searchprog("make");
@@ -40,14 +56,22 @@ $main::javaVersion = "1.4.1_01";
$main::SDK_AUTO_DEPLOYMENT = "";
$main::SDK_AUTO_DEPLOYMENT_SUGGESTION = "YES";
+$main::SDK_AUTO_DEPLOYMENT = "";
+$main::SDK_AUTO_DEPLOYMENT_SUGGESTION = "YES";
+
+$main::OO_SDK_OUTPUT_DIR = "";
+#$main::OO_SDK_OUTPUT_DIR = '$HOME';
+$main::OO_SDK_OUTPUT_DIR = "";
+$main::skipOutputDir = 0;
+
$main::return = 0;
# prepare SDK path
while ( (! -d "$main::OO_SDK_HOME" ) ||
((-d "$main::OO_SDK_HOME") && (! -d "$main::OO_SDK_HOME/idl")) )
{
- print "Enter the Office Software Development Kit directory [$main::OO_SDK_HOME_SUGGESTION]: ";
- $main::OO_SDK_HOME = <STDIN>;
+ print " Enter the Office Software Development Kit directory [$main::OO_SDK_HOME_SUGGESTION]: ";
+ $main::OO_SDK_HOME = readStdIn();
chop($main::OO_SDK_HOME);
if ( $main::OO_SDK_HOME eq "" )
{
@@ -57,7 +81,7 @@ while ( (! -d "$main::OO_SDK_HOME" ) ||
((-d "$main::OO_SDK_HOME") && (! -d "$main::OO_SDK_HOME/idl")) )
{
$main::OO_SDK_HOME = "";
- print "Error: An SDK is required, please specify the path to a valid installation.\n";
+ print " Error: An SDK is required, please specify the path to a valid installation.\n";
}
}
@@ -65,8 +89,8 @@ while ( (! -d "$main::OO_SDK_HOME" ) ||
while ( (! -d "$main::OFFICE_HOME" ) ||
((-d "$main::OFFICE_HOME") && (! -d "$main::OFFICE_HOME/program")) )
{
- print "Enter the Office installation directory [$main::OFFICE_HOME_SUGGESTION]: ";
- $main::OFFICE_HOME = <STDIN>;
+ print " Enter the Office installation directory [$main::OFFICE_HOME_SUGGESTION]: ";
+ $main::OFFICE_HOME = readStdIn();
chop($main::OFFICE_HOME);
if ( $main::OFFICE_HOME eq "" )
{
@@ -76,7 +100,7 @@ while ( (! -d "$main::OFFICE_HOME" ) ||
if ( ! -d "$main::OFFICE_HOME" )
{
$main::OFFICE_HOME = "";
- print "Error: An office installation is required, please specify the path to a valid installation.\n";
+ print " Error: An office installation is required, please specify the path to a valid installation.\n";
} else
{
# special work for a network installation, no prgram directory but a link to the soffice binary
@@ -88,7 +112,7 @@ while ( (! -d "$main::OFFICE_HOME" ) ||
if ( ! -d $soserver )
{
$main::OFFICE_HOME = "";
- print "Error: An office installation is required, please specify the path to a valid installation.\n";
+ print " Error: An office installation is required, please specify the path to a valid installation.\n";
} else
{
$main::OFFICE_HOME = $soserver;
@@ -102,8 +126,8 @@ while ( (!$main::correctVersion) &&
((! -d "$main::OO_SDK_MAKE_HOME" ) ||
((-d "$main::OO_SDK_MAKE_HOME") && (! -e "$main::OO_SDK_MAKE_HOME/make"))) )
{
- print "Enter GNU make ($main::makeVersion or higher) tools directory [$main::OO_SDK_MAKE_HOME_SUGGESTION]: ";
- $main::OO_SDK_MAKE_HOME = <STDIN>;
+ print " Enter GNU make ($main::makeVersion or higher) tools directory [$main::OO_SDK_MAKE_HOME_SUGGESTION]: ";
+ $main::OO_SDK_MAKE_HOME = readStdIn();
chop($main::OO_SDK_MAKE_HOME);
if ( $main::OO_SDK_MAKE_HOME eq "" )
{
@@ -113,16 +137,21 @@ while ( (!$main::correctVersion) &&
((-d "$main::OO_SDK_MAKE_HOME") && (! -e "$main::OO_SDK_MAKE_HOME/make")) )
{
$main::OO_SDK_MAKE_HOME = "";
- print "Error: GNU make is required, please specify a GNU make tools directory.\n";
+ print " Error: GNU make is required, please specify a GNU make tools directory.\n";
} else
{
#check version
my $testVersion = `$OO_SDK_MAKE_HOME/make --version`;
if ( $testVersion eq "")
{
- print "The 'make' command found at $main::OO_SDK_MAKE_HOME/make is not GNU Make\n";
- print "Set the environment variable OO_SDK_MAKE_HOME to your GNU build tools directory.\n";
- print "GNU make version $main::makeVersion can be obtained at ftp://ftp.gnu.org/gnu/make/\n";
+ $main::offset = rindex($main::OO_SDK_JAVA_HOME_SUGGESTION, "/bin");
+if ( $main::offset != -1 )
+{
+ $main::OO_SDK_JAVA_HOME_SUGGESTION = substr($main::OO_SDK_JAVA_HOME_SUGGESTION, 0, $main::offset);
+}
+ print " The 'make' command found at $main::OO_SDK_MAKE_HOME/make is not GNU Make\n";
+ print " Set the environment variable OO_SDK_MAKE_HOME to your GNU build tools directory.\n";
+ print " GNU make version $main::makeVersion can be obtained at ftp://ftp.gnu.org/gnu/make/\n";
} else
{
if ($testVersion =~ m#((\d+\.)+\d+)# )
@@ -132,7 +161,7 @@ while ( (!$main::correctVersion) &&
$main::correctVersion = testVersion($main::makeVersion, $testVersion, "$main::OO_SDK_MAKE_HOME/make");
if ( !$main::correctVersion )
{
- print "The 'make' command found at '$main::OO_SDK_MAKE_HOME' has a wrong version\n";
+ print " The 'make' command found at '$main::OO_SDK_MAKE_HOME' has a wrong version\n";
$main::OO_SDK_MAKE_HOME = "";
}
}
@@ -145,24 +174,29 @@ while ( (!$main::correctVersion) &&
((! -d "$main::OO_SDK_CPP_HOME" ) ||
((-d "$main::OO_SDK_CPP_HOME") && (! -e "$main::OO_SDK_CPP_HOME/$main::cpp"))) )
{
- print "C++ Compiler where a language binding exist:\n";
- print "Solaris, Sun WorkShop 6 update 1 C++ 5.2 2000/09/11 or higher\n";
- print "Linux, GNU C++ compiler, gcc version 3.0.1 or higher\n";
- print "Enter the directory of the C++ compiler, the directory\n";
- print "where the compiler is located (optional) [$main::OO_SDK_CPP_HOME_SUGGESTION]: ";
+ print " C++ compilers where for example a language binding exist:\n";
+ print " - Solaris, Sun WorkShop 6 update 1 C++ 5.2 2000/09/11 or higher\n";
+ print " - Linux, GNU C++ compiler, gcc version 3.0.1 or higher\n";
+ print " Enter the directory of the C++ compiler, the directory\n";
+ print " where the compiler is located (optional) [$main::OO_SDK_CPP_HOME_SUGGESTION]: ";
- $main::OO_SDK_CPP_HOME = <STDIN>;
+ $main::OO_SDK_CPP_HOME = readStdIn();
chop($main::OO_SDK_CPP_HOME);
if ( $main::OO_SDK_CPP_HOME eq "" )
{
$main::OO_SDK_CPP_HOME = $main::OO_SDK_CPP_HOME_SUGGESTION;
- }
+ }$main::offset = rindex($main::OO_SDK_JAVA_HOME_SUGGESTION, "/bin");
+if ( $main::offset != -1 )
+{
+ $main::OO_SDK_JAVA_HOME_SUGGESTION = substr($main::OO_SDK_JAVA_HOME_SUGGESTION, 0, $main::offset);
+}
+
if ( ! $main::OO_SDK_CPP_HOME eq "" )
{
if ( (! -d "$main::OO_SDK_CPP_HOME") ||
((-d "$main::OO_SDK_CPP_HOME") && (! -e "$main::OO_SDK_CPP_HOME/$main::cppName")) )
{
- print "Error: Could not find directory '$main::OO_SDK_CPP_HOME'.\n";
+ print " Error: Could not find directory '$main::OO_SDK_CPP_HOME'.\n";
if ( skipChoice("C++ compiler") == 1 )
{
$main::correctVersion = 1;
@@ -176,16 +210,16 @@ while ( (!$main::correctVersion) &&
my $testVersion = `$OO_SDK_CPP_HOME/$main::cppName -dumpversion`;
if ( $testVersion eq "")
{
- print "The '$main::cppName' command found at $main::OO_SDK_CPP_HOME/$main::cppName is not a ";
- print "GNU compiler.\nSet the environment variable OO_SDK_CPP_HOME to your GNU build tools ";
- print "directory.\nA GNU compiler version $main::cppVersion can be obtained at ";
- print "ftp://ftp.gnu.org/gnu/gcc/\n";
+ print " The '$main::cppName' command found at $main::OO_SDK_CPP_HOME/$main::cppName is not a ";
+ print " GNU compiler.\nSet the environment variable OO_SDK_CPP_HOME to your GNU build tools ";
+ print " directory.\nA GNU compiler version $main::cppVersion can be obtained at ";
+ print " ftp://ftp.gnu.org/gnu/gcc/\n";
} else
{
$main::correctVersion = testVersion($main::cppVersion, $testVersion, "$main::OO_SDK_CPP_HOME/$main::cppName");
if ( !$main::correctVersion )
{
- print "The '$main::cppName' command found at '$main::OO_SDK_CPP_HOME' has a wrong version\n";
+ print " The '$main::cppName' command found at '$main::OO_SDK_CPP_HOME' has a wrong version\n";
if ( skipChoice("C++ compiler") == 1 )
{
$main::correctVersion = 1;
@@ -202,8 +236,8 @@ while ( (!$main::correctVersion) &&
my $testVersion = $lines[0];
if ( $testVersion eq "")
{
- print "The '$main::cppName' command found at $main::OO_SDK_CPP_HOME/$main::cppName is not a ";
- print "Solaris C++ compiler.\nSet the environment variable OO_SDK_CPP_HOME to your Solaris C++ compiler directory.\n";
+ print " The '$main::cppName' command found at $main::OO_SDK_CPP_HOME/$main::cppName is not a ";
+ print " Solaris C++ compiler.\nSet the environment variable OO_SDK_CPP_HOME to your Solaris C++ compiler directory.\n";
} else
{
if ($testVersion =~ m#((\d+\.)+\d+)# )
@@ -213,7 +247,7 @@ while ( (!$main::correctVersion) &&
$main::correctVersion = testVersion($main::cppVersion, $testVersion, "$main::OO_SDK_CPP_HOME/$main::cppName");
if ( !$main::correctVersion )
{
- print "The '$main::cppName' command found at '$main::OO_SDK_CPP_HOME' has a wrong version\n";
+ print " The '$main::cppName' command found at '$main::OO_SDK_CPP_HOME' has a wrong version\n";
if ( skipChoice("C++ compiler") == 1 )
{
$main::correctVersion = 1;
@@ -233,12 +267,20 @@ while ( (!$main::correctVersion) &&
# prepare Java path
$main::correctVersion = 0;
+
+# prepare Java suggestion (cut bin directory to be in the root of the Java SDK)
+$main::offset = rindex($main::OO_SDK_JAVA_HOME_SUGGESTION, "/bin");
+if ( $main::offset != -1 )
+{
+ $main::OO_SDK_JAVA_HOME_SUGGESTION = substr($main::OO_SDK_JAVA_HOME_SUGGESTION, 0, $main::offset);
+}
+
while ( (!$main::correctVersion) &&
((! -d "$main::OO_SDK_JAVA_HOME" ) ||
((-d "$main::OO_SDK_JAVA_HOME") && (! -e "$main::OO_SDK_JAVA_HOME/bin/javac"))) )
{
- print "Enter JAVA SDK (1.4.1_01 or higher) installation directory [$Main::OO_SDK_JAVA_HOME_SUGGESTION]: ";
- $main::OO_SDK_JAVA_HOME = <STDIN>;
+ print " Enter JAVA SDK (1.4.1_01 or higher) installation directory [$Main::OO_SDK_JAVA_HOME_SUGGESTION]: ";
+ $main::OO_SDK_JAVA_HOME = readStdIn();
chop($main::OO_SDK_JAVA_HOME);
if ( $main::OO_SDK_JAVA_HOME eq "" )
{
@@ -248,11 +290,12 @@ while ( (!$main::correctVersion) &&
((-d "$main::OO_SDK_JAVA_HOME") && (! -e "$main::OO_SDK_JAVA_HOME/bin/javac")) )
{
$main::OO_SDK_JAVA_HOME = "";
- print "Error: A Java SDK is required, please specify a valid Java SDK directory.\n";
+ print " Error: A Java SDK is required, please specify a valid Java SDK directory.\n";
} else
{
#check version
my $testVersion = `$main::OO_SDK_JAVA_HOME/bin/java -version 2>&1 | egrep "java version" | head -1 | sed -e 's#.*version "##' | sed -e 's#".*##'`;
+ $testVersion =~ s#([^\n]+)\n#$1#go;
$main::correctVersion = testVersion($main::javaVersion, $testVersion, "$main::OO_SDK_JAVA_HOME/bin/java");
if ( !$main::correctVersion )
@@ -262,11 +305,44 @@ while ( (!$main::correctVersion) &&
}
}
+# prepare output directory (optional)
+while ( (!$main::skipOutputDir) &&
+ (! -d "$main::OO_SDK_OUTPUT_DIR") )
+{
+ print " Default output directory is the SDK directory itself.\n";
+ print " Enter an existent directory if you prefer a different output directory (optional) [$main::OO_SDK_OUTPUT_DIR]: ";
+
+ $main::OO_SDK_OUTPUT_DIR = readStdIn();
+
+ chop($main::OO_SDK_OUTPUT_DIR);
+ if ( $main::OO_SDK_OUTPUT_DIR eq "" )
+ {
+ $main::OO_SDK_OUTPUT_DIR = $main::OO_SDK_OUTPUT_DIR_SUGGESTION;
+ }
+ if ( ! $main::OO_SDK_OUTPUT_DIR eq "" )
+ {
+ if ( ! -d "$main::OO_SDK_OUTPUT_DIR" )
+ {
+ print " Error: Could not find directory '$main::OO_SDK_OUTPUT_DIR'.\n";
+ if ( skipChoice("optional output directory") == 1 )
+ {
+ $main::skipOutputDir = 1;
+ }
+ $main::OO_SDK_OUTPUT_DIR = "";
+ }
+ } else
+ {
+ # the output directory is optional
+ $main::skipOutputDir = 1;
+ }
+}
+
+# prepare auto deployment
while ( $main::SDK_AUTO_DEPLOYMENT eq "" ||
((! $main::SDK_AUTO_DEPLOYMENT eq "YES") &&
(! $main::SDK_AUTO_DEPLOYMENT eq "NO")) )
{
- print "Automatic deployment of UNO components (YES/NO) [$main::SDK_AUTO_DEPLOYMENT_SUGGESTION]: ";
+ print " Automatic deployment of UNO components (YES/NO) [$main::SDK_AUTO_DEPLOYMENT_SUGGESTION]: ";
$main::SDK_AUTO_DEPLOYMENT = <STDIN>;
chop($main::SDK_AUTO_DEPLOYMENT);
if ( $main::SDK_AUTO_DEPLOYMENT eq "" )
@@ -276,18 +352,19 @@ while ( $main::SDK_AUTO_DEPLOYMENT eq "" ||
}
-
open ( FILEIN, "$main::currentWorkingDir/setsdkenv_unix.in" ) || die "\nERROR: could not open '$main::currentWorkingDir/setsdkenv_unix.in' for reading";
open ( FILEOUT, ">$main::currentWorkingDir/setsdkenv_unix" ) || die "\nERROR: could not open '$main::currentWorkingDir/setsdkenv_unix' for writing";
while ( <FILEIN> )
{
+ $_ =~ s#\@OO_SDK_NAME\@#$main::OO_SDK_NAME#go;
$_ =~ s#\@OO_SDK_HOME\@#$main::OO_SDK_HOME#go;
$_ =~ s#\@OFFICE_HOME\@#$main::OFFICE_HOME#go;
$_ =~ s#\@OO_SDK_MAKE_HOME\@#$main::OO_SDK_MAKE_HOME#go;
$_ =~ s#\@OO_SDK_CPP_HOME\@#$main::OO_SDK_CPP_HOME#go;
$_ =~ s#\@OO_SDK_JAVA_HOME\@#$main::OO_SDK_JAVA_HOME#go;
$_ =~ s#\@SDK_AUTO_DEPLOYMENT\@#$main::SDK_AUTO_DEPLOYMENT#go;
+ $_ =~ s#\@OO_SDK_OUTPUT_DIR\@#$main::OO_SDK_OUTPUT_DIR#go;
print FILEOUT $_;
}
@@ -296,9 +373,12 @@ close FILEIN;
close FILEOUT;
chmod 0755, "$main::currentWorkingDir/setsdkenv_unix";
-print "\n... \"setsdkenv_unix\" script file has been prepared.\n";
-print "For each time you want to use this configured SDK environment,\n";
-print "you have to run the \"setsdkenv_unix\" script in a new shell!\n\n";
+print "\n";
+print " *****************************************************************\n";
+print " * ... \"setsdkenv_unix\" has been prepared. *\n";
+print " * For each time you want to use this configured SDK environment *\n";
+print " * environment, please run the \"setsdkenv_unix\" script file! *\n";
+print " *****************************************************************\n\n";
exit $return;
@@ -308,7 +388,7 @@ sub skipChoice
my $skip = "";
while ( !( $skip eq "YES" || $skip eq "NO") )
{
- print "Do you want to skip the choice of the '$msg' (YES/NO): [YES] ";
+ print " Do you want to skip the choice of the '$msg' (YES/NO): [YES] ";
$skip = <STDIN>;
chop($skip);
if ( $skip eq "" ) { $skip = "YES"; } # default
@@ -350,8 +430,8 @@ sub testVersion
my $tmpMustBeVersion = shift;
my $tmpTestVersion = shift;
my $toolName = shift;
- my @mustBeVersion = split(/\.|_/,$tmpMustBeVersion);
- my @testVersion = split(/\.|_/,$tmpTestVersion);
+ my @mustBeVersion = split(/\.|_|-/,$tmpMustBeVersion);
+ my @testVersion = split(/\.|_|-/,$tmpTestVersion);
my $length = $#mustBeVersion;
if ($#testVersion < $#mustBeVersion) {
@@ -362,11 +442,46 @@ sub testVersion
{
if ( @testVersion->[$i] < @mustBeVersion->[$i] )
{
- print "The command '$toolName' has the version $tmpTestVersion.\n";
- print "The SDK requires at least the version $tmpMustBeVersion.\n";
+ print " The command '$toolName' has the version $tmpTestVersion.\n";
+ print " The SDK requires at least the version $tmpMustBeVersion.\n";
return 0;
+ } else {
+ if ( @testVersion->[$i] > @mustBeVersion->[$i] )
+ {
+ return 1; # 1 indicates a correct version
+ }
}
}
return 1; # 1 indicates a correct version
}
+
+sub readSDKName
+{
+ my $mkfilename = "./settings/dk.mk";
+ open ( FILEIN, $mkfilename ) || die "ERROR: could not open '$mkfilename' for reading";
+
+ @lines = <FILEIN>;
+ close( FILEIN );
+ foreach $_ (@lines)
+ {
+ if( s#(SDKNAME=([\w]+)\n)#$1#go )
+ {
+ return $2;
+ break;
+ }
+ }
+
+ return "";
+}
+
+sub readStdIn
+{
+ my $tmpstdin = <STDIN>;
+ if ( index($tmpstdin, "\$") != -1)
+ {
+ return `echo $tmpstdin`;
+ }
+
+ return $tmpstdin;
+}