shithub: aubio

Download patch

ref: c101fe139c5f96364e9d3d18734eafd64d7b7618
parent: 54e74f0c2fdd60f10ccd1d321f92e491f898fee0
author: Paul Brossier <piem@piem.org>
date: Wed Nov 13 08:00:56 EST 2013

waf, waflib: update to 1.7.13

--- a/waf
+++ b/waf
@@ -32,11 +32,11 @@
 
 import os, sys
 
-VERSION="1.7.9"
-REVISION="b503f38d25464d88953a601c8cd0ace6"
+VERSION="1.7.13"
+REVISION="5a064c2686fe54de4e11018d22148cfc"
 INSTALL=''
-C1='#='
-C2='#+'
+C1='#('
+C2='#$'
 cwd = os.getcwd()
 join = os.path.join
 
@@ -108,7 +108,7 @@
 		import fixpy2
 		fixpy2.fixdir(dir)
 
-	os.unlink(tmp)
+	os.remove(tmp)
 	os.chdir(cwd)
 
 	try: dir = unicode(dir, 'mbcs')
--- a/waflib/Build.py
+++ b/waflib/Build.py
@@ -132,29 +132,24 @@
 				raise Errors.WafError('Version mismatch! reconfigure the project')
 			for t in env['tools']:
 				self.setup(**t)
-		f=None
+		dbfn=os.path.join(self.variant_dir,Context.DBFILE)
 		try:
-			dbfn=os.path.join(self.variant_dir,Context.DBFILE)
+			data=Utils.readf(dbfn,'rb')
+		except(IOError,EOFError):
+			Logs.debug('build: Could not load the build cache %s (missing)'%dbfn)
+		else:
 			try:
-				f=open(dbfn,'rb')
-			except(IOError,EOFError):
-				Logs.debug('build: Could not load the build cache %s (missing)'%dbfn)
-			else:
+				waflib.Node.pickle_lock.acquire()
+				waflib.Node.Nod3=self.node_class
 				try:
-					waflib.Node.pickle_lock.acquire()
-					waflib.Node.Nod3=self.node_class
-					try:
-						data=cPickle.load(f)
-					except Exception ,e:
-						Logs.debug('build: Could not pickle the build cache %s: %r'%(dbfn,e))
-					else:
-						for x in SAVED_ATTRS:
-							setattr(self,x,data[x])
-				finally:
-					waflib.Node.pickle_lock.release()
-		finally:
-			if f:
-				f.close()
+					data=cPickle.loads(data)
+				except Exception ,e:
+					Logs.debug('build: Could not pickle the build cache %s: %r'%(dbfn,e))
+				else:
+					for x in SAVED_ATTRS:
+						setattr(self,x,data[x])
+			finally:
+				waflib.Node.pickle_lock.release()
 		self.init_dirs()
 	def store(self):
 		data={}
@@ -164,18 +159,13 @@
 		try:
 			waflib.Node.pickle_lock.acquire()
 			waflib.Node.Nod3=self.node_class
-			f=None
-			try:
-				f=open(db+'.tmp','wb')
-				cPickle.dump(data,f,-1)
-			finally:
-				if f:
-					f.close()
+			x=cPickle.dumps(data,-1)
 		finally:
 			waflib.Node.pickle_lock.release()
+		Utils.writef(db+'.tmp',x,m='wb')
 		try:
 			st=os.stat(db)
-			os.unlink(db)
+			os.remove(db)
 			if not Utils.is_win32:
 				os.chown(db+'.tmp',st.st_uid,st.st_gid)
 		except(AttributeError,OSError):
@@ -481,7 +471,6 @@
 		for x,y in zip(self.source,self.inputs):
 			if self.relative_trick:
 				destfile=os.path.join(destpath,y.path_from(self.path))
-				Utils.check_dir(os.path.dirname(destfile))
 			else:
 				destfile=os.path.join(destpath,y.name)
 			self.generator.bld.do_install(y.abspath(),destfile,self.chmod)
@@ -624,7 +613,7 @@
 	def do_link(self,src,tgt):
 		try:
 			if not self.progress_bar:
-				Logs.info('- unlink %s'%tgt)
+				Logs.info('- remove %s'%tgt)
 			os.remove(tgt)
 		except OSError:
 			pass
--- a/waflib/ConfigSet.py
+++ b/waflib/ConfigSet.py
@@ -120,18 +120,18 @@
 			os.makedirs(os.path.split(filename)[0])
 		except OSError:
 			pass
-		f=None
+		buf=[]
+		merged_table=self.get_merged_dict()
+		keys=list(merged_table.keys())
+		keys.sort()
 		try:
-			f=open(filename,'w')
-			merged_table=self.get_merged_dict()
-			keys=list(merged_table.keys())
-			keys.sort()
-			for k in keys:
-				if k!='undo_stack':
-					f.write('%s = %r\n'%(k,merged_table[k]))
-		finally:
-			if f:
-				f.close()
+			fun=ascii
+		except NameError:
+			fun=repr
+		for k in keys:
+			if k!='undo_stack':
+				buf.append('%s = %s\n'%(k,fun(merged_table[k])))
+		Utils.writef(filename,''.join(buf))
 	def load(self,filename):
 		tbl=self.table
 		code=Utils.readf(filename,m='rU')
--- a/waflib/Context.py
+++ b/waflib/Context.py
@@ -5,9 +5,9 @@
 import os,imp,sys
 from waflib import Utils,Errors,Logs
 import waflib.Node
-HEXVERSION=0x1070900
-WAFVERSION="1.7.9"
-WAFREVISION="9e92489dbc008e4abae9c147b1d63b48296797c2"
+HEXVERSION=0x1070d00
+WAFVERSION="1.7.13"
+WAFREVISION="daa91dba4b881d86bc25eec90a3745ebaeece835"
 ABI=98
 DBFILE='.wafpickle-%s-%d-%d'%(sys.platform,sys.hexversion,ABI)
 APPNAME='APPNAME'
--- a/waflib/Logs.py
+++ b/waflib/Logs.py
@@ -3,10 +3,17 @@
 # WARNING! Do not edit! http://waf.googlecode.com/git/docs/wafbook/single.html#_obtaining_the_waf_file
 
 import os,re,traceback,sys
