1*b1cdbd2cSJim Jagielski#************************************************************** 2*b1cdbd2cSJim Jagielski# 3*b1cdbd2cSJim Jagielski# Licensed to the Apache Software Foundation (ASF) under one 4*b1cdbd2cSJim Jagielski# or more contributor license agreements. See the NOTICE file 5*b1cdbd2cSJim Jagielski# distributed with this work for additional information 6*b1cdbd2cSJim Jagielski# regarding copyright ownership. The ASF licenses this file 7*b1cdbd2cSJim Jagielski# to you under the Apache License, Version 2.0 (the 8*b1cdbd2cSJim Jagielski# "License"); you may not use this file except in compliance 9*b1cdbd2cSJim Jagielski# with the License. You may obtain a copy of the License at 10*b1cdbd2cSJim Jagielski# 11*b1cdbd2cSJim Jagielski# http://www.apache.org/licenses/LICENSE-2.0 12*b1cdbd2cSJim Jagielski# 13*b1cdbd2cSJim Jagielski# Unless required by applicable law or agreed to in writing, 14*b1cdbd2cSJim Jagielski# software distributed under the License is distributed on an 15*b1cdbd2cSJim Jagielski# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*b1cdbd2cSJim Jagielski# KIND, either express or implied. See the License for the 17*b1cdbd2cSJim Jagielski# specific language governing permissions and limitations 18*b1cdbd2cSJim Jagielski# under the License. 19*b1cdbd2cSJim Jagielski# 20*b1cdbd2cSJim Jagielski#************************************************************** 21*b1cdbd2cSJim Jagielski 22*b1cdbd2cSJim Jagielski# 23*b1cdbd2cSJim Jagielski# configure.pl - a perl script to set a minimal environment for the SDK. 24*b1cdbd2cSJim Jagielski# 25*b1cdbd2cSJim Jagielski# Copyright 2000, 2010 Oracle and/or its affiliates. 26*b1cdbd2cSJim Jagielski# 27*b1cdbd2cSJim Jagielski 28*b1cdbd2cSJim Jagielskiuse IO::File; 29*b1cdbd2cSJim Jagielskiuse File::Basename; 30*b1cdbd2cSJim Jagielski 31*b1cdbd2cSJim Jagielski$main::hostname= $ARGV[0]; 32*b1cdbd2cSJim Jagielski$main::sdkpath= $ARGV[1]; 33*b1cdbd2cSJim Jagielski$main::OO_SDK_NAME= $ARGV[2]; 34*b1cdbd2cSJim Jagielski 35*b1cdbd2cSJim Jagielski$main::OO_MAJORVERSION=$main::OO_SDK_NAME; 36*b1cdbd2cSJim Jagielski$main::OO_MINORVERSION=$main::OO_SDK_NAME; 37*b1cdbd2cSJim Jagielski$main::OO_MAJORVERSION =~ s#[^\d]+(\d).(\d).+#$1#go; 38*b1cdbd2cSJim Jagielski$main::OO_MINORVERSION =~ s#[^\d]+(\d).(\d).+#$2#go; 39*b1cdbd2cSJim Jagielski 40*b1cdbd2cSJim Jagielski$main::OO_SDK_CONFIG_HOME= "$ENV{HOME}/$main::OO_SDK_NAME"; 41*b1cdbd2cSJim Jagielski 42*b1cdbd2cSJim Jagielski$main::operatingSystem = `$main::sdkpath/config.guess | cut -d"-" -f3,4`; 43*b1cdbd2cSJim Jagielskichomp ($main::operatingSystem); 44*b1cdbd2cSJim Jagielski 45*b1cdbd2cSJim Jagielski$main::OO_SDK_HOME = $main::sdkpath; 46*b1cdbd2cSJim Jagielski$main::OO_SDK_HOME_SUGGESTION = $main::sdkpath; 47*b1cdbd2cSJim Jagielski 48*b1cdbd2cSJim Jagielski$main::OFFICE_HOME = ""; 49*b1cdbd2cSJim Jagielski 50*b1cdbd2cSJim Jagielski#$main::OFFICE_BASE_HOME = substr($main::sdkpath, 0, rindex($main::sdkpath, "/sdk")); 51*b1cdbd2cSJim Jagielski 52*b1cdbd2cSJim Jagielski$main::OO_SDK_MAKE_HOME = ""; 53*b1cdbd2cSJim Jagielski$main::makeName = "make"; 54*b1cdbd2cSJim Jagielskiif ( $main::operatingSystem =~ m/solaris/ || 55*b1cdbd2cSJim Jagielski $main::operatingSystem =~ m/freebsd/ ) 56*b1cdbd2cSJim Jagielski{ 57*b1cdbd2cSJim Jagielski $main::makeName = "gmake"; 58*b1cdbd2cSJim Jagielski} 59*b1cdbd2cSJim Jagielski$main::OO_SDK_MAKE_HOME_SUGGESTION = searchprog($main::makeName); 60*b1cdbd2cSJim Jagielski$main::makeVersion = "3.79.1"; 61*b1cdbd2cSJim Jagielski$main::correctVersion = 0; 62*b1cdbd2cSJim Jagielski 63*b1cdbd2cSJim Jagielski$main::OO_SDK_ZIP_HOME = ""; 64*b1cdbd2cSJim Jagielski$main::OO_SDK_ZIP_HOME_SUGGESTION = searchprog("zip"); 65*b1cdbd2cSJim Jagielski$main::zipVersion = "2.3"; 66*b1cdbd2cSJim Jagielski 67*b1cdbd2cSJim Jagielski$main::OO_SDK_CAT_HOME = ""; 68*b1cdbd2cSJim Jagielski$main::OO_SDK_CAT_HOME_SUGGESTION = searchprog("cat"); 69*b1cdbd2cSJim Jagielski# TODO cat version 70*b1cdbd2cSJim Jagielski# $main::catVersion = ""; 71*b1cdbd2cSJim Jagielski 72*b1cdbd2cSJim Jagielski$main::OO_SDK_SED_HOME = ""; 73*b1cdbd2cSJim Jagielski$main::OO_SDK_SED_HOME_SUGGESTION = searchprog("sed"); 74*b1cdbd2cSJim Jagielski# TODO sed version 75*b1cdbd2cSJim Jagielski# $main::sedVersion = ""; 76*b1cdbd2cSJim Jagielski 77*b1cdbd2cSJim Jagielski$main::OO_SDK_CPP_HOME = ""; 78*b1cdbd2cSJim Jagielski$main::cppName = "gcc"; 79*b1cdbd2cSJim Jagielski$main::cppVersion = "4.0.1"; 80*b1cdbd2cSJim Jagielskiif ( $main::operatingSystem =~ m/solaris/ ) 81*b1cdbd2cSJim Jagielski{ 82*b1cdbd2cSJim Jagielski $main::cppName = "CC"; 83*b1cdbd2cSJim Jagielski $main::cppVersion = "5.2"; 84*b1cdbd2cSJim Jagielski} 85*b1cdbd2cSJim Jagielskiif ( $main::operatingSystem =~ m/darwin/ ) 86*b1cdbd2cSJim Jagielski{ 87*b1cdbd2cSJim Jagielski $main::cppName = "clang"; 88*b1cdbd2cSJim Jagielski $main::cppVersion = "4.2"; 89*b1cdbd2cSJim Jagielski} 90*b1cdbd2cSJim Jagielski$main::OO_SDK_CC_55_OR_HIGHER = ""; 91*b1cdbd2cSJim Jagielskiif ( $main::operatingSystem =~ m/darwin/ ) 92*b1cdbd2cSJim Jagielski{ 93*b1cdbd2cSJim Jagielski $clangpath = `xcrun -f clang++`; 94*b1cdbd2cSJim Jagielski $main::OO_SDK_CPP_HOME_SUGGESTION = substr($clangpath, 0, rindex($clangpath, "/")); 95*b1cdbd2cSJim Jagielski} else { 96*b1cdbd2cSJim Jagielski $main::OO_SDK_CPP_HOME_SUGGESTION = searchprog($main::cppName); 97*b1cdbd2cSJim Jagielski} 98*b1cdbd2cSJim Jagielski 99*b1cdbd2cSJim Jagielski$main::OO_SDK_JAVA_HOME = ""; 100*b1cdbd2cSJim Jagielski$main::OO_SDK_JAVA_BIN_DIR = "bin"; 101*b1cdbd2cSJim Jagielskiif ( $main::operatingSystem =~ m/darwin/ ) 102*b1cdbd2cSJim Jagielski{ 103*b1cdbd2cSJim Jagielski $main::OO_SDK_JAVA_BIN_DIR="Commands"; 104*b1cdbd2cSJim Jagielski} 105*b1cdbd2cSJim Jagielski$main::OO_SDK_JAVA_HOME_SUGGESTION = searchprog("javac"); 106*b1cdbd2cSJim Jagielski$main::javaVersion = "1.5.0_01"; 107*b1cdbd2cSJim Jagielski 108*b1cdbd2cSJim Jagielski$main::OO_SDK_BOOST_HOME_SUGGESTION = ""; 109*b1cdbd2cSJim Jagielski$main::boostVersion = "1.48.0"; 110*b1cdbd2cSJim Jagielski$main::skipBoostDir = 0; 111*b1cdbd2cSJim Jagielski 112*b1cdbd2cSJim Jagielski$main::SDK_AUTO_DEPLOYMENT = ""; 113*b1cdbd2cSJim Jagielski$main::SDK_AUTO_DEPLOYMENT_SUGGESTION = "YES"; 114*b1cdbd2cSJim Jagielski 115*b1cdbd2cSJim Jagielski$main::OO_SDK_OUTPUT_DIR_SUGGESTION = "$ENV{HOME}"; 116*b1cdbd2cSJim Jagielski$main::OO_SDK_OUTPUT_DIR = ""; 117*b1cdbd2cSJim Jagielski$main::skipOutputDir = 0; 118*b1cdbd2cSJim Jagielski 119*b1cdbd2cSJim Jagielski$main::return = 0; 120*b1cdbd2cSJim Jagielski 121*b1cdbd2cSJim Jagielskiif ( $main::operatingSystem =~ m/darwin/ ) 122*b1cdbd2cSJim Jagielski{ 123*b1cdbd2cSJim Jagielski# used for a SDK as part of the office installation 124*b1cdbd2cSJim Jagielski# $main::OFFICE_HOME = `cd $main::sdkpath/../../.. && pwd`; 125*b1cdbd2cSJim Jagielski# chomp($main::OFFICE_HOME); 126*b1cdbd2cSJim Jagielski# print " Used Office = $main::OFFICE_HOME\n"; 127*b1cdbd2cSJim Jagielski print " Used SDK = $main::OO_SDK_HOME\n\n"; 128*b1cdbd2cSJim Jagielski 129*b1cdbd2cSJim Jagielski $main::OFFICE_HOME_SUGGESTION = searchMacOffice(); 130*b1cdbd2cSJim Jagielski while ( (! -d "$main::OFFICE_HOME" ) || 131*b1cdbd2cSJim Jagielski ((-d "$main::OFFICE_HOME") && (! -d "$main::OFFICE_HOME/Contents/MacOS")) ) 132*b1cdbd2cSJim Jagielski { 133*b1cdbd2cSJim Jagielski print " Enter the Office installation directory [$main::OFFICE_HOME_SUGGESTION]: "; 134*b1cdbd2cSJim Jagielski $main::OFFICE_HOME = readStdIn(); 135*b1cdbd2cSJim Jagielski chop($main::OFFICE_HOME); 136*b1cdbd2cSJim Jagielski if ( $main::OFFICE_HOME eq "" ) 137*b1cdbd2cSJim Jagielski { 138*b1cdbd2cSJim Jagielski $main::OFFICE_HOME = $main::OFFICE_HOME_SUGGESTION; 139*b1cdbd2cSJim Jagielski } 140*b1cdbd2cSJim Jagielski 141*b1cdbd2cSJim Jagielski if ( ! -d "$main::OFFICE_HOME" ) 142*b1cdbd2cSJim Jagielski { 143*b1cdbd2cSJim Jagielski $main::OFFICE_HOME = ""; 144*b1cdbd2cSJim Jagielski print " Error: An office installation is required, please specify the path to a valid installation.\n"; 145*b1cdbd2cSJim Jagielski } 146*b1cdbd2cSJim Jagielski 147*b1cdbd2cSJim Jagielski# $main::OFFICE_BASE_HOME = "$main::OFFICE_HOME/Contents"; 148*b1cdbd2cSJim Jagielski } 149*b1cdbd2cSJim Jagielski} else 150*b1cdbd2cSJim Jagielski{ 151*b1cdbd2cSJim Jagielski $main::OFFICE_HOME_SUGGESTION = searchoffice(); 152*b1cdbd2cSJim Jagielski 153*b1cdbd2cSJim Jagielski if ( $main::OFFICE_HOME_SUGGESTION eq "" ) { 154*b1cdbd2cSJim Jagielski # prepare Office path 155*b1cdbd2cSJim Jagielski $main::OFFICE_HOME_SUGGESTION = searchprog("soffice"); 156*b1cdbd2cSJim Jagielski } 157*b1cdbd2cSJim Jagielski 158*b1cdbd2cSJim Jagielski if ( ! $main::OFFICE_HOME_SUGGESTION eq "" ) 159*b1cdbd2cSJim Jagielski { 160*b1cdbd2cSJim Jagielski my $tmpOffice = readlink "$main::OFFICE_HOME_SUGGESTION/soffice"; 161*b1cdbd2cSJim Jagielski 162*b1cdbd2cSJim Jagielski if ( $tmpOffice eq "" ) 163*b1cdbd2cSJim Jagielski { 164*b1cdbd2cSJim Jagielski $tmpOffice = "$main::OFFICE_HOME_SUGGESTION/soffice"; 165*b1cdbd2cSJim Jagielski } 166*b1cdbd2cSJim Jagielski 167*b1cdbd2cSJim Jagielski my $offset = rindex($tmpOffice, "/program/soffice"); 168*b1cdbd2cSJim Jagielski if ( $offset != -1 ) 169*b1cdbd2cSJim Jagielski { 170*b1cdbd2cSJim Jagielski $main::OFFICE_HOME_SUGGESTION = substr($tmpOffice, 0, $offset); 171*b1cdbd2cSJim Jagielski } else 172*b1cdbd2cSJim Jagielski { 173*b1cdbd2cSJim Jagielski $offset = rindex($tmpOffice, "/soffice"); 174*b1cdbd2cSJim Jagielski if ( $offset != -1 ) 175*b1cdbd2cSJim Jagielski { 176*b1cdbd2cSJim Jagielski $main::OFFICE_HOME_SUGGESTION = substr($tmpOffice, 0, $offset); 177*b1cdbd2cSJim Jagielski } else 178*b1cdbd2cSJim Jagielski { 179*b1cdbd2cSJim Jagielski $main::OFFICE_HOME_SUGGESTION = ""; 180*b1cdbd2cSJim Jagielski } 181*b1cdbd2cSJim Jagielski } 182*b1cdbd2cSJim Jagielski } 183*b1cdbd2cSJim Jagielski 184*b1cdbd2cSJim Jagielski while ( (! -d "$main::OFFICE_HOME" ) || 185*b1cdbd2cSJim Jagielski ((-d "$main::OFFICE_HOME") && (! -d "$main::OFFICE_HOME/program")) ) 186*b1cdbd2cSJim Jagielski { 187*b1cdbd2cSJim Jagielski print " Enter the Office installation directory [$main::OFFICE_HOME_SUGGESTION]: "; 188*b1cdbd2cSJim Jagielski $main::OFFICE_HOME = readStdIn(); 189*b1cdbd2cSJim Jagielski chop($main::OFFICE_HOME); 190*b1cdbd2cSJim Jagielski if ( $main::OFFICE_HOME eq "" ) 191*b1cdbd2cSJim Jagielski { 192*b1cdbd2cSJim Jagielski $main::OFFICE_HOME = $main::OFFICE_HOME_SUGGESTION; 193*b1cdbd2cSJim Jagielski } 194*b1cdbd2cSJim Jagielski 195*b1cdbd2cSJim Jagielski if ( ! -d "$main::OFFICE_HOME" ) 196*b1cdbd2cSJim Jagielski { 197*b1cdbd2cSJim Jagielski $main::OFFICE_HOME = ""; 198*b1cdbd2cSJim Jagielski print " Error: An office installation is required, please specify the path to a valid installation.\n"; 199*b1cdbd2cSJim Jagielski } else 200*b1cdbd2cSJim Jagielski { 201*b1cdbd2cSJim Jagielski # special work for a network installation, no prgram directory but a link to the soffice binary 202*b1cdbd2cSJim Jagielski if ( (! -d "$main::OFFICE_HOME/program") && (-e "$main::OFFICE_HOME/soffice") ) 203*b1cdbd2cSJim Jagielski { 204*b1cdbd2cSJim Jagielski my $soserver = `ls -l $OFFICE_HOME_SUGGESTION/soffice | sed -n 's/.* -> //p'`; 205*b1cdbd2cSJim Jagielski $soserver= substr($soserver, 0, rindex($soserver, "program") - 1); 206*b1cdbd2cSJim Jagielski 207*b1cdbd2cSJim Jagielski if ( ! -d $soserver ) 208*b1cdbd2cSJim Jagielski { 209*b1cdbd2cSJim Jagielski $main::OFFICE_HOME = ""; 210*b1cdbd2cSJim Jagielski print " Error: An office installation is required, please specify the path to a valid installation.\n"; 211*b1cdbd2cSJim Jagielski } else 212*b1cdbd2cSJim Jagielski { 213*b1cdbd2cSJim Jagielski $main::OFFICE_HOME = $soserver; 214*b1cdbd2cSJim Jagielski } 215*b1cdbd2cSJim Jagielski } 216*b1cdbd2cSJim Jagielski } 217*b1cdbd2cSJim Jagielski } 218*b1cdbd2cSJim Jagielski} 219*b1cdbd2cSJim Jagielski 220*b1cdbd2cSJim Jagielski 221*b1cdbd2cSJim Jagielski# prepare GNU make path 222*b1cdbd2cSJim Jagielskiwhile ( (!$main::correctVersion) && 223*b1cdbd2cSJim Jagielski ((! -d "$main::OO_SDK_MAKE_HOME" ) || 224*b1cdbd2cSJim Jagielski ((-d "$main::OO_SDK_MAKE_HOME") && (! -e "$main::OO_SDK_MAKE_HOME/$main::makeName"))) ) 225*b1cdbd2cSJim Jagielski{ 226*b1cdbd2cSJim Jagielski print " Enter GNU make ($main::makeVersion or higher) tools directory [$main::OO_SDK_MAKE_HOME_SUGGESTION]: "; 227*b1cdbd2cSJim Jagielski $main::OO_SDK_MAKE_HOME = readStdIn(); 228*b1cdbd2cSJim Jagielski chop($main::OO_SDK_MAKE_HOME); 229*b1cdbd2cSJim Jagielski if ( $main::OO_SDK_MAKE_HOME eq "" ) 230*b1cdbd2cSJim Jagielski { 231*b1cdbd2cSJim Jagielski $main::OO_SDK_MAKE_HOME = $main::OO_SDK_MAKE_HOME_SUGGESTION; 232*b1cdbd2cSJim Jagielski } 233*b1cdbd2cSJim Jagielski if ( (! -d "$main::OO_SDK_MAKE_HOME") || 234*b1cdbd2cSJim Jagielski ((-d "$main::OO_SDK_MAKE_HOME") && (! -e "$main::OO_SDK_MAKE_HOME/$main::makeName")) ) 235*b1cdbd2cSJim Jagielski { 236*b1cdbd2cSJim Jagielski $main::OO_SDK_MAKE_HOME = ""; 237*b1cdbd2cSJim Jagielski print " Error: GNU make is required, please specify a GNU make tools directory.\n"; 238*b1cdbd2cSJim Jagielski } else 239*b1cdbd2cSJim Jagielski { 240*b1cdbd2cSJim Jagielski #check version 241*b1cdbd2cSJim Jagielski my $testVersion = `$OO_SDK_MAKE_HOME/$main::makeName --version`; 242*b1cdbd2cSJim Jagielski if ( $testVersion eq "") 243*b1cdbd2cSJim Jagielski { 244*b1cdbd2cSJim Jagielski print " Set the environment variable OO_SDK_MAKE_HOME to your GNU build tools directory.\n"; 245*b1cdbd2cSJim Jagielski print " GNU make version $main::makeVersion can be obtained at ftp://ftp.gnu.org/gnu/make/\n"; 246*b1cdbd2cSJim Jagielski } else 247*b1cdbd2cSJim Jagielski { 248*b1cdbd2cSJim Jagielski if ($testVersion =~ m#((\d+\.)+\d+)# ) 249*b1cdbd2cSJim Jagielski { 250*b1cdbd2cSJim Jagielski $testVersion = $1; 251*b1cdbd2cSJim Jagielski } 252*b1cdbd2cSJim Jagielski $main::correctVersion = testVersion($main::makeVersion, $testVersion, "$main::OO_SDK_MAKE_HOME/$main::makeName", 1); 253*b1cdbd2cSJim Jagielski if ( !$main::correctVersion ) 254*b1cdbd2cSJim Jagielski { 255*b1cdbd2cSJim Jagielski print " The '$main::makeName' command found at '$main::OO_SDK_MAKE_HOME' has a wrong version\n"; 256*b1cdbd2cSJim Jagielski $main::OO_SDK_MAKE_HOME = ""; 257*b1cdbd2cSJim Jagielski } 258*b1cdbd2cSJim Jagielski } 259*b1cdbd2cSJim Jagielski } 260*b1cdbd2cSJim Jagielski} 261*b1cdbd2cSJim Jagielski 262*b1cdbd2cSJim Jagielski# prepare zip path 263*b1cdbd2cSJim Jagielski$main::correctVersion = 0; 264*b1cdbd2cSJim Jagielskiwhile ( (!$main::correctVersion) && 265*b1cdbd2cSJim Jagielski ((! -d "$main::OO_SDK_ZIP_HOME" ) || 266*b1cdbd2cSJim Jagielski ((-d "$main::OO_SDK_ZIP_HOME") && (! -e "$main::OO_SDK_ZIP_HOME/zip"))) ) 267*b1cdbd2cSJim Jagielski{ 268*b1cdbd2cSJim Jagielski print " Enter zip ($main::zipVersion or higher) tool directory [$main::OO_SDK_ZIP_HOME_SUGGESTION]: "; 269*b1cdbd2cSJim Jagielski $main::OO_SDK_ZIP_HOME = readStdIn(); 270*b1cdbd2cSJim Jagielski chop($main::OO_SDK_ZIP_HOME); 271*b1cdbd2cSJim Jagielski if ( $main::OO_SDK_ZIP_HOME eq "" ) 272*b1cdbd2cSJim Jagielski { 273*b1cdbd2cSJim Jagielski $main::OO_SDK_ZIP_HOME = $main::OO_SDK_ZIP_HOME_SUGGESTION; 274*b1cdbd2cSJim Jagielski } 275*b1cdbd2cSJim Jagielski if ( (! -d "$main::OO_SDK_ZIP_HOME") || 276*b1cdbd2cSJim Jagielski ((-d "$main::OO_SDK_ZIP_HOME") && (! -e "$main::OO_SDK_ZIP_HOME/zip")) ) 277*b1cdbd2cSJim Jagielski { 278*b1cdbd2cSJim Jagielski $main::OO_SDK_ZIP_HOME = ""; 279*b1cdbd2cSJim Jagielski print " Error: zip tool is required, please specify a zip tool directory.\n"; 280*b1cdbd2cSJim Jagielski } else 281*b1cdbd2cSJim Jagielski { 282*b1cdbd2cSJim Jagielski #check version 283*b1cdbd2cSJim Jagielski my $testVersion = `$OO_SDK_ZIP_HOME/zip -h 2>&1 | egrep Zip | head -n 1`; 284*b1cdbd2cSJim Jagielski $testVersion =~ s#Zip ([\d.]+) .*#$1#go; 285*b1cdbd2cSJim Jagielski if ( $testVersion eq "") 286*b1cdbd2cSJim Jagielski { 287*b1cdbd2cSJim Jagielski print " Set the environment variable OO_SDK_ZIP_HOME to your zip tool directory.\n"; 288*b1cdbd2cSJim Jagielski print " zip version $main::zipVersion can be obtained at ftp://www.info-zip.org/\n"; 289*b1cdbd2cSJim Jagielski } else 290*b1cdbd2cSJim Jagielski { 291*b1cdbd2cSJim Jagielski if ($testVersion =~ m#((\d+\.)+\d+)# ) 292*b1cdbd2cSJim Jagielski { 293*b1cdbd2cSJim Jagielski $testVersion = $1; 294*b1cdbd2cSJim Jagielski } 295*b1cdbd2cSJim Jagielski $main::correctVersion = testVersion($main::zipVersion, $testVersion, "$main::OO_SDK_MAKE_HOME/zip", 1); 296*b1cdbd2cSJim Jagielski if ( !$main::correctVersion ) 297*b1cdbd2cSJim Jagielski { 298*b1cdbd2cSJim Jagielski print " The 'zip' command found at '$main::OO_SDK_ZIP_HOME' has a wrong version\n"; 299*b1cdbd2cSJim Jagielski $main::OO_SDK_ZIP_HOME = ""; 300*b1cdbd2cSJim Jagielski } 301*b1cdbd2cSJim Jagielski } 302*b1cdbd2cSJim Jagielski } 303*b1cdbd2cSJim Jagielski} 304*b1cdbd2cSJim Jagielski 305*b1cdbd2cSJim Jagielski# prepare cat path 306*b1cdbd2cSJim Jagielski$main::correctVersion = 0; 307*b1cdbd2cSJim Jagielskiwhile ( (!$main::correctVersion) && 308*b1cdbd2cSJim Jagielski ((! -d "$main::OO_SDK_CAT_HOME" ) || 309*b1cdbd2cSJim Jagielski ((-d "$main::OO_SDK_CAT_HOME") && (! -e "$main::OO_SDK_CAT_HOME/cat"))) ) 310*b1cdbd2cSJim Jagielski{ 311*b1cdbd2cSJim Jagielski print " Enter cat tool directory [$main::OO_SDK_CAT_HOME_SUGGESTION]: "; 312*b1cdbd2cSJim Jagielski $main::OO_SDK_CAT_HOME = readStdIn(); 313*b1cdbd2cSJim Jagielski chop($main::OO_SDK_CAT_HOME); 314*b1cdbd2cSJim Jagielski if ( $main::OO_SDK_CAT_HOME eq "" ) 315*b1cdbd2cSJim Jagielski { 316*b1cdbd2cSJim Jagielski $main::OO_SDK_CAT_HOME = $main::OO_SDK_CAT_HOME_SUGGESTION; 317*b1cdbd2cSJim Jagielski } 318*b1cdbd2cSJim Jagielski if ( (! -d "$main::OO_SDK_CAT_HOME") || 319*b1cdbd2cSJim Jagielski ((-d "$main::OO_SDK_CAT_HOME") && (! -e "$main::OO_SDK_CAT_HOME/cat")) ) 320*b1cdbd2cSJim Jagielski { 321*b1cdbd2cSJim Jagielski $main::OO_SDK_CAT_HOME = ""; 322*b1cdbd2cSJim Jagielski print " Error: cat tool is required, please specify a cat tool directory.\n"; 323*b1cdbd2cSJim Jagielski } 324*b1cdbd2cSJim Jagielski # else ... 325*b1cdbd2cSJim Jagielski # TODO check version 326*b1cdbd2cSJim Jagielski # NOTE: only Linux cat understands --version 327*b1cdbd2cSJim Jagielski} 328*b1cdbd2cSJim Jagielski 329*b1cdbd2cSJim Jagielski# prepare sed path 330*b1cdbd2cSJim Jagielski$main::correctVersion = 0; 331*b1cdbd2cSJim Jagielskiwhile ( (!$main::correctVersion) && 332*b1cdbd2cSJim Jagielski ((! -d "$main::OO_SDK_SED_HOME" ) || 333*b1cdbd2cSJim Jagielski ((-d "$main::OO_SDK_SED_HOME") && (! -e "$main::OO_SDK_SED_HOME/sed"))) ) 334*b1cdbd2cSJim Jagielski{ 335*b1cdbd2cSJim Jagielski print " Enter sed tool directory [$main::OO_SDK_SED_HOME_SUGGESTION]: "; 336*b1cdbd2cSJim Jagielski $main::OO_SDK_SED_HOME = readStdIn(); 337*b1cdbd2cSJim Jagielski chop($main::OO_SDK_SED_HOME); 338*b1cdbd2cSJim Jagielski if ( $main::OO_SDK_SED_HOME eq "" ) 339*b1cdbd2cSJim Jagielski { 340*b1cdbd2cSJim Jagielski $main::OO_SDK_SED_HOME = $main::OO_SDK_SED_HOME_SUGGESTION; 341*b1cdbd2cSJim Jagielski } 342*b1cdbd2cSJim Jagielski if ( (! -d "$main::OO_SDK_SED_HOME") || 343*b1cdbd2cSJim Jagielski ((-d "$main::OO_SDK_SED_HOME") && (! -e "$main::OO_SDK_SED_HOME/sed")) ) 344*b1cdbd2cSJim Jagielski { 345*b1cdbd2cSJim Jagielski $main::OO_SDK_SED_HOME = ""; 346*b1cdbd2cSJim Jagielski print " Error: sed tool is required, please specify a sed tool directory.\n"; 347*b1cdbd2cSJim Jagielski } 348*b1cdbd2cSJim Jagielski # else ... 349*b1cdbd2cSJim Jagielski # TODO check version 350*b1cdbd2cSJim Jagielski # NOTE: only Linux sed understands --version 351*b1cdbd2cSJim Jagielski} 352*b1cdbd2cSJim Jagielski 353*b1cdbd2cSJim Jagielski# prepare C++ compiler path 354*b1cdbd2cSJim Jagielski$main::correctVersion = 0; 355*b1cdbd2cSJim Jagielskiwhile ( (!$main::correctVersion) && 356*b1cdbd2cSJim Jagielski ((! -d "$main::OO_SDK_CPP_HOME" ) || 357*b1cdbd2cSJim Jagielski ((-d "$main::OO_SDK_CPP_HOME") && (! -e "$main::OO_SDK_CPP_HOME/$main::cpp"))) ) 358*b1cdbd2cSJim Jagielski{ 359*b1cdbd2cSJim Jagielski print " C++ compilers where for example a language binding exist:\n"; 360*b1cdbd2cSJim Jagielski print " - Solaris, Sun WorkShop 6 update 1 C++ 5.2 2000/09/11 or higher\n"; 361*b1cdbd2cSJim Jagielski print " - Linux, GNU C++ compiler, gcc version 4.0.1 or higher\n"; 362*b1cdbd2cSJim Jagielski print " - MacOS 64bit, Apple LLVM version 4.2 (clang-425.0.28) or higher\n"; 363*b1cdbd2cSJim Jagielski print " on MacOS auto detected using xcrun -f clang'\n"; 364*b1cdbd2cSJim Jagielski 365*b1cdbd2cSJim Jagielski if ( $main::operatingSystem =~ m/darwin/ ) 366*b1cdbd2cSJim Jagielski { 367*b1cdbd2cSJim Jagielski # xcrun is used to find the correct clang compiler, just print the result as information 368*b1cdbd2cSJim Jagielski $main::OO_SDK_CPP_HOME = $main::OO_SDK_CPP_HOME_SUGGESTION; 369*b1cdbd2cSJim Jagielski print " Used clang compiler: $main::OO_SDK_CPP_HOME\n"; 370*b1cdbd2cSJim Jagielski } else 371*b1cdbd2cSJim Jagielski { 372*b1cdbd2cSJim Jagielski print " Enter the directory of the C++ compiler, the directory\n"; 373*b1cdbd2cSJim Jagielski print " where the compiler is located (optional) [$main::OO_SDK_CPP_HOME_SUGGESTION]: "; 374*b1cdbd2cSJim Jagielski 375*b1cdbd2cSJim Jagielski $main::OO_SDK_CPP_HOME = readStdIn(); 376*b1cdbd2cSJim Jagielski chop($main::OO_SDK_CPP_HOME); 377*b1cdbd2cSJim Jagielski if ( $main::OO_SDK_CPP_HOME eq "" ) 378*b1cdbd2cSJim Jagielski { 379*b1cdbd2cSJim Jagielski $main::OO_SDK_CPP_HOME = $main::OO_SDK_CPP_HOME_SUGGESTION; 380*b1cdbd2cSJim Jagielski } 381*b1cdbd2cSJim Jagielski } 382*b1cdbd2cSJim Jagielski 383*b1cdbd2cSJim Jagielski if ( (!$main::operatingSystem =~ m/darwin/) && (! $main::OO_SDK_CPP_HOME eq "") ) 384*b1cdbd2cSJim Jagielski { 385*b1cdbd2cSJim Jagielski if ( (! -d "$main::OO_SDK_CPP_HOME") || 386*b1cdbd2cSJim Jagielski ((-d "$main::OO_SDK_CPP_HOME") && (! -e "$main::OO_SDK_CPP_HOME/$main::cppName")) ) 387*b1cdbd2cSJim Jagielski { 388*b1cdbd2cSJim Jagielski print " Error: Could not find directory '$main::OO_SDK_CPP_HOME'.\n"; 389*b1cdbd2cSJim Jagielski if ( skipChoice("C++ compiler") == 1 ) 390*b1cdbd2cSJim Jagielski { 391*b1cdbd2cSJim Jagielski $main::correctVersion = 1; 392*b1cdbd2cSJim Jagielski } 393*b1cdbd2cSJim Jagielski $main::OO_SDK_CPP_HOME = ""; 394*b1cdbd2cSJim Jagielski } else 395*b1cdbd2cSJim Jagielski { 396*b1cdbd2cSJim Jagielski #check version 397*b1cdbd2cSJim Jagielski if ( $main::cppName eq "gcc" ) 398*b1cdbd2cSJim Jagielski { 399*b1cdbd2cSJim Jagielski my $testVersion = `$OO_SDK_CPP_HOME/$main::cppName -dumpversion`; 400*b1cdbd2cSJim Jagielski if ( $testVersion eq "") 401*b1cdbd2cSJim Jagielski { 402*b1cdbd2cSJim Jagielski print " The '$main::cppName' command found at $main::OO_SDK_CPP_HOME/$main::cppName is not a "; 403*b1cdbd2cSJim Jagielski print " GNU compiler.\nSet the environment variable OO_SDK_CPP_HOME to your GNU build tools "; 404*b1cdbd2cSJim Jagielski print " directory.\nA GNU compiler version $main::cppVersion can be obtained at "; 405*b1cdbd2cSJim Jagielski print " ftp://ftp.gnu.org/gnu/gcc/\n"; 406*b1cdbd2cSJim Jagielski } else 407*b1cdbd2cSJim Jagielski { 408*b1cdbd2cSJim Jagielski $main::correctVersion = testVersion($main::cppVersion, $testVersion, "$main::OO_SDK_CPP_HOME/$main::cppName", 1); 409*b1cdbd2cSJim Jagielski if ( !$main::correctVersion ) 410*b1cdbd2cSJim Jagielski { 411*b1cdbd2cSJim Jagielski print " The '$main::cppName' command found at '$main::OO_SDK_CPP_HOME' has a wrong version\n"; 412*b1cdbd2cSJim Jagielski if ( skipChoice("C++ compiler") == 1 ) 413*b1cdbd2cSJim Jagielski { 414*b1cdbd2cSJim Jagielski $main::correctVersion = 1; 415*b1cdbd2cSJim Jagielski } 416*b1cdbd2cSJim Jagielski 417*b1cdbd2cSJim Jagielski $main::OO_SDK_CPP_HOME = ""; 418*b1cdbd2cSJim Jagielski } 419*b1cdbd2cSJim Jagielski } 420*b1cdbd2cSJim Jagielski } else 421*b1cdbd2cSJim Jagielski { 422*b1cdbd2cSJim Jagielski # for Solaris we have to check the version too 423*b1cdbd2cSJim Jagielski open(FILE, "$OO_SDK_CPP_HOME/$main::cppName -V 2>&1 |"); 424*b1cdbd2cSJim Jagielski my @lines = <FILE>; 425*b1cdbd2cSJim Jagielski my $testVersion = $lines[0]; 426*b1cdbd2cSJim Jagielski if ( $testVersion eq "") 427*b1cdbd2cSJim Jagielski { 428*b1cdbd2cSJim Jagielski print " The '$main::cppName' command found at $main::OO_SDK_CPP_HOME/$main::cppName is not a "; 429*b1cdbd2cSJim Jagielski print " Solaris C++ compiler.\nSet the environment variable OO_SDK_CPP_HOME to your Solaris C++ compiler directory.\n"; 430*b1cdbd2cSJim Jagielski } else 431*b1cdbd2cSJim Jagielski { 432*b1cdbd2cSJim Jagielski if ($testVersion =~ m#((\d+\.)+\d+)# ) 433*b1cdbd2cSJim Jagielski { 434*b1cdbd2cSJim Jagielski $testVersion = $1; 435*b1cdbd2cSJim Jagielski } 436*b1cdbd2cSJim Jagielski $main::correctVersion = testVersion($main::cppVersion, $testVersion, "$main::OO_SDK_CPP_HOME/$main::cppName", 1); 437*b1cdbd2cSJim Jagielski if ( !$main::correctVersion ) 438*b1cdbd2cSJim Jagielski { 439*b1cdbd2cSJim Jagielski print " The '$main::cppName' command found at '$main::OO_SDK_CPP_HOME' has a wrong version\n"; 440*b1cdbd2cSJim Jagielski if ( skipChoice("C++ compiler") == 1 ) 441*b1cdbd2cSJim Jagielski { 442*b1cdbd2cSJim Jagielski $main::correctVersion = 1; 443*b1cdbd2cSJim Jagielski } 444*b1cdbd2cSJim Jagielski 445*b1cdbd2cSJim Jagielski $main::OO_SDK_CPP_HOME = ""; 446*b1cdbd2cSJim Jagielski } else { 447*b1cdbd2cSJim Jagielski $main::correctVersion = testVersion("5.5", $testVersion, "$main::OO_SDK_CPP_HOME/$main::cppName", 2); 448*b1cdbd2cSJim Jagielski if ( $main::correctVersion ) { 449*b1cdbd2cSJim Jagielski $main::OO_SDK_CC_55_OR_HIGHER = $testVersion; 450*b1cdbd2cSJim Jagielski } 451*b1cdbd2cSJim Jagielski } 452*b1cdbd2cSJim Jagielski } 453*b1cdbd2cSJim Jagielski } 454*b1cdbd2cSJim Jagielski } 455*b1cdbd2cSJim Jagielski } else 456*b1cdbd2cSJim Jagielski { 457*b1cdbd2cSJim Jagielski # the C++ compiler is optional 458*b1cdbd2cSJim Jagielski $main::correctVersion = 1; 459*b1cdbd2cSJim Jagielski } 460*b1cdbd2cSJim Jagielski} 461*b1cdbd2cSJim Jagielski 462*b1cdbd2cSJim Jagielski 463*b1cdbd2cSJim Jagielski# prepare Java path 464*b1cdbd2cSJim Jagielski$main::correctVersion = 0; 465*b1cdbd2cSJim Jagielski 466*b1cdbd2cSJim Jagielski# prepare Java suggestion (cut bin or Commands directory to be in the root of the Java SDK) 467*b1cdbd2cSJim Jagielski$main::offset = rindex($main::OO_SDK_JAVA_HOME_SUGGESTION, "/$main::OO_SDK_JAVA_BIN_DIR"); 468*b1cdbd2cSJim Jagielskiif ( $main::offset != -1 ) 469*b1cdbd2cSJim Jagielski{ 470*b1cdbd2cSJim Jagielski $main::OO_SDK_JAVA_HOME_SUGGESTION = substr($main::OO_SDK_JAVA_HOME_SUGGESTION, 0, $main::offset); 471*b1cdbd2cSJim Jagielski} 472*b1cdbd2cSJim Jagielski 473*b1cdbd2cSJim Jagielskiwhile ( (!$main::correctVersion) && 474*b1cdbd2cSJim Jagielski ((! -d "$main::OO_SDK_JAVA_HOME" ) || 475*b1cdbd2cSJim Jagielski ((-d "$main::OO_SDK_JAVA_HOME") && (! -e "$main::OO_SDK_JAVA_HOME/$main::OO_SDK_JAVA_BIN_DIR/javac"))) ) 476*b1cdbd2cSJim Jagielski{ 477*b1cdbd2cSJim Jagielski print " Enter Java SDK (1.5, recommendation is 1.6 or higher) installation directory (optional) [$main::OO_SDK_JAVA_HOME_SUGGESTION]: "; 478*b1cdbd2cSJim Jagielski $main::OO_SDK_JAVA_HOME = readStdIn(); 479*b1cdbd2cSJim Jagielski chop($main::OO_SDK_JAVA_HOME); 480*b1cdbd2cSJim Jagielski if ( $main::OO_SDK_JAVA_HOME eq "" ) 481*b1cdbd2cSJim Jagielski { 482*b1cdbd2cSJim Jagielski $main::OO_SDK_JAVA_HOME = $main::OO_SDK_JAVA_HOME_SUGGESTION; 483*b1cdbd2cSJim Jagielski } 484*b1cdbd2cSJim Jagielski if ( ! $main::OO_SDK_JAVA_HOME eq "" ) 485*b1cdbd2cSJim Jagielski { 486*b1cdbd2cSJim Jagielski if ( (! -d "$main::OO_SDK_JAVA_HOME") || 487*b1cdbd2cSJim Jagielski ((-d "$main::OO_SDK_JAVA_HOME") && (! -e "$main::OO_SDK_JAVA_HOME/$main::OO_SDK_JAVA_BIN_DIR/javac")) ) 488*b1cdbd2cSJim Jagielski { 489*b1cdbd2cSJim Jagielski 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"; 490*b1cdbd2cSJim Jagielski if ( skipChoice("JAVA SDK") == 1 ) 491*b1cdbd2cSJim Jagielski { 492*b1cdbd2cSJim Jagielski $main::correctVersion = 1; 493*b1cdbd2cSJim Jagielski } 494*b1cdbd2cSJim Jagielski $main::OO_SDK_JAVA_HOME = ""; 495*b1cdbd2cSJim Jagielski } else 496*b1cdbd2cSJim Jagielski { 497*b1cdbd2cSJim Jagielski #check version 498*b1cdbd2cSJim Jagielski 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#".*##'`; 499*b1cdbd2cSJim Jagielski $testVersion =~ s#([^\n]+)\n#$1#go; 500*b1cdbd2cSJim Jagielski 501*b1cdbd2cSJim Jagielski $main::correctVersion = testVersion($main::javaVersion, $testVersion, "$main::OO_SDK_JAVA_HOME/$main::OO_SDK_JAVA_BIN_DIR/java", 1); 502*b1cdbd2cSJim Jagielski if ( !$main::correctVersion ) 503*b1cdbd2cSJim Jagielski { 504*b1cdbd2cSJim Jagielski if ( skipChoice("JAVA SDK") == 1 ) 505*b1cdbd2cSJim Jagielski { 506*b1cdbd2cSJim Jagielski $main::correctVersion = 1; 507*b1cdbd2cSJim Jagielski } 508*b1cdbd2cSJim Jagielski $main::OO_SDK_JAVA_HOME = ""; 509*b1cdbd2cSJim Jagielski } 510*b1cdbd2cSJim Jagielski } 511*b1cdbd2cSJim Jagielski }else 512*b1cdbd2cSJim Jagielski { 513*b1cdbd2cSJim Jagielski # the Java SDK is optional 514*b1cdbd2cSJim Jagielski $main::correctVersion = 1; 515*b1cdbd2cSJim Jagielski } 516*b1cdbd2cSJim Jagielski} 517*b1cdbd2cSJim Jagielski 518*b1cdbd2cSJim Jagielski# prepare boost directory (optional) 519*b1cdbd2cSJim Jagielskiwhile ( (!$main::skipBoostDir) && 520*b1cdbd2cSJim Jagielski ((! -d "$main::OO_SDK_BOOST_HOME" ) || 521*b1cdbd2cSJim Jagielski ((-d "$main::OO_SDK_BOOST_HOME") && (! -e "$main::OO_SDK_BOOST_HOME/boost/tr1/unordered_map.hpp"))) ) 522*b1cdbd2cSJim Jagielski{ 523*b1cdbd2cSJim Jagielski 524*b1cdbd2cSJim Jagielski print " Enter boost directory [$main::OO_SDK_BOOST_HOME_SUGGESTION]: "; 525*b1cdbd2cSJim Jagielski $main::OO_SDK_BOOST_HOME = readStdIn(); 526*b1cdbd2cSJim Jagielski chop($main::OO_SDK_BOOST_HOME); 527*b1cdbd2cSJim Jagielski if ( $main::OO_SDK_BOOST_HOME eq "" ) 528*b1cdbd2cSJim Jagielski { 529*b1cdbd2cSJim Jagielski $main::OO_SDK_BOOST_HOME = $main::OO_SDK_BOOST_HOME_SUGGESTION; 530*b1cdbd2cSJim Jagielski } 531*b1cdbd2cSJim Jagielski if ( (! -d "$main::OO_SDK_BOOST_HOME") || 532*b1cdbd2cSJim Jagielski ((-d "$main::OO_SDK_BOOST_HOME") && (! -e "$main::OO_SDK_BOOST_HOME/boost/tr1/unordered_map.hpp")) ) 533*b1cdbd2cSJim Jagielski { 534*b1cdbd2cSJim Jagielski print " Error: boost couldn't be find or verified, please specify a boost directory.\n"; 535*b1cdbd2cSJim Jagielski if ( skipChoice("optional output directory") == 1 ) 536*b1cdbd2cSJim Jagielski { 537*b1cdbd2cSJim Jagielski $main::skipBoostDir = 1; 538*b1cdbd2cSJim Jagielski } 539*b1cdbd2cSJim Jagielski $main::OO_SDK_BOOST_HOME = ""; 540*b1cdbd2cSJim Jagielski } else 541*b1cdbd2cSJim Jagielski { 542*b1cdbd2cSJim Jagielski # the boost directory is optional 543*b1cdbd2cSJim Jagielski $main::skipBoostDir = 1; 544*b1cdbd2cSJim Jagielski } 545*b1cdbd2cSJim Jagielski} 546*b1cdbd2cSJim Jagielski 547*b1cdbd2cSJim Jagielski# prepare output directory (optional) 548*b1cdbd2cSJim Jagielskiwhile ( (!$main::skipOutputDir) && 549*b1cdbd2cSJim Jagielski (! -d "$main::OO_SDK_OUTPUT_DIR") ) 550*b1cdbd2cSJim Jagielski{ 551*b1cdbd2cSJim Jagielski print " Default output directory is in your HOME directory.\n"; 552*b1cdbd2cSJim Jagielski print " Enter an existent directory if you prefer a different output directory (optional) [$main::OO_SDK_OUTPUT_DIR_SUGGESTION]: "; 553*b1cdbd2cSJim Jagielski 554*b1cdbd2cSJim Jagielski $main::OO_SDK_OUTPUT_DIR = readStdIn(); 555*b1cdbd2cSJim Jagielski 556*b1cdbd2cSJim Jagielski chop($main::OO_SDK_OUTPUT_DIR); 557*b1cdbd2cSJim Jagielski if ( $main::OO_SDK_OUTPUT_DIR eq "" ) 558*b1cdbd2cSJim Jagielski { 559*b1cdbd2cSJim Jagielski $main::OO_SDK_OUTPUT_DIR = $main::OO_SDK_OUTPUT_DIR_SUGGESTION; 560*b1cdbd2cSJim Jagielski } 561*b1cdbd2cSJim Jagielski if ( ! $main::OO_SDK_OUTPUT_DIR eq "" ) 562*b1cdbd2cSJim Jagielski { 563*b1cdbd2cSJim Jagielski if ( ! -d "$main::OO_SDK_OUTPUT_DIR" ) 564*b1cdbd2cSJim Jagielski { 565*b1cdbd2cSJim Jagielski print " Error: Could not find directory '$main::OO_SDK_OUTPUT_DIR'.\n"; 566*b1cdbd2cSJim Jagielski if ( skipChoice("optional output directory") == 1 ) 567*b1cdbd2cSJim Jagielski { 568*b1cdbd2cSJim Jagielski $main::skipOutputDir = 1; 569*b1cdbd2cSJim Jagielski } 570*b1cdbd2cSJim Jagielski $main::OO_SDK_OUTPUT_DIR = ""; 571*b1cdbd2cSJim Jagielski } 572*b1cdbd2cSJim Jagielski } else 573*b1cdbd2cSJim Jagielski { 574*b1cdbd2cSJim Jagielski # the output directory is optional 575*b1cdbd2cSJim Jagielski $main::skipOutputDir = 1; 576*b1cdbd2cSJim Jagielski } 577*b1cdbd2cSJim Jagielski} 578*b1cdbd2cSJim Jagielski 579*b1cdbd2cSJim Jagielski# prepare auto deployment 580*b1cdbd2cSJim Jagielskiwhile ( $main::SDK_AUTO_DEPLOYMENT eq "" || 581*b1cdbd2cSJim Jagielski ((! $main::SDK_AUTO_DEPLOYMENT eq "YES") && 582*b1cdbd2cSJim Jagielski (! $main::SDK_AUTO_DEPLOYMENT eq "NO")) ) 583*b1cdbd2cSJim Jagielski{ 584*b1cdbd2cSJim Jagielski print " Automatic deployment of UNO components (YES/NO) [$main::SDK_AUTO_DEPLOYMENT_SUGGESTION]: "; 585*b1cdbd2cSJim Jagielski $main::SDK_AUTO_DEPLOYMENT = uc <STDIN>; 586*b1cdbd2cSJim Jagielski chop($main::SDK_AUTO_DEPLOYMENT); 587*b1cdbd2cSJim Jagielski if ( $main::SDK_AUTO_DEPLOYMENT eq "" ) 588*b1cdbd2cSJim Jagielski { 589*b1cdbd2cSJim Jagielski $main::SDK_AUTO_DEPLOYMENT = "YES"; 590*b1cdbd2cSJim Jagielski } 591*b1cdbd2cSJim Jagielski} 592*b1cdbd2cSJim Jagielski 593*b1cdbd2cSJim JagielskiprepareScriptFile("setsdkenv_unix.sh.in", "setsdkenv_unix.sh"); 594*b1cdbd2cSJim Jagielskichmod 0644, "$main::OO_SDK_CONFIG_HOME/$main::hostname/setsdkenv_unix.sh"; 595*b1cdbd2cSJim Jagielski 596*b1cdbd2cSJim Jagielskiprint "\n"; 597*b1cdbd2cSJim Jagielskiprint " ************************************************************************\n"; 598*b1cdbd2cSJim Jagielskiprint " * ... your SDK environment has been prepared.\n"; 599*b1cdbd2cSJim Jagielskiprint " * For each time you want to use this configured SDK environment, you\n"; 600*b1cdbd2cSJim Jagielskiprint " * have to run the \"setsdkenv_unix\" script file!\n"; 601*b1cdbd2cSJim Jagielskiprint " * Alternatively can you source one of the scripts\n"; 602*b1cdbd2cSJim Jagielskiprint " * \"$main::OO_SDK_CONFIG_HOME/$main::hostname/setsdkenv_unix.sh\"\n"; 603*b1cdbd2cSJim Jagielskiprint " * to get an environment without starting a new shell.\n"; 604*b1cdbd2cSJim Jagielskiprint " ************************************************************************\n\n"; 605*b1cdbd2cSJim Jagielski 606*b1cdbd2cSJim Jagielskiexit $return; 607*b1cdbd2cSJim Jagielski 608*b1cdbd2cSJim Jagielskisub skipChoice 609*b1cdbd2cSJim Jagielski{ 610*b1cdbd2cSJim Jagielski my $msg = shift; 611*b1cdbd2cSJim Jagielski my $skip = ""; 612*b1cdbd2cSJim Jagielski while ( !( $skip eq "yes" || $skip eq "no") ) 613*b1cdbd2cSJim Jagielski { 614*b1cdbd2cSJim Jagielski print " Do you want to skip the choice of the '$msg' (YES/NO): [YES] "; 615*b1cdbd2cSJim Jagielski $skip = lc <STDIN>; 616*b1cdbd2cSJim Jagielski chop($skip); 617*b1cdbd2cSJim Jagielski if ( $skip eq "" ) { $skip = "yes"; } # default 618*b1cdbd2cSJim Jagielski if ( $skip eq "yes" ) 619*b1cdbd2cSJim Jagielski { 620*b1cdbd2cSJim Jagielski return 1; 621*b1cdbd2cSJim Jagielski } 622*b1cdbd2cSJim Jagielski } 623*b1cdbd2cSJim Jagielski return 0; 624*b1cdbd2cSJim Jagielski} 625*b1cdbd2cSJim Jagielski 626*b1cdbd2cSJim Jagielskisub resolveLink 627*b1cdbd2cSJim Jagielski{ 628*b1cdbd2cSJim Jagielski my $base= shift; 629*b1cdbd2cSJim Jagielski my $link= shift; 630*b1cdbd2cSJim Jagielski 631*b1cdbd2cSJim Jagielski my $resolvedpath = "$base/$link"; 632*b1cdbd2cSJim Jagielski my $linktarget = readlink "$resolvedpath"; 633*b1cdbd2cSJim Jagielski my $resolvedlink = ""; 634*b1cdbd2cSJim Jagielski 635*b1cdbd2cSJim Jagielski while ( $linktarget ne "") { 636*b1cdbd2cSJim Jagielski 637*b1cdbd2cSJim Jagielski if ( $linktarget =~ m/^\/.*/ ) 638*b1cdbd2cSJim Jagielski { 639*b1cdbd2cSJim Jagielski $resolvedpath = "$linktarget"; 640*b1cdbd2cSJim Jagielski } else { 641*b1cdbd2cSJim Jagielski $resolvedpath = `cd $base/$linktarget; pwd`; 642*b1cdbd2cSJim Jagielski chop $resolvedpath; 643*b1cdbd2cSJim Jagielski } 644*b1cdbd2cSJim Jagielski $base = dirname("$resolvedpath"); 645*b1cdbd2cSJim Jagielski 646*b1cdbd2cSJim Jagielski $linktarget = readlink "$resolvedpath"; 647*b1cdbd2cSJim Jagielski } 648*b1cdbd2cSJim Jagielski 649*b1cdbd2cSJim Jagielski $resolvedlink = `cd $resolvedpath; pwd`; 650*b1cdbd2cSJim Jagielski chop $resolvedlink; 651*b1cdbd2cSJim Jagielski return $resolvedlink; 652*b1cdbd2cSJim Jagielski} 653*b1cdbd2cSJim Jagielski 654*b1cdbd2cSJim Jagielskisub searchprog 655*b1cdbd2cSJim Jagielski{ 656*b1cdbd2cSJim Jagielski my $_search= shift; 657*b1cdbd2cSJim Jagielski my $tmpPath = `echo "\$PATH"`; 658*b1cdbd2cSJim Jagielski my @pathList = split(":" , $tmpPath); 659*b1cdbd2cSJim Jagielski my $progDir = ""; 660*b1cdbd2cSJim Jagielski 661*b1cdbd2cSJim Jagielski if ( $_search eq "javac" ) 662*b1cdbd2cSJim Jagielski { 663*b1cdbd2cSJim Jagielski if ( $main::operatingSystem =~ m/darwin/ ) { 664*b1cdbd2cSJim Jagielski $progDir = resolveLink("/System/Library/Frameworks/JavaVM.Framework/Versions", "CurrentJDK"); 665*b1cdbd2cSJim Jagielski 666*b1cdbd2cSJim Jagielski if ( -e "$progDir/$main::OO_SDK_JAVA_BIN_DIR/javac" ) 667*b1cdbd2cSJim Jagielski { 668*b1cdbd2cSJim Jagielski return "$progDir/$main::OO_SDK_JAVA_BIN_DIR"; 669*b1cdbd2cSJim Jagielski } 670*b1cdbd2cSJim Jagielski } 671*b1cdbd2cSJim Jagielski 672*b1cdbd2cSJim Jagielski if ( $main::operatingSystem =~ m/solaris/ ) { 673*b1cdbd2cSJim Jagielski $progDir = resolveLink("/usr/jdk", "latest"); 674*b1cdbd2cSJim Jagielski if ( -e "$progDir/$main::OO_SDK_JAVA_BIN_DIR/javac" ) 675*b1cdbd2cSJim Jagielski { 676*b1cdbd2cSJim Jagielski return "$progDir/$main::OO_SDK_JAVA_BIN_DIR"; 677*b1cdbd2cSJim Jagielski } 678*b1cdbd2cSJim Jagielski } 679*b1cdbd2cSJim Jagielski } 680*b1cdbd2cSJim Jagielski 681*b1cdbd2cSJim Jagielski if ( $_search eq "gmake" && $main::operatingSystem =~ m/solaris/ ) { 682*b1cdbd2cSJim Jagielski if ( -e "/usr/sfw/bin/gmake" ) 683*b1cdbd2cSJim Jagielski { 684*b1cdbd2cSJim Jagielski return "/usr/sfw/bin"; 685*b1cdbd2cSJim Jagielski } 686*b1cdbd2cSJim Jagielski } 687*b1cdbd2cSJim Jagielski 688*b1cdbd2cSJim Jagielski foreach $i (@pathList) 689*b1cdbd2cSJim Jagielski { 690*b1cdbd2cSJim Jagielski chomp ($i); 691*b1cdbd2cSJim Jagielski 692*b1cdbd2cSJim Jagielski if ( -e "$i/$_search" ) 693*b1cdbd2cSJim Jagielski { 694*b1cdbd2cSJim Jagielski 695*b1cdbd2cSJim Jagielski if ( index($i, "/") == 0 ) 696*b1cdbd2cSJim Jagielski { 697*b1cdbd2cSJim Jagielski # # absolute path; leave unchanged 698*b1cdbd2cSJim Jagielski $progDir = $i; 699*b1cdbd2cSJim Jagielski } else 700*b1cdbd2cSJim Jagielski { 701*b1cdbd2cSJim Jagielski $progDir = `cd "$i"; pwd`; 702*b1cdbd2cSJim Jagielski } 703*b1cdbd2cSJim Jagielski return $progDir 704*b1cdbd2cSJim Jagielski } 705*b1cdbd2cSJim Jagielski } 706*b1cdbd2cSJim Jagielski return $progDir 707*b1cdbd2cSJim Jagielski} 708*b1cdbd2cSJim Jagielski 709*b1cdbd2cSJim Jagielskisub searchMacOffice 710*b1cdbd2cSJim Jagielski{ 711*b1cdbd2cSJim Jagielski if (-d "/Applications/OpenOffice.app" ) { 712*b1cdbd2cSJim Jagielski return "/Applications/OpenOffice.app" 713*b1cdbd2cSJim Jagielski } 714*b1cdbd2cSJim Jagielski return ""; 715*b1cdbd2cSJim Jagielski} 716*b1cdbd2cSJim Jagielski 717*b1cdbd2cSJim Jagielskisub searchoffice 718*b1cdbd2cSJim Jagielski{ 719*b1cdbd2cSJim Jagielski my $offset = rindex($main::sdkpath, "/openoffice"); 720*b1cdbd2cSJim Jagielski my $tmpOffice = substr($main::sdkpath, 0, $offset); 721*b1cdbd2cSJim Jagielski my $officepath = "$tmpOffice/openoffice$main::OO_MAJORVERSION"; 722*b1cdbd2cSJim Jagielski 723*b1cdbd2cSJim Jagielski# if ( $main::OO_MINORVERSION > 0) { 724*b1cdbd2cSJim Jagielski# $officepath = "$officepath$main::OO_MINORVERSION"; 725*b1cdbd2cSJim Jagielski# } 726*b1cdbd2cSJim Jagielski 727*b1cdbd2cSJim Jagielski # search corresponding office for this SDK 728*b1cdbd2cSJim Jagielski if (-d $officepath && -e "$officepath/program/soffice") { 729*b1cdbd2cSJim Jagielski return $officepath; 730*b1cdbd2cSJim Jagielski } 731*b1cdbd2cSJim Jagielski return ""; 732*b1cdbd2cSJim Jagielski} 733*b1cdbd2cSJim Jagielski 734*b1cdbd2cSJim Jagielski 735*b1cdbd2cSJim Jagielski 736*b1cdbd2cSJim Jagielskisub testVersion 737*b1cdbd2cSJim Jagielski{ 738*b1cdbd2cSJim Jagielski my $tmpMustBeVersion = shift; 739*b1cdbd2cSJim Jagielski my $tmpTestVersion = shift; 740*b1cdbd2cSJim Jagielski my $toolName = shift; 741*b1cdbd2cSJim Jagielski # 1=check + message 2=check only 742*b1cdbd2cSJim Jagielski my $checkOnly = shift; 743*b1cdbd2cSJim Jagielski my @mustBeVersion = split(/\.|_|-/,$tmpMustBeVersion); 744*b1cdbd2cSJim Jagielski my @testVersion = split(/\.|_|-/,$tmpTestVersion); 745*b1cdbd2cSJim Jagielski my $length = $#mustBeVersion; 746*b1cdbd2cSJim Jagielski 747*b1cdbd2cSJim Jagielski if ($#testVersion < $#mustBeVersion) { 748*b1cdbd2cSJim Jagielski $length = $#testVersion; 749*b1cdbd2cSJim Jagielski } 750*b1cdbd2cSJim Jagielski 751*b1cdbd2cSJim Jagielski for ($i=0; $i <= $length; $i++ ) 752*b1cdbd2cSJim Jagielski { 753*b1cdbd2cSJim Jagielski if ( @testVersion[$i] > @mustBeVersion[$i] ) 754*b1cdbd2cSJim Jagielski { 755*b1cdbd2cSJim Jagielski return 1; # 1 indicates a correct version 756*b1cdbd2cSJim Jagielski } 757*b1cdbd2cSJim Jagielski 758*b1cdbd2cSJim Jagielski if ( @testVersion[$i] < @mustBeVersion[$i] ) 759*b1cdbd2cSJim Jagielski { 760*b1cdbd2cSJim Jagielski if ( $#checkOnly == 1 ) { 761*b1cdbd2cSJim Jagielski print " The command '$toolName' has the version $tmpTestVersion.\n"; 762*b1cdbd2cSJim Jagielski print " The SDK requires at least the version $tmpMustBeVersion.\n"; 763*b1cdbd2cSJim Jagielski } 764*b1cdbd2cSJim Jagielski return 0; 765*b1cdbd2cSJim Jagielski } 766*b1cdbd2cSJim Jagielski } 767*b1cdbd2cSJim Jagielski 768*b1cdbd2cSJim Jagielski return 1; # 1 indicates a correct version 769*b1cdbd2cSJim Jagielski} 770*b1cdbd2cSJim Jagielski 771*b1cdbd2cSJim Jagielskisub readStdIn 772*b1cdbd2cSJim Jagielski{ 773*b1cdbd2cSJim Jagielski my $tmpstdin = <STDIN>; 774*b1cdbd2cSJim Jagielski if ( index($tmpstdin, "\$") != -1) 775*b1cdbd2cSJim Jagielski { 776*b1cdbd2cSJim Jagielski return `echo $tmpstdin`; 777*b1cdbd2cSJim Jagielski } 778*b1cdbd2cSJim Jagielski 779*b1cdbd2cSJim Jagielski return $tmpstdin; 780*b1cdbd2cSJim Jagielski} 781*b1cdbd2cSJim Jagielski 782*b1cdbd2cSJim Jagielskisub prepareScriptFile() 783*b1cdbd2cSJim Jagielski{ 784*b1cdbd2cSJim Jagielski my $inputFile = shift; 785*b1cdbd2cSJim Jagielski my $outputFile = shift; 786*b1cdbd2cSJim Jagielski 787*b1cdbd2cSJim Jagielski if ( ! -d "$main::OO_SDK_CONFIG_HOME/$main::hostname" ) 788*b1cdbd2cSJim Jagielski { 789*b1cdbd2cSJim Jagielski system("mkdir -p $main::OO_SDK_CONFIG_HOME/$main::hostname"); 790*b1cdbd2cSJim Jagielski } 791*b1cdbd2cSJim Jagielski 792*b1cdbd2cSJim Jagielski open ( FILEIN, "$main::sdkpath/$inputFile" ) || die "\nERROR: could not open '$main::sdkpath/$inputFile' for reading"; 793*b1cdbd2cSJim Jagielski 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"; 794*b1cdbd2cSJim Jagielski 795*b1cdbd2cSJim Jagielski while ( <FILEIN> ) 796*b1cdbd2cSJim Jagielski { 797*b1cdbd2cSJim Jagielski $_ =~ s#\@OO_SDK_NAME\@#$main::OO_SDK_NAME#go; 798*b1cdbd2cSJim Jagielski $_ =~ s#\@OO_SDK_HOME\@#$main::OO_SDK_HOME#go; 799*b1cdbd2cSJim Jagielski $_ =~ s#\@OFFICE_HOME\@#$main::OFFICE_HOME#go; 800*b1cdbd2cSJim Jagielski $_ =~ s#\@OO_SDK_MAKE_HOME\@#$main::OO_SDK_MAKE_HOME#go; 801*b1cdbd2cSJim Jagielski $_ =~ s#\@OO_SDK_ZIP_HOME\@#$main::OO_SDK_ZIP_HOME#go; 802*b1cdbd2cSJim Jagielski $_ =~ s#\@OO_SDK_CAT_HOME\@#$main::OO_SDK_CAT_HOME#go; 803*b1cdbd2cSJim Jagielski $_ =~ s#\@OO_SDK_SED_HOME\@#$main::OO_SDK_SED_HOME#go; 804*b1cdbd2cSJim Jagielski $_ =~ s#\@OO_SDK_CPP_HOME\@#$main::OO_SDK_CPP_HOME#go; 805*b1cdbd2cSJim Jagielski $_ =~ s#\@OO_SDK_CC_55_OR_HIGHER\@#$main::OO_SDK_CC_55_OR_HIGHER#go; 806*b1cdbd2cSJim Jagielski $_ =~ s#\@OO_SDK_JAVA_HOME\@#$main::OO_SDK_JAVA_HOME#go; 807*b1cdbd2cSJim Jagielski $_ =~ s#\@OO_SDK_BOOST_HOME\@#$main::OO_SDK_BOOST_HOME#go; 808*b1cdbd2cSJim Jagielski $_ =~ s#\@SDK_AUTO_DEPLOYMENT\@#$main::SDK_AUTO_DEPLOYMENT#go; 809*b1cdbd2cSJim Jagielski $_ =~ s#\@OO_SDK_OUTPUT_DIR\@#$main::OO_SDK_OUTPUT_DIR#go; 810*b1cdbd2cSJim Jagielski 811*b1cdbd2cSJim Jagielski print FILEOUT $_; 812*b1cdbd2cSJim Jagielski } 813*b1cdbd2cSJim Jagielski 814*b1cdbd2cSJim Jagielski close FILEIN; 815*b1cdbd2cSJim Jagielski close FILEOUT; 816*b1cdbd2cSJim Jagielski} 817