Skip to content

Commit

Permalink
build: Harmonize Ninja invocations
Browse files Browse the repository at this point in the history
- Use `meson install` where appropriate.
- Rely on environment having ninja on its PATH.
- Remove NINJA from config.mk.
  • Loading branch information
oleavr committed Jan 18, 2022
1 parent b4ecb38 commit 634360e
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 36 deletions.
8 changes: 4 additions & 4 deletions Makefile.freebsd.mk
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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 $@

Expand Down Expand Up @@ -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
Expand Down
26 changes: 13 additions & 13 deletions Makefile.linux.mk
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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))
Expand Down
30 changes: 15 additions & 15 deletions Makefile.macos.mk
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down Expand Up @@ -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: \
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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))
Expand Down
9 changes: 6 additions & 3 deletions Makefile.sdk.mk
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 \
Expand Down Expand Up @@ -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 \
Expand Down
1 change: 0 additions & 1 deletion config.mk
Original file line number Diff line number Diff line change
Expand Up @@ -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 ?=

0 comments on commit 634360e

Please sign in to comment.