pkgsrc-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: pkg/55027 (Samurai as ninja-build alternative system-wide)



The following reply was made to PR pkg/55027; it has been noted by GNATS.

From: Denys Nykula <nykula%ukr.net@localhost>
To: gnats-bugs%netbsd.org@localhost
Cc: 
Subject: Re: pkg/55027 (Samurai as ninja-build alternative system-wide)
Date: Sat, 29 Feb 2020 00:43:30 +0200

 On Thu, 27 Feb 2020 13:08:41 -0800, Michael Forney wrote:
 > I've been using the following patch to make the ninja command
 > selectable via TOOLS_PLATFORM.ninja, so I can use my system version of
 > samu:
 > https://github.com/oasislinux/pkgsrc/commit/7627f6ef0760d04efde48930981f67c86caba1f2.patch
 > 
 > Is it possible to integrate your patch with the TOOLS framework
 > somehow, so that it can use the system version of ninja or samurai (if
 > they are available)?
 
 Please review if the following patch v2 works for your system.
 ---
 From d65d1e395af4983ee237be6aeddceb4e18bfad73 Mon Sep 17 00:00:00 2001
 From: Denys Nykula <nykula%ukr.net@localhost>
 Date: Sat, 29 Feb 2020 00:09:46 +0200
 Subject: [PATCH v2] samurai: 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.
 
 Following Michael Forney's suggestion, switched to the TOOLS framework,
 which removes the need for build.mk and depends.mk and also lets you opt
 out of building either samurai or ninja-build in favor of the host ninja
 implementation, using a TOOLS_PLATFORM.ninja=/usr/bin/ninja setting.
 ---
 diff --git a/devel/meson/Makefile b/devel/meson/Makefile
 index 336572a9d..0d661e633 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
 +USE_TOOLS+=	ninja:run
 
  PYTHON_VERSIONS_INCOMPATIBLE=	27
 
 diff --git a/devel/meson/build.mk b/devel/meson/build.mk
 index f50a38830..4e0b19b7c 100644
 --- a/devel/meson/build.mk
 +++ b/devel/meson/build.mk
 @@ -1,6 +1,7 @@
  # $NetBSD: build.mk,v 1.5 2020/02/25 04:54:35 rillig Exp $
 
  BUILD_DEPENDS+=        meson-[0-9]*:../../devel/meson
 +USE_TOOLS+=    ninja
 
  CONFIGURE_DIRS?=       .
  BUILD_DIRS?=           ${CONFIGURE_DIRS}
 diff --git a/devel/samurai/Makefile b/devel/samurai/Makefile
 index e01301fe9..37c50bf24 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 9ee7f3604..cdbd25cd2 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 3c7db7a29..30a173bbf 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
 +#USE_TOOLS+=		ninja
 
  #do-build:
  #	cd ${WRKSRC}; ${SETENV} ${MAKE_ENV} ninja
 diff --git a/ham/gnuradio-core/options.mk b/ham/gnuradio-core/options.mk
 index 0237c3418..3758d3fa0 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
 +USE_TOOLS+=	ninja
 
  do-build:
  	(cd ${WRKSRC}/build; ninja)
 diff --git a/mk/defaults/mk.conf b/mk/defaults/mk.conf
 index 78807fe0f..e32866e62 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 cmake or python.
 +# Possible: ninja or samu.
 +# Default: ninja
 +
  NMH_EDITOR?= vi
  # default editor for use in nmh.
  # Possible: any editor.
 diff --git a/mk/tools/replace.mk b/mk/tools/replace.mk
 index 8d1986ec4..98f0d9b6c 100644
 --- a/mk/tools/replace.mk
 +++ b/mk/tools/replace.mk
 @@ -619,6 +619,20 @@ TOOLS_PATH.mtree=		${LOCALBASE}/bin/mtree
  .  endif
  .endif
 
 +.if !defined(TOOLS_IGNORE.ninja) && !empty(_USE_TOOLS:Mninja)
 +.  if !empty(PKGPATH:Mdevel/ninja-build)
 +MAKEFLAGS+=			TOOLS_IGNORE.ninja=
 +.  elif !empty(_TOOLS_USE_PKGSRC.ninja:M[yY][eE][sS])
 +TOOLS_CREATE+=			ninja
 +TOOLS_PATH.ninja=		${LOCALBASE}/bin/ninja
 +.    if !empty(NINJA_BUILD:Msamu)
 +TOOLS_DEPENDS.ninja?=		samurai-[0-9]*:../../devel/samurai
 +.    else
 +TOOLS_DEPENDS.ninja?=		ninja-build-[0-9]*:../../devel/ninja-build
 +.    endif
 +.  endif
 +.endif
 +
  .if !defined(TOOLS_IGNORE.openssl) && !empty(_USE_TOOLS:Mopenssl)
  #
  # Ensure we use pkgsrc openssl if we're not using builtin.
 


Home | Main Index | Thread Index | Old Index