mklibs: Fix mklibs usage when *.so files reside in subdirs

Currently package/Makefile only passes /lib /usr/lib and /usr/lib/ebtables
to mklibs. However, other libs can also reside in different subdirectories
(in my case /usr/lib/ipsec). Hence, create the list of library directories
dynamically.

Signed-off-by: Helmut Schaa <helmut.schaa@googlemail.com>

SVN-Revision: 37841
This commit is contained in:
Felix Fietkau 2013-08-26 17:31:27 +00:00
parent eaa8cb7834
commit f91d09cabb

View file

@ -34,20 +34,18 @@ ifdef CONFIG_USE_MKLIBS
# find all loadable objects that are not regular libraries and add them to the list as well # find all loadable objects that are not regular libraries and add them to the list as well
find $(STAGING_DIR_ROOT) -type f -name \*.so\* -exec \ find $(STAGING_DIR_ROOT) -type f -name \*.so\* -exec \
file -r -N -F '' {} + | \ file -r -N -F '' {} + | \
awk ' /shared object/ { print $$1 }' >> $(TMP_DIR)/mklibs-progs awk ' /shared object/ { print $$1 }' > $(TMP_DIR)/mklibs-libs
mkdir -p $(TMP_DIR)/mklibs-out mkdir -p $(TMP_DIR)/mklibs-out
$(STAGING_DIR_HOST)/bin/mklibs -D \ $(STAGING_DIR_HOST)/bin/mklibs -D \
-d $(TMP_DIR)/mklibs-out \ -d $(TMP_DIR)/mklibs-out \
--sysroot $(STAGING_DIR_ROOT) \ --sysroot $(STAGING_DIR_ROOT) \
-L /lib \ `cat $(TMP_DIR)/mklibs-libs | sed 's:/*[^/]\+/*$$::' | uniq | sed 's:^$(STAGING_DIR_ROOT):-L :'` \
-L /usr/lib \
-L /usr/lib/ebtables \
--ldlib $(patsubst $(STAGING_DIR_ROOT)/%,/%,$(firstword $(wildcard \ --ldlib $(patsubst $(STAGING_DIR_ROOT)/%,/%,$(firstword $(wildcard \
$(foreach name,ld-uClibc.so.* ld-linux.so.* ld-*.so, \ $(foreach name,ld-uClibc.so.* ld-linux.so.* ld-*.so, \
$(STAGING_DIR_ROOT)/lib/$(name) \ $(STAGING_DIR_ROOT)/lib/$(name) \
)))) \ )))) \
--target $(REAL_GNU_TARGET_NAME) \ --target $(REAL_GNU_TARGET_NAME) \
`cat $(TMP_DIR)/mklibs-progs` 2>&1 `cat $(TMP_DIR)/mklibs-progs $(TMP_DIR)/mklibs-libs` 2>&1
$(RSTRIP) $(TMP_DIR)/mklibs-out $(RSTRIP) $(TMP_DIR)/mklibs-out
for lib in `ls $(TMP_DIR)/mklibs-out/*.so.* 2>/dev/null`; do \ for lib in `ls $(TMP_DIR)/mklibs-out/*.so.* 2>/dev/null`; do \
LIB="$${lib##*/}"; \ LIB="$${lib##*/}"; \