diff mbox series

[RFC,1/2] package/ninja: do not require cmake

Message ID 20220112132618.2634250-2-aperez@igalia.com
State Superseded
Headers show
Series Use Ninja as build tool for CMake-based packages | expand

Commit Message

Adrian Perez de Castro Jan. 12, 2022, 1:26 p.m. UTC
Use host-generic-package to manually build ninja. This avoids the need
for host-cmake in preparation for the CMake build system machinery being
changed to use ninja instead of make.

Signed-off-by: Adrian Perez de Castro <aperez@igalia.com>
---
 package/ninja/ninja.mk | 36 +++++++++++++++++++++++++++++++++++-
 1 file changed, 35 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/package/ninja/ninja.mk b/package/ninja/ninja.mk
index ab1941023e..ae3be6a14f 100644
--- a/package/ninja/ninja.mk
+++ b/package/ninja/ninja.mk
@@ -9,8 +9,42 @@  NINJA_SITE = $(call github,ninja-build,ninja,v$(NINJA_VERSION))
 NINJA_LICENSE = Apache-2.0
 NINJA_LICENSE_FILES = COPYING
 
+# Ninja is used by CMake-based packages, avoid a circular dependency by
+# by using host-generic-package instead and using a single command to
+# compile the binary. This does in essence the same as the "bootstrap.py"
+# included in the distribution avoiding the need for host-python.
+define HOST_NINJA_BUILD_CMDS
+	cd $(@D) && $(HOSTCXX) $(HOST_CXXFLAGS) $(HOST_LDFLAGS) \
+		src/build_log.cc \
+		src/build.cc \
+		src/clean.cc \
+		src/clparser.cc \
+		src/dyndep.cc \
+		src/dyndep_parser.cc \
+		src/debug_flags.cc \
+		src/deps_log.cc \
+		src/disk_interface.cc \
+		src/edit_distance.cc \
+		src/eval_env.cc \
+		src/graph.cc \
+		src/graphviz.cc \
+		src/line_printer.cc \
+		src/manifest_parser.cc \
+		src/metrics.cc \
+		src/parser.cc \
+		src/state.cc \
+		src/string_piece_util.cc \
+		src/util.cc \
+		src/version.cc \
+		src/depfile_parser.cc \
+		src/lexer.cc \
+		src/subprocess-posix.cc \
+		src/ninja.cc \
+		-o ninja
+endef
+
 define HOST_NINJA_INSTALL_CMDS
 	$(INSTALL) -m 0755 -D $(@D)/ninja $(HOST_DIR)/bin/ninja
 endef
 
-$(eval $(host-cmake-package))
+$(eval $(host-generic-package))