From 54449e9c6689b17379c24ca68f52a80ec5688f22 Mon Sep 17 00:00:00 2001 From: Rosen Penev Date: Mon, 7 Sep 2020 13:37:25 -0700 Subject: [PATCH] ninja: use for CMake CMake supports Ninja for faster compilation and less bugginess when it comes to parallel compilation. That is, some CMake packages currently have PKG_BUILD_PARALLEL set where it is not needed with ninja. Signed-off-by: Rosen Penev --- devel/ninja/Makefile | 2 +- devel/ninja/ninja-cmake.mk | 25 +++++++++++++++++++++++++ devel/ninja/ninja.mk | 3 +++ 3 files changed, 29 insertions(+), 1 deletion(-) create mode 100644 devel/ninja/ninja-cmake.mk diff --git a/devel/ninja/Makefile b/devel/ninja/Makefile index 73a162fa1..08ab50ff5 100644 --- a/devel/ninja/Makefile +++ b/devel/ninja/Makefile @@ -2,7 +2,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=ninja PKG_VERSION:=1.10.1 -PKG_RELEASE:=1 +PKG_RELEASE:=2 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_SOURCE_URL:=https://codeload.github.com/ninja-build/ninja/tar.gz/v$(PKG_VERSION)? diff --git a/devel/ninja/ninja-cmake.mk b/devel/ninja/ninja-cmake.mk new file mode 100644 index 000000000..3dc7debfb --- /dev/null +++ b/devel/ninja/ninja-cmake.mk @@ -0,0 +1,25 @@ +include $(INCLUDE_DIR)/cmake.mk +include ../../devel/ninja/ninja.mk + +CMAKE_HOST_OPTIONS += -DCMAKE_GENERATOR="Ninja" +CMAKE_OPTIONS += -DCMAKE_GENERATOR="Ninja" + +define Host/Compile/Default + $(call Ninja,-C $(HOST_BUILD_DIR)/$(CMAKE_BINARY_SUBDIR),) +endef + +define Host/Install/Default + $(call Ninja,-C $(HOST_BUILD_DIR)/$(CMAKE_BINARY_SUBDIR) install,DESTDIR="$(HOST_INSTALL_DIR)") +endef + +define Host/Uninstall/Default + -$(call Ninja,-C $(HOST_BUILD_DIR)/$(CMAKE_BINARY_SUBDIR) uninstall,) +endef + +define Build/Compile/Default + $(call Ninja,-C $(PKG_BUILD_DIR)/$(CMAKE_BINARY_SUBDIR),) +endef + +define Build/Install/Default + $(call Ninja,-C $(PKG_BUILD_DIR)/$(CMAKE_BINARY_SUBDIR) install,DESTDIR="$(PKG_INSTALL_DIR)") +endef diff --git a/devel/ninja/ninja.mk b/devel/ninja/ninja.mk index 66554764e..ef6a04a64 100644 --- a/devel/ninja/ninja.mk +++ b/devel/ninja/ninja.mk @@ -6,6 +6,9 @@ # $(call Ninja,-C $(MY_NINJA_BUILD_DIR),$(MY_NINJA_ENV_VARS)) # endef +HOST_BUILD_DEPENDS += ninka/host +PKG_BUILD_DEPENDS += ninja/host + NINJA_ARGS:=$(filter -j%,$(filter-out -j,$(MAKEFLAGS))) ifneq ($(findstring c,$(OPENWRT_VERBOSE)),) NINJA_ARGS+=-v