2009-01-19 21:05:46 +03:00
# -------------------------------------------------------------------------- #
2010-02-22 20:00:30 +03:00
# Copyright 2002-2010, OpenNebula Project Leads (OpenNebula.org) #
2009-01-19 21:05:46 +03:00
# #
# Licensed under the Apache License, Version 2.0 (the "License"); you may #
# not use this file except in compliance with the License. You may obtain #
# a copy of the License at #
# #
# http://www.apache.org/licenses/LICENSE-2.0 #
# #
# Unless required by applicable law or agreed to in writing, software #
# distributed under the License is distributed on an "AS IS" BASIS, #
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
# See the License for the specific language governing permissions and #
# limitations under the License. #
#--------------------------------------------------------------------------- #
2008-06-17 20:27:32 +04:00
import os
import sys
2009-04-23 21:01:52 +04:00
import shutil
2008-06-17 20:27:32 +04:00
sys . path . append ( " ./share/scons " )
from lex_bison import *
# This is the absolute path where the project is located
cwd = os . getcwd ( )
# Environment that will be applied to each scons child
main_env = Environment ( )
main_env [ ' ENV ' ] [ ' PATH ' ] = os . environ [ ' PATH ' ]
# Add builders for flex and bison
add_lex ( main_env )
add_bison ( main_env )
# Include dirs
main_env . Append ( CPPPATH = [
2008-07-10 15:24:48 +04:00
cwd + ' /include ' ,
2008-06-17 20:27:32 +04:00
] )
# Library dirs
main_env . Append ( LIBPATH = [
2008-07-10 15:24:48 +04:00
cwd + ' /src/common ' ,
2010-05-14 17:30:28 +04:00
cwd + ' /src/log ' ,
2010-05-07 16:45:27 +04:00
cwd + ' /src/sql ' ,
2008-07-10 15:24:48 +04:00
cwd + ' /src/host ' ,
cwd + ' /src/mad ' ,
cwd + ' /src/nebula ' ,
cwd + ' /src/pool ' ,
cwd + ' /src/template ' ,
cwd + ' /src/vm ' ,
cwd + ' /src/vmm ' ,
cwd + ' /src/lcm ' ,
2009-04-23 21:24:12 +04:00
cwd + ' /src/tm ' ,
2008-07-10 15:24:48 +04:00
cwd + ' /src/dm ' ,
cwd + ' /src/im ' ,
cwd + ' /src/rm ' ,
2008-11-13 19:21:17 +03:00
cwd + ' /src/vnm ' ,
2009-04-04 03:34:33 +04:00
cwd + ' /src/hm ' ,
2009-07-09 18:34:34 +04:00
cwd + ' /src/um ' ,
2008-06-17 20:27:32 +04:00
] )
# Compile flags
main_env . Append ( CPPFLAGS = [
2008-07-10 15:24:48 +04:00
" -g " ,
" -Wall "
2008-06-17 20:27:32 +04:00
] )
# Linking flags
main_env . Append ( LDFLAGS = [ " -g " ] )
#######################
# EXTRA CONFIGURATION #
#######################
# SQLITE
2010-05-07 16:45:27 +04:00
sqlite_dir = ARGUMENTS . get ( ' sqlite_dir ' , ' none ' )
2008-06-17 20:27:32 +04:00
if sqlite_dir != ' none ' :
main_env . Append ( LIBPATH = [ sqlite_dir + " /lib " ] )
main_env . Append ( CPPPATH = [ sqlite_dir + " /include " ] )
2010-05-07 16:45:27 +04:00
sqlite = ARGUMENTS . get ( ' sqlite ' , ' yes ' )
if sqlite == ' yes ' :
main_env . Append ( sqlite = ' yes ' )
main_env . Append ( CPPFLAGS = [ " -DSQLITE_DB " ] )
else :
main_env . Append ( sqlite = ' no ' )
2010-05-05 21:26:35 +04:00
# MySQL
mysql = ARGUMENTS . get ( ' mysql ' , ' no ' )
if mysql == ' yes ' :
main_env . Append ( mysql = ' yes ' )
2010-05-07 16:45:27 +04:00
main_env . Append ( CPPFLAGS = [ " -DMYSQL_DB " ] )
2010-05-05 21:26:35 +04:00
else :
main_env . Append ( mysql = ' no ' )
2008-06-17 20:27:32 +04:00
2010-05-07 16:45:27 +04:00
2008-06-17 20:27:32 +04:00
# xmlrpc
xmlrpc_dir = ARGUMENTS . get ( ' xmlrpc ' , ' none ' )
if xmlrpc_dir != ' none ' :
main_env . Append ( LIBPATH = [ xmlrpc_dir + " /lib " ] )
main_env . Append ( CPPPATH = [ xmlrpc_dir + " /include " ] )
# build lex/bison
build_parsers = ARGUMENTS . get ( ' parsers ' , ' no ' )
if build_parsers == ' yes ' :
2008-07-10 15:24:48 +04:00
main_env . Append ( parsers = ' yes ' )
2008-06-17 20:27:32 +04:00
else :
2008-07-10 15:24:48 +04:00
main_env . Append ( parsers = ' no ' )
2009-04-23 20:30:59 +04:00
if not main_env . GetOption ( ' clean ' ) :
try :
main_env . ParseConfig ( ' share/scons/get_xmlrpc_config server ' )
main_env . ParseConfig ( ' share/scons/get_xmlrpc_config client ' )
2010-05-07 16:45:27 +04:00
2010-05-05 21:26:35 +04:00
if mysql == ' yes ' :
2010-05-06 18:08:16 +04:00
main_env . ParseConfig ( ' mysql_config --cflags --libs ' )
2010-05-07 16:45:27 +04:00
2009-04-23 20:30:59 +04:00
except Exception , e :
print " "
2009-04-23 21:38:46 +04:00
print " Error searching for xmlrpc-c libraries. Please check this " + \
2009-04-23 21:24:12 +04:00
" things: "
2009-04-23 20:30:59 +04:00
print " "
2009-04-23 21:38:46 +04:00
print " * You have installed development libraries for xmlrpc-c. One " + \
2009-04-23 21:24:12 +04:00
" way to check "
2009-04-23 21:38:46 +04:00
print " this is calling xmlrpc-c-config that is provided with the " + \
2009-04-23 21:24:12 +04:00
" development "
2009-04-23 20:30:59 +04:00
print " package. "
2009-04-23 21:38:46 +04:00
print " * Check that the version of xmlrpc-c is at least 1.06. You " + \
" can do this also "
2009-04-23 20:30:59 +04:00
print " calling: "
print " $ xmlrpc-c-config --version "
2009-04-23 21:38:46 +04:00
print " * If all this requirements are already met please send log " + \
2009-04-23 21:24:12 +04:00
" files located in "
2009-04-23 20:30:59 +04:00
print " .xmlrpc_test to the mailing list. "
print " "
exit ( - 1 )
2009-04-23 21:01:52 +04:00
else :
shutil . rmtree ( ' .xmlrpc_test ' , True )
shutil . rmtree ( ' src/nebula/.xmlrpc_test ' , True )
shutil . rmtree ( ' src/scheduler/.xmlrpc_test ' , True )
2008-06-17 20:27:32 +04:00
# SCONS scripts to build
build_scripts = [
2008-10-20 18:44:16 +04:00
' src/client/SConstruct ' ,
2010-05-07 16:45:27 +04:00
' src/sql/SConstruct ' ,
2010-05-14 17:30:28 +04:00
' src/log/SConstruct ' ,
2008-06-17 20:27:32 +04:00
' src/common/SConstruct ' ,
' src/template/SConstruct ' ,
' src/host/SConstruct ' ,
' src/mad/SConstruct ' ,
' src/nebula/SConstruct ' ,
' src/pool/SConstruct ' ,
' src/vm/SConstruct ' ,
' src/vmm/SConstruct ' ,
' src/lcm/SConstruct ' ,
' src/rm/SConstruct ' ,
' src/tm/SConstruct ' ,
' src/im/SConstruct ' ,
' src/dm/SConstruct ' ,
2010-05-14 18:53:31 +04:00
' src/scheduler/SConstruct ' ,
2009-04-04 03:34:33 +04:00
' src/vnm/SConstruct ' ,
' src/hm/SConstruct ' ,
2009-07-09 18:34:34 +04:00
' src/um/SConstruct ' ,
2008-06-17 20:27:32 +04:00
]
for script in build_scripts :
env = main_env . Clone ( )
SConscript ( script , exports = ' env ' )