Monday, April 30, 2018

NEW: devel/samurai

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 1 May 2018 03:51:27 -0000
@@ -8,12 +8,17 @@ MAKE_ENV+=LIB${_n}_VERSION=${_v}
.endfor

USE_NINJA ?= Yes
+USE_SAMURAI ?= No

# XXX: Ninja is broken on m88k
.if ${MACHINE_ARCH} == "m88k"
USE_NINJA = No
.endif

+.if ${USE_SAMURAI:L} == "yes"
+USE_NINJA = No
+.endif
+
.if ${USE_NINJA:L} == "yes"
BUILD_DEPENDS += devel/ninja>=1.5.1
_MODCMAKE_GEN = Ninja
@@ -25,6 +30,34 @@ MODCMAKE_INSTALL_TARGET = cd ${WRKBUILD}
${FAKE_SETUP} ${NINJA} ${NINJA_FLAGS} ${FAKE_TARGET}
MODCMAKE_TEST_TARGET = cd ${WRKBUILD} && exec ${SETENV} ${ALL_TEST_ENV} \
${NINJA} ${NINJA_FLAGS} ${TEST_FLAGS} ${TEST_TARGET}
+
+.if !target(do-build)
+do-build:
+ @${MODCMAKE_BUILD_TARGET}
+.endif
+
+.if !target(do-install)
+do-install:
+ @${MODCMAKE_INSTALL_TARGET}
+.endif
+
+.if !target(do-test)
+do-test:
+ @${MODCMAKE_TEST_TARGET}
+.endif
+
+.elif ${USE_SAMURAI:L} == "yes"
+BUILD_DEPENDS += devel/samurai
+_MODCMAKE_GEN = Ninja
+SAMURAI ?= samu
+SAMURAI_FLAGS ?= -v -j ${MAKE_JOBS}
+CONFIGURE_ARGS += -DCMAKE_MAKE_PROGRAM:String=${SAMURAI}
+MODCMAKE_BUILD_TARGET = cd ${WRKBUILD} && exec ${SETENV} ${MAKE_ENV} \
+ ${SAMURAI} ${SAMURAI_FLAGS} ${ALL_TARGET}
+MODCMAKE_INSTALL_TARGET = cd ${WRKBUILD} && exec ${SETENV} ${MAKE_ENV} \
+ ${FAKE_SETUP} ${SAMURAI} ${SAMURAI_FLAGS} ${FAKE_TARGET}
+MODCMAKE_TEST_TARGET = cd ${WRKBUILD} && exec ${SETENV} ${ALL_TEST_ENV} \
+ ${SAMURAI} ${SAMURAI_FLAGS} ${TEST_FLAGS} ${TEST_TARGET}

.if !target(do-build)
do-build:
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

No comments:

Post a Comment