74 lines
2.0 KiB
Python
74 lines
2.0 KiB
Python
#!/usr/bin/python
|
|
|
|
MAJOR = 5
|
|
MINOR = 3
|
|
BUG = 0
|
|
EXTRA = "rc1"
|
|
DEBUG = False
|
|
|
|
PREFIX = "/usr"
|
|
|
|
FLAGS = ["-O2"]
|
|
if DEBUG == True:
|
|
FLAGS = ["-Wall", "-Werror", "-g", "-DDEBUG"]
|
|
|
|
env = Environment(CCFLAGS = FLAGS)
|
|
if ARGUMENTS.get('VERBOSE') != "1":
|
|
env.Append(CXXCOMSTR = "CXX $TARGET")
|
|
env.Append(LINKCOMSTR = "Linking $TARGET")
|
|
env.Append(CPPPATH = "include")
|
|
|
|
env.ParseConfig('pkg-config --cflags --libs gtk+-2.0')
|
|
env.ParseConfig('pkg-config --cflags --libs gstreamer-0.10')
|
|
env.ParseConfig('pkg-config --cflags --libs taglib')
|
|
|
|
def version_h():
|
|
f = open("include/version.h", "w")
|
|
for line in open("include/version.tmpl", "r"):
|
|
line = line.replace("__MAJOR__", str(MAJOR))
|
|
line = line.replace("__MINOR__", str(MINOR))
|
|
line = line.replace("__BUG__", str(BUG))
|
|
line = line.replace("__EXTRA__", str(EXTRA))
|
|
f.write(line)
|
|
f.close()
|
|
version_h()
|
|
|
|
def list_dirs(directory):
|
|
import os
|
|
dirs = [x[0] for x in os.walk(directory)]
|
|
return [Glob(dir + "/*.cpp") for dir in dirs]
|
|
|
|
ocarina=env.Program('ocarina.bin', list_dirs('libsaria') + list_dirs('ocarina'))
|
|
Default(ocarina)
|
|
|
|
# Install Ocarina
|
|
lib = PREFIX + "/lib/ocarina"
|
|
bin = PREFIX + "/bin/ocarina"
|
|
images = lib + "/images"
|
|
env.Install(lib, ocarina)
|
|
env.Alias("install", [lib, images, bin])
|
|
env.Command(images, "./images/", [Copy(images, "./images")])
|
|
def ocarina_sh(target, source, env):
|
|
f = open("ocarina.sh", "w")
|
|
f.write("#!/bin/bash\n")
|
|
f.write(PREFIX + "/lib/ocarina/ocarina.bin \"$*\"\n")
|
|
f.close()
|
|
#return "./ocarina.sh"
|
|
env.Command(bin, None, [ocarina_sh, Move(bin, "ocarina.sh"), Chmod(bin, 0755)])
|
|
|
|
# Clean up the build directory
|
|
Clean(ocarina, ["include/version.h"])
|
|
|
|
# Create a tarball
|
|
def git_archive(target, source, env):
|
|
import os
|
|
version = "%s.%s" % (MAJOR, MINOR)
|
|
if BUG != 0:
|
|
version += ".%s" % BUG
|
|
if EXTRA != "":
|
|
version += "-%s" % EXTRA
|
|
if DEBUG == True:
|
|
version += "-debug"
|
|
os.popen("git archive --prefix=ocarina/ -o ocarina-%s.tar.gz HEAD" % (version))
|
|
env.Command("archive", None, [git_archive])
|