pkgsrc-Bugs archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
pkg/55027: Samurai as ninja-build alternative system-wide
>Number: 55027
>Category: pkg
>Synopsis: Samurai as ninja-build alternative system-wide
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: pkg-manager
>State: open
>Class: change-request
>Submitter-Id: net
>Arrival-Date: Thu Feb 27 20:05:00 +0000 2020
>Originator: Denys Nykula
>Release: current
>Organization:
>Environment:
Linux e11 5.5.0-rc3 #1 SMP Thu Dec 26 01:45:51 UTC 2019 x86_64
>Description:
>How-To-Repeat:
>Fix:
From 193a530962afa6b072486ee6cd8d6d1f090c772a Mon Sep 17 00:00:00 2001
From: Denys Nykula <nykula%ukr.net@localhost>
Date: Wed, 26 Feb 2020 23:47:42 +0200
Subject: [PATCH] Samurai as ninja-build alternative system-wide
Samurai implements ninja language without depending on either cmake or
python, or other packages such as re2c. It's 4k lines of C and Makefile,
as opposed to 18k lines of C++ and Python according to codetabs, so
builds slightly faster. When you have samurai you don't require to have
ninja-build installed, and vice versa. User should be able to choose
samu as the global ninja implementation while bootstrapping pkgsrc, by
mentioning NINJA_BUILD=samu in their mk.conf fragment.
---
diff --git a/devel/meson/Makefile b/devel/meson/Makefile
index 336572a..f572d68 100644
--- a/devel/meson/Makefile
+++ b/devel/meson/Makefile
@@ -12,7 +12,7 @@ LICENSE= apache-2.0
CONFLICTS= ${PYPKGPREFIX}-meson-[0-9]*
SUPERSEDES= ${PYPKGPREFIX}-meson-[0-9]*
-DEPENDS+= ninja-build-[0-9]*:../../devel/ninja-build
+.include "../../devel/ninja-build/depends.mk"
PYTHON_VERSIONS_INCOMPATIBLE= 27
diff --git a/devel/ninja-build/build.mk b/devel/ninja-build/build.mk
new file mode 100644
index 0000000..ce5179d
--- /dev/null
+++ b/devel/ninja-build/build.mk
@@ -0,0 +1,26 @@
+# $NetBSD$
+#
+# This mk fragment can be included by all packages that need ninja as a build
+# dependency (e.g. for gnuradio).
+#
+# User-settable variables:
+#
+# NINJA_BUILD
+# Type of used ninja-build implementation.
+#
+# Possible values: ninja samu
+# Default: ninja
+#
+
+.if !defined(NINJA_BUILD_MK)
+NINJA_BUILD_MK= defined
+
+.include "../../mk/bsd.prefs.mk"
+
+.if ${NINJA_BUILD} == "samu"
+BUILD_DEPENDS+= samurai-[0-9]*:../../devel/samurai
+.else
+BUILD_DEPENDS+= ninja-build-[0-9]*:../../devel/ninja-build
+.endif
+
+.endif # NINJA_BUILD_MK
diff --git a/devel/ninja-build/depends.mk b/devel/ninja-build/depends.mk
new file mode 100644
index 0000000..5cc5e7d
--- /dev/null
+++ b/devel/ninja-build/depends.mk
@@ -0,0 +1,26 @@
+# $NetBSD$
+#
+# This mk fragment can be included by all packages that need ninja as a
+# dependency (e.g. for meson).
+#
+# User-settable variables:
+#
+# NINJA_BUILD
+# Type of used ninja-build implementation.
+#
+# Possible values: ninja samu
+# Default: ninja
+#
+
+.if !defined(NINJA_DEPENDS_MK)
+NINJA_DEPENDS_MK= defined
+
+.include "../../mk/bsd.prefs.mk"
+
+.if ${NINJA_BUILD} == "samu"
+DEPENDS+= samurai-[0-9]*:../../devel/samurai
+.else
+DEPENDS+= ninja-build-[0-9]*:../../devel/ninja-build
+.endif
+
+.endif # NINJA_DEPENDS_MK
diff --git a/devel/samurai/Makefile b/devel/samurai/Makefile
index e01301f..e879b7c 100644
--- a/devel/samurai/Makefile
+++ b/devel/samurai/Makefile
@@ -14,4 +14,12 @@ BUILD_TARGET= samu
MAKE_FLAGS+= PREFIX=${PREFIX}
MAKE_FLAGS+= MANDIR=${PREFIX}/${PKGMANDIR}
+PLIST_VARS+= ninja
+.include "../../mk/bsd.prefs.mk"
+.if ${NINJA_BUILD} == "samu"
+PLIST.ninja= yes
+post-install:
+ ${LN} -s samu ${DESTDIR}${PREFIX}/bin/ninja
+.endif
+
.include "../../mk/bsd.pkg.mk"
diff --git a/devel/samurai/PLIST b/devel/samurai/PLIST
index 9ee7f36..cdbd25c 100644
--- a/devel/samurai/PLIST
+++ b/devel/samurai/PLIST
@@ -1,3 +1,4 @@
@comment $NetBSD: PLIST,v 1.1 2019/12/11 23:36:29 ng0 Exp $
+${PLIST.ninja}bin/ninja
bin/samu
man/man1/samu.1
diff --git a/finance/gnucash/Makefile b/finance/gnucash/Makefile
index 3c7db7a..98bd39e 100644
--- a/finance/gnucash/Makefile
+++ b/finance/gnucash/Makefile
@@ -44,7 +44,7 @@ CMAKE_ARGS+= -DWITH_AQBANKING=OFF
CMAKE_ARGS+= -DPERL_EXECUTABLE=${PERL5}
CMAKE_ARGS+= -DCOMPILE_GSCHEMAS=OFF
#CMAKE_ARGS+= -GNinja
-#BUILD_DEPENDS+= ninja-build-[0-9]*:../../devel/ninja-build
+#.include "../../devel/ninja-build/build.mk"
#do-build:
# cd ${WRKSRC}; ${SETENV} ${MAKE_ENV} ninja
diff --git a/ham/gnuradio-core/options.mk b/ham/gnuradio-core/options.mk
index 0237c34..83b424e 100644
--- a/ham/gnuradio-core/options.mk
+++ b/ham/gnuradio-core/options.mk
@@ -16,7 +16,7 @@ PKG_SUGGESTED_OPTIONS= filter-design
.if !empty(PKG_OPTIONS:Mninja-build)
CMAKE_ARGS+= -GNinja
-BUILD_DEPENDS+= ninja-build-[0-9]*:../../devel/ninja-build
+.include "../../devel/ninja-build/build.mk"
do-build:
(cd ${WRKSRC}/build; ninja)
diff --git a/mk/defaults/mk.conf b/mk/defaults/mk.conf
index 78807fe..c73beb1 100644
--- a/mk/defaults/mk.conf
+++ b/mk/defaults/mk.conf
@@ -1470,6 +1470,12 @@ NBPAX_PROGRAM_PREFIX?= nb
# Possible: any string, leave it empty for no prefix at all
# Default: nb
+NINJA_BUILD?= ninja
+# devel/samurai implements most features of devel/ninja-build
+# without depending on either c++ or python, and is smaller.
+# Possible: ninja or samu.
+# Default: ninja
+
NMH_EDITOR?= vi
# default editor for use in nmh.
# Possible: any editor.
Home |
Main Index |
Thread Index |
Old Index