import sys
import os
sys.path.append('build')
from osync_support import *


#Define the default values for some variables. Take note, that they might
#get overwriten by the scons files in the build directory


class BuildConfig:
	version = "0.30"
	major = 1
	minor = 0	       
	micro = 0		       
	plugin_version = 1
	path_sep = r"/"

config = BuildConfig()

# Get our configuration options:
env = Environment(ENV = os.environ) 
opts = Options('vformat.conf')
opts.Add('debug', 'Should debugging be enabled?', 1)
opts.Add(BoolOption('debug_modules', 'Should unloading of shared modules be avoided (DEBUGGING ONLY!)', 0))
opts.Add(('APPEND_LDFLAGS', 'Linker flags'))
opts.Add(('APPEND_CCFLAGS', 'Compiler flags'))
opts.Add(('DESTDIR', 'Set the root directory to install into ( /path/to/DESTDIR )', ''))

target_dir = SelectBuildDir('build')
sys.path.append(target_dir)
from osync_build import *
target_dir = '#' + target_dir
configure(opts)
SConsignFile()

opts.Update(env)
opts.Save('vformat.conf', env)
opts.Update(env)

Help("""
++++++++++++++++++++++++++++++++++++
Welcome to the OpenSync Help System!


You can set the following options:
""" + opts.GenerateHelpText(env))

env.Append(CCFLAGS = Split('$APPEND_CCFLAGS'))
env.Append(LDFLAGS = Split('$APPEND_LDFLAGS'))

testenv = check(env, config)

install_prefix = '${DESTDIR}$prefix'
install_format = '${DESTDIR}$prefix/$libsuffix/opensync/formats'

Export('env opts testenv install_prefix install_format')

SConscript(['src/SConscript'])
BuildDir(target_dir, 'vformat', duplicate=0)
