All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/3] Hotfix for make install
@ 2010-04-15  9:40 Zdenek Kabelac
  2010-04-15  9:40 ` [PATCH 1/3] Hotfix: $(datarootdir) has already $(DESTDIR) Zdenek Kabelac
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Zdenek Kabelac @ 2010-04-15  9:40 UTC (permalink / raw)
  To: lvm-devel

Patchset fixes relative linkage of libraries between
usrlibdir and libdir.
Also fixes usage of DESTDIR for infodir and mandir.

Zdenek Kabelac (3):
  Hotfix: $(datarootdir) has already $(DESTDIR)
  Script to create proper relative path
  Use relative paths for creating links .so

 make.tmpl.in       |    7 ++++---
 scripts/relpath.sh |   49 +++++++++++++++++++++++++++++++++++++++++++++++++
 tools/Makefile.in  |    2 +-
 3 files changed, 54 insertions(+), 4 deletions(-)
 create mode 100755 scripts/relpath.sh



^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 1/3] Hotfix: $(datarootdir) has already $(DESTDIR)
  2010-04-15  9:40 [PATCH 0/3] Hotfix for make install Zdenek Kabelac
@ 2010-04-15  9:40 ` Zdenek Kabelac
  2010-04-15  9:40 ` [PATCH 2/3] Script to create proper relative path Zdenek Kabelac
  2010-04-15  9:40 ` [PATCH 3/3] Use relative paths for creating links .so Zdenek Kabelac
  2 siblings, 0 replies; 4+ messages in thread
From: Zdenek Kabelac @ 2010-04-15  9:40 UTC (permalink / raw)
  To: lvm-devel

FIXME: We should use DESTDIR only for $(INSTALL) commands to allow
user-override of commonly known variables and still be able
to honor $(DESTDIR).

Signed-off-by: Zdenek Kabelac <zkabelac@redhat.com>
---
 make.tmpl.in |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/make.tmpl.in b/make.tmpl.in
index 87e8505..a6b00fc 100644
--- a/make.tmpl.in
+++ b/make.tmpl.in
@@ -57,8 +57,8 @@ usrlibdir = $(DESTDIR)@usrlibdir@
 sbindir = $(DESTDIR)@sbindir@
 usrsbindir = $(DESTDIR)@usrsbindir@
 datarootdir = $(DESTDIR)@datarootdir@
-infodir = $(DESTDIR)@infodir@
-mandir = $(DESTDIR)@mandir@
+infodir = $(datarootdir)/info
+mandir = $(datarootdir)/man
 localedir = $(DESTDIR)@LOCALEDIR@
 staticdir = $(DESTDIR)@STATICDIR@
 udevdir = $(DESTDIR)@udevdir@
-- 
1.7.0.1



^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 2/3] Script to create proper relative path
  2010-04-15  9:40 [PATCH 0/3] Hotfix for make install Zdenek Kabelac
  2010-04-15  9:40 ` [PATCH 1/3] Hotfix: $(datarootdir) has already $(DESTDIR) Zdenek Kabelac
@ 2010-04-15  9:40 ` Zdenek Kabelac
  2010-04-15  9:40 ` [PATCH 3/3] Use relative paths for creating links .so Zdenek Kabelac
  2 siblings, 0 replies; 4+ messages in thread
From: Zdenek Kabelac @ 2010-04-15  9:40 UTC (permalink / raw)
  To: lvm-devel

This script takes two real paths and calculates relative
path between them. Script is used for creation of relative
path /usr/lib/lib.so -> /lib/lib.so.1.2

i.e.   relpath.sh   a/b/c/d  a/b/e/f/g/g  -> ../../e/f/g/g/

Signed-off-by: Zdenek Kabelac <zkabelac@redhat.com>
---
 scripts/relpath.sh |   49 +++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 49 insertions(+), 0 deletions(-)
 create mode 100755 scripts/relpath.sh

diff --git a/scripts/relpath.sh b/scripts/relpath.sh
new file mode 100755
index 0000000..3e79a0d
--- /dev/null
+++ b/scripts/relpath.sh
@@ -0,0 +1,49 @@
+#!/bin/bash
+
+# usage: relpath from to
+#
+# modified script from to avoid print of ./:
+# http://stackoverflow.com/questions/2564634/bash-convert-absolute-path-into-relative-path-given-a-current-directory 
+# 
+
+from=${1%%/}
+to=${2%%/}
+
+test "$from" == "$to" && exit
+
+IFS="/"
+
+current=($from)
+absolute=($to)
+
+abssize=${#absolute[@]}
+cursize=${#current[@]}
+
+while [[ ${absolute[$level]} == ${current[$level]} ]]
+do
+    (( level++ ))
+    if (( level > abssize || level > cursize ))
+    then
+        break
+    fi
+done
+
+for ((i = level; i < cursize; i++))
+do
+    if ((i > level))
+    then
+        newpath=$newpath"/"
+    fi
+    newpath=$newpath".."
+done
+
+for ((i = level; i < abssize; i++))
+do
+    if [[ -n $newpath ]]
+    then
+        newpath=$newpath"/"
+    fi
+    newpath=$newpath${absolute[i]}
+done
+
+echo "$newpath/"
-- 
1.7.0.1



^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 3/3] Use relative paths for creating links .so
  2010-04-15  9:40 [PATCH 0/3] Hotfix for make install Zdenek Kabelac
  2010-04-15  9:40 ` [PATCH 1/3] Hotfix: $(datarootdir) has already $(DESTDIR) Zdenek Kabelac
  2010-04-15  9:40 ` [PATCH 2/3] Script to create proper relative path Zdenek Kabelac
@ 2010-04-15  9:40 ` Zdenek Kabelac
  2 siblings, 0 replies; 4+ messages in thread
From: Zdenek Kabelac @ 2010-04-15  9:40 UTC (permalink / raw)
  To: lvm-devel

Using relpath.sh to generate link path between libs.

Signed-off-by: Zdenek Kabelac <zkabelac@redhat.com>
---
 make.tmpl.in      |    3 ++-
 tools/Makefile.in |    2 +-
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/make.tmpl.in b/make.tmpl.in
index a6b00fc..b3b54f4 100644
--- a/make.tmpl.in
+++ b/make.tmpl.in
@@ -62,6 +62,7 @@ mandir = $(datarootdir)/man
 localedir = $(DESTDIR)@LOCALEDIR@
 staticdir = $(DESTDIR)@STATICDIR@
 udevdir = $(DESTDIR)@udevdir@
+USRLIB_RELPATH = $(shell $(top_srcdir)/scripts/relpath.sh $(abspath $(usrlibdir) $(libdir)))
 
 # Setup vpath search paths for some suffixes
 vpath %.c $(srcdir)
@@ -301,7 +302,7 @@ $(LIB_SHARED): $(LIB_SHARED).$(LIB_VERSION)
 install_lib_shared: $(LIB_SHARED)
 	$(INSTALL_PROGRAM) -D $< $(libdir)/$(<F).$(LIB_VERSION)
 	$(INSTALL) -d $(usrlibdir)
-	$(LN_S) -f $(libdir)/$(<F).$(LIB_VERSION) $(usrlibdir)/$(<F)
+	$(LN_S) -f $(USRLIB_RELPATH)$(<F).$(LIB_VERSION) $(usrlibdir)/$(<F)
 
 # FIXME: plugins are currently installed with .so suffix only
 install_lib_shared_plugin: $(LIB_SHARED)
diff --git a/tools/Makefile.in b/tools/Makefile.in
index 0a4d75f..47fa2db 100644
--- a/tools/Makefile.in
+++ b/tools/Makefile.in
@@ -169,7 +169,7 @@ install_cmdlib_include: $(srcdir)/lvm2cmd.h
 install_cmdlib_dynamic: liblvm2cmd.$(LIB_SUFFIX)
 	$(INSTALL_PROGRAM) -D $< $(libdir)/$(<F).$(LIB_VERSION)
 	$(INSTALL) -d $(usrlibdir)
-	$(LN_S) -f $(libdir)/$<.$(LIB_VERSION) $(usrlibdir)/$(<F)
+	$(LN_S) -f $(USRLIB_RELPATH)$(<F).$(LIB_VERSION) $(usrlibdir)/$(<F)
 
 install_cmdlib_static: liblvm2cmd-static.a
 	$(INSTALL_DATA) -D $< $(usrlibdir)/liblvm2cmd.a
-- 
1.7.0.1



^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2010-04-15  9:40 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-04-15  9:40 [PATCH 0/3] Hotfix for make install Zdenek Kabelac
2010-04-15  9:40 ` [PATCH 1/3] Hotfix: $(datarootdir) has already $(DESTDIR) Zdenek Kabelac
2010-04-15  9:40 ` [PATCH 2/3] Script to create proper relative path Zdenek Kabelac
2010-04-15  9:40 ` [PATCH 3/3] Use relative paths for creating links .so Zdenek Kabelac

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.