From 634360e75e3c821100f045ff3ec2a8cb3e58b88a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ole=20Andr=C3=A9=20Vadla=20Ravn=C3=A5s?= Date: Tue, 18 Jan 2022 20:29:32 +0100 Subject: [PATCH] build: Harmonize Ninja invocations - Use `meson install` where appropriate. - Rely on environment having ninja on its PATH. - Remove NINJA from config.mk. --- Makefile.freebsd.mk | 8 ++++---- Makefile.linux.mk | 26 +++++++++++++------------- Makefile.macos.mk | 30 +++++++++++++++--------------- Makefile.sdk.mk | 9 ++++++--- config.mk | 1 - 5 files changed, 38 insertions(+), 36 deletions(-) diff --git a/Makefile.freebsd.mk b/Makefile.freebsd.mk index 58d2d82631..d4088ccfd3 100644 --- a/Makefile.freebsd.mk +++ b/Makefile.freebsd.mk @@ -88,7 +88,7 @@ build/frida-%/libdata/pkgconfig/frida-gum-1.0.pc: build/frida-env-%.rc build/.fr $(frida_gum_flags) \ frida-gum $$builddir || exit 1; \ fi; \ - $(NINJA) -C $$builddir install || exit 1 + $(MESON) install -C $$builddir || exit 1 @touch -c $@ check-gum: gum ##@gum Run tests @@ -110,7 +110,7 @@ build/tmp-%/frida-core/.frida-ninja-stamp: build/.frida-core-submodule-stamp bui @touch $@ build/frida-%/libdata/pkgconfig/frida-core-1.0.pc: build/tmp-%/frida-core/.frida-ninja-stamp - . build/frida-meson-env-$*.rc && $(NINJA) -C build/tmp-$*/frida-core install + . build/frida-meson-env-$*.rc && $(MESON) install -C build/tmp-$*/frida-core @touch $@ check-core: core ##@core Run tests @@ -129,7 +129,7 @@ build/tmp-%/frida-$(PYTHON_NAME)/.frida-stamp: build/.frida-python-submodule-sta -Dpython=$(PYTHON) \ frida-python $$builddir || exit 1; \ fi; \ - $(NINJA) -C $$builddir install || exit 1; \ + $(MESON) install -C $$builddir || exit 1; \ $$STRIP $$STRIP_FLAGS build/frida-$*/lib/$(PYTHON_NAME)/site-packages/_frida.so @touch $@ @@ -183,7 +183,7 @@ build/tmp-%/frida-tools-$(PYTHON_NAME)/.frida-stamp: build/.frida-tools-submodul -Dpython=$(PYTHON) \ frida-tools $$builddir || exit 1; \ fi; \ - $(NINJA) -C $$builddir install || exit 1 + $(MESON) install -C $$builddir || exit 1 @touch $@ check-tools: build/tmp-freebsd-$(build_arch)/frida-tools-$(PYTHON_NAME)/.frida-stamp ##@tools Test CLI tools diff --git a/Makefile.linux.mk b/Makefile.linux.mk index 091a756525..534bacd459 100644 --- a/Makefile.linux.mk +++ b/Makefile.linux.mk @@ -112,7 +112,7 @@ build/$1-%/lib/pkgconfig/frida-gum-1.0.pc: build/$1-env-%.rc build/.frida-gum-su $$(frida_gum_flags) \ frida-gum $$$$builddir || exit 1; \ fi; \ - $$(NINJA) -C $$$$builddir install || exit 1 + $$(MESON) install -C $$$$builddir || exit 1 @touch -c $$@ endef $(eval $(call make-gum-rules,frida,tmp)) @@ -254,41 +254,41 @@ build/tmp_thin-%/frida-core/.frida-ninja-stamp: build/.frida-core-submodule-stam build/frida-linux-x86/lib/pkgconfig/frida-core-1.0.pc: build/tmp-linux-x86/frida-core/.frida-helper-and-agent-stamp @rm -f build/tmp-linux-x86/frida-core/src/frida-data-{helper,agent}* - . build/frida-meson-env-linux-x86.rc && $(NINJA) -C build/tmp-linux-x86/frida-core install + . build/frida-meson-env-linux-x86.rc && $(MESON) install -C build/tmp-linux-x86/frida-core @touch $@ build/frida-linux-x86_64/lib/pkgconfig/frida-core-1.0.pc: build/tmp-linux-x86/frida-core/.frida-helper-and-agent-stamp build/tmp-linux-x86_64/frida-core/.frida-helper-and-agent-stamp @rm -f build/tmp-linux-x86_64/frida-core/src/frida-data-{helper,agent}* - . build/frida-meson-env-linux-x86_64.rc && $(NINJA) -C build/tmp-linux-x86_64/frida-core install + . build/frida-meson-env-linux-x86_64.rc && $(MESON) install -C build/tmp-linux-x86_64/frida-core @touch $@ build/frida-android-x86/lib/pkgconfig/frida-core-1.0.pc: build/tmp-android-x86/frida-core/.frida-helper-and-agent-stamp build/tmp-android-arm/frida-core/.frida-agent-stamp @rm -f build/tmp-android-x86/frida-core/src/frida-data-{helper,agent}* - . build/frida-meson-env-android-x86.rc && $(NINJA) -C build/tmp-android-x86/frida-core install + . build/frida-meson-env-android-x86.rc && $(MESON) install -C build/tmp-android-x86/frida-core @touch $@ build/frida-android-x86_64/lib/pkgconfig/frida-core-1.0.pc: build/tmp-android-x86/frida-core/.frida-helper-and-agent-stamp build/tmp-android-x86_64/frida-core/.frida-helper-and-agent-stamp build/tmp-android-arm/frida-core/.frida-agent-stamp build/tmp-android-arm64/frida-core/.frida-agent-stamp @rm -f build/tmp-android-x86_64/frida-core/src/frida-data-{helper,agent}* - . build/frida-meson-env-android-x86_64.rc && $(NINJA) -C build/tmp-android-x86_64/frida-core install + . build/frida-meson-env-android-x86_64.rc && $(MESON) install -C build/tmp-android-x86_64/frida-core @touch $@ build/frida-android-arm/lib/pkgconfig/frida-core-1.0.pc: build/tmp-android-arm/frida-core/.frida-helper-and-agent-stamp @rm -f build/tmp-android-arm/frida-core/src/frida-data-{helper,agent}* - . build/frida-meson-env-android-arm.rc && $(NINJA) -C build/tmp-android-arm/frida-core install + . build/frida-meson-env-android-arm.rc && $(MESON) install -C build/tmp-android-arm/frida-core @touch $@ build/frida-android-armbe8/lib/pkgconfig/frida-core-1.0.pc: build/tmp-android-armbe8/frida-core/.frida-helper-and-agent-stamp @rm -f build/tmp-android-armbe8/frida-core/src/frida-data-{helper,agent}* - . build/frida-meson-env-android-armbe8.rc && $(NINJA) -C build/tmp-android-armbe8/frida-core install + . build/frida-meson-env-android-armbe8.rc && $(MESON) install -C build/tmp-android-armbe8/frida-core @touch $@ build/frida-android-arm64/lib/pkgconfig/frida-core-1.0.pc: build/tmp-android-arm/frida-core/.frida-helper-and-agent-stamp build/tmp-android-arm64/frida-core/.frida-helper-and-agent-stamp @rm -f build/tmp-android-arm64/frida-core/src/frida-data-{helper,agent}* - . build/frida-meson-env-android-arm64.rc && $(NINJA) -C build/tmp-android-arm64/frida-core install + . build/frida-meson-env-android-arm64.rc && $(MESON) install -C build/tmp-android-arm64/frida-core @touch $@ build/frida_thin-%/lib/pkgconfig/frida-core-1.0.pc: build/tmp_thin-%/frida-core/.frida-ninja-stamp - . build/frida_thin-meson-env-$*.rc && $(NINJA) -C build/tmp_thin-$*/frida-core install + . build/frida_thin-meson-env-$*.rc && $(MESON) install -C build/tmp_thin-$*/frida-core @touch $@ build/tmp-%/frida-core/.frida-helper-and-agent-stamp: build/tmp-%/frida-core/.frida-ninja-stamp - . build/frida-meson-env-$*.rc && $(NINJA) -C build/tmp-$*/frida-core src/frida-helper lib/agent/frida-agent.so + . build/frida-meson-env-$*.rc && ninja -C build/tmp-$*/frida-core src/frida-helper lib/agent/frida-agent.so @touch $@ build/tmp-%/frida-core/.frida-agent-stamp: build/tmp-%/frida-core/.frida-ninja-stamp - . build/frida-meson-env-$*.rc && $(NINJA) -C build/tmp-$*/frida-core lib/agent/frida-agent.so + . build/frida-meson-env-$*.rc && ninja -C build/tmp-$*/frida-core lib/agent/frida-agent.so @touch $@ check-core-linux-x86: core-linux-x86 ##@core Run tests for Linux/x86 @@ -325,7 +325,7 @@ build/$2-%/frida-$$(PYTHON_NAME)/.frida-stamp: build/.frida-python-submodule-sta -Dpython_incdir=$$(PYTHON_INCDIR) \ frida-python $$$$builddir || exit 1; \ fi; \ - $$(NINJA) -C $$$$builddir install || exit 1; \ + $$(MESON) install -C $$$$builddir || exit 1; \ $$$$STRIP $$$$STRIP_FLAGS build/$1-$$*/lib/$$(PYTHON_NAME)/site-packages/_frida.so @touch $$@ endef @@ -431,7 +431,7 @@ build/$2-%/frida-tools-$$(PYTHON_NAME)/.frida-stamp: build/.frida-tools-submodul -Dpython=$$(PYTHON) \ frida-tools $$$$builddir || exit 1; \ fi; \ - $$(NINJA) -C $$$$builddir install || exit 1 + $$(MESON) install -C $$$$builddir || exit 1 @touch $$@ endef $(eval $(call make-tools-rule,frida,tmp)) diff --git a/Makefile.macos.mk b/Makefile.macos.mk index 4893d063b9..1bafaa6920 100644 --- a/Makefile.macos.mk +++ b/Makefile.macos.mk @@ -104,7 +104,7 @@ build/$1-%/lib/pkgconfig/frida-gum-1.0.pc: build/$1-env-%.rc build/.frida-gum-su $$(frida_gum_flags) \ frida-gum $$$$builddir || exit 1; \ fi; \ - $$(NINJA) -C $$$$builddir install || exit 1 + $$(MESON) install -C $$$$builddir || exit 1 @touch -c $$@ endef $(eval $(call make-gum-rules,frida,tmp)) @@ -244,47 +244,47 @@ build/tmp_thin-%/frida-core/.frida-ninja-stamp: build/.frida-core-submodule-stam build/frida-macos-x86_64/lib/pkgconfig/frida-core-1.0.pc: build/tmp-macos-x86_64/frida-core/.frida-helper-and-agent-stamp @rm -f build/tmp-macos-x86_64/frida-core/src/frida-data-{helper,agent}* - . build/frida-meson-env-macos-x86_64.rc && $(NINJA) -C build/tmp-macos-x86_64/frida-core install + . build/frida-meson-env-macos-x86_64.rc && $(MESON) install -C build/tmp-macos-x86_64/frida-core @touch $@ build/frida-macos-arm64/lib/pkgconfig/frida-core-1.0.pc: build/tmp-macos-arm64/frida-core/.frida-helper-and-agent-stamp build/tmp-macos-arm64e/frida-core/.frida-helper-and-agent-stamp @rm -f build/tmp-macos-arm64/frida-core/src/frida-data-{helper,agent}* - . build/frida-meson-env-macos-arm64.rc && $(NINJA) -C build/tmp-macos-arm64/frida-core install + . build/frida-meson-env-macos-arm64.rc && $(MESON) install -C build/tmp-macos-arm64/frida-core @touch $@ build/frida-macos-arm64e/lib/pkgconfig/frida-core-1.0.pc: build/tmp-macos-arm64/frida-core/.frida-helper-and-agent-stamp build/tmp-macos-arm64e/frida-core/.frida-helper-and-agent-stamp @rm -f build/tmp-macos-arm64e/frida-core/src/frida-data-{helper,agent}* - . build/frida-meson-env-macos-arm64e.rc && $(NINJA) -C build/tmp-macos-arm64e/frida-core install + . build/frida-meson-env-macos-arm64e.rc && $(MESON) install -C build/tmp-macos-arm64e/frida-core @touch $@ build/frida-android-x86/lib/pkgconfig/frida-core-1.0.pc: build/tmp-android-x86/frida-core/.frida-helper-and-agent-stamp build/tmp-android-arm/frida-core/.frida-agent-stamp @rm -f build/tmp-android-x86/frida-core/src/frida-data-{helper,agent}* - . build/frida-meson-env-android-x86.rc && $(NINJA) -C build/tmp-android-x86/frida-core install + . build/frida-meson-env-android-x86.rc && $(MESON) install -C build/tmp-android-x86/frida-core @touch $@ build/frida-android-x86_64/lib/pkgconfig/frida-core-1.0.pc: build/tmp-android-x86/frida-core/.frida-helper-and-agent-stamp build/tmp-android-x86_64/frida-core/.frida-helper-and-agent-stamp build/tmp-android-arm/frida-core/.frida-agent-stamp build/tmp-android-arm64/frida-core/.frida-agent-stamp @rm -f build/tmp-android-x86_64/frida-core/src/frida-data-{helper,agent}* - . build/frida-meson-env-android-x86_64.rc && $(NINJA) -C build/tmp-android-x86_64/frida-core install + . build/frida-meson-env-android-x86_64.rc && $(MESON) install -C build/tmp-android-x86_64/frida-core @touch $@ build/frida-android-arm/lib/pkgconfig/frida-core-1.0.pc: build/tmp-android-arm/frida-core/.frida-helper-and-agent-stamp @rm -f build/tmp-android-arm/frida-core/src/frida-data-{helper,agent}* - . build/frida-meson-env-android-arm.rc && $(NINJA) -C build/tmp-android-arm/frida-core install + . build/frida-meson-env-android-arm.rc && $(MESON) install -C build/tmp-android-arm/frida-core @touch $@ build/frida-android-arm64/lib/pkgconfig/frida-core-1.0.pc: build/tmp-android-arm/frida-core/.frida-helper-and-agent-stamp build/tmp-android-arm64/frida-core/.frida-helper-and-agent-stamp @rm -f build/tmp-android-arm64/frida-core/src/frida-data-{helper,agent}* - . build/frida-meson-env-android-arm64.rc && $(NINJA) -C build/tmp-android-arm64/frida-core install + . build/frida-meson-env-android-arm64.rc && $(MESON) install -C build/tmp-android-arm64/frida-core @touch $@ build/frida_thin-%/lib/pkgconfig/frida-core-1.0.pc: build/tmp_thin-%/frida-core/.frida-ninja-stamp - . build/frida_thin-meson-env-$*.rc && $(NINJA) -C build/tmp_thin-$*/frida-core install + . build/frida_thin-meson-env-$*.rc && $(MESON) install -C build/tmp_thin-$*/frida-core @touch $@ build/tmp-macos-%/frida-core/.frida-helper-and-agent-stamp: build/tmp-macos-%/frida-core/.frida-ninja-stamp - . build/frida-meson-env-macos-$*.rc && $(NINJA) -C build/tmp-macos-$*/frida-core src/frida-helper lib/agent/frida-agent.dylib + . build/frida-meson-env-macos-$*.rc && ninja -C build/tmp-macos-$*/frida-core src/frida-helper lib/agent/frida-agent.dylib @touch $@ build/tmp-macos-%/frida-core/.frida-agent-stamp: build/tmp-macos-%/frida-core/.frida-ninja-stamp - . build/frida-meson-env-macos-$*.rc && $(NINJA) -C build/tmp-macos-$*/frida-core lib/agent/frida-agent.dylib + . build/frida-meson-env-macos-$*.rc && ninja -C build/tmp-macos-$*/frida-core lib/agent/frida-agent.dylib @touch $@ build/tmp-android-%/frida-core/.frida-helper-and-agent-stamp: build/tmp-android-%/frida-core/.frida-ninja-stamp - . build/frida-meson-env-android-$*.rc && $(NINJA) -C build/tmp-android-$*/frida-core src/frida-helper lib/agent/frida-agent.so + . build/frida-meson-env-android-$*.rc && ninja -C build/tmp-android-$*/frida-core src/frida-helper lib/agent/frida-agent.so @touch $@ build/tmp-android-%/frida-core/.frida-agent-stamp: build/tmp-android-%/frida-core/.frida-ninja-stamp - . build/frida-meson-env-android-$*.rc && $(NINJA) -C build/tmp-android-$*/frida-core lib/agent/frida-agent.so + . build/frida-meson-env-android-$*.rc && ninja -C build/tmp-android-$*/frida-core lib/agent/frida-agent.so @touch $@ build/frida-macos-universal/lib/frida/frida-gadget.dylib: \ @@ -429,7 +429,7 @@ build/$2-%/frida-$$(PYTHON_NAME)/.frida-stamp: build/.frida-python-submodule-sta -Dpython_incdir=$$(PYTHON_INCDIR) \ frida-python $$$$builddir || exit 1; \ fi; \ - $$(NINJA) -C $$$$builddir install || exit 1; \ + $$(MESON) install -C $$$$builddir || exit 1; \ $$$$STRIP $$$$STRIP_FLAGS build/$1-$$*$(PYTHON_PREFIX)/lib/$$(PYTHON_NAME)/site-packages/_frida.so @touch $$@ endef @@ -529,7 +529,7 @@ build/$2-%/frida-tools-$$(PYTHON_NAME)/.frida-stamp: build/.frida-tools-submodul -Dpython=$$(PYTHON) \ frida-tools $$$$builddir || exit 1; \ fi; \ - $$(NINJA) -C $$$$builddir install || exit 1 + $$(MESON) install -C $$$$builddir || exit 1 @touch $$@ endef $(eval $(call make-tools-rule,frida,tmp)) diff --git a/Makefile.sdk.mk b/Makefile.sdk.mk index 2ff6e5176e..8ec7a44df0 100644 --- a/Makefile.sdk.mk +++ b/Makefile.sdk.mk @@ -461,7 +461,8 @@ build/fs-%/manifest/gn.pkg: build/fs-tmp-%/gn/build.ninja @prefix=build/fs-$*; \ builddir=build/fs-tmp-$*/gn; \ (set -x \ - && $(NINJA) -C $$builddir \ + && . build/fs-meson-env-$*.rc \ + && ninja -C $$builddir \ && install -d $$prefix/bin \ && install -m 755 $$builddir/gn $$prefix/bin \ ) >>$$builddir/build.log 2>&1 @@ -538,8 +539,9 @@ build/fs-%/manifest/v8.pkg: build/fs-tmp-%/v8/build.ninja srcdir=deps/v8-checkout/v8; \ builddir=build/fs-tmp-$*/v8; \ (set -x \ + && . build/fs-meson-env-$*.rc \ && $(xcode_env_setup) \ - && $(NINJA) -C $$builddir v8_monolith \ + && ninja -C $$builddir v8_monolith \ && install -d $$prefix/include/v8-$(v8_api_version)/v8 \ && install -m 644 $$srcdir/include/*.h $$prefix/include/v8-$(v8_api_version)/v8/ \ && install -d $$prefix/include/v8-$(v8_api_version)/v8/inspector \ @@ -593,8 +595,9 @@ build/fs-%/manifest/libcxx.pkg: build/fs-%/manifest/v8.pkg srcdir=deps/v8-checkout/v8; \ builddir=build/fs-tmp-$*/v8; \ (set -x \ + && . build/fs-meson-env-$*.rc \ && $(xcode_env_setup) \ - && $(NINJA) -C $$builddir libc++ \ + && ninja -C $$builddir libc++ \ && install -d $$prefix/include/c++/ \ && cp -a $$srcdir/buildtools/third_party/libc++/trunk/include/* $$prefix/include/c++/ \ && rm $$prefix/include/c++/CMakeLists.txt $$prefix/include/c++/__config_site.in \ diff --git a/config.mk b/config.mk index 2a028f53fe..c4321d146e 100644 --- a/config.mk +++ b/config.mk @@ -44,6 +44,5 @@ NODE_BIN_DIR := $(shell dirname $(NODE) 2>/dev/null) NPM ?= $(NODE_BIN_DIR)/npm MESON ?= $(PYTHON3) $(FRIDA)/releng/meson/meson.py -NINJA ?= $(FRIDA)/releng/ninja-$(build_os_arch) tests ?=