def generateDocs(env, doCPP=False, doC=False, doJava=False): """Generate and install generated documentation (doxygen & javadoc).""" # remove target files so documentation always gets rebuilt rmcmd = 'rm -fr doc/javadoc doc/doxygen/CC' output = os.popen(rmcmd).read() if doCPP: def docGeneratorCC(target, source, env): cmd = 'doxygen doc/doxygen/DoxyfileCC' pipe = Popen(cmd, shell=True, env={ "TOPLEVEL": "./" }, stdout=PIPE).stdout return docBuildCC = Builder(action=docGeneratorCC) env.Append(BUILDERS={'DocGenCC': docBuildCC}) env.Alias( 'doc', env.DocGenCC(target=['#/doc/doxygen/CC/html/index.html'], source=scanFiles("src/libsrc", accept=["*.cpp", "*.h"]))) if doC: def docGeneratorC(target, source, env): cmd = 'doxygen doc/doxygen/DoxyfileC' pipe = Popen(cmd, shell=True, env={ "TOPLEVEL": "./" }, stdout=PIPE).stdout return docBuildC = Builder(action=docGeneratorC) env.Append(BUILDERS={'DocGenC': docBuildC}) env.Alias( 'doc', env.DocGenC(target=['#/doc/doxygen/C/html/index.html'], source=scanFiles("src/libCsrc", accept=["*.c", "*.h"]))) if doJava: def docGeneratorJava(target, source, env): cmd = 'ant javadoc' output = os.popen(cmd).read() return docBuildJava = Builder(action=docGeneratorJava) env.Append(BUILDERS={'DocGenJava': docBuildJava}) env.Alias( 'doc', env.DocGenJava(target=['#/doc/javadoc/index.html'], source=scanFiles("java/org/jlab/coda", accept=["*.java"]))) return 1
def add_custom_builders(env): """Call this to add all our custom builders to the environment.""" from SCons.Scanner import Scanner from SCons.Builder import Builder from SCons.Action import Action # Add the file substitution tool TOOL_SUBST(env) # XXX: Put them into tools ? env['BUILDERS']['DistutilsSharedLibrary'] = DistutilsSharedLibrary env['BUILDERS']['NumpyCtypes'] = NumpyCtypes env['BUILDERS']['DistutilsPythonExtension'] = DistutilsPythonExtension env['BUILDERS']['NumpyPythonExtension'] = NumpyPythonExtension tpl_scanner = Scanner(function=generate_from_template_scanner, skeys=['.src']) env['BUILDERS']['FromCTemplate'] = Builder( action=Action(generate_from_c_template, '$CTEMPLATECOMSTR'), emitter=generate_from_template_emitter, source_scanner=tpl_scanner) env['BUILDERS']['FromFTemplate'] = Builder( action=Action(generate_from_f_template, '$FTEMPLATECOMSTR'), emitter=generate_from_template_emitter, source_scanner=tpl_scanner) createStaticExtLibraryBuilder(env) env['BUILDERS']['DistutilsStaticExtLibrary'] = DistutilsStaticExtLibrary env['BUILDERS']['DistutilsInstalledStaticExtLibrary'] = \ DistutilsInstalledStaticExtLibrary
def generate(env): def _ghc_searchpath_opts(paths): if paths: return reduce(lambda list, path: " -i" + path, paths, "") else: return "" env["_ghc_searchpath_opts"] = _ghc_searchpath_opts def _ghc_package_opts(packages): return reduce(lambda list, package: list + " -package " + package, packages, "") env["_ghc_package_opts"] = _ghc_package_opts env["HSC"] = "ghc" env["HSCFLAGS"] = [] env["HSLINKFLAGS"] = [] env["HSSEARCHPATH"] = [] env["HSPACKAGES"] = [] env["_HSPACKAGE_OPTS"] = "${_ghc_package_opts(HSPACKAGES)}" env["_HSSEARCHPATH_OPTS"] = "${_ghc_searchpath_opts(HSSEARCHPATH)}" ghc_scanner = Scanner(function=ghc_scanner_function, skeys=[".hs", ".lhs"], path_function=ghc_path_function) ghc_c_compiler = Builder(action="$HSC $HSCFLAGS -c -o $TARGET $SOURCE", src_suffix=[".c"], suffix=".o", single_source=True) ghc_compiler = Builder( action="$HSC $HSCFLAGS $_HSSEARCHPATH_OPTS -c -o $TARGET $SOURCE", src_suffix=[".hs", ".lhs"], suffix=".o", single_source=True, emitter=ghc_emitter, source_scanner=ghc_scanner) ghc_linker = Builder( action="$HSC $HSLINKFLAGS $_HSPACKAGE_OPTS -o $TARGET $SOURCES", src_suffix=".o", suffix="$PROGSUFFIX", src_builder=[ghc_compiler, ghc_c_compiler]) ghc_make = Builder( action="$HSC --make $HSCFLAGS $_HSSEARCHPATH_OPTS -o $TARGET $SOURCE", src_suffix=[".hs", ".lhs"], suffix="", single_source=True, emitter=ghc_make_emitter, source_scanner=ghc_scanner) env.Append( BUILDERS={ "HaskellProgram": ghc_linker, "HaskellObject": ghc_compiler, "HaskellMake": ghc_make })
def generate(env): def generate_so_name(target, source, env): source_dir = os.path.dirname(str(source[0])) cwd = os.getcwd() os.chdir(source_dir) if sys.platform == 'linux2': os.system("/sbin/ldconfig -n .") os.chdir(cwd) bld = Builder( action=Action(generate_so_name, "== Generating soname $TARGET")) env.Append(BUILDERS={'SonameLink': bld}) def generate_linker_name(target, source, env): source_file = os.path.basename(str(source[0])) os.system("ln -sf %s %s" % (source_file, str(target[0]))) bld = Builder(action=Action( generate_linker_name, "== Generating linker name $TARGET to $SOURCE")) env.Append(BUILDERS={'LinkerNameLink': bld}) import shutil bld = Builder(action=Action( lambda target, source, env: shutil.copy(str(source[0]), str(target[0]) ), "== Build copying $SOURCE")) env.Append(BUILDERS={'CopyFileAndUpdateIncludes': bld}) env.AddMethod(enable_modules, "EnableClamModules") env.AddMethod(ClamQuietCompilation) env.AddMethod(ClamModule) env.AddMethod(scanFiles) env.AddMethod(recursiveDirs) env.AddMethod(moveIntermediateInto) env.AddMethod(activateColorCommandLine)
def generate(env): env.Append(BUILDERS = {"aTar":Builder(action= " tar -f ${TARGET} $TARFLAGS .")}) env.Append(BUILDERS = {"aCopy":Builder(action= "if [ ! -f ${TARGET} ]; then cp -r ${SOURCE} ${TARGET}; fi")}) env.Append(BUILDERS = {"xLink":Builder(action= "cd ${LINK_DIR}; if [ -f ${TARGET_FILE} ]; then rm ${TARGET_FILE};fi; ln -s ${SOURCE_FILE} ${TARGET_FILE}; cd -")}) env.Append(BUILDERS = {"installToPackage" : installToPackage}) env.Append(BUILDERS = {"installDependLibrary" : installDependLibrary}) env.Append(BUILDERS = {"package" : package})
def generate(env): try: env["MSGFMT"] except KeyError: env["XGETTEXT"] = WhereIs("xgettext") or 'xgettext' env["MSGFMT"] = WhereIs("msgfmt") msgfmt = Builder(action = "$MSGFMT -c --statistics -o $TARGET $SOURCE", src_suffix = ".po", suffix = ".mo", single_source = True) env["BUILDERS"]["Msgfmt"] = msgfmt env["MSGMERGE"] = WhereIs("msgmerge") or 'msgmerge' msgmerge = Builder(action = "$MSGMERGE $TARGET $SOURCE -o $TARGET", src_suffix = ".pot", suffix = ".po", single_source = True) env["BUILDERS"]["MsgMerge"] = msgmerge env["MSGINIT"] = WhereIs("msginit") or 'msginit' msginit = Builder(action = "$MSGINIT -i $SOURCE -o $TARGET --no-translator", src_suffix = ".pot", suffix = ".po", single_source = True) env["BUILDERS"]["MsgInit"] = msginit def MsgInitMerge(env, target, source): #print target[0].path, os.path.exists(target[0].abspath) if os.path.exists(target[0].abspath): return env.MsgMerge(target, source) else: return env.MsgInit(target, source) env["BUILDERS"]["MsgInitMerge"] = MsgInitMerge
def GridBuilder( env, **args ): #action=None, generator=None, emitter=None, chdir=None, **args): action = args.get("action", None) queue = env["GPU_QUEUE"] if env.get("USE_GPU", False) else env["CPU_QUEUE"] resources = env["GPU_RESOURCES"] if env.get( "USE_GPU", False) else env["CPU_RESOURCES"] generator = args.get("generator", None) emitter = args.get("emitter", None) chdir = args.get("chdir", None) if action: if isinstance(action, str) or isinstance(action, list) and all( [isinstance(a, str) for a in action]): generator = lambda target, source, env, for_signature: action else: raise Exception( "Only simple string actions (and lists of them) are supported!" ) def command_printer(target, source, env): command = generator(target, source, env, False) return ("Grid(command={}, queue={}, resources={}, chdir='{}')" if env["USE_GRID"] else "Local(command={0})").format( env.subst(command, target=target, source=source), queue, resources, chdir, ) def grid_method(target, source, env): command = generator(target, source, env, False) if chdir: nchdir = env.Dir(chdir).abspath else: nchdir = None depends_on = set( filter(lambda x: x != None, [s.GetTag("built_by_job") for s in source])) command = env.subst(command, source=source, target=target) job_id = qsub( command, args.get("GRID_LABEL", env.get("GRID_LABEL", "steamroller")), "{}.qout".format(target[0].abspath), depends_on, resources, nchdir, queue, ) for t in target: t.Tag("built_by_job", job_id) logging.info("Job %d depends on %s", job_id, depends_on) return None return Builder(action=Action( grid_method, command_printer, name="steamroller"), emitter=emitter) if env["USE_GRID"] else Builder(**args)
def generateDocs(env, doC=False, doCPP=False, doJava=False, javaDir=''): """Generate and install generated documentation (doxygen & javadoc).""" if doC: # Function that does the documentation creation def docGeneratorC(target, source, env): cmd = 'doxygen doc/doxygen/DoxyfileC' pipe = Popen(cmd, shell=True, env={ "TOPLEVEL": "./" }, stdout=PIPE).stdout return # Doc files builders docBuildC = Builder(action=docGeneratorC) env.Append(BUILDERS={'DocGenC': docBuildC}) # Generate documentation env.Alias( 'doc', env.DocGenC(target=['#/doc/doxygen/C/html/index.html'], source=scanFiles("src/libsrc", accept=["*.[ch]"]))) if doCPP: def docGeneratorCC(target, source, env): cmd = 'doxygen doc/doxygen/DoxyfileCC' pipe = Popen(cmd, shell=True, env={ "TOPLEVEL": "./" }, stdout=PIPE).stdout return docBuildCC = Builder(action=docGeneratorCC) env.Append(BUILDERS={'DocGenCC': docBuildCC}) env.Alias( 'doc', env.DocGenCC(target=['#/doc/doxygen/CC/html/index.html'], source=scanFiles("src/libsrc++", accept=["*.[ch]", "*.cc", "*.hxx"]))) if doJava: def docGeneratorJava(target, source, env): cmd = 'ant javadoc' output = os.popen(cmd).read() return docBuildJava = Builder(action=docGeneratorJava) env.Append(BUILDERS={'DocGenJava': docBuildJava}) env.Alias( 'doc', env.DocGenJava(target=['#/doc/javadoc/index.html'], source=scanFiles(javaDir, accept=["*.java"]))) return 1
def generate(env): """Add Builders and construction variables for running unit tests.""" try: # it may be defined already builder = env['BUILDERS']['UnitTest'] except KeyError: env['BUILDERS']['UnitTest'] = Builder(action=_unitTest(), suffix='.utest') env['BUILDERS']['UnitTestCheck'] = Builder(action=_unitTestCheck()) env['UNIT_TESTS_FAILED'] = []
def generate(env): configOpencvBuilder = Builder(emitter=config_opencv_emitter, generator=config_opencv_generator) env.Append(BUILDERS={'configOpencv': configOpencvBuilder}) thirdpartyOpencvBuilder = Builder(emitter=thirdparty_opencv_emitter, generator=thirdparty_opencv_generator) env.Append(BUILDERS={'thirdpartyOpencv': thirdpartyOpencvBuilder}) openclOpencvBuilder = Builder(emitter=opencl_opencv_emitter, generator=opencl_opencv_generator) env.Append(BUILDERS={'openclOpencv': openclOpencvBuilder}) opencvBuilder = Builder(emitter=build_opencv_emitter, generator=build_opencv_generator) env.Append(BUILDERS={'buildOpencv': opencvBuilder})
def generate(env): env.AppendENVPath("PATH", join(env["gettextdir"], "bin")) env["MSGFMT"] = WhereIs("msgfmt") msgfmt = Builder( action = "$MSGFMT --check-domain --statistics -o $TARGET $SOURCE", src_suffix = ".po", suffix = ".mo", single_source = True ) env["BUILDERS"]["Msgfmt"] = msgfmt env["MSGMERGE"] = WhereIs("msgmerge") msgmerge = Builder( action = "$MSGMERGE --backup=none --previous -U $TARGET $SOURCE", src_suffix = ".pot", suffix = ".po", single_source = True ) env["BUILDERS"]["MsgMerge"] = msgmerge env["MSGINIT"] = WhereIs("msginit") msginit = Builder( action = "$MSGINIT -i $SOURCE -o $TARGET -l $MSGINIT_LINGUA --no-translator", src_suffix = ".pot", suffix = ".po", single_source = True ) env["BUILDERS"]["MsgInit"] = msginit env["ENV"]["LANG"] = os.environ.get("LANG") env["MSGINIT_LINGUA"] = "C" def MsgInitMerge(env, target, source, **kw): if os.path.exists(target + ".po"): return env.MsgMerge(target, source, **kw) else: return env.MsgInit(target, source, **kw) env.AddMethod(MsgInitMerge) env["PO4A_GETTEXTIZE"] = WhereIs("po4a-gettextize") po4a_gettextize = Builder( action = "$PO4A_GETTEXTIZE -f $PO4A_FORMAT ${''.join([' -m ' + str(source) for source in SOURCES])} -p $TARGET", ) env["BUILDERS"]["Po4aGettextize"] = po4a_gettextize env["PO4A_TRANSLATE"] = WhereIs("po4a-translate") po4a_translate = Builder( action = "$PO4A_TRANSLATE -f $PO4A_FORMAT -L $PO4A_CHARSET -m ${SOURCES[0]} -p ${SOURCES[1]} -l $TARGET" ) env["BUILDERS"]["Po4aTranslate"] = po4a_translate
def generate(env, **kw): subst_builder = Builder(action=Action( subst_build_function, "Substituting in $TARGET from $SOURCE"), emitter=subst_emitter, src_suffix='.in', single_source=True) env['BUILDERS']['Substitute'] = subst_builder
def add_builders(env): def unity_emitter(target, source, env): assert (len(source) == 1) assert (len(target) == 1) file = str(target[0]) target = list() target.append(file + '_Runner.c') return target, source def unity_generator(source, target, env, for_signature): assert (len(source) == 1) assert (len(target) == 1) result = 'ruby ' result += os.path.join(os.path.dirname(__file__), 'unity', 'auto', 'generate_test_runner.rb') result += ' {} {}'.format(str(source[0]), str(target[0])) return result env.Append( BUILDERS={ 'Unity': Builder(generator=unity_generator, emitter=unity_emitter, src_suffix='.c'), })
def generate(env): p = os.popen(str(env.File('#util/git_version.sh'))) env['VERSION'] = p.read().strip() if p.close(): sys.exit('Failed to detect git version') env.AddMethod(VersionH) env['BUILDERS']['WriteVersionH'] = Builder(action=version_h)
def add_builders(env): def cmock_emitter(target, source, env): print(target) target = list() for s in source: file = os.path.basename(str(s)) file_name, ext = os.path.splitext(file) target.append('cmock_' + file_name + '.c') target.append('cmock_' + file_name + '.h') return target, source def cmock_generator(source, target, env, for_signature): result = 'ruby ' result += os.path.join(os.path.dirname(__file__), 'cmock', 'lib', 'cmock.rb') result += ' ' result += ' '.join([str(s) for s in source]) result += ' --mock_path={}'.format(os.path.dirname(str(target[0]))) result += ' --plugins=return_thru_ptr;ignore_arg;ignore;callback;array' result += ' --mock_prefix="cmock_"' return result env.Append( BUILDERS={ 'CMock': Builder(generator=cmock_generator, emitter=cmock_emitter, src_suffix='.h'), })
def add_builders(env): env.Append(BUILDERS={ 'Elf2Hex': Builder( action = "$OBJCOPY --i32 $SOURCE -o $TARGET", suffix = env['HEXSUFFIX'], src_suffix = env['PROGSUFFIX']) })
def generate(env): if env.WhereIs("yui-compressor"): action = "yui-compressor -o $TARGET $SOURCE" else: action = Copy("$TARGET", "$SOURCE") bld = Builder(action=action, suffix=".min.css", src_suffix=".css") env.Append(BUILDERS={"MinifyCSS": bld})
def generate(env): env['CC'] = env.WhereIs('arm-none-eabi-gcc', os.environ['PATH']) env['AS'] = env.WhereIs('arm-none-eabi-as', os.environ['PATH']) env['OBJCOPY'] = env.WhereIs('arm-none-eabi-objcopy', os.environ['PATH']) env['OBJDUMP'] = env.WhereIs('arm-none-eabi-objdump', os.environ['PATH']) env['GDB'] = env.WhereIs('arm-none-eabi-gdb', os.environ['PATH']) env.AddMethod(SetARMFlags) env.AddMethod(EmbeddedProgram) env.AddMethod(CopyObject) env.AddMethod(GDBInstall) env.AddMethod(Globs) env['BUILDERS']['Objcopy'] = Builder( action='$OBJCOPY $COPYFLAGS $SOURCE $TARGET') env['BUILDERS']['Objdump'] = Builder( action='$OBJDUMP $DUMPFLAGS $SOURCE > $TARGET')
def setup(env) : env["LIBRARIES"] = [] env["DRIVERS"] = [] env["SERVERS"] = [] env["SYS_APPS"] = [] # setup compiler executables # TODO: the x86_64 part is still hardcoded ... toolchain = _get_toolchain_path(env) env["CC"] = "%s/bin/x86_64-pc-urubu-gcc" % toolchain env["CXX"] = "%s/bin/x86_64-pc-urubu-g++" % toolchain env["LD"] = "%s/bin/x86_64-pc-urubu-ld" % toolchain # customize the generated output of builders env["ASPPCOMSTR"] = " [AS] $SOURCE" env["CCCOMSTR"] = " [CC] $SOURCE" env["CXXCOMSTR"] = " [C++] $SOURCE" env["LINKCOMSTR"] = " [LD] $TARGET" env["ARCOMSTR"] = " [AR] $TARGET" env["RANLIBCOMSTR"] = " [RL] $TARGET" env["CPCOMSTR"] = " [CP] $SOURCE -> $TARGET" env["SCGENCOMSTR"] = " [GEN] $TARGET" env["ISOCOMSTR"] = " [ISO] $TARGET" # insall custom builders env["BUILDERS"]["ISO"] = Builder( action = Action(isobuilder._iso_builder, env["ISOCOMSTR"]), emitter = isobuilder._iso_emitter )
def generate(env): from SCons.Builder import Builder env.Append( BUILDERS={ 'BuildSphinx': Builder(action='sphinx-build -b html doc/source doc/build/html', ) })
def generateTarFile(env, baseName, majorVersion, minorVersion): """Generate a gzipped tar file of the current directory.""" # Function that does the tar. Note that tar on Solaris is different # (more primitive) than tar on Linux and MacOS. Solaris tar has no -z option # and the exclude file does not allow wildcards. Thus, stick to Linux for # creating the tar file. def tarballer(target, source, env): dirname = os.path.basename(os.path.abspath('.')) cmd = 'tar -X tar/tarexclude -C .. -c -z -f ' + str( target[0]) + ' ./' + dirname pipe = Popen(cmd, shell=True, stdin=PIPE).stdout return pipe # name of tarfile (software package dependent) tarfile = 'tar/' + baseName + '-' + majorVersion + '.' + minorVersion + '.tgz' # Use a Builder instead of env.Tar() since I can't make that work. # It runs into circular dependencies since we copy tar file to local # ./tar directory tarBuild = Builder(action=tarballer) env.Append(BUILDERS={'Tarball': tarBuild}) env.Alias('tar', env.Tarball(target=tarfile, source=None)) return 1
def generate(env): env.SetDefault(MAX_NGRAM=4, ) for name, command in [ ("GetCount", "python -m steamroller.tools.count --input ${SOURCES[0]} --output ${TARGETS[0]}" ), ("CreateSplit", "python -m steamroller.tools.split --total_file ${SOURCES[0]} --training_size ${TRAINING_SIZE} --testing_size ${TESTING_SIZE} --train ${TARGETS[0]} --test ${TARGETS[1]}" ), ("NoSplit", "python -m steamroller.tools.nosplit -i ${SOURCES[0]} -o ${TARGETS[0]}" ), ("Accuracy", "python -m steamroller.metrics.accuracy -o ${TARGETS[0]} ${SOURCES}"), ("FScore", "python -m steamroller.metrics.fscore -o ${TARGETS[0]} ${SOURCES}"), ("CollateResources", "python -m steamroller.tools.resources -o ${TARGETS[0]} -s ${STAGE} ${SOURCES}" ), ("CombineCSVs", "python -m steamroller.tools.combine_csvs -o ${TARGETS[0]} ${SOURCES}" ), ("ModelSizes", "python -m steamroller.tools.model_sizes -o ${TARGETS[0]} ${SOURCES}" ), ("Plot", "python -m steamroller.plots.${TYPE} --output ${TARGETS[0]} --x ${X} --y ${Y} --xlabel \"${XLABEL}\" --ylabel \"${YLABEL}\" --title \"'${TITLE}'\" --input ${SOURCES[0]} --color \"${COLOR}\" --color_label \"'${COLOR_LABEL}'\"" ), ]: env["BUILDERS"][name] = make_builder(env, command, name) for model in env["MODELS"]: if not model.get("DISABLED", False): env["BUILDERS"]["Train{}".format(model["NAME"])] = make_builder( env, model["TRAIN_COMMAND"], "Train{}".format(model["NAME"])) env["BUILDERS"]["Apply{}".format(model["NAME"])] = make_builder( env, model["APPLY_COMMAND"], "Apply{}".format(model["NAME"])) def wait_for_grid(target, source, env): while True: p = subprocess.Popen(["qstat"], stdout=subprocess.PIPE) out, err = p.communicate() lines = out.strip().split("\n") if len(lines) < 2: break else: counts = {} for line in [l for l in lines if l.startswith(" ")]: toks = line.strip().split() counts[toks[4][0]] = counts.get(toks[4][0], 0) + 1 logging.info("Running: %d Waiting: %d Held: %d", counts.get("r", 0), counts.get("w", 0), counts.get("h", 0)) time.sleep(env["GRID_CHECK_INTERVAL"]) return None env["BUILDERS"]["WaitForGrid"] = Builder(action=wait_for_grid)
def generate(env): """Setup the our custom tools""" indent = _find_indent() # In order to pass the indent function to the generator and only execute _find_indent # once, we create a lambda function to wrap our own that takes indent as argument. pp_generator = lambda source, target, env, for_signature: _pp_gen(source, target, env, # noqa indent) # noqa # Only handle C for now preprocess = Builder(generator=pp_generator, emitter=_preprocess_emitter) # Workaround for SCons issue #2757. Avoid using Configure for internal headers check_header = Builder(action='$CCCOM', emitter=_ch_emitter) env.Append(BUILDERS={"Preprocess": preprocess}) env.Append(BUILDERS={"CheckHeader": check_header})
def generate(env): "Add RPCGEN Builders and construction variables for an Environment." client = Builder(action=rpcgen_client, suffix='_clnt.c', src_suffix='.x') header = Builder(action=rpcgen_header, suffix='.h', src_suffix='.x') service = Builder(action=rpcgen_service, suffix='_svc.c', src_suffix='.x') xdr = Builder(action=rpcgen_xdr, suffix='_xdr.c', src_suffix='.x') env.Append(BUILDERS={'RPCGenClient' : client, 'RPCGenHeader' : header, 'RPCGenService' : service, 'RPCGenXDR' : xdr}) env['RPCGEN'] = 'rpcgen' env['RPCGENFLAGS'] = SCons.Util.CLVar('') env['RPCGENCLIENTFLAGS'] = SCons.Util.CLVar('') env['RPCGENHEADERFLAGS'] = SCons.Util.CLVar('') env['RPCGENSERVICEFLAGS'] = SCons.Util.CLVar('') env['RPCGENXDRFLAGS'] = SCons.Util.CLVar('')
def generate(env): env['UGLIFYJS'] = env.File( os.path.join(os.path.dirname(__file__), '..', 'node_modules', 'uglify-js', 'bin', 'uglifyjs')) env['UGLIFYJSFLAGS'] = [] env['BUILDERS']['UglifyJS'] = Builder( action= '$NODEJS $NODEJSFLAGS $UGLIFYJS $SOURCES -o $TARGET $UGLIFYJSFLAGS')
def generate(env): env.SetDefault(CLANG='clang', CLANGXX='clang++', LLVM_DIS='llvm-dis', LLVM_OPT='opt', LLVM_LINK='llvm-link') env['BUILDERS']['LLVMDis'] = Builder( action='${LLVM_ROOT}/$LLVM_DIS -o=$TARGET $SOURCE') env['BUILDERS']['LLVMOpt'] = Builder( action= '${LLVM_ROOT}/$LLVM_OPT $LLVM_OPT_FLAGS $LLVM_OPT_PASSES -o=$TARGET $SOURCE' ) env['BUILDERS']['LLVMLink'] = Builder( action='${LLVM_ROOT}/$LLVM_LINK -o=$TARGET $SOURCES', emitter=add_libraries)
def generate(env): if env.WhereIs("uglifyjs"): action = "uglifyjs --no-copyright --output $TARGET $SOURCE" elif env.WhereIs("yui-compressor"): action = "yui-compressor -o $TARGET $SOURCE" else: action = Copy("$TARGET", "$SOURCE") bld = Builder(action = action, suffix = ".min.js", src_suffix = ".js") env.Append(BUILDERS = { "MinifyJS": bld })
def ThriftSconsEnvFunc(env, async): opath = env.Dir('.').abspath thriftcmd = env.Dir(env['TOP_BIN']).abspath + '/thrift' if async: lstr = thriftcmd + ' --gen cpp:async -o ' + opath + ' $SOURCE' else: lstr = thriftcmd + ' --gen cpp -o ' + opath + ' $SOURCE' cppbuild = Builder(action=lstr) env.Append(BUILDERS={'ThriftCpp': cppbuild})
def generate(env): import SCons.Tool.install install_sandbox = env.GetOption('install_sandbox') if install_sandbox: target_factory = SCons.Tool.install.DESTDIR_factory( env, install_sandbox).Entry else: target_factory = env.fs.Entry env.Append(BUILDERS=dict( SonameLink=Builder(action=Action( "/sbin/ldconfig -n ${SOURCE.dir}", "== Generating soname $TARGET", ), ), LinkerNameLink=Builder( action=Action( 'ln -sf ${SOURCE.name} ${TARGET} ', # generate_linker_name, "== Generating linker name $TARGET to $SOURCE", ), ), InstallLink=Builder( action=Action( 'ln -sf ${SOURCE.name} ${TARGET} ', "== Installing link $TARGET to $SOURCE", ), target_factory=target_factory, emitter=[ SCons.Tool.install.add_targets_to_INSTALLED_FILES, ], ))) import shutil bld = Builder(action=Action( lambda target, source, env: shutil.copy(str(source[0]), str(target[0]) ), "== Build copying $SOURCE")) env.Append(BUILDERS={'CopyFileAndUpdateIncludes': bld}) env.AddMethod(enable_modules, "EnableClamModules") env.AddMethod(ClamQuietCompilation) env.AddMethod(ClamModule) env.AddMethod(scanFiles) env.AddMethod(recursiveDirs) env.AddMethod(moveIntermediateInto) env.AddMethod(activateColorCommandLine)
def generate(env): env['RUSTC'] = _detect(env) env['RUSTCFLAGS'] = [] rust_cargo_builder = Builder( action='"$RUSTC" $RUSTCFLAGS -o $TARGET $SOURCE', suffix='$PROGSUFFIX', src_suffix='.rs', emitter=rustc_emitter, ) env.Append(BUILDERS={'rustc': rust_cargo_builder})