Submitted By: Joe Ciccone <jciccone@linuxfromscratch.org>
Date: 2006-09-04
Upstream Status: Unknown
Origin: Joe Ciccone
Description: Defines the libdir that contains tc in the makefile and modifies the paths in the executables to use the libdir set in the makefile.

diff -Naur iproute2-2.6.16-060323.orig/netem/Makefile iproute2-2.6.16-060323/netem/Makefile
--- iproute2-2.6.16-060323.orig/netem/Makefile  2006-09-03 03:39:19.000000000 -0400
+++ iproute2-2.6.16-060323/netem/Makefile       2006-09-03 03:46:33.000000000 -0400
 -1,6 +1,8 @@
 DISTGEN = maketable normal pareto paretonormal
 DISTDATA = normal.dist pareto.dist paretonormal.dist experimental.dist

+LIBDIR = /usr/lib
+
 HOSTCC ?= $(CC)
 LDLIBS += -lm

 -16,9 +18,9 @@
        ./maketable experimental.dat > experimental.dist

 install: all
-       mkdir -p $(DESTDIR)/usr/lib/tc
+       mkdir -p $(DESTDIR)/$(LIBDIR)/tc
        for i in $(DISTDATA); \
-       do install -m 755 $$i $(DESTDIR)/usr/lib/tc; \
+       do install -m 755 $$i $(DESTDIR)/$(LIBDIR)/tc; \
        done

 clean:
diff -Naur iproute2-2.6.16-060323.orig/tc/Makefile iproute2-2.6.16-060323/tc/Makefile
--- iproute2-2.6.16-060323.orig/tc/Makefile     2006-09-03 03:39:19.000000000 -0400
+++ iproute2-2.6.16-060323/tc/Makefile  2006-09-03 03:44:55.000000000 -0400
 -42,7 +42,8 @@
 TCLIB += tc_cbq.o
 TCLIB += tc_estimator.o

-CFLAGS += -DCONFIG_GACT -DCONFIG_GACT_PROB
+LIBDIR = /usr/lib
+CFLAGS += -DCONFIG_GACT -DCONFIG_GACT_PROB -DLIBDIR="\"$(LIBDIR)\""

 TCSO :=
 TCSO += q_netem.so
 -69,10 +70,10 @@
        $(AR) rcs $@ $(TCLIB)

 install: all
-       mkdir -p $(DESTDIR)/usr/lib/tc
+       mkdir -p $(DESTDIR)/$(LIBDIR)/tc
        install -m 0755 -s tc $(DESTDIR)$(SBINDIR)
        for i in $(TCSO); \
-       do install -m 755 -s $$i $(DESTDIR)/usr/lib/tc; \
+       do install -m 755 -s $$i $(DESTDIR)/$(LIBDIR)/tc; \
        done

 clean:
diff -Naur iproute2-2.6.16-060323.orig/tc/q_netem.c iproute2-2.6.16-060323/tc/q_netem.c
--- iproute2-2.6.16-060323.orig/tc/q_netem.c    2006-09-03 03:39:19.000000000 -0400
+++ iproute2-2.6.16-060323/tc/q_netem.c 2006-09-03 03:43:51.000000000 -0400
 -60,7 +60,7 @@
        char *line = NULL;
        char name[128];

-       snprintf(name, sizeof(name), "/usr/lib/tc/%s.dist", type);
+       snprintf(name, sizeof(name), LIBDIR "/tc/%s.dist", type);
        if ((f = fopen(name, "r")) == NULL) {
                fprintf(stderr, "No distribution data for %s (%s: %s)\n",
                        type, name, strerror(errno));
diff -Naur iproute2-2.6.16-060323.orig/tc/tc.c iproute2-2.6.16-060323/tc/tc.c
--- iproute2-2.6.16-060323.orig/tc/tc.c 2006-09-03 03:39:19.000000000 -0400
+++ iproute2-2.6.16-060323/tc/tc.c      2006-09-03 03:43:30.000000000 -0400
 -99,7 +99,7 @@
                if (strcmp(q->id, str) == 0)
                        return q;

-       snprintf(buf, sizeof(buf), "/usr/lib/tc/q_%s.so", str);
+       snprintf(buf, sizeof(buf), LIBDIR "/tc/q_%s.so", str);
        dlh = dlopen(buf, RTLD_LAZY);
        if (!dlh) {
                /* look in current binary, only open once */
 -144,8 +144,7 @@
        for (q = filter_list; q; q = q->next)
                if (strcmp(q->id, str) == 0)
                        return q;
-
-       snprintf(buf, sizeof(buf), "/usr/lib/tc/f_%s.so", str);
+       snprintf(buf, sizeof(buf), LIBDIR "/tc/f_%s.so", str);
        dlh = dlopen(buf, RTLD_LAZY);
        if (dlh == NULL) {
                dlh = BODY;