+_nocolor=os.environ.get('NOCOLOR','no')not in('no','0','false')
 try:
-	import threading
+	if not _nocolor:
+		import waflib.ansiterm
 except ImportError:
 	pass
+try:
+	import threading
+except ImportError:
+	if not'JOBS'in os.environ:
+		os.environ['JOBS']='1'
 else:
 	wlock=threading.Lock()
 	class sync_stream(object):
@@ -26,12 +33,6 @@
 			self.stream.flush()
 		def isatty(self):
 			return self.stream.isatty()
-	_nocolor=os.environ.get('NOCOLOR','no')not in('no','0','false')
-	try:
-		if not _nocolor:
-			import waflib.ansiterm
-	except ImportError:
-		pass
 	if not os.environ.get('NOSYNC',False):
 		if id(sys.stdout)==id(sys.__stdout__):
 			sys.stdout=sync_stream(sys.stdout)
--- a/waflib/Node.py
+++ b/waflib/Node.py
@@ -33,6 +33,7 @@
 **/{arch}
 **/_darcs
 **/_darcs/**
+**/.intlcache
 **/.DS_Store'''
 def split_path(path):
 	return path.split('/')
@@ -89,10 +90,10 @@
 		os.chmod(self.abspath(),val)
 	def delete(self):
 		try:
-			if getattr(self,'children',None):
+			if hasattr(self,'children'):
 				shutil.rmtree(self.abspath())
 			else:
-				os.unlink(self.abspath())
+				os.remove(self.abspath())
 		except OSError:
 			pass
 		self.evict()
@@ -327,7 +328,7 @@
 			if[]in nrej:
 				nacc=[]
 			return[nacc,nrej]
-		ret=[x for x in self.ant_iter(accept=accept,pats=[to_pat(incl),to_pat(excl)],maxdepth=25,dir=dir,src=src,remove=kw.get('remove',True))]
+		ret=[x for x in self.ant_iter(accept=accept,pats=[to_pat(incl),to_pat(excl)],maxdepth=kw.get('maxdepth',25),dir=dir,src=src,remove=kw.get('remove',True))]
 		if kw.get('flat',False):
 			return' '.join([x.path_from(self)for x in ret])
 		return ret
--- a/waflib/Scripting.py
+++ b/waflib/Scripting.py
@@ -164,12 +164,12 @@
 			if _can_distclean(f):
 				fname=root+os.sep+f
 				try:
-					os.unlink(fname)
+					os.remove(fname)
 				except OSError:
 					Logs.warn('Could not remove %r'%fname)
 	for x in[Context.DBFILE,'config.log']:
 		try:
-			os.unlink(x)
+			os.remove(x)
 		except OSError:
 			pass
 	try:
@@ -325,7 +325,7 @@
 		else:
 			cfg=[x for x in sys.argv if x.startswith('-')]
 		instdir=tempfile.mkdtemp('.inst',self.get_base_name())
-		ret=Utils.subprocess.Popen([sys.argv[0],'configure','install','uninstall','--destdir='+instdir]+cfg,cwd=self.get_base_name()).wait()
+		ret=Utils.subprocess.Popen([sys.executable,sys.argv[0],'configure','install','uninstall','--destdir='+instdir]+cfg,cwd=self.get_base_name()).wait()
 		if ret:
 			raise Errors.WafError('distcheck failed with code %i'%ret)
 		if os.path.exists(instdir):
--- a/waflib/TaskGen.py
+++ b/waflib/TaskGen.py
@@ -305,7 +305,9 @@
 			self.outputs[0].write(self.inputs[0].read('rb'),'wb')
 			if getattr(self.generator,'chmod',None):
 				os.chmod(self.outputs[0].abspath(),self.generator.chmod)
-			return
+			return None
+		if getattr(self.generator,'fun',None):
+			self.generator.fun(self)
 		code=self.inputs[0].read(encoding=getattr(self.generator,'encoding','ISO8859-1'))
 		if getattr(self.generator,'subst_fun',None):
 			code=self.generator.subst_fun(self,code)
@@ -339,6 +341,8 @@
 		bld=self.generator.bld
 		env=self.env
 		upd=self.m.update
+		if getattr(self.generator,'fun',None):
+			upd(Utils.h_fun(self.generator.fun))
 		if getattr(self.generator,'subst_fun',None):
 			upd(Utils.h_fun(self.generator.subst_fun))
 		vars=self.generator.bld.raw_deps.get(self.uid(),[])
--- a/waflib/Tools/c_config.py
+++ b/waflib/Tools/c_config.py
@@ -599,7 +599,7 @@
 	if gcc:
 		if out.find('__INTEL_COMPILER')>=0:
 			conf.fatal('The intel compiler pretends to be gcc')
-		if out.find('__GNUC__')<0:
+		if out.find('__GNUC__')<0 and out.find('__clang__')<0:
 			conf.fatal('Could not determine the compiler type')
 	if icc and out.find('__INTEL_COMPILER')<0:
 		conf.fatal('Not icc/icpc')
@@ -629,9 +629,9 @@
 				conf.env.DEST_OS='generic'
 		if isD('__ELF__'):
 			conf.env.DEST_BINFMT='elf'
-		elif isD('__WINNT__')or isD('__CYGWIN__'):
+		elif isD('__WINNT__')or isD('__CYGWIN__')or isD('_WIN32'):
 			conf.env.DEST_BINFMT='pe'
-			conf.env.LIBDIR=conf.env['PREFIX']+'/bin'
+			conf.env.LIBDIR=conf.env.BINDIR
 		elif isD('__APPLE__'):
 			conf.env.DEST_BINFMT='mac-o'
 		if not conf.env.DEST_BINFMT:
@@ -666,6 +666,22 @@
 			break
 	else:
 		conf.fatal('Could not determine the XLC version.')
+@conf
+def get_suncc_version(conf,cc):
+	cmd=cc+['-V']
+	try:
+		out,err=conf.cmd_and_log(cmd,output=0)
+	except Errors.WafError:
+		conf.fatal('Could not find suncc %r'%cmd)
+	version=(out or err)
+	version=version.split('\n')[0]
+	version_re=re.compile(r'cc:\s+sun\s+(c\+\+|c)\s+(?P<major>\d*)\.(?P<minor>\d*)',re.I).search
+	match=version_re(version)
+	if match:
+		k=match.groupdict()
+		conf.env['CC_VERSION']=(k['major'],k['minor'])
+	else:
+		conf.fatal('Could not determine the suncc version.')
 @conf
 def add_as_needed(self):
 	if self.env.DEST_BINFMT=='elf'and'gcc'in(self.env.CXX_NAME,self.env.CC_NAME):
--- a/waflib/Tools/c_preproc.py
+++ b/waflib/Tools/c_preproc.py
@@ -21,7 +21,7 @@
 re_fun=re.compile('^[a-zA-Z_][a-zA-Z0-9_]*[(]')
 re_pragma_once=re.compile('^\s*once\s*',re.IGNORECASE)
 re_nl=re.compile('\\\\\r*\n',re.MULTILINE)
-re_cpp=re.compile(r"""(/\*[^*]*\*+([^/*][^*]*\*+)*/)|//[^\n]*|("(\\.|[^"\\])*"|'(\\.|[^'\\])*'|.[^/"'\\]*)""",re.MULTILINE)
+re_cpp=re.compile(r'//.*?$|/\*.*?\*/|\'(?:\\.|[^\\\'])*\'|"(?:\\.|[^\\"])*"',re.DOTALL|re.MULTILINE)
 trig_def=[('??'+a,b)for a,b in zip("=-/!'()<>",r'#~\|^[]{}')]
 chr_esc={'0':0,'a':7,'b':8,'t':9,'n':10,'f':11,'v':12,'r':13,'\\':92,"'":39}
 NUM='i'
@@ -37,10 +37,10 @@
 undefined='u'
 skipped='s'
 def repl(m):
-	s=m.group(1)
-	if s:
+	s=m.group(0)
+	if s.startswith('/'):
 		return' '
-	return m.group(3)or''
+	return s
 def filter_comments(filename):
 	code=Utils.readf(filename)
 	if use_trigraphs:
@@ -475,7 +475,7 @@
 			if found:
 				break
 			found=self.cached_find_resource(n,filename)
-		if found:
+		if found and not found in self.ban_includes:
 			self.nodes.append(found)
 			if filename[-4:]!='.moc':
 				self.addlines(found)
@@ -518,6 +518,7 @@
 		except AttributeError:
 			bld.parse_cache={}
 			self.parse_cache=bld.parse_cache
+		self.current_file=node
 		self.addlines(node)
 		if env['DEFINES']:
 			try:
@@ -557,12 +558,11 @@
 					else:state[-1]=accepted
 				elif token=='include'or token=='import':
 					(kind,inc)=extract_include(line,self.defs)
-					if inc in self.ban_includes:
-						continue
-					if token=='import':self.ban_includes.add(inc)
 					if ve:debug('preproc: include found %s    (%s) ',inc,kind)
 					if kind=='"'or not strict_quotes:
-						self.tryfind(inc)
+						self.current_file=self.tryfind(inc)
+						if token=='import':
+							self.ban_includes.add(self.current_file)
 				elif token=='elif':
 					if state[-1]==accepted:
 						state[-1]=skipped
@@ -583,7 +583,7 @@
 						self.defs.__delitem__(m.group(0))
 				elif token=='pragma':
 					if re_pragma_once.match(line.lower()):
-						self.ban_includes.add(self.curfile)
+						self.ban_includes.add(self.current_file)
 			except Exception ,e:
 				if Logs.verbose:
 					debug('preproc: line parsing failed (%s): %s %s',e,line,Utils.ex_stack())
--- a/waflib/Tools/ccroot.py
+++ b/waflib/Tools/ccroot.py
@@ -2,7 +2,7 @@
 # encoding: utf-8
 # WARNING! Do not edit! http://waf.googlecode.com/git/docs/wafbook/single.html#_obtaining_the_waf_file
 
-import os
+import os,re
 from waflib import Task,Utils,Node,Errors
 from waflib.TaskGen import after_method,before_method,feature,taskgen_method,extension
 from waflib.Tools import c_aliases,c_preproc,c_config,c_osx,c_tests
@@ -70,9 +70,12 @@
 			if not pattern:
 				pattern='%s'
 			folder,name=os.path.split(target)
-			if self.__class__.__name__.find('shlib')>0:
-				if self.env.DEST_BINFMT=='pe'and getattr(self.generator,'vnum',None):
-					name=name+'-'+self.generator.vnum.split('.')[0]
+			if self.__class__.__name__.find('shlib')>0 and getattr(self.generator,'vnum',None):
+				nums=self.generator.vnum.split('.')
+				if self.env.DEST_BINFMT=='pe':
+					name=name+'-'+nums[0]
+				elif self.env.DEST_OS=='openbsd':
+					pattern='%s.%s.%s'%(pattern,nums[0],nums[1])
 			tmp=folder+os.sep+pattern%name
 			target=self.generator.path.find_or_declare(tmp)
 		self.set_outputs(target)
@@ -197,6 +200,8 @@
 				self.add_objects_from_tgen(y)
 		if getattr(y,'export_includes',None):
 			self.includes.extend(y.to_incnodes(y.export_includes))
+		if getattr(y,'export_defines',None):
+			self.env.append_value('DEFINES',self.to_list(y.export_defines))
 	for x in names:
 		try:
 			y=self.bld.get_tgen_by_name(x)
@@ -273,6 +278,7 @@
 	if not inst_to:
 		return
 	self.implib_install_task=self.bld.install_as('${LIBDIR}/%s'%implib.name,implib,self.env)
+re_vnum=re.compile('^([1-9]\\d*|0)[.]([1-9]\\d*|0)[.]([1-9]\\d*|0)$')
 @feature('cshlib','cxxshlib','dshlib','fcshlib','vnum')
 @after_method('apply_link','propagate_uselib_vars')
 def apply_vnum(self):
@@ -279,6 +285,8 @@
 	if not getattr(self,'vnum','')or os.name!='posix'or self.env.DEST_BINFMT not in('elf','mac-o'):
 		return
 	link=self.link_task
+	if not re_vnum.match(self.vnum):
+		raise Errors.WafError('Invalid version %r for %r'%(self.vnum,self))
 	nums=self.vnum.split('.')
 	node=link.outputs[0]
 	libname=node.name
@@ -291,15 +299,21 @@
 	if self.env.SONAME_ST:
 		v=self.env.SONAME_ST%name2
 		self.env.append_value('LINKFLAGS',v.split())
-	self.create_task('vnum',node,[node.parent.find_or_declare(name2),node.parent.find_or_declare(name3)])
+	if self.env.DEST_OS!='openbsd':
+		self.create_task('vnum',node,[node.parent.find_or_declare(name2),node.parent.find_or_declare(name3)])
 	if getattr(self,'install_task',None):
 		self.install_task.hasrun=Task.SKIP_ME
 		bld=self.bld
 		path=self.install_task.dest
-		t1=bld.install_as(path+os.sep+name3,node,env=self.env,chmod=self.link_task.chmod)
-		t2=bld.symlink_as(path+os.sep+name2,name3)
-		t3=bld.symlink_as(path+os.sep+libname,name3)
-		self.vnum_install_task=(t1,t2,t3)
+		if self.env.DEST_OS=='openbsd':
+			libname=self.link_task.outputs[0].name
+			t1=bld.install_as('%s%s%s'%(path,os.sep,libname),node,env=self.env,chmod=self.link_task.chmod)
+			self.vnum_install_task=(t1,)
+		else:
+			t1=bld.install_as(path+os.sep+name3,node,env=self.env,chmod=self.link_task.chmod)
+			t2=bld.symlink_as(path+os.sep+name2,name3)
+			t3=bld.symlink_as(path+os.sep+libname,name3)
+			self.vnum_install_task=(t1,t2,t3)
 	if'-dynamiclib'in self.env['LINKFLAGS']:
 		try:
 			inst_to=self.install_path
@@ -341,11 +355,11 @@
 			x.sig=Utils.h_file(x.abspath())
 		return Task.SKIP_ME
 @conf
-def read_shlib(self,name,paths=[]):
-	return self(name=name,features='fake_lib',lib_paths=paths,lib_type='shlib')
+def read_shlib(self,name,paths=[],export_includes=[],export_defines=[]):
+	return self(name=name,features='fake_lib',lib_paths=paths,lib_type='shlib',export_includes=export_includes,export_defines=export_defines)
 @conf
-def read_stlib(self,name,paths=[]):
-	return self(name=name,features='fake_lib',lib_paths=paths,lib_type='stlib')
+def read_stlib(self,name,paths=[],export_includes=[],export_defines=[]):
+	return self(name=name,features='fake_lib',lib_paths=paths,lib_type='stlib',export_includes=export_includes,export_defines=export_defines)
 lib_patterns={'shlib':['lib%s.so','%s.so','lib%s.dylib','lib%s.dll','%s.dll'],'stlib':['lib%s.a','%s.a','lib%s.dll','%s.dll','lib%s.lib','%s.lib'],}
 @feature('fake_lib')
 def process_lib(self):
--- a/waflib/Tools/cs.py
+++ b/waflib/Tools/cs.py
@@ -103,7 +103,7 @@
 		if flag.find(' ')>-1:
 			for x in('/r:','/reference:','/resource:','/lib:','/out:'):
 				if flag.startswith(x):
-					flag='%s"%s"'%(x,flag[len(x):])
+					flag='%s"%s"'%(x,'","'.join(flag[len(x):].split(',')))
 					break
 			else:
 				flag='"%s"'%flag
--- a/waflib/Tools/fc_config.py
+++ b/waflib/Tools/fc_config.py
@@ -51,8 +51,8 @@
 @conf
 def fortran_modifier_darwin(conf):
 	v=conf.env
-	v['FCFLAGS_fcshlib']=['-fPIC','-compatibility_version','1','-current_version','1']
-	v['LINKFLAGS_fcshlib']=['-dynamiclib']
+	v['FCFLAGS_fcshlib']=['-fPIC']
+	v['LINKFLAGS_fcshlib']=['-dynamiclib','-Wl,-compatibility_version,1','-Wl,-current_version,1']
 	v['fcshlib_PATTERN']='lib%s.dylib'
 	v['FRAMEWORKPATH_ST']='-F%s'
 	v['FRAMEWORK_ST']='-framework %s'
--- a/waflib/Tools/gcc.py
+++ b/waflib/Tools/gcc.py
@@ -2,8 +2,6 @@
 # encoding: utf-8
 # WARNING! Do not edit! http://waf.googlecode.com/git/docs/wafbook/single.html#_obtaining_the_waf_file
 
-import os,sys
-from waflib import Configure,Options,Utils
 from waflib.Tools import ccroot,ar
 from waflib.Configure import conf
 @conf
@@ -59,8 +57,8 @@
 @conf
 def gcc_modifier_darwin(conf):
 	v=conf.env
-	v['CFLAGS_cshlib']=['-fPIC','-compatibility_version','1','-current_version','1']
-	v['LINKFLAGS_cshlib']=['-dynamiclib']
+	v['CFLAGS_cshlib']=['-fPIC']
+	v['LINKFLAGS_cshlib']=['-dynamiclib','-Wl,-compatibility_version,1','-Wl,-current_version,1']
 	v['cshlib_PATTERN']='lib%s.dylib'
 	v['FRAMEWORKPATH_ST']='-F%s'
 	v['FRAMEWORK_ST']=['-framework']
@@ -82,6 +80,9 @@
 	v['STLIB_MARKER']='-Bstatic'
 	v['CFLAGS_cshlib']=['-fPIC','-DPIC']
 	v['cshlib_PATTERN']='lib%s.sl'
+@conf
+def gcc_modifier_openbsd(conf):
+	conf.env.SONAME_ST=[]
 @conf
 def gcc_modifier_platform(conf):
 	gcc_modifier_func=getattr(conf,'gcc_modifier_'+conf.env.DEST_OS,None)
--- a/waflib/Tools/gxx.py
+++ b/waflib/Tools/gxx.py
@@ -2,8 +2,6 @@
 # encoding: utf-8
 # WARNING! Do not edit! http://waf.googlecode.com/git/docs/wafbook/single.html#_obtaining_the_waf_file
 
-import os,sys
-from waflib import Configure,Options,Utils
 from waflib.Tools import ccroot,ar
 from waflib.Configure import conf
 @conf
@@ -59,8 +57,8 @@
 @conf
 def gxx_modifier_darwin(conf):
 	v=conf.env
-	v['CXXFLAGS_cxxshlib']=['-fPIC','-compatibility_version','1','-current_version','1']
-	v['LINKFLAGS_cxxshlib']=['-dynamiclib']
+	v['CXXFLAGS_cxxshlib']=['-fPIC']
+	v['LINKFLAGS_cxxshlib']=['-dynamiclib','-Wl,-compatibility_version,1','-Wl,-current_version,1']
 	v['cxxshlib_PATTERN']='lib%s.dylib'
 	v['FRAMEWORKPATH_ST']='-F%s'
 	v['FRAMEWORK_ST']=['-framework']
@@ -82,6 +80,9 @@
 	v['STLIB_MARKER']='-Bstatic'
 	v['CFLAGS_cxxshlib']=['-fPIC','-DPIC']
 	v['cxxshlib_PATTERN']='lib%s.sl'
+@conf
+def gxx_modifier_openbsd(conf):
+	conf.env.SONAME_ST=[]
 @conf
 def gxx_modifier_platform(conf):
 	gxx_modifier_func=getattr(conf,'gxx_modifier_'+conf.env.DEST_OS,None)
--- a/waflib/Tools/javaw.py
+++ b/waflib/Tools/javaw.py
@@ -202,7 +202,7 @@
 			ret=self.exec_command(cmd,cwd=wd,env=env.env or None)
 		finally:
 			if tmp:
-				os.unlink(tmp)
+				os.remove(tmp)
 		return ret
 	def post_run(self):
 		for n in self.generator.outdir.ant_glob('**/*.class'):
@@ -270,9 +270,7 @@
 		classpath+=os.pathsep+with_classpath
 	shutil.rmtree(javatestdir,True)
 	os.mkdir(javatestdir)
-	java_file=open(os.path.join(javatestdir,'Test.java'),'w')
-	java_file.write(class_check_source)
-	java_file.close()
+	Utils.writef(os.path.join(javatestdir,'Test.java'),class_check_source)
 	self.exec_command(self.env['JAVAC']+[os.path.join(javatestdir,'Test.java')],shell=False)
 	cmd=self.env['JAVA']+['-cp',classpath,'Test',classname]
 	self.to_log("%s\n"%str(cmd))
--- a/waflib/Tools/msvc.py
+++ b/waflib/Tools/msvc.py
@@ -3,7 +3,7 @@
 # WARNING! Do not edit! http://waf.googlecode.com/git/docs/wafbook/single.html#_obtaining_the_waf_file
 
 import os,sys,re,tempfile
-from waflib import Utils,Task,Logs,Options
+from waflib import Utils,Task,Logs,Options,Errors
 from waflib.Logs import debug,warn
 from waflib.TaskGen import after_method,feature
 from waflib.Configure import conf
@@ -28,7 +28,7 @@
 version vfw32 wbemuuid  webpost wiaguid wininet winmm winscard winspool winstrm
 wintrust wldap32 wmiutils wow32 ws2_32 wsnmp32 wsock32 wst wtsapi32 xaswitch xolehlp
 '''.split()
