Skip to content

Commit 6e715b8

Browse files
committed
Upgrade Waf to 1.5.16
1 parent fa514a9 commit 6e715b8

File tree

25 files changed

+749
-75
lines changed

25 files changed

+749
-75
lines changed

bin/node-waf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,6 @@ t = join(w, 'Tools')
1212
sys.path = [w, t] + sys.path
1313

1414
import Scripting
15-
VERSION="1.5.15"
15+
VERSION="1.5.16"
1616
Scripting.prepare(t, os.getcwd(), VERSION, wafdir)
1717
sys.exit(0)

tools/waf-light

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ if 'PSYCOWAF' in os.environ:
3737
try:import psyco;psyco.full()
3838
except:pass
3939

40-
VERSION="1.5.15"
40+
VERSION="1.5.16"
4141
REVISION="x"
4242
INSTALL="x"
4343
C1='x'
@@ -82,26 +82,30 @@ def unpack_wafdir(dir):
8282
err("Cannot unpack waf lib into %s\nMove waf into a writeable directory" % dir)
8383

8484
os.chdir(dir)
85-
tmp = 't.tbz2'
85+
tmp = 't.bz2'
8686
t = open(tmp,'wb')
8787
t.write(txt)
8888
t.close()
8989

90+
t = None
9091
try:
9192
t = tarfile.open(tmp)
92-
for x in t: t.extract(x)
93-
t.close()
9493
except:
95-
os.chdir(cwd)
96-
try: shutil.rmtree(dir)
97-
except OSError: pass
98-
err("Waf cannot be unpacked, check that bzip2 support is present")
94+
try:
95+
os.system('bunzip2 t.bz2')
96+
t = tarfile.open('t')
97+
except:
98+
os.chdir(cwd)
99+
try: shutil.rmtree(dir)
100+
except OSError: pass
101+
err("Waf cannot be unpacked, check that bzip2 support is present")
102+
103+
for x in t: t.extract(x)
104+
t.close()
99105

100106
for x in ['Tools', '3rdparty']:
101107
os.chmod(join('wafadmin',x), 493)
102108

103-
os.unlink(tmp)
104-
105109
if sys.hexversion>0x300000f:
106110
sys.path = [join(dir, 'wafadmin')] + sys.path
107111
import py3kfixes

tools/wafadmin/3rdparty/gccdeps.py

Lines changed: 128 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,128 @@
1+
#!/usr/bin/env python
2+
# encoding: utf-8
3+
# Thomas Nagy, 2008-2010 (ita)
4+
5+
"""
6+
Execute the tasks with gcc -MD, read the dependencies from the .d file
7+
and prepare the dependency calculation for the next run
8+
"""
9+
10+
import os, re, threading
11+
import Task, Logs, Utils, preproc
12+
from TaskGen import before, after, feature
13+
14+
lock = threading.Lock()
15+
16+
preprocessor_flag = '-MD'
17+
18+
@feature('cc')
19+
@before('apply_core')
20+
def add_mmd_cc(self):
21+
if self.env.get_flat('CCFLAGS').find(preprocessor_flag) < 0:
22+
self.env.append_value('CCFLAGS', preprocessor_flag)
23+
24+
@feature('cxx')
25+
@before('apply_core')
26+
def add_mmd_cxx(self):
27+
if self.env.get_flat('CXXFLAGS').find(preprocessor_flag) < 0:
28+
self.env.append_value('CXXFLAGS', preprocessor_flag)
29+
30+
def scan(self):
31+
"the scanner does not do anything initially"
32+
nodes = self.generator.bld.node_deps.get(self.unique_id(), [])
33+
names = []
34+
return (nodes, names)
35+
36+
re_o = re.compile("\.o$")
37+
re_src = re.compile("^(\.\.)[\\/](.*)$")
38+
39+
def post_run(self):
40+
# The following code is executed by threads, it is not safe, so a lock is needed...
41+
42+
if getattr(self, 'cached', None):
43+
return Task.Task.post_run(self)
44+
45+
name = self.outputs[0].abspath(self.env)
46+
name = re_o.sub('.d', name)
47+
txt = Utils.readf(name)
48+
#os.unlink(name)
49+
50+
txt = txt.replace('\\\n', '')
51+
52+
lst = txt.strip().split(':')
53+
val = ":".join(lst[1:])
54+
val = val.split()
55+
56+
nodes = []
57+
bld = self.generator.bld
58+
59+
f = re.compile("^("+self.env.variant()+"|\.\.)[\\/](.*)$")
60+
for x in val:
61+
if os.path.isabs(x):
62+
63+
if not preproc.go_absolute:
64+
continue
65+
66+
lock.acquire()
67+
try:
68+
node = bld.root.find_resource(x)
69+
finally:
70+
lock.release()
71+
else:
72+
g = re.search(re_src, x)
73+
if g:
74+
x = g.group(2)
75+
lock.acquire()
76+
try:
77+
node = bld.bldnode.parent.find_resource(x)
78+
finally:
79+
lock.release()
80+
else:
81+
g = re.search(f, x)
82+
if g:
83+
x = g.group(2)
84+
lock.acquire()
85+
try:
86+
node = bld.srcnode.find_resource(x)
87+
finally:
88+
lock.release()
89+
90+
if id(node) == id(self.inputs[0]):
91+
# ignore the source file, it is already in the dependencies
92+
# this way, successful config tests may be retrieved from the cache
93+
continue
94+
95+
if not node:
96+
raise ValueError('could not find %r for %r' % (x, self))
97+
else:
98+
nodes.append(node)
99+
100+
Logs.debug('deps: real scanner for %s returned %s' % (str(self), str(nodes)))
101+
102+
bld.node_deps[self.unique_id()] = nodes
103+
bld.raw_deps[self.unique_id()] = []
104+
105+
try:
106+
del self.cache_sig
107+
except:
108+
pass
109+
110+
Task.Task.post_run(self)
111+
112+
import Constants, Utils
113+
def sig_implicit_deps(self):
114+
try:
115+
return Task.Task.sig_implicit_deps(self)
116+
except Utils.WafError:
117+
return Constants.SIG_NIL
118+
119+
for name in 'cc cxx'.split():
120+
try:
121+
cls = Task.TaskBase.classes[name]
122+
except KeyError:
123+
pass
124+
else:
125+
cls.post_run = post_run
126+
cls.scan = scan
127+
cls.sig_implicit_deps = sig_implicit_deps
128+

