wscript: fix and improve dist target (waf 1.6)
This commit is contained in:
parent
68049ee6cb
commit
75e08bc107
70
wscript
70
wscript
|
@ -7,6 +7,7 @@ import Utils
|
||||||
import shutil
|
import shutil
|
||||||
import re
|
import re
|
||||||
import waflib
|
import waflib
|
||||||
|
from waflib.Scripting import Dist
|
||||||
|
|
||||||
parallel_debug = False
|
parallel_debug = False
|
||||||
|
|
||||||
|
@ -50,6 +51,9 @@ def options(opt):
|
||||||
opt.add_option('--debug', action='store_true', default=False, dest='debug', help="Build debuggable binaries")
|
opt.add_option('--debug', action='store_true', default=False, dest='debug', help="Build debuggable binaries")
|
||||||
opt.add_option('--doxygen', action='store_true', default=False, help='Enable build of doxygen documentation')
|
opt.add_option('--doxygen', action='store_true', default=False, help='Enable build of doxygen documentation')
|
||||||
opt.add_option('--distnodeps', action='store_true', default=False, help="When creating distribution tarball, don't package git submodules")
|
opt.add_option('--distnodeps', action='store_true', default=False, help="When creating distribution tarball, don't package git submodules")
|
||||||
|
opt.add_option('--distname', type='string', default=None, help="Name for the distribution tarball")
|
||||||
|
opt.add_option('--distsuffix', type='string', default="", help="String to append to the distribution tarball name")
|
||||||
|
opt.add_option('--tagdist', action='store_true', default=False, help='Create of git tag for distname')
|
||||||
if parallel_debug:
|
if parallel_debug:
|
||||||
opt.load('parallel_debug')
|
opt.load('parallel_debug')
|
||||||
|
|
||||||
|
@ -275,8 +279,9 @@ def configure(conf):
|
||||||
def git_ver(self):
|
def git_ver(self):
|
||||||
bld = self.generator.bld
|
bld = self.generator.bld
|
||||||
header = self.outputs[0].abspath()
|
header = self.outputs[0].abspath()
|
||||||
if os.access('../version.h', os.R_OK):
|
if os.access('./version.h', os.R_OK):
|
||||||
shutil.copy('../version.h', header)
|
header = os.path.join(os.getcwd(), out, "version.h")
|
||||||
|
shutil.copy('./version.h', header)
|
||||||
data = file(header).read()
|
data = file(header).read()
|
||||||
m = re.match(r'^#define GIT_VERSION "([^"]*)"$', data)
|
m = re.match(r'^#define GIT_VERSION "([^"]*)"$', data)
|
||||||
if m != None:
|
if m != None:
|
||||||
|
@ -611,15 +616,52 @@ def etags(ctx):
|
||||||
os.system(cmd)
|
os.system(cmd)
|
||||||
os.system("stat -c '%y' TAGS")
|
os.system("stat -c '%y' TAGS")
|
||||||
|
|
||||||
def dist_hook():
|
class ladish_dist(waflib.Scripting.Dist):
|
||||||
#print repr(Options.options)
|
cmd = 'dist'
|
||||||
if Options.options.distnodeps:
|
fun = 'dist'
|
||||||
shutil.rmtree('laditools')
|
|
||||||
shutil.rmtree('flowcanvas')
|
def __init__(self):
|
||||||
shutil.rmtree('jack2')
|
Dist.__init__(self)
|
||||||
shutil.rmtree('a2jmidid')
|
if Options.options.distname:
|
||||||
nodist_files = ['.gitmodules', 'GTAGS', 'GRTAGS', 'GPATH', 'GSYMS'] # waf does not ignore these file
|
self.base_name = Options.options.distname
|
||||||
for nodist_file in nodist_files:
|
else:
|
||||||
if os.access(nodist_file, os.F_OK):
|
try:
|
||||||
os.remove(nodist_file)
|
self.base_name = self.cmd_and_log("LANG= git describe --tags", quiet=waflib.Context.BOTH).splitlines()[0]
|
||||||
shutil.copy('../build/default/version.h', "./")
|
except:
|
||||||
|
self.base_name = APPNAME + '-' + VERSION
|
||||||
|
self.base_name += Options.options.distsuffix
|
||||||
|
|
||||||
|
#print self.base_name
|
||||||
|
|
||||||
|
if Options.options.distname and Options.options.tagdist:
|
||||||
|
ret = self.exec_command("LANG= git tag " + self.base_name)
|
||||||
|
if ret != 0:
|
||||||
|
raise waflib.Errors.WafError('git tag creation failed')
|
||||||
|
|
||||||
|
def get_base_name(self):
|
||||||
|
return self.base_name
|
||||||
|
|
||||||
|
def get_excl(self):
|
||||||
|
excl = Dist.get_excl(self)
|
||||||
|
|
||||||
|
excl += ' .gitmodules'
|
||||||
|
excl += ' GTAGS'
|
||||||
|
excl += ' GRTAGS'
|
||||||
|
excl += ' GPATH'
|
||||||
|
excl += ' GSYMS'
|
||||||
|
|
||||||
|
if Options.options.distnodeps:
|
||||||
|
excl += ' laditools'
|
||||||
|
excl += ' flowcanvas'
|
||||||
|
excl += ' jack2'
|
||||||
|
excl += ' a2jmidid'
|
||||||
|
|
||||||
|
#print repr(excl)
|
||||||
|
return excl
|
||||||
|
|
||||||
|
def execute(self):
|
||||||
|
shutil.copy('./build/version.h', "./")
|
||||||
|
try:
|
||||||
|
super(ladish_dist, self).execute()
|
||||||
|
finally:
|
||||||
|
os.remove("version.h")
|
||||||
|
|
Loading…
Reference in New Issue