2011-11-07 23:42:59 -05:00
|
|
|
#!/usr/bin/python
|
2014-04-09 20:40:30 -04:00
|
|
|
import os
|
2011-08-28 11:10:58 -04:00
|
|
|
|
2014-04-09 20:40:30 -04:00
|
|
|
# Configuration variables
|
2014-04-09 21:01:56 -04:00
|
|
|
CONFIG_VERSION = 6.1
|
2014-04-09 20:40:30 -04:00
|
|
|
CONFIG_DEBUG = True
|
2014-05-14 17:48:43 -04:00
|
|
|
CONFIG_TEST_VALGRIND = False
|
2014-04-09 20:40:30 -04:00
|
|
|
|
|
|
|
|
|
|
|
# Set up default environment
|
|
|
|
CONFIG_CCFLAGS = [ "-O2" ]
|
|
|
|
if CONFIG_DEBUG == True:
|
|
|
|
CONFIG_CCFLAGS = [ "-Wall", "-Werror", "-g", "-DCONFIG_DEBUG" ]
|
|
|
|
|
2014-05-14 17:48:43 -04:00
|
|
|
class OEnvironment(Environment):
|
|
|
|
Debug = False
|
|
|
|
Version = 0
|
|
|
|
Valgrind = False
|
2014-04-09 20:40:30 -04:00
|
|
|
|
2014-05-14 17:48:43 -04:00
|
|
|
def __init__(self):
|
|
|
|
Environment.__init__(self, CCFLAGS = CONFIG_CCFLAGS)
|
|
|
|
self.Append(CPPPATH = os.path.abspath("include"))
|
|
|
|
self.Append(CXXCOMSTR = "C++ $TARGET")
|
|
|
|
self.Append(LINKCOMSTR = "Linking $TARGET")
|
|
|
|
self.Debug = CONFIG_DEBUG
|
|
|
|
self.Version = CONFIG_VERSION
|
|
|
|
self.Valgrind = CONFIG_TEST_VALGRIND
|
2014-04-09 20:40:30 -04:00
|
|
|
|
2014-05-14 17:48:43 -04:00
|
|
|
def UsePackage(self, name):
|
|
|
|
self.ParseConfig("pkg-config --cflags --libs %s" % name)
|
2014-04-09 20:40:30 -04:00
|
|
|
|
2014-05-14 17:48:43 -04:00
|
|
|
env = OEnvironment()
|
|
|
|
test_env = OEnvironment()
|
|
|
|
Export("env", "test_env")
|
2014-04-09 20:40:30 -04:00
|
|
|
|
|
|
|
|
|
|
|
include = SConscript("include/Sconscript")
|
|
|
|
lib = SConscript("lib/Sconscript")
|
2014-05-14 17:48:43 -04:00
|
|
|
gui = SConscript("gui/Sconscript")
|
2014-04-09 20:40:30 -04:00
|
|
|
|
|
|
|
tests = SConscript("tests/Sconscript")
|
|
|
|
|
|
|
|
|
2014-05-18 14:11:21 -04:00
|
|
|
ocarina = env.Program("bin/ocarina", lib + gui)
|
2014-04-09 20:40:30 -04:00
|
|
|
Default(ocarina)
|
|
|
|
Clean(ocarina, "bin/")
|
|
|
|
|
|
|
|
|
|
|
|
def ocarina_release(target, source, env):
|
|
|
|
o_vers = "ocarina-%s" % CONFIG_VERSION
|
|
|
|
|
|
|
|
os.popen("git archive --prefix=%s/ -o %s.tar.gz HEAD" % (o_vers, o_vers))
|
|
|
|
print os.popen("sha1sum %s.tar.gz" % o_vers).read()
|
|
|
|
|
|
|
|
Command("release", None, ocarina_release)
|
|
|
|
|
|
|
|
|
|
|
|
env.Install("/usr/bin", "bin/ocarina")
|
|
|
|
env.Install("/usr/share", "share/ocarina/")
|
|
|
|
env.Install("/usr/share/applications", "share/applications/ocarina.desktop")
|
|
|
|
|
|
|
|
install = Alias("install", [ "/usr/bin", "/usr/share", "/usr/share/applications" ])
|
|
|
|
Depends(install, ocarina)
|
|
|
|
Clean(install, "/usr/share/ocarina")
|