1122c3632SJürgen Schmidt#************************************************************** 2985d02c7SAriel Constenla-Haile# 3122c3632SJürgen Schmidt# Licensed to the Apache Software Foundation (ASF) under one 4122c3632SJürgen Schmidt# or more contributor license agreements. See the NOTICE file 5122c3632SJürgen Schmidt# distributed with this work for additional information 6122c3632SJürgen Schmidt# regarding copyright ownership. The ASF licenses this file 7122c3632SJürgen Schmidt# to you under the Apache License, Version 2.0 (the 8122c3632SJürgen Schmidt# "License"); you may not use this file except in compliance 9122c3632SJürgen Schmidt# with the License. You may obtain a copy of the License at 10985d02c7SAriel Constenla-Haile# 11122c3632SJürgen Schmidt# http://www.apache.org/licenses/LICENSE-2.0 12985d02c7SAriel Constenla-Haile# 13122c3632SJürgen Schmidt# Unless required by applicable law or agreed to in writing, 14122c3632SJürgen Schmidt# software distributed under the License is distributed on an 15122c3632SJürgen Schmidt# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16122c3632SJürgen Schmidt# KIND, either express or implied. See the License for the 17122c3632SJürgen Schmidt# specific language governing permissions and limitations 18122c3632SJürgen Schmidt# under the License. 19985d02c7SAriel Constenla-Haile# 20122c3632SJürgen Schmidt#************************************************************** 21122c3632SJürgen Schmidt 22cdf0e10cSrcweir# 23cdf0e10cSrcweir# configure.pl - a perl script to set a minimal environment for the SDK. 24cdf0e10cSrcweir# 25cdf0e10cSrcweir# Copyright 2000, 2010 Oracle and/or its affiliates. 26cdf0e10cSrcweir# 27cdf0e10cSrcweir 28cdf0e10cSrcweiruse IO::File; 29cdf0e10cSrcweiruse File::Basename; 30cdf0e10cSrcweir 31cdf0e10cSrcweir$main::hostname= $ARGV[0]; 32cdf0e10cSrcweir$main::sdkpath= $ARGV[1]; 33cdf0e10cSrcweir$main::OO_SDK_NAME= $ARGV[2]; 34cdf0e10cSrcweir 35cdf0e10cSrcweir$main::OO_MAJORVERSION=$main::OO_SDK_NAME; 36cdf0e10cSrcweir$main::OO_MINORVERSION=$main::OO_SDK_NAME; 37cdf0e10cSrcweir$main::OO_MAJORVERSION =~ s#[^\d]+(\d).(\d).+#$1#go; 38cdf0e10cSrcweir$main::OO_MINORVERSION =~ s#[^\d]+(\d).(\d).+#$2#go; 39cdf0e10cSrcweir 40cdf0e10cSrcweir$main::OO_SDK_CONFIG_HOME= "$ENV{HOME}/$main::OO_SDK_NAME"; 41cdf0e10cSrcweir 42cdf0e10cSrcweir$main::operatingSystem = `$main::sdkpath/config.guess | cut -d"-" -f3,4`; 43cdf0e10cSrcweirchomp ($main::operatingSystem); 44cdf0e10cSrcweir 45cdf0e10cSrcweir$main::OO_SDK_HOME = $main::sdkpath; 46cdf0e10cSrcweir#$main::OO_SDK_HOME = ""; 47cdf0e10cSrcweir$main::OO_SDK_HOME_SUGGESTION = $main::sdkpath; 48cdf0e10cSrcweir 49cdf0e10cSrcweir$main::OFFICE_OR_URE = "Office"; 50cdf0e10cSrcweir$main::OFFICE_OR_URE_SUGGESTION = "Office"; 51cdf0e10cSrcweir 52cdf0e10cSrcweir$main::OFFICE_HOME = ""; 53cdf0e10cSrcweir 54cdf0e10cSrcweir$main::OFFICE_BASE_HOME = substr($main::sdkpath, 0, rindex($main::sdkpath, "/sdk")); 55cdf0e10cSrcweir 56cdf0e10cSrcweirif ( $main::operatingSystem =~ m/darwin/ ) 57cdf0e10cSrcweir{ 58cdf0e10cSrcweir# $main::OO_SDK_URE_HOME = `cd $main::sdkpath/../ure-link && pwd`; 59cdf0e10cSrcweir} else { 60cdf0e10cSrcweir $main::OO_SDK_URE_HOME = `cd $main::sdkpath/../ure-link && pwd`; 61cdf0e10cSrcweir} 62cdf0e10cSrcweirchomp($main::OO_SDK_URE_HOME); 63cdf0e10cSrcweir 64cdf0e10cSrcweir$main::OO_SDK_MAKE_HOME = ""; 65cdf0e10cSrcweir$main::makeName = "make"; 66cdf0e10cSrcweirif ( $main::operatingSystem =~ m/solaris/ || 67cdf0e10cSrcweir $main::operatingSystem =~ m/freebsd/ ) 68cdf0e10cSrcweir{ 69cdf0e10cSrcweir $main::makeName = "gmake"; 70cdf0e10cSrcweir} 71cdf0e10cSrcweir$main::OO_SDK_MAKE_HOME_SUGGESTION = searchprog($main::makeName); 72cdf0e10cSrcweir$main::makeVersion = "3.79.1"; 73cdf0e10cSrcweir$main::correctVersion = 0; 74cdf0e10cSrcweir 75cdf0e10cSrcweir$main::OO_SDK_ZIP_HOME = ""; 76cdf0e10cSrcweir$main::OO_SDK_ZIP_HOME_SUGGESTION = searchprog("zip"); 77cdf0e10cSrcweir$main::zipVersion = "2.3"; 78cdf0e10cSrcweir 79985d02c7SAriel Constenla-Haile$main::OO_SDK_CAT_HOME = ""; 80985d02c7SAriel Constenla-Haile$main::OO_SDK_CAT_HOME_SUGGESTION = searchprog("cat"); 81985d02c7SAriel Constenla-Haile# TODO cat version 82985d02c7SAriel Constenla-Haile# $main::catVersion = ""; 83985d02c7SAriel Constenla-Haile 84985d02c7SAriel Constenla-Haile$main::OO_SDK_SED_HOME = ""; 85985d02c7SAriel Constenla-Haile$main::OO_SDK_SED_HOME_SUGGESTION = searchprog("sed"); 86985d02c7SAriel Constenla-Haile# TODO sed version 87985d02c7SAriel Constenla-Haile# $main::sedVersion = ""; 88985d02c7SAriel Constenla-Haile 89cdf0e10cSrcweir$main::OO_SDK_CPP_HOME = ""; 90cdf0e10cSrcweir$main::cppName = "gcc"; 91cdf0e10cSrcweir$main::cppVersion = "4.0.1"; 92cdf0e10cSrcweirif ( $main::operatingSystem =~ m/solaris/ ) 93cdf0e10cSrcweir{ 94cdf0e10cSrcweir $main::cppName = "CC"; 95cdf0e10cSrcweir $main::cppVersion = "5.2"; 96cdf0e10cSrcweir} 97cdf0e10cSrcweir$main::OO_SDK_CC_55_OR_HIGHER = ""; 98cdf0e10cSrcweir$main::OO_SDK_CPP_HOME_SUGGESTION = searchprog($main::cppName); 99cdf0e10cSrcweir 100cdf0e10cSrcweir$main::OO_SDK_JAVA_HOME = ""; 101cdf0e10cSrcweir$main::OO_SDK_JAVA_BIN_DIR = "bin"; 102cdf0e10cSrcweirif ( $main::operatingSystem =~ m/darwin/ ) 103cdf0e10cSrcweir{ 104cdf0e10cSrcweir $main::OO_SDK_JAVA_BIN_DIR="Commands"; 105cdf0e10cSrcweir} 106cdf0e10cSrcweir$main::OO_SDK_JAVA_HOME_SUGGESTION = searchprog("javac"); 107cdf0e10cSrcweir$main::javaVersion = "1.5.0_01"; 108cdf0e10cSrcweir 109cdf0e10cSrcweir$main::SDK_AUTO_DEPLOYMENT = ""; 110cdf0e10cSrcweir$main::SDK_AUTO_DEPLOYMENT_SUGGESTION = "YES"; 111cdf0e10cSrcweir 112cdf0e10cSrcweir$main::OO_SDK_OUTPUT_DIR_SUGGESTION = "$ENV{HOME}"; 113cdf0e10cSrcweir$main::OO_SDK_OUTPUT_DIR = ""; 114cdf0e10cSrcweir$main::skipOutputDir = 0; 115cdf0e10cSrcweir 116cdf0e10cSrcweir$main::return = 0; 117cdf0e10cSrcweir 118cdf0e10cSrcweirif ( $main::OFFICE_OR_URE eq "Office" ) 119cdf0e10cSrcweir{ 120cdf0e10cSrcweir if ( $main::operatingSystem =~ m/darwin/ ) 121cdf0e10cSrcweir { 122cdf0e10cSrcweir# used for a SDK as part of the office installation 123cdf0e10cSrcweir# $main::OFFICE_HOME = `cd $main::sdkpath/../../.. && pwd`; 124cdf0e10cSrcweir# chomp($main::OFFICE_HOME); 125cdf0e10cSrcweir# print " Used Office = $main::OFFICE_HOME\n"; 126cdf0e10cSrcweir print " Used SDK = $main::OO_SDK_HOME\n\n"; 127cdf0e10cSrcweir 128cdf0e10cSrcweir $main::OFFICE_HOME_SUGGESTION = searchMacOffice(); 129cdf0e10cSrcweir while ( (! -d "$main::OFFICE_HOME" ) || 130cdf0e10cSrcweir ((-d "$main::OFFICE_HOME") && (! -d "$main::OFFICE_HOME/Contents/MacOS")) ) 131cdf0e10cSrcweir { 132cdf0e10cSrcweir print " Enter the Office installation directory [$main::OFFICE_HOME_SUGGESTION]: "; 133cdf0e10cSrcweir $main::OFFICE_HOME = readStdIn(); 134cdf0e10cSrcweir chop($main::OFFICE_HOME); 135cdf0e10cSrcweir if ( $main::OFFICE_HOME eq "" ) 136cdf0e10cSrcweir { 137cdf0e10cSrcweir $main::OFFICE_HOME = $main::OFFICE_HOME_SUGGESTION; 138cdf0e10cSrcweir } 139cdf0e10cSrcweir 140cdf0e10cSrcweir if ( ! -d "$main::OFFICE_HOME" ) 141cdf0e10cSrcweir { 142cdf0e10cSrcweir $main::OFFICE_HOME = ""; 143cdf0e10cSrcweir print " Error: An office installation is required, please specify the path to a valid installation.\n"; 144cdf0e10cSrcweir } 145cdf0e10cSrcweir 146cdf0e10cSrcweir # check more details 147cdf0e10cSrcweir if ( -d "$main::OFFICE_HOME/Contents/basis-link" ) { 148cdf0e10cSrcweir $main::OFFICE_BASE_HOME = "$main::OFFICE_HOME/Contents/basis-link"; 149cdf0e10cSrcweir if ( -d "$main::OFFICE_BASE_HOME/ure-link" ) { 150cdf0e10cSrcweir $main::OO_SDK_URE_HOME = "$main::OFFICE_BASE_HOME/ure-link"; 151cdf0e10cSrcweir } else { 152cdf0e10cSrcweir $main::OFFICE_HOME = ""; 153cdf0e10cSrcweir $main::OFFICE_BASE_HOME = ""; 154cdf0e10cSrcweir $main::OO_SDK_URE_HOME = ""; 155cdf0e10cSrcweir print " Error: no URE found in office installation, please specify the path to a valid installation.\n"; 156cdf0e10cSrcweir } 157cdf0e10cSrcweir } else { 158cdf0e10cSrcweir $main::OFFICE_HOME = ""; 159cdf0e10cSrcweir $main::OFFICE_BASE_HOME = ""; 160cdf0e10cSrcweir $main::OO_SDK_URE_HOME = ""; 161cdf0e10cSrcweir print " Error: no base layer found in office installation, please specify the path to a valid installation.\n"; 162cdf0e10cSrcweir } 163cdf0e10cSrcweir } 164cdf0e10cSrcweir } else 165cdf0e10cSrcweir { 166cdf0e10cSrcweir $main::OFFICE_HOME_SUGGESTION = searchoffice(); 167cdf0e10cSrcweir 168cdf0e10cSrcweir if ( $main::OFFICE_HOME_SUGGESTION eq "" ) { 169cdf0e10cSrcweir # prepare Office path 170cdf0e10cSrcweir $main::OFFICE_HOME_SUGGESTION = searchprog("soffice"); 171cdf0e10cSrcweir } 172cdf0e10cSrcweir 173cdf0e10cSrcweir if ( ! $main::OFFICE_HOME_SUGGESTION eq "" ) 174cdf0e10cSrcweir { 175cdf0e10cSrcweir my $tmpOffice = readlink "$main::OFFICE_HOME_SUGGESTION/soffice"; 176cdf0e10cSrcweir 177cdf0e10cSrcweir if ( $tmpOffice eq "" ) 178cdf0e10cSrcweir { 179cdf0e10cSrcweir $tmpOffice = "$main::OFFICE_HOME_SUGGESTION/soffice"; 180cdf0e10cSrcweir } 181cdf0e10cSrcweir 182cdf0e10cSrcweir my $offset = rindex($tmpOffice, "/program/soffice"); 183cdf0e10cSrcweir if ( $offset != -1 ) 184cdf0e10cSrcweir { 185cdf0e10cSrcweir $main::OFFICE_HOME_SUGGESTION = substr($tmpOffice, 0, $offset); 186cdf0e10cSrcweir } else 187cdf0e10cSrcweir { 188cdf0e10cSrcweir $offset = rindex($tmpOffice, "/soffice"); 189cdf0e10cSrcweir if ( $offset != -1 ) 190cdf0e10cSrcweir { 191cdf0e10cSrcweir $main::OFFICE_HOME_SUGGESTION = substr($tmpOffice, 0, $offset); 192cdf0e10cSrcweir } else 193cdf0e10cSrcweir { 194cdf0e10cSrcweir $main::OFFICE_HOME_SUGGESTION = ""; 195cdf0e10cSrcweir } 196cdf0e10cSrcweir } 197cdf0e10cSrcweir } 198cdf0e10cSrcweir 199cdf0e10cSrcweir while ( (! -d "$main::OFFICE_HOME" ) || 200cdf0e10cSrcweir ((-d "$main::OFFICE_HOME") && (! -d "$main::OFFICE_HOME/program")) ) 201cdf0e10cSrcweir { 202cdf0e10cSrcweir print " Enter the Office installation directory [$main::OFFICE_HOME_SUGGESTION]: "; 203cdf0e10cSrcweir $main::OFFICE_HOME = readStdIn(); 204cdf0e10cSrcweir chop($main::OFFICE_HOME); 205cdf0e10cSrcweir if ( $main::OFFICE_HOME eq "" ) 206cdf0e10cSrcweir { 207cdf0e10cSrcweir $main::OFFICE_HOME = $main::OFFICE_HOME_SUGGESTION; 208cdf0e10cSrcweir } 209cdf0e10cSrcweir 210cdf0e10cSrcweir if ( ! -d "$main::OFFICE_HOME" ) 211cdf0e10cSrcweir { 212cdf0e10cSrcweir $main::OFFICE_HOME = ""; 213cdf0e10cSrcweir print " Error: An office installation is required, please specify the path to a valid installation.\n"; 214cdf0e10cSrcweir } else 215cdf0e10cSrcweir { 216cdf0e10cSrcweir # special work for a network installation, no prgram directory but a link to the soffice binary 217cdf0e10cSrcweir if ( (! -d "$main::OFFICE_HOME/program") && (-e "$main::OFFICE_HOME/soffice") ) 218cdf0e10cSrcweir { 219cdf0e10cSrcweir my $soserver = `ls -l $OFFICE_HOME_SUGGESTION/soffice | sed -n 's/.* -> //p'`; 220cdf0e10cSrcweir $soserver= substr($soserver, 0, rindex($soserver, "program") - 1); 221cdf0e10cSrcweir 222cdf0e10cSrcweir if ( ! -d $soserver ) 223cdf0e10cSrcweir { 224cdf0e10cSrcweir $main::OFFICE_HOME = ""; 225cdf0e10cSrcweir print " Error: An office installation is required, please specify the path to a valid installation.\n"; 226cdf0e10cSrcweir } else 227cdf0e10cSrcweir { 228cdf0e10cSrcweir $main::OFFICE_HOME = $soserver; 229cdf0e10cSrcweir } 230cdf0e10cSrcweir } 231cdf0e10cSrcweir } 232cdf0e10cSrcweir } 233cdf0e10cSrcweir } 234cdf0e10cSrcweir} 235cdf0e10cSrcweirelse 236cdf0e10cSrcweir{ 237cdf0e10cSrcweir # prepare URE path 238*599cc5b4SOliver-Rainer Wittmann $main::OO_SDK_URE_HOME_SUGGESTION = "/opt/openoffice/ure"; 239cdf0e10cSrcweir $main::OO_SDK_URE_HOME_SUGGESTION = "" unless 240cdf0e10cSrcweir -e "$main::OO_SDK_URE_HOME_SUGGESTION/bin/uno"; 241cdf0e10cSrcweir for (;;) 242cdf0e10cSrcweir { 243cdf0e10cSrcweir print " Enter the URE installation directory", 244cdf0e10cSrcweir " [$main::OO_SDK_URE_HOME_SUGGESTION]: "; 245cdf0e10cSrcweir $main::OO_SDK_URE_HOME = readStdIn(); 246cdf0e10cSrcweir chop $main::OO_SDK_URE_HOME; 247cdf0e10cSrcweir $main::OO_SDK_URE_HOME = $main::OO_SDK_URE_HOME_SUGGESTION if 248cdf0e10cSrcweir $main::OO_SDK_URE_HOME eq "" && 249cdf0e10cSrcweir $main::OO_SDK_URE_HOME_SUGGESTION ne ""; 250cdf0e10cSrcweir last if -e "$main::OO_SDK_URE_HOME/bin/uno"; 251cdf0e10cSrcweir print " Error: A valid URE installation is required.\n"; 252cdf0e10cSrcweir } 253cdf0e10cSrcweir} 254cdf0e10cSrcweir 255cdf0e10cSrcweir# prepare GNU make path 256cdf0e10cSrcweirwhile ( (!$main::correctVersion) && 257cdf0e10cSrcweir ((! -d "$main::OO_SDK_MAKE_HOME" ) || 258cdf0e10cSrcweir ((-d "$main::OO_SDK_MAKE_HOME") && (! -e "$main::OO_SDK_MAKE_HOME/$main::makeName"))) ) 259cdf0e10cSrcweir{ 260cdf0e10cSrcweir print " Enter GNU make ($main::makeVersion or higher) tools directory [$main::OO_SDK_MAKE_HOME_SUGGESTION]: "; 261cdf0e10cSrcweir $main::OO_SDK_MAKE_HOME = readStdIn(); 262cdf0e10cSrcweir chop($main::OO_SDK_MAKE_HOME); 263cdf0e10cSrcweir if ( $main::OO_SDK_MAKE_HOME eq "" ) 264cdf0e10cSrcweir { 265cdf0e10cSrcweir $main::OO_SDK_MAKE_HOME = $main::OO_SDK_MAKE_HOME_SUGGESTION; 266cdf0e10cSrcweir } 267cdf0e10cSrcweir if ( (! -d "$main::OO_SDK_MAKE_HOME") || 268cdf0e10cSrcweir ((-d "$main::OO_SDK_MAKE_HOME") && (! -e "$main::OO_SDK_MAKE_HOME/$main::makeName")) ) 269cdf0e10cSrcweir { 270cdf0e10cSrcweir $main::OO_SDK_MAKE_HOME = ""; 271cdf0e10cSrcweir print " Error: GNU make is required, please specify a GNU make tools directory.\n"; 272cdf0e10cSrcweir } else 273cdf0e10cSrcweir { 274cdf0e10cSrcweir #check version 275cdf0e10cSrcweir my $testVersion = `$OO_SDK_MAKE_HOME/$main::makeName --version`; 276cdf0e10cSrcweir if ( $testVersion eq "") 277cdf0e10cSrcweir { 278cdf0e10cSrcweir print " Set the environment variable OO_SDK_MAKE_HOME to your GNU build tools directory.\n"; 279cdf0e10cSrcweir print " GNU make version $main::makeVersion can be obtained at ftp://ftp.gnu.org/gnu/make/\n"; 280cdf0e10cSrcweir } else 281cdf0e10cSrcweir { 282cdf0e10cSrcweir if ($testVersion =~ m#((\d+\.)+\d+)# ) 283cdf0e10cSrcweir { 284cdf0e10cSrcweir $testVersion = $1; 285cdf0e10cSrcweir } 286cdf0e10cSrcweir $main::correctVersion = testVersion($main::makeVersion, $testVersion, "$main::OO_SDK_MAKE_HOME/$main::makeName", 1); 287cdf0e10cSrcweir if ( !$main::correctVersion ) 288cdf0e10cSrcweir { 289cdf0e10cSrcweir print " The '$main::makeName' command found at '$main::OO_SDK_MAKE_HOME' has a wrong version\n"; 290cdf0e10cSrcweir $main::OO_SDK_MAKE_HOME = ""; 291cdf0e10cSrcweir } 292cdf0e10cSrcweir } 293cdf0e10cSrcweir } 294cdf0e10cSrcweir} 295cdf0e10cSrcweir 296cdf0e10cSrcweir# prepare zip path 297cdf0e10cSrcweir$main::correctVersion = 0; 298cdf0e10cSrcweirwhile ( (!$main::correctVersion) && 299cdf0e10cSrcweir ((! -d "$main::OO_SDK_ZIP_HOME" ) || 300cdf0e10cSrcweir ((-d "$main::OO_SDK_ZIP_HOME") && (! -e "$main::OO_SDK_ZIP_HOME/zip"))) ) 301cdf0e10cSrcweir{ 302cdf0e10cSrcweir print " Enter zip ($main::zipVersion or higher) tool directory [$main::OO_SDK_ZIP_HOME_SUGGESTION]: "; 303cdf0e10cSrcweir $main::OO_SDK_ZIP_HOME = readStdIn(); 304cdf0e10cSrcweir chop($main::OO_SDK_ZIP_HOME); 305cdf0e10cSrcweir if ( $main::OO_SDK_ZIP_HOME eq "" ) 306cdf0e10cSrcweir { 307cdf0e10cSrcweir $main::OO_SDK_ZIP_HOME = $main::OO_SDK_ZIP_HOME_SUGGESTION; 308cdf0e10cSrcweir } 309cdf0e10cSrcweir if ( (! -d "$main::OO_SDK_ZIP_HOME") || 310cdf0e10cSrcweir ((-d "$main::OO_SDK_ZIP_HOME") && (! -e "$main::OO_SDK_ZIP_HOME/zip")) ) 311cdf0e10cSrcweir { 312cdf0e10cSrcweir $main::OO_SDK_ZIP_HOME = ""; 313cdf0e10cSrcweir print " Error: zip tool is required, please specify a zip tool directory.\n"; 314cdf0e10cSrcweir } else 315cdf0e10cSrcweir { 316cdf0e10cSrcweir #check version 317cdf0e10cSrcweir my $testVersion = `$OO_SDK_ZIP_HOME/zip -h 2>&1 | egrep Zip | head -n 1`; 318cdf0e10cSrcweir $testVersion =~ s#Zip ([\d.]+) .*#$1#go; 319cdf0e10cSrcweir if ( $testVersion eq "") 320cdf0e10cSrcweir { 321cdf0e10cSrcweir print " Set the environment variable OO_SDK_ZIP_HOME to your zip tool directory.\n"; 322cdf0e10cSrcweir print " zip version $main::zipVersion can be obtained at ftp://www.info-zip.org/\n"; 323cdf0e10cSrcweir } else 324cdf0e10cSrcweir { 325cdf0e10cSrcweir if ($testVersion =~ m#((\d+\.)+\d+)# ) 326cdf0e10cSrcweir { 327cdf0e10cSrcweir $testVersion = $1; 328cdf0e10cSrcweir } 329cdf0e10cSrcweir $main::correctVersion = testVersion($main::zipVersion, $testVersion, "$main::OO_SDK_MAKE_HOME/zip", 1); 330cdf0e10cSrcweir if ( !$main::correctVersion ) 331cdf0e10cSrcweir { 332cdf0e10cSrcweir print " The 'zip' command found at '$main::OO_SDK_ZIP_HOME' has a wrong version\n"; 333cdf0e10cSrcweir $main::OO_SDK_ZIP_HOME = ""; 334cdf0e10cSrcweir } 335cdf0e10cSrcweir } 336cdf0e10cSrcweir } 337cdf0e10cSrcweir} 338cdf0e10cSrcweir 339985d02c7SAriel Constenla-Haile# prepare cat path 340985d02c7SAriel Constenla-Haile$main::correctVersion = 0; 341985d02c7SAriel Constenla-Hailewhile ( (!$main::correctVersion) && 342985d02c7SAriel Constenla-Haile ((! -d "$main::OO_SDK_CAT_HOME" ) || 343985d02c7SAriel Constenla-Haile ((-d "$main::OO_SDK_CAT_HOME") && (! -e "$main::OO_SDK_CAT_HOME/cat"))) ) 344985d02c7SAriel Constenla-Haile{ 345985d02c7SAriel Constenla-Haile print " Enter cat tool directory [$main::OO_SDK_CAT_HOME_SUGGESTION]: "; 346985d02c7SAriel Constenla-Haile $main::OO_SDK_CAT_HOME = readStdIn(); 347985d02c7SAriel Constenla-Haile chop($main::OO_SDK_CAT_HOME); 348985d02c7SAriel Constenla-Haile if ( $main::OO_SDK_CAT_HOME eq "" ) 349985d02c7SAriel Constenla-Haile { 350985d02c7SAriel Constenla-Haile $main::OO_SDK_CAT_HOME = $main::OO_SDK_CAT_HOME_SUGGESTION; 351985d02c7SAriel Constenla-Haile } 352985d02c7SAriel Constenla-Haile if ( (! -d "$main::OO_SDK_CAT_HOME") || 353985d02c7SAriel Constenla-Haile ((-d "$main::OO_SDK_CAT_HOME") && (! -e "$main::OO_SDK_CAT_HOME/cat")) ) 354985d02c7SAriel Constenla-Haile { 355985d02c7SAriel Constenla-Haile $main::OO_SDK_CAT_HOME = ""; 356985d02c7SAriel Constenla-Haile print " Error: cat tool is required, please specify a cat tool directory.\n"; 357985d02c7SAriel Constenla-Haile } 358985d02c7SAriel Constenla-Haile # else ... 359985d02c7SAriel Constenla-Haile # TODO check version 360985d02c7SAriel Constenla-Haile # NOTE: only Linux cat understands --version 361985d02c7SAriel Constenla-Haile} 362985d02c7SAriel Constenla-Haile 363985d02c7SAriel Constenla-Haile# prepare sed path 364985d02c7SAriel Constenla-Haile$main::correctVersion = 0; 365985d02c7SAriel Constenla-Hailewhile ( (!$main::correctVersion) && 366985d02c7SAriel Constenla-Haile ((! -d "$main::OO_SDK_SED_HOME" ) || 367985d02c7SAriel Constenla-Haile ((-d "$main::OO_SDK_SED_HOME") && (! -e "$main::OO_SDK_SED_HOME/sed"))) ) 368985d02c7SAriel Constenla-Haile{ 369985d02c7SAriel Constenla-Haile print " Enter sed tool directory [$main::OO_SDK_SED_HOME_SUGGESTION]: "; 370985d02c7SAriel Constenla-Haile $main::OO_SDK_SED_HOME = readStdIn(); 371985d02c7SAriel Constenla-Haile chop($main::OO_SDK_SED_HOME); 372985d02c7SAriel Constenla-Haile if ( $main::OO_SDK_SED_HOME eq "" ) 373985d02c7SAriel Constenla-Haile { 374985d02c7SAriel Constenla-Haile $main::OO_SDK_SED_HOME = $main::OO_SDK_SED_HOME_SUGGESTION; 375985d02c7SAriel Constenla-Haile } 376985d02c7SAriel Constenla-Haile if ( (! -d "$main::OO_SDK_SED_HOME") || 377985d02c7SAriel Constenla-Haile ((-d "$main::OO_SDK_SED_HOME") && (! -e "$main::OO_SDK_SED_HOME/sed")) ) 378985d02c7SAriel Constenla-Haile { 379985d02c7SAriel Constenla-Haile $main::OO_SDK_SED_HOME = ""; 380985d02c7SAriel Constenla-Haile print " Error: sed tool is required, please specify a sed tool directory.\n"; 381985d02c7SAriel Constenla-Haile } 382985d02c7SAriel Constenla-Haile # else ... 383985d02c7SAriel Constenla-Haile # TODO check version 384985d02c7SAriel Constenla-Haile # NOTE: only Linux sed understands --version 385985d02c7SAriel Constenla-Haile} 386985d02c7SAriel Constenla-Haile 387cdf0e10cSrcweir# prepare C++ compiler path 388cdf0e10cSrcweir$main::correctVersion = 0; 389cdf0e10cSrcweirwhile ( (!$main::correctVersion) && 390cdf0e10cSrcweir ((! -d "$main::OO_SDK_CPP_HOME" ) || 391cdf0e10cSrcweir ((-d "$main::OO_SDK_CPP_HOME") && (! -e "$main::OO_SDK_CPP_HOME/$main::cpp"))) ) 392cdf0e10cSrcweir{ 393cdf0e10cSrcweir print " C++ compilers where for example a language binding exist:\n"; 394cdf0e10cSrcweir print " - Solaris, Sun WorkShop 6 update 1 C++ 5.2 2000/09/11 or higher\n"; 395cdf0e10cSrcweir print " - Linux, GNU C++ compiler, gcc version 4.0.1 or higher\n"; 396cdf0e10cSrcweir print " - MacOS, GNU C++ compiler, gcc version 4.0.1 or higher\n"; 397cdf0e10cSrcweir print " Enter the directory of the C++ compiler, the directory\n"; 398cdf0e10cSrcweir print " where the compiler is located (optional) [$main::OO_SDK_CPP_HOME_SUGGESTION]: "; 399cdf0e10cSrcweir 400cdf0e10cSrcweir $main::OO_SDK_CPP_HOME = readStdIn(); 401cdf0e10cSrcweir chop($main::OO_SDK_CPP_HOME); 402cdf0e10cSrcweir if ( $main::OO_SDK_CPP_HOME eq "" ) 403cdf0e10cSrcweir { 404cdf0e10cSrcweir $main::OO_SDK_CPP_HOME = $main::OO_SDK_CPP_HOME_SUGGESTION; 405cdf0e10cSrcweir } 406cdf0e10cSrcweir 407cdf0e10cSrcweir if ( ! $main::OO_SDK_CPP_HOME eq "" ) 408cdf0e10cSrcweir { 409cdf0e10cSrcweir if ( (! -d "$main::OO_SDK_CPP_HOME") || 410cdf0e10cSrcweir ((-d "$main::OO_SDK_CPP_HOME") && (! -e "$main::OO_SDK_CPP_HOME/$main::cppName")) ) 411cdf0e10cSrcweir { 412cdf0e10cSrcweir print " Error: Could not find directory '$main::OO_SDK_CPP_HOME'.\n"; 413cdf0e10cSrcweir if ( skipChoice("C++ compiler") == 1 ) 414cdf0e10cSrcweir { 415cdf0e10cSrcweir $main::correctVersion = 1; 416cdf0e10cSrcweir } 417cdf0e10cSrcweir $main::OO_SDK_CPP_HOME = ""; 418cdf0e10cSrcweir } else 419cdf0e10cSrcweir { 420cdf0e10cSrcweir #check version 421cdf0e10cSrcweir if ( $main::cppName eq "gcc" ) 422cdf0e10cSrcweir { 423cdf0e10cSrcweir my $testVersion = `$OO_SDK_CPP_HOME/$main::cppName -dumpversion`; 424cdf0e10cSrcweir if ( $testVersion eq "") 425cdf0e10cSrcweir { 426cdf0e10cSrcweir print " The '$main::cppName' command found at $main::OO_SDK_CPP_HOME/$main::cppName is not a "; 427cdf0e10cSrcweir print " GNU compiler.\nSet the environment variable OO_SDK_CPP_HOME to your GNU build tools "; 428cdf0e10cSrcweir print " directory.\nA GNU compiler version $main::cppVersion can be obtained at "; 429cdf0e10cSrcweir print " ftp://ftp.gnu.org/gnu/gcc/\n"; 430cdf0e10cSrcweir } else 431cdf0e10cSrcweir { 432cdf0e10cSrcweir $main::correctVersion = testVersion($main::cppVersion, $testVersion, "$main::OO_SDK_CPP_HOME/$main::cppName", 1); 433cdf0e10cSrcweir if ( !$main::correctVersion ) 434cdf0e10cSrcweir { 435cdf0e10cSrcweir print " The '$main::cppName' command found at '$main::OO_SDK_CPP_HOME' has a wrong version\n"; 436cdf0e10cSrcweir if ( skipChoice("C++ compiler") == 1 ) 437cdf0e10cSrcweir { 438cdf0e10cSrcweir $main::correctVersion = 1; 439cdf0e10cSrcweir } 440cdf0e10cSrcweir 441cdf0e10cSrcweir $main::OO_SDK_CPP_HOME = ""; 442cdf0e10cSrcweir } 443cdf0e10cSrcweir } 444cdf0e10cSrcweir } else 445cdf0e10cSrcweir { 446cdf0e10cSrcweir # for Solaris we have to check the version too 447cdf0e10cSrcweir open(FILE, "$OO_SDK_CPP_HOME/$main::cppName -V 2>&1 |"); 448cdf0e10cSrcweir my @lines = <FILE>; 449cdf0e10cSrcweir my $testVersion = $lines[0]; 450cdf0e10cSrcweir if ( $testVersion eq "") 451cdf0e10cSrcweir { 452cdf0e10cSrcweir print " The '$main::cppName' command found at $main::OO_SDK_CPP_HOME/$main::cppName is not a "; 453cdf0e10cSrcweir print " Solaris C++ compiler.\nSet the environment variable OO_SDK_CPP_HOME to your Solaris C++ compiler directory.\n"; 454cdf0e10cSrcweir } else 455cdf0e10cSrcweir { 456cdf0e10cSrcweir if ($testVersion =~ m#((\d+\.)+\d+)# ) 457cdf0e10cSrcweir { 458cdf0e10cSrcweir $testVersion = $1; 459cdf0e10cSrcweir } 460cdf0e10cSrcweir $main::correctVersion = testVersion($main::cppVersion, $testVersion, "$main::OO_SDK_CPP_HOME/$main::cppName", 1); 461cdf0e10cSrcweir if ( !$main::correctVersion ) 462cdf0e10cSrcweir { 463cdf0e10cSrcweir print " The '$main::cppName' command found at '$main::OO_SDK_CPP_HOME' has a wrong version\n"; 464cdf0e10cSrcweir if ( skipChoice("C++ compiler") == 1 ) 465cdf0e10cSrcweir { 466cdf0e10cSrcweir $main::correctVersion = 1; 467cdf0e10cSrcweir } 468cdf0e10cSrcweir 469cdf0e10cSrcweir $main::OO_SDK_CPP_HOME = ""; 470cdf0e10cSrcweir } else { 471cdf0e10cSrcweir $main::correctVersion = testVersion("5.5", $testVersion, "$main::OO_SDK_CPP_HOME/$main::cppName", 2); 472cdf0e10cSrcweir if ( $main::correctVersion ) { 473cdf0e10cSrcweir $main::OO_SDK_CC_55_OR_HIGHER = $testVersion; 474cdf0e10cSrcweir } 475cdf0e10cSrcweir } 476cdf0e10cSrcweir } 477cdf0e10cSrcweir } 478cdf0e10cSrcweir } 479cdf0e10cSrcweir } else 480cdf0e10cSrcweir { 481cdf0e10cSrcweir # the C++ compiler is optional 482cdf0e10cSrcweir $main::correctVersion = 1; 483cdf0e10cSrcweir } 484cdf0e10cSrcweir} 485cdf0e10cSrcweir 486cdf0e10cSrcweir 487cdf0e10cSrcweir# prepare Java path 488cdf0e10cSrcweir$main::correctVersion = 0; 489cdf0e10cSrcweir 490cdf0e10cSrcweir# prepare Java suggestion (cut bin or Commands directory to be in the root of the Java SDK) 491cdf0e10cSrcweir$main::offset = rindex($main::OO_SDK_JAVA_HOME_SUGGESTION, "/$main::OO_SDK_JAVA_BIN_DIR"); 492cdf0e10cSrcweirif ( $main::offset != -1 ) 493cdf0e10cSrcweir{ 494cdf0e10cSrcweir $main::OO_SDK_JAVA_HOME_SUGGESTION = substr($main::OO_SDK_JAVA_HOME_SUGGESTION, 0, $main::offset); 495cdf0e10cSrcweir} 496cdf0e10cSrcweir 497cdf0e10cSrcweirwhile ( (!$main::correctVersion) && 498cdf0e10cSrcweir ((! -d "$main::OO_SDK_JAVA_HOME" ) || 499cdf0e10cSrcweir ((-d "$main::OO_SDK_JAVA_HOME") && (! -e "$main::OO_SDK_JAVA_HOME/$main::OO_SDK_JAVA_BIN_DIR/javac"))) ) 500cdf0e10cSrcweir{ 501cdf0e10cSrcweir print " Enter Java SDK (1.5, recommendation is 1.6 or higher) installation directory (optional) [$main::OO_SDK_JAVA_HOME_SUGGESTION]: "; 502cdf0e10cSrcweir $main::OO_SDK_JAVA_HOME = readStdIn(); 503cdf0e10cSrcweir chop($main::OO_SDK_JAVA_HOME); 504cdf0e10cSrcweir if ( $main::OO_SDK_JAVA_HOME eq "" ) 505cdf0e10cSrcweir { 506cdf0e10cSrcweir $main::OO_SDK_JAVA_HOME = $main::OO_SDK_JAVA_HOME_SUGGESTION; 507cdf0e10cSrcweir } 508cdf0e10cSrcweir if ( ! $main::OO_SDK_JAVA_HOME eq "" ) 509cdf0e10cSrcweir { 510cdf0e10cSrcweir if ( (! -d "$main::OO_SDK_JAVA_HOME") || 511cdf0e10cSrcweir ((-d "$main::OO_SDK_JAVA_HOME") && (! -e "$main::OO_SDK_JAVA_HOME/$main::OO_SDK_JAVA_BIN_DIR/javac")) ) 512cdf0e10cSrcweir { 513cdf0e10cSrcweir 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"; 514cdf0e10cSrcweir if ( skipChoice("JAVA SDK") == 1 ) 515cdf0e10cSrcweir { 516cdf0e10cSrcweir $main::correctVersion = 1; 517cdf0e10cSrcweir } 518cdf0e10cSrcweir $main::OO_SDK_JAVA_HOME = ""; 519cdf0e10cSrcweir } else 520cdf0e10cSrcweir { 521cdf0e10cSrcweir #check version 522cdf0e10cSrcweir 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#".*##'`; 523cdf0e10cSrcweir $testVersion =~ s#([^\n]+)\n#$1#go; 524cdf0e10cSrcweir 525cdf0e10cSrcweir $main::correctVersion = testVersion($main::javaVersion, $testVersion, "$main::OO_SDK_JAVA_HOME/$main::OO_SDK_JAVA_BIN_DIR/java", 1); 526cdf0e10cSrcweir if ( !$main::correctVersion ) 527cdf0e10cSrcweir { 528cdf0e10cSrcweir if ( skipChoice("JAVA SDK") == 1 ) 529cdf0e10cSrcweir { 530cdf0e10cSrcweir $main::correctVersion = 1; 531cdf0e10cSrcweir } 532cdf0e10cSrcweir $main::OO_SDK_JAVA_HOME = ""; 533cdf0e10cSrcweir } 534cdf0e10cSrcweir } 535cdf0e10cSrcweir }else 536cdf0e10cSrcweir { 537cdf0e10cSrcweir # the Java SDK is optional 538cdf0e10cSrcweir $main::correctVersion = 1; 539cdf0e10cSrcweir } 540cdf0e10cSrcweir} 541cdf0e10cSrcweir 542cdf0e10cSrcweir 543cdf0e10cSrcweir# prepare output directory (optional) 544cdf0e10cSrcweirwhile ( (!$main::skipOutputDir) && 545cdf0e10cSrcweir (! -d "$main::OO_SDK_OUTPUT_DIR") ) 546cdf0e10cSrcweir{ 547cdf0e10cSrcweir print " Default output directory is in your HOME directory.\n"; 548cdf0e10cSrcweir print " Enter an existent directory if you prefer a different output directory (optional) [$main::OO_SDK_OUTPUT_DIR_SUGGESTION]: "; 549cdf0e10cSrcweir 550cdf0e10cSrcweir $main::OO_SDK_OUTPUT_DIR = readStdIn(); 551cdf0e10cSrcweir 552cdf0e10cSrcweir chop($main::OO_SDK_OUTPUT_DIR); 553cdf0e10cSrcweir if ( $main::OO_SDK_OUTPUT_DIR eq "" ) 554cdf0e10cSrcweir { 555cdf0e10cSrcweir $main::OO_SDK_OUTPUT_DIR = $main::OO_SDK_OUTPUT_DIR_SUGGESTION; 556cdf0e10cSrcweir } 557cdf0e10cSrcweir if ( ! $main::OO_SDK_OUTPUT_DIR eq "" ) 558cdf0e10cSrcweir { 559cdf0e10cSrcweir if ( ! -d "$main::OO_SDK_OUTPUT_DIR" ) 560cdf0e10cSrcweir { 561cdf0e10cSrcweir print " Error: Could not find directory '$main::OO_SDK_OUTPUT_DIR'.\n"; 562cdf0e10cSrcweir if ( skipChoice("optional output directory") == 1 ) 563cdf0e10cSrcweir { 564cdf0e10cSrcweir $main::skipOutputDir = 1; 565cdf0e10cSrcweir } 566cdf0e10cSrcweir $main::OO_SDK_OUTPUT_DIR = ""; 567cdf0e10cSrcweir } 568cdf0e10cSrcweir } else 569cdf0e10cSrcweir { 570cdf0e10cSrcweir # the output directory is optional 571cdf0e10cSrcweir $main::skipOutputDir = 1; 572cdf0e10cSrcweir } 573cdf0e10cSrcweir} 574cdf0e10cSrcweir 575cdf0e10cSrcweir# prepare auto deployment 576cdf0e10cSrcweirif ( $main::OFFICE_OR_URE eq "Office" ) 577cdf0e10cSrcweir{ 578cdf0e10cSrcweir while ( $main::SDK_AUTO_DEPLOYMENT eq "" || 579cdf0e10cSrcweir ((! $main::SDK_AUTO_DEPLOYMENT eq "YES") && 580cdf0e10cSrcweir (! $main::SDK_AUTO_DEPLOYMENT eq "NO")) ) 581cdf0e10cSrcweir { 582cdf0e10cSrcweir print " Automatic deployment of UNO components (YES/NO) [$main::SDK_AUTO_DEPLOYMENT_SUGGESTION]: "; 583cdf0e10cSrcweir $main::SDK_AUTO_DEPLOYMENT = uc <STDIN>; 584cdf0e10cSrcweir chop($main::SDK_AUTO_DEPLOYMENT); 585cdf0e10cSrcweir if ( $main::SDK_AUTO_DEPLOYMENT eq "" ) 586cdf0e10cSrcweir { 587cdf0e10cSrcweir $main::SDK_AUTO_DEPLOYMENT = "YES"; 588cdf0e10cSrcweir } 589cdf0e10cSrcweir } 590cdf0e10cSrcweir} 591cdf0e10cSrcweirelse 592cdf0e10cSrcweir{ 593cdf0e10cSrcweir $main::SDK_AUTO_DEPLOYMENT = "NO"; 594cdf0e10cSrcweir} 595cdf0e10cSrcweir 596985d02c7SAriel Constenla-HaileprepareScriptFile("setsdkenv_unix.sh.in", "setsdkenv_unix.sh"); 597cdf0e10cSrcweirchmod 0644, "$main::OO_SDK_CONFIG_HOME/$main::hostname/setsdkenv_unix.sh"; 598cdf0e10cSrcweir 599cdf0e10cSrcweirprint "\n"; 600cdf0e10cSrcweirprint " ************************************************************************\n"; 601cdf0e10cSrcweirprint " * ... your SDK environment has been prepared.\n"; 602cdf0e10cSrcweirprint " * For each time you want to use this configured SDK environment, you\n"; 603cdf0e10cSrcweirprint " * have to run the \"setsdkenv_unix\" script file!\n"; 604cdf0e10cSrcweirprint " * Alternatively can you source one of the scripts\n"; 605cdf0e10cSrcweirprint " * \"$main::OO_SDK_CONFIG_HOME/$main::hostname/setsdkenv_unix.sh\"\n"; 606cdf0e10cSrcweirprint " * to get an environment without starting a new shell.\n"; 607cdf0e10cSrcweirprint " ************************************************************************\n\n"; 608cdf0e10cSrcweir 609cdf0e10cSrcweirexit $return; 610cdf0e10cSrcweir 611cdf0e10cSrcweirsub skipChoice 612cdf0e10cSrcweir{ 613cdf0e10cSrcweir my $msg = shift; 614cdf0e10cSrcweir my $skip = ""; 615cdf0e10cSrcweir while ( !( $skip eq "yes" || $skip eq "no") ) 616cdf0e10cSrcweir { 617cdf0e10cSrcweir print " Do you want to skip the choice of the '$msg' (YES/NO): [YES] "; 618cdf0e10cSrcweir $skip = lc <STDIN>; 619cdf0e10cSrcweir chop($skip); 620cdf0e10cSrcweir if ( $skip eq "" ) { $skip = "yes"; } # default 621cdf0e10cSrcweir if ( $skip eq "yes" ) 622cdf0e10cSrcweir { 623cdf0e10cSrcweir return 1; 624cdf0e10cSrcweir } 625cdf0e10cSrcweir } 626cdf0e10cSrcweir return 0; 627cdf0e10cSrcweir} 628cdf0e10cSrcweir 629cdf0e10cSrcweirsub resolveLink 630cdf0e10cSrcweir{ 631cdf0e10cSrcweir my $base= shift; 632cdf0e10cSrcweir my $link= shift; 633cdf0e10cSrcweir 634cdf0e10cSrcweir my $resolvedpath = "$base/$link"; 635cdf0e10cSrcweir my $linktarget = readlink "$resolvedpath"; 636cdf0e10cSrcweir my $resolvedlink = ""; 637cdf0e10cSrcweir 638cdf0e10cSrcweir while ( $linktarget ne "") { 639cdf0e10cSrcweir 640cdf0e10cSrcweir if ( $linktarget =~ m/^\/.*/ ) 641cdf0e10cSrcweir { 642cdf0e10cSrcweir $resolvedpath = "$linktarget"; 643cdf0e10cSrcweir } else { 644cdf0e10cSrcweir $resolvedpath = `cd $base/$linktarget; pwd`; 645cdf0e10cSrcweir chop $resolvedpath; 646cdf0e10cSrcweir } 647cdf0e10cSrcweir $base = dirname("$resolvedpath"); 648cdf0e10cSrcweir 649cdf0e10cSrcweir $linktarget = readlink "$resolvedpath"; 650cdf0e10cSrcweir } 651cdf0e10cSrcweir 652cdf0e10cSrcweir $resolvedlink = `cd $resolvedpath; pwd`; 653cdf0e10cSrcweir chop $resolvedlink; 654cdf0e10cSrcweir return $resolvedlink; 655cdf0e10cSrcweir} 656cdf0e10cSrcweir 657cdf0e10cSrcweirsub searchprog 658cdf0e10cSrcweir{ 659cdf0e10cSrcweir my $_search= shift; 660cdf0e10cSrcweir my $tmpPath = `echo "\$PATH"`; 661cdf0e10cSrcweir my @pathList = split(":" , $tmpPath); 662cdf0e10cSrcweir my $progDir = ""; 663cdf0e10cSrcweir 664cdf0e10cSrcweir if ( $_search eq "javac" ) 665cdf0e10cSrcweir { 666cdf0e10cSrcweir if ( $main::operatingSystem =~ m/darwin/ ) { 667cdf0e10cSrcweir $progDir = resolveLink("/System/Library/Frameworks/JavaVM.Framework/Versions", "CurrentJDK"); 668cdf0e10cSrcweir 669cdf0e10cSrcweir if ( -e "$progDir/$main::OO_SDK_JAVA_BIN_DIR/javac" ) 670cdf0e10cSrcweir { 671cdf0e10cSrcweir return "$progDir/$main::OO_SDK_JAVA_BIN_DIR"; 672cdf0e10cSrcweir } 673cdf0e10cSrcweir } 674cdf0e10cSrcweir 675cdf0e10cSrcweir if ( $main::operatingSystem =~ m/solaris/ ) { 676cdf0e10cSrcweir $progDir = resolveLink("/usr/jdk", "latest"); 677cdf0e10cSrcweir if ( -e "$progDir/$main::OO_SDK_JAVA_BIN_DIR/javac" ) 678cdf0e10cSrcweir { 679cdf0e10cSrcweir return "$progDir/$main::OO_SDK_JAVA_BIN_DIR"; 680cdf0e10cSrcweir } 681cdf0e10cSrcweir } 682cdf0e10cSrcweir } 683cdf0e10cSrcweir 684cdf0e10cSrcweir if ( $_search eq "gmake" && $main::operatingSystem =~ m/solaris/ ) { 685cdf0e10cSrcweir if ( -e "/usr/sfw/bin/gmake" ) 686cdf0e10cSrcweir { 687cdf0e10cSrcweir return "/usr/sfw/bin"; 688cdf0e10cSrcweir } 689cdf0e10cSrcweir } 690cdf0e10cSrcweir 691cdf0e10cSrcweir foreach $i (@pathList) 692cdf0e10cSrcweir { 693cdf0e10cSrcweir chomp ($i); 694cdf0e10cSrcweir 695cdf0e10cSrcweir if ( -e "$i/$_search" ) 696cdf0e10cSrcweir { 697cdf0e10cSrcweir 698cdf0e10cSrcweir if ( index($i, "/") == 0 ) 699cdf0e10cSrcweir { 700cdf0e10cSrcweir # # absolute path; leave unchanged 701cdf0e10cSrcweir $progDir = $i; 702cdf0e10cSrcweir } else 703cdf0e10cSrcweir { 704cdf0e10cSrcweir $progDir = `cd "$i"; pwd`; 705cdf0e10cSrcweir } 706cdf0e10cSrcweir return $progDir 707cdf0e10cSrcweir } 708cdf0e10cSrcweir } 709cdf0e10cSrcweir return $progDir 710cdf0e10cSrcweir} 711cdf0e10cSrcweir 712cdf0e10cSrcweirsub searchMacOffice 713cdf0e10cSrcweir{ 714*599cc5b4SOliver-Rainer Wittmann if (-d "/Applications/OpenOffice.app" ) { 715*599cc5b4SOliver-Rainer Wittmann return "/Applications/OpenOffice.app" 716ff3f4ebcSOliver-Rainer Wittmann } 717cdf0e10cSrcweir if (-d "/Applications/OpenOffice.org.app" ) { 718cdf0e10cSrcweir return "/Applications/OpenOffice.org.app" 719cdf0e10cSrcweir } 720cdf0e10cSrcweir if (-d "/Applications/Oracle Open Office.app" ) { 721cdf0e10cSrcweir return "/Applications/Oracle Open Office.app"; 722cdf0e10cSrcweir } 723cdf0e10cSrcweir if (-d "/Applications/StarOffice.app" ) { 724cdf0e10cSrcweir return "/Applications/StarOffice.app"; 725cdf0e10cSrcweir } 726cdf0e10cSrcweir if (-d "/Applications/StarSuite.app" ) { 727cdf0e10cSrcweir return "/Applications/StarSuite.app"; 728cdf0e10cSrcweir } 729cdf0e10cSrcweir 730cdf0e10cSrcweir return ""; 731cdf0e10cSrcweir} 732cdf0e10cSrcweir 733cdf0e10cSrcweirsub searchoffice 734cdf0e10cSrcweir{ 735*599cc5b4SOliver-Rainer Wittmann my $offset = rindex($main::sdkpath, "/openoffice"); 736cdf0e10cSrcweir my $tmpOffice = substr($main::sdkpath, 0, $offset); 737*599cc5b4SOliver-Rainer Wittmann my $officepath = "$tmpOffice/openoffice$main::OO_MAJORVERSION"; 738cdf0e10cSrcweir 739cdf0e10cSrcweir# if ( $main::OO_MINORVERSION > 0) { 740cdf0e10cSrcweir# $officepath = "$officepath$main::OO_MINORVERSION"; 741cdf0e10cSrcweir# } 742cdf0e10cSrcweir 743cdf0e10cSrcweir # search corresponding office for this SDK 744cdf0e10cSrcweir if (-d $officepath && -e "$officepath/program/soffice") { 745cdf0e10cSrcweir return $officepath; 746cdf0e10cSrcweir } 747cdf0e10cSrcweir # fallback 748cdf0e10cSrcweir my $tmpversion = $main::OO_MAJORVERSION; 749cdf0e10cSrcweir# if ( $main::OO_MINORVERSION > 0) { 750cdf0e10cSrcweir# $tmpversion = "$tmpversion.$main::OO_MINORVERSION"; 751cdf0e10cSrcweir# } 752cdf0e10cSrcweir 753cdf0e10cSrcweir $officepath = "$tmpOffice/oracle_open_office$tmpversion"; 754cdf0e10cSrcweir if (-d $officepath && -e "$officepath/program/soffice") { 755cdf0e10cSrcweir return $officepath; 756cdf0e10cSrcweir } 757cdf0e10cSrcweir 758cdf0e10cSrcweir my $tmpversion = $main::OO_MAJORVERSION + 6; 759cdf0e10cSrcweir if ( $main::OO_MINORVERSION > 0) { 760cdf0e10cSrcweir $tmpversion = "$tmpversion.$main::OO_MINORVERSION"; 761cdf0e10cSrcweir } 762cdf0e10cSrcweir 763cdf0e10cSrcweir $officepath = "$tmpOffice/staroffice$tmpversion"; 764cdf0e10cSrcweir if (-d $officepath && -e "$officepath/program/soffice") { 765cdf0e10cSrcweir return $officepath; 766cdf0e10cSrcweir } 767cdf0e10cSrcweir $officepath = "$tmpOffice/StarOffice$tmpversion"; 768cdf0e10cSrcweir if (-d $officepath && -e "$officepath/program/soffice") { 769cdf0e10cSrcweir return $officepath; 770cdf0e10cSrcweir } 771cdf0e10cSrcweir $officepath = "$tmpOffice/starsuite$tmpversion"; 772cdf0e10cSrcweir if (-d $officepath && -e "$officepath/program/soffice") { 773cdf0e10cSrcweir return $officepath; 774cdf0e10cSrcweir } 775cdf0e10cSrcweir $officepath = "$tmpOffice/StarSuite$tmpversion"; 776cdf0e10cSrcweir if (-d $officepath && -e "$officepath/program/soffice") { 777cdf0e10cSrcweir return $officepath; 778cdf0e10cSrcweir } 779cdf0e10cSrcweir $officepath = ""; 780cdf0e10cSrcweir 781cdf0e10cSrcweir # search other potential matching office versions 782cdf0e10cSrcweir my $path = "/opt/"; 783cdf0e10cSrcweir my $entry = ""; 784cdf0e10cSrcweir my $version = "0"; 785cdf0e10cSrcweir for $entry (glob($path.'*')) { 786cdf0e10cSrcweir ## if the file is a directory 787cdf0e10cSrcweir if( -d $entry) { 788cdf0e10cSrcweir 789cdf0e10cSrcweir if ($entry =~ m#(.+(o|O)ffice(\.org){0,1}(\d([\d\.]){0,2}))# || 790cdf0e10cSrcweir $entry =~ m#(.+(s|S)uite(.*)(\d([\d\.]){0,2}))# ) 791cdf0e10cSrcweir { 792cdf0e10cSrcweir if ($4 > $version) { 793cdf0e10cSrcweir $version = $4; 794cdf0e10cSrcweir $officepath = $entry; 795cdf0e10cSrcweir } 796cdf0e10cSrcweir } 797cdf0e10cSrcweir } 798cdf0e10cSrcweir } 799cdf0e10cSrcweir return $officepath; 800cdf0e10cSrcweir} 801cdf0e10cSrcweir 802cdf0e10cSrcweir 803cdf0e10cSrcweir 804cdf0e10cSrcweirsub testVersion 805cdf0e10cSrcweir{ 806cdf0e10cSrcweir my $tmpMustBeVersion = shift; 807cdf0e10cSrcweir my $tmpTestVersion = shift; 808cdf0e10cSrcweir my $toolName = shift; 809cdf0e10cSrcweir # 1=check + message 2=check only 810cdf0e10cSrcweir my $checkOnly = shift; 811cdf0e10cSrcweir my @mustBeVersion = split(/\.|_|-/,$tmpMustBeVersion); 812cdf0e10cSrcweir my @testVersion = split(/\.|_|-/,$tmpTestVersion); 813cdf0e10cSrcweir my $length = $#mustBeVersion; 814cdf0e10cSrcweir 815cdf0e10cSrcweir if ($#testVersion < $#mustBeVersion) { 816cdf0e10cSrcweir $length = $#testVersion; 817cdf0e10cSrcweir } 818cdf0e10cSrcweir 819cdf0e10cSrcweir for ($i=0; $i <= $length; $i++ ) 820cdf0e10cSrcweir { 821985d02c7SAriel Constenla-Haile if ( @testVersion[$i] > @mustBeVersion[$i] ) 822cdf0e10cSrcweir { 823cdf0e10cSrcweir return 1; # 1 indicates a correct version 824cdf0e10cSrcweir } 825cdf0e10cSrcweir 826985d02c7SAriel Constenla-Haile if ( @testVersion[$i] < @mustBeVersion[$i] ) 827cdf0e10cSrcweir { 828cdf0e10cSrcweir if ( $#checkOnly == 1 ) { 829cdf0e10cSrcweir print " The command '$toolName' has the version $tmpTestVersion.\n"; 830cdf0e10cSrcweir print " The SDK requires at least the version $tmpMustBeVersion.\n"; 831cdf0e10cSrcweir } 832cdf0e10cSrcweir return 0; 833cdf0e10cSrcweir } 834cdf0e10cSrcweir } 835cdf0e10cSrcweir 836cdf0e10cSrcweir return 1; # 1 indicates a correct version 837cdf0e10cSrcweir} 838cdf0e10cSrcweir 839cdf0e10cSrcweirsub readStdIn 840cdf0e10cSrcweir{ 841cdf0e10cSrcweir my $tmpstdin = <STDIN>; 842cdf0e10cSrcweir if ( index($tmpstdin, "\$") != -1) 843cdf0e10cSrcweir { 844cdf0e10cSrcweir return `echo $tmpstdin`; 845cdf0e10cSrcweir } 846cdf0e10cSrcweir 847cdf0e10cSrcweir return $tmpstdin; 848cdf0e10cSrcweir} 849cdf0e10cSrcweir 850cdf0e10cSrcweirsub prepareScriptFile() 851cdf0e10cSrcweir{ 852cdf0e10cSrcweir my $inputFile = shift; 853cdf0e10cSrcweir my $outputFile = shift; 854cdf0e10cSrcweir 855cdf0e10cSrcweir if ( ! -d "$main::OO_SDK_CONFIG_HOME/$main::hostname" ) 856cdf0e10cSrcweir { 857cdf0e10cSrcweir system("mkdir -p $main::OO_SDK_CONFIG_HOME/$main::hostname"); 858cdf0e10cSrcweir } 859cdf0e10cSrcweir 860cdf0e10cSrcweir open ( FILEIN, "$main::sdkpath/$inputFile" ) || die "\nERROR: could not open '$main::sdkpath/$inputFile' for reading"; 861cdf0e10cSrcweir 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"; 862cdf0e10cSrcweir 863cdf0e10cSrcweir while ( <FILEIN> ) 864cdf0e10cSrcweir { 865cdf0e10cSrcweir $_ =~ s#\@OO_SDK_NAME\@#$main::OO_SDK_NAME#go; 866cdf0e10cSrcweir $_ =~ s#\@OO_SDK_HOME\@#$main::OO_SDK_HOME#go; 867cdf0e10cSrcweir $_ =~ s#\@OFFICE_HOME\@#$main::OFFICE_HOME#go; 868cdf0e10cSrcweir $_ =~ s#\@OFFICE_BASE_HOME\@#$main::OFFICE_BASE_HOME#go; 869cdf0e10cSrcweir $_ =~ s#\@OO_SDK_URE_HOME\@#$main::OO_SDK_URE_HOME#go; 870cdf0e10cSrcweir $_ =~ s#\@OO_SDK_MAKE_HOME\@#$main::OO_SDK_MAKE_HOME#go; 871cdf0e10cSrcweir $_ =~ s#\@OO_SDK_ZIP_HOME\@#$main::OO_SDK_ZIP_HOME#go; 872985d02c7SAriel Constenla-Haile $_ =~ s#\@OO_SDK_CAT_HOME\@#$main::OO_SDK_CAT_HOME#go; 873985d02c7SAriel Constenla-Haile $_ =~ s#\@OO_SDK_SED_HOME\@#$main::OO_SDK_SED_HOME#go; 874cdf0e10cSrcweir $_ =~ s#\@OO_SDK_CPP_HOME\@#$main::OO_SDK_CPP_HOME#go; 875cdf0e10cSrcweir $_ =~ s#\@OO_SDK_CC_55_OR_HIGHER\@#$main::OO_SDK_CC_55_OR_HIGHER#go; 876cdf0e10cSrcweir $_ =~ s#\@OO_SDK_JAVA_HOME\@#$main::OO_SDK_JAVA_HOME#go; 877cdf0e10cSrcweir $_ =~ s#\@SDK_AUTO_DEPLOYMENT\@#$main::SDK_AUTO_DEPLOYMENT#go; 878cdf0e10cSrcweir $_ =~ s#\@OO_SDK_OUTPUT_DIR\@#$main::OO_SDK_OUTPUT_DIR#go; 879cdf0e10cSrcweir 880cdf0e10cSrcweir print FILEOUT $_; 881cdf0e10cSrcweir } 882cdf0e10cSrcweir 883cdf0e10cSrcweir close FILEIN; 884cdf0e10cSrcweir close FILEOUT; 885cdf0e10cSrcweir} 886