commit 64112a95a5942591bc42647098630c7bc21ed173
parent a0c846a29b55ea170e57480989e7ccc1ca392095
Author: Antoine A <>
Date: Thu, 13 Feb 2025 09:48:22 +0100
common: add bootstrap and make install, fix config logic
Diffstat:
8 files changed, 75 insertions(+), 9 deletions(-)
diff --git a/.gitignore b/.gitignore
@@ -1,5 +1,7 @@
.env
.ci
+*.mk
+configure
test-suite.log
target
dev.conf
diff --git a/.gitmodules b/.gitmodules
@@ -0,0 +1,7 @@
+[submodule "build-system/taler-build-scripts"]
+ path = build-system/taler-build-scripts
+ url = ../build-common.git
+[submodule "doc/prebuilt"]
+ path = doc/prebuilt
+ url = ../taler-docs.git
+ branch = prebuilt
diff --git a/Makefile b/Makefile
@@ -1,8 +1,31 @@
+# This Makefile has been placed under the public domain
+-include build-system/config.mk
+
+export GIT_HASH=$(shell git rev-parse --short HEAD)
+
+# Absolute DESTDIR or empty string if DESTDIR unset/empty
+abs_destdir=$(abspath $(DESTDIR))
+
+man_dir=$(abs_destdir)$(prefix)/share/man
+sql_dir=$(abs_destdir)$(prefix)/share/taler-magnet-bank/sql
+config_dir=$(abs_destdir)$(prefix)/share/taler-magnet-bank/config.d
+bin_dir=$(abs_destdir)$(prefix)/bin
+lib_dir=$(abs_destdir)$(prefix)/lib
+
all: build
.PHONY: build
build:
- cargo build
+ cargo build --release
+
+.PHONY: install-nobuild
+install-nobuild:
+ install -m 644 -D -t $(config_dir) taler-magnet-bank/magnet-bank.conf
+ install -D -t $(bin_dir) contrib/taler-magnet-bank-dbconfig
+ install -D -t $(bin_dir) target/release/taler-magnet-bank
+
+.PHONY: install
+install: build install-nobuild
.PHONY: check
check:
@@ -12,10 +35,6 @@ check:
doc:
cargo doc
-.PHONY: deb
-deb:
- cargo deb -p taler-magnet-bank --deb-version ${VERSION}
-
.PHONY: ci
ci:
contrib/ci/run-all-jobs.sh
\ No newline at end of file
diff --git a/bootstrap b/bootstrap
@@ -0,0 +1,25 @@
+#!/bin/sh
+
+# Bootstrap the repository. Used when the repository is checked out from git.
+# When using the source tarball, running this script is not necessary.
+
+set -eu
+
+if ! git --version >/dev/null; then
+ echo "git not installed"
+ exit 1
+fi
+
+if ! python3 --version >/dev/null; then
+ echo "python3 not installed"
+ exit 1
+fi
+
+# Make sure that "git pull" et al. also update
+# submodules to avoid accidental rollbacks.
+git config --local submodule.recurse true
+
+git submodule sync
+git submodule update --init
+rm -f ./configure
+cp build-system/taler-build-scripts/configure ./configure
diff --git a/build-system/configure.py b/build-system/configure.py
@@ -0,0 +1,9 @@
+# This configure.py.template file is in the public domain.
+
+from talerbuildconfig import *
+
+b = BuildConfig()
+b.enable_prefix()
+b.enable_configmk()
+b.add_tool(PosixTool("find"))
+b.run()
diff --git a/build-system/taler-build-scripts b/build-system/taler-build-scripts
@@ -0,0 +1 @@
+Subproject commit 884e13fe65b584f63d4cf92348fab1136af4bd69
diff --git a/common/taler-common/src/config.rs b/common/taler-common/src/config.rs
@@ -395,10 +395,12 @@ pub mod parser {
/** Search for the binary installation path in PATH */
fn install_path(&self) -> Result<PathBuf, (PathBuf, std::io::Error)> {
let path_env = std::env::var("PATH").unwrap();
- for entry in path_env.split(':') {
- let path = PathBuf::from(entry).join(self.exec_name);
- if path.join(self.exec_name).exists() {
- if let Some(parent) = path.parent() {
+ for path_dir in path_env.split(':') {
+ let path_dir = PathBuf::from(path_dir);
+ let bin_path = path_dir.join(self.exec_name);
+ if bin_path.exists() {
+ if let Some(parent) = path_dir.parent() {
+ dbg!(parent);
return parent.canonicalize().map_err(|e| (parent.to_path_buf(), e));
}
}
diff --git a/doc/prebuilt b/doc/prebuilt
@@ -0,0 +1 @@
+Subproject commit 3b83e3fc98d4621b8792c61c6ec67d6bc41c4dd9