aboutsummaryrefslogtreecommitdiffstats
path: root/tools/ninja/Makefile
diff options
context:
space:
mode:
authorFelix Fietkau <nbd@nbd.name>2021-06-06 14:31:01 +0200
committerFelix Fietkau <nbd@nbd.name>2021-06-12 10:46:39 +0200
commit97258f53634d7237a2962aec3387f011047ce83b (patch)
tree24966f800bdf95b4f3ef3126772f5017c78c0c2e /tools/ninja/Makefile
parenta85aaa1bc299301ad741b6ef94d7580c9095f1be (diff)
downloadupstream-97258f53634d7237a2962aec3387f011047ce83b.tar.gz
upstream-97258f53634d7237a2962aec3387f011047ce83b.tar.bz2
upstream-97258f53634d7237a2962aec3387f011047ce83b.zip
build: add ninja build tool and make it available for cmake
ninja is faster at building cmake packages than make, and according to reports also more reliable at handling parallel builds This commit includes a patch that adds GNU make jobserver support, in order to allow more precise control over the number of parallel tasks Enable parallel build by default for packages using ninja Signed-off-by: Felix Fietkau <nbd@nbd.name> Signed-off-by: Rosen Penev <rosenp@gmail.com>
Diffstat (limited to 'tools/ninja/Makefile')
-rw-r--r--tools/ninja/Makefile39
1 files changed, 39 insertions, 0 deletions
diff --git a/tools/ninja/Makefile b/tools/ninja/Makefile
new file mode 100644
index 0000000000..3cbd6aebba
--- /dev/null
+++ b/tools/ninja/Makefile
@@ -0,0 +1,39 @@
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=ninja
+PKG_VERSION:=1.10.2
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=https://codeload.github.com/ninja-build/ninja/tar.gz/v$(PKG_VERSION)?
+PKG_HASH:=ce35865411f0490368a8fc383f29071de6690cbadc27704734978221f25e2bed
+
+include $(INCLUDE_DIR)/host-build.mk
+
+CONFIGURE_ARGS:=
+ifneq ($(findstring c,$(OPENWRT_VERBOSE)),)
+ CONFIGURE_ARGS+=--verbose
+endif
+
+define Host/Configure
+endef
+
+define Host/Compile
+ cd $(HOST_BUILD_DIR) && \
+ CXX="$(HOSTCXX)" \
+ CXXFLAGS="$(HOST_CXXFLAGS) $(HOST_CPPFLAGS)" \
+ LDFLAGS="$(HOST_LDFLAGS)" \
+ $(STAGING_DIR_HOST)/bin/$(PYTHON) configure.py --bootstrap $(CONFIGURE_ARGS)
+endef
+
+define Host/Install
+ $(INSTALL_DIR) $(STAGING_DIR_HOST)/bin
+ $(INSTALL_BIN) $(HOST_BUILD_DIR)/ninja $(STAGING_DIR_HOST)/bin/
+endef
+
+define Host/Clean
+ $(call Host/Clean/Default)
+ rm -f $(STAGING_DIR_HOST)/bin/ninja
+endef
+
+$(eval $(call HostBuild))