build: Create a configuration script

Users set values here to be used by the build system.

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
This commit is contained in:
Bryan Schumaker 2012-05-28 11:31:36 -04:00
parent 0dfb02c612
commit fbcc660bd6
7 changed files with 30 additions and 25 deletions

2
.gitignore vendored
View File

@ -1,6 +1,8 @@
*.o *.o
*.swp *.swp
*.pyc
*.tar.gz *.tar.gz
ocarina.bin
.sconsign.dblite .sconsign.dblite
bin/ bin/
lib/ lib/

View File

@ -1,11 +1,6 @@
#!/usr/bin/python #!/usr/bin/python
import os, sys import os, sys
import config
MAJOR = 5
MINOR = 9
BUG = 0
EXTRA = ""
DEBUG = True
PREFIX = "/usr" PREFIX = "/usr"
POSTFIX = "" POSTFIX = ""
@ -16,7 +11,7 @@ for argv in sys.argv:
DESTDIR = split[1] + "/" DESTDIR = split[1] + "/"
FLAGS = ["-O2"] FLAGS = ["-O2"]
if DEBUG == True: if config.DEBUG == True:
FLAGS = ["-Wall", "-Werror", "-g", "-DDEBUG"] FLAGS = ["-Wall", "-Werror", "-g", "-DDEBUG"]
POSTFIX = "-debug" POSTFIX = "-debug"
@ -26,7 +21,7 @@ if ARGUMENTS.get('VERBOSE') != "1":
env.Append(LINKCOMSTR = "Linking $TARGET") env.Append(LINKCOMSTR = "Linking $TARGET")
env.Append(CPPPATH = "include") env.Append(CPPPATH = "include")
Export("env", "MAJOR", "MINOR", "BUG", "EXTRA", "DEBUG") config.env = env
def directory(dirs): def directory(dirs):
objs = [] objs = []

15
config.py Normal file
View File

@ -0,0 +1,15 @@
#!/usr/bin/python
import os
MAJOR = 5
MINOR = 9
BUG = 0
EXTRA = ""
DEBUG = True
env = None
def get_cpp_files():
dirs = [x[0] for x in os.walk(".")]
return [env.Glob(dir + "/*.cpp") for dir in dirs]

View File

@ -1,6 +1,5 @@
#!/usr/bin/python #!/usr/bin/python
from config import *
Import("MAJOR", "MINOR", "BUG", "EXTRA")
f = open("version.h", "w") f = open("version.h", "w")
for line in open("version.tmpl", "r"): for line in open("version.tmpl", "r"):

View File

@ -1,12 +1,9 @@
#!/usr/bin/python #!/usr/bin/python
import os import config
Import('env')
env.ParseConfig('pkg-config --cflags --libs gstreamer-0.10') config.env.ParseConfig('pkg-config --cflags --libs gstreamer-0.10')
env.ParseConfig('pkg-config --cflags --libs gstreamer-interfaces-0.10') config.env.ParseConfig('pkg-config --cflags --libs gstreamer-interfaces-0.10')
env.ParseConfig('pkg-config --cflags --libs taglib') config.env.ParseConfig('pkg-config --cflags --libs taglib')
dirs = [x[0] for x in os.walk(".")]
files = [Glob(dir + "/*.cpp") for dir in dirs]
files = config.get_cpp_files()
Return('files') Return('files')

View File

@ -1,10 +1,7 @@
#!/usr/bin/python #!/usr/bin/python
import os import config
Import('env')
env.ParseConfig('pkg-config --cflags --libs gtk+-2.0') config.env.ParseConfig('pkg-config --cflags --libs gtk+-2.0')
dirs = [x[0] for x in os.walk(".")]
files = [Glob(dir + "/*.cpp") for dir in dirs]
files = config.get_cpp_files()
Return('files') Return('files')

View File

@ -1,7 +1,7 @@
#!/usr/bin/python #!/usr/bin/python
import os, re import os, re
from config import *
Import( "env", "DEBUG" )
bin = "../bin/%s" bin = "../bin/%s"
lib = "../lib/ocarina/%s" lib = "../lib/ocarina/%s"