Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Adrian Perez de Castro <aperez@igalia.com>
To: buildroot@buildroot.org
Cc: Eric Le Bihan <eric.le.bihan.dev@free.fr>,
	Pierre Ducroquet <pinaraf@pinaraf.info>,
	Samuel Martin <s.martin49@gmail.com>,
	Peter Seiderer <ps.report@gmx.net>,
	Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Subject: [Buildroot] [PATCH RFC v2 2/7] package/pkg-cmake.mk: use ninja instead of make
Date: Fri, 21 Jan 2022 17:42:30 +0200	[thread overview]
Message-ID: <20220121154235.798255-3-aperez@igalia.com> (raw)
In-Reply-To: <20220121154235.798255-1-aperez@igalia.com>

Switch to ninja as the build tool for the CMake package infrastructure.
Note that the changes make packages which use [host-]cmake-package
depend on host-ninja.

Signed-off-by: Adrian Perez de Castro <aperez@igalia.com>
---
Changes v1 -> v2:
  - No changes.
---
 package/pkg-cmake.mk | 24 ++++++++++++++----------
 1 file changed, 14 insertions(+), 10 deletions(-)

diff --git a/package/pkg-cmake.mk b/package/pkg-cmake.mk
index 3b1db35fb6..65f005a914 100644
--- a/package/pkg-cmake.mk
+++ b/package/pkg-cmake.mk
@@ -51,11 +51,6 @@ endif
 
 define inner-cmake-package
 
-$(2)_MAKE			?= $$(MAKE)
-$(2)_INSTALL_OPTS		?= install
-$(2)_INSTALL_STAGING_OPTS	?= DESTDIR=$$(STAGING_DIR) install/fast
-$(2)_INSTALL_TARGET_OPTS	?= DESTDIR=$$(TARGET_DIR) install/fast
-
 $(3)_SUPPORTS_IN_SOURCE_BUILD ?= YES
 
 
@@ -88,6 +83,7 @@ define $(2)_CONFIGURE_CMDS
 	rm -f CMakeCache.txt && \
 	PATH=$$(BR_PATH) \
 	$$($$(PKG)_CONF_ENV) $$(BR2_CMAKE) $$($$(PKG)_SRCDIR) \
+		-GNinja \
 		-DCMAKE_TOOLCHAIN_FILE="$$(HOST_DIR)/share/buildroot/toolchainfile.cmake" \
 		-DCMAKE_INSTALL_PREFIX="/usr" \
 		-DCMAKE_COLOR_MAKEFILE=OFF \
@@ -117,6 +113,7 @@ define $(2)_CONFIGURE_CMDS
 	PKG_CONFIG_ALLOW_SYSTEM_CFLAGS=1 \
 	PKG_CONFIG_ALLOW_SYSTEM_LIBS=1 \
 	$$($$(PKG)_CONF_ENV) $$(BR2_CMAKE) $$($$(PKG)_SRCDIR) \
+		-GNinja \
 		-DCMAKE_INSTALL_SO_NO_EXE=0 \
 		-DCMAKE_FIND_ROOT_PATH="$$(HOST_DIR)" \
 		-DCMAKE_FIND_ROOT_PATH_MODE_PROGRAM="BOTH" \
@@ -154,6 +151,8 @@ endif
 # primitives to find {C,LD}FLAGS, add it to the dependency list.
 $(2)_DEPENDENCIES += host-pkgconf
 
+$(2)_DEPENDENCIES += host-ninja
+
 $(2)_DEPENDENCIES += $(BR2_CMAKE_HOST_DEPENDENCY)
 
 #
@@ -163,11 +162,13 @@ $(2)_DEPENDENCIES += $(BR2_CMAKE_HOST_DEPENDENCY)
 ifndef $(2)_BUILD_CMDS
 ifeq ($(4),target)
 define $(2)_BUILD_CMDS
-	$$(TARGET_MAKE_ENV) $$($$(PKG)_MAKE_ENV) $$($$(PKG)_MAKE) $$($$(PKG)_MAKE_OPTS) -C $$($$(PKG)_BUILDDIR)
+	$$(TARGET_MAKE_ENV) $$($$(PKG)_NINJA_ENV) \
+		$$(NINJA) $$(NINJA_OPTS) $$($$(PKG)_NINJA_OPTS) -C $$($$(PKG)_BUILDDIR)
 endef
 else
 define $(2)_BUILD_CMDS
-	$$(HOST_MAKE_ENV) $$($$(PKG)_MAKE_ENV) $$($$(PKG)_MAKE) $$($$(PKG)_MAKE_OPTS) -C $$($$(PKG)_BUILDDIR)
+	$$(HOST_MAKE_ENV) $$($$(PKG)_NINJA_ENV) \
+		$$(NINJA) $$(NINJA_OPTS) $$($$(PKG)_NINJA_OPTS) -C $$($$(PKG)_BUILDDIR)
 endef
 endif
 endif
@@ -178,7 +179,8 @@ endif
 #
 ifndef $(2)_INSTALL_CMDS
 define $(2)_INSTALL_CMDS
