Simplify env['FOO'] -> env.FOO

This commit is contained in:
Thomas Nagy 2016-06-25 23:54:12 +02:00
parent ef48d49260
commit 850e9ad5fc
No known key found for this signature in database
GPG Key ID: 67A565EDFDF90E64
37 changed files with 598 additions and 611 deletions

View File

@ -25,6 +25,7 @@ NEW IN WAF 1.9
- Enable ut_str to process scriptlet expressions for C/C++ unit tests - Enable ut_str to process scriptlet expressions for C/C++ unit tests
- Minimize the amount of paths added to unit test environment variable - Minimize the amount of paths added to unit test environment variable
- Restore configuration values with Configure.autoconfig='clobber' #1758 - Restore configuration values with Configure.autoconfig='clobber' #1758
- Rebuilds are applied on file contents so that update_outputs is no longer needed
* Performance highlights: * Performance highlights:
- Reduce the key size in bld.task_sigs by adding bld.node_sigs and bld.imp_sigs - Reduce the key size in bld.task_sigs by adding bld.node_sigs and bld.imp_sigs
@ -39,7 +40,7 @@ NEW IN WAF 1.9
* API changes: * API changes:
- The minimum Python version required is Python 2.5 - The minimum Python version required is Python 2.5
- Add Task.get_cwd() - Add Task.get_cwd()
- Remove the command called "update" - Remove the command called 'update'
- Remove unused variables and functions: - Remove unused variables and functions:
- TaskBase.attr() - TaskBase.attr()
- Build.POST_BOTH - Build.POST_BOTH

View File

@ -49,7 +49,7 @@ $ ./waf-light --make-waf --tools=compat15,/comp/waf/aba.py --prelude=$'\tfrom wa
Or, to avoid regenerating the waf file all the time, just set the `WAFDIR` environment variable to the directory containing "waflib". Or, to avoid regenerating the waf file all the time, just set the `WAFDIR` environment variable to the directory containing "waflib".
## HOW TO TRY THE EXAMPLES ## HOW TO RUN THE EXAMPLES
Try this: Try this:
```sh ```sh

View File

@ -295,9 +295,9 @@ class BuildContext(Context.Context):
except EnvironmentError: except EnvironmentError:
pass pass
else: else:
if env['version'] < Context.HEXVERSION: if env.version < Context.HEXVERSION:
raise Errors.WafError('Version mismatch! reconfigure the project') raise Errors.WafError('Version mismatch! reconfigure the project')
for t in env['tools']: for t in env.tools:
self.setup(**t) self.setup(**t)
dbfn = os.path.join(self.variant_dir, Context.DBFILE) dbfn = os.path.join(self.variant_dir, Context.DBFILE)

View File

@ -167,9 +167,9 @@ class ConfigurationContext(Context.Context):
# consider the current path as the root directory (see prepare_impl). # consider the current path as the root directory (see prepare_impl).
# to remove: use 'waf distclean' # to remove: use 'waf distclean'
env = ConfigSet.ConfigSet() env = ConfigSet.ConfigSet()
env['argv'] = sys.argv env.argv = sys.argv
env['options'] = Options.options.__dict__ env.options = Options.options.__dict__
env['config_cmd'] = self.cmd env.config_cmd = self.cmd
env.run_dir = Context.run_dir env.run_dir = Context.run_dir
env.top_dir = Context.top_dir env.top_dir = Context.top_dir
@ -177,9 +177,9 @@ class ConfigurationContext(Context.Context):
# conf.hash & conf.files hold wscript files paths and hash # conf.hash & conf.files hold wscript files paths and hash
# (used only by Configure.autoconfig) # (used only by Configure.autoconfig)
env['hash'] = self.hash env.hash = self.hash
env['files'] = self.files env.files = self.files
env['environ'] = dict(self.environ) env.environ = dict(self.environ)
if not self.env.NO_LOCK_IN_RUN and not getattr(Options.options, 'no_lock_in_run'): if not self.env.NO_LOCK_IN_RUN and not getattr(Options.options, 'no_lock_in_run'):
env.store(os.path.join(Context.run_dir, Options.lockfile)) env.store(os.path.join(Context.run_dir, Options.lockfile))

View File

@ -591,12 +591,12 @@ def autoconfigure(execute_method):
do_config = True do_config = True
else: else:
h = 0 h = 0
for f in env['files']: for f in env.files:
h = Utils.h_list((h, Utils.readf(f, 'rb'))) h = Utils.h_list((h, Utils.readf(f, 'rb')))
do_config = h != env.hash do_config = h != env.hash
if do_config: if do_config:
cmd = env['config_cmd'] or 'configure' cmd = env.config_cmd or 'configure'
if Configure.autoconfig == 'clobber': if Configure.autoconfig == 'clobber':
tmp = Options.options.__dict__ tmp = Options.options.__dict__
Options.options.__dict__ = env.options Options.options.__dict__ = env.options

View File

@ -22,7 +22,7 @@ def big_bison(self, node):
""" """
Creates a bison task, which must be executed from the directory of the output file. Creates a bison task, which must be executed from the directory of the output file.
""" """
has_h = '-d' in self.env['BISONFLAGS'] has_h = '-d' in self.env.BISONFLAGS
outs = [] outs = []
if node.name.endswith('.yc'): if node.name.endswith('.yc'):

View File

@ -484,7 +484,7 @@ def validate_c(self, kw):
if not 'compiler' in kw and not 'features' in kw: if not 'compiler' in kw and not 'features' in kw:
kw['compiler'] = 'c' kw['compiler'] = 'c'
if env['CXX_NAME'] and Task.classes.get('cxx'): if env.CXX_NAME and Task.classes.get('cxx'):
kw['compiler'] = 'cxx' kw['compiler'] = 'cxx'
if not self.env.CXX: if not self.env.CXX:
self.fatal('a c++ compiler is required') self.fatal('a c++ compiler is required')
@ -820,7 +820,7 @@ def define(self, key, val, quote=True, comment=''):
app = s % (key, str(val)) app = s % (key, str(val))
ban = key + '=' ban = key + '='
lst = self.env['DEFINES'] lst = self.env.DEFINES
for x in lst: for x in lst:
if x.startswith(ban): if x.startswith(ban):
lst[lst.index(x)] = app lst[lst.index(x)] = app
@ -842,8 +842,8 @@ def undefine(self, key, comment=''):
assert key and isinstance(key, str) assert key and isinstance(key, str)
ban = key + '=' ban = key + '='
lst = [x for x in self.env['DEFINES'] if not x.startswith(ban)] lst = [x for x in self.env.DEFINES if not x.startswith(ban)]
self.env['DEFINES'] = lst self.env.DEFINES = lst
self.env.append_unique(DEFKEYS, key) self.env.append_unique(DEFKEYS, key)
self.set_define_comment(key, comment) self.set_define_comment(key, comment)
@ -881,7 +881,7 @@ def is_defined(self, key):
assert key and isinstance(key, str) assert key and isinstance(key, str)
ban = key + '=' ban = key + '='
for x in self.env['DEFINES']: for x in self.env.DEFINES:
if x.startswith(ban): if x.startswith(ban):
return True return True
return False return False
@ -896,7 +896,7 @@ def get_define(self, key):
assert key and isinstance(key, str) assert key and isinstance(key, str)
ban = key + '=' ban = key + '='
for x in self.env['DEFINES']: for x in self.env.DEFINES:
if x.startswith(ban): if x.startswith(ban):
return x[len(ban):] return x[len(ban):]
return None return None
@ -993,7 +993,7 @@ def get_config_header(self, defines=True, headers=False, define_prefix=''):
if defines: if defines:
tbl = {} tbl = {}
for k in self.env['DEFINES']: for k in self.env.DEFINES:
a, _, b = k.partition('=') a, _, b = k.partition('=')
tbl[a] = b tbl[a] = b
@ -1125,13 +1125,13 @@ def get_cc_version(conf, cc, gcc=False, icc=False, clang=False):
Logs.debug('ccroot: dest platform: ' + ' '.join([conf.env[x] or '?' for x in ('DEST_OS', 'DEST_BINFMT', 'DEST_CPU')])) Logs.debug('ccroot: dest platform: ' + ' '.join([conf.env[x] or '?' for x in ('DEST_OS', 'DEST_BINFMT', 'DEST_CPU')]))
if icc: if icc:
ver = k['__INTEL_COMPILER'] ver = k['__INTEL_COMPILER']
conf.env['CC_VERSION'] = (ver[:-2], ver[-2], ver[-1]) conf.env.CC_VERSION = (ver[:-2], ver[-2], ver[-1])
else: else:
if isD('__clang__') and isD('__clang_major__'): if isD('__clang__') and isD('__clang_major__'):
conf.env['CC_VERSION'] = (k['__clang_major__'], k['__clang_minor__'], k['__clang_patchlevel__']) conf.env.CC_VERSION = (k['__clang_major__'], k['__clang_minor__'], k['__clang_patchlevel__'])
else: else:
# older clang versions and gcc # older clang versions and gcc
conf.env['CC_VERSION'] = (k['__GNUC__'], k['__GNUC_MINOR__'], k.get('__GNUC_PATCHLEVEL__', '0')) conf.env.CC_VERSION = (k['__GNUC__'], k['__GNUC_MINOR__'], k.get('__GNUC_PATCHLEVEL__', '0'))
return k return k
@conf @conf
@ -1150,7 +1150,7 @@ def get_xlc_version(conf, cc):
match = version_re(out or err) match = version_re(out or err)
if match: if match:
k = match.groupdict() k = match.groupdict()
conf.env['CC_VERSION'] = (k['major'], k['minor']) conf.env.CC_VERSION = (k['major'], k['minor'])
break break
else: else:
conf.fatal('Could not determine the XLC version.') conf.fatal('Could not determine the XLC version.')
@ -1179,7 +1179,7 @@ def get_suncc_version(conf, cc):
match = version_re(version) match = version_re(version)
if match: if match:
k = match.groupdict() k = match.groupdict()
conf.env['CC_VERSION'] = (k['major'], k['minor']) conf.env.CC_VERSION = (k['major'], k['minor'])
else: else:
conf.fatal('Could not determine the suncc version.') conf.fatal('Could not determine the suncc version.')

View File

@ -37,8 +37,8 @@ def set_macosx_deployment_target(self):
""" """
see WAF issue 285 and also and also http://trac.macports.org/ticket/17059 see WAF issue 285 and also and also http://trac.macports.org/ticket/17059
""" """
if self.env['MACOSX_DEPLOYMENT_TARGET']: if self.env.MACOSX_DEPLOYMENT_TARGET:
os.environ['MACOSX_DEPLOYMENT_TARGET'] = self.env['MACOSX_DEPLOYMENT_TARGET'] os.environ['MACOSX_DEPLOYMENT_TARGET'] = self.env.MACOSX_DEPLOYMENT_TARGET
elif 'MACOSX_DEPLOYMENT_TARGET' not in os.environ: elif 'MACOSX_DEPLOYMENT_TARGET' not in os.environ:
if Utils.unversioned_sys_platform() == 'darwin': if Utils.unversioned_sys_platform() == 'darwin':
os.environ['MACOSX_DEPLOYMENT_TARGET'] = '.'.join(platform.mac_ver()[0].split('.')[:2]) os.environ['MACOSX_DEPLOYMENT_TARGET'] = '.'.join(platform.mac_ver()[0].split('.')[:2])
@ -78,7 +78,7 @@ def create_task_macapp(self):
bld.env.MACAPP = True bld.env.MACAPP = True
bld.shlib(source='a.c', target='foo') bld.shlib(source='a.c', target='foo')
""" """
if self.env['MACAPP'] or getattr(self, 'mac_app', False): if self.env.MACAPP or getattr(self, 'mac_app', False):
out = self.link_task.outputs[0] out = self.link_task.outputs[0]
name = bundle_name_for_output(out) name = bundle_name_for_output(out)
@ -114,7 +114,7 @@ def create_task_macplist(self):
""" """
Creates a :py:class:`waflib.Tools.c_osx.macplist` instance. Creates a :py:class:`waflib.Tools.c_osx.macplist` instance.
""" """
if self.env['MACAPP'] or getattr(self, 'mac_app', False): if self.env.MACAPP or getattr(self, 'mac_app', False):
out = self.link_task.outputs[0] out = self.link_task.outputs[0]
name = bundle_name_for_output(out) name = bundle_name_for_output(out)
@ -158,9 +158,9 @@ def apply_bundle(self):
bld.env.MACBUNDLE = True bld.env.MACBUNDLE = True
bld.shlib(source='a.c', target='foo') bld.shlib(source='a.c', target='foo')
""" """
if self.env['MACBUNDLE'] or getattr(self, 'mac_bundle', False): if self.env.MACBUNDLE or getattr(self, 'mac_bundle', False):
self.env['LINKFLAGS_cshlib'] = self.env['LINKFLAGS_cxxshlib'] = [] # disable the '-dynamiclib' flag self.env.LINKFLAGS_cshlib = self.env.LINKFLAGS_cxxshlib = [] # disable the '-dynamiclib' flag
self.env['cshlib_PATTERN'] = self.env['cxxshlib_PATTERN'] = self.env['macbundle_PATTERN'] self.env.cshlib_PATTERN = self.env.cxxshlib_PATTERN = self.env.macbundle_PATTERN
use = self.use = self.to_list(getattr(self, 'use', [])) use = self.use = self.to_list(getattr(self, 'use', []))
if not 'MACBUNDLE' in use: if not 'MACBUNDLE' in use:
use.append('MACBUNDLE') use.append('MACBUNDLE')

View File

@ -118,10 +118,10 @@ def apply_incpaths(self):
and the list of include paths in ``tg.env.INCLUDES``. and the list of include paths in ``tg.env.INCLUDES``.
""" """
lst = self.to_incnodes(self.to_list(getattr(self, 'includes', [])) + self.env['INCLUDES']) lst = self.to_incnodes(self.to_list(getattr(self, 'includes', [])) + self.env.INCLUDES)
self.includes_nodes = lst self.includes_nodes = lst
cwd = self.get_cwd() cwd = self.get_cwd()
self.env['INCPATHS'] = [x.path_from(cwd) for x in lst] self.env.INCPATHS = [x.path_from(cwd) for x in lst]
class link_task(Task.Task): class link_task(Task.Task):
""" """
@ -498,9 +498,9 @@ def apply_implib(self):
name = self.target.name name = self.target.name
else: else:
name = os.path.split(self.target)[1] name = os.path.split(self.target)[1]
implib = self.env['implib_PATTERN'] % name implib = self.env.implib_PATTERN % name
implib = dll.parent.find_or_declare(implib) implib = dll.parent.find_or_declare(implib)
self.env.append_value('LINKFLAGS', self.env['IMPLIB_ST'] % implib.bldpath()) self.env.append_value('LINKFLAGS', self.env.IMPLIB_ST % implib.bldpath())
self.link_task.outputs.append(implib) self.link_task.outputs.append(implib)
if getattr(self, 'defs', None) and self.env.DEST_BINFMT == 'pe': if getattr(self, 'defs', None) and self.env.DEST_BINFMT == 'pe':
@ -608,7 +608,7 @@ def apply_vnum(self):
else: else:
self.vnum_install_task = (t1, t3) self.vnum_install_task = (t1, t3)
if '-dynamiclib' in self.env['LINKFLAGS']: if '-dynamiclib' in self.env.LINKFLAGS:
# this requires after(propagate_uselib_vars) # this requires after(propagate_uselib_vars)
try: try:
inst_to = self.install_path inst_to = self.install_path

View File

@ -57,7 +57,7 @@ def d_hook(self, node):
if getattr(self, 'generate_headers', None): if getattr(self, 'generate_headers', None):
tsk = create_compiled_task(self, 'd_with_header', node) tsk = create_compiled_task(self, 'd_with_header', node)
tsk.outputs.append(node.change_ext(self.env['DHEADER_ext'])) tsk.outputs.append(node.change_ext(self.env.DHEADER_ext))
else: else:
tsk = create_compiled_task(self, 'd', node) tsk = create_compiled_task(self, 'd', node)
return tsk return tsk

View File

