Message ID | 20220112132618.2634250-3-aperez@igalia.com |
---|---|
State | Superseded |
Headers | show |
Series | Use Ninja as build tool for CMake-based packages | expand |
Hello, On Wed, 12 Jan 2022 15:26:18 +0200 Adrian Perez de Castro <aperez@igalia.com> wrote: > 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> > --- > 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 This means an audit of all cmake-package packages need to be done to see if any of those variables is used. I could spot: MUSEPACK_MAKE = $(MAKE1) But also: HOST_MARIADB_MAKE_OPTS = import_executables Best regards, Thomas
Hi, On Wed, 12 Jan 2022 15:35:16 +0100 Thomas Petazzoni <thomas.petazzoni@bootlin.com> wrote: > On Wed, 12 Jan 2022 15:26:18 +0200 > Adrian Perez de Castro <aperez@igalia.com> wrote: > > > 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> > > --- > > 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 > > This means an audit of all cmake-package packages need to be done to > see if any of those variables is used. I will be going through the packages in the next days, for now a couple of notes on the ones you mentioned already, below. > I could spot: > > MUSEPACK_MAKE = $(MAKE1) I fixed this locally using: MUSEPACK_NINJA_OPTS = -j1 Sadly, switching to Ninja does not fix parallel builds for this package. > But also: > > HOST_MARIADB_MAKE_OPTS = import_executables Replacing with the following works, because the CMake Ninja generator also produces top-level phony targets: HOST_MARIADB_NINJA_OPTS = import_executables Both these tweaks (and likely a bunch more) will be part of v2 of the patch set :) Cheers, —Adrián
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
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> --- package/pkg-cmake.mk | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-)