samurai

用 C 语言编写的与 ninja 兼容的构建工具。「ninja-compatible build tool written in C」

samurai

builds.sr.ht status
GitHub build status

samurai is a ninja-compatible build tool written in C99 with a focus on
simplicity, speed, and portability.

Status

samurai implements the ninja build language through version 1.9.0 except
for MSVC dependency handling (deps = msvc). It uses the same format
for .ninja_log and .ninja_deps as ninja, currently version 5 and 4
respectively.

It is feature-complete and supports most of the same options as ninja.

Requirements

samurai requires various POSIX.1-2008 interfaces.

Scheduling jobs based on load average requires the non-standard
getloadavg function. This feature can be enabled by defining
HAVE_GETLOADAVG in your CFLAGS, along with any other necessary
definitions for your platform.

Differences from ninja

samurai tries to match ninja behavior as much as possible, but there
are several cases where it is slightly different:

  • samurai uses the variable lookup order documented in the ninja manual,
    while ninja has a quirk (ninja-build/ninja#1516) that if the build
    edge has no variable bindings, the variable is looked up in file scope
    before the rule-level variables.
  • samurai schedules jobs using a stack, so the last scheduled job is
    the first to execute, while ninja schedules jobs based on the pointer
    value of the edge structure (they are stored in a std::set<Edge*>),
    so the first to execute depends on the address returned by malloc.
    This may result in build failures due to insufficiently specified
    dependencies in the project's build system.
  • samurai does not post-process the job output in any way, so if it
    includes escape sequences they will be preserved, while ninja strips
    escape sequences if standard output is not a terminal. Some build
    systems, like meson, force color output from gcc by default using
    -fdiagnostics-color=always, so if you plan to save the output to a
    log, you should pass -Db_colorout=auto to meson.
  • samurai follows the POSIX Utility Syntax Guidelines, in particular
    guideline 9, so it requires that any command-line options precede
    the operands. It does not do GNU-style argument permutation.

主要指标

概览
名称与所有者michaelforney/samurai
主编程语言C
编程语言 (语言数: 3)
平台
许可证Other
所有者活动
创建于2017-07-15 23:17:43
推送于2025-03-03 20:27:58
最后一次提交2025-03-03 12:27:25
发布数10
最新版本名称1.2 (发布于 2020-12-16 17:50:37)
第一版名称0.1 (发布于 2017-08-19 19:14:14)
用户参与
星数0.9k
关注者数28
派生数56
提交数363
已启用问题?
问题数70
打开的问题数25
拉请求数6
打开的拉请求数7
关闭的拉请求数35
项目设置
已启用Wiki?
已存档?
是复刻?
已锁定?
是镜像?
是私有?