@ -8,24 +8,24 @@ from waflib.Configure import conf
@conf @conf
def d_platform_flags(self): def d_platform_flags(self):
""" """
Set the extensions dll/so for d programs and libraries Sets the extensions dll/so for d programs and libraries
""" """
v = self.env v = self.env
if not v.DEST_OS: if not v.DEST_OS:
v.DEST_OS = Utils.unversioned_sys_platform() v.DEST_OS = Utils.unversioned_sys_platform()
binfmt = Utils.destos_to_binfmt(self.env.DEST_OS) binfmt = Utils.destos_to_binfmt(self.env.DEST_OS)
if binfmt == 'pe': if binfmt == 'pe':
v['dprogram_PATTERN'] = '%s.exe' v.dprogram_PATTERN = '%s.exe'
v['dshlib_PATTERN'] = 'lib%s.dll' v.dshlib_PATTERN = 'lib%s.dll'
v['dstlib_PATTERN'] = 'lib%s.a' v.dstlib_PATTERN = 'lib%s.a'
elif binfmt == 'mac-o': elif binfmt == 'mac-o':
v['dprogram_PATTERN'] = '%s' v.dprogram_PATTERN = '%s'
v['dshlib_PATTERN'] = 'lib%s.dylib' v.dshlib_PATTERN = 'lib%s.dylib'
v['dstlib_PATTERN'] = 'lib%s.a' v.dstlib_PATTERN = 'lib%s.a'
else: else:
v['dprogram_PATTERN'] = '%s' v.dprogram_PATTERN = '%s'
v['dshlib_PATTERN'] = 'lib%s.so' v.dshlib_PATTERN = 'lib%s.so'
v['dstlib_PATTERN'] = 'lib%s.a' v.dstlib_PATTERN = 'lib%s.a'
DLIB = ''' DLIB = '''
version(D_Version2) { version(D_Version2) {

View File

@ -10,7 +10,7 @@ from waflib.Configure import conf
@conf @conf
def find_dmd(conf): def find_dmd(conf):
""" """
Find the program *dmd*, *dmd2*, or *ldc* and set the variable *D* Finds the program *dmd*, *dmd2*, or *ldc* and set the variable *D*
""" """
conf.find_program(['dmd', 'dmd2', 'ldc'], var='D') conf.find_program(['dmd', 'dmd2', 'ldc'], var='D')
@ -24,48 +24,40 @@ def find_dmd(conf):
@conf @conf
def common_flags_ldc(conf): def common_flags_ldc(conf):
""" """
Set the D flags required by *ldc* Sets the D flags required by *ldc*
""" """
v = conf.env v = conf.env
v['DFLAGS'] = ['-d-version=Posix'] v.DFLAGS = ['-d-version=Posix']
v['LINKFLAGS'] = [] v.LINKFLAGS = []
v['DFLAGS_dshlib'] = ['-relocation-model=pic'] v.DFLAGS_dshlib = ['-relocation-model=pic']
@conf @conf
def common_flags_dmd(conf): def common_flags_dmd(conf):
""" """
Set the flags required by *dmd* or *dmd2* Set the flags required by *dmd* or *dmd2*
""" """
v = conf.env v = conf.env
# _DFLAGS _DIMPORTFLAGS v.D_SRC_F = ['-c']
v.D_TGT_F = '-of%s'
# Compiler is dmd so 'gdc' part will be ignored, just v.D_LINKER = v.D
# ensure key is there, so wscript can append flags to it v.DLNK_SRC_F = ''
#v['DFLAGS'] = ['-version=Posix'] v.DLNK_TGT_F = '-of%s'
v.DINC_ST = '-I%s'
v['D_SRC_F'] = ['-c'] v.DSHLIB_MARKER = v.DSTLIB_MARKER = ''
v['D_TGT_F'] = '-of%s' v.DSTLIB_ST = v.DSHLIB_ST = '-L-l%s'
v.DSTLIBPATH_ST = v.DLIBPATH_ST = '-L-L%s'
# linker v.LINKFLAGS_dprogram= ['-quiet']
v['D_LINKER'] = v['D']
v['DLNK_SRC_F'] = ''
v['DLNK_TGT_F'] = '-of%s'
v['DINC_ST'] = '-I%s'
v['DSHLIB_MARKER'] = v['DSTLIB_MARKER'] = '' v.DFLAGS_dshlib = ['-fPIC']
v['DSTLIB_ST'] = v['DSHLIB_ST'] = '-L-l%s' v.LINKFLAGS_dshlib = ['-L-shared']
v['DSTLIBPATH_ST'] = v['DLIBPATH_ST'] = '-L-L%s'
v['LINKFLAGS_dprogram']= ['-quiet'] v.DHEADER_ext = '.di'
v['DFLAGS_dshlib'] = ['-fPIC']
v['LINKFLAGS_dshlib'] = ['-L-shared']
v['DHEADER_ext'] = '.di'
v.DFLAGS_d_with_header = ['-H', '-Hf'] v.DFLAGS_d_with_header = ['-H', '-Hf']
v['D_HDR_F'] = '%s' v.D_HDR_F = '%s'
def configure(conf): def configure(conf):
""" """
@ -75,7 +67,7 @@ def configure(conf):
if sys.platform == 'win32': if sys.platform == 'win32':
out = conf.cmd_and_log(conf.env.D + ['--help']) out = conf.cmd_and_log(conf.env.D + ['--help'])
if out.find("D Compiler v2.") > -1: if out.find('D Compiler v2.') > -1:
conf.fatal('dmd2 on Windows is not supported, use gdc or ldc2 instead') conf.fatal('dmd2 on Windows is not supported, use gdc or ldc2 instead')
conf.load('ar') conf.load('ar')

View File

@ -21,29 +21,31 @@ def fc_flags(conf):
""" """
v = conf.env v = conf.env
v['FC_SRC_F'] = [] v.FC_SRC_F = []
v['FC_TGT_F'] = ['-c', '-o'] v.FC_TGT_F = ['-c', '-o']
v['FCINCPATH_ST'] = '-I%s' v.FCINCPATH_ST = '-I%s'
v['FCDEFINES_ST'] = '-D%s' v.FCDEFINES_ST = '-D%s'
if not v['LINK_FC']: v['LINK_FC'] = v['FC'] if not v.LINK_FC:
v['FCLNK_SRC_F'] = [] v.LINK_FC = v.FC
v['FCLNK_TGT_F'] = ['-o']
v['FCFLAGS_fcshlib'] = ['-fpic'] v.FCLNK_SRC_F = []
v['LINKFLAGS_fcshlib'] = ['-shared'] v.FCLNK_TGT_F = ['-o']
v['fcshlib_PATTERN'] = 'lib%s.so'
v['fcstlib_PATTERN'] = 'lib%s.a' v.FCFLAGS_fcshlib = ['-fpic']
v.LINKFLAGS_fcshlib = ['-shared']
v.fcshlib_PATTERN = 'lib%s.so'
v['FCLIB_ST'] = '-l%s' v.fcstlib_PATTERN = 'lib%s.a'
v['FCLIBPATH_ST'] = '-L%s'
v['FCSTLIB_ST'] = '-l%s'
v['FCSTLIBPATH_ST'] = '-L%s'
v['FCSTLIB_MARKER'] = '-Wl,-Bstatic'
v['FCSHLIB_MARKER'] = '-Wl,-Bdynamic'
v['SONAME_ST'] = '-Wl,-h,%s' v.FCLIB_ST = '-l%s'
v.FCLIBPATH_ST = '-L%s'
v.FCSTLIB_ST = '-l%s'
v.FCSTLIBPATH_ST = '-L%s'
v.FCSTLIB_MARKER = '-Wl,-Bstatic'
v.FCSHLIB_MARKER = '-Wl,-Bdynamic'
v.SONAME_ST = '-Wl,-h,%s'
@conf @conf
def fc_add_flags(conf): def fc_add_flags(conf):
@ -92,30 +94,30 @@ def fortran_modifier_darwin(conf):
Define fortran flags and extensions for the OSX systems Define fortran flags and extensions for the OSX systems
""" """
v = conf.env v = conf.env
v['FCFLAGS_fcshlib'] = ['-fPIC'] v.FCFLAGS_fcshlib = ['-fPIC']
v['LINKFLAGS_fcshlib'] = ['-dynamiclib'] v.LINKFLAGS_fcshlib = ['-dynamiclib']
v['fcshlib_PATTERN'] = 'lib%s.dylib' v.fcshlib_PATTERN = 'lib%s.dylib'
v['FRAMEWORKPATH_ST'] = '-F%s' v.FRAMEWORKPATH_ST = '-F%s'
v['FRAMEWORK_ST'] = '-framework %s' v.FRAMEWORK_ST = '-framework %s'
v['LINKFLAGS_fcstlib'] = [] v.LINKFLAGS_fcstlib = []
v['FCSHLIB_MARKER'] = '' v.FCSHLIB_MARKER = ''
v['FCSTLIB_MARKER'] = '' v.FCSTLIB_MARKER = ''
v['SONAME_ST'] = '' v.SONAME_ST = ''
@conf @conf
def fortran_modifier_win32(conf): def fortran_modifier_win32(conf):
"""Define fortran flags for the windows platforms""" """Define fortran flags for the windows platforms"""
v = conf.env v = conf.env
v['fcprogram_PATTERN'] = v['fcprogram_test_PATTERN'] = '%s.exe' v.fcprogram_PATTERN = v.fcprogram_test_PATTERN = '%s.exe'
v['fcshlib_PATTERN'] = '%s.dll' v.fcshlib_PATTERN = '%s.dll'
v['implib_PATTERN'] = 'lib%s.dll.a' v.implib_PATTERN = 'lib%s.dll.a'
v['IMPLIB_ST'] = '-Wl,--out-implib,%s' v.IMPLIB_ST = '-Wl,--out-implib,%s'
v['FCFLAGS_fcshlib'] = [] v.FCFLAGS_fcshlib = []
# Auto-import is enabled by default even without this option, # Auto-import is enabled by default even without this option,
# but enabling it explicitly has the nice effect of suppressing the rather boring, debug-level messages # but enabling it explicitly has the nice effect of suppressing the rather boring, debug-level messages
@ -127,9 +129,9 @@ def fortran_modifier_cygwin(conf):
"""Define fortran flags for use on cygwin""" """Define fortran flags for use on cygwin"""
fortran_modifier_win32(conf) fortran_modifier_win32(conf)
v = conf.env v = conf.env
v['fcshlib_PATTERN'] = 'cyg%s.dll' v.fcshlib_PATTERN = 'cyg%s.dll'
v.append_value('LINKFLAGS_fcshlib', ['-Wl,--enable-auto-image-base']) v.append_value('LINKFLAGS_fcshlib', ['-Wl,--enable-auto-image-base'])
v['FCFLAGS_fcshlib'] = [] v.FCFLAGS_fcshlib = []
# ------------------------------------------------------------------------ # ------------------------------------------------------------------------
@conf @conf
@ -445,7 +447,7 @@ def check_fortran_mangling(self, *k, **kw):
@before_method('propagate_uselib_vars', 'apply_link') @before_method('propagate_uselib_vars', 'apply_link')
def set_lib_pat(self): def set_lib_pat(self):
"""Set the fortran flags for linking with the python library""" """Set the fortran flags for linking with the python library"""
self.env['fcshlib_PATTERN'] = self.env['pyext_PATTERN'] self.env.fcshlib_PATTERN = self.env.pyext_PATTERN
@conf @conf
def detect_openmp(self): def detect_openmp(self):

View File

@ -23,8 +23,8 @@ def flexfun(tsk):
if isinstance(xx, str): return [xx] if isinstance(xx, str): return [xx]
return xx return xx
tsk.last_cmd = lst = [] tsk.last_cmd = lst = []
lst.extend(to_list(env['FLEX'])) lst.extend(to_list(env.FLEX))
lst.extend(to_list(env['FLEXFLAGS'])) lst.extend(to_list(env.FLEXFLAGS))
inputs = [a.path_from(tsk.get_cwd()) for a in tsk.inputs] inputs = [a.path_from(tsk.get_cwd()) for a in tsk.inputs]
if env.FLEX_MSYS: if env.FLEX_MSYS:
inputs = [x.replace(os.sep, '/') for x in inputs] inputs = [x.replace(os.sep, '/') for x in inputs]

View File

@ -17,9 +17,9 @@ def find_g95(conf):
@conf @conf
def g95_flags(conf): def g95_flags(conf):
v = conf.env v = conf.env
v['FCFLAGS_fcshlib'] = ['-fPIC'] v.FCFLAGS_fcshlib = ['-fPIC']
v['FORTRANMODFLAG'] = ['-fmod=', ''] # template for module path v.FORTRANMODFLAG = ['-fmod=', ''] # template for module path
v['FCFLAGS_DEBUG'] = ['-Werror'] # why not v.FCFLAGS_DEBUG = ['-Werror'] # why not
@conf @conf
def g95_modifier_win32(conf): def g95_modifier_win32(conf):
@ -35,7 +35,7 @@ def g95_modifier_darwin(conf):
@conf @conf
def g95_modifier_platform(conf): def g95_modifier_platform(conf):
dest_os = conf.env['DEST_OS'] or Utils.unversioned_sys_platform() dest_os = conf.env.DEST_OS or Utils.unversioned_sys_platform()
g95_modifier_func = getattr(conf, 'g95_modifier_' + dest_os, None) g95_modifier_func = getattr(conf, 'g95_modifier_' + dest_os, None)
if g95_modifier_func: if g95_modifier_func:
g95_modifier_func() g95_modifier_func()
@ -54,7 +54,7 @@ def get_g95_version(conf, fc):
if not match: if not match:
conf.fatal('cannot determine g95 version') conf.fatal('cannot determine g95 version')
k = match.groupdict() k = match.groupdict()
conf.env['FC_VERSION'] = (k['major'], k['minor']) conf.env.FC_VERSION = (k['major'], k['minor'])
def configure(conf): def configure(conf):
conf.find_g95() conf.find_g95()

View File

@ -27,54 +27,51 @@ def gcc_common_flags(conf):
""" """
v = conf.env v = conf.env
v['CC_SRC_F'] = [] v.CC_SRC_F = []
v['CC_TGT_F'] = ['-c', '-o'] v.CC_TGT_F = ['-c', '-o']
# linker if not v.LINK_CC:
if not v['LINK_CC']: v['LINK_CC'] = v['CC'] v.LINK_CC = v.CC
v['CCLNK_SRC_F'] = []
v['CCLNK_TGT_F'] = ['-o']
v['CPPPATH_ST'] = '-I%s'
v['DEFINES_ST'] = '-D%s'
v['LIB_ST'] = '-l%s' # template for adding libs v.CCLNK_SRC_F = []
v['LIBPATH_ST'] = '-L%s' # template for adding libpaths v.CCLNK_TGT_F = ['-o']
v['STLIB_ST'] = '-l%s' v.CPPPATH_ST = '-I%s'
v['STLIBPATH_ST'] = '-L%s' v.DEFINES_ST = '-D%s'
v['RPATH_ST'] = '-Wl,-rpath,%s'
v['SONAME_ST'] = '-Wl,-h,%s' v.LIB_ST = '-l%s' # template for adding libs
v['SHLIB_MARKER'] = '-Wl,-Bdynamic' v.LIBPATH_ST = '-L%s' # template for adding libpaths
v['STLIB_MARKER'] = '-Wl,-Bstatic' v.STLIB_ST = '-l%s'
v.STLIBPATH_ST = '-L%s'
v.RPATH_ST = '-Wl,-rpath,%s'
# program v.SONAME_ST = '-Wl,-h,%s'
v['cprogram_PATTERN'] = '%s' v.SHLIB_MARKER = '-Wl,-Bdynamic'
v.STLIB_MARKER = '-Wl,-Bstatic'
# shared librar v.cprogram_PATTERN = '%s'
v['CFLAGS_cshlib'] = ['-fPIC']
v['LINKFLAGS_cshlib'] = ['-shared']
v['cshlib_PATTERN'] = 'lib%s.so'
# static lib v.CFLAGS_cshlib = ['-fPIC']
v['LINKFLAGS_cstlib'] = ['-Wl,-Bstatic'] v.LINKFLAGS_cshlib = ['-shared']
v['cstlib_PATTERN'] = 'lib%s.a' v.cshlib_PATTERN = 'lib%s.so'
# osx stuff v.LINKFLAGS_cstlib = ['-Wl,-Bstatic']
v['LINKFLAGS_MACBUNDLE'] = ['-bundle', '-undefined', 'dynamic_lookup'] v.cstlib_PATTERN = 'lib%s.a'
v['CFLAGS_MACBUNDLE'] = ['-fPIC']
v['macbundle_PATTERN'] = '%s.bundle' v.LINKFLAGS_MACBUNDLE = ['-bundle', '-undefined', 'dynamic_lookup']
v.CFLAGS_MACBUNDLE = ['-fPIC']
v.macbundle_PATTERN = '%s.bundle'
@conf @conf
def gcc_modifier_win32(conf): def gcc_modifier_win32(conf):
"""Configuration flags for executing gcc on Windows""" """Configuration flags for executing gcc on Windows"""
v = conf.env v = conf.env
v['cprogram_PATTERN'] = '%s.exe' v.cprogram_PATTERN = '%s.exe'
v['cshlib_PATTERN'] = '%s.dll' v.cshlib_PATTERN = '%s.dll'
v['implib_PATTERN'] = 'lib%s.dll.a' v.implib_PATTERN = 'lib%s.dll.a'
v['IMPLIB_ST'] = '-Wl,--out-implib,%s' v.IMPLIB_ST = '-Wl,--out-implib,%s'
v['CFLAGS_cshlib'] = [] v.CFLAGS_cshlib = []
# Auto-import is enabled by default even without this option, # Auto-import is enabled by default even without this option,
# but enabling it explicitly has the nice effect of suppressing the rather boring, debug-level messages # but enabling it explicitly has the nice effect of suppressing the rather boring, debug-level messages
@ -86,42 +83,42 @@ def gcc_modifier_cygwin(conf):
"""Configuration flags for executing gcc on Cygwin""" """Configuration flags for executing gcc on Cygwin"""
gcc_modifier_win32(conf) gcc_modifier_win32(conf)
v = conf.env v = conf.env
v['cshlib_PATTERN'] = 'cyg%s.dll' v.cshlib_PATTERN = 'cyg%s.dll'
v.append_value('LINKFLAGS_cshlib', ['-Wl,--enable-auto-image-base']) v.append_value('LINKFLAGS_cshlib', ['-Wl,--enable-auto-image-base'])
v['CFLAGS_cshlib'] = [] v.CFLAGS_cshlib = []
@conf @conf
def gcc_modifier_darwin(conf): def gcc_modifier_darwin(conf):
"""Configuration flags for executing gcc on MacOS""" """Configuration flags for executing gcc on MacOS"""
v = conf.env v = conf.env
v['CFLAGS_cshlib'] = ['-fPIC'] v.CFLAGS_cshlib = ['-fPIC']
v['LINKFLAGS_cshlib'] = ['-dynamiclib'] v.LINKFLAGS_cshlib = ['-dynamiclib']
v['cshlib_PATTERN'] = 'lib%s.dylib' v.cshlib_PATTERN = 'lib%s.dylib'
v['FRAMEWORKPATH_ST'] = '-F%s' v.FRAMEWORKPATH_ST = '-F%s'
v['FRAMEWORK_ST'] = ['-framework'] v.FRAMEWORK_ST = ['-framework']
v['ARCH_ST'] = ['-arch'] v.ARCH_ST = ['-arch']
v['LINKFLAGS_cstlib'] = [] v.LINKFLAGS_cstlib = []
v['SHLIB_MARKER'] = [] v.SHLIB_MARKER = []
v['STLIB_MARKER'] = [] v.STLIB_MARKER = []
v['SONAME_ST'] = [] v.SONAME_ST = []
@conf @conf
def gcc_modifier_aix(conf): def gcc_modifier_aix(conf):
"""Configuration flags for executing gcc on AIX""" """Configuration flags for executing gcc on AIX"""
v = conf.env v = conf.env
v['LINKFLAGS_cprogram'] = ['-Wl,-brtl'] v.LINKFLAGS_cprogram = ['-Wl,-brtl']
v['LINKFLAGS_cshlib'] = ['-shared','-Wl,-brtl,-bexpfull'] v.LINKFLAGS_cshlib = ['-shared','-Wl,-brtl,-bexpfull']
v['SHLIB_MARKER'] = [] v.SHLIB_MARKER = []
@conf @conf
def gcc_modifier_hpux(conf): def gcc_modifier_hpux(conf):
v = conf.env v = conf.env
v['SHLIB_MARKER'] = [] v.SHLIB_MARKER = []
v['STLIB_MARKER'] = [] v.STLIB_MARKER = []
v['CFLAGS_cshlib'] = ['-fPIC','-DPIC'] v.CFLAGS_cshlib = ['-fPIC','-DPIC']
v['cshlib_PATTERN'] = 'lib%s.sl' v.cshlib_PATTERN = 'lib%s.sl'
@conf @conf
def gcc_modifier_openbsd(conf): def gcc_modifier_openbsd(conf):
@ -130,9 +127,9 @@ def gcc_modifier_openbsd(conf):
@conf @conf
def gcc_modifier_osf1V(conf): def gcc_modifier_osf1V(conf):
v = conf.env v = conf.env
v['SHLIB_MARKER'] = [] v.SHLIB_MARKER = []
v['STLIB_MARKER'] = [] v.STLIB_MARKER = []
v['SONAME_ST'] = [] v.SONAME_ST = []
@conf @conf
def gcc_modifier_platform(conf): def gcc_modifier_platform(conf):
@ -156,4 +153,3 @@ def configure(conf):
conf.cc_add_flags() conf.cc_add_flags()
conf.link_add_flags() conf.link_add_flags()

View File

@ -8,7 +8,7 @@ from waflib.Configure import conf
@conf @conf
def find_gdc(conf): def find_gdc(conf):
""" """
Find the program gdc and set the variable *D* Finds the program gdc and set the variable *D*
""" """
conf.find_program('gdc', var='D') conf.find_program('gdc', var='D')
@ -19,33 +19,29 @@ def find_gdc(conf):
@conf @conf
def common_flags_gdc(conf): def common_flags_gdc(conf):
""" """
Set the flags required by *gdc* Sets the flags required by *gdc*
""" """
v = conf.env v = conf.env
# _DFLAGS _DIMPORTFLAGS v.DFLAGS = []
# for mory info about the meaning of this dict see dmd.py v.D_SRC_F = ['-c']
v['DFLAGS'] = [] v.D_TGT_F = '-o%s'
v['D_SRC_F'] = ['-c'] v.D_LINKER = v.D
v['D_TGT_F'] = '-o%s' v.DLNK_SRC_F = ''
v.DLNK_TGT_F = '-o%s'
v.DINC_ST = '-I%s'
# linker v.DSHLIB_MARKER = v.DSTLIB_MARKER = ''
v['D_LINKER'] = v['D'] v.DSTLIB_ST = v.DSHLIB_ST = '-l%s'
v['DLNK_SRC_F'] = '' v.DSTLIBPATH_ST = v.DLIBPATH_ST = '-L%s'
v['DLNK_TGT_F'] = '-o%s'
v['DINC_ST'] = '-I%s'
v['DSHLIB_MARKER'] = v['DSTLIB_MARKER'] = '' v.LINKFLAGS_dshlib = ['-shared']
v['DSTLIB_ST'] = v['DSHLIB_ST'] = '-l%s'
v['DSTLIBPATH_ST'] = v['DLIBPATH_ST'] = '-L%s'
v['LINKFLAGS_dshlib'] = ['-shared'] v.DHEADER_ext = '.di'
v['DHEADER_ext'] = '.di'
v.DFLAGS_d_with_header = '-fintfc' v.DFLAGS_d_with_header = '-fintfc'
v['D_HDR_F'] = '-fintfc-file=%s' v.D_HDR_F = '-fintfc-file=%s'
def configure(conf): def configure(conf):
""" """

View File

@ -19,9 +19,9 @@ def find_gfortran(conf):
@conf @conf
def gfortran_flags(conf): def gfortran_flags(conf):
v = conf.env v = conf.env
v['FCFLAGS_fcshlib'] = ['-fPIC'] v.FCFLAGS_fcshlib = ['-fPIC']
v['FORTRANMODFLAG'] = ['-J', ''] # template for module path v.FORTRANMODFLAG = ['-J', ''] # template for module path
v['FCFLAGS_DEBUG'] = ['-Werror'] # why not v.FCFLAGS_DEBUG = ['-Werror'] # why not
@conf @conf
def gfortran_modifier_win32(conf): def gfortran_modifier_win32(conf):
@ -37,7 +37,7 @@ def gfortran_modifier_darwin(conf):
@conf @conf
def gfortran_modifier_platform(conf): def gfortran_modifier_platform(conf):
dest_os = conf.env['DEST_OS'] or Utils.unversioned_sys_platform() dest_os = conf.env.DEST_OS or Utils.unversioned_sys_platform()
gfortran_modifier_func = getattr(conf, 'gfortran_modifier_' + dest_os, None) gfortran_modifier_func = getattr(conf, 'gfortran_modifier_' + dest_os, None)
if gfortran_modifier_func: if gfortran_modifier_func:
gfortran_modifier_func() gfortran_modifier_func()
@ -79,7 +79,7 @@ def get_gfortran_version(conf, fc):
def isT(var): def isT(var):
return var in k and k[var] != '0' return var in k and k[var] != '0'
conf.env['FC_VERSION'] = (k['__GNUC__'], k['__GNUC_MINOR__'], k['__GNUC_PATCHLEVEL__']) conf.env.FC_VERSION = (k['__GNUC__'], k['__GNUC_MINOR__'], k['__GNUC_PATCHLEVEL__'])
def configure(conf): def configure(conf):
conf.find_gfortran() conf.find_gfortran()

View File

@ -167,7 +167,7 @@ def process_enums(self):
raise Errors.WafError('missing source ' + str(enum)) raise Errors.WafError('missing source ' + str(enum))
source_list = [self.path.find_resource(k) for k in source_list] source_list = [self.path.find_resource(k) for k in source_list]
inputs += source_list inputs += source_list
env['GLIB_MKENUMS_SOURCE'] = [k.abspath() for k in source_list] env.GLIB_MKENUMS_SOURCE = [k.abspath() for k in source_list]
# find the target # find the target
if not enum['target']: if not enum['target']:
@ -175,7 +175,7 @@ def process_enums(self):
tgt_node = self.path.find_or_declare(enum['target']) tgt_node = self.path.find_or_declare(enum['target'])
if tgt_node.name.endswith('.c'): if tgt_node.name.endswith('.c'):
self.source.append(tgt_node) self.source.append(tgt_node)
env['GLIB_MKENUMS_TARGET'] = tgt_node.abspath() env.GLIB_MKENUMS_TARGET = tgt_node.abspath()
options = [] options = []
@ -196,7 +196,7 @@ def process_enums(self):
if enum[param]: if enum[param]:
options.append('%s %r' % (option, enum[param])) options.append('%s %r' % (option, enum[param]))
env['GLIB_MKENUMS_OPTIONS'] = ' '.join(options) env.GLIB_MKENUMS_OPTIONS = ' '.join(options)
# update the task instance # update the task instance
task.set_inputs(inputs) task.set_inputs(inputs)
@ -257,7 +257,7 @@ def process_settings(self):
install_files = [] install_files = []
settings_schema_files = getattr(self, 'settings_schema_files', []) settings_schema_files = getattr(self, 'settings_schema_files', [])
if settings_schema_files and not self.env['GLIB_COMPILE_SCHEMAS']: if settings_schema_files and not self.env.GLIB_COMPILE_SCHEMAS:
raise Errors.WafError ("Unable to process GSettings schemas - glib-compile-schemas was not found during configure") raise Errors.WafError ("Unable to process GSettings schemas - glib-compile-schemas was not found during configure")
# 1. process gsettings_enum_files (generate .enums.xml) # 1. process gsettings_enum_files (generate .enums.xml)
@ -268,18 +268,18 @@ def process_settings(self):
source_list = self.settings_enum_files source_list = self.settings_enum_files
source_list = [self.path.find_resource(k) for k in source_list] source_list = [self.path.find_resource(k) for k in source_list]
enums_task.set_inputs(source_list) enums_task.set_inputs(source_list)
enums_task.env['GLIB_MKENUMS_SOURCE'] = [k.abspath() for k in source_list] enums_task.env.GLIB_MKENUMS_SOURCE = [k.abspath() for k in source_list]
target = self.settings_enum_namespace + '.enums.xml' target = self.settings_enum_namespace + '.enums.xml'
tgt_node = self.path.find_or_declare(target) tgt_node = self.path.find_or_declare(target)
enums_task.set_outputs(tgt_node) enums_task.set_outputs(tgt_node)
enums_task.env['GLIB_MKENUMS_TARGET'] = tgt_node.abspath() enums_task.env.GLIB_MKENUMS_TARGET = tgt_node.abspath()
enums_tgt_node = [tgt_node] enums_tgt_node = [tgt_node]
install_files.append(tgt_node) install_files.append(tgt_node)
options = '--comments "<!-- @comment@ -->" --fhead "<schemalist>" --vhead " <@type@ id=\\"%s.@EnumName@\\">" --vprod " <value nick=\\"@valuenick@\\" value=\\"@valuenum@\\"/>" --vtail " </@type@>" --ftail "</schemalist>" ' % (self.settings_enum_namespace) options = '--comments "<!-- @comment@ -->" --fhead "<schemalist>" --vhead " <@type@ id=\\"%s.@EnumName@\\">" --vprod " <value nick=\\"@valuenick@\\" value=\\"@valuenum@\\"/>" --vtail " </@type@>" --ftail "</schemalist>" ' % (self.settings_enum_namespace)
enums_task.env['GLIB_MKENUMS_OPTIONS'] = options enums_task.env.GLIB_MKENUMS_OPTIONS = options
# 2. process gsettings_schema_files (validate .gschema.xml files) # 2. process gsettings_schema_files (validate .gschema.xml files)
# #
@ -293,11 +293,11 @@ def process_settings(self):
source_list = enums_tgt_node + [schema_node] source_list = enums_tgt_node + [schema_node]
schema_task.set_inputs (source_list) schema_task.set_inputs (source_list)
schema_task.env['GLIB_COMPILE_SCHEMAS_OPTIONS'] = [("--schema-file=" + k.abspath()) for k in source_list] schema_task.env.GLIB_COMPILE_SCHEMAS_OPTIONS = [("--schema-file=" + k.abspath()) for k in source_list]
target_node = schema_node.change_ext('.xml.valid') target_node = schema_node.change_ext('.xml.valid')
schema_task.set_outputs (target_node) schema_task.set_outputs (target_node)
schema_task.env['GLIB_VALIDATE_SCHEMA_OUTPUT'] = target_node.abspath() schema_task.env.GLIB_VALIDATE_SCHEMA_OUTPUT = target_node.abspath()
# 3. schemas install task # 3. schemas install task
def compile_schemas_callback(bld): def compile_schemas_callback(bld):
@ -307,11 +307,11 @@ def process_settings(self):
self.bld.exec_command(command) self.bld.exec_command(command)
if self.bld.is_install: if self.bld.is_install:
if not self.env['GSETTINGSSCHEMADIR']: if not self.env.GSETTINGSSCHEMADIR:
raise Errors.WafError ('GSETTINGSSCHEMADIR not defined (should have been set up automatically during configure)') raise Errors.WafError ('GSETTINGSSCHEMADIR not defined (should have been set up automatically during configure)')
if install_files: if install_files:
self.add_install_files(install_to=self.env['GSETTINGSSCHEMADIR'], install_from=install_files) self.add_install_files(install_to=self.env.GSETTINGSSCHEMADIR, install_from=install_files)
if not hasattr(self.bld, '_compile_schemas_registered'): if not hasattr(self.bld, '_compile_schemas_registered'):
self.bld.add_post_fun(compile_schemas_callback) self.bld.add_post_fun(compile_schemas_callback)
self.bld._compile_schemas_registered = True self.bld._compile_schemas_registered = True
@ -330,7 +330,7 @@ def process_gresource_source(self, node):
""" """
Hook to process .gresource.xml to generate C source files Hook to process .gresource.xml to generate C source files
""" """
if not self.env['GLIB_COMPILE_RESOURCES']: if not self.env.GLIB_COMPILE_RESOURCES:
raise Errors.WafError ("Unable to process GResource file - glib-compile-resources was not found during configure") raise Errors.WafError ("Unable to process GResource file - glib-compile-resources was not found during configure")
if 'gresource' in self.features: if 'gresource' in self.features:
@ -445,11 +445,11 @@ def find_glib_compile_schemas(conf):
if not gsettingsschemadir: if not gsettingsschemadir:
datadir = getstr('DATADIR') datadir = getstr('DATADIR')
if not datadir: if not datadir:
prefix = conf.env['PREFIX'] prefix = conf.env.PREFIX
datadir = os.path.join(prefix, 'share') datadir = os.path.join(prefix, 'share')
gsettingsschemadir = os.path.join(datadir, 'glib-2.0', 'schemas') gsettingsschemadir = os.path.join(datadir, 'glib-2.0', 'schemas')
conf.env['GSETTINGSSCHEMADIR'] = gsettingsschemadir conf.env.GSETTINGSSCHEMADIR = gsettingsschemadir
@conf @conf
def find_glib_compile_resources(conf): def find_glib_compile_resources(conf):

View File

@ -14,7 +14,7 @@ from waflib.Configure import conf
@conf @conf
def find_gxx(conf): def find_gxx(conf):
""" """
Find the program g++, and if present, try to detect its version number Finds the program g++, and if present, try to detect its version number
""" """
cxx = conf.find_program(['g++', 'c++'], var='CXX') cxx = conf.find_program(['g++', 'c++'], var='CXX')
conf.get_cc_version(cxx, gcc=True) conf.get_cc_version(cxx, gcc=True)
@ -27,54 +27,51 @@ def gxx_common_flags(conf):
""" """
v = conf.env v = conf.env
v['CXX_SRC_F'] = [] v.CXX_SRC_F = []
v['CXX_TGT_F'] = ['-c', '-o'] v.CXX_TGT_F = ['-c', '-o']
# linker if not v.LINK_CXX:
if not v['LINK_CXX']: v['LINK_CXX'] = v['CXX'] v.LINK_CXX = v.CXX
v['CXXLNK_SRC_F'] = []
v['CXXLNK_TGT_F'] = ['-o']
v['CPPPATH_ST'] = '-I%s'
v['DEFINES_ST'] = '-D%s'
v['LIB_ST'] = '-l%s' # template for adding libs v.CXXLNK_SRC_F = []
v['LIBPATH_ST'] = '-L%s' # template for adding libpaths v.CXXLNK_TGT_F = ['-o']
v['STLIB_ST'] = '-l%s' v.CPPPATH_ST = '-I%s'
v['STLIBPATH_ST'] = '-L%s' v.DEFINES_ST = '-D%s'
v['RPATH_ST'] = '-Wl,-rpath,%s'
v['SONAME_ST'] = '-Wl,-h,%s' v.LIB_ST = '-l%s' # template for adding libs
v['SHLIB_MARKER'] = '-Wl,-Bdynamic' v.LIBPATH_ST = '-L%s' # template for adding libpaths
v['STLIB_MARKER'] = '-Wl,-Bstatic' v.STLIB_ST = '-l%s'
v.STLIBPATH_ST = '-L%s'
v.RPATH_ST = '-Wl,-rpath,%s'
# program v.SONAME_ST = '-Wl,-h,%s'
v['cxxprogram_PATTERN'] = '%s' v.SHLIB_MARKER = '-Wl,-Bdynamic'
v.STLIB_MARKER = '-Wl,-Bstatic'
# shared library v.cxxprogram_PATTERN = '%s'
v['CXXFLAGS_cxxshlib'] = ['-fPIC']
v['LINKFLAGS_cxxshlib'] = ['-shared']
v['cxxshlib_PATTERN'] = 'lib%s.so'
# static lib v.CXXFLAGS_cxxshlib = ['-fPIC']
v['LINKFLAGS_cxxstlib'] = ['-Wl,-Bstatic'] v.LINKFLAGS_cxxshlib = ['-shared']
v['cxxstlib_PATTERN'] = 'lib%s.a' v.cxxshlib_PATTERN = 'lib%s.so'
# osx stuff v.LINKFLAGS_cxxstlib = ['-Wl,-Bstatic']
v['LINKFLAGS_MACBUNDLE'] = ['-bundle', '-undefined', 'dynamic_lookup'] v.cxxstlib_PATTERN = 'lib%s.a'
v['CXXFLAGS_MACBUNDLE'] = ['-fPIC']
v['macbundle_PATTERN'] = '%s.bundle' v.LINKFLAGS_MACBUNDLE = ['-bundle', '-undefined', 'dynamic_lookup']
v.CXXFLAGS_MACBUNDLE = ['-fPIC']
v.macbundle_PATTERN = '%s.bundle'
@conf @conf
def gxx_modifier_win32(conf): def gxx_modifier_win32(conf):
"""Configuration flags for executing gcc on Windows""" """Configuration flags for executing gcc on Windows"""
v = conf.env v = conf.env
v['cxxprogram_PATTERN'] = '%s.exe' v.cxxprogram_PATTERN = '%s.exe'
v['cxxshlib_PATTERN'] = '%s.dll' v.cxxshlib_PATTERN = '%s.dll'
v['implib_PATTERN'] = 'lib%s.dll.a' v.implib_PATTERN = 'lib%s.dll.a'
v['IMPLIB_ST'] = '-Wl,--out-implib,%s' v.IMPLIB_ST = '-Wl,--out-implib,%s'
v['CXXFLAGS_cxxshlib'] = [] v.CXXFLAGS_cxxshlib = []
# Auto-import is enabled by default even without this option, # Auto-import is enabled by default even without this option,
# but enabling it explicitly has the nice effect of suppressing the rather boring, debug-level messages # but enabling it explicitly has the nice effect of suppressing the rather boring, debug-level messages
@ -86,43 +83,43 @@ def gxx_modifier_cygwin(conf):
"""Configuration flags for executing g++ on Cygwin""" """Configuration flags for executing g++ on Cygwin"""
gxx_modifier_win32(conf) gxx_modifier_win32(conf)
v = conf.env v = conf.env
v['cxxshlib_PATTERN'] = 'cyg%s.dll' v.cxxshlib_PATTERN = 'cyg%s.dll'
v.append_value('LINKFLAGS_cxxshlib', ['-Wl,--enable-auto-image-base']) v.append_value('LINKFLAGS_cxxshlib', ['-Wl,--enable-auto-image-base'])
v['CXXFLAGS_cxxshlib'] = [] v.CXXFLAGS_cxxshlib = []
@conf @conf
def gxx_modifier_darwin(conf): def gxx_modifier_darwin(conf):
"""Configuration flags for executing g++ on MacOS""" """Configuration flags for executing g++ on MacOS"""
v = conf.env v = conf.env
v['CXXFLAGS_cxxshlib'] = ['-fPIC'] v.CXXFLAGS_cxxshlib = ['-fPIC']
v['LINKFLAGS_cxxshlib'] = ['-dynamiclib'] v.LINKFLAGS_cxxshlib = ['-dynamiclib']
v['cxxshlib_PATTERN'] = 'lib%s.dylib' v.cxxshlib_PATTERN = 'lib%s.dylib'
v['FRAMEWORKPATH_ST'] = '-F%s' v.FRAMEWORKPATH_ST = '-F%s'
v['FRAMEWORK_ST'] = ['-framework'] v.FRAMEWORK_ST = ['-framework']
v['ARCH_ST'] = ['-arch'] v.ARCH_ST = ['-arch']
v['LINKFLAGS_cxxstlib'] = [] v.LINKFLAGS_cxxstlib = []
v['SHLIB_MARKER'] = [] v.SHLIB_MARKER = []
v['STLIB_MARKER'] = [] v.STLIB_MARKER = []
v['SONAME_ST'] = [] v.SONAME_ST = []
@conf @conf
def gxx_modifier_aix(conf): def gxx_modifier_aix(conf):
"""Configuration flags for executing g++ on AIX""" """Configuration flags for executing g++ on AIX"""
v = conf.env v = conf.env
v['LINKFLAGS_cxxprogram']= ['-Wl,-brtl'] v.LINKFLAGS_cxxprogram= ['-Wl,-brtl']
v['LINKFLAGS_cxxshlib'] = ['-shared', '-Wl,-brtl,-bexpfull'] v.LINKFLAGS_cxxshlib = ['-shared', '-Wl,-brtl,-bexpfull']
v['SHLIB_MARKER'] = [] v.SHLIB_MARKER = []
@conf @conf
def gxx_modifier_hpux(conf): def gxx_modifier_hpux(conf):
v = conf.env v = conf.env
v['SHLIB_MARKER'] = [] v.SHLIB_MARKER = []
v['STLIB_MARKER'] = [] v.STLIB_MARKER = []
v['CFLAGS_cxxshlib'] = ['-fPIC','-DPIC'] v.CFLAGS_cxxshlib = ['-fPIC','-DPIC']
v['cxxshlib_PATTERN'] = 'lib%s.sl' v.cxxshlib_PATTERN = 'lib%s.sl'
@conf @conf
def gxx_modifier_openbsd(conf): def gxx_modifier_openbsd(conf):
@ -131,9 +128,9 @@ def gxx_modifier_openbsd(conf):
@conf @conf
def gcc_modifier_osf1V(conf): def gcc_modifier_osf1V(conf):
v = conf.env v = conf.env
v['SHLIB_MARKER'] = [] v.SHLIB_MARKER = []
v['STLIB_MARKER'] = [] v.STLIB_MARKER = []
v['SONAME_ST'] = [] v.SONAME_ST = []
@conf @conf
def gxx_modifier_platform(conf): def gxx_modifier_platform(conf):

View File

@ -4,7 +4,7 @@
# Thomas Nagy 2009-2016 (ita) # Thomas Nagy 2009-2016 (ita)
""" """
Detect the Intel C compiler Detects the Intel C compiler
""" """
import sys import sys
@ -14,11 +14,8 @@ from waflib.Configure import conf
@conf @conf
def find_icc(conf): def find_icc(conf):
""" """
Find the program icc and execute it to ensure it really is icc Finds the program icc and execute it to ensure it really is icc
""" """
if sys.platform == 'cygwin':
conf.fatal('The Intel compiler does not work on Cygwin')
cc = conf.find_program(['icc', 'ICL'], var='CC') cc = conf.find_program(['icc', 'ICL'], var='CC')
conf.get_cc_version(cc, icc=True) conf.get_cc_version(cc, icc=True)
conf.env.CC_NAME = 'icc' conf.env.CC_NAME = 'icc'

View File

@ -3,7 +3,7 @@
# Thomas Nagy 2009-2016 (ita) # Thomas Nagy 2009-2016 (ita)
""" """
Detect the Intel C++ compiler Detects the Intel C++ compiler
""" """
import sys import sys
@ -13,11 +13,8 @@ from waflib.Configure import conf
@conf @conf
def find_icpc(conf): def find_icpc(conf):
""" """
Find the program icpc, and execute it to ensure it really is icpc Finds the program icpc, and execute it to ensure it really is icpc
""" """
if sys.platform == 'cygwin':
conf.fatal('The Intel compiler does not work on Cygwin')
cxx = conf.find_program('icpc', var='CXX') cxx = conf.find_program('icpc', var='CXX')
conf.get_cc_version(cxx, icc=True) conf.get_cc_version(cxx, icc=True)
conf.env.CXX_NAME = 'icc' conf.env.CXX_NAME = 'icc'

View File

@ -68,7 +68,7 @@ def get_ifort_version(conf, fc):
if not match: if not match:
conf.fatal('cannot determine ifort version.') conf.fatal('cannot determine ifort version.')
k = match.groupdict() k = match.groupdict()
conf.env['FC_VERSION'] = (k['major'], k['minor']) conf.env.FC_VERSION = (k['major'], k['minor'])
def configure(conf): def configure(conf):
if Utils.is_win32: if Utils.is_win32:
@ -158,8 +158,8 @@ def setup_ifort(conf, versiondict):
:return: the compiler, revision, path, include dirs, library paths and target architecture :return: the compiler, revision, path, include dirs, library paths and target architecture
:rtype: tuple of strings :rtype: tuple of strings
""" """
platforms = Utils.to_list(conf.env['MSVC_TARGETS']) or [i for i,j in all_ifort_platforms] platforms = Utils.to_list(conf.env.MSVC_TARGETS) or [i for i,j in all_ifort_platforms]
desired_versions = conf.env['MSVC_VERSIONS'] or list(reversed(list(versiondict.keys()))) desired_versions = conf.env.MSVC_VERSIONS or list(reversed(list(versiondict.keys())))
for version in desired_versions: for version in desired_versions:
try: try:
targets = versiondict[version] targets = versiondict[version]
@ -317,9 +317,9 @@ def _get_prog_names(self, compiler):
def find_ifort_win32(conf): def find_ifort_win32(conf):
# the autodetection is supposed to be performed before entering in this method # the autodetection is supposed to be performed before entering in this method
v = conf.env v = conf.env
path = v['PATH'] path = v.PATH
compiler = v['MSVC_COMPILER'] compiler = v.MSVC_COMPILER
version = v['MSVC_VERSION'] version = v.MSVC_VERSION
compiler_name, linker_name, lib_name = _get_prog_names(conf, compiler) compiler_name, linker_name, lib_name = _get_prog_names(conf, compiler)
v.IFORT_MANIFEST = (compiler == 'intel' and version >= 11) v.IFORT_MANIFEST = (compiler == 'intel' and version >= 11)
@ -333,21 +333,19 @@ def find_ifort_win32(conf):
if not conf.cmd_and_log(fc + ['/nologo', '/help'], env=env): if not conf.cmd_and_log(fc + ['/nologo', '/help'], env=env):
conf.fatal('not intel fortran compiler could not be identified') conf.fatal('not intel fortran compiler could not be identified')
v['FC_NAME'] = 'IFORT' v.FC_NAME = 'IFORT'
# linker if not v.LINK_FC:
if not v['LINK_FC']:
conf.find_program(linker_name, var='LINK_FC', path_list=path, mandatory=True) conf.find_program(linker_name, var='LINK_FC', path_list=path, mandatory=True)
# staticlib linker if not v.AR:
if not v['AR']:
conf.find_program(lib_name, path_list=path, var='AR', mandatory=True) conf.find_program(lib_name, path_list=path, var='AR', mandatory=True)
v['ARFLAGS'] = ['/nologo'] v.ARFLAGS = ['/nologo']
# manifest tool. Not required for VS 2003 and below. Must have for VS 2005 and later # manifest tool. Not required for VS 2003 and below. Must have for VS 2005 and later
if v.IFORT_MANIFEST: if v.IFORT_MANIFEST:
conf.find_program('MT', path_list=path, var='MT') conf.find_program('MT', path_list=path, var='MT')
v['MTFLAGS'] = ['/nologo'] v.MTFLAGS = ['/nologo']
try: try:
conf.load('winres') conf.load('winres')

View File

@ -1,9 +1,9 @@
#! /usr/bin/env python #! /usr/bin/env python
# encoding: utf-8
# imported from samba # imported from samba
""" """
compiler definition for irix/MIPSpro cc compiler Compiler definition for irix/MIPSpro cc compiler
based on suncc.py from waf
""" """
from waflib.Tools import ccroot, ar from waflib.Tools import ccroot, ar
@ -13,41 +13,46 @@ from waflib.Configure import conf
def find_irixcc(conf): def find_irixcc(conf):
v = conf.env v = conf.env
cc = None cc = None
if v['CC']: cc = v['CC'] if v.CC:
elif 'CC' in conf.environ: cc = conf.environ['CC'] cc = v.CC
if not cc: cc = conf.find_program('cc', var='CC') elif 'CC' in conf.environ:
if not cc: conf.fatal('irixcc was not found') cc = conf.environ['CC']
if not cc:
cc = conf.find_program('cc', var='CC')
if not cc:
conf.fatal('irixcc was not found')
try: try:
conf.cmd_and_log(cc + ['-version']) conf.cmd_and_log(cc + ['-version'])
except Exception: except Exception:
conf.fatal('%r -version could not be executed' % cc) conf.fatal('%r -version could not be executed' % cc)
v['CC'] = cc v.CC = cc
v['CC_NAME'] = 'irix' v.CC_NAME = 'irix'
@conf @conf
def irixcc_common_flags(conf): def irixcc_common_flags(conf):
v = conf.env v = conf.env
v['CC_SRC_F'] = '' v.CC_SRC_F = ''
v['CC_TGT_F'] = ['-c', '-o'] v.CC_TGT_F = ['-c', '-o']
v['CPPPATH_ST'] = '-I%s' v.CPPPATH_ST = '-I%s'
v['DEFINES_ST'] = '-D%s' v.DEFINES_ST = '-D%s'
# linker if not v.LINK_CC:
if not v['LINK_CC']: v['LINK_CC'] = v['CC'] v.LINK_CC = v.CC
v['CCLNK_SRC_F'] = ''
v['CCLNK_TGT_F'] = ['-o']
v['LIB_ST'] = '-l%s' # template for adding libs v.CCLNK_SRC_F = ''
v['LIBPATH_ST'] = '-L%s' # template for adding libpaths v.CCLNK_TGT_F = ['-o']
v['STLIB_ST'] = '-l%s'
v['STLIBPATH_ST'] = '-L%s'
v['cprogram_PATTERN'] = '%s' v.LIB_ST = '-l%s' # template for adding libs
v['cshlib_PATTERN'] = 'lib%s.so' v.LIBPATH_ST = '-L%s' # template for adding libpaths
v['cstlib_PATTERN'] = 'lib%s.a' v.STLIB_ST = '-l%s'
v.STLIBPATH_ST = '-L%s'
v.cprogram_PATTERN = '%s'
v.cshlib_PATTERN = 'lib%s.so'
v.cstlib_PATTERN = 'lib%s.a'
def configure(conf): def configure(conf):
conf.find_irixcc() conf.find_irixcc()

View File

@ -77,7 +77,7 @@ def apply_java(self):
outdir = self.path.get_bld() outdir = self.path.get_bld()
outdir.mkdir() outdir.mkdir()
self.outdir = outdir self.outdir = outdir
self.env['OUTDIR'] = outdir.abspath() self.env.OUTDIR = outdir.abspath()
self.javac_task = tsk = self.create_task('javac') self.javac_task = tsk = self.create_task('javac')
tmp = [] tmp = []
@ -185,8 +185,8 @@ def jar_files(self):
jaropts.append(basedir.bldpath()) jaropts.append(basedir.bldpath())
jaropts.append('.') jaropts.append('.')
tsk.env['JAROPTS'] = jaropts tsk.env.JAROPTS = jaropts
tsk.env['JARCREATE'] = jarcreate tsk.env.JARCREATE = jarcreate
if getattr(self, 'javac_task', None): if getattr(self, 'javac_task', None):
tsk.set_run_after(self.javac_task) tsk.set_run_after(self.javac_task)
@ -318,7 +318,7 @@ class javadoc(Task.Task):
classpath = "".join(classpath) classpath = "".join(classpath)
self.last_cmd = lst = [] self.last_cmd = lst = []
lst.extend(Utils.to_list(env['JAVADOC'])) lst.extend(Utils.to_list(env.JAVADOC))
lst.extend(['-d', self.generator.javadoc_output.abspath()]) lst.extend(['-d', self.generator.javadoc_output.abspath()])
lst.extend(['-sourcepath', srcpath]) lst.extend(['-sourcepath', srcpath])
lst.extend(['-classpath', classpath]) lst.extend(['-classpath', classpath])
@ -344,19 +344,21 @@ def configure(self):
if 'JAVA_HOME' in self.environ: if 'JAVA_HOME' in self.environ:
java_path = [os.path.join(self.environ['JAVA_HOME'], 'bin')] + java_path java_path = [os.path.join(self.environ['JAVA_HOME'], 'bin')] + java_path
self.env['JAVA_HOME'] = [self.environ['JAVA_HOME']] self.env.JAVA_HOME = [self.environ['JAVA_HOME']]
for x in 'javac java jar javadoc'.split(): for x in 'javac java jar javadoc'.split():
self.find_program(x, var=x.upper(), path_list=java_path) self.find_program(x, var=x.upper(), path_list=java_path)
if 'CLASSPATH' in self.environ: if 'CLASSPATH' in self.environ:
v['CLASSPATH'] = self.environ['CLASSPATH'] v.CLASSPATH = self.environ['CLASSPATH']
if not v['JAR']: self.fatal('jar is required for making java packages') if not v.JAR:
if not v['JAVAC']: self.fatal('javac is required for compiling java classes') self.fatal('jar is required for making java packages')
if not v.JAVAC:
self.fatal('javac is required for compiling java classes')
v['JARCREATE'] = 'cf' # can use cvf v.JARCREATE = 'cf' # can use cvf
v['JAVACFLAGS'] = [] v.JAVACFLAGS = []
@conf @conf
def check_java_class(self, classname, with_classpath=None): def check_java_class(self, classname, with_classpath=None):
@ -368,12 +370,11 @@ def check_java_class(self, classname, with_classpath=None):
:param with_classpath: additional classpath to give :param with_classpath: additional classpath to give
:type with_classpath: string :type with_classpath: string
""" """
javatestdir = '.waf-javatest' javatestdir = '.waf-javatest'
classpath = javatestdir classpath = javatestdir
if self.env['CLASSPATH']: if self.env.CLASSPATH:
classpath += os.pathsep + self.env['CLASSPATH'] classpath += os.pathsep + self.env.CLASSPATH
if isinstance(with_classpath, str): if isinstance(with_classpath, str):
classpath += os.pathsep + with_classpath classpath += os.pathsep + with_classpath
@ -383,10 +384,10 @@ def check_java_class(self, classname, with_classpath=None):
Utils.writef(os.path.join(javatestdir, 'Test.java'), class_check_source) Utils.writef(os.path.join(javatestdir, 'Test.java'), class_check_source)
# Compile the source # Compile the source
self.exec_command(self.env['JAVAC'] + [os.path.join(javatestdir, 'Test.java')], shell=False) self.exec_command(self.env.JAVAC + [os.path.join(javatestdir, 'Test.java')], shell=False)
# Try to run the app # Try to run the app
cmd = self.env['JAVA'] + ['-cp', classpath, 'Test', classname] cmd = self.env.JAVA + ['-cp', classpath, 'Test', classname]
self.to_log("%s\n" % str(cmd)) self.to_log("%s\n" % str(cmd))
found = self.exec_command(cmd, shell=False) found = self.exec_command(cmd, shell=False)
@ -419,7 +420,7 @@ def check_jni_headers(conf):
conf.fatal('set JAVA_HOME in the system environment') conf.fatal('set JAVA_HOME in the system environment')
# jni requires the jvm # jni requires the jvm
javaHome = conf.env['JAVA_HOME'][0] javaHome = conf.env.JAVA_HOME[0]
dir = conf.root.find_dir(conf.env.JAVA_HOME[0] + '/include') dir = conf.root.find_dir(conf.env.JAVA_HOME[0] + '/include')
if dir is None: if dir is None:

View File

@ -8,9 +8,8 @@ from waflib.Configure import conf
@conf @conf
def find_ldc2(conf): def find_ldc2(conf):
""" """
Find the program *ldc2* and set the variable *D* Finds the program *ldc2* and set the variable *D*
""" """
conf.find_program(['ldc2'], var='D') conf.find_program(['ldc2'], var='D')
out = conf.cmd_and_log(conf.env.D + ['-version']) out = conf.cmd_and_log(conf.env.D + ['-version'])
@ -20,39 +19,38 @@ def find_ldc2(conf):
@conf @conf
def common_flags_ldc2(conf): def common_flags_ldc2(conf):
""" """
Set the D flags required by *ldc2* Sets the D flags required by *ldc2*
""" """
v = conf.env v = conf.env
v['D_SRC_F'] = ['-c'] v.D_SRC_F = ['-c']
v['D_TGT_F'] = '-of%s' v.D_TGT_F = '-of%s'
v['D_LINKER'] = v['D'] v.D_LINKER = v.D
v['DLNK_SRC_F'] = '' v.DLNK_SRC_F = ''
v['DLNK_TGT_F'] = '-of%s' v.DLNK_TGT_F = '-of%s'
v['DINC_ST'] = '-I%s' v.DINC_ST = '-I%s'
v['DSHLIB_MARKER'] = v['DSTLIB_MARKER'] = '' v.DSHLIB_MARKER = v.DSTLIB_MARKER = ''
v['DSTLIB_ST'] = v['DSHLIB_ST'] = '-L-l%s' v.DSTLIB_ST = v.DSHLIB_ST = '-L-l%s'
v['DSTLIBPATH_ST'] = v['DLIBPATH_ST'] = '-L-L%s' v.DSTLIBPATH_ST = v.DLIBPATH_ST = '-L-L%s'
v['LINKFLAGS_dshlib'] = ['-L-shared'] v.LINKFLAGS_dshlib = ['-L-shared']
v['DHEADER_ext'] = '.di' v.DHEADER_ext = '.di'
v['DFLAGS_d_with_header'] = ['-H', '-Hf'] v.DFLAGS_d_with_header = ['-H', '-Hf']
v['D_HDR_F'] = '%s' v.D_HDR_F = '%s'
v['LINKFLAGS'] = [] v.LINKFLAGS = []
v['DFLAGS_dshlib'] = ['-relocation-model=pic'] v.DFLAGS_dshlib = ['-relocation-model=pic']
def configure(conf): def configure(conf):
""" """
Configuration for *ldc2* Configuration for *ldc2*
""" """
conf.find_ldc2() conf.find_ldc2()
conf.load('ar') conf.load('ar')
conf.load('d') conf.load('d')
conf.common_flags_ldc2() conf.common_flags_ldc2()
conf.d_platform_flags() conf.d_platform_flags()

View File

@ -15,8 +15,8 @@ Usage::
or:: or::
def configure(conf): def configure(conf):
conf.env['MSVC_VERSIONS'] = ['msvc 10.0', 'msvc 9.0', 'msvc 8.0', 'msvc 7.1', 'msvc 7.0', 'msvc 6.0', 'wsdk 7.0', 'intel 11', 'PocketPC 9.0', 'Smartphone 8.0'] conf.env.MSVC_VERSIONS = ['msvc 10.0', 'msvc 9.0', 'msvc 8.0', 'msvc 7.1', 'msvc 7.0', 'msvc 6.0', 'wsdk 7.0', 'intel 11', 'PocketPC 9.0', 'Smartphone 8.0']
conf.env['MSVC_TARGETS'] = ['x64'] conf.env.MSVC_TARGETS = ['x64']
conf.load('msvc') conf.load('msvc')
or:: or::
@ -32,7 +32,7 @@ Platforms and targets will be tested in the order they appear;
the first good configuration will be used. the first good configuration will be used.
To force testing all the configurations that are not used, use the ``--no-msvc-lazy`` option To force testing all the configurations that are not used, use the ``--no-msvc-lazy`` option
or set ``conf.env['MSVC_LAZY_AUTODETECT']=False``. or set ``conf.env.MSVC_LAZY_AUTODETECT=False``.
Supported platforms: ia64, x64, x86, x86_amd64, x86_ia64, x86_arm, amd64_x86, amd64_arm Supported platforms: ia64, x64, x86, x86_amd64, x86_ia64, x86_arm, amd64_x86, amd64_arm
@ -108,14 +108,14 @@ def setup_msvc(conf, versiondict):
""" """
platforms = getattr(Options.options, 'msvc_targets', '').split(',') platforms = getattr(Options.options, 'msvc_targets', '').split(',')
if platforms == ['']: if platforms == ['']:
platforms=Utils.to_list(conf.env['MSVC_TARGETS']) or [i for i,j in all_msvc_platforms+all_icl_platforms+all_wince_platforms] platforms=Utils.to_list(conf.env.MSVC_TARGETS) or [i for i,j in all_msvc_platforms+all_icl_platforms+all_wince_platforms]
desired_versions = getattr(Options.options, 'msvc_version', '').split(',') desired_versions = getattr(Options.options, 'msvc_version', '').split(',')
if desired_versions == ['']: if desired_versions == ['']:
desired_versions = conf.env['MSVC_VERSIONS'] or list(reversed(list(versiondict.keys()))) desired_versions = conf.env.MSVC_VERSIONS or list(reversed(list(versiondict.keys())))
# Override lazy detection by evaluating after the fact. # Override lazy detection by evaluating after the fact.
lazy_detect = getattr(Options.options, 'msvc_lazy', True) lazy_detect = getattr(Options.options, 'msvc_lazy', True)
if conf.env['MSVC_LAZY_AUTODETECT'] is False: if conf.env.MSVC_LAZY_AUTODETECT is False:
lazy_detect = False lazy_detect = False
if not lazy_detect: if not lazy_detect:
@ -125,7 +125,7 @@ def setup_msvc(conf, versiondict):
cfg.evaluate() cfg.evaluate()
if not cfg.is_valid: if not cfg.is_valid:
del val[arch] del val[arch]
conf.env['MSVC_INSTALLED_VERSIONS'] = versiondict conf.env.MSVC_INSTALLED_VERSIONS = versiondict
for version in desired_versions: for version in desired_versions:
try: try:
@ -608,7 +608,7 @@ def find_lt_names_msvc(self, libname, is_static=False):
'%s.la' % libname, '%s.la' % libname,
] ]
for path in self.env['LIBPATH']: for path in self.env.LIBPATH:
for la in lt_names: for la in lt_names:
laf=os.path.join(path,la) laf=os.path.join(path,la)
dll=None dll=None
@ -655,9 +655,9 @@ def libname_msvc(self, libname, is_static=False):
return os.path.join(lt_path,lt_libname) return os.path.join(lt_path,lt_libname)
if lt_path != None: if lt_path != None:
_libpaths=[lt_path] + self.env['LIBPATH'] _libpaths = [lt_path] + self.env.LIBPATH
else: else:
_libpaths=self.env['LIBPATH'] _libpaths = self.env.LIBPATH
static_libs=[ static_libs=[
'lib%ss.lib' % lib, 'lib%ss.lib' % lib,
@ -695,7 +695,7 @@ def check_lib_msvc(self, libname, is_static=False, uselib_store=None):
""" """
Ideally we should be able to place the lib in the right env var, either STLIB or LIB, Ideally we should be able to place the lib in the right env var, either STLIB or LIB,
but we don't distinguish static libs from shared libs. but we don't distinguish static libs from shared libs.
This is ok since msvc doesn't have any special linker flag to select static libs (no env['STLIB_MARKER']) This is ok since msvc doesn't have any special linker flag to select static libs (no env.STLIB_MARKER)
""" """
libn = self.libname_msvc(libname, is_static) libn = self.libname_msvc(libname, is_static)
@ -739,16 +739,16 @@ def autodetect(conf, arch=False):
compiler, version, path, includes, libdirs, cpu = conf.detect_msvc() compiler, version, path, includes, libdirs, cpu = conf.detect_msvc()
if arch: if arch:
v['DEST_CPU'] = cpu v.DEST_CPU = cpu
v['PATH'] = path v.PATH = path
v['INCLUDES'] = includes v.INCLUDES = includes
v['LIBPATH'] = libdirs v.LIBPATH = libdirs
v['MSVC_COMPILER'] = compiler v.MSVC_COMPILER = compiler
try: try:
v['MSVC_VERSION'] = float(version) v.MSVC_VERSION = float(version)
except TypeError: except TypeError:
v['MSVC_VERSION'] = float(version[:-3]) v.MSVC_VERSION = float(version[:-3])
def _get_prog_names(conf, compiler): def _get_prog_names(conf, compiler):
if compiler == 'intel': if compiler == 'intel':
@ -770,9 +770,9 @@ def find_msvc(conf):
# the autodetection is supposed to be performed before entering in this method # the autodetection is supposed to be performed before entering in this method
v = conf.env v = conf.env
path = v['PATH'] path = v.PATH
compiler = v['MSVC_COMPILER'] compiler = v.MSVC_COMPILER
version = v['MSVC_VERSION'] version = v.MSVC_VERSION
compiler_name, linker_name, lib_name = _get_prog_names(conf, compiler) compiler_name, linker_name, lib_name = _get_prog_names(conf, compiler)
v.MSVC_MANIFEST = (compiler == 'msvc' and version >= 8) or (compiler == 'wsdk' and version >= 6) or (compiler == 'intel' and version >= 11) v.MSVC_MANIFEST = (compiler == 'msvc' and version >= 8) or (compiler == 'wsdk' and version >= 6) or (compiler == 'intel' and version >= 11)
@ -787,27 +787,28 @@ def find_msvc(conf):
conf.fatal('the msvc compiler could not be identified') conf.fatal('the msvc compiler could not be identified')
# c/c++ compiler # c/c++ compiler
v['CC'] = v['CXX'] = cxx v.CC = v.CXX = cxx
v['CC_NAME'] = v['CXX_NAME'] = 'msvc' v.CC_NAME = v.CXX_NAME = 'msvc'
# linker # linker
if not v['LINK_CXX']: if not v.LINK_CXX:
# TODO: var=LINK_CXX to let so that LINK_CXX can be overridden? # TODO: var=LINK_CXX to let so that LINK_CXX can be overridden?
v.LINK_CXX = conf.find_program(linker_name, path_list=path, errmsg='%s was not found (linker)' % linker_name) v.LINK_CXX = conf.find_program(linker_name, path_list=path, errmsg='%s was not found (linker)' % linker_name)
if not v['LINK_CC']: if not v.LINK_CC:
v['LINK_CC'] = v['LINK_CXX'] v.LINK_CC = v.LINK_CXX
# staticlib linker # staticlib linker
if not v['AR']: if not v.AR:
stliblink = conf.find_program(lib_name, path_list=path, var='AR') stliblink = conf.find_program(lib_name, path_list=path, var='AR')
if not stliblink: return if not stliblink:
v['ARFLAGS'] = ['/nologo'] return
v.ARFLAGS = ['/nologo']
# manifest tool. Not required for VS 2003 and below. Must have for VS 2005 and later # manifest tool. Not required for VS 2003 and below. Must have for VS 2005 and later
if v.MSVC_MANIFEST: if v.MSVC_MANIFEST:
conf.find_program('MT', path_list=path, var='MT') conf.find_program('MT', path_list=path, var='MT')
v['MTFLAGS'] = ['/nologo'] v.MTFLAGS = ['/nologo']
try: try:
conf.load('winres') conf.load('winres')
@ -830,62 +831,58 @@ def msvc_common_flags(conf):
""" """
v = conf.env v = conf.env
v['DEST_BINFMT'] = 'pe' v.DEST_BINFMT = 'pe'
v.append_value('CFLAGS', ['/nologo']) v.append_value('CFLAGS', ['/nologo'])
v.append_value('CXXFLAGS', ['/nologo']) v.append_value('CXXFLAGS', ['/nologo'])
v.append_value('LINKFLAGS', ['/nologo']) v.append_value('LINKFLAGS', ['/nologo'])
v['DEFINES_ST'] = '/D%s' v.DEFINES_ST = '/D%s'
v['CC_SRC_F'] = '' v.CC_SRC_F = ''
v['CC_TGT_F'] = ['/c', '/Fo'] v.CC_TGT_F = ['/c', '/Fo']
v['CXX_SRC_F'] = '' v.CXX_SRC_F = ''
v['CXX_TGT_F'] = ['/c', '/Fo'] v.CXX_TGT_F = ['/c', '/Fo']
if (v.MSVC_COMPILER == 'msvc' and v.MSVC_VERSION >= 8) or (v.MSVC_COMPILER == 'wsdk' and v.MSVC_VERSION >= 6): 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.CC_TGT_F = ['/FC'] + v.CC_TGT_F
v['CXX_TGT_F']= ['/FC'] + v['CXX_TGT_F'] v.CXX_TGT_F = ['/FC'] + v.CXX_TGT_F
v['CPPPATH_ST'] = '/I%s' # template for adding include paths v.CPPPATH_ST = '/I%s' # template for adding include paths
v['AR_TGT_F'] = v['CCLNK_TGT_F'] = v['CXXLNK_TGT_F'] = '/OUT:' v.AR_TGT_F = v.CCLNK_TGT_F = v.CXXLNK_TGT_F = '/OUT:'
# Subsystem specific flags # Subsystem specific flags
v['CFLAGS_CONSOLE'] = v['CXXFLAGS_CONSOLE'] = ['/SUBSYSTEM:CONSOLE'] v.CFLAGS_CONSOLE = v.CXXFLAGS_CONSOLE = ['/SUBSYSTEM:CONSOLE']
v['CFLAGS_NATIVE'] = v['CXXFLAGS_NATIVE'] = ['/SUBSYSTEM:NATIVE'] v.CFLAGS_NATIVE = v.CXXFLAGS_NATIVE = ['/SUBSYSTEM:NATIVE']
v['CFLAGS_POSIX'] = v['CXXFLAGS_POSIX'] = ['/SUBSYSTEM:POSIX'] v.CFLAGS_POSIX = v.CXXFLAGS_POSIX = ['/SUBSYSTEM:POSIX']
v['CFLAGS_WINDOWS'] = v['CXXFLAGS_WINDOWS'] = ['/SUBSYSTEM:WINDOWS'] v.CFLAGS_WINDOWS = v.CXXFLAGS_WINDOWS = ['/SUBSYSTEM:WINDOWS']
v['CFLAGS_WINDOWSCE'] = v['CXXFLAGS_WINDOWSCE'] = ['/SUBSYSTEM:WINDOWSCE'] v.CFLAGS_WINDOWSCE = v.CXXFLAGS_WINDOWSCE = ['/SUBSYSTEM:WINDOWSCE']
# CRT specific flags # CRT specific flags
v['CFLAGS_CRT_MULTITHREADED'] = v['CXXFLAGS_CRT_MULTITHREADED'] = ['/MT'] v.CFLAGS_CRT_MULTITHREADED = v.CXXFLAGS_CRT_MULTITHREADED = ['/MT']
v['CFLAGS_CRT_MULTITHREADED_DLL'] = v['CXXFLAGS_CRT_MULTITHREADED_DLL'] = ['/MD'] v.CFLAGS_CRT_MULTITHREADED_DLL = v.CXXFLAGS_CRT_MULTITHREADED_DLL = ['/MD']
v['CFLAGS_CRT_MULTITHREADED_DBG'] = v['CXXFLAGS_CRT_MULTITHREADED_DBG'] = ['/MTd'] v.CFLAGS_CRT_MULTITHREADED_DBG = v.CXXFLAGS_CRT_MULTITHREADED_DBG = ['/MTd']
v['CFLAGS_CRT_MULTITHREADED_DLL_DBG'] = v['CXXFLAGS_CRT_MULTITHREADED_DLL_DBG'] = ['/MDd'] v.CFLAGS_CRT_MULTITHREADED_DLL_DBG = v.CXXFLAGS_CRT_MULTITHREADED_DLL_DBG = ['/MDd']
# linker v.LIB_ST = '%s.lib' # template for adding shared libs
v['LIB_ST'] = '%s.lib' # template for adding shared libs v.LIBPATH_ST = '/LIBPATH:%s' # template for adding libpaths
v['LIBPATH_ST'] = '/LIBPATH:%s' # template for adding libpaths v.STLIB_ST = '%s.lib'
v['STLIB_ST'] = '%s.lib' v.STLIBPATH_ST = '/LIBPATH:%s'
v['STLIBPATH_ST'] = '/LIBPATH:%s'
if v['MSVC_MANIFEST']: if v.MSVC_MANIFEST:
v.append_value('LINKFLAGS', ['/MANIFEST']) v.append_value('LINKFLAGS', ['/MANIFEST'])
# shared library v.CFLAGS_cshlib = []
v['CFLAGS_cshlib'] = [] v.CXXFLAGS_cxxshlib = []
v['CXXFLAGS_cxxshlib'] = [] v.LINKFLAGS_cshlib = v.LINKFLAGS_cxxshlib = ['/DLL']
v['LINKFLAGS_cshlib'] = v['LINKFLAGS_cxxshlib'] = ['/DLL'] v.cshlib_PATTERN = v.cxxshlib_PATTERN = '%s.dll'
v['cshlib_PATTERN'] = v['cxxshlib_PATTERN'] = '%s.dll' v.implib_PATTERN = '%s.lib'
v['implib_PATTERN'] = '%s.lib' v.IMPLIB_ST = '/IMPLIB:%s'
v['IMPLIB_ST'] = '/IMPLIB:%s'
# static library v.LINKFLAGS_cstlib = []
v['LINKFLAGS_cstlib'] = [] v.cstlib_PATTERN = v.cxxstlib_PATTERN = '%s.lib'
v['cstlib_PATTERN'] = v['cxxstlib_PATTERN'] = '%s.lib'
# program v.cprogram_PATTERN = v.cxxprogram_PATTERN = '%s.exe'
v['cprogram_PATTERN'] = v['cxxprogram_PATTERN'] = '%s.exe'
####################################################################################################### #######################################################################################################

View File

@ -37,7 +37,7 @@ def init_perlext(self):
""" """
self.uselib = self.to_list(getattr(self, 'uselib', [])) self.uselib = self.to_list(getattr(self, 'uselib', []))
if not 'PERLEXT' in self.uselib: self.uselib.append('PERLEXT') if not 'PERLEXT' in self.uselib: self.uselib.append('PERLEXT')
self.env['cshlib_PATTERN'] = self.env['cxxshlib_PATTERN'] = self.env['perlext_PATTERN'] self.env.cshlib_PATTERN = self.env.cxxshlib_PATTERN = self.env.perlext_PATTERN
@extension('.xs') @extension('.xs')
def xsubpp_file(self, node): def xsubpp_file(self, node):
@ -80,7 +80,7 @@ def check_perl_version(self, minver=None):
if ver < minver: if ver < minver:
res = False res = False
self.end_msg(version, color=res and "GREEN" or "YELLOW") self.end_msg(version, color=res and 'GREEN' or 'YELLOW')
return res return res
@conf @conf
@ -133,18 +133,18 @@ def check_perl_ext_devel(self):
return xsubpp return xsubpp
return self.find_program('xsubpp') return self.find_program('xsubpp')
env['LINKFLAGS_PERLEXT'] = cfg_lst('$Config{lddlflags}') env.LINKFLAGS_PERLEXT = cfg_lst('$Config{lddlflags}')
env['INCLUDES_PERLEXT'] = cfg_lst('$Config{archlib}/CORE') env.INCLUDES_PERLEXT = cfg_lst('$Config{archlib}/CORE')
env['CFLAGS_PERLEXT'] = cfg_lst('$Config{ccflags} $Config{cccdlflags}') env.CFLAGS_PERLEXT = cfg_lst('$Config{ccflags} $Config{cccdlflags}')
env['EXTUTILS_TYPEMAP'] = cfg_lst('$Config{privlib}/ExtUtils/typemap') env.EXTUTILS_TYPEMAP = cfg_lst('$Config{privlib}/ExtUtils/typemap')
env['XSUBPP'] = find_xsubpp() env.XSUBPP = find_xsubpp()
if not getattr(Options.options, 'perlarchdir', None): if not getattr(Options.options, 'perlarchdir', None):
env['ARCHDIR_PERL'] = cfg_str('$Config{sitearch}') env.ARCHDIR_PERL = cfg_str('$Config{sitearch}')
else: else:
env['ARCHDIR_PERL'] = getattr(Options.options, 'perlarchdir') env.ARCHDIR_PERL = getattr(Options.options, 'perlarchdir')
env['perlext_PATTERN'] = '%s.' + cfg_str('$Config{dlext}') env.perlext_PATTERN = '%s.' + cfg_str('$Config{dlext}')
def options(opt): def options(opt):
""" """
@ -152,3 +152,4 @@ def options(opt):
""" """
opt.add_option('--with-perl-binary', type='string', dest='perlbinary', help = 'Specify alternate perl binary', default=None) opt.add_option('--with-perl-binary', type='string', dest='perlbinary', help = 'Specify alternate perl binary', default=None)
opt.add_option('--with-perl-archdir', type='string', dest='perlarchdir', help = 'Specify directory where to install arch specific files', default=None) opt.add_option('--with-perl-archdir', type='string', dest='perlarchdir', help = 'Specify directory where to install arch specific files', default=None)

View File

@ -287,14 +287,14 @@ def check_python_headers(conf, features='pyembed pyext'):
features = Utils.to_list(features) features = Utils.to_list(features)
assert ('pyembed' in features) or ('pyext' in features), "check_python_headers features must include 'pyembed' and/or 'pyext'" assert ('pyembed' in features) or ('pyext' in features), "check_python_headers features must include 'pyembed' and/or 'pyext'"
env = conf.env env = conf.env
if not env['CC_NAME'] and not env['CXX_NAME']: if not env.CC_NAME and not env.CXX_NAME:
conf.fatal('load a compiler first (gcc, g++, ..)') conf.fatal('load a compiler first (gcc, g++, ..)')
# bypass all the code below for cross-compilation # bypass all the code below for cross-compilation
if conf.python_cross_compile(features): if conf.python_cross_compile(features):
return return
if not env['PYTHON_VERSION']: if not env.PYTHON_VERSION:
conf.check_python_version() conf.check_python_version()
pybin = env.PYTHON pybin = env.PYTHON
@ -315,11 +315,11 @@ def check_python_headers(conf, features='pyembed pyext'):
x = 'MACOSX_DEPLOYMENT_TARGET' x = 'MACOSX_DEPLOYMENT_TARGET'
if dct[x]: if dct[x]:
env[x] = conf.environ[x] = dct[x] env[x] = conf.environ[x] = dct[x]
env['pyext_PATTERN'] = '%s' + dct['SO'] # not a mistake env.pyext_PATTERN = '%s' + dct['SO'] # not a mistake
# Try to get pythonX.Y-config # Try to get pythonX.Y-config
num = '.'.join(env['PYTHON_VERSION'].split('.')[:2]) num = '.'.join(env.PYTHON_VERSION.split('.')[:2])
conf.find_program([''.join(pybin) + '-config', 'python%s-config' % num, 'python-config-%s' % num, 'python%sm-config' % num], var='PYTHON_CONFIG', msg="python-config", mandatory=False) conf.find_program([''.join(pybin) + '-config', 'python%s-config' % num, 'python-config-%s' % num, 'python%sm-config' % num], var='PYTHON_CONFIG', msg="python-config", mandatory=False)
if env.PYTHON_CONFIG: if env.PYTHON_CONFIG:
@ -370,14 +370,14 @@ def check_python_headers(conf, features='pyembed pyext'):
result = None result = None
if not dct["LDVERSION"]: if not dct["LDVERSION"]:
dct["LDVERSION"] = env['PYTHON_VERSION'] dct["LDVERSION"] = env.PYTHON_VERSION
# further simplification will be complicated # further simplification will be complicated
for name in ('python' + dct['LDVERSION'], 'python' + env['PYTHON_VERSION'] + 'm', 'python' + env['PYTHON_VERSION'].replace('.', '')): for name in ('python' + dct['LDVERSION'], 'python' + env.PYTHON_VERSION + 'm', 'python' + env.PYTHON_VERSION.replace('.', '')):
# LIBPATH_PYEMBED is already set; see if it works. # LIBPATH_PYEMBED is already set; see if it works.
if not result and env['LIBPATH_PYEMBED']: if not result and env.LIBPATH_PYEMBED:
path = env['LIBPATH_PYEMBED'] path = env.LIBPATH_PYEMBED
conf.to_log("\n\n# Trying default LIBPATH_PYEMBED: %r\n" % path) conf.to_log("\n\n# Trying default LIBPATH_PYEMBED: %r\n" % path)
result = conf.check(lib=name, uselib='PYEMBED', libpath=path, mandatory=False, msg='Checking for library %s in LIBPATH_PYEMBED' % name) result = conf.check(lib=name, uselib='PYEMBED', libpath=path, mandatory=False, msg='Checking for library %s in LIBPATH_PYEMBED' % name)
@ -400,7 +400,7 @@ def check_python_headers(conf, features='pyembed pyext'):
break # do not forget to set LIBPATH_PYEMBED break # do not forget to set LIBPATH_PYEMBED
if result: if result:
env['LIBPATH_PYEMBED'] = path env.LIBPATH_PYEMBED = path
env.append_value('LIB_PYEMBED', [name]) env.append_value('LIB_PYEMBED', [name])
else: else:
conf.to_log("\n\n### LIB NOT FOUND\n") conf.to_log("\n\n### LIB NOT FOUND\n")
@ -408,18 +408,18 @@ def check_python_headers(conf, features='pyembed pyext'):
# under certain conditions, python extensions must link to # under certain conditions, python extensions must link to
# python libraries, not just python embedding programs. # python libraries, not just python embedding programs.
if Utils.is_win32 or dct['Py_ENABLE_SHARED']: if Utils.is_win32 or dct['Py_ENABLE_SHARED']:
env['LIBPATH_PYEXT'] = env['LIBPATH_PYEMBED'] env.LIBPATH_PYEXT = env.LIBPATH_PYEMBED
env['LIB_PYEXT'] = env['LIB_PYEMBED'] env.LIB_PYEXT = env.LIB_PYEMBED
conf.to_log("Include path for Python extensions (found via distutils module): %r\n" % (dct['INCLUDEPY'],)) conf.to_log("Include path for Python extensions (found via distutils module): %r\n" % (dct['INCLUDEPY'],))
env['INCLUDES_PYEXT'] = [dct['INCLUDEPY']] env.INCLUDES_PYEXT = [dct['INCLUDEPY']]
env['INCLUDES_PYEMBED'] = [dct['INCLUDEPY']] env.INCLUDES_PYEMBED = [dct['INCLUDEPY']]
# Code using the Python API needs to be compiled with -fno-strict-aliasing # Code using the Python API needs to be compiled with -fno-strict-aliasing
if env['CC_NAME'] == 'gcc': if env.CC_NAME == 'gcc':
env.append_value('CFLAGS_PYEMBED', ['-fno-strict-aliasing']) env.append_value('CFLAGS_PYEMBED', ['-fno-strict-aliasing'])
env.append_value('CFLAGS_PYEXT', ['-fno-strict-aliasing']) env.append_value('CFLAGS_PYEXT', ['-fno-strict-aliasing'])
if env['CXX_NAME'] == 'gcc': if env.CXX_NAME == 'gcc':
env.append_value('CXXFLAGS_PYEMBED', ['-fno-strict-aliasing']) env.append_value('CXXFLAGS_PYEMBED', ['-fno-strict-aliasing'])
env.append_value('CXXFLAGS_PYEXT', ['-fno-strict-aliasing']) env.append_value('CXXFLAGS_PYEXT', ['-fno-strict-aliasing'])
@ -450,7 +450,7 @@ def check_python_version(conf, minver=None):
:type minver: tuple of int :type minver: tuple of int
""" """
assert minver is None or isinstance(minver, tuple) assert minver is None or isinstance(minver, tuple)
pybin = conf.env['PYTHON'] pybin = conf.env.PYTHON
if not pybin: if not pybin:
conf.fatal('could not find the python executable') conf.fatal('could not find the python executable')
@ -467,11 +467,11 @@ def check_python_version(conf, minver=None):
if result: if result:
# define useful environment variables # define useful environment variables
pyver = '.'.join([str(x) for x in pyver_tuple[:2]]) pyver = '.'.join([str(x) for x in pyver_tuple[:2]])
conf.env['PYTHON_VERSION'] = pyver conf.env.PYTHON_VERSION = pyver
if 'PYTHONDIR' in conf.env: if 'PYTHONDIR' in conf.env:
# Check if --pythondir was specified # Check if --pythondir was specified
pydir = conf.env['PYTHONDIR'] pydir = conf.env.PYTHONDIR
elif 'PYTHONDIR' in conf.environ: elif 'PYTHONDIR' in conf.environ:
# Check environment for PYTHONDIR # Check environment for PYTHONDIR
pydir = conf.environ['PYTHONDIR'] pydir = conf.environ['PYTHONDIR']
@ -485,14 +485,14 @@ def check_python_version(conf, minver=None):
python_LIBDEST = None python_LIBDEST = None
(pydir,) = conf.get_python_variables( ["get_python_lib(standard_lib=0, prefix=%r) or ''" % conf.env.PREFIX]) (pydir,) = conf.get_python_variables( ["get_python_lib(standard_lib=0, prefix=%r) or ''" % conf.env.PREFIX])
if python_LIBDEST is None: if python_LIBDEST is None:
if conf.env['LIBDIR']: if conf.env.LIBDIR:
python_LIBDEST = os.path.join(conf.env['LIBDIR'], "python" + pyver) python_LIBDEST = os.path.join(conf.env.LIBDIR, 'python' + pyver)
else: else:
python_LIBDEST = os.path.join(conf.env['PREFIX'], "lib", "python" + pyver) python_LIBDEST = os.path.join(conf.env.PREFIX, 'lib', 'python' + pyver)
if 'PYTHONARCHDIR' in conf.env: if 'PYTHONARCHDIR' in conf.env:
# Check if --pythonarchdir was specified # Check if --pythonarchdir was specified
pyarchdir = conf.env['PYTHONARCHDIR'] pyarchdir = conf.env.PYTHONARCHDIR
elif 'PYTHONARCHDIR' in conf.environ: elif 'PYTHONARCHDIR' in conf.environ:
# Check environment for PYTHONDIR # Check environment for PYTHONDIR
pyarchdir = conf.environ['PYTHONARCHDIR'] pyarchdir = conf.environ['PYTHONARCHDIR']
@ -506,8 +506,8 @@ def check_python_version(conf, minver=None):
conf.define('PYTHONDIR', pydir) conf.define('PYTHONDIR', pydir)
conf.define('PYTHONARCHDIR', pyarchdir) conf.define('PYTHONARCHDIR', pyarchdir)
conf.env['PYTHONDIR'] = pydir conf.env.PYTHONDIR = pydir
conf.env['PYTHONARCHDIR'] = pyarchdir conf.env.PYTHONARCHDIR = pyarchdir
# Feedback # Feedback
pyver_full = '.'.join(map(str, pyver_tuple[:3])) pyver_full = '.'.join(map(str, pyver_tuple[:3]))
@ -546,7 +546,7 @@ def check_python_module(conf, module_name, condition=''):
msg = '%s (%s)' % (msg, condition) msg = '%s (%s)' % (msg, condition)
conf.start_msg(msg) conf.start_msg(msg)
try: try:
ret = conf.cmd_and_log(conf.env['PYTHON'] + ['-c', PYTHON_MODULE_TEMPLATE % module_name]) ret = conf.cmd_and_log(conf.env.PYTHON + ['-c', PYTHON_MODULE_TEMPLATE % module_name])
except Exception: except Exception:
conf.end_msg(False) conf.end_msg(False)
conf.fatal('Could not find the python module %r' % module_name) conf.fatal('Could not find the python module %r' % module_name)
@ -579,17 +579,17 @@ def configure(conf):
""" """
v = conf.env v = conf.env
if Options.options.pythondir: if Options.options.pythondir:
v['PYTHONDIR'] = Options.options.pythondir v.PYTHONDIR = Options.options.pythondir
if Options.options.pythonarchdir: if Options.options.pythonarchdir:
v['PYTHONARCHDIR'] = Options.options.pythonarchdir v.PYTHONARCHDIR = Options.options.pythonarchdir
conf.find_program('python', var='PYTHON', value=Options.options.pythondir or sys.executable) conf.find_program('python', var='PYTHON', value=Options.options.pythondir or sys.executable)
v['PYFLAGS'] = '' v.PYFLAGS = ''
v['PYFLAGS_OPT'] = '-O' v.PYFLAGS_OPT = '-O'
v['PYC'] = getattr(Options.options, 'pyc', 1) v.PYC = getattr(Options.options, 'pyc', 1)
v['PYO'] = getattr(Options.options, 'pyo', 1) v.PYO = getattr(Options.options, 'pyo', 1)
try: try:
v.PYTAG = conf.cmd_and_log(conf.env.PYTHON + ['-c', "import imp;print(imp.get_tag())"]).strip() v.PYTAG = conf.cmd_and_log(conf.env.PYTHON + ['-c', "import imp;print(imp.get_tag())"]).strip()

View File

@ -298,7 +298,7 @@ def create_rcc_task(self, node):
def create_uic_task(self, node): def create_uic_task(self, node):
"hook for uic tasks" "hook for uic tasks"
uictask = self.create_task('ui5', node) uictask = self.create_task('ui5', node)
uictask.outputs = [node.parent.find_or_declare(self.env['ui_PATTERN'] % node.name[:-3])] uictask.outputs = [node.parent.find_or_declare(self.env.ui_PATTERN % node.name[:-3])]
@extension('.ts') @extension('.ts')
def add_lang(self, node): def add_lang(self, node):
@ -368,7 +368,7 @@ def apply_qt5(self):
self.link_task.inputs.append(k.outputs[0]) self.link_task.inputs.append(k.outputs[0])
lst = [] lst = []
for flag in self.to_list(self.env['CXXFLAGS']): for flag in self.to_list(self.env.CXXFLAGS):
if len(flag) < 2: continue if len(flag) < 2: continue
f = flag[0:2] f = flag[0:2]
if f in ('-D', '-I', '/D', '/I'): if f in ('-D', '-I', '/D', '/I'):
@ -610,10 +610,10 @@ def find_qt5_binaries(self):
find_bin(['lrelease-qt5', 'lrelease'], 'QT_LRELEASE') find_bin(['lrelease-qt5', 'lrelease'], 'QT_LRELEASE')
find_bin(['lupdate-qt5', 'lupdate'], 'QT_LUPDATE') find_bin(['lupdate-qt5', 'lupdate'], 'QT_LUPDATE')
env['UIC_ST'] = '%s -o %s' env.UIC_ST = '%s -o %s'
env['MOC_ST'] = '-o' env.MOC_ST = '-o'
env['ui_PATTERN'] = 'ui_%s.h' env.ui_PATTERN = 'ui_%s.h'
env['QT_LRELEASE_FLAGS'] = ['-silent'] env.QT_LRELEASE_FLAGS = ['-silent']
env.MOCCPPPATH_ST = '-I%s' env.MOCCPPPATH_ST = '-I%s'
env.MOCDEFINES_ST = '-D%s' env.MOCDEFINES_ST = '-D%s'

View File

@ -46,7 +46,7 @@ def apply_ruby_so_name(self):
""" """
Strip the *lib* prefix from ruby extensions Strip the *lib* prefix from ruby extensions
""" """
self.env['cshlib_PATTERN'] = self.env['cxxshlib_PATTERN'] = self.env['rubyext_PATTERN'] self.env.cshlib_PATTERN = self.env.cxxshlib_PATTERN = self.env.rubyext_PATTERN
@conf @conf
def check_ruby_version(self, minver=()): def check_ruby_version(self, minver=()):
@ -171,7 +171,7 @@ class run_ruby(Task.Task):
ctx.check_ruby_version() ctx.check_ruby_version()
def build(bld): def build(bld):
bld.env['RBFLAGS'] = '-e puts "hello world"' bld.env.RBFLAGS = '-e puts "hello world"'
bld(source='a_ruby_file.rb') bld(source='a_ruby_file.rb')
""" """
run_str = '${RUBY} ${RBFLAGS} -I ${SRC[0].parent.abspath()} ${SRC}' run_str = '${RUBY} ${RBFLAGS} -I ${SRC[0].parent.abspath()} ${SRC}'

View File

@ -9,11 +9,10 @@ from waflib.Configure import conf
@conf @conf
def find_scc(conf): def find_scc(conf):
""" """
Detect the Sun C compiler Detects the Sun C compiler
""" """
v = conf.env v = conf.env
cc = conf.find_program('cc', var='CC') cc = conf.find_program('cc', var='CC')
try: try:
conf.cmd_and_log(cc + ['-flags']) conf.cmd_and_log(cc + ['-flags'])
except Exception: except Exception:
@ -28,36 +27,34 @@ def scc_common_flags(conf):
""" """
v = conf.env v = conf.env
v['CC_SRC_F'] = [] v.CC_SRC_F = []
v['CC_TGT_F'] = ['-c', '-o', ''] v.CC_TGT_F = ['-c', '-o', '']
# linker if not v.LINK_CC:
if not v['LINK_CC']: v['LINK_CC'] = v['CC'] v.LINK_CC = v.CC
v['CCLNK_SRC_F'] = ''
v['CCLNK_TGT_F'] = ['-o', '']
v['CPPPATH_ST'] = '-I%s'
v['DEFINES_ST'] = '-D%s'
v['LIB_ST'] = '-l%s' # template for adding libs v.CCLNK_SRC_F = ''
v['LIBPATH_ST'] = '-L%s' # template for adding libpaths v.CCLNK_TGT_F = ['-o', '']
v['STLIB_ST'] = '-l%s' v.CPPPATH_ST = '-I%s'
v['STLIBPATH_ST'] = '-L%s' v.DEFINES_ST = '-D%s'
v['SONAME_ST'] = '-Wl,-h,%s' v.LIB_ST = '-l%s' # template for adding libs
v['SHLIB_MARKER'] = '-Bdynamic' v.LIBPATH_ST = '-L%s' # template for adding libpaths
v['STLIB_MARKER'] = '-Bstatic' v.STLIB_ST = '-l%s'
v.STLIBPATH_ST = '-L%s'
# program v.SONAME_ST = '-Wl,-h,%s'
v['cprogram_PATTERN'] = '%s' v.SHLIB_MARKER = '-Bdynamic'
v.STLIB_MARKER = '-Bstatic'
# shared library v.cprogram_PATTERN = '%s'
v['CFLAGS_cshlib'] = ['-xcode=pic32', '-DPIC']
v['LINKFLAGS_cshlib'] = ['-G']
v['cshlib_PATTERN'] = 'lib%s.so'
# static lib v.CFLAGS_cshlib = ['-xcode=pic32', '-DPIC']
v['LINKFLAGS_cstlib'] = ['-Bstatic'] v.LINKFLAGS_cshlib = ['-G']
v['cstlib_PATTERN'] = 'lib%s.a' v.cshlib_PATTERN = 'lib%s.so'
v.LINKFLAGS_cstlib = ['-Bstatic']
v.cstlib_PATTERN = 'lib%s.a'
def configure(conf): def configure(conf):
conf.find_scc() conf.find_scc()
@ -66,3 +63,4 @@ def configure(conf):
conf.cc_load_tools() conf.cc_load_tools()
conf.cc_add_flags() conf.cc_add_flags()
conf.link_add_flags() conf.link_add_flags()

View File

@ -9,7 +9,7 @@ from waflib.Configure import conf
@conf @conf
def find_sxx(conf): def find_sxx(conf):
""" """
Detect the sun C++ compiler Detects the sun C++ compiler
""" """
v = conf.env v = conf.env
cc = conf.find_program(['CC', 'c++'], var='CXX') cc = conf.find_program(['CC', 'c++'], var='CXX')
@ -27,36 +27,34 @@ def sxx_common_flags(conf):
""" """
v = conf.env v = conf.env
v['CXX_SRC_F'] = [] v.CXX_SRC_F = []
v['CXX_TGT_F'] = ['-c', '-o', ''] v.CXX_TGT_F = ['-c', '-o', '']
# linker if not v.LINK_CXX:
if not v['LINK_CXX']: v['LINK_CXX'] = v['CXX'] v.LINK_CXX = v.CXX
v['CXXLNK_SRC_F'] = []
v['CXXLNK_TGT_F'] = ['-o', '']
v['CPPPATH_ST'] = '-I%s'
v['DEFINES_ST'] = '-D%s'
v['LIB_ST'] = '-l%s' # template for adding libs v.CXXLNK_SRC_F = []
v['LIBPATH_ST'] = '-L%s' # template for adding libpaths v.CXXLNK_TGT_F = ['-o', '']
v['STLIB_ST'] = '-l%s' v.CPPPATH_ST = '-I%s'
v['STLIBPATH_ST'] = '-L%s' v.DEFINES_ST = '-D%s'
v['SONAME_ST'] = '-Wl,-h,%s' v.LIB_ST = '-l%s' # template for adding libs
v['SHLIB_MARKER'] = '-Bdynamic' v.LIBPATH_ST = '-L%s' # template for adding libpaths
v['STLIB_MARKER'] = '-Bstatic' v.STLIB_ST = '-l%s'
v.STLIBPATH_ST = '-L%s'
# program v.SONAME_ST = '-Wl,-h,%s'
v['cxxprogram_PATTERN'] = '%s' v.SHLIB_MARKER = '-Bdynamic'
v.STLIB_MARKER = '-Bstatic'
# shared library v.cxxprogram_PATTERN = '%s'
v['CXXFLAGS_cxxshlib'] = ['-xcode=pic32', '-DPIC']
v['LINKFLAGS_cxxshlib'] = ['-G']
v['cxxshlib_PATTERN'] = 'lib%s.so'
# static lib v.CXXFLAGS_cxxshlib = ['-xcode=pic32', '-DPIC']
v['LINKFLAGS_cxxstlib'] = ['-Bstatic'] v.LINKFLAGS_cxxshlib = ['-G']
v['cxxstlib_PATTERN'] = 'lib%s.a' v.cxxshlib_PATTERN = 'lib%s.so'
v.LINKFLAGS_cxxstlib = ['-Bstatic']
v.cxxstlib_PATTERN = 'lib%s.a'
def configure(conf): def configure(conf):
conf.find_sxx() conf.find_sxx()

View File

@ -20,7 +20,7 @@ Example::
outs = 'ps', # 'pdf' or 'ps pdf' outs = 'ps', # 'pdf' or 'ps pdf'
deps = 'crossreferencing.lst', # to give dependencies directly deps = 'crossreferencing.lst', # to give dependencies directly
prompt = 1, # 0 for the batch mode prompt = 1, # 0 for the batch mode
) )
Notes: Notes:
@ -28,10 +28,9 @@ Notes:
$ PDFLATEX=luatex waf configure $ PDFLATEX=luatex waf configure
- This tool doesn't use the target attribute of the task generator - This tool does not use the target attribute of the task generator
(``bld(target=...)``); the target file name is built from the source (``bld(target=...)``); the target file name is built from the source
base name and the out type(s) base name and the output type(s)
""" """
import os, re import os, re
@ -41,7 +40,7 @@ from waflib.TaskGen import feature, before_method
re_bibunit = re.compile(r'\\(?P<type>putbib)\[(?P<file>[^\[\]]*)\]',re.M) re_bibunit = re.compile(r'\\(?P<type>putbib)\[(?P<file>[^\[\]]*)\]',re.M)
def bibunitscan(self): def bibunitscan(self):
""" """
Parse the inputs and try to find the *bibunit* dependencies Parses TeX inputs and try to find the *bibunit* file dependencies
:return: list of bibunit files :return: list of bibunit files
:rtype: list of :py:class:`waflib.Node.Node` :rtype: list of :py:class:`waflib.Node.Node`
@ -52,7 +51,6 @@ def bibunitscan(self):
if not node: return nodes if not node: return nodes
code = node.read() code = node.read()
for match in re_bibunit.finditer(code): for match in re_bibunit.finditer(code):
path = match.group('file') path = match.group('file')
if path: if path:
@ -66,7 +64,7 @@ def bibunitscan(self):
else: else:
Logs.debug('tex: could not find %s', path) Logs.debug('tex: could not find %s', path)
Logs.debug("tex: found the following bibunit files: %s", nodes) Logs.debug('tex: found the following bibunit files: %s', nodes)
return nodes return nodes
exts_deps_tex = ['', '.ltx', '.tex', '.bib', '.pdf', '.png', '.eps', '.ps', '.sty'] exts_deps_tex = ['', '.ltx', '.tex', '.bib', '.pdf', '.png', '.eps', '.ps', '.sty']
@ -86,7 +84,7 @@ g_glossaries_re = re.compile('\\@newglossary', re.M)
class tex(Task.Task): class tex(Task.Task):
""" """
Compile a tex/latex file. Compiles a tex/latex file.
.. inheritance-diagram:: waflib.Tools.tex.latex waflib.Tools.tex.xelatex waflib.Tools.tex.pdflatex .. inheritance-diagram:: waflib.Tools.tex.latex waflib.Tools.tex.xelatex waflib.Tools.tex.pdflatex
""" """
@ -108,7 +106,7 @@ class tex(Task.Task):
def exec_command(self, cmd, **kw): def exec_command(self, cmd, **kw):
""" """
Override :py:meth:`waflib.Task.Task.exec_command` to execute the command without buffering (latex may prompt for inputs) Executes TeX commands without buffering (latex may prompt for inputs)
:return: the return code :return: the return code
:rtype: int :rtype: int
@ -118,7 +116,7 @@ class tex(Task.Task):
def scan_aux(self, node): def scan_aux(self, node):
""" """
A recursive regex-based scanner that finds included auxiliary files. Recursive regex-based scanner that finds included auxiliary files.
""" """
nodes = [node] nodes = [node]
re_aux = re.compile(r'\\@input{(?P<file>[^{}]*)}', re.M) re_aux = re.compile(r'\\@input{(?P<file>[^{}]*)}', re.M)
@ -132,13 +130,12 @@ class tex(Task.Task):
Logs.debug('tex: found aux node %r', found) Logs.debug('tex: found aux node %r', found)
nodes.append(found) nodes.append(found)
parse_node(found) parse_node(found)
parse_node(node) parse_node(node)
return nodes return nodes
def scan(self): def scan(self):
""" """
A recursive regex-based scanner that finds latex dependencies. It uses :py:attr:`waflib.Tools.tex.re_tex` Recursive regex-based scanner that finds latex dependencies. It uses :py:attr:`waflib.Tools.tex.re_tex`
Depending on your needs you might want: Depending on your needs you might want:
@ -220,7 +217,7 @@ class tex(Task.Task):
def check_status(self, msg, retcode): def check_status(self, msg, retcode):
""" """
Check an exit status and raise an error with a particular message Checks an exit status and raise an error with a particular message
:param msg: message to display if the code is non-zero :param msg: message to display if the code is non-zero
:type msg: string :type msg: string
@ -228,12 +225,12 @@ class tex(Task.Task):
:type retcode: boolean :type retcode: boolean
""" """
if retcode != 0: if retcode != 0:
raise Errors.WafError("%r command exit status %r" % (msg, retcode)) raise Errors.WafError('%r command exit status %r' % (msg, retcode))
def bibfile(self): def bibfile(self):
""" """
Parse the *.aux* files to find bibfiles to process. Parses *.aux* files to find bibfiles to process.
If yes, execute :py:meth:`waflib.Tools.tex.tex.bibtex_fun` If present, execute :py:meth:`waflib.Tools.tex.tex.bibtex_fun`
""" """
for aux_node in self.aux_nodes: for aux_node in self.aux_nodes:
try: try:
@ -260,8 +257,8 @@ class tex(Task.Task):
def bibunits(self): def bibunits(self):
""" """
Parse the *.aux* file to find bibunit files. If there are bibunit files, Parses *.aux* file to find bibunit files. If there are bibunit files,
execute :py:meth:`waflib.Tools.tex.tex.bibtex_fun`. runs :py:meth:`waflib.Tools.tex.tex.bibtex_fun`.
""" """
try: try:
bibunits = bibunitscan(self) bibunits = bibunitscan(self)
@ -280,8 +277,8 @@ class tex(Task.Task):
def makeindex(self): def makeindex(self):
""" """
Look on the filesystem if there is a *.idx* file to process. If yes, execute Searches the filesystem for *.idx* files to process. If present,
:py:meth:`waflib.Tools.tex.tex.makeindex_fun` runs :py:meth:`waflib.Tools.tex.tex.makeindex_fun`
""" """
self.idx_node = self.inputs[0].change_ext('.idx') self.idx_node = self.inputs[0].change_ext('.idx')
try: try:
@ -298,13 +295,16 @@ class tex(Task.Task):
def bibtopic(self): def bibtopic(self):
""" """
Additional .aux files from the bibtopic package Lists additional .aux files from the bibtopic package
""" """
p = self.inputs[0].parent.get_bld() p = self.inputs[0].parent.get_bld()
if os.path.exists(os.path.join(p.abspath(), 'btaux.aux')): if os.path.exists(os.path.join(p.abspath(), 'btaux.aux')):
self.aux_nodes += p.ant_glob('*[0-9].aux') self.aux_nodes += p.ant_glob('*[0-9].aux')
def makeglossaries(self): def makeglossaries(self):
"""
Lists additional glossaries from .aux files. If present, runs the makeglossaries program.
"""
src_file = self.inputs[0].abspath() src_file = self.inputs[0].abspath()
base_file = os.path.basename(src_file) base_file = os.path.basename(src_file)
base, _ = os.path.splitext(base_file) base, _ = os.path.splitext(base_file)
@ -324,21 +324,24 @@ class tex(Task.Task):
return return
def texinputs(self): def texinputs(self):
"""
Returns the list of texinput nodes as a string suitable for the TEXINPUTS environment variables
:rtype: string
"""
return os.pathsep.join([k.abspath() for k in self.texinputs_nodes]) + os.pathsep return os.pathsep.join([k.abspath() for k in self.texinputs_nodes]) + os.pathsep
def run(self): def run(self):
""" """
Runs the TeX build process. Runs the whole TeX build process
It may require multiple passes, depending on the usage of cross-references, Multiple passes are required depending on the usage of cross-references,
bibliographies, content susceptible of needing such passes. bibliographies, glossaries, indexes and additional contents
The appropriate TeX compiler is called until the *.aux* files stop changing. The appropriate TeX compiler is called until the *.aux* files stop changing.
Makeindex and bibtex are called if necessary.
""" """
env = self.env env = self.env
if not env['PROMPT_LATEX']: if not env.PROMPT_LATEX:
env.append_value('LATEXFLAGS', '-interaction=batchmode') env.append_value('LATEXFLAGS', '-interaction=batchmode')
env.append_value('PDFLATEXFLAGS', '-interaction=batchmode') env.append_value('PDFLATEXFLAGS', '-interaction=batchmode')
env.append_value('XELATEXFLAGS', '-interaction=batchmode') env.append_value('XELATEXFLAGS', '-interaction=batchmode')
@ -376,6 +379,11 @@ class tex(Task.Task):
self.call_latex() self.call_latex()
def hash_aux_nodes(self): def hash_aux_nodes(self):
"""
Returns a hash of the .aux file contents
:rtype: string or bytes
"""
try: try:
self.aux_nodes self.aux_nodes
except AttributeError: except AttributeError:
@ -386,31 +394,41 @@ class tex(Task.Task):
return Utils.h_list([Utils.h_file(x.abspath()) for x in self.aux_nodes]) return Utils.h_list([Utils.h_file(x.abspath()) for x in self.aux_nodes])
def call_latex(self): def call_latex(self):
"""
Runs the TeX compiler once
"""
self.env.env = {} self.env.env = {}
self.env.env.update(os.environ) self.env.env.update(os.environ)
self.env.env.update({'TEXINPUTS': self.texinputs()}) self.env.env.update({'TEXINPUTS': self.texinputs()})
self.env.SRCFILE = self.inputs[0].abspath() self.env.SRCFILE = self.inputs[0].abspath()
self.check_status('error when calling latex', self.texfun()) self.check_status('error when calling latex', self.texfun())
class latex(tex): class latex(tex):
"Compiles LaTeX files"
texfun, vars = Task.compile_fun('${LATEX} ${LATEXFLAGS} ${SRCFILE}', shell=False) texfun, vars = Task.compile_fun('${LATEX} ${LATEXFLAGS} ${SRCFILE}', shell=False)
class pdflatex(tex): class pdflatex(tex):
"Compiles PdfLaTeX files"
texfun, vars = Task.compile_fun('${PDFLATEX} ${PDFLATEXFLAGS} ${SRCFILE}', shell=False) texfun, vars = Task.compile_fun('${PDFLATEX} ${PDFLATEXFLAGS} ${SRCFILE}', shell=False)
class xelatex(tex): class xelatex(tex):
"XeLaTeX files"
texfun, vars = Task.compile_fun('${XELATEX} ${XELATEXFLAGS} ${SRCFILE}', shell=False) texfun, vars = Task.compile_fun('${XELATEX} ${XELATEXFLAGS} ${SRCFILE}', shell=False)
class dvips(Task.Task): class dvips(Task.Task):
"Converts dvi files to postscript"
run_str = '${DVIPS} ${DVIPSFLAGS} ${SRC} -o ${TGT}' run_str = '${DVIPS} ${DVIPSFLAGS} ${SRC} -o ${TGT}'
color = 'BLUE' color = 'BLUE'
after = ['latex', 'pdflatex', 'xelatex'] after = ['latex', 'pdflatex', 'xelatex']
class dvipdf(Task.Task): class dvipdf(Task.Task):
"Converts dvi files to pdf"
run_str = '${DVIPDF} ${DVIPDFFLAGS} ${SRC} ${TGT}' run_str = '${DVIPDF} ${DVIPDFFLAGS} ${SRC} ${TGT}'
color = 'BLUE' color = 'BLUE'
after = ['latex', 'pdflatex', 'xelatex'] after = ['latex', 'pdflatex', 'xelatex']
class pdf2ps(Task.Task): class pdf2ps(Task.Task):
"Converts pdf files to postscript"
run_str = '${PDF2PS} ${PDF2PSFLAGS} ${SRC} ${TGT}' run_str = '${PDF2PS} ${PDF2PSFLAGS} ${SRC} ${TGT}'
color = 'BLUE' color = 'BLUE'
after = ['latex', 'pdflatex', 'xelatex'] after = ['latex', 'pdflatex', 'xelatex']
@ -419,7 +437,8 @@ class pdf2ps(Task.Task):
@before_method('process_source') @before_method('process_source')
def apply_tex(self): def apply_tex(self):
""" """
Create :py:class:`waflib.Tools.tex.tex` objects, and dvips/dvipdf/pdf2ps tasks if necessary (outs='ps', etc). Creates :py:class:`waflib.Tools.tex.tex` objects, and
dvips/dvipdf/pdf2ps tasks if necessary (outs='ps', etc).
""" """
if not getattr(self, 'type', None) in ('latex', 'pdflatex', 'xelatex'): if not getattr(self, 'type', None) in ('latex', 'pdflatex', 'xelatex'):
self.type = 'pdflatex' self.type = 'pdflatex'
@ -427,7 +446,7 @@ def apply_tex(self):
outs = Utils.to_list(getattr(self, 'outs', [])) outs = Utils.to_list(getattr(self, 'outs', []))
# prompt for incomplete files (else the batchmode is used) # prompt for incomplete files (else the batchmode is used)
self.env['PROMPT_LATEX'] = getattr(self, 'prompt', 1) self.env.PROMPT_LATEX = getattr(self, 'prompt', 1)
deps_lst = [] deps_lst = []
@ -444,7 +463,6 @@ def apply_tex(self):
deps_lst.append(dep) deps_lst.append(dep)
for node in self.to_nodes(self.source): for node in self.to_nodes(self.source):
if self.type == 'latex': if self.type == 'latex':
task = self.create_task('latex', node, node.change_ext('.dvi')) task = self.create_task('latex', node, node.change_ext('.dvi'))
elif self.type == 'pdflatex': elif self.type == 'pdflatex':
@ -495,8 +513,7 @@ def apply_tex(self):
def configure(self): def configure(self):
""" """
Try to find the programs tex, latex and others. Do not raise any error if they Find the programs tex, latex and others without raising errors.
are not found.
""" """
v = self.env v = self.env
for p in 'tex latex pdflatex xelatex bibtex dvips dvipdf ps2pdf makeindex pdf2ps makeglossaries'.split(): for p in 'tex latex pdflatex xelatex bibtex dvips dvipdf ps2pdf makeindex pdf2ps makeglossaries'.split():
@ -504,5 +521,5 @@ def configure(self):
self.find_program(p, var=p.upper()) self.find_program(p, var=p.upper())
except self.errors.ConfigurationError: except self.errors.ConfigurationError:
pass pass
v['DVIPSFLAGS'] = '-Ppdf' v.DVIPSFLAGS = '-Ppdf'

View File

@ -124,7 +124,7 @@ def init_vala_task(self):
valatask.install_path = getattr(self, 'install_path', '') valatask.install_path = getattr(self, 'install_path', '')
valatask.vapi_path = getattr(self, 'vapi_path', '${DATAROOTDIR}/vala/vapi') valatask.vapi_path = getattr(self, 'vapi_path', '${DATAROOTDIR}/vala/vapi')
valatask.pkg_name = getattr(self, 'pkg_name', self.env['PACKAGE']) valatask.pkg_name = getattr(self, 'pkg_name', self.env.PACKAGE)
valatask.header_path = getattr(self, 'header_path', '${INCLUDEDIR}/%s-%s' % (valatask.pkg_name, _get_api_version())) valatask.header_path = getattr(self, 'header_path', '${INCLUDEDIR}/%s-%s' % (valatask.pkg_name, _get_api_version()))
valatask.install_binding = getattr(self, 'install_binding', True) valatask.install_binding = getattr(self, 'install_binding', True)
@ -275,7 +275,7 @@ def find_valac(self, valac_name, min_version):
if valac and valac_version < min_version: if valac and valac_version < min_version:
self.fatal("%s version %r is too old, need >= %r" % (valac_name, valac_version, min_version)) self.fatal("%s version %r is too old, need >= %r" % (valac_name, valac_version, min_version))
self.env['VALAC_VERSION'] = valac_version self.env.VALAC_VERSION = valac_version
return valac return valac
@conf @conf
@ -305,7 +305,7 @@ def check_vala_deps(self):
""" """
Load the gobject and gthread packages if they are missing. Load the gobject and gthread packages if they are missing.
""" """
if not self.env['HAVE_GOBJECT']: if not self.env.HAVE_GOBJECT:
pkg_args = {'package': 'gobject-2.0', pkg_args = {'package': 'gobject-2.0',
'uselib_store': 'GOBJECT', 'uselib_store': 'GOBJECT',
'args': '--cflags --libs'} 'args': '--cflags --libs'}
@ -313,7 +313,7 @@ def check_vala_deps(self):
pkg_args['atleast_version'] = Options.options.vala_target_glib pkg_args['atleast_version'] = Options.options.vala_target_glib
self.check_cfg(**pkg_args) self.check_cfg(**pkg_args)
if not self.env['HAVE_GTHREAD']: if not self.env.HAVE_GTHREAD:
pkg_args = {'package': 'gthread-2.0', pkg_args = {'package': 'gthread-2.0',
'uselib_store': 'GTHREAD', 'uselib_store': 'GTHREAD',
'args': '--cflags --libs'} 'args': '--cflags --libs'}

