diff --git a/Mk/Uses/ninja.mk b/Mk/Uses/ninja.mk --- a/Mk/Uses/ninja.mk +++ b/Mk/Uses/ninja.mk @@ -2,18 +2,19 @@ # # Feature: ninja # Usage: USES=ninja -# Valid ARGS: build, make (default), run +# Valid ARGS: build, make (default), run, samurai # # build add a build dependency on ninja # make use ninja for the build instead of make, implies "build" # run add a run dependency on ninja +# samurai use samurai irregardless of NINJA_DEFAULT # # MAINTAINER: ports@FreeBSD.org .if !defined(_INCLUDE_USES_NINJA_MK) _INCLUDE_USES_NINJA_MK= yes -_valid_ARGS= build make run +_valid_ARGS= build make run samurai . for _arg in ${ninja_ARGS} . if empty(_valid_ARGS:M${_arg}) @@ -21,7 +22,7 @@ . endif . endfor -. if empty(ninja_ARGS) +. if empty(ninja_ARGS) || ${ninja_ARGS:M*samurai*} ninja_ARGS+= make . endif @@ -29,12 +30,14 @@ ninja_ARGS+= build . endif -. if ${NINJA_DEFAULT} == ninja +. if ${NINJA_DEFAULT} == ninja && (${ninja_ARGS:M*samurai*} == "") NINJA_CMD= ninja _NINJA_PORT= devel/ninja -. elif ${NINJA_DEFAULT} == samurai +. elif ${NINJA_DEFAULT} == samurai || ${ninja_ARGS:M*samurai*} NINJA_CMD= samu +. if ${NINJA_DEFAULT} == samurai _NINJA_PORT= devel/samurai +. endif MAKE_ENV+= SAMUFLAGS="-v -j${MAKE_JOBS_NUMBER}" . if ${ninja_ARGS:Mbuild} && !${BINARY_ALIAS:U:Mninja=*} # Cmake and Meson have native support for Samurai and detect and @@ -48,15 +51,17 @@ IGNORE= invalid DEFAULT_VERSIONS+=ninja=${NINJA_DEFAULT} . endif -. if ${ninja_ARGS:Mbuild} +. if ${ninja_ARGS:Mbuild} && (${ninja_ARGS:M*samurai*} == "") BUILD_DEPENDS+= ${NINJA_CMD}:${_NINJA_PORT} +. elif ${ninja_ARGS:M*samurai*} +BUILD_DEPENDS+= samu:devel/samurai +. endif # Humanize build log and include percentage of completed jobs %p in it. # See samu(1) or the Ninja manual. MAKE_ENV+= NINJA_STATUS="[%p %s/%t] " -. endif . if ${ninja_ARGS:Mmake} -. if ${NINJA_DEFAULT} == ninja +. if ${NINJA_DEFAULT} == ninja && (${ninja_ARGS:M*samurai*} == "") # samu does not support GNU-style args, so we cannot just append # -v last. samu gets this via SAMUFLAGS above but ninja does not # support an equivalent environment variable. @@ -71,7 +76,7 @@ _DESTDIR_VIA_ENV= yes . endif -. if ${ninja_ARGS:Mrun} +. if ${ninja_ARGS:Mrun} && (${ninja_ARGS:M*samurai*} == "") RUN_DEPENDS+= ${NINJA_CMD}:${_NINJA_PORT} . endif