# # Also, note that the link phase accepts only *one* input, which is the "main" package. The linker # will automatically link imported packages. However, it again needs the GoPackage extension in # order to ensure proper build order and import paths. # # Take a look at the generated "build.ninja" for details. # from ronin.cli import cli from ronin.contexts import new_context from ronin.go import GoCompile, GoLink, GoPackage from ronin.phases import Phase from ronin.projects import Project from ronin.utils.paths import glob with new_context() as ctx: project = Project('Go Example') extensions = [GoPackage(project, 'compile_functions')] # Compile main package Phase(project=project, name='compile_main', executor=GoCompile(), inputs=glob('src/main.go'), extensions=extensions, output='main') # Compile functions package Phase(project=project,
# This adds on build2.py by explicitly configuring the utilities (the values are all identical to # the default), just to show you what is possible at its most verbose. # from ronin.cli import cli from ronin.contexts import new_context from ronin.gcc import configure_gcc, GccCompile, GccLink from ronin.phases import Phase from ronin.pkg_config import configure_pkg_config, Package from ronin.projects import Project from ronin.ninja import configure_ninja from ronin.utils.paths import base_path, glob with new_context(root_path=base_path(__file__), input_path_relative=None, output_path_relative='build3', binary_path_relative='bin', object_path_relative='obj', source_path_relative='src') as ctx: configure_ninja(ninja_command='ninja', encoding='utf8', file_name='build', columns=100, strict=False) configure_gcc(gcc_command='gcc', ccache=True, ccache_path='/usr/lib/ccache') configure_pkg_config(pkg_config_command='pkg-config', pkg_config_path=None)
# The compile/link phases are more straightforward, though note that behind the scenes we are using # pkg_config.Package to translate the Vala package into a library that gcc can use. In most cases # the name of the Vala package is specifically made to be the same as what is used in # pkg_config.Package, but we've seen quite a few exceptions in the wild. Check the documentation for # ValaPackage to make sure you configure your packages correctly for four-phase builds. # from ronin.cli import cli from ronin.contexts import new_context from ronin.gcc import GccLink from ronin.phases import Phase from ronin.projects import Project from ronin.vala import ValaApi, ValaTranspile, ValaGccCompile, ValaPackage from ronin.utils.paths import glob with new_context(output_path_relative='build2') as ctx: project = Project('Vala GTK+ Hello World') inputs = glob('src/**/*.vala') extensions = [ValaPackage('gtk+-3.0')] # API executor = ValaApi() executor.enable_deprecated() Phase(project=project, name='api', executor=ValaApi(), inputs=inputs) # Transpile Phase(project=project, name='transpile', executor=ValaTranspile(apis=['api']),
# Build executor = ValaBuild() executor.enable_threads() executor.enable_experimental() executor.enable_deprecated() executor.target_glib('2.32') Phase(project=project, name='build', executor=executor, inputs=inputs, extensions=extensions, output=name) return project with new_context() as ctx: dependencies = Dependencies() khovsgold_inputs = \ glob_src('src/server/**') + \ glob('src/version.gs') + \ glob('src/models.gs') + \ glob('src/iterators.gs') + \ glob('src/utilities.gs') + \ glob_src('src/lib/logging/**') + \ glob_src('src/lib/console/**') + \ glob_src('src/lib/nap/**') + \ glob_src('src/lib/json/**') + \ glob_src('src/lib/avahi/**') + \ glob_src('src/lib/sqlite/**') + \ glob_src('src/lib/gstreamer/**') + \