-all_msvc_platforms=[('x64','amd64'),('x86','x86'),('ia64','ia64'),('x86_amd64','amd64'),('x86_ia64','ia64')]
+all_msvc_platforms=[('x64','amd64'),('x86','x86'),('ia64','ia64'),('x86_amd64','amd64'),('x86_ia64','ia64'),('x86_arm','arm')]
 all_wince_platforms=[('armv4','arm'),('armv4i','arm'),('mipsii','mips'),('mipsii_fp','mips'),('mipsiv','mips'),('mipsiv_fp','mips'),('sh4','sh'),('x86','cex86')]
 all_icl_platforms=[('intel64','amd64'),('em64t','amd64'),('ia32','x86'),('Itanium','ia64')]
 def options(opt):
@@ -66,23 +66,12 @@
 call "%s" %s
 echo PATH=%%PATH%%
 echo INCLUDE=%%INCLUDE%%
-echo LIB=%%LIB%%
+echo LIB=%%LIB%%;%%LIBPATH%%
 """%(vcvars,target))
 	sout=conf.cmd_and_log(['cmd','/E:on','/V:on','/C',batfile.abspath()])
 	lines=sout.splitlines()
 	if not lines[0]:
 		lines.pop(0)
-	if version=='11.0':
-		if lines[0].startswith('Error'):
-			conf.fatal('msvc: Could not find a valid architecture for building (get_msvc_version_1)')
-	else:
-		for x in('Setting environment','Setting SDK environment','Intel(R) C++ Compiler','Intel Parallel Studio','Intel(R) Parallel Studio','Intel(R) Composer','Intel Corporation. All rights reserved.'):
-			if lines[0].find(x)>-1:
-				lines.pop(0)
-				break
-		else:
-			debug('msvc: get_msvc_version: %r %r %r -> not found',compiler,version,target)
-			conf.fatal('msvc: Could not find a valid architecture for building (get_msvc_version_2)')
 	MSVC_PATH=MSVC_INCDIR=MSVC_LIBDIR=None
 	for line in lines:
 		if line.startswith('PATH='):
@@ -232,7 +221,8 @@
 			targets.append(('x86',('x86',conf.get_msvc_version('msvc',version,'',os.path.join(vc_path,'Bin','vcvars32.bat')))))
 		except conf.errors.ConfigurationError:
 			pass
-	versions.append(('msvc '+version,targets))
+	if targets:
+		versions.append(('msvc '+version,targets))
 @conf
 def gather_wince_targets(conf,versions,version,vc_path,vsvars,supported_platforms):
 	for device,platforms in supported_platforms:
@@ -253,6 +243,16 @@
 		if cetargets:
 			versions.append((device+' '+version,cetargets))
 @conf
+def gather_winphone_targets(conf,versions,version,vc_path,vsvars):
+	targets=[]
+	for target,realtarget in all_msvc_platforms[::-1]:
+		try:
+			targets.append((target,(realtarget,conf.get_msvc_version('winphone',version,target,vsvars))))
+		except conf.errors.ConfigurationError ,e:
+			pass
+	if targets:
+		versions.append(('winphone '+version,targets))
+@conf
 def gather_msvc_versions(conf,versions):
 	vc_paths=[]
 	for(v,version,reg)in gather_msvc_detected_versions():
@@ -271,6 +271,9 @@
 		vsvars=os.path.join(vs_path,'Common7','Tools','vsvars32.bat')
 		if wince_supported_platforms and os.path.isfile(vsvars):
 			conf.gather_wince_targets(versions,version,vc_path,vsvars,wince_supported_platforms)
+		vsvars=os.path.join(vs_path,'VC','WPSDK','WP80','vcvarsphoneall.bat')
+		if os.path.isfile(vsvars):
+			conf.gather_winphone_targets(versions,'8.0',vc_path,vsvars)
 	for version,vc_path in vc_paths:
 		vs_path=os.path.dirname(vc_path)
 		conf.gather_msvc_targets(versions,version,vc_path)
@@ -369,10 +372,12 @@
 					setattr(conf,compilervars_warning_attr,False)
 					patch_url='http://software.intel.com/en-us/forums/topic/328487'
 					compilervars_arch=os.path.join(path,'bin','compilervars_arch.bat')
-					vs_express_path=os.environ['VS110COMNTOOLS']+r'..\IDE\VSWinExpress.exe'
-					dev_env_path=os.environ['VS110COMNTOOLS']+r'..\IDE\devenv.exe'
-					if(r'if exist "%VS110COMNTOOLS%..\IDE\VSWinExpress.exe"'in Utils.readf(compilervars_arch)and not os.path.exists(vs_express_path)and not os.path.exists(dev_env_path)):
-						Logs.warn(('The Intel compilervar_arch.bat only checks for one Visual Studio SKU ''(VSWinExpress.exe) but it does not seem to be installed at %r. ''The intel command line set up will fail to configure unless the file %r''is patched. See: %s')%(vs_express_path,compilervars_arch,patch_url))
+					for vscomntool in['VS110COMNTOOLS','VS100COMNTOOLS']:
+						if vscomntool in os.environ:
+							vs_express_path=os.environ[vscomntool]+r'..\IDE\VSWinExpress.exe'
+							dev_env_path=os.environ[vscomntool]+r'..\IDE\devenv.exe'
+							if(r'if exist "%VS110COMNTOOLS%..\IDE\VSWinExpress.exe"'in Utils.readf(compilervars_arch)and not os.path.exists(vs_express_path)and not os.path.exists(dev_env_path)):
+								Logs.warn(('The Intel compilervar_arch.bat only checks for one Visual Studio SKU ''(VSWinExpress.exe) but it does not seem to be installed at %r. ''The intel command line set up will fail to configure unless the file %r''is patched. See: %s')%(vs_express_path,compilervars_arch,patch_url))
 			except WindowsError:
 				pass
 		major=version[0:2]
@@ -544,8 +549,9 @@
 	if v.MSVC_MANIFEST:
 		conf.find_program('MT',path_list=path,var='MT')
 		v['MTFLAGS']=['/NOLOGO']
-	conf.load('winres')
-	if not conf.env['WINRC']:
+	try:
+		conf.load('winres')
+	except Errors.WafError:
 		warn('Resource compiler not found. Compiling resource file is disabled')
 @conf
 def visual_studio_add_flags(self):
@@ -563,11 +569,10 @@
 	v['DEFINES_ST']='/D%s'
 	v['CC_SRC_F']=''
 	v['CC_TGT_F']=['/c','/Fo']
-	if v['MSVC_VERSION']>=8:
-		v['CC_TGT_F']=['/FC']+v['CC_TGT_F']
 	v['CXX_SRC_F']=''
 	v['CXX_TGT_F']=['/c','/Fo']
-	if v['MSVC_VERSION']>=8:
+	if(v.MSVC_COMPILER=='msvc'and v.MSVC_VERSION>=8)or(v.MSVC_COMPILER=='wsdk'and v.MSVC_VERSION>=6):
+		v['CC_TGT_F']=['/FC']+v['CC_TGT_F']
 		v['CXX_TGT_F']=['/FC']+v['CXX_TGT_F']
 	v['CPPPATH_ST']='/I%s'
 	v['AR_TGT_F']=v['CCLNK_TGT_F']=v['CXXLNK_TGT_F']='/OUT:'
@@ -681,7 +686,6 @@
 				pass
 	return ret
 def exec_command_msvc(self,*k,**kw):
-	assert self.env['CC_NAME']=='msvc'
 	if isinstance(k[0],list):
 		lst=[]
 		carry=''
@@ -724,3 +728,22 @@
 	return derived_class
 for k in'c cxx cprogram cxxprogram cshlib cxxshlib cstlib cxxstlib'.split():
 	wrap_class(k)
+def make_winapp(self,family):
+	append=self.env.append_unique
+	append('DEFINES','WINAPI_FAMILY=%s'%family)
+	append('CXXFLAGS','/ZW')
+	append('CXXFLAGS','/TP')
+	for lib_path in self.env.LIBPATH:
+		append('CXXFLAGS','/AI%s'%lib_path)
+@feature('winphoneapp')
+@after_method('process_use')
+@after_method('propagate_uselib_vars')
+def make_winphone_app(self):
+	make_winapp(self,'WINAPI_FAMILY_PHONE_APP')
+	conf.env.append_unique('LINKFLAGS','/NODEFAULTLIB:ole32.lib')
+	conf.env.append_unique('LINKFLAGS','PhoneAppModelHost.lib')
+@feature('winapp')
+@after_method('process_use')
+@after_method('propagate_uselib_vars')
+def make_windows_app(self):
+	make_winapp(self,'WINAPI_FAMILY_DESKTOP_APP')
--- a/waflib/Tools/python.py
+++ b/waflib/Tools/python.py
@@ -170,7 +170,7 @@
 	all_flags=dct['LDFLAGS']+' '+dct['LDSHARED']+' '+dct['CFLAGS']
 	conf.parse_flags(all_flags,'PYEXT')
 	result=None
-	for name in('python'+env['PYTHON_VERSION'],'python'+env['PYTHON_VERSION'].replace('.','')):
+	for name in('python'+env['PYTHON_VERSION'],'python'+env['PYTHON_VERSION']+'m','python'+env['PYTHON_VERSION'].replace('.','')):
 		if not result and env['LIBPATH_PYEMBED']:
 			path=env['LIBPATH_PYEMBED']
 			conf.to_log("\n\n# Trying default LIBPATH_PYEMBED: %r\n"%path)
@@ -230,9 +230,12 @@
 		conf.check(header_name='Python.h',define_name='HAVE_PYTHON_H',uselib='PYEMBED',fragment=FRAG,errmsg=':-(')
 	except conf.errors.ConfigurationError:
 		xx=conf.env.CXX_NAME and'cxx'or'c'
-		conf.check_cfg(msg='Asking python-config for the flags (pyembed)',path=conf.env.PYTHON_CONFIG,package='',uselib_store='PYEMBED',args=['--cflags','--libs','--ldflags'])
+		flags=['--cflags','--libs','--ldflags']
+		for f in flags:
+			conf.check_cfg(msg='Asking python-config for pyembed %s flags'%f,path=conf.env.PYTHON_CONFIG,package='',uselib_store='PYEMBED',args=[f])
 		conf.check(header_name='Python.h',define_name='HAVE_PYTHON_H',msg='Getting pyembed flags from python-config',fragment=FRAG,errmsg='Could not build a python embedded interpreter',features='%s %sprogram pyembed'%(xx,xx))
-		conf.check_cfg(msg='Asking python-config for the flags (pyext)',path=conf.env.PYTHON_CONFIG,package='',uselib_store='PYEXT',args=['--cflags','--libs','--ldflags'])
+		for f in flags:
+			conf.check_cfg(msg='Asking python-config for pyext %s flags'%f,path=conf.env.PYTHON_CONFIG,package='',uselib_store='PYEXT',args=[f])
 		conf.check(header_name='Python.h',define_name='HAVE_PYTHON_H',msg='Getting pyext flags from python-config',features='%s %sshlib pyext'%(xx,xx),fragment=FRAG,errmsg='Could not build python extensions')
 @conf
 def check_python_version(conf,minver=None):
--- a/waflib/Tools/qt4.py
+++ b/waflib/Tools/qt4.py
@@ -20,18 +20,22 @@
 EXT_RCC=['.qrc']
 EXT_UI=['.ui']
 EXT_QT4=['.cpp','.cc','.cxx','.C']
-QT4_LIBS="QtCore QtGui QtUiTools QtNetwork QtOpenGL QtSql QtSvg QtTest QtXml QtXmlPatterns QtWebKit Qt3Support QtHelp QtScript QtDeclarative"
-class qxx(cxx.cxx):
+QT4_LIBS="QtCore QtGui QtUiTools QtNetwork QtOpenGL QtSql QtSvg QtTest QtXml QtXmlPatterns QtWebKit Qt3Support QtHelp QtScript QtDeclarative QtDesigner"
+class qxx(Task.classes['cxx']):
 	def __init__(self,*k,**kw):
 		Task.Task.__init__(self,*k,**kw)
 		self.moc_done=0
 	def scan(self):
 		(nodes,names)=c_preproc.scan(self)
+		lst=[]
 		for x in nodes:
 			if x.name.endswith('.moc'):
-				nodes.remove(x)
-				names.append(x.path_from(self.inputs[0].parent.get_bld()))
-		return(nodes,names)
+				s=x.path_from(self.inputs[0].parent.get_bld())
+				if s not in names:
+					names.append(s)
+			else:
+				lst.append(x)
+		return(lst,names)
 	def runnable_status(self):
 		if self.moc_done:
 			return Task.Task.runnable_status(self)
@@ -41,6 +45,21 @@
 					return Task.ASK_LATER
 			self.add_moc_tasks()
 			return Task.Task.runnable_status(self)
+	def create_moc_task(self,h_node,m_node):
+		try:
+			moc_cache=self.generator.bld.moc_cache
+		except AttributeError:
+			moc_cache=self.generator.bld.moc_cache={}
+		try:
+			return moc_cache[h_node]
+		except KeyError:
+			tsk=moc_cache[h_node]=Task.classes['moc'](env=self.env,generator=self.generator)
+			tsk.set_inputs(h_node)
+			tsk.set_outputs(m_node)
+			gen=self.generator.bld.producer
+			gen.outstanding.insert(0,tsk)
+			gen.total+=1
+			return tsk
 	def add_moc_tasks(self):
 		node=self.inputs[0]
 		bld=self.generator.bld
@@ -90,12 +109,7 @@
 			if not h_node:
 				raise Errors.WafError('no header found for %r which is a moc file'%d)
 			bld.node_deps[(self.inputs[0].parent.abspath(),m_node.name)]=h_node
-			task=Task.classes['moc'](env=self.env,generator=self.generator)
-			task.set_inputs(h_node)
-			task.set_outputs(m_node)
-			gen=bld.producer
-			gen.outstanding.insert(0,task)
-			gen.total+=1
+			task=self.create_moc_task(h_node,m_node)
 			moctasks.append(task)
 		tmp_lst=bld.raw_deps[self.uid()]=mocfiles
 		lst=bld.node_deps.get(self.uid(),())
@@ -102,12 +116,7 @@
 		for d in lst:
 			name=d.name
 			if name.endswith('.moc'):
-				task=Task.classes['moc'](env=self.env,generator=self.generator)
-				task.set_inputs(bld.node_deps[(self.inputs[0].parent.abspath(),name)])
-				task.set_outputs(d)
-				gen=bld.producer
-				gen.outstanding.insert(0,task)
-				gen.total+=1
+				task=self.create_moc_task(bld.node_deps[(self.inputs[0].parent.abspath(),name)],d)
 				moctasks.append(task)
 		self.run_after.update(set(moctasks))
 		self.moc_done=1
@@ -175,7 +184,7 @@
 				lst.append('-'+flag[1:])
 			else:
 				lst.append(flag)
-	self.env['MOC_FLAGS']=lst
+	self.env.append_value('MOC_FLAGS',lst)
 @extension(*EXT_QT4)
 def cxx_hook(self,node):
 	return self.create_compiled_task('qxx',node)
@@ -224,6 +233,7 @@
 def configure(self):
 	self.find_qt4_binaries()
 	self.set_qt4_libs_to_check()
+	self.set_qt4_defines()
 	self.find_qt4_libraries()
 	self.add_qt4_rpath()
 	self.simplify_qt4_libs()
@@ -405,7 +415,7 @@
 @conf
 def add_qt4_rpath(self):
 	env=self.env
-	if Options.options.want_rpath:
+	if getattr(Options.options,'want_rpath',False):
 		def process_rpath(vars_,coreval):
 			for d in vars_:
 				var=d.upper()
@@ -429,6 +439,14 @@
 	if not hasattr(self,'qt4_vars_debug'):
 		self.qt4_vars_debug=[a+'_debug'for a in self.qt4_vars]
 	self.qt4_vars_debug=Utils.to_list(self.qt4_vars_debug)
+@conf
+def set_qt4_defines(self):
+	if sys.platform!='win32':
+		return
+	for x in self.qt4_vars:
+		y=x[2:].upper()
+		self.env.append_unique('DEFINES_%s'%x.upper(),'QT_%s_LIB'%y)
+		self.env.append_unique('DEFINES_%s_DEBUG'%x.upper(),'QT_%s_LIB'%y)
 def options(opt):
 	opt.add_option('--want-rpath',action='store_true',default=False,dest='want_rpath',help='enable the rpath for qt libraries')
 	opt.add_option('--header-ext',type='string',default='',help='header extension for moc files',dest='qt_header_ext')
--- a/waflib/Tools/suncc.py
+++ b/waflib/Tools/suncc.py
@@ -21,6 +21,7 @@
 		conf.fatal('%r is not a Sun compiler'%cc)
 	v['CC']=cc
 	v['CC_NAME']='sun'
+	conf.get_suncc_version(cc)
 @conf
 def scc_common_flags(conf):
 	v=conf.env
--- a/waflib/Tools/suncxx.py
+++ b/waflib/Tools/suncxx.py
@@ -22,6 +22,7 @@
 		conf.fatal('%r is not a Sun compiler'%cc)
 	v['CXX']=cc
 	v['CXX_NAME']='sun'
+	conf.get_suncc_version(cc)
 @conf
 def sxx_common_flags(conf):
 	v=conf.env
--- a/waflib/Tools/tex.py
+++ b/waflib/Tools/tex.py
@@ -78,7 +78,10 @@
 						for k in exts_deps_tex:
 							Logs.debug('tex: trying %s%s'%(path,k))
 							found=node.parent.find_resource(path+k)
-							if found and not found in self.outputs:
+							for tsk in self.generator.tasks:
+								if not found or found in tsk.outputs:
+									break
+							else:
 								nodes.append(found)
 								add_name=False
 								for ext in exts_tex:
@@ -96,22 +99,18 @@
 		if retcode!=0:
 			raise Errors.WafError("%r command exit status %r"%(msg,retcode))
 	def bibfile(self):
-		need_bibtex=False
-		try:
-			for aux_node in self.aux_nodes:
+		for aux_node in self.aux_nodes:
+			try:
 				ct=aux_node.read()
-				if g_bibtex_re.findall(ct):
-					need_bibtex=True
-					break
-		except(OSError,IOError):
-			Logs.error('error bibtex scan')
-		else:
-			if need_bibtex:
+			except(OSError,IOError):
+				Logs.error('Error reading %s: %r'%aux_node.abspath())
+				continue
+			if g_bibtex_re.findall(ct):
 				Logs.warn('calling bibtex')
 				self.env.env={}
 				self.env.env.update(os.environ)
 				self.env.env.update({'BIBINPUTS':self.TEXINPUTS,'BSTINPUTS':self.TEXINPUTS})
-				self.env.SRCFILE=self.aux_nodes[0].name[:-4]
+				self.env.SRCFILE=aux_node.name[:-4]
 				self.check_status('error when calling bibtex',self.bibtex_fun())
 	def bibunits(self):
 		try:
@@ -138,6 +137,10 @@
 			self.env.SRCFILE=self.idx_node.name
 			self.env.env={}
 			self.check_status('error when calling makeindex %s'%idx_path,self.makeindex_fun())
+	def bibtopic(self):
+		p=self.inputs[0].parent.get_bld()
+		if os.path.exists(os.path.join(p.abspath(),'btaux.aux')):
+			self.aux_nodes+=p.ant_glob('*[0-9].aux')
 	def run(self):
 		env=self.env
 		if not env['PROMPT_LATEX']:
@@ -158,6 +161,7 @@
 		self.check_status('error when calling latex',fun())
 		self.aux_nodes=self.scan_aux(node.change_ext('.aux'))
 		self.idx_node=node.change_ext('.idx')
+		self.bibtopic()
 		self.bibfile()
 		self.bibunits()
 		self.makeindex()
@@ -229,13 +233,16 @@
 						lst.append(n)
 			except KeyError:
 				tree.node_deps[task.uid()]=deps_lst
+		v=dict(os.environ)
+		p=node.parent.abspath()+os.pathsep+self.path.abspath()+os.pathsep+self.path.get_bld().abspath()+os.pathsep+v.get('TEXINPUTS','')+os.pathsep
+		v['TEXINPUTS']=p
 		if self.type=='latex':
 			if'ps'in outs:
 				tsk=self.create_task('dvips',task.outputs,node.change_ext('.ps'))
-				tsk.env.env={'TEXINPUTS':node.parent.abspath()+os.pathsep+self.path.abspath()+os.pathsep+self.path.get_bld().abspath()}
+				tsk.env.env=dict(v)
 			if'pdf'in outs:
 				tsk=self.create_task('dvipdf',task.outputs,node.change_ext('.pdf'))
-				tsk.env.env={'TEXINPUTS':node.parent.abspath()+os.pathsep+self.path.abspath()+os.pathsep+self.path.get_bld().abspath()}
+				tsk.env.env=dict(v)
 		elif self.type=='pdflatex':
 			if'ps'in outs:
 				self.create_task('pdf2ps',task.outputs,node.change_ext('.ps'))
--- a/waflib/Tools/waf_unit_test.py
+++ b/waflib/Tools/waf_unit_test.py
@@ -36,7 +36,9 @@
 			for g in self.generator.bld.groups:
 				for tg in g:
 					if getattr(tg,'link_task',None):
-						lst.append(tg.link_task.outputs[0].parent.abspath())
+						s=tg.link_task.outputs[0].parent.abspath()
+						if s not in lst:
+							lst.append(s)
 			def add_path(dct,path,var):
 				dct[var]=os.pathsep.join(Utils.to_list(path)+[os.environ.get(var,'')])
 			if Utils.is_win32: