All of lore.kernel.org
 help / color / mirror / Atom feed
From: Martin Wilck <martin.wilck@suse.com>
To: Christophe Varoqui <christophe.varoqui@opensvc.com>,
	Benjamin Marzinski <bmarzins@redhat.com>
Cc: dm-devel@lists.linux.dev, Etienne AUJAMES <eaujames@ddn.com>
Subject: [PATCH 1/8] multipath-tools: add TGTDIR option
Date: Wed, 17 Apr 2024 20:46:37 +0200	[thread overview]
Message-ID: <20240417184644.6193-2-mwilck@suse.com> (raw)
In-Reply-To: <20240417184644.6193-1-mwilck@suse.com>

TGTDIR is a convenience option for developers for building multipath-tools such
that compiled-in paths of the plugins, config files, etc. match an
installation under some optional path. See README.md for instructions and
examples.

Signed-off-by: Martin Wilck <mwilck@suse.com>
---
 .github/actions/spelling/expect.txt |  2 ++
 Makefile.inc                        |  8 +++----
 README.md                           | 33 +++++++++++++++++++++++++++++
 3 files changed, 39 insertions(+), 4 deletions(-)

diff --git a/.github/actions/spelling/expect.txt b/.github/actions/spelling/expect.txt
index 5906403..fc9f22f 100644
--- a/.github/actions/spelling/expect.txt
+++ b/.github/actions/spelling/expect.txt
@@ -167,6 +167,7 @@ retrigger
 rhabarber
 rootprefix
 rootprefixdir
+rpmbuild
 rport
 rtpi
 sas
@@ -200,6 +201,7 @@ tcp
 TESTDEPS
 testname
 tgill
+TGTDIR
 TIDS
 tmo
 tpg
diff --git a/Makefile.inc b/Makefile.inc
index 5668e63..81b86cd 100644
--- a/Makefile.inc
+++ b/Makefile.inc
@@ -101,9 +101,9 @@ WARNFLAGS	:= -Werror -Wall -Wextra -Wformat=2 $(WFORMATOVERFLOW) -Werror=implici
 		  $(WNOCLOBBERED) -Werror=cast-qual $(ERROR_DISCARDED_QUALIFIERS) $(W_URCU_TYPE_LIMITS)
 CPPFLAGS	:= $(FORTIFY_OPT) $(CPPFLAGS) $(D_URCU_VERSION) \
 		   -D_FILE_OFFSET_BITS=64 \
-		   -DBIN_DIR=\"$(bindir)\" -DMULTIPATH_DIR=\"$(plugindir)\" \
-		   -DRUNTIME_DIR=\"$(runtimedir)\" -DCONFIG_DIR=\"$(configdir)\" \
-		   -DDEFAULT_CONFIGFILE=\"$(configfile)\" -DSTATE_DIR=\"$(statedir)\" \
+		   -DBIN_DIR=\"$(bindir)\" -DMULTIPATH_DIR=\"$(TGTDIR)$(plugindir)\" \
+		   -DRUNTIME_DIR=\"$(runtimedir)\" -DCONFIG_DIR=\"$(TGTDIR)$(configdir)\" \
+		   -DDEFAULT_CONFIGFILE=\"$(TGTDIR)$(configfile)\" -DSTATE_DIR=\"$(TGTDIR)$(statedir)\" \
 		   -DEXTRAVERSION=\"$(EXTRAVERSION)\" -MMD -MP
 CFLAGS		:= -std=gnu99 $(CFLAGS) $(OPTFLAGS) $(WARNFLAGS) -pipe
 BIN_CFLAGS	:= -fPIE -DPIE
@@ -149,4 +149,4 @@ NV_VERSION_SCRIPT = $(DEVLIB:%.so=%-nv.version)
 
 %:	%.in
 	@echo creating $@
-	$(Q)sed 's:@CONFIGFILE@:'$(configfile)':g;s:@CONFIGDIR@:'$(configdir)':g;s:@STATE_DIR@:'$(statedir)':g;s:@RUNTIME_DIR@:'$(runtimedir)':g;s/@MODPROBE_UNIT@/'$(MODPROBE_UNIT)'/g;s:@BINDIR@:'$(bindir)':g' $< >$@
+	$(Q)sed 's:@CONFIGFILE@:'$(TGTDIR)$(configfile)':g;s:@CONFIGDIR@:'$(TGTDIR)$(configdir)':g;s:@STATE_DIR@:'$(TGTDIR)$(statedir)':g;s:@RUNTIME_DIR@:'$(runtimedir)':g;s/@MODPROBE_UNIT@/'$(MODPROBE_UNIT)'/g;s:@BINDIR@:'$(bindir)':g' $< >$@
diff --git a/README.md b/README.md
index d4f35f5..7207b14 100644
--- a/README.md
+++ b/README.md
@@ -151,6 +151,39 @@ sufficient control. See `Makefile.inc` for even more fine-grained control.
 	On such distributions, override `unitdir` and `libudevdir` to use systemd's
    `rootprefix`: `make libudevdir=/lib/udev unitdir=/lib/systemd/system`
 
+### prefix, DESTDIR and TGTDIR
+
+`prefix` and related variables are included in compiled-in paths like
+`plugindir` and are used by `make install`. Using `prefix` is useful if
+multipath-tools is built locally on the same host where it's supposed to be
+installed.
+
+By convention, the `DESTDIR` variable is prepended to all paths by `make
+install`, but not to any compiled-in paths.
+It is useful if the software is built on one system (build host) but intended
+to be run on another system (installation host). This is typically used in build
+systems like *rpmbuild* to set a root directory for all the installed
+files.
+
+On the contrary, the `TGTDIR` variable is used for compiled-in paths only, and
+ignored by `make install`. It is useful for running multipath-tools in a separate
+subdirectory in the installation host, mostly for testing / development
+purposes.
+
+For example,
+
+    make prefix=/opt DESTDIR=/build TGTDIR=/test install
+
+will install plugins into `/build/opt/lib64/multipath` on the build
+host. On the installation host, the plugins will be expected to be found under
+`/test/opt/lib64/multipath`. If the developer runs
+
+    rsync -a $BUILD_HOST:$DESTDIR/ $INSTALL_HOST:$TGTDIR/
+	
+and adds `$TGTDIR/lib64` to `LD_LIBRARY_PATH` on the installation host, the
+multipath binaries installed under `$TGTDIR` will find their plugins and
+configuration files in the expected compiled-in paths.
+
 ### Compiler Options
 
 Use `OPTFLAGS` to change optimization-related compiler options;
-- 
2.44.0


  reply	other threads:[~2024-04-17 18:46 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-17 18:46 [PATCH 0/8] multipath-tools: max_sectors_kb rework Martin Wilck
2024-04-17 18:46 ` Martin Wilck [this message]
2024-04-17 18:46 ` [PATCH 2/8] libmultipath: move get_udev_for_mpp to sysfs.c Martin Wilck
2024-04-17 18:46 ` [PATCH 3/8] libmultipath: add mp_find_path_by_devt() Martin Wilck
2024-04-17 18:46 ` [PATCH 4/8] Revert "libmultipath: fix max_sectors_kb on adding path" Martin Wilck
2024-04-17 18:46 ` [PATCH 5/8] libmultipath: Only set max_sectors_kb on map creation Martin Wilck
2024-04-17 18:46 ` [PATCH 6/8] libmultipath: set max_sectors_kb in adopt_paths() Martin Wilck
2024-04-17 18:46 ` [PATCH 7/8] libmultipath: add wildcard %k for printing max_sectors_kb Martin Wilck
2024-04-17 18:46 ` [PATCH 8/8] multipath.conf(5): update documentation for max_sectors_kb Martin Wilck
2024-04-18 18:40 ` [PATCH 0/8] multipath-tools: max_sectors_kb rework Benjamin Marzinski

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240417184644.6193-2-mwilck@suse.com \
    --to=martin.wilck@suse.com \
    --cc=bmarzins@redhat.com \
    --cc=christophe.varoqui@opensvc.com \
    --cc=dm-devel@lists.linux.dev \
    --cc=eaujames@ddn.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.