-	$$(HOST_MAKE_ENV) $$($$(PKG)_MAKE_ENV) $$($$(PKG)_MAKE) $$($$(PKG)_MAKE_OPTS) $$($$(PKG)_INSTALL_OPTS) -C $$($$(PKG)_BUILDDIR)
+	$$(HOST_MAKE_ENV) $$($$(PKG)_NINJA_ENV) \
+		$$(NINJA) $$(NINJA_OPTS) -C $$($$(PKG)_BUILDDIR) install
 endef
 endif
 
@@ -188,7 +190,8 @@ endif
 #
 ifndef $(2)_INSTALL_STAGING_CMDS
 define $(2)_INSTALL_STAGING_CMDS
-	$$(TARGET_MAKE_ENV) $$($$(PKG)_MAKE_ENV) $$($$(PKG)_MAKE) $$($$(PKG)_MAKE_OPTS) $$($$(PKG)_INSTALL_STAGING_OPTS) -C $$($$(PKG)_BUILDDIR)
+	$$(TARGET_MAKE_ENV) $$($$(PKG)_NINJA_ENV) DESTDIR=$$(STAGING_DIR) \
+		$$(NINJA) $$(NINJA_OPTS) -C $$($$(PKG)_BUILDDIR) install
 endef
 endif
 
@@ -198,7 +201,8 @@ endif
 #
 ifndef $(2)_INSTALL_TARGET_CMDS
 define $(2)_INSTALL_TARGET_CMDS
-	$$(TARGET_MAKE_ENV) $$($$(PKG)_MAKE_ENV) $$($$(PKG)_MAKE) $$($$(PKG)_MAKE_OPTS) $$($$(PKG)_INSTALL_TARGET_OPTS) -C $$($$(PKG)_BUILDDIR)
+	$$(TARGET_MAKE_ENV) $$($$(PKG)_NINJA_ENV) DESTDIR=$$(TARGET_DIR) \
+		$$(NINJA) $$(NINJA_OPTS) -C $$($$(PKG)_BUILDDIR) install
 endef
 endif
 
-- 
2.34.1

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

  parent reply	other threads:[~2022-01-21 15:43 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-12 13:26 [Buildroot] [PATCH RFC 0/2] Use Ninja as build tool for CMake-based packages Adrian Perez de Castro
2022-01-12 13:26 ` [Buildroot] [PATCH RFC 1/2] package/ninja: do not require cmake Adrian Perez de Castro
2022-01-21 15:42   ` [Buildroot] [PATCH RFC v2 0/7] Use Ninja as build tool for CMake-based packages Adrian Perez de Castro
2022-01-21 15:42     ` [Buildroot] [PATCH RFC v2 1/7] package/ninja: do not require cmake Adrian Perez de Castro
2022-01-21 15:42     ` Adrian Perez de Castro [this message]
2022-07-24 13:16       ` [Buildroot] [PATCH RFC v2 2/7] package/pkg-cmake.mk: use ninja instead of make Arnout Vandecappelle
2022-01-21 15:42     ` [Buildroot] [PATCH RFC v2 3/7] package/musepack: use MUSEPACK_NINJA_OPTS Adrian Perez de Castro
2022-07-24 13:18       ` Arnout Vandecappelle
2022-01-21 15:42     ` [Buildroot] [PATCH RFC v2 4/7] package/mariadb: use HOST_MARIADB_NINJA_OPTS Adrian Perez de Castro
2022-01-21 15:42     ` [Buildroot] [PATCH RFC v2 5/7] package/kf5/kf5-extra-cmake-modules: do not build documentation Adrian Perez de Castro
2022-01-21 15:42     ` [Buildroot] [PATCH RFC v2 6/7] package/libcorrect: avoid multiple rules for same target Adrian Perez de Castro
2022-01-21 15:42     ` [Buildroot] [PATCH RFC v2 7/7] package/racehound: add patch to support building with ninja Adrian Perez de Castro
2022-01-21 15:53     ` [Buildroot] [PATCH RFC v2 0/7] Use Ninja as build tool for CMake-based packages Adrian Perez de Castro
2022-01-12 13:26 ` [Buildroot] [PATCH RFC 2/2] package/pkg-cmake.mk: use ninja instead of make Adrian Perez de Castro
2022-01-12 14:35   ` Thomas Petazzoni
2022-01-12 16:51     ` Adrian Perez de Castro
2022-01-12 14:36 ` [Buildroot] [PATCH RFC 0/2] Use Ninja as build tool for CMake-based packages Thomas Petazzoni
2022-01-12 15:09   ` Adrian Perez de Castro
2022-01-12 16:02     ` Thomas Petazzoni
2022-01-12 16:05 ` Alexander Dahl
2022-01-12 16:47   ` Adrian Perez de Castro
2022-01-12 18:55     ` Arnout Vandecappelle
2022-01-13 15:49       ` Thomas Petazzoni
2022-05-05 21:35         ` James Hilliard
2022-07-24 13:05 ` Arnout Vandecappelle

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220121154235.798255-3-aperez@igalia.com \
    --to=aperez@igalia.com \
    --cc=buildroot@buildroot.org \
    --cc=eric.le.bihan.dev@free.fr \
    --cc=pinaraf@pinaraf.info \
    --cc=ps.report@gmx.net \
    --cc=s.martin49@gmail.com \
    --cc=thomas.petazzoni@bootlin.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox