return task cxx_str = '${CXX} ${CXXFLAGS} ${CPPFLAGS} ${_CXXINCFLAGS} ${_CXXDEFFLAGS} ${CXX_SRC_F}${SRC} ${CXX_TGT_F}${TGT}' cls = Task.simple_task_type('cxx', cxx_str, color='GREEN', ext_out='.o', ext_in='.cxx', shell=False) cls.scan = ccroot.scan cls.vars.append('CXXDEPS') link_str = '${LINK_CXX} ${CXXLNK_SRC_F}${SRC} ${CXXLNK_TGT_F}${TGT[0].abspath(env)} ${LINKFLAGS}' cls = Task.simple_task_type('cxx_link', link_str, color='YELLOW', ext_in='.o', ext_out='.bin', shell=False) cls.maxjobs = 1 cls.install = Utils.nada feature('cxx')(init_cxx) before('apply_type_vars')(init_cxx) after('default_cc')(init_cxx) feature('cxx')(apply_obj_vars_cxx) after('apply_incpaths')(apply_obj_vars_cxx) feature('cxx')(apply_defines_cxx) after('apply_lib_vars')(apply_defines_cxx) extension(EXT_CXX)(cxx_hook)
task.outputs=[node.change_ext(obj_ext)] try: self.compiled_tasks.append(task) except AttributeError: raise Utils.WafError('Have you forgotten to set the feature "cxx" on %s?'%str(self)) return task cxx_str='${CXX} ${CXXFLAGS} ${CPPFLAGS} ${_CXXINCFLAGS} ${_CXXDEFFLAGS} ${CXX_SRC_F}${SRC} ${CXX_TGT_F}${TGT}' cls=Task.simple_task_type('cxx',cxx_str,color='GREEN',ext_out='.o',ext_in='.cxx',shell=False) cls.scan=ccroot.scan cls.vars.append('CXXDEPS') link_str='${LINK_CXX} ${CXXLNK_SRC_F}${SRC} ${CXXLNK_TGT_F}${TGT} ${LINKFLAGS}' cls=Task.simple_task_type('cxx_link',link_str,color='YELLOW',ext_in='.o',shell=False) cls.maxjobs=1 cls2=Task.task_type_from_func('vnum_cxx_link',ccroot.link_vnum,cls.vars,color='CYAN',ext_in='.o') cls2.maxjobs=1 link_str='${LINK_CXX} ${CXXLNK_SRC_F}${SRC} ${CXXLNK_TGT_F}${TGT[0].abspath(env)} ${LINKFLAGS}' cls=Task.simple_task_type('dll_cxx_link',link_str,color='YELLOW',ext_in='.o',shell=False) cls.maxjobs=1 old=cls.run def run(self):return old(self)or ccroot.post_dll_link(self) cls.run=run feature('cxx')(init_cxx) before('apply_type_vars')(init_cxx) after('default_cc')(init_cxx) feature('cxx')(apply_obj_vars_cxx) after('apply_incpaths')(apply_obj_vars_cxx) feature('cxx')(apply_defines_cxx) after('apply_lib_vars')(apply_defines_cxx) extension(EXT_CXX)(cxx_hook)
#! /usr/bin/env python # encoding: utf-8 import Task from TaskGen import extension bison='${BISON} ${BISONFLAGS} ${SRC[0].abspath()} -o ${TGT[0].name}' cls=Task.simple_task_type('bison',bison,'GREEN',ext_in='.yc .y .yy',ext_out='.c .cxx .h .l',shell=False) def big_bison(self,node): has_h='-d'in self.env['BISONFLAGS'] outs=[] if node.name.endswith('.yc'): outs.append(node.change_ext('.tab.cc')) if has_h: outs.append(node.change_ext('.tab.hh')) else: outs.append(node.change_ext('.tab.c')) if has_h: outs.append(node.change_ext('.tab.h')) tsk=self.create_task('bison',node,outs) tsk.cwd=node.bld_dir(tsk.env) self.allnodes.append(outs[0]) def detect(conf): bison=conf.find_program('bison',var='BISON',mandatory=True) conf.env['BISONFLAGS']='-d' extension(['.y','.yc','.yy'])(big_bison)
) conf.env['OCAMLC'] = occ conf.env['OCAMLOPT'] = opt conf.env['OCAMLLEX'] = conf.find_program('ocamllex', var='OCAMLLEX') conf.env['OCAMLYACC'] = conf.find_program('ocamlyacc', var='OCAMLYACC') conf.env['OCAMLFLAGS'] = '' conf.env['OCAMLLIB'] = Utils.cmd_output(conf.env['OCAMLC'] + ' -where').strip() + os.sep conf.env['LIBPATH_OCAML'] = Utils.cmd_output(conf.env['OCAMLC'] + ' -where').strip() + os.sep conf.env['CPPPATH_OCAML'] = Utils.cmd_output(conf.env['OCAMLC'] + ' -where').strip() + os.sep conf.env['LIB_OCAML'] = 'camlrun' feature('ocaml')(init_ml) feature('ocaml')(init_envs_ml) after('init_ml')(init_envs_ml) feature('ocaml')(apply_incpaths_ml) before('apply_vars_ml')(apply_incpaths_ml) after('init_envs_ml')(apply_incpaths_ml) feature('ocaml')(apply_vars_ml) before('apply_core')(apply_vars_ml) feature('ocaml')(apply_link_ml) after('apply_core')(apply_link_ml) extension(EXT_MLL)(mll_hook) extension(EXT_MLY)(mly_hook) extension(EXT_MLI)(mli_hook) extension(EXT_MLC)(mlc_hook) extension(EXT_ML)(ml_hook)
libs=self.to_list(self.uselib) for l in libs: val=self.env['CCDEFINES_'+l] if val:milst+=val self.env['DEFLINES']=["%s %s"%(x[0],Utils.trimquotes('='.join(x[1:])))for x in[y.split('=')for y in milst]] y=self.env['CCDEFINES_ST'] self.env['_CCDEFFLAGS']=[y%x for x in milst] def c_hook(self,node): task=self.create_task('cc') try:obj_ext=self.obj_ext except AttributeError:obj_ext='_%d.o'%self.idx task.defines=self.scanner_defines task.inputs=[node] task.outputs=[node.change_ext(obj_ext)] self.compiled_tasks.append(task) cc_str='${CC} ${CCFLAGS} ${CPPFLAGS} ${_CCINCFLAGS} ${_CCDEFFLAGS} ${CC_SRC_F}${SRC} ${CC_TGT_F}${TGT}' link_str='${LINK_CC} ${CCLNK_SRC_F}${SRC} ${CCLNK_TGT_F}${TGT} ${LINKFLAGS} ${_LIBDIRFLAGS} ${_LIBFLAGS}' cls=Task.simple_task_type('cc',cc_str,'GREEN',ext_out='.o',ext_in='.c') cls.scan=ccroot.scan cls.vars.append('CCDEPS') cls=Task.simple_task_type('cc_link',link_str,color='YELLOW',ext_in='.o') cls.maxjobs=1 TaskGen.declare_order('apply_incpaths','apply_defines_cc','apply_core','apply_lib_vars','apply_obj_vars_cc','apply_obj_vars') feature('cc')(init_cc) before('apply_type_vars')(init_cc) after('default_cc')(init_cc) feature('cc')(apply_obj_vars_cc) feature('cc')(apply_defines_cc) extension(EXT_CC)(c_hook)
def asm_incflags(self): if self.env["ASINCFLAGS"]: self.env["_ASINCFLAGS"] = self.env["ASINCFLAGS"] if "cxx" in self.features: self.env["_ASINCFLAGS"] = self.env["_CXXINCFLAGS"] else: self.env["_ASINCFLAGS"] = self.env["_CCINCFLAGS"] def detect(conf): comp = os.environ.get("AS", "") if not comp: comp = conf.find_program("as", var="AS") if not comp: comp = conf.find_program("gas", var="AS") if not comp: comp = conf.env["CC"] if not comp: return v = conf.env v["ASFLAGS"] = "" extension(EXT_ASM)(asm_hook) taskgen(asm_incflags) after("apply_obj_vars_cc")(asm_incflags) after("apply_obj_vars_cxx")(asm_incflags) before("apply_link")(asm_incflags)
Task.simple_task_type('d_header',d_header_str,color='BLUE',shell=False) def d_platform_flags(conf): v=conf.env binfmt=v.DEST_BINFMT or Utils.unversioned_sys_platform_to_binary_format(v.DEST_OS or Utils.unversioned_sys_platform()) if binfmt=='pe': v['D_program_PATTERN']='%s.exe' v['D_shlib_PATTERN']='lib%s.dll' v['D_staticlib_PATTERN']='lib%s.a' else: v['D_program_PATTERN']='%s' v['D_shlib_PATTERN']='lib%s.so' v['D_staticlib_PATTERN']='lib%s.a' feature('d')(init_d) before('apply_type_vars')(init_d) feature('d')(init_d) before('apply_d_libs')(init_d) feature('d')(apply_d_libs) after('apply_d_link','init_d')(apply_d_libs) before('apply_vnum')(apply_d_libs) feature('dprogram','dshlib','dstaticlib')(apply_d_link) after('apply_core')(apply_d_link) feature('d')(apply_d_vars) after('apply_core')(apply_d_vars) feature('dshlib')(add_shlib_d_flags) after('apply_d_vars')(add_shlib_d_flags) extension(EXT_D)(d_hook) taskgen(generate_header) before('apply_core')(process_header) conftest(d_platform_flags)
'print "$Config{privlib}/ExtUtils/xsubpp$Config{exe_ext}"') conf.env.EXTUTILS_TYPEMAP = read_out( 'print "$Config{privlib}/ExtUtils/typemap"') conf.env.perlext_PATTERN = '%s.' + read_out('print $Config{dlext}')[0] if getattr(Options.options, 'perlarchdir', None): conf.env.ARCHDIR_PERL = Options.options.perlarchdir else: conf.env.ARCHDIR_PERL = read_out('print $Config{sitearch}')[0] def set_options(opt): 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) before('apply_incpaths', 'apply_type_vars', 'apply_lib_vars')(init_perlext) feature('perlext')(init_perlext) extension(EXT_XS)(xsubpp_file) conf(check_perl_version) conf(check_perl_module) conf(check_perl_ext_devel)
type='int', default=1, dest='want_rpath', help='set rpath to 1 or 0 [Default 1]') opt.add_option('--header-ext', type='string', default='', help='header extension for moc files', dest='qt_header_ext') for i in 'qtdir qtbin qtlibs'.split(): opt.add_option('--' + i, type='string', default='', dest=i) if sys.platform == "darwin": opt.add_option('--no-qt4-framework', action="store_false", help='do not use the framework version of Qt4 in OS X', dest='use_qt4_osxframework', default=True) opt.add_option('--translate', action="store_true", help="collect translation strings", dest="trans_qt4", default=False) extension(EXT_RCC)(create_rcc_task) extension(EXT_UI)(create_uic_task) extension('.ts')(add_lang) feature('qt4')(apply_qt4) after('apply_link')(apply_qt4) extension(EXT_QT4)(cxx_hook)
#! /usr/bin/env python # encoding: utf-8 import Task from TaskGen import extension Task.simple_task_type('fluid','${FLUID} -c -o ${TGT[0].abspath(env)} -h ${TGT[1].abspath(env)} ${SRC}','BLUE',shell=False,ext_out='.cxx') def fluid(self,node): cpp=node.change_ext('.cpp') hpp=node.change_ext('.hpp') self.create_task('fluid',node,[cpp,hpp]) if'cxx'in self.features: self.allnodes.append(cpp) def detect(conf): fluid=conf.find_program('fluid',var='FLUID',mandatory=True) conf.check_cfg(path='fltk-config',package='',args='--cxxflags --ldflags',uselib_store='FLTK',mandatory=True) extension('.fl')(fluid)
def nasm_file(self, node): try: obj_ext = self.obj_ext except AttributeError: obj_ext = '_%d.o' % self.idx task = self.create_task('nasm') task.inputs = [node] task.outputs = [node.change_ext(obj_ext)] self.compiled_tasks.append(task) self.meths.append('apply_nasm_vars') Task.simple_task_type('nasm', nasm_str, color='BLUE', ext_out='.o', shell=False) def detect(conf): nasm = conf.find_program('nasm', var='NASM') if not nasm: nasm = conf.find_program('yasm', var='NASM') if not nasm: conf.fatal( 'could not find nasm (or yasm), install it or set PATH env var') before('apply_link')(apply_nasm_vars) extension(EXT_NASM)(nasm_file)
self.compiled_tasks.append(rctask) Task.simple_task_type('winrc', winrc_str, color='BLUE', before='cc cxx', shell=False) def detect(conf): v = conf.env winrc = v['WINRC'] v['WINRC_TGT_F'] = '-o' v['WINRC_SRC_F'] = '-i' if not winrc: if v['CC_NAME'] in ['gcc', 'cc', 'g++', 'c++']: winrc = conf.find_program('windres', var='WINRC', path_list=v['PATH']) elif v['CC_NAME'] == 'msvc': winrc = conf.find_program('RC', var='WINRC', path_list=v['PATH']) v['WINRC_TGT_F'] = '/fo' v['WINRC_SRC_F'] = '' if not winrc: conf.fatal('winrc was not found!') v['WINRCFLAGS'] = '' extension(EXT_WINRC)(rc_file)
if hasattr(self, "includes"): for inc in self.to_list(self.includes): node = self.path.find_dir(inc) if not node: raise Utils.WafError("cannot find the dir" + inc) self.env.append_value("NASM_INCLUDES", "-I%s" % node.srcpath(self.env)) self.env.append_value("NASM_INCLUDES", "-I%s" % node.bldpath(self.env)) def nasm_file(self, node): try: obj_ext = self.obj_ext except AttributeError: obj_ext = "_%d.o" % self.idx task = self.create_task("nasm") task.inputs = [node] task.outputs = [node.change_ext(obj_ext)] self.compiled_tasks.append(task) self.meths.append("apply_nasm_vars") Task.simple_task_type("nasm", nasm_str, color="BLUE", ext_out=".o", shell=False) def detect(conf): nasm = conf.find_program(["nasm", "yasm"], var="NASM", mandatory=True) before("apply_link")(apply_nasm_vars) extension(EXT_NASM)(nasm_file)
if value: core=env[coreval] accu=[] for lib in value: if var!='QTCORE': if lib in core: continue accu.append('-Wl,--rpath='+lib) env['RPATH_'+var]=accu process_rpath(vars,'LIBPATH_QTCORE') process_rpath(vars_debug,'LIBPATH_QTCORE_DEBUG') env['QTLOCALE']=str(env['PREFIX'])+'/share/locale' def detect(conf): if sys.platform=='win32':conf.fatal('Qt4.py will not work on win32 for now - ask the author') detect_qt4(conf) def set_options(opt): opt.add_option('--want-rpath',type='int',default=1,dest='want_rpath',help='set rpath to 1 or 0 [Default 1]') opt.add_option('--header-ext',type='string',default='',help='header extension for moc files',dest='qt_header_ext') for i in"qtdir qtincludes qtlibs qtbin".split(): opt.add_option('--'+i,type='string',default='',dest=i) if sys.platform=="darwin": opt.add_option('--no-qt4-framework',action="store_false",help='do not use the framework version of Qt4 in OS X',dest='use_qt4_osxframework',default=True) opt.add_option('--translate',action="store_true",help="collect translation strings",dest="trans_qt4",default=False) extension(EXT_RCC)(create_rcc_task) extension(EXT_UI)(create_uic_task) taskgen(apply_qt4) feature('qt4')(apply_qt4) after('apply_link')(apply_qt4) extension(EXT_QT4)(cxx_hook)
task.inputs = [node] task.outputs = [node.change_ext(obj_ext)] self.compiled_tasks.append(task) self.meths.append('asm_incflags') def asm_incflags(self): if self.env['ASINCFLAGS']: self.env['_ASINCFLAGS'] = self.env['ASINCFLAGS'] if 'cxx' in self.features: self.env['_ASINCFLAGS'] = self.env['_CXXINCFLAGS'] else: self.env['_ASINCFLAGS'] = self.env['_CCINCFLAGS'] def detect(conf): comp = conf.environ.get('AS', '') if not comp: comp = conf.env['AS'] if not comp: comp = conf.find_program('as', var='AS') if not comp: comp = conf.find_program('gas', var='AS') if not comp: comp = conf.env['CC'] if not comp: return v = conf.env v['ASFLAGS'] = '' extension(EXT_ASM)(asm_hook) taskgen(asm_incflags) after('apply_obj_vars_cc')(asm_incflags) after('apply_obj_vars_cxx')(asm_incflags) before('apply_link')(asm_incflags)
if not node.parent.id in self.masters: m = self.masters[node.parent.id] = self.master = self.create_task('batch') self.allmasters.append(m) else: m = self.masters[node.parent.id] if len(m.slaves) > MAX_BATCH: m = self.masters[node.parent.id] = self.master = self.create_task('batch') self.allmasters.append(m) m.add_slave(task) return task return foo c_hook = wrap(cc.c_hook) extension(cc.EXT_CC)(c_hook) cxx_hook = wrap(cxx.cxx_hook) extension(cxx.EXT_CXX)(cxx_hook) @feature('cprogram', 'cshlib', 'cstaticlib') @after('apply_link') def link_after_masters(self): if getattr(self, 'allmasters', None): for m in self.allmasters: self.link_task.set_run_after(m) for c in ['cc', 'cxx']: t = Task.TaskBase.classes[c] def run(self):
valac=conf.find_program('valac',var='VALAC',mandatory=True) if not conf.env["HAVE_GOBJECT"]: pkg_args={'package':'gobject-2.0','uselib_store':'GOBJECT','args':'--cflags --libs'} if getattr(Options.options,'vala_target_glib',None): pkg_args['atleast_version']=Options.options.vala_target_glib conf.check_cfg(**pkg_args) if not conf.env["HAVE_GTHREAD"]: pkg_args={'package':'gthread-2.0','uselib_store':'GTHREAD','args':'--cflags --libs'} if getattr(Options.options,'vala_target_glib',None): pkg_args['atleast_version']=Options.options.vala_target_glib conf.check_cfg(**pkg_args) try: output=Utils.cmd_output(valac+" --version",silent=True) version=output.split(' ',1)[-1].strip().split(".")[0:3] version=[int(x)for x in version] valac_version=tuple(version) except Exception: valac_version=(0,0,0) conf.check_message('program version','valac >= '+min_version_str,valac_version>=min_version,"%d.%d.%d"%valac_version) conf.check_tool('gnu_dirs') if valac_version<min_version: conf.fatal("valac version too old to be used with this tool") return conf.env['VALAC_VERSION']=valac_version conf.env['VALAFLAGS']='' def set_options(opt): valaopts=opt.add_option_group('Vala Compiler Options') valaopts.add_option('--vala-target-glib',default=None,dest='vala_target_glib',metavar='MAJOR.MINOR',help='Target version of glib for Vala GObject code generation') extension(EXT_VALA)(vala_file)
import TaskGen,Task from Utils import quote_whitespace from TaskGen import extension EXT_WINRC=['.rc'] winrc_str='${WINRC} ${_CPPDEFFLAGS} ${_CCDEFFLAGS} ${WINRCFLAGS} ${_CPPINCFLAGS} ${_CCINCFLAGS} ${WINRC_TGT_F} ${TGT} ${WINRC_SRC_F} ${SRC}' def rc_file(self,node): obj_ext='.rc.o' if self.env['WINRC_TGT_F']=='/fo':obj_ext='.res' rctask=self.create_task('winrc') rctask.set_inputs(node) rctask.set_outputs(node.change_ext(obj_ext)) self.compiled_tasks.append(rctask) Task.simple_task_type('winrc',winrc_str,color='BLUE',before='cc cxx',shell=False) def detect(conf): v=conf.env winrc=v['WINRC'] v['WINRC_TGT_F']='-o' v['WINRC_SRC_F']='-i' if not winrc: if v['CC_NAME']in['gcc','cc','g++','c++']: winrc=conf.find_program('windres',var='WINRC',path_list=v['PATH']) elif v['CC_NAME']=='msvc': winrc=conf.find_program('RC',var='WINRC',path_list=v['PATH']) v['WINRC_TGT_F']='/fo' v['WINRC_SRC_F']='' if not winrc: conf.fatal('winrc was not found!') v['WINRCFLAGS']='' extension(EXT_WINRC)(rc_file)
conf.check_cfg(**pkg_args) try: output = Utils.cmd_output(valac + " --version", silent=True) version = output.split(' ', 1)[-1].strip().split(".")[0:3] version = [int(x) for x in version] valac_version = tuple(version) except Exception: valac_version = (0, 0, 0) conf.check_message('program version', 'valac >= ' + min_version_str, valac_version >= min_version, "%d.%d.%d" % valac_version) conf.check_tool('gnu_dirs') if valac_version < min_version: conf.fatal("valac version too old to be used with this tool") return conf.env['VALAC_VERSION'] = valac_version conf.env['VALAFLAGS'] = '' def set_options(opt): valaopts = opt.add_option_group('Vala Compiler Options') valaopts.add_option( '--vala-target-glib', default=None, dest='vala_target_glib', metavar='MAJOR.MINOR', help='Target version of glib for Vala GObject code generation') extension(EXT_VALA)(vala_file)
cls = Task.simple_task_type('bison', bison, 'GREEN', ext_in='.yc .y .yy', ext_out='.c .cxx .h .l', shell=False) def big_bison(self, node): has_h = '-d' in self.env['BISONFLAGS'] outs = [] if node.name.endswith('.yc'): outs.append(node.change_ext('.tab.cc')) if has_h: outs.append(node.change_ext('.tab.hh')) else: outs.append(node.change_ext('.tab.c')) if has_h: outs.append(node.change_ext('.tab.h')) tsk = self.create_task('bison', node, outs) tsk.cwd = node.bld_dir(tsk.env) self.allnodes.append(outs[0]) def detect(conf): bison = conf.find_program('bison', var='BISON', mandatory=True) conf.env['BISONFLAGS'] = '-d' extension(['.y', '.yc', '.yy'])(big_bison)
value=env['LIBPATH_'+var] if value: core=env[coreval] accu=[] for lib in value: if var!='QTCORE': if lib in core: continue accu.append('-Wl,--rpath='+lib) env['RPATH_'+var]=accu process_rpath(vars,'LIBPATH_QTCORE') process_rpath(vars_debug,'LIBPATH_QTCORE_DEBUG') env['QTLOCALE']=str(env['PREFIX'])+'/share/locale' def detect(conf): detect_qt4(conf) def set_options(opt): opt.add_option('--want-rpath',type='int',default=1,dest='want_rpath',help='set rpath to 1 or 0 [Default 1]') opt.add_option('--header-ext',type='string',default='',help='header extension for moc files',dest='qt_header_ext') for i in'qtdir qtbin qtlibs'.split(): opt.add_option('--'+i,type='string',default='',dest=i) if sys.platform=="darwin": opt.add_option('--no-qt4-framework',action="store_false",help='do not use the framework version of Qt4 in OS X',dest='use_qt4_osxframework',default=True) opt.add_option('--translate',action="store_true",help="collect translation strings",dest="trans_qt4",default=False) extension(EXT_RCC)(create_rcc_task) extension(EXT_UI)(create_uic_task) extension('.ts')(add_lang) feature('qt4')(apply_qt4) after('apply_link')(apply_qt4) extension(EXT_QT4)(cxx_hook)
return task cc_str = '${CC} ${CCFLAGS} ${CPPFLAGS} ${_CCINCFLAGS} ${_CCDEFFLAGS} ${CC_SRC_F}${SRC} ${CC_TGT_F}${TGT}' cls = Task.simple_task_type('cc', cc_str, 'GREEN', ext_out='.o', ext_in='.c', shell=False) cls.scan = ccroot.scan cls.vars.append('CCDEPS') link_str = '${LINK_CC} ${CCLNK_SRC_F}${SRC} ${CCLNK_TGT_F}${TGT[0].abspath(env)} ${LINKFLAGS}' cls = Task.simple_task_type('cc_link', link_str, color='YELLOW', ext_in='.o', ext_out='.bin', shell=False) cls.maxjobs = 1 cls.install = Utils.nada feature('cc')(init_cc) before('apply_type_vars')(init_cc) after('default_cc')(init_cc) feature('cc')(apply_obj_vars_cc) after('apply_incpaths')(apply_obj_vars_cc) feature('cc')(apply_defines_cc) after('apply_lib_vars')(apply_defines_cc) extension(EXT_CC)(c_hook)
v = conf.env binfmt = v.DEST_BINFMT or Utils.unversioned_sys_platform_to_binary_format( v.DEST_OS or Utils.unversioned_sys_platform()) if binfmt == 'pe': v['D_program_PATTERN'] = '%s.exe' v['D_shlib_PATTERN'] = 'lib%s.dll' v['D_staticlib_PATTERN'] = 'lib%s.a' else: v['D_program_PATTERN'] = '%s' v['D_shlib_PATTERN'] = 'lib%s.so' v['D_staticlib_PATTERN'] = 'lib%s.a' feature('d')(init_d) before('apply_type_vars')(init_d) feature('d')(init_d) before('apply_d_libs')(init_d) feature('d')(apply_d_libs) after('apply_d_link', 'init_d')(apply_d_libs) before('apply_vnum')(apply_d_libs) feature('dprogram', 'dshlib', 'dstaticlib')(apply_d_link) after('apply_core')(apply_d_link) feature('d')(apply_d_vars) after('apply_core')(apply_d_vars) feature('dshlib')(add_shlib_d_flags) after('apply_d_vars')(add_shlib_d_flags) extension(EXT_D)(d_hook) taskgen(generate_header) before('apply_core')(process_header) conftest(d_platform_flags)
def detect(conf): opt=conf.find_program('ocamlopt',var='OCAMLOPT') occ=conf.find_program('ocamlc',var='OCAMLC') if(not opt)or(not occ): conf.fatal('The objective caml compiler was not found:\ninstall it or make it available in your PATH') conf.env['OCAMLC']=occ conf.env['OCAMLOPT']=opt conf.env['OCAMLLEX']=conf.find_program('ocamllex',var='OCAMLLEX') conf.env['OCAMLYACC']=conf.find_program('ocamlyacc',var='OCAMLYACC') conf.env['OCAMLFLAGS']='' conf.env['OCAMLLIB']=Utils.cmd_output(conf.env['OCAMLC']+' -where').strip()+os.sep conf.env['LIBPATH_OCAML']=Utils.cmd_output(conf.env['OCAMLC']+' -where').strip()+os.sep conf.env['CPPPATH_OCAML']=Utils.cmd_output(conf.env['OCAMLC']+' -where').strip()+os.sep conf.env['LIB_OCAML']='camlrun' feature('ocaml')(init_ml) feature('ocaml')(init_envs_ml) after('init_ml')(init_envs_ml) feature('ocaml')(apply_incpaths_ml) before('apply_vars_ml')(apply_incpaths_ml) after('init_envs_ml')(apply_incpaths_ml) feature('ocaml')(apply_vars_ml) before('apply_core')(apply_vars_ml) feature('ocaml')(apply_link_ml) after('apply_core')(apply_link_ml) extension(EXT_MLL)(mll_hook) extension(EXT_MLY)(mly_hook) extension(EXT_MLI)(mli_hook) extension(EXT_MLC)(mlc_hook) extension(EXT_ML)(ml_hook)
def check_perl_module(conf,module): cmd=[conf.env['PERL'],'-e','use %s'%module] r=Utils.pproc.call(cmd,stdout=Utils.pproc.PIPE,stderr=Utils.pproc.PIPE)==0 conf.check_message("perl module %s"%module,"",r) return r def check_perl_ext_devel(conf): if not conf.env.PERL: conf.fatal('perl detection is required first') def read_out(cmd): return Utils.to_list(Utils.cmd_output([conf.env.PERL,'-MConfig','-e',cmd])) conf.env.LINKFLAGS_PERLEXT=read_out('print $Config{lddlflags}') conf.env.CPPPATH_PERLEXT=read_out('print "$Config{archlib}/CORE"') conf.env.CCFLAGS_PERLEXT=read_out('print "$Config{ccflags} $Config{cccdlflags}"') conf.env.XSUBPP=read_out('print "$Config{privlib}/ExtUtils/xsubpp$Config{exe_ext}"') conf.env.EXTUTILS_TYPEMAP=read_out('print "$Config{privlib}/ExtUtils/typemap"') conf.env.perlext_PATTERN='%s.'+read_out('print $Config{dlext}')[0] if getattr(Options.options,'perlarchdir',None): conf.env.ARCHDIR_PERL=Options.options.perlarchdir else: conf.env.ARCHDIR_PERL=read_out('print $Config{sitearch}')[0] def set_options(opt): 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) before('apply_incpaths','apply_type_vars','apply_lib_vars')(init_perlext) feature('perlext')(init_perlext) extension(EXT_XS)(xsubpp_file) conf(check_perl_version) conf(check_perl_module) conf(check_perl_ext_devel)
action='store_false', default=1, help= 'Do not install bytecode compiled .pyc files (configuration) [Default:install]', dest='pyc') opt.add_option( '--nopyo', action='store_false', default=1, help= 'Do not install optimised compiled .pyo files (configuration) [Default:install]', dest='pyo') before('apply_incpaths', 'apply_lib_vars', 'apply_type_vars')(init_pyext) feature('pyext')(init_pyext) before('apply_bundle')(init_pyext) before('apply_link', 'apply_lib_vars', 'apply_type_vars')(pyext_shlib_ext) after('apply_bundle')(pyext_shlib_ext) feature('pyext')(pyext_shlib_ext) before('apply_incpaths', 'apply_lib_vars', 'apply_type_vars')(init_pyembed) feature('pyembed')(init_pyembed) extension(EXT_PY)(process_py) feature('py')(byte_compile_py) before('apply_core')(init_py) after('vars_target_cprogram', 'vars_target_cstaticlib')(init_py) feature('py')(init_py) conf(check_python_headers) conf(check_python_version) conf(check_python_module)
if not conf.env.PYTHON: conf.env.PYTHON=sys.executable python=conf.find_program('python',var='PYTHON') if not python: conf.fatal('Could not find the path of the python executable') v=conf.env v['PYCMD']='"import sys, py_compile;py_compile.compile(sys.argv[1], sys.argv[2])"' v['PYFLAGS']='' v['PYFLAGS_OPT']='-O' v['PYC']=getattr(Options.options,'pyc',1) v['PYO']=getattr(Options.options,'pyo',1) def set_options(opt): opt.add_option('--nopyc',action='store_false',default=1,help='Do not install bytecode compiled .pyc files (configuration) [Default:install]',dest='pyc') opt.add_option('--nopyo',action='store_false',default=1,help='Do not install optimised compiled .pyo files (configuration) [Default:install]',dest='pyo') before('apply_incpaths','apply_lib_vars','apply_type_vars')(init_pyext) feature('pyext')(init_pyext) before('apply_bundle')(init_pyext) before('apply_link','apply_lib_vars','apply_type_vars')(pyext_shlib_ext) after('apply_bundle')(pyext_shlib_ext) feature('pyext')(pyext_shlib_ext) before('apply_incpaths','apply_lib_vars','apply_type_vars')(init_pyembed) feature('pyembed')(init_pyembed) extension(EXT_PY)(process_py) before('apply_core')(init_py) after('vars_target_cprogram','vars_target_cshlib')(init_py) feature('py')(init_py) conf(check_python_headers) conf(check_python_version) conf(check_python_module)
self.allmasters.append(m) else: m = self.masters[node.parent.id] if len(m.slaves) > MAX_BATCH: m = self.masters[ node.parent.id] = self.master = self.create_task('batch') self.allmasters.append(m) m.add_slave(task) return task return foo c_hook = wrap(cc.c_hook) extension(cc.EXT_CC)(c_hook) cxx_hook = wrap(cxx.cxx_hook) extension(cxx.EXT_CXX)(cxx_hook) @feature('cprogram', 'cshlib', 'cstaticlib') @after('apply_link') def link_after_masters(self): if getattr(self, 'allmasters', None): for m in self.allmasters: self.link_task.set_run_after(m) for c in ['cc', 'cxx']: t = Task.TaskBase.classes[c]