From 467f96869536a76ed0d129e38f237a77b31b1f60 Mon Sep 17 00:00:00 2001 From: Florian Dold Date: Thu, 28 Sep 2023 17:50:53 +0200 Subject: [PATCH] build system: support DESTDIR --- Makefile | 23 ++++++++++++-------- packages/aml-backoffice-ui/Makefile | 3 ++- packages/anastasis-cli/Makefile | 21 +++++++++--------- packages/demobank-ui/Makefile | 3 ++- packages/merchant-backoffice-ui/Makefile | 3 ++- packages/taler-harness/Makefile | 22 ++++++++++--------- packages/taler-wallet-cli/Makefile | 27 ++++++++++++------------ 7 files changed, 57 insertions(+), 45 deletions(-) diff --git a/Makefile b/Makefile index 45deb0d2c..7b4003b74 100644 --- a/Makefile +++ b/Makefile @@ -9,6 +9,11 @@ git-archive-all = ./build-system/taler-build-scripts/archive-with-submodules/git include .config.mk +# Let recursive Makefiles know that they're being invoked +# from the top-level makefile. +export TOPLEVEL := yes +export TOP_DESTDIR := $(abspath $(DESTDIR)) + .PHONY: compile compile: pnpm install -r --frozen-lockfile @@ -121,18 +126,18 @@ lint: install: pnpm install --frozen-lockfile pnpm run compile - make -C packages/taler-wallet-cli TOPLEVEL=yes install-nodeps - make -C packages/anastasis-cli TOPLEVEL=yes install-nodeps - make -C packages/taler-harness TOPLEVEL=yes install-nodeps - make -C packages/demobank-ui TOPLEVEL=yes install-nodeps - make -C packages/merchant-backoffice-ui TOPLEVEL=yes install-nodeps - make -C packages/aml-backoffice-ui TOPLEVEL=yes install-nodeps + $(MAKE) -C packages/taler-wallet-cli install-nodeps + $(MAKE) -C packages/anastasis-cli install-nodeps + $(MAKE) -C packages/taler-harness install-nodeps + $(MAKE) -C packages/demobank-ui install-nodeps + $(MAKE) -C packages/merchant-backoffice-ui install-nodeps + $(MAKE) -C packages/aml-backoffice-ui install-nodeps .PHONY: install-tools # Install taler-wallet-cli, anastasis-cli and taler-harness install-tools: pnpm install --frozen-lockfile --filter @gnu-taler/taler-wallet-cli... --filter @gnu-taler/anastasis-cli... --filter @gnu-taler/taler-harness... pnpm run --filter @gnu-taler/taler-wallet-cli... --filter @gnu-taler/anastasis-cli... --filter @gnu-taler/taler-harness... compile - make -C packages/taler-wallet-cli TOPLEVEL=yes install-nodeps - make -C packages/anastasis-cli TOPLEVEL=yes install-nodeps - make -C packages/taler-harness TOPLEVEL=yes install-nodeps + $(MAKE) -C packages/taler-wallet-cli install-nodeps + $(MAKE) -C packages/anastasis-cli install-nodeps + $(MAKE) -C packages/taler-harness install-nodeps diff --git a/packages/aml-backoffice-ui/Makefile b/packages/aml-backoffice-ui/Makefile index 2653ce92f..64f9f83d1 100644 --- a/packages/aml-backoffice-ui/Makefile +++ b/packages/aml-backoffice-ui/Makefile @@ -3,6 +3,7 @@ ifeq ($(TOPLEVEL), yes) $(info top-level build) -include ../../.config.mk + override DESTDIR := $(TOP_DESTDIR) else $(info package-level build) -include ../../.config.mk @@ -15,7 +16,7 @@ $(info prefix is $(prefix)) all: @echo run \'make install\' to install -spa_dir=$(prefix)/share/taler/aml-backoffice-ui +spa_dir=$(DESTDIR)$(prefix)/share/taler/aml-backoffice-ui .PHONY: install-nodeps install-nodeps: diff --git a/packages/anastasis-cli/Makefile b/packages/anastasis-cli/Makefile index 292f7000f..de6c92a7b 100644 --- a/packages/anastasis-cli/Makefile +++ b/packages/anastasis-cli/Makefile @@ -3,6 +3,7 @@ ifeq ($(TOPLEVEL), yes) $(info top-level build) -include ../../.config.mk + override DESTDIR := $(TOP_DESTDIR) else $(info package-level build) -include ../../.config.mk @@ -20,19 +21,19 @@ warn-noprefix: @echo "no prefix configured, did you run ./configure?" install: warn-noprefix else -install_target = $(prefix)/lib/anastasis-cli +bindir = $(DESTDIR)$(prefix)/bin +libdir = $(DESTDIR)$(prefix)/lib/anastasis-cli +nodedir = $(libdir)/node_modules/anastasis-cli .PHONY: install install-nodeps deps install-nodeps: ./build-node.mjs - install -d $(prefix)/bin - install -d $(install_target)/bin - install -d $(install_target)/node_modules/anastasis-cli - install -d $(install_target)/node_modules/anastasis-cli/bin - install -d $(install_target)/node_modules/anastasis-cli/dist - install ./dist/anastasis-cli-bundled.cjs $(install_target)/node_modules/anastasis-cli/dist/ - install ./dist/anastasis-cli-bundled.cjs.map $(install_target)/node_modules/anastasis-cli/dist/ - install ./bin/anastasis-cli.mjs $(install_target)/node_modules/anastasis-cli/bin/ - ln -sf $(install_target)/node_modules/anastasis-cli/bin/anastasis-cli.mjs $(prefix)/bin/anastasis-cli + install -d $(bindir) + install -d $(nodedir)/bin + install -d $(nodedir)/dist + install ./dist/anastasis-cli-bundled.cjs $(nodedir)/dist/ + install ./dist/anastasis-cli-bundled.cjs.map $(nodedir)/dist/ + install ./bin/anastasis-cli.mjs $(nodedir)/bin/ + ln -sf $(nodedir)/bin/anastasis-cli.mjs $(bindir)/anastasis-cli deps: pnpm install --frozen-lockfile --filter @gnu-taler/anastasis-cli... install: diff --git a/packages/demobank-ui/Makefile b/packages/demobank-ui/Makefile index 8e41cc7c6..2399cc427 100644 --- a/packages/demobank-ui/Makefile +++ b/packages/demobank-ui/Makefile @@ -3,6 +3,7 @@ ifeq ($(TOPLEVEL), yes) $(info top-level build) -include ../../.config.mk + override DESTDIR := $(TOP_DESTDIR) else $(info package-level build) -include ../../.config.mk @@ -15,7 +16,7 @@ $(info prefix is $(prefix)) all: @echo run \'make install\' to install -spa_dir=$(prefix)/share/taler/demobank-ui +spa_dir=$(DESTDIR)$(prefix)/share/taler/demobank-ui .PHONY: deps deps: diff --git a/packages/merchant-backoffice-ui/Makefile b/packages/merchant-backoffice-ui/Makefile index 1f7e0bf2b..7175ef723 100644 --- a/packages/merchant-backoffice-ui/Makefile +++ b/packages/merchant-backoffice-ui/Makefile @@ -3,6 +3,7 @@ ifeq ($(TOPLEVEL), yes) $(info top-level build) -include ../../.config.mk + override DESTDIR := $(TOP_DESTDIR) else $(info package-level build) -include ../../.config.mk @@ -15,7 +16,7 @@ $(info prefix is $(prefix)) all: @echo run \'make install\' to install -spa_dir=$(prefix)/share/taler/merchant-backoffice +spa_dir=$(DESTDIR)$(prefix)/share/taler/merchant-backoffice .PHONY: deps deps: diff --git a/packages/taler-harness/Makefile b/packages/taler-harness/Makefile index ed8365dc8..f9967419d 100644 --- a/packages/taler-harness/Makefile +++ b/packages/taler-harness/Makefile @@ -3,6 +3,7 @@ ifeq ($(TOPLEVEL), yes) $(info top-level build) -include ../../.config.mk + override DESTDIR := $(TOP_DESTDIR) else $(info package-level build) -include ../../.config.mk @@ -20,19 +21,20 @@ warn-noprefix: @echo "no prefix configured, did you run ./configure?" install: warn-noprefix else -install_target = $(prefix)/lib/taler-harness +BINDIR = $(DESTDIR)$(prefix)/bin +LIBDIR = $(DESTDIR)$(prefix)/lib/taler-harness +NODEDIR = $(LIBDIR)/node_modules/taler-harness .PHONY: install deps install-nodeps install-nodeps: ./build.mjs - install -d $(prefix)/bin - install -d $(install_target)/bin - install -d $(install_target)/node_modules/taler-harness - install -d $(install_target)/node_modules/taler-harness/bin - install -d $(install_target)/node_modules/taler-harness/dist - install ./dist/taler-harness-bundled.cjs $(install_target)/node_modules/taler-harness/dist/ - install ./dist/taler-harness-bundled.cjs.map $(install_target)/node_modules/taler-harness/dist/ - install ./bin/taler-harness.mjs $(install_target)/node_modules/taler-harness/bin/ - ln -sf $(install_target)/node_modules/taler-harness/bin/taler-harness.mjs $(prefix)/bin/taler-harness + install -d $(BINDIR) + install -d $(NODEDIR) + install -d $(NODEDIR)/bin + install -d $(NODEDIR)/dist + install ./dist/taler-harness-bundled.cjs $(NODEDIR)/dist/ + install ./dist/taler-harness-bundled.cjs.map $(NODEDIR)/dist/ + install ./bin/taler-harness.mjs $(NODEDIR)/bin/ + ln -sf $(NODEDIR)/bin/taler-harness.mjs $(BINDIR)/taler-harness deps: pnpm install --frozen-lockfile --filter @gnu-taler/taler-harness... install: diff --git a/packages/taler-wallet-cli/Makefile b/packages/taler-wallet-cli/Makefile index 6d695e9c1..6bfe05fc5 100644 --- a/packages/taler-wallet-cli/Makefile +++ b/packages/taler-wallet-cli/Makefile @@ -3,6 +3,7 @@ ifeq ($(TOPLEVEL), yes) $(info top-level build) -include ../../.config.mk + override DESTDIR := $(TOP_DESTDIR) else $(info package-level build) -include ../../.config.mk @@ -20,23 +21,23 @@ warn-noprefix: @echo "no prefix configured, did you run ./configure?" install: warn-noprefix else -install_target = $(prefix)/lib/taler-wallet-cli +LIBDIR = $(DESTDIR)$(prefix)/lib/taler-wallet-cli +BINDIR=$(DESTDIR)$(prefix)/bin +NODEDIR=$(LIBDIR)/node_modules/taler-wallet-cli .PHONY: install install-nodeps deps install-nodeps: ./build-node.mjs - @echo installing wallet CLI to $(install_target) - install -d $(prefix)/bin - install -d $(install_target)/build - install -d $(install_target)/bin - install -d $(install_target)/node_modules/taler-wallet-cli - install -d $(install_target)/node_modules/taler-wallet-cli/bin - install -d $(install_target)/node_modules/taler-wallet-cli/dist - install ./dist/taler-wallet-cli-bundled.cjs $(install_target)/node_modules/taler-wallet-cli/dist/ - install ./dist/taler-wallet-cli-bundled.cjs.map $(install_target)/node_modules/taler-wallet-cli/dist/ - install ./bin/taler-wallet-cli.mjs $(install_target)/node_modules/taler-wallet-cli/bin/ - install ../idb-bridge/node_modules/better-sqlite3/build/Release/better_sqlite3.node $(install_target)/build/ \ + @echo installing wallet CLI to $(DESTDIR)$(prefix) + install -d $(BINDIR) + install -d $(LIBDIR)/build + install -d $(NODEDIR)/bin + install -d $(NODEDIR)/dist + install ./dist/taler-wallet-cli-bundled.cjs $(NODEDIR)/dist/ + install ./dist/taler-wallet-cli-bundled.cjs.map $(NODEDIR)/dist/ + install ./bin/taler-wallet-cli.mjs $(NODEDIR)/bin/ + install ../idb-bridge/node_modules/better-sqlite3/build/Release/better_sqlite3.node $(LIBDIR)/build/ \ || echo "sqlite3 unavailable, better-sqlite3 native module not found" - ln -sf $(install_target)/node_modules/taler-wallet-cli/bin/taler-wallet-cli.mjs $(prefix)/bin/taler-wallet-cli + ln -sf $(NODESIR)/bin/taler-wallet-cli.mjs $(BINDIR)/taler-wallet-cli deps: pnpm install --frozen-lockfile --filter @gnu-taler/taler-wallet-cli... pnpm run --filter @gnu-taler/taler-wallet-cli... compile