tools/wafadmin/3rdparty/go.py

Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
#!/usr/bin/env python
2+
# encoding: utf-8
3+
# go.py - Waf tool for the Go programming language
4+
# By: Tom Wambold <[email protected]>
5+
6+
import platform
7+
8+
import Task
9+
import Utils
10+
from TaskGen import feature, extension, after
11+
12+
Task.simple_task_type('gocompile', '${GOC} ${GOCFLAGS} -o ${TGT} ${SRC}', shell=False)
13+
Task.simple_task_type('gopack', '${GOP} grc ${TGT} ${SRC}', shell=False)
14+
Task.simple_task_type('golink', '${GOL} ${GOLFLAGS} -o ${TGT} ${SRC}', shell=False)
15+
16+
def detect(conf):
17+
18+
def set_def(var, val):
19+
if not conf.env[var]:
20+
conf.env[var] = val
21+
22+
set_def('GO_PLATFORM', platform.machine())
23+
24+
if conf.env.GO_PLATFORM == 'x86_64':
25+
set_def('GO_COMPILER', '6g')
26+
set_def('GO_LINKER', '6l')
27+
set_def('GO_EXTENSION', '.6')
28+
elif conf.env.GO_PLATFORM == 'i386':
29+
set_def('GO_COMPILER', '8g')
30+
set_def('GO_LINKER', '8l')
31+
set_def('GO_EXTENSION', '.8')
32+
33+
if not (conf.env.GO_COMPILER or conf.env.GO_LINKER or conf.env.GO_EXTENSION):
34+
raise conf.fatal('Unsupported platform ' + platform.machine())
35+
36+
set_def('GO_PACK', 'gopack')
37+
set_def('GO_PACK_EXTENSION', '.a')
38+
39+
conf.find_program(conf.env.GO_COMPILER, var='GOC', mandatory=True)
40+
conf.find_program(conf.env.GO_LINKER, var='GOL', mandatory=True)
41+
conf.find_program(conf.env.GO_PACK, var='GOP', mandatory=True)
42+
43+
@extension('.go')
44+
def compile_go(self, node):
45+
try:
46+
self.go_nodes.append(node)
47+
except AttributeError:
48+
self.go_nodes = [node]
49+
50+
@feature('go')
51+
@after('apply_core')
52+
def apply_compile_go(self):
53+
try:
54+
nodes = self.go_nodes
55+
except AttributeError:
56+
self.go_compile_task = None
57+
else:
58+
self.go_compile_task = self.create_task('gocompile',
59+
nodes,
60+
[self.path.find_or_declare(self.target + self.env.GO_EXTENSION)])
61+
62+
@feature('gopackage', 'goprogram')
63+
@after('apply_compile_go')
64+
def apply_goinc(self):
65+
if not getattr(self, 'go_compile_task', None):
66+
return
67+
68+
names = self.to_list(getattr(self, 'uselib_local', []))
69+
for name in names:
70+
obj = self.name_to_obj(name)
71+
if not obj:
72+
raise Utils.WafError('object %r was not found in uselib_local '
73+
'(required by %r)' % (lib_name, self.name))
74+
obj.post()
75+
self.go_compile_task.set_run_after(obj.go_package_task)
76+
self.go_compile_task.deps_nodes.extend(obj.go_package_task.outputs)
77+
self.env.append_unique('GOCFLAGS', '-I' + obj.path.abspath(obj.env))
78+
self.env.append_unique('GOLFLAGS', '-L' + obj.path.abspath(obj.env))
79+
80+
@feature('gopackage')
81+
@after('apply_goinc')
82+
def apply_gopackage(self):
83+
self.go_package_task = self.create_task('gopack',
84+
self.go_compile_task.outputs[0],
85+
self.path.find_or_declare(self.target + self.env.GO_PACK_EXTENSION))
86+
self.go_package_task.set_run_after(self.go_compile_task)
87+
self.go_package_task.deps_nodes.extend(self.go_compile_task.outputs)
88+
89+
@feature('goprogram')
90+
@after('apply_goinc')
91+
def apply_golink(self):
92+
self.go_link_task = self.create_task('golink',
93+
self.go_compile_task.outputs[0],
94+
self.path.find_or_declare(self.target))
95+
self.go_link_task.set_run_after(self.go_compile_task)
96+
self.go_link_task.deps_nodes.extend(self.go_compile_task.outputs)
97+

0 commit comments

Comments
 (0)