On 2018/05/01 00:10, Brian Callahan wrote:
> Hi ports --
> 
> Attached is a new port, devel/samurai. Samurai is a ninja-compatible build
> tool written in C.
> 
> ---
> pkg/DESCR:
> samurai is a ninja-compatible build tool written in C99 with a focus on
> simplicity, speed, and portability.
> 
> samurai implements the ninja build language through version 1.8.2. It
> uses the same format for .ninja_log and .ninja_deps as ninja, currently
> version 5 and 3 respectively.
> 
> It is largely feature-complete and supports most of the same options as
> ninja.
> ---
> 
> Samurai can be used as a drop-in replacement for Ninja with CMake. Notably,
> samurai does not do the random build order thing that ninja does, but
> samurai has built everything I have thrown at it without issue. To make
> testing easy, I'm including a patch for cmake.port.mk -- then all you have
> to do is go to a port that uses cmake and add USE_SAMURAI=Yes to the port
> Makefile. Note that I am not seriously proposing to commit the cmake.port.mk
> change, unless people think that it'd be useful to have a backup to ninja.
> 
> OK?
> 
> ~Brian
> 


Here's an updated tgz for samurai 0.4, which has a proper tarball,
changelog is as follows:

New features

- Add support for --version option for compatibility with existing
higher-level build tools like cmake and meson.

- Now builds on macOS, which does not support the POSIX O_DIRECTORY or
st_mtim member of struct stat.

- Better messages from -d explain for missing/invalid dependencies or
build log entry.

Bug fixes

- Generator action with no entry in build log was incorrectly considered
dirty, causing a re-run of the ninja generation (cmake, meson, etc) on
the first build.

- Avoid large stack allocations during .ninja_deps processing and when
user specified a large maximum number of jobs.

- Fix -k maxfail handling when multiple jobs fail at the same time
(regression in 0.3).

Cleanups

- Prefer C99 functions/types over POSIX in some cases.

- Store modification time internally as int64_t for compatibility with
future ninja release and to avoid struct timespec requirement.

- Remove redundant call to stat when recording dependencies.

- Mark lexing keyword table as const to move to read-only section of
executable.


And here's a simpler cmake.port.mk diff using "USE_NINJA=samurai"
rather than a separate variable (though I am rather tempted to just
switch the cmake module to using samurai if it works in bulk build,
diffable build logs is a BIG improvement).

Index: cmake.port.mk
===================================================================
RCS file: /cvs/ports/devel/cmake/cmake.port.mk,v
retrieving revision 1.63
diff -u -p -r1.63 cmake.port.mk
--- cmake.port.mk       26 Jan 2018 13:11:14 -0000      1.63
+++ cmake.port.mk       10 Sep 2018 19:03:50 -0000
@@ -16,9 +16,16 @@ USE_NINJA = No
 
 .if ${USE_NINJA:L} == "yes"
 BUILD_DEPENDS += devel/ninja>=1.5.1
-_MODCMAKE_GEN = Ninja
 NINJA ?= ninja
 NINJA_FLAGS ?= -v -j ${MAKE_JOBS}
+.elif ${USE_NINJA:L} == "samurai"
+BUILD_DEPENDS += devel/samurai
+NINJA ?= samu
+NINJA_FLAGS ?= -v -j ${MAKE_JOBS}
+.endif
+
+.if ${USE_NINJA:L} == "yes" || ${USE_NINJA:L} == "samurai"
+_MODCMAKE_GEN = Ninja
 MODCMAKE_BUILD_TARGET = cd ${WRKBUILD} && exec ${SETENV} ${MAKE_ENV} \
        ${NINJA} ${NINJA_FLAGS} ${ALL_TARGET}
 MODCMAKE_INSTALL_TARGET = cd ${WRKBUILD} && exec ${SETENV} ${MAKE_ENV} \

Attachment: samu.tgz
Description: Binary data

Reply via email to