Commit 5e3bb534 authored by Andreas Henriksson's avatar Andreas Henriksson Committed by Stephen Hemminger

iproute: DESTDIR vs LIBDIR.

Hello Rafael Almeida.

I noticed your patch adding DESTDIR support in the latest iproute2 release.
Much appreciated! Soon the debian packages might be able to move to actually
using "make install" rather then it's own installation procedure when
building packages. I've noticed something that will break though....

Debian packages usually sets DESTDIR=debian/tmp/ and packages the contents
of that directory as if it where the root file system. This will break
the /usr/lib/{tc,ip}/ module loading, because they DESTDIR (/usr) will be
/whatever-the-build-path-was/debian/tmp/lib/{tc,ip}/.
I beleive others usually call this the LIBDIR to make the separation between
DISTDIR being the (possibly temporary) place things are put when build is
done, and LIBDIR (and others) are used for actual runtime paths.

I'm attaching a patch that I think fixes this, but would be really happy if
you could have a look at to verify I'm not screwing something up.

--
Regards,
Andreas Henriksson
Signed-off-by: default avatarStephen Hemminger <stephen.hemminger@vyatta.com>
parent 839c8456
DESTDIR=/usr/ DESTDIR=/usr/
LIBDIR=/usr/lib/
SBINDIR=/sbin SBINDIR=/sbin
CONFDIR=/etc/iproute2 CONFDIR=/etc/iproute2
DOCDIR=/share/doc/iproute2 DOCDIR=/share/doc/iproute2
...@@ -7,7 +8,7 @@ MANDIR=/share/man ...@@ -7,7 +8,7 @@ MANDIR=/share/man
# Path to db_185.h include # Path to db_185.h include
DBM_INCLUDE:=/usr/include DBM_INCLUDE:=/usr/include
DEFINES= -DRESOLVE_HOSTNAMES -DDESTDIR=\"$(DESTDIR)\" DEFINES= -DRESOLVE_HOSTNAMES -DLIBDIR=\"$(LIBDIR)\"
#options if you have a bind>=4.9.4 libresolv (or, maybe, glibc) #options if you have a bind>=4.9.4 libresolv (or, maybe, glibc)
LDLIBS=-lresolv LDLIBS=-lresolv
......
...@@ -33,8 +33,8 @@ ...@@ -33,8 +33,8 @@
#include "ip_common.h" #include "ip_common.h"
#define IPLINK_IOCTL_COMPAT 1 #define IPLINK_IOCTL_COMPAT 1
#ifndef DESTDIR #ifndef LIBDIR
#define DESTDIR "/usr/" #define LIBDIR "/usr/lib/"
#endif #endif
static void usage(void) __attribute__((noreturn)); static void usage(void) __attribute__((noreturn));
...@@ -81,7 +81,7 @@ struct link_util *get_link_kind(const char *id) ...@@ -81,7 +81,7 @@ struct link_util *get_link_kind(const char *id)
if (strcmp(l->id, id) == 0) if (strcmp(l->id, id) == 0)
return l; return l;
snprintf(buf, sizeof(buf), DESTDIR "/lib/ip/link_%s.so", id); snprintf(buf, sizeof(buf), LIBDIR "/ip/link_%s.so", id);
dlh = dlopen(buf, RTLD_LAZY); dlh = dlopen(buf, RTLD_LAZY);
if (dlh == NULL) { if (dlh == NULL) {
/* look in current binary, only open once */ /* look in current binary, only open once */
......
...@@ -73,10 +73,10 @@ libtc.a: $(TCLIB) ...@@ -73,10 +73,10 @@ libtc.a: $(TCLIB)
$(AR) rcs $@ $(TCLIB) $(AR) rcs $@ $(TCLIB)
install: all install: all
mkdir -p $(DESTDIR)/lib/tc mkdir -p $(DESTDIR)$(LIBDIR)/tc
install -m 0755 tc $(DESTDIR)$(SBINDIR) install -m 0755 tc $(DESTDIR)$(SBINDIR)
for i in $(TCSO); \ for i in $(TCSO); \
do install -m 755 $$i $(DESTDIR)/lib/tc; \ do install -m 755 $$i $(DESTDIR)$(LIBDIR)/tc; \
done done
clean: clean:
......
...@@ -24,8 +24,8 @@ ...@@ -24,8 +24,8 @@
#include "utils.h" #include "utils.h"
#include "tc_util.h" #include "tc_util.h"
#ifndef DESTDIR #ifndef LIBDIR
#define DESTDIR "/usr/" #define LIBDIR "/usr/lib/"
#endif #endif
const char *get_tc_lib(void) const char *get_tc_lib(void)
...@@ -34,7 +34,7 @@ const char *get_tc_lib(void) ...@@ -34,7 +34,7 @@ const char *get_tc_lib(void)
lib_dir = getenv("TC_LIB_DIR"); lib_dir = getenv("TC_LIB_DIR");
if (!lib_dir) if (!lib_dir)
lib_dir = DESTDIR "/lib/tc"; lib_dir = LIBDIR "/tc/";
return lib_dir; return lib_dir;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment