--- /dev/null
+Make ldconfig configurable
+
+In a cross-compilation set up, running /sbin/ldconfig is useless, so
+we make the path to ldconfig configurable through the environment/make
+command line. This allows to pass LDCONFIG=/bin/true when doing
+cross-compilation.
+
+Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
+
+Index: b/make/Makefile.linux
+===================================================================
+--- a/make/Makefile.linux
++++ b/make/Makefile.linux
+@@ -3,6 +3,7 @@
+ #
+
+ ARCH := $(shell uname -m)
++LDCONFIG ?= /sbin/ldconfig
+ DESTDIR ?=
+ LIBDIR = $(DESTDIR)$(shell if [ "$(ARCH)" = "x86_64" -a -d "/usr/lib64" ]; then echo "/usr/lib64"; else echo "/usr/lib"; fi)
+
+@@ -14,7 +15,7 @@
+
+ PLUGIN_FULLNAME ?= $(PLUGIN_NAME).so.$(PLUGIN_VER)
+ INSTALL_LIB = install -D -m 755 $(PLUGIN_FULLNAME) $(LIBDIR)/$(PLUGIN_FULLNAME); \
+- /sbin/ldconfig -n $(LIBDIR)
++ $(LDCONFIG) -n $(LIBDIR)
+
+ ifdef OLSRD_PLUGIN
+ GENERATE_PIC = true
OLSR_VERSION = $(OLSR_VERSION_MAJOR).$(OLSR_VERSION_MINOR)
OLSR_SOURCE = olsrd-$(OLSR_VERSION).tar.bz2
OLSR_SITE = http://www.olsr.org/releases/$(OLSR_VERSION_MAJOR)
-OLSR_BINARY = olsrd
-OLSR_TARGET_BINARY = usr/sbin/olsrd
#OLSR_PLUGINS=httpinfo tas dot_draw nameservice dyn_gw dyn_gw_plain pgraph bmf quagga secure
OLSR_PLUGINS = dot_draw dyn_gw secure
-OLSR_TARGET_PLUGIN = usr/lib/
define OLSR_BUILD_CMDS
- $(TARGET_CONFIGURE_OPTS) $(MAKE) ARCH=$(KERNEL_ARCH) -C $(@D) olsrd $(OLSR_PLUGINS)
+ $(TARGET_CONFIGURE_OPTS) $(MAKE) ARCH=$(KERNEL_ARCH) -C $(@D) olsrd
+ for p in $(OLSR_PLUGINS) ; do \
+ $(TARGET_CONFIGURE_OPTS) $(MAKE) ARCH=$(KERNEL_ARCH) -C $(@D)/lib/$$p ; \
+ done
endef
define OLSR_INSTALL_TARGET_CMDS
- cp -dpf $(@D)/$(OLSR_BINARY) $(TARGET_DIR)/$(OLSR_TARGET_BINARY)
- cp -R $(@D)/lib/*/olsrd_*.so* $(TARGET_DIR)/$(OLSR_TARGET_PLUGIN)
- mkdir -p $(TARGET_DIR)/etc/init.d
- cp -dpf package/olsr/S50olsr $(TARGET_DIR)/etc/init.d/
+ $(TARGET_CONFIGURE_OPTS) $(MAKE) -C $(@D) DESTDIR=$(TARGET_DIR) install_bin
+ for p in $(OLSR_PLUGINS) ; do \
+ $(TARGET_CONFIGURE_OPTS) $(MAKE) -C $(@D)/lib/$$p \
+ LDCONFIG=/bin/true DESTDIR=$(TARGET_DIR) install ; \
+ done
+ $(INSTALL) -D -m 0755 package/olsr/S50olsr $(TARGET_DIR)/etc/init.d/S50olsr
test -r $(TARGET_DIR)/etc/olsrd.conf || \
- cp -dpf $(@D)/files/olsrd.conf.default.lq $(TARGET_DIR)/etc/olsrd.conf
- -$(STRIPCMD) $(STRIP_STRIP_UNNEEDED) $(TARGET_DIR)/$(OLSR_TARGET_PLUGIN)/olsrd_*.so*
- $(STRIPCMD) $(STRIP_STRIP_ALL) $(TARGET_DIR)/$(OLSR_TARGET_BINARY)
+ $(INSTALL) -D -m 0644 $(@D)/files/olsrd.conf.default.lq $(TARGET_DIR)/etc/olsrd.conf
endef
define OLSR_CLEAN_CMDS
- rm -f $(TARGET_DIR)/$(OLSR_TARGET_BINARY) \
- $(TARGET_DIR)/$(OLSR_TARGET_PLUGIN)/olsrd_*.so* \
- $(TARGET_DIR)/etc/init.d/S50olsr \
- $(TARGET_DIR)/etc/olsrd.conf
-$(MAKE) -C $(@D) clean
endef