Submitted By: Joe Ciccone <jciccone@gmail.com>
Date: 2008-09-31
Upstream Status: Unknown
Origin: Joe Ciccone
Description: This patch gives the ability to change the libdir.

--- iproute2-2.6.26.orig/Config	1969-12-31 19:00:00.000000000 -0500
+++ iproute2-2.6.26/Config	2008-09-13 15:07:31.000000000 -0400
@@ -0,0 +1 @@
+# Generated config based on /usr/src/clfs-tarballs/conglomeration/iproute2-2.6.26/include
diff -Naur iproute2-2.6.26.orig/include/iptables.h iproute2-2.6.26/include/iptables.h
--- iproute2-2.6.26.orig/include/iptables.h	2008-07-25 16:46:07.000000000 -0400
+++ iproute2-2.6.26/include/iptables.h	2008-09-13 15:43:33.000000000 -0400
@@ -4,8 +4,12 @@
 #include "iptables_common.h"
 #include "libiptc/libiptc.h"
 
+#ifndef LIBDIR
+#define LIBDIR "/usr/lib"
+#endif
+
 #ifndef IPT_LIB_DIR
-#define IPT_LIB_DIR "/usr/local/lib/iptables"
+#define IPT_LIB_DIR LIBDIR "/iptables"
 #endif
 
 #ifndef IPPROTO_SCTP
diff -Naur iproute2-2.6.26.orig/ip/iplink.c iproute2-2.6.26/ip/iplink.c
--- iproute2-2.6.26.orig/ip/iplink.c	2008-07-25 16:46:07.000000000 -0400
+++ iproute2-2.6.26/ip/iplink.c	2008-09-13 15:14:41.000000000 -0400
@@ -34,7 +34,11 @@
 
 #define IPLINK_IOCTL_COMPAT	1
 #ifndef DESTDIR
-#define DESTDIR "/usr/"
+#define DESTDIR "/usr"
+#endif
+
+#ifndef LIBDIR
+#define LIBDIR "/usr/lib"
 #endif
 
 static void usage(void) __attribute__((noreturn));
@@ -81,7 +85,7 @@
 		if (strcmp(l->id, id) == 0)
 			return l;
 
-	snprintf(buf, sizeof(buf), DESTDIR "/lib/ip/link_%s.so", id);
+	snprintf(buf, sizeof(buf), DESTDIR LIBDIR "/ip/link_%s.so", id);
 	dlh = dlopen(buf, RTLD_LAZY);
 	if (dlh == NULL) {
 		/* look in current binary, only open once */
diff -Naur iproute2-2.6.26.orig/Makefile iproute2-2.6.26/Makefile
--- iproute2-2.6.26.orig/Makefile	2008-07-25 16:46:07.000000000 -0400
+++ iproute2-2.6.26/Makefile	2008-09-13 15:15:24.000000000 -0400
@@ -1,13 +1,15 @@
-DESTDIR=/usr/
+DESTDIR=/usr
 SBINDIR=/sbin
 CONFDIR=/etc/iproute2
 DOCDIR=/share/doc/iproute2
 MANDIR=/share/man
 
+LIBDIR=/usr/lib
+
 # Path to db_185.h include
 DBM_INCLUDE:=/usr/include
 
-DEFINES= -DRESOLVE_HOSTNAMES -DDESTDIR=\"$(DESTDIR)\"
+DEFINES= -DRESOLVE_HOSTNAMES -DDESTDIR=\"$(DESTDIR)\" -DLIBDIR=\"$(LIBDIR)\"
 
 #options if you have a bind>=4.9.4 libresolv (or, maybe, glibc)
 LDLIBS=-lresolv
diff -Naur iproute2-2.6.26.orig/netem/Makefile iproute2-2.6.26/netem/Makefile
--- iproute2-2.6.26.orig/netem/Makefile	2008-07-25 16:46:07.000000000 -0400
+++ iproute2-2.6.26/netem/Makefile	2008-09-13 14:27:07.000000000 -0400
@@ -20,9 +20,9 @@
 	$(HOSTCC) $(CCOPTS) -I../include -o $@ $@.c -lm
 
 install: all
-	mkdir -p $(DESTDIR)/lib/tc
+	mkdir -p $(DESTDIR)$(LIBDIR)/tc
 	for i in $(DISTDATA); \
-	do install -m 755 $$i $(DESTDIR)/lib/tc; \
+	do install -m 755 $$i $(DESTDIR)$(LIBDIR)/tc; \
 	done
 
 clean:
diff -Naur iproute2-2.6.26.orig/tc/Makefile iproute2-2.6.26/tc/Makefile
--- iproute2-2.6.26.orig/tc/Makefile	2008-07-25 16:46:07.000000000 -0400
+++ iproute2-2.6.26/tc/Makefile	2008-09-13 14:30:37.000000000 -0400
@@ -72,10 +72,10 @@
 	$(AR) rcs $@ $(TCLIB)
 
 install: all
-	mkdir -p $(DESTDIR)/lib/tc
+	mkdir -p $(DESTDIR)$(LIBDIR)/tc
 	install -m 0755 tc $(DESTDIR)$(SBINDIR)
 	for i in $(TCSO); \
-	do install -m 755 $$i $(DESTDIR)/lib/tc; \
+	do install -m 755 $$i $(DESTDIR)$(LIBDIR)/tc; \
 	done
 
 clean:
diff -Naur iproute2-2.6.26.orig/tc/tc_util.c iproute2-2.6.26/tc/tc_util.c
--- iproute2-2.6.26.orig/tc/tc_util.c	2008-07-25 16:46:07.000000000 -0400
+++ iproute2-2.6.26/tc/tc_util.c	2008-09-13 15:15:16.000000000 -0400
@@ -25,7 +25,11 @@
 #include "tc_util.h"
 
 #ifndef DESTDIR
-#define DESTDIR "/usr/"
+#define DESTDIR "/usr"
+#endif
+
+#ifndef LIBDIR
+#define LIBDIR "/usr/lib"
 #endif
 
 const char *get_tc_lib(void)
@@ -34,7 +38,7 @@
 
 	lib_dir = getenv("TC_LIB_DIR");
 	if (!lib_dir)
-		lib_dir = DESTDIR "/lib/tc";
+		lib_dir = DESTDIR LIBDIR "/tc";
 
 	return lib_dir;