Rename config -> Sconstruct

I only had config so I could easily refer to the original Sconstruct.  I
don't need that anymore =)

Signed-off-by: Anna Schumaker <anna@ocarinaproject.net>
This commit is contained in:
Anna Schumaker 2014-04-09 20:40:30 -04:00
parent 887051e5c1
commit 2eca396042
3 changed files with 52 additions and 128 deletions

View File

@ -1,76 +1,55 @@
#!/usr/bin/python
import os
config = SConscript("config")
# Configuration variables
CONFIG_VERSION = 6.0
CONFIG_DEBUG = True
#import os, sys
#import config
#
#FLAGS = ["-O2"]
#if config.DEBUG == True:
# FLAGS = ["-Wall", "-Werror", "-g", "-DDEBUG"]
# POSTFIX = "-debug"
#
#config.env = Environment(CCFLAGS = FLAGS)
#if ARGUMENTS.get('VERBOSE') != "1":
# config.env.Append(CXXCOMSTR = "C++ $TARGET")
# config.env.Append(LINKCOMSTR = "Linking $TARGET")
#
## Make sure these directories exist before doing anything
#if not os.path.exists("bin"):
# os.mkdir("bin")
#if not os.path.exists("lib"):
# os.mkdir("lib")
#
#config.include = SConscript("include/Sconscript")
#config.libsaria = SConscript("libsaria/Sconscript")
#
#ocarina = SConscript("ocarina/Sconscript")
#newgui = SConscript("newgui/Sconscript")
#Default(ocarina)
#
## Install bin/ and lib/
#def install_dirs(dirs):
# res = []
# for dir in dirs:
# target = os.path.join(config.PREFIX, dir)
# for file in os.listdir(dir):
# source = os.path.join(dir, file)
# config.env.Install(target, source)
# res += [target]
# return res
#
#dirs = install_dirs(["bin/", "lib/"])
#config.env.Alias("install", dirs)
#config.env.Command("uninstall", None, Delete(FindInstalledFiles()))
#
## Clean up the build directory
#clean = Clean(ocarina, ["include/version.h", "bin/", "lib/"])
#
## Create a tarball and a PKGBUILD script
#def prepare_release(target, source, env):
# import datetime
#
# ocarina="ocarina-%s" % config.version
# os.popen("git archive --prefix=%s/ -o %s.tar.gz HEAD" % (ocarina, ocarina))
# md5 = os.popen("md5sum %s.tar.gz | awk '{print $1}'" % ocarina).read().strip()
#
# now = datetime.datetime.now()
# year = str(now.year)
# month = str(now.month)
# if (len(month) == 1):
# month = "0" + month
#
# f = open("PKGBUILD", "w")
# for line in open("PKGBUILD.tmpl"):
# if config.BUG == 0:
# line = line.replace("pkgver=", "pkgver=%s.%s" % (config.MAJOR, config.MINOR))
# else:
# line = line.replace("pkgver=", "pkgver=%s.%s.%s" % (config.MAJOR, config.MINOR, config.BUG))
# line = line.replace("md5sums=", "md5sums=('%s')" % md5)
# line = line.replace("YEAR", year)
# line = line.replace("MONTH", month)
# f.write(line)
# f.close()
#
#config.env.Command("release", None, [prepare_release])
# Set up default environment
CONFIG_CCFLAGS = [ "-O2" ]
if CONFIG_DEBUG == True:
CONFIG_CCFLAGS = [ "-Wall", "-Werror", "-g", "-DCONFIG_DEBUG" ]
env = Environment( CCFLAGS = CONFIG_CCFLAGS )
env.Append(CPPPATH = os.path.abspath("include"))
env.Append(CXXCOMSTR = "C++ $TARGET")
env.Append(LINKCOMSTR = "Linking $TARGET")
def use_package(name):
env.ParseConfig("pkg-config --cflags --libs %s" % name)
Export("env", "use_package", "CONFIG_DEBUG", "CONFIG_VERSION")
include = SConscript("include/Sconscript")
lib = SConscript("lib/Sconscript")
Export("lib")
tests = SConscript("tests/Sconscript")
gui = SConscript("gui/Sconscript")
ocarina = env.Program("bin/ocarina", lib + gui)
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")

55
config
View File

@ -1,55 +0,0 @@
#!/usr/bin/python
import os
# Configuration variables
CONFIG_VERSION = 6.0
CONFIG_DEBUG = True
# Set up default environment
CONFIG_CCFLAGS = [ "-O2" ]
if CONFIG_DEBUG == True:
CONFIG_CCFLAGS = [ "-Wall", "-Werror", "-g", "-DCONFIG_DEBUG" ]
env = Environment( CCFLAGS = CONFIG_CCFLAGS )
env.Append(CPPPATH = os.path.abspath("include"))
env.Append(CXXCOMSTR = "C++ $TARGET")
env.Append(LINKCOMSTR = "Linking $TARGET")
def use_package(name):
env.ParseConfig("pkg-config --cflags --libs %s" % name)
Export("env", "use_package", "CONFIG_DEBUG", "CONFIG_VERSION")
include = SConscript("include/Sconscript")
lib = SConscript("lib/Sconscript")
Export("lib")
tests = SConscript("tests/Sconscript")
gui = SConscript("gui/Sconscript")
ocarina = env.Program("bin/ocarina", lib + gui)
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")

View File

@ -3,7 +3,7 @@
function read_config
{
cat ../config | grep ^$1 | awk -F= '{print $2}' | tr -d ' '
cat ../Sconstruct | grep ^$1 | awk -F= '{print $2}' | tr -d ' '
}
function config_version