View File

@ -11,7 +11,7 @@ from waflib.Configure import conf
@conf @conf
def find_xlc(conf): def find_xlc(conf):
""" """
Detect the Aix C compiler Detects the Aix C compiler
""" """
cc = conf.find_program(['xlc_r', 'xlc'], var='CC') cc = conf.find_program(['xlc_r', 'xlc'], var='CC')
conf.get_xlc_version(cc) conf.get_xlc_version(cc)
@ -24,38 +24,36 @@ def xlc_common_flags(conf):
""" """
v = conf.env v = conf.env
v['CC_SRC_F'] = [] v.CC_SRC_F = []
v['CC_TGT_F'] = ['-c', '-o'] v.CC_TGT_F = ['-c', '-o']
# linker if not v.LINK_CC:
if not v['LINK_CC']: v['LINK_CC'] = v['CC'] v.LINK_CC = v.CC
v['CCLNK_SRC_F'] = []
v['CCLNK_TGT_F'] = ['-o']
v['CPPPATH_ST'] = '-I%s'
v['DEFINES_ST'] = '-D%s'
v['LIB_ST'] = '-l%s' # template for adding libs v.CCLNK_SRC_F = []
v['LIBPATH_ST'] = '-L%s' # template for adding libpaths v.CCLNK_TGT_F = ['-o']
v['STLIB_ST'] = '-l%s' v.CPPPATH_ST = '-I%s'
v['STLIBPATH_ST'] = '-L%s' v.DEFINES_ST = '-D%s'
v['RPATH_ST'] = '-Wl,-rpath,%s'
v['SONAME_ST'] = [] v.LIB_ST = '-l%s' # template for adding libs
v['SHLIB_MARKER'] = [] v.LIBPATH_ST = '-L%s' # template for adding libpaths
v['STLIB_MARKER'] = [] v.STLIB_ST = '-l%s'
v.STLIBPATH_ST = '-L%s'
v.RPATH_ST = '-Wl,-rpath,%s'
# program v.SONAME_ST = []
v['LINKFLAGS_cprogram'] = ['-Wl,-brtl'] v.SHLIB_MARKER = []
v['cprogram_PATTERN'] = '%s' v.STLIB_MARKER = []
# shared library v.LINKFLAGS_cprogram = ['-Wl,-brtl']
v['CFLAGS_cshlib'] = ['-fPIC'] v.cprogram_PATTERN = '%s'
v['LINKFLAGS_cshlib'] = ['-G', '-Wl,-brtl,-bexpfull']
v['cshlib_PATTERN'] = 'lib%s.so'
# static lib v.CFLAGS_cshlib = ['-fPIC']
v['LINKFLAGS_cstlib'] = [] v.LINKFLAGS_cshlib = ['-G', '-Wl,-brtl,-bexpfull']
v['cstlib_PATTERN'] = 'lib%s.a' v.cshlib_PATTERN = 'lib%s.so'
v.LINKFLAGS_cstlib = []
v.cstlib_PATTERN = 'lib%s.a'
def configure(conf): def configure(conf):
conf.find_xlc() conf.find_xlc()

