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_SUGGESTION = $main::sdkpath; 47cdf0e10cSrcweir 48cdf0e10cSrcweir$main::OFFICE_HOME = ""; 49cdf0e10cSrcweir 50b3ba5bc7SJürgen Schmidt#$main::OFFICE_BASE_HOME = substr($main::sdkpath, 0, rindex($main::sdkpath, "/sdk")); 51cdf0e10cSrcweir 52cdf0e10cSrcweir$main::OO_SDK_MAKE_HOME = ""; 53cdf0e10cSrcweir$main::makeName = "make"; 54cdf0e10cSrcweirif ( $main::operatingSystem =~ m/solaris/ || 55cdf0e10cSrcweir $main::operatingSystem =~ m/freebsd/ ) 56cdf0e10cSrcweir{ 57cdf0e10cSrcweir $main::makeName = "gmake"; 58cdf0e10cSrcweir} 59cdf0e10cSrcweir$main::OO_SDK_MAKE_HOME_SUGGESTION = searchprog($main::makeName); 60cdf0e10cSrcweir$main::makeVersion = "3.79.1"; 61cdf0e10cSrcweir$main::correctVersion = 0; 62cdf0e10cSrcweir 63cdf0e10cSrcweir$main::OO_SDK_ZIP_HOME = ""; 64cdf0e10cSrcweir$main::OO_SDK_ZIP_HOME_SUGGESTION = searchprog("zip"); 65cdf0e10cSrcweir$main::zipVersion = "2.3"; 66cdf0e10cSrcweir 67985d02c7SAriel Constenla-Haile$main::OO_SDK_CAT_HOME = ""; 68985d02c7SAriel Constenla-Haile$main::OO_SDK_CAT_HOME_SUGGESTION = searchprog("cat"); 69985d02c7SAriel Constenla-Haile# TODO cat version 70985d02c7SAriel Constenla-Haile# $main::catVersion = ""; 71985d02c7SAriel Constenla-Haile 72985d02c7SAriel Constenla-Haile$main::OO_SDK_SED_HOME = ""; 73985d02c7SAriel Constenla-Haile$main::OO_SDK_SED_HOME_SUGGESTION = searchprog("sed"); 74985d02c7SAriel Constenla-Haile# TODO sed version 75985d02c7SAriel Constenla-Haile# $main::sedVersion = ""; 76985d02c7SAriel Constenla-Haile 77cdf0e10cSrcweir$main::OO_SDK_CPP_HOME = ""; 78cdf0e10cSrcweir$main::cppName = "gcc"; 79cdf0e10cSrcweir$main::cppVersion = "4.0.1"; 80cdf0e10cSrcweirif ( $main::operatingSystem =~ m/solaris/ ) 81cdf0e10cSrcweir{ 82cdf0e10cSrcweir $main::cppName = "CC"; 83cdf0e10cSrcweir $main::cppVersion = "5.2"; 84cdf0e10cSrcweir} 85*789d489dSHerbert Dürrif ( $main::operatingSystem =~ m/darwin/ ) 86*789d489dSHerbert Dürr{ 87*789d489dSHerbert Dürr $main::cppName = "clang"; 88*789d489dSHerbert Dürr $main::cppVersion = "4.2"; 89*789d489dSHerbert Dürr} 90cdf0e10cSrcweir$main::OO_SDK_CC_55_OR_HIGHER = ""; 91*789d489dSHerbert Dürrif ( $main::operatingSystem =~ m/darwin/ ) 92*789d489dSHerbert Dürr{ 93*789d489dSHerbert Dürr $clangpath = `xcrun -f clang++`; 94*789d489dSHerbert Dürr $main::OO_SDK_CPP_HOME_SUGGESTION = substr($clangpath, 0, rindex($clangpath, "/")); 95*789d489dSHerbert Dürr} else { 96*789d489dSHerbert Dürr $main::OO_SDK_CPP_HOME_SUGGESTION = searchprog($main::cppName); 97*789d489dSHerbert Dürr} 98cdf0e10cSrcweir 99cdf0e10cSrcweir$main::OO_SDK_JAVA_HOME = ""; 100cdf0e10cSrcweir$main::OO_SDK_JAVA_BIN_DIR = "bin"; 101cdf0e10cSrcweirif ( $main::operatingSystem =~ m/darwin/ ) 102cdf0e10cSrcweir{ 103cdf0e10cSrcweir $main::OO_SDK_JAVA_BIN_DIR="Commands"; 104cdf0e10cSrcweir} 105cdf0e10cSrcweir$main::OO_SDK_JAVA_HOME_SUGGESTION = searchprog("javac"); 106cdf0e10cSrcweir$main::javaVersion = "1.5.0_01"; 107cdf0e10cSrcweir 108ed9d7cbeSJürgen Schmidt$main::OO_SDK_BOOST_HOME_SUGGESTION = ""; 109ed9d7cbeSJürgen Schmidt$main::boostVersion = "1.48.0"; 110ed9d7cbeSJürgen Schmidt$main::skipBoostDir = 0; 111ed9d7cbeSJürgen Schmidt 112cdf0e10cSrcweir$main::SDK_AUTO_DEPLOYMENT = ""; 113cdf0e10cSrcweir$main::SDK_AUTO_DEPLOYMENT_SUGGESTION = "YES"; 114cdf0e10cSrcweir 115cdf0e10cSrcweir$main::OO_SDK_OUTPUT_DIR_SUGGESTION = "$ENV{HOME}"; 116cdf0e10cSrcweir$main::OO_SDK_OUTPUT_DIR = ""; 117cdf0e10cSrcweir$main::skipOutputDir = 0; 118cdf0e10cSrcweir 119cdf0e10cSrcweir$main::return = 0; 120cdf0e10cSrcweir 121b3ba5bc7SJürgen Schmidtif ( $main::operatingSystem =~ m/darwin/ ) 122cdf0e10cSrcweir{ 123cdf0e10cSrcweir# used for a SDK as part of the office installation 124b3ba5bc7SJürgen Schmidt# $main::OFFICE_HOME = `cd $main::sdkpath/../../.. && pwd`; 125b3ba5bc7SJürgen Schmidt# chomp($main::OFFICE_HOME); 126b3ba5bc7SJürgen Schmidt# print " Used Office = $main::OFFICE_HOME\n"; 127b3ba5bc7SJürgen Schmidt print " Used SDK = $main::OO_SDK_HOME\n\n"; 128b3ba5bc7SJürgen Schmidt 129b3ba5bc7SJürgen Schmidt $main::OFFICE_HOME_SUGGESTION = searchMacOffice(); 130b3ba5bc7SJürgen Schmidt while ( (! -d "$main::OFFICE_HOME" ) || 131b3ba5bc7SJürgen Schmidt ((-d "$main::OFFICE_HOME") && (! -d "$main::OFFICE_HOME/Contents/MacOS")) ) 132b3ba5bc7SJürgen Schmidt { 133b3ba5bc7SJürgen Schmidt print " Enter the Office installation directory [$main::OFFICE_HOME_SUGGESTION]: "; 134b3ba5bc7SJürgen Schmidt $main::OFFICE_HOME = readStdIn(); 135b3ba5bc7SJürgen Schmidt chop($main::OFFICE_HOME); 136b3ba5bc7SJürgen Schmidt if ( $main::OFFICE_HOME eq "" ) 137b3ba5bc7SJürgen Schmidt { 138b3ba5bc7SJürgen Schmidt $main::OFFICE_HOME = $main::OFFICE_HOME_SUGGESTION; 139b3ba5bc7SJürgen Schmidt } 140b3ba5bc7SJürgen Schmidt 141b3ba5bc7SJürgen Schmidt if ( ! -d "$main::OFFICE_HOME" ) 142b3ba5bc7SJürgen Schmidt { 143b3ba5bc7SJürgen Schmidt $main::OFFICE_HOME = ""; 144b3ba5bc7SJürgen Schmidt print " Error: An office installation is required, please specify the path to a valid installation.\n"; 145b3ba5bc7SJürgen Schmidt } 146b3ba5bc7SJürgen Schmidt 147b3ba5bc7SJürgen Schmidt# $main::OFFICE_BASE_HOME = "$main::OFFICE_HOME/Contents"; 148b3ba5bc7SJürgen Schmidt } 149b3ba5bc7SJürgen Schmidt} else 150b3ba5bc7SJürgen Schmidt{ 151b3ba5bc7SJürgen Schmidt $main::OFFICE_HOME_SUGGESTION = searchoffice(); 152b3ba5bc7SJürgen Schmidt 153b3ba5bc7SJürgen Schmidt if ( $main::OFFICE_HOME_SUGGESTION eq "" ) { 154b3ba5bc7SJürgen Schmidt # prepare Office path 155b3ba5bc7SJürgen Schmidt $main::OFFICE_HOME_SUGGESTION = searchprog("soffice"); 156b3ba5bc7SJürgen Schmidt } 157b3ba5bc7SJürgen Schmidt 158b3ba5bc7SJürgen Schmidt if ( ! $main::OFFICE_HOME_SUGGESTION eq "" ) 159b3ba5bc7SJürgen Schmidt { 160b3ba5bc7SJürgen Schmidt my $tmpOffice = readlink "$main::OFFICE_HOME_SUGGESTION/soffice"; 161b3ba5bc7SJürgen Schmidt 162b3ba5bc7SJürgen Schmidt if ( $tmpOffice eq "" ) 163b3ba5bc7SJürgen Schmidt { 164b3ba5bc7SJürgen Schmidt $tmpOffice = "$main::OFFICE_HOME_SUGGESTION/soffice"; 165b3ba5bc7SJürgen Schmidt } 166b3ba5bc7SJürgen Schmidt 167b3ba5bc7SJürgen Schmidt my $offset = rindex($tmpOffice, "/program/soffice"); 168b3ba5bc7SJürgen Schmidt if ( $offset != -1 ) 169b3ba5bc7SJürgen Schmidt { 170b3ba5bc7SJürgen Schmidt $main::OFFICE_HOME_SUGGESTION = substr($tmpOffice, 0, $offset); 171cdf0e10cSrcweir } else 172cdf0e10cSrcweir { 173b3ba5bc7SJürgen Schmidt $offset = rindex($tmpOffice, "/soffice"); 174b3ba5bc7SJürgen Schmidt if ( $offset != -1 ) 175b3ba5bc7SJürgen Schmidt { 176b3ba5bc7SJürgen Schmidt $main::OFFICE_HOME_SUGGESTION = substr($tmpOffice, 0, $offset); 177b3ba5bc7SJürgen Schmidt } else 178b3ba5bc7SJürgen Schmidt { 179b3ba5bc7SJürgen Schmidt $main::OFFICE_HOME_SUGGESTION = ""; 180b3ba5bc7SJürgen Schmidt } 181b3ba5bc7SJürgen Schmidt } 182b3ba5bc7SJürgen Schmidt } 183b3ba5bc7SJürgen Schmidt 184b3ba5bc7SJürgen Schmidt while ( (! -d "$main::OFFICE_HOME" ) || 185b3ba5bc7SJürgen Schmidt ((-d "$main::OFFICE_HOME") && (! -d "$main::OFFICE_HOME/program")) ) 186b3ba5bc7SJürgen Schmidt { 187b3ba5bc7SJürgen Schmidt print " Enter the Office installation directory [$main::OFFICE_HOME_SUGGESTION]: "; 188b3ba5bc7SJürgen Schmidt $main::OFFICE_HOME = readStdIn(); 189b3ba5bc7SJürgen Schmidt chop($main::OFFICE_HOME); 190b3ba5bc7SJürgen Schmidt if ( $main::OFFICE_HOME eq "" ) 191b3ba5bc7SJürgen Schmidt { 192b3ba5bc7SJürgen Schmidt $main::OFFICE_HOME = $main::OFFICE_HOME_SUGGESTION; 193b3ba5bc7SJürgen Schmidt } 194b3ba5bc7SJürgen Schmidt 195b3ba5bc7SJürgen Schmidt if ( ! -d "$main::OFFICE_HOME" ) 196b3ba5bc7SJürgen Schmidt { 197b3ba5bc7SJürgen Schmidt $main::OFFICE_HOME = ""; 198b3ba5bc7SJürgen Schmidt print " Error: An office installation is required, please specify the path to a valid installation.\n"; 199b3ba5bc7SJürgen Schmidt } else 200b3ba5bc7SJürgen Schmidt { 201b3ba5bc7SJürgen Schmidt # special work for a network installation, no prgram directory but a link to the soffice binary 202b3ba5bc7SJürgen Schmidt if ( (! -d "$main::OFFICE_HOME/program") && (-e "$main::OFFICE_HOME/soffice") ) 203b3ba5bc7SJürgen Schmidt { 204b3ba5bc7SJürgen Schmidt my $soserver = `ls -l $OFFICE_HOME_SUGGESTION/soffice | sed -n 's/.* -> //p'`; 205b3ba5bc7SJürgen Schmidt $soserver= substr($soserver, 0, rindex($soserver, "program") - 1); 206cdf0e10cSrcweir 207b3ba5bc7SJürgen Schmidt if ( ! -d $soserver ) 208cdf0e10cSrcweir { 209b3ba5bc7SJürgen Schmidt $main::OFFICE_HOME = ""; 210b3ba5bc7SJürgen Schmidt print " Error: An office installation is required, please specify the path to a valid installation.\n"; 211b3ba5bc7SJürgen Schmidt } else 212b3ba5bc7SJürgen Schmidt { 213b3ba5bc7SJürgen Schmidt $main::OFFICE_HOME = $soserver; 214cdf0e10cSrcweir } 215b3ba5bc7SJürgen Schmidt } 216cdf0e10cSrcweir } 217cdf0e10cSrcweir } 218cdf0e10cSrcweir} 219cdf0e10cSrcweir 220b3ba5bc7SJürgen Schmidt 221cdf0e10cSrcweir# prepare GNU make path 222cdf0e10cSrcweirwhile ( (!$main::correctVersion) && 223cdf0e10cSrcweir ((! -d "$main::OO_SDK_MAKE_HOME" ) || 224cdf0e10cSrcweir ((-d "$main::OO_SDK_MAKE_HOME") && (! -e "$main::OO_SDK_MAKE_HOME/$main::makeName"))) ) 225cdf0e10cSrcweir{ 226cdf0e10cSrcweir print " Enter GNU make ($main::makeVersion or higher) tools directory [$main::OO_SDK_MAKE_HOME_SUGGESTION]: "; 227cdf0e10cSrcweir $main::OO_SDK_MAKE_HOME = readStdIn(); 228cdf0e10cSrcweir chop($main::OO_SDK_MAKE_HOME); 229cdf0e10cSrcweir if ( $main::OO_SDK_MAKE_HOME eq "" ) 230cdf0e10cSrcweir { 231cdf0e10cSrcweir $main::OO_SDK_MAKE_HOME = $main::OO_SDK_MAKE_HOME_SUGGESTION; 232cdf0e10cSrcweir } 233cdf0e10cSrcweir if ( (! -d "$main::OO_SDK_MAKE_HOME") || 234cdf0e10cSrcweir ((-d "$main::OO_SDK_MAKE_HOME") && (! -e "$main::OO_SDK_MAKE_HOME/$main::makeName")) ) 235cdf0e10cSrcweir { 236cdf0e10cSrcweir $main::OO_SDK_MAKE_HOME = ""; 237cdf0e10cSrcweir print " Error: GNU make is required, please specify a GNU make tools directory.\n"; 238cdf0e10cSrcweir } else 239cdf0e10cSrcweir { 240cdf0e10cSrcweir #check version 241cdf0e10cSrcweir my $testVersion = `$OO_SDK_MAKE_HOME/$main::makeName --version`; 242cdf0e10cSrcweir if ( $testVersion eq "") 243cdf0e10cSrcweir { 244cdf0e10cSrcweir print " Set the environment variable OO_SDK_MAKE_HOME to your GNU build tools directory.\n"; 245cdf0e10cSrcweir print " GNU make version $main::makeVersion can be obtained at ftp://ftp.gnu.org/gnu/make/\n"; 246cdf0e10cSrcweir } else 247cdf0e10cSrcweir { 248cdf0e10cSrcweir if ($testVersion =~ m#((\d+\.)+\d+)# ) 249cdf0e10cSrcweir { 250cdf0e10cSrcweir $testVersion = $1; 251cdf0e10cSrcweir } 252cdf0e10cSrcweir $main::correctVersion = testVersion($main::makeVersion, $testVersion, "$main::OO_SDK_MAKE_HOME/$main::makeName", 1); 253cdf0e10cSrcweir if ( !$main::correctVersion ) 254cdf0e10cSrcweir { 255cdf0e10cSrcweir print " The '$main::makeName' command found at '$main::OO_SDK_MAKE_HOME' has a wrong version\n"; 256cdf0e10cSrcweir $main::OO_SDK_MAKE_HOME = ""; 257cdf0e10cSrcweir } 258cdf0e10cSrcweir } 259cdf0e10cSrcweir } 260cdf0e10cSrcweir} 261cdf0e10cSrcweir 262cdf0e10cSrcweir# prepare zip path 263cdf0e10cSrcweir$main::correctVersion = 0; 264cdf0e10cSrcweirwhile ( (!$main::correctVersion) && 265cdf0e10cSrcweir ((! -d "$main::OO_SDK_ZIP_HOME" ) || 266cdf0e10cSrcweir ((-d "$main::OO_SDK_ZIP_HOME") && (! -e "$main::OO_SDK_ZIP_HOME/zip"))) ) 267cdf0e10cSrcweir{ 268cdf0e10cSrcweir print " Enter zip ($main::zipVersion or higher) tool directory [$main::OO_SDK_ZIP_HOME_SUGGESTION]: "; 269cdf0e10cSrcweir $main::OO_SDK_ZIP_HOME = readStdIn(); 270cdf0e10cSrcweir chop($main::OO_SDK_ZIP_HOME); 271cdf0e10cSrcweir if ( $main::OO_SDK_ZIP_HOME eq "" ) 272cdf0e10cSrcweir { 273cdf0e10cSrcweir $main::OO_SDK_ZIP_HOME = $main::OO_SDK_ZIP_HOME_SUGGESTION; 274cdf0e10cSrcweir } 275cdf0e10cSrcweir if ( (! -d "$main::OO_SDK_ZIP_HOME") || 276cdf0e10cSrcweir ((-d "$main::OO_SDK_ZIP_HOME") && (! -e "$main::OO_SDK_ZIP_HOME/zip")) ) 277cdf0e10cSrcweir { 278cdf0e10cSrcweir $main::OO_SDK_ZIP_HOME = ""; 279cdf0e10cSrcweir print " Error: zip tool is required, please specify a zip tool directory.\n"; 280cdf0e10cSrcweir } else 281cdf0e10cSrcweir { 282cdf0e10cSrcweir #check version 283cdf0e10cSrcweir my $testVersion = `$OO_SDK_ZIP_HOME/zip -h 2>&1 | egrep Zip | head -n 1`; 284cdf0e10cSrcweir $testVersion =~ s#Zip ([\d.]+) .*#$1#go; 285cdf0e10cSrcweir if ( $testVersion eq "") 286cdf0e10cSrcweir { 287cdf0e10cSrcweir print " Set the environment variable OO_SDK_ZIP_HOME to your zip tool directory.\n"; 288cdf0e10cSrcweir print " zip version $main::zipVersion can be obtained at ftp://www.info-zip.org/\n"; 289cdf0e10cSrcweir } else 290cdf0e10cSrcweir { 291cdf0e10cSrcweir if ($testVersion =~ m#((\d+\.)+\d+)# ) 292cdf0e10cSrcweir { 293cdf0e10cSrcweir $testVersion = $1; 294cdf0e10cSrcweir } 295cdf0e10cSrcweir $main::correctVersion = testVersion($main::zipVersion, $testVersion, "$main::OO_SDK_MAKE_HOME/zip", 1); 296cdf0e10cSrcweir if ( !$main::correctVersion ) 297cdf0e10cSrcweir { 298cdf0e10cSrcweir print " The 'zip' command found at '$main::OO_SDK_ZIP_HOME' has a wrong version\n"; 299cdf0e10cSrcweir $main::OO_SDK_ZIP_HOME = ""; 300cdf0e10cSrcweir } 301cdf0e10cSrcweir } 302cdf0e10cSrcweir } 303cdf0e10cSrcweir} 304cdf0e10cSrcweir 305985d02c7SAriel Constenla-Haile# prepare cat path 306985d02c7SAriel Constenla-Haile$main::correctVersion = 0; 307985d02c7SAriel Constenla-Hailewhile ( (!$main::correctVersion) && 308985d02c7SAriel Constenla-Haile ((! -d "$main::OO_SDK_CAT_HOME" ) || 309985d02c7SAriel Constenla-Haile ((-d "$main::OO_SDK_CAT_HOME") && (! -e "$main::OO_SDK_CAT_HOME/cat"))) ) 310985d02c7SAriel Constenla-Haile{ 311985d02c7SAriel Constenla-Haile print " Enter cat tool directory [$main::OO_SDK_CAT_HOME_SUGGESTION]: "; 312985d02c7SAriel Constenla-Haile $main::OO_SDK_CAT_HOME = readStdIn(); 313985d02c7SAriel Constenla-Haile chop($main::OO_SDK_CAT_HOME); 314985d02c7SAriel Constenla-Haile if ( $main::OO_SDK_CAT_HOME eq "" ) 315985d02c7SAriel Constenla-Haile { 316985d02c7SAriel Constenla-Haile $main::OO_SDK_CAT_HOME = $main::OO_SDK_CAT_HOME_SUGGESTION; 317985d02c7SAriel Constenla-Haile } 318985d02c7SAriel Constenla-Haile if ( (! -d "$main::OO_SDK_CAT_HOME") || 319985d02c7SAriel Constenla-Haile ((-d "$main::OO_SDK_CAT_HOME") && (! -e "$main::OO_SDK_CAT_HOME/cat")) ) 320985d02c7SAriel Constenla-Haile { 321985d02c7SAriel Constenla-Haile $main::OO_SDK_CAT_HOME = ""; 322985d02c7SAriel Constenla-Haile print " Error: cat tool is required, please specify a cat tool directory.\n"; 323985d02c7SAriel Constenla-Haile } 324985d02c7SAriel Constenla-Haile # else ... 325985d02c7SAriel Constenla-Haile # TODO check version 326985d02c7SAriel Constenla-Haile # NOTE: only Linux cat understands --version 327985d02c7SAriel Constenla-Haile} 328985d02c7SAriel Constenla-Haile 329985d02c7SAriel Constenla-Haile# prepare sed path 330985d02c7SAriel Constenla-Haile$main::correctVersion = 0; 331985d02c7SAriel Constenla-Hailewhile ( (!$main::correctVersion) && 332985d02c7SAriel Constenla-Haile ((! -d "$main::OO_SDK_SED_HOME" ) || 333985d02c7SAriel Constenla-Haile ((-d "$main::OO_SDK_SED_HOME") && (! -e "$main::OO_SDK_SED_HOME/sed"))) ) 334985d02c7SAriel Constenla-Haile{ 335985d02c7SAriel Constenla-Haile print " Enter sed tool directory [$main::OO_SDK_SED_HOME_SUGGESTION]: "; 336985d02c7SAriel Constenla-Haile $main::OO_SDK_SED_HOME = readStdIn(); 337985d02c7SAriel Constenla-Haile chop($main::OO_SDK_SED_HOME); 338985d02c7SAriel Constenla-Haile if ( $main::OO_SDK_SED_HOME eq "" ) 339985d02c7SAriel Constenla-Haile { 340985d02c7SAriel Constenla-Haile $main::OO_SDK_SED_HOME = $main::OO_SDK_SED_HOME_SUGGESTION; 341985d02c7SAriel Constenla-Haile } 342985d02c7SAriel Constenla-Haile if ( (! -d "$main::OO_SDK_SED_HOME") || 343985d02c7SAriel Constenla-Haile ((-d "$main::OO_SDK_SED_HOME") && (! -e "$main::OO_SDK_SED_HOME/sed")) ) 344985d02c7SAriel Constenla-Haile { 345985d02c7SAriel Constenla-Haile $main::OO_SDK_SED_HOME = ""; 346985d02c7SAriel Constenla-Haile print " Error: sed tool is required, please specify a sed tool directory.\n"; 347985d02c7SAriel Constenla-Haile } 348985d02c7SAriel Constenla-Haile # else ... 349985d02c7SAriel Constenla-Haile # TODO check version 350985d02c7SAriel Constenla-Haile # NOTE: only Linux sed understands --version 351985d02c7SAriel Constenla-Haile} 352985d02c7SAriel Constenla-Haile 353cdf0e10cSrcweir# prepare C++ compiler path 354cdf0e10cSrcweir$main::correctVersion = 0; 355cdf0e10cSrcweirwhile ( (!$main::correctVersion) && 356cdf0e10cSrcweir ((! -d "$main::OO_SDK_CPP_HOME" ) || 357cdf0e10cSrcweir ((-d "$main::OO_SDK_CPP_HOME") && (! -e "$main::OO_SDK_CPP_HOME/$main::cpp"))) ) 358cdf0e10cSrcweir{ 359cdf0e10cSrcweir print " C++ compilers where for example a language binding exist:\n"; 360cdf0e10cSrcweir print " - Solaris, Sun WorkShop 6 update 1 C++ 5.2 2000/09/11 or higher\n"; 361cdf0e10cSrcweir print " - Linux, GNU C++ compiler, gcc version 4.0.1 or higher\n"; 362*789d489dSHerbert Dürr print " - MacOS 64bit, Apple LLVM version 4.2 (clang-425.0.28) or higher\n"; 363*789d489dSHerbert Dürr print " on MacOS auto detected using xcrun -f clang'\n"; 364*789d489dSHerbert Dürr 365*789d489dSHerbert Dürr if ( $main::operatingSystem =~ m/darwin/ ) 366cdf0e10cSrcweir { 367*789d489dSHerbert Dürr # xcrun is used to find the correct clang compiler, just print the result as information 368cdf0e10cSrcweir $main::OO_SDK_CPP_HOME = $main::OO_SDK_CPP_HOME_SUGGESTION; 369*789d489dSHerbert Dürr print " Used clang compiler: $main::OO_SDK_CPP_HOME\n"; 370*789d489dSHerbert Dürr } else 371*789d489dSHerbert Dürr { 372*789d489dSHerbert Dürr print " Enter the directory of the C++ compiler, the directory\n"; 373*789d489dSHerbert Dürr print " where the compiler is located (optional) [$main::OO_SDK_CPP_HOME_SUGGESTION]: "; 374*789d489dSHerbert Dürr 375*789d489dSHerbert Dürr $main::OO_SDK_CPP_HOME = readStdIn(); 376*789d489dSHerbert Dürr chop($main::OO_SDK_CPP_HOME); 377*789d489dSHerbert Dürr if ( $main::OO_SDK_CPP_HOME eq "" ) 378*789d489dSHerbert Dürr { 379*789d489dSHerbert Dürr $main::OO_SDK_CPP_HOME = $main::OO_SDK_CPP_HOME_SUGGESTION; 380*789d489dSHerbert Dürr } 381cdf0e10cSrcweir } 382cdf0e10cSrcweir 383*789d489dSHerbert Dürr if ( (!$main::operatingSystem =~ m/darwin/) && (! $main::OO_SDK_CPP_HOME eq "") ) 384cdf0e10cSrcweir { 385cdf0e10cSrcweir if ( (! -d "$main::OO_SDK_CPP_HOME") || 386cdf0e10cSrcweir ((-d "$main::OO_SDK_CPP_HOME") && (! -e "$main::OO_SDK_CPP_HOME/$main::cppName")) ) 387cdf0e10cSrcweir { 388cdf0e10cSrcweir print " Error: Could not find directory '$main::OO_SDK_CPP_HOME'.\n"; 389cdf0e10cSrcweir if ( skipChoice("C++ compiler") == 1 ) 390cdf0e10cSrcweir { 391cdf0e10cSrcweir $main::correctVersion = 1; 392cdf0e10cSrcweir } 393cdf0e10cSrcweir $main::OO_SDK_CPP_HOME = ""; 394cdf0e10cSrcweir } else 395cdf0e10cSrcweir { 396cdf0e10cSrcweir #check version 397cdf0e10cSrcweir if ( $main::cppName eq "gcc" ) 398cdf0e10cSrcweir { 399cdf0e10cSrcweir my $testVersion = `$OO_SDK_CPP_HOME/$main::cppName -dumpversion`; 400cdf0e10cSrcweir if ( $testVersion eq "") 401cdf0e10cSrcweir { 402cdf0e10cSrcweir print " The '$main::cppName' command found at $main::OO_SDK_CPP_HOME/$main::cppName is not a "; 403cdf0e10cSrcweir print " GNU compiler.\nSet the environment variable OO_SDK_CPP_HOME to your GNU build tools "; 404cdf0e10cSrcweir print " directory.\nA GNU compiler version $main::cppVersion can be obtained at "; 405cdf0e10cSrcweir print " ftp://ftp.gnu.org/gnu/gcc/\n"; 406cdf0e10cSrcweir } else 407cdf0e10cSrcweir { 408cdf0e10cSrcweir $main::correctVersion = testVersion($main::cppVersion, $testVersion, "$main::OO_SDK_CPP_HOME/$main::cppName", 1); 409cdf0e10cSrcweir if ( !$main::correctVersion ) 410cdf0e10cSrcweir { 411cdf0e10cSrcweir print " The '$main::cppName' command found at '$main::OO_SDK_CPP_HOME' has a wrong version\n"; 412cdf0e10cSrcweir if ( skipChoice("C++ compiler") == 1 ) 413cdf0e10cSrcweir { 414cdf0e10cSrcweir $main::correctVersion = 1; 415cdf0e10cSrcweir } 416cdf0e10cSrcweir 417cdf0e10cSrcweir $main::OO_SDK_CPP_HOME = ""; 418cdf0e10cSrcweir } 419cdf0e10cSrcweir } 420cdf0e10cSrcweir } else 421cdf0e10cSrcweir { 422cdf0e10cSrcweir # for Solaris we have to check the version too 423cdf0e10cSrcweir open(FILE, "$OO_SDK_CPP_HOME/$main::cppName -V 2>&1 |"); 424cdf0e10cSrcweir my @lines = <FILE>; 425cdf0e10cSrcweir my $testVersion = $lines[0]; 426cdf0e10cSrcweir if ( $testVersion eq "") 427cdf0e10cSrcweir { 428cdf0e10cSrcweir print " The '$main::cppName' command found at $main::OO_SDK_CPP_HOME/$main::cppName is not a "; 429cdf0e10cSrcweir print " Solaris C++ compiler.\nSet the environment variable OO_SDK_CPP_HOME to your Solaris C++ compiler directory.\n"; 430cdf0e10cSrcweir } else 431cdf0e10cSrcweir { 432cdf0e10cSrcweir if ($testVersion =~ m#((\d+\.)+\d+)# ) 433cdf0e10cSrcweir { 434cdf0e10cSrcweir $testVersion = $1; 435cdf0e10cSrcweir } 436cdf0e10cSrcweir $main::correctVersion = testVersion($main::cppVersion, $testVersion, "$main::OO_SDK_CPP_HOME/$main::cppName", 1); 437cdf0e10cSrcweir if ( !$main::correctVersion ) 438cdf0e10cSrcweir { 439cdf0e10cSrcweir print " The '$main::cppName' command found at '$main::OO_SDK_CPP_HOME' has a wrong version\n"; 440cdf0e10cSrcweir if ( skipChoice("C++ compiler") == 1 ) 441cdf0e10cSrcweir { 442cdf0e10cSrcweir $main::correctVersion = 1; 443cdf0e10cSrcweir } 444cdf0e10cSrcweir 445cdf0e10cSrcweir $main::OO_SDK_CPP_HOME = ""; 446cdf0e10cSrcweir } else { 447cdf0e10cSrcweir $main::correctVersion = testVersion("5.5", $testVersion, "$main::OO_SDK_CPP_HOME/$main::cppName", 2); 448cdf0e10cSrcweir if ( $main::correctVersion ) { 449cdf0e10cSrcweir $main::OO_SDK_CC_55_OR_HIGHER = $testVersion; 450cdf0e10cSrcweir } 451cdf0e10cSrcweir } 452cdf0e10cSrcweir } 453cdf0e10cSrcweir } 454cdf0e10cSrcweir } 455cdf0e10cSrcweir } else 456cdf0e10cSrcweir { 457cdf0e10cSrcweir # the C++ compiler is optional 458cdf0e10cSrcweir $main::correctVersion = 1; 459cdf0e10cSrcweir } 460cdf0e10cSrcweir} 461cdf0e10cSrcweir 462cdf0e10cSrcweir 463cdf0e10cSrcweir# prepare Java path 464cdf0e10cSrcweir$main::correctVersion = 0; 465cdf0e10cSrcweir 466cdf0e10cSrcweir# prepare Java suggestion (cut bin or Commands directory to be in the root of the Java SDK) 467cdf0e10cSrcweir$main::offset = rindex($main::OO_SDK_JAVA_HOME_SUGGESTION, "/$main::OO_SDK_JAVA_BIN_DIR"); 468cdf0e10cSrcweirif ( $main::offset != -1 ) 469cdf0e10cSrcweir{ 470cdf0e10cSrcweir $main::OO_SDK_JAVA_HOME_SUGGESTION = substr($main::OO_SDK_JAVA_HOME_SUGGESTION, 0, $main::offset); 471cdf0e10cSrcweir} 472cdf0e10cSrcweir 473cdf0e10cSrcweirwhile ( (!$main::correctVersion) && 474cdf0e10cSrcweir ((! -d "$main::OO_SDK_JAVA_HOME" ) || 475cdf0e10cSrcweir ((-d "$main::OO_SDK_JAVA_HOME") && (! -e "$main::OO_SDK_JAVA_HOME/$main::OO_SDK_JAVA_BIN_DIR/javac"))) ) 476cdf0e10cSrcweir{ 477cdf0e10cSrcweir print " Enter Java SDK (1.5, recommendation is 1.6 or higher) installation directory (optional) [$main::OO_SDK_JAVA_HOME_SUGGESTION]: "; 478cdf0e10cSrcweir $main::OO_SDK_JAVA_HOME = readStdIn(); 479cdf0e10cSrcweir chop($main::OO_SDK_JAVA_HOME); 480cdf0e10cSrcweir if ( $main::OO_SDK_JAVA_HOME eq "" ) 481cdf0e10cSrcweir { 482cdf0e10cSrcweir $main::OO_SDK_JAVA_HOME = $main::OO_SDK_JAVA_HOME_SUGGESTION; 483cdf0e10cSrcweir } 484cdf0e10cSrcweir if ( ! $main::OO_SDK_JAVA_HOME eq "" ) 485cdf0e10cSrcweir { 486cdf0e10cSrcweir if ( (! -d "$main::OO_SDK_JAVA_HOME") || 487cdf0e10cSrcweir ((-d "$main::OO_SDK_JAVA_HOME") && (! -e "$main::OO_SDK_JAVA_HOME/$main::OO_SDK_JAVA_BIN_DIR/javac")) ) 488cdf0e10cSrcweir { 489cdf0e10cSrcweir 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"; 490cdf0e10cSrcweir if ( skipChoice("JAVA SDK") == 1 ) 491cdf0e10cSrcweir { 492cdf0e10cSrcweir $main::correctVersion = 1; 493cdf0e10cSrcweir } 494cdf0e10cSrcweir $main::OO_SDK_JAVA_HOME = ""; 495cdf0e10cSrcweir } else 496cdf0e10cSrcweir { 497cdf0e10cSrcweir #check version 498cdf0e10cSrcweir 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#".*##'`; 499cdf0e10cSrcweir $testVersion =~ s#([^\n]+)\n#$1#go; 500cdf0e10cSrcweir 501cdf0e10cSrcweir $main::correctVersion = testVersion($main::javaVersion, $testVersion, "$main::OO_SDK_JAVA_HOME/$main::OO_SDK_JAVA_BIN_DIR/java", 1); 502cdf0e10cSrcweir if ( !$main::correctVersion ) 503cdf0e10cSrcweir { 504cdf0e10cSrcweir if ( skipChoice("JAVA SDK") == 1 ) 505cdf0e10cSrcweir { 506cdf0e10cSrcweir $main::correctVersion = 1; 507cdf0e10cSrcweir } 508cdf0e10cSrcweir $main::OO_SDK_JAVA_HOME = ""; 509cdf0e10cSrcweir } 510cdf0e10cSrcweir } 511cdf0e10cSrcweir }else 512cdf0e10cSrcweir { 513cdf0e10cSrcweir # the Java SDK is optional 514cdf0e10cSrcweir $main::correctVersion = 1; 515cdf0e10cSrcweir } 516cdf0e10cSrcweir} 517cdf0e10cSrcweir 518ed9d7cbeSJürgen Schmidt# prepare boost directory (optional) 519ed9d7cbeSJürgen Schmidtwhile ( (!$main::skipBoostDir) && 520ed9d7cbeSJürgen Schmidt ((! -d "$main::OO_SDK_BOOST_HOME" ) || 521ed9d7cbeSJürgen Schmidt ((-d "$main::OO_SDK_BOOST_HOME") && (! -e "$main::OO_SDK_BOOST_HOME/boost/tr1/unordered_map.hpp"))) ) 522ed9d7cbeSJürgen Schmidt{ 523ed9d7cbeSJürgen Schmidt 524ed9d7cbeSJürgen Schmidt print " Enter boost directory [$main::OO_SDK_BOOST_HOME_SUGGESTION]: "; 525ed9d7cbeSJürgen Schmidt $main::OO_SDK_BOOST_HOME = readStdIn(); 526ed9d7cbeSJürgen Schmidt chop($main::OO_SDK_BOOST_HOME); 527ed9d7cbeSJürgen Schmidt if ( $main::OO_SDK_BOOST_HOME eq "" ) 528ed9d7cbeSJürgen Schmidt { 529ed9d7cbeSJürgen Schmidt $main::OO_SDK_BOOST_HOME = $main::OO_SDK_BOOST_HOME_SUGGESTION; 530ed9d7cbeSJürgen Schmidt } 531ed9d7cbeSJürgen Schmidt if ( (! -d "$main::OO_SDK_BOOST_HOME") || 532ed9d7cbeSJürgen Schmidt ((-d "$main::OO_SDK_BOOST_HOME") && (! -e "$main::OO_SDK_BOOST_HOME/boost/tr1/unordered_map.hpp")) ) 533ed9d7cbeSJürgen Schmidt { 534ed9d7cbeSJürgen Schmidt print " Error: boost couldn't be find or verified, please specify a boost directory.\n"; 535ed9d7cbeSJürgen Schmidt if ( skipChoice("optional output directory") == 1 ) 536ed9d7cbeSJürgen Schmidt { 537ed9d7cbeSJürgen Schmidt $main::skipBoostDir = 1; 538ed9d7cbeSJürgen Schmidt } 539ed9d7cbeSJürgen Schmidt $main::OO_SDK_BOOST_HOME = ""; 540ed9d7cbeSJürgen Schmidt } else 541ed9d7cbeSJürgen Schmidt { 542ed9d7cbeSJürgen Schmidt # the boost directory is optional 543ed9d7cbeSJürgen Schmidt $main::skipBoostDir = 1; 544ed9d7cbeSJürgen Schmidt } 545ed9d7cbeSJürgen Schmidt} 546cdf0e10cSrcweir 547cdf0e10cSrcweir# prepare output directory (optional) 548cdf0e10cSrcweirwhile ( (!$main::skipOutputDir) && 549cdf0e10cSrcweir (! -d "$main::OO_SDK_OUTPUT_DIR") ) 550cdf0e10cSrcweir{ 551cdf0e10cSrcweir print " Default output directory is in your HOME directory.\n"; 552cdf0e10cSrcweir print " Enter an existent directory if you prefer a different output directory (optional) [$main::OO_SDK_OUTPUT_DIR_SUGGESTION]: "; 553cdf0e10cSrcweir 554cdf0e10cSrcweir $main::OO_SDK_OUTPUT_DIR = readStdIn(); 555cdf0e10cSrcweir 556cdf0e10cSrcweir chop($main::OO_SDK_OUTPUT_DIR); 557cdf0e10cSrcweir if ( $main::OO_SDK_OUTPUT_DIR eq "" ) 558cdf0e10cSrcweir { 559cdf0e10cSrcweir $main::OO_SDK_OUTPUT_DIR = $main::OO_SDK_OUTPUT_DIR_SUGGESTION; 560cdf0e10cSrcweir } 561cdf0e10cSrcweir if ( ! $main::OO_SDK_OUTPUT_DIR eq "" ) 562cdf0e10cSrcweir { 563cdf0e10cSrcweir if ( ! -d "$main::OO_SDK_OUTPUT_DIR" ) 564cdf0e10cSrcweir { 565cdf0e10cSrcweir print " Error: Could not find directory '$main::OO_SDK_OUTPUT_DIR'.\n"; 566cdf0e10cSrcweir if ( skipChoice("optional output directory") == 1 ) 567cdf0e10cSrcweir { 568cdf0e10cSrcweir $main::skipOutputDir = 1; 569cdf0e10cSrcweir } 570cdf0e10cSrcweir $main::OO_SDK_OUTPUT_DIR = ""; 571cdf0e10cSrcweir } 572cdf0e10cSrcweir } else 573cdf0e10cSrcweir { 574cdf0e10cSrcweir # the output directory is optional 575cdf0e10cSrcweir $main::skipOutputDir = 1; 576cdf0e10cSrcweir } 577cdf0e10cSrcweir} 578cdf0e10cSrcweir 579cdf0e10cSrcweir# prepare auto deployment 580b3ba5bc7SJürgen Schmidtwhile ( $main::SDK_AUTO_DEPLOYMENT eq "" || 581b3ba5bc7SJürgen Schmidt ((! $main::SDK_AUTO_DEPLOYMENT eq "YES") && 582b3ba5bc7SJürgen Schmidt (! $main::SDK_AUTO_DEPLOYMENT eq "NO")) ) 583cdf0e10cSrcweir{ 584b3ba5bc7SJürgen Schmidt print " Automatic deployment of UNO components (YES/NO) [$main::SDK_AUTO_DEPLOYMENT_SUGGESTION]: "; 585b3ba5bc7SJürgen Schmidt $main::SDK_AUTO_DEPLOYMENT = uc <STDIN>; 586b3ba5bc7SJürgen Schmidt chop($main::SDK_AUTO_DEPLOYMENT); 587b3ba5bc7SJürgen Schmidt if ( $main::SDK_AUTO_DEPLOYMENT eq "" ) 588cdf0e10cSrcweir { 589b3ba5bc7SJürgen Schmidt $main::SDK_AUTO_DEPLOYMENT = "YES"; 590cdf0e10cSrcweir } 591cdf0e10cSrcweir} 592cdf0e10cSrcweir 593985d02c7SAriel Constenla-HaileprepareScriptFile("setsdkenv_unix.sh.in", "setsdkenv_unix.sh"); 594cdf0e10cSrcweirchmod 0644, "$main::OO_SDK_CONFIG_HOME/$main::hostname/setsdkenv_unix.sh"; 595cdf0e10cSrcweir 596cdf0e10cSrcweirprint "\n"; 597cdf0e10cSrcweirprint " ************************************************************************\n"; 598cdf0e10cSrcweirprint " * ... your SDK environment has been prepared.\n"; 599cdf0e10cSrcweirprint " * For each time you want to use this configured SDK environment, you\n"; 600cdf0e10cSrcweirprint " * have to run the \"setsdkenv_unix\" script file!\n"; 601cdf0e10cSrcweirprint " * Alternatively can you source one of the scripts\n"; 602cdf0e10cSrcweirprint " * \"$main::OO_SDK_CONFIG_HOME/$main::hostname/setsdkenv_unix.sh\"\n"; 603cdf0e10cSrcweirprint " * to get an environment without starting a new shell.\n"; 604cdf0e10cSrcweirprint " ************************************************************************\n\n"; 605cdf0e10cSrcweir 606cdf0e10cSrcweirexit $return; 607cdf0e10cSrcweir 608cdf0e10cSrcweirsub skipChoice 609cdf0e10cSrcweir{ 610cdf0e10cSrcweir my $msg = shift; 611cdf0e10cSrcweir my $skip = ""; 612cdf0e10cSrcweir while ( !( $skip eq "yes" || $skip eq "no") ) 613cdf0e10cSrcweir { 614cdf0e10cSrcweir print " Do you want to skip the choice of the '$msg' (YES/NO): [YES] "; 615cdf0e10cSrcweir $skip = lc <STDIN>; 616cdf0e10cSrcweir chop($skip); 617cdf0e10cSrcweir if ( $skip eq "" ) { $skip = "yes"; } # default 618cdf0e10cSrcweir if ( $skip eq "yes" ) 619cdf0e10cSrcweir { 620cdf0e10cSrcweir return 1; 621cdf0e10cSrcweir } 622cdf0e10cSrcweir } 623cdf0e10cSrcweir return 0; 624cdf0e10cSrcweir} 625cdf0e10cSrcweir 626cdf0e10cSrcweirsub resolveLink 627cdf0e10cSrcweir{ 628cdf0e10cSrcweir my $base= shift; 629cdf0e10cSrcweir my $link= shift; 630cdf0e10cSrcweir 631cdf0e10cSrcweir my $resolvedpath = "$base/$link"; 632cdf0e10cSrcweir my $linktarget = readlink "$resolvedpath"; 633cdf0e10cSrcweir my $resolvedlink = ""; 634cdf0e10cSrcweir 635cdf0e10cSrcweir while ( $linktarget ne "") { 636cdf0e10cSrcweir 637cdf0e10cSrcweir if ( $linktarget =~ m/^\/.*/ ) 638cdf0e10cSrcweir { 639cdf0e10cSrcweir $resolvedpath = "$linktarget"; 640cdf0e10cSrcweir } else { 641cdf0e10cSrcweir $resolvedpath = `cd $base/$linktarget; pwd`; 642cdf0e10cSrcweir chop $resolvedpath; 643cdf0e10cSrcweir } 644cdf0e10cSrcweir $base = dirname("$resolvedpath"); 645cdf0e10cSrcweir 646cdf0e10cSrcweir $linktarget = readlink "$resolvedpath"; 647cdf0e10cSrcweir } 648cdf0e10cSrcweir 649cdf0e10cSrcweir $resolvedlink = `cd $resolvedpath; pwd`; 650cdf0e10cSrcweir chop $resolvedlink; 651cdf0e10cSrcweir return $resolvedlink; 652cdf0e10cSrcweir} 653cdf0e10cSrcweir 654cdf0e10cSrcweirsub searchprog 655cdf0e10cSrcweir{ 656cdf0e10cSrcweir my $_search= shift; 657cdf0e10cSrcweir my $tmpPath = `echo "\$PATH"`; 658cdf0e10cSrcweir my @pathList = split(":" , $tmpPath); 659cdf0e10cSrcweir my $progDir = ""; 660cdf0e10cSrcweir 661cdf0e10cSrcweir if ( $_search eq "javac" ) 662cdf0e10cSrcweir { 663cdf0e10cSrcweir if ( $main::operatingSystem =~ m/darwin/ ) { 664cdf0e10cSrcweir $progDir = resolveLink("/System/Library/Frameworks/JavaVM.Framework/Versions", "CurrentJDK"); 665cdf0e10cSrcweir 666cdf0e10cSrcweir if ( -e "$progDir/$main::OO_SDK_JAVA_BIN_DIR/javac" ) 667cdf0e10cSrcweir { 668cdf0e10cSrcweir return "$progDir/$main::OO_SDK_JAVA_BIN_DIR"; 669cdf0e10cSrcweir } 670cdf0e10cSrcweir } 671cdf0e10cSrcweir 672cdf0e10cSrcweir if ( $main::operatingSystem =~ m/solaris/ ) { 673cdf0e10cSrcweir $progDir = resolveLink("/usr/jdk", "latest"); 674cdf0e10cSrcweir if ( -e "$progDir/$main::OO_SDK_JAVA_BIN_DIR/javac" ) 675cdf0e10cSrcweir { 676cdf0e10cSrcweir return "$progDir/$main::OO_SDK_JAVA_BIN_DIR"; 677cdf0e10cSrcweir } 678cdf0e10cSrcweir } 679cdf0e10cSrcweir } 680cdf0e10cSrcweir 681cdf0e10cSrcweir if ( $_search eq "gmake" && $main::operatingSystem =~ m/solaris/ ) { 682cdf0e10cSrcweir if ( -e "/usr/sfw/bin/gmake" ) 683cdf0e10cSrcweir { 684cdf0e10cSrcweir return "/usr/sfw/bin"; 685cdf0e10cSrcweir } 686cdf0e10cSrcweir } 687cdf0e10cSrcweir 688cdf0e10cSrcweir foreach $i (@pathList) 689cdf0e10cSrcweir { 690cdf0e10cSrcweir chomp ($i); 691cdf0e10cSrcweir 692cdf0e10cSrcweir if ( -e "$i/$_search" ) 693cdf0e10cSrcweir { 694cdf0e10cSrcweir 695cdf0e10cSrcweir if ( index($i, "/") == 0 ) 696cdf0e10cSrcweir { 697cdf0e10cSrcweir # # absolute path; leave unchanged 698cdf0e10cSrcweir $progDir = $i; 699cdf0e10cSrcweir } else 700cdf0e10cSrcweir { 701cdf0e10cSrcweir $progDir = `cd "$i"; pwd`; 702cdf0e10cSrcweir } 703cdf0e10cSrcweir return $progDir 704cdf0e10cSrcweir } 705cdf0e10cSrcweir } 706cdf0e10cSrcweir return $progDir 707cdf0e10cSrcweir} 708cdf0e10cSrcweir 709cdf0e10cSrcweirsub searchMacOffice 710cdf0e10cSrcweir{ 711599cc5b4SOliver-Rainer Wittmann if (-d "/Applications/OpenOffice.app" ) { 712599cc5b4SOliver-Rainer Wittmann return "/Applications/OpenOffice.app" 713ff3f4ebcSOliver-Rainer Wittmann } 714cdf0e10cSrcweir return ""; 715cdf0e10cSrcweir} 716cdf0e10cSrcweir 717cdf0e10cSrcweirsub searchoffice 718cdf0e10cSrcweir{ 719599cc5b4SOliver-Rainer Wittmann my $offset = rindex($main::sdkpath, "/openoffice"); 720cdf0e10cSrcweir my $tmpOffice = substr($main::sdkpath, 0, $offset); 721599cc5b4SOliver-Rainer Wittmann my $officepath = "$tmpOffice/openoffice$main::OO_MAJORVERSION"; 722cdf0e10cSrcweir 723cdf0e10cSrcweir# if ( $main::OO_MINORVERSION > 0) { 724cdf0e10cSrcweir# $officepath = "$officepath$main::OO_MINORVERSION"; 725cdf0e10cSrcweir# } 726cdf0e10cSrcweir 727cdf0e10cSrcweir # search corresponding office for this SDK 728cdf0e10cSrcweir if (-d $officepath && -e "$officepath/program/soffice") { 729cdf0e10cSrcweir return $officepath; 730cdf0e10cSrcweir } 731b3ba5bc7SJürgen Schmidt return ""; 732cdf0e10cSrcweir} 733cdf0e10cSrcweir 734cdf0e10cSrcweir 735cdf0e10cSrcweir 736cdf0e10cSrcweirsub testVersion 737cdf0e10cSrcweir{ 738cdf0e10cSrcweir my $tmpMustBeVersion = shift; 739cdf0e10cSrcweir my $tmpTestVersion = shift; 740cdf0e10cSrcweir my $toolName = shift; 741cdf0e10cSrcweir # 1=check + message 2=check only 742cdf0e10cSrcweir my $checkOnly = shift; 743cdf0e10cSrcweir my @mustBeVersion = split(/\.|_|-/,$tmpMustBeVersion); 744cdf0e10cSrcweir my @testVersion = split(/\.|_|-/,$tmpTestVersion); 745cdf0e10cSrcweir my $length = $#mustBeVersion; 746cdf0e10cSrcweir 747cdf0e10cSrcweir if ($#testVersion < $#mustBeVersion) { 748cdf0e10cSrcweir $length = $#testVersion; 749cdf0e10cSrcweir } 750cdf0e10cSrcweir 751cdf0e10cSrcweir for ($i=0; $i <= $length; $i++ ) 752cdf0e10cSrcweir { 753985d02c7SAriel Constenla-Haile if ( @testVersion[$i] > @mustBeVersion[$i] ) 754cdf0e10cSrcweir { 755cdf0e10cSrcweir return 1; # 1 indicates a correct version 756cdf0e10cSrcweir } 757cdf0e10cSrcweir 758985d02c7SAriel Constenla-Haile if ( @testVersion[$i] < @mustBeVersion[$i] ) 759cdf0e10cSrcweir { 760cdf0e10cSrcweir if ( $#checkOnly == 1 ) { 761cdf0e10cSrcweir print " The command '$toolName' has the version $tmpTestVersion.\n"; 762cdf0e10cSrcweir print " The SDK requires at least the version $tmpMustBeVersion.\n"; 763cdf0e10cSrcweir } 764cdf0e10cSrcweir return 0; 765cdf0e10cSrcweir } 766cdf0e10cSrcweir } 767cdf0e10cSrcweir 768cdf0e10cSrcweir return 1; # 1 indicates a correct version 769cdf0e10cSrcweir} 770cdf0e10cSrcweir 771cdf0e10cSrcweirsub readStdIn 772cdf0e10cSrcweir{ 773cdf0e10cSrcweir my $tmpstdin = <STDIN>; 774cdf0e10cSrcweir if ( index($tmpstdin, "\$") != -1) 775cdf0e10cSrcweir { 776cdf0e10cSrcweir return `echo $tmpstdin`; 777cdf0e10cSrcweir } 778cdf0e10cSrcweir 779cdf0e10cSrcweir return $tmpstdin; 780cdf0e10cSrcweir} 781cdf0e10cSrcweir 782cdf0e10cSrcweirsub prepareScriptFile() 783cdf0e10cSrcweir{ 784cdf0e10cSrcweir my $inputFile = shift; 785cdf0e10cSrcweir my $outputFile = shift; 786cdf0e10cSrcweir 787cdf0e10cSrcweir if ( ! -d "$main::OO_SDK_CONFIG_HOME/$main::hostname" ) 788cdf0e10cSrcweir { 789cdf0e10cSrcweir system("mkdir -p $main::OO_SDK_CONFIG_HOME/$main::hostname"); 790cdf0e10cSrcweir } 791cdf0e10cSrcweir 792cdf0e10cSrcweir open ( FILEIN, "$main::sdkpath/$inputFile" ) || die "\nERROR: could not open '$main::sdkpath/$inputFile' for reading"; 793cdf0e10cSrcweir 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"; 794cdf0e10cSrcweir 795cdf0e10cSrcweir while ( <FILEIN> ) 796cdf0e10cSrcweir { 797cdf0e10cSrcweir $_ =~ s#\@OO_SDK_NAME\@#$main::OO_SDK_NAME#go; 798cdf0e10cSrcweir $_ =~ s#\@OO_SDK_HOME\@#$main::OO_SDK_HOME#go; 799cdf0e10cSrcweir $_ =~ s#\@OFFICE_HOME\@#$main::OFFICE_HOME#go; 800cdf0e10cSrcweir $_ =~ s#\@OO_SDK_MAKE_HOME\@#$main::OO_SDK_MAKE_HOME#go; 801cdf0e10cSrcweir $_ =~ s#\@OO_SDK_ZIP_HOME\@#$main::OO_SDK_ZIP_HOME#go; 802b3ba5bc7SJürgen Schmidt $_ =~ s#\@OO_SDK_CAT_HOME\@#$main::OO_SDK_CAT_HOME#go; 803b3ba5bc7SJürgen Schmidt $_ =~ s#\@OO_SDK_SED_HOME\@#$main::OO_SDK_SED_HOME#go; 804cdf0e10cSrcweir $_ =~ s#\@OO_SDK_CPP_HOME\@#$main::OO_SDK_CPP_HOME#go; 805cdf0e10cSrcweir $_ =~ s#\@OO_SDK_CC_55_OR_HIGHER\@#$main::OO_SDK_CC_55_OR_HIGHER#go; 806cdf0e10cSrcweir $_ =~ s#\@OO_SDK_JAVA_HOME\@#$main::OO_SDK_JAVA_HOME#go; 807ed9d7cbeSJürgen Schmidt $_ =~ s#\@OO_SDK_BOOST_HOME\@#$main::OO_SDK_BOOST_HOME#go; 808cdf0e10cSrcweir $_ =~ s#\@SDK_AUTO_DEPLOYMENT\@#$main::SDK_AUTO_DEPLOYMENT#go; 809cdf0e10cSrcweir $_ =~ s#\@OO_SDK_OUTPUT_DIR\@#$main::OO_SDK_OUTPUT_DIR#go; 810cdf0e10cSrcweir 811cdf0e10cSrcweir print FILEOUT $_; 812cdf0e10cSrcweir } 813cdf0e10cSrcweir 814cdf0e10cSrcweir close FILEIN; 815cdf0e10cSrcweir close FILEOUT; 816cdf0e10cSrcweir} 817