From 624d9a9e74636025585b0e5c3b94a0e1826a2fc2 Mon Sep 17 00:00:00 2001 From: Bryan Schumaker Date: Wed, 9 Nov 2011 23:01:18 -0500 Subject: [PATCH] build: Added a `scons archive` command This will create an ocarina tarball for the current release. --- Sconstruct | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/Sconstruct b/Sconstruct index 46d987e2..7dae20ee 100644 --- a/Sconstruct +++ b/Sconstruct @@ -39,6 +39,7 @@ def list_dirs(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" @@ -57,3 +58,16 @@ 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])