1 include $(INCLUDE_DIR)/feeds.mk
3 ifdef CONFIG_USE_MKLIBS
5 rm -rf $(TMP_DIR)/mklibs-progs $(TMP_DIR)/mklibs-out
6 # first find all programs and add them to the mklibs list
7 find $(STAGING_DIR_ROOT) -type f -perm /100 -exec \
8 file -r -N -F '' {} + | \
9 awk ' /executable.*dynamically/ { print $$1 }' > $(TMP_DIR)/mklibs-progs
10 # find all loadable objects that are not regular libraries and add them to the list as well
11 find $(STAGING_DIR_ROOT) -type f -name \*.so\* -exec \
12 file -r -N -F '' {} + | \
13 awk ' /shared object/ { print $$1 }' > $(TMP_DIR)/mklibs-libs
14 mkdir -p $(TMP_DIR)/mklibs-out
15 $(STAGING_DIR_HOST)/bin/mklibs -D \
16 -d $(TMP_DIR)/mklibs-out \
17 --sysroot $(STAGING_DIR_ROOT) \
18 `cat $(TMP_DIR)/mklibs-libs | sed 's:/*[^/]\+/*$$::' | uniq | sed 's:^$(STAGING_DIR_ROOT):-L :'` \
19 --ldlib $(patsubst $(STAGING_DIR_ROOT)/%,/%,$(firstword $(wildcard \
20 $(foreach name,ld-uClibc.so.* ld-linux.so.* ld-*.so ld-musl-*.so.*, \
21 $(STAGING_DIR_ROOT)/lib/$(name) \
23 --target $(REAL_GNU_TARGET_NAME) \
24 `cat $(TMP_DIR)/mklibs-progs $(TMP_DIR)/mklibs-libs` 2>&1
25 $(RSTRIP) $(TMP_DIR)/mklibs-out
26 for lib in `ls $(TMP_DIR)/mklibs-out/*.so.* 2>/dev/null`; do \
28 DEST="`ls "$(1)/lib/$$LIB" "$(1)/usr/lib/$$LIB" 2>/dev/null`"; \
29 [ -n "$$DEST" ] || continue; \
30 echo "Copying stripped library $$lib to $$DEST"; \
31 cp "$$lib" "$$DEST" || exit 1; \
36 # where to build (and put) .ipk packages
41 $(STAGING_DIR_HOST)/bin/opkg \
46 --add-arch $(if $(ARCH_PACKAGES),$(ARCH_PACKAGES),$(BOARD)):200
48 TARGET_DIR_ORIG := $(TARGET_ROOTFS_DIR)/root.orig-$(BOARD)
51 @if [ -d $(TOPDIR)/files ]; then \
52 $(call file_copy,$(TOPDIR)/files/.,$(1)); \
54 @mkdir -p $(1)/etc/rc.d
57 for script in ./usr/lib/opkg/info/*.postinst; do \
58 IPKG_INSTROOT=$(1) $$(which bash) $$script; \
60 if [ $$ret -ne 0 ]; then \
61 echo "postinst script $$script has failed with exit code $$ret" >&2; \
65 for script in ./etc/init.d/*; do \
66 grep '#!/bin/sh /etc/rc.common' $$script >/dev/null || continue; \
67 IPKG_INSTROOT=$(1) $$(which bash) ./etc/rc.common $$script enable; \
70 $(if $(SOURCE_DATE_EPOCH),sed -i "s/Installed-Time: .*/Installed-Time: $(SOURCE_DATE_EPOCH)/" $(1)/usr/lib/opkg/status)
71 @-find $(1) -name CVS | $(XARGS) rm -rf
72 @-find $(1) -name .svn | $(XARGS) rm -rf
73 @-find $(1) -name .git | $(XARGS) rm -rf
74 @-find $(1) -name '.#*' | $(XARGS) rm -f
75 rm -f $(1)/usr/lib/opkg/lists/*
76 rm -f $(1)/usr/lib/opkg/info/*.postinst*
77 rm -f $(1)/usr/lib/opkg/info/*.prerm*
78 $(if $(CONFIG_CLEAN_IPKG),rm -rf $(1)/usr/lib/opkg)