def config_host(ctx, build): ctx.logger.log('configuring host phase', color='cyan') platform = call('fbuild.builders.platform.guess_platform', ctx, ctx.options.build_platform) if platform == build.platform: ctx.logger.log("using build's c and cxx compiler", color='cyan') phase = build else: phase = Record( ctx=ctx, platform=platform, c=make_c_builder(ctx, exe=fbuild.builders.host_cc, platform=platform, debug=ctx.options.debug or ctx.options.host_c_debug, optimize=not (ctx.options.debug or ctx.options.host_c_debug), includes=ctx.options.host_includes, libpaths=ctx.options.host_libpaths, flags=ctx.options.host_c_flags), cxx=make_cxx_builder(ctx, exe=fbuild.builders.host_cxx, platform=platform, debug=ctx.options.debug or ctx.options.host_c_debug, optimize=not (ctx.options.debug or ctx.options.host_c_debug), includes=ctx.options.host_includes, libpaths=ctx.options.host_libpaths, flags=ctx.options.host_cxx_flags)) phase.ocaml = call('fbuild.builders.ocaml.Ocaml', ctx, debug=ctx.options.debug or ctx.options.host_ocaml_debug, ocamlc=ctx.options.host_ocamlc, ocamlopt=ctx.options.host_ocamlopt, flags=['-w', 'yzex', '-warn-error', 'FPSU'], linker=phase.c.static.lib_linker, requires_at_least_version=(3, 11)) phase.ocamllex = call('fbuild.builders.ocaml.Ocamllex', ctx, ctx.options.host_ocamllex) # we prefer the native ocaml as it's much faster if hasattr(phase.ocaml, 'ocamlopt'): phase.ocaml = phase.ocaml.ocamlopt else: phase.ocaml = phase.ocaml.ocamlc # We optionally support llvm try: llvm_config = call('fbuild.builders.llvm.LlvmConfig', ctx, ctx.options.host_llvm_config, requires_at_least_version=(2, 7)) except fbuild.ConfigFailed: phase.llvm_config = None else: if llvm_config.ocaml_libdir().exists(): #phase.llvm_config = llvm_config phase.llvm_config = None else: phase.llvm_config = None return phase
def config_host(ctx, build, *, platform, cc, cxx, ocamlc, ocamlopt, ocamllex, ocamlyacc): ctx.logger.log('configuring host phase', color='cyan') platform = call('fbuild.builders.platform.guess_platform', ctx, platform) if platform == build.platform: ctx.logger.log("using build's c and cxx compiler") phase = build else: phase = Record( platform=platform, c=make_c_builder(ctx, exe=cc), cxx=make_cxx_builder(ctx, exe=cxx)) phase.ocaml = call('fbuild.builders.ocaml.Ocaml', ctx, ocamlc=ocamlc, ocamlopt=ocamlopt, ) phase.ocamllex = call('fbuild.builders.ocaml.Ocamllex', ctx, ocamllex) phase.ocamlyacc = call('fbuild.builders.ocaml.Ocamlyacc', ctx, ocamlyacc) return phase
def config_host(ctx, build): ctx.logger.log('configuring host phase', color='cyan') platform = call('fbuild.builders.platform.platform', ctx, ctx.options.build_platform) if platform == build.platform: ctx.logger.log("using build's c and cxx compiler", color='cyan') phase = build else: phase = Record( ctx=ctx, platform=platform, c=make_c_builder(ctx, fbuild.builders.host_cc, platform=platform, debug=ctx.options.debug or ctx.options.host_c_debug, profile=ctx.options.profile or ctx.options.host_c_profile, optimize=ctx.options.optimize or ctx.options.host_c_optimize, includes=ctx.options.host_includes, libpaths=ctx.options.host_libpaths, flags=ctx.options.host_c_flags), cxx=make_cxx_builder(ctx, fbuild.buildesr.host_cxx, platform=platform, debug=ctx.options.debug or ctx.options.host_c_debug, profile=ctx.options.profile or ctx.options.host_c_profile, optimize=ctx.options.optimize or ctx.options.host_c_optimize, includes=ctx.options.host_includes, libpaths=ctx.options.host_libpaths, flags=ctx.options.host_c_flags)) ocaml = call('fbuild.builders.ocaml.ocamlfind.Ocaml', ctx, debug=ctx.options.debug or ctx.options.host_ocaml_debug, profile=ctx.options.profile or ctx.options.host_ocaml_profile, ocamlc=ctx.options.host_ocamlc, ocamlcp=ctx.options.host_ocamlcp, ocamlopt=ctx.options.host_ocamlopt, flags=['-w', 'exYz', '-warn-error', 'FDPSU'], requires_at_least_version=(3, 12)) phase.ocamlc = ocaml.ocamlc phase.ocamlcp = ocaml.ocamlcp phase.ocamlopt = ocaml.ocamlopt phase.ocamllex = call('fbuild.builders.ocaml.Ocamllex', ctx, ctx.options.host_ocamllex) # we prefer the native ocaml as it's much faster if not ctx.options.host_use_ocamlc and hasattr(ocaml, 'ocamlopt'): phase.ocaml = phase.ocamlopt elif ctx.options.profile or ctx.options.host_ocaml_profile: phase.ocaml = phase.ocamlcp else: phase.ocaml = phase.ocamlc # We optionally support llvm try: llvm_config = call('fbuild.builders.llvm.LlvmConfig', ctx, ctx.options.host_llvm_config, requires_at_least_version=(2, '7')) except fbuild.ConfigFailed: phase.llvm_config = None else: if llvm_config.ocaml_libdir().exists(): phase.llvm_config = llvm_config else: phase.llvm_config = None return phase