View File

@ -11,7 +11,7 @@ from waflib.Configure import conf
@conf @conf
def find_xlcxx(conf): def find_xlcxx(conf):
""" """
Detect the Aix C++ compiler Detects the Aix C++ compiler
""" """
cxx = conf.find_program(['xlc++_r', 'xlc++'], var='CXX') cxx = conf.find_program(['xlc++_r', 'xlc++'], var='CXX')
conf.get_xlc_version(cxx) conf.get_xlc_version(cxx)
@ -24,38 +24,36 @@ def xlcxx_common_flags(conf):
""" """
v = conf.env v = conf.env
v['CXX_SRC_F'] = [] v.CXX_SRC_F = []
v['CXX_TGT_F'] = ['-c', '-o'] v.CXX_TGT_F = ['-c', '-o']
# linker if not v.LINK_CXX:
if not v['LINK_CXX']: v['LINK_CXX'] = v['CXX'] v.LINK_CXX = v.CXX
v['CXXLNK_SRC_F'] = []
v['CXXLNK_TGT_F'] = ['-o']
v['CPPPATH_ST'] = '-I%s'
v['DEFINES_ST'] = '-D%s'
v['LIB_ST'] = '-l%s' # template for adding libs v.CXXLNK_SRC_F = []
v['LIBPATH_ST'] = '-L%s' # template for adding libpaths v.CXXLNK_TGT_F = ['-o']
v['STLIB_ST'] = '-l%s' v.CPPPATH_ST = '-I%s'
v['STLIBPATH_ST'] = '-L%s' v.DEFINES_ST = '-D%s'
v['RPATH_ST'] = '-Wl,-rpath,%s'
v['SONAME_ST'] = [] v.LIB_ST = '-l%s' # template for adding libs
v['SHLIB_MARKER'] = [] v.LIBPATH_ST = '-L%s' # template for adding libpaths
v['STLIB_MARKER'] = [] v.STLIB_ST = '-l%s'
v.STLIBPATH_ST = '-L%s'
v.RPATH_ST = '-Wl,-rpath,%s'
# program v.SONAME_ST = []
v['LINKFLAGS_cxxprogram']= ['-Wl,-brtl'] v.SHLIB_MARKER = []
v['cxxprogram_PATTERN'] = '%s' v.STLIB_MARKER = []
# shared library v.LINKFLAGS_cxxprogram= ['-Wl,-brtl']
v['CXXFLAGS_cxxshlib'] = ['-fPIC'] v.cxxprogram_PATTERN = '%s'
v['LINKFLAGS_cxxshlib'] = ['-G', '-Wl,-brtl,-bexpfull']
v['cxxshlib_PATTERN'] = 'lib%s.so'
# static lib v.CXXFLAGS_cxxshlib = ['-fPIC']
v['LINKFLAGS_cxxstlib'] = [] v.LINKFLAGS_cxxshlib = ['-G', '-Wl,-brtl,-bexpfull']
v['cxxstlib_PATTERN'] = 'lib%s.a' v.cxxshlib_PATTERN = 'lib%s.so'
v.LINKFLAGS_cxxstlib = []
v.cxxstlib_PATTERN = 'lib%s.a'
def configure(conf): def configure(conf):
conf.find_xlcxx() conf.find_xlcxx()