logrotate: enable selinux support
[buildroot-gz.git] / toolchain / toolchain.mk
blob59fc905caf01acf50db5922ab243f5d74877d3e1
1 # This file contains toolchain-related customisation of the content
2 # of the target/ directory. Those customisations are added to the
3 # TARGET_FINALIZE_HOOKS, to be applied just after all packages
4 # have been built.
6 # Install default nsswitch.conf file if the skeleton doesn't provide it
7 ifeq ($(BR2_TOOLCHAIN_USES_GLIBC),y)
8 define GLIBC_COPY_NSSWITCH_FILE
9 $(Q)if [ ! -f "$(TARGET_DIR)/etc/nsswitch.conf" ]; then \
10 $(INSTALL) -D -m 0644 package/glibc/nsswitch.conf $(TARGET_DIR)/etc/nsswitch.conf ; \
12 endef
13 TOOLCHAIN_TARGET_FINALIZE_HOOKS += GLIBC_COPY_NSSWITCH_FILE
14 endif
16 # Install the gconv modules
17 ifeq ($(BR2_TOOLCHAIN_GLIBC_GCONV_LIBS_COPY),y)
18 GCONV_LIBS = $(call qstrip,$(BR2_TOOLCHAIN_GLIBC_GCONV_LIBS_LIST))
19 define COPY_GCONV_LIBS
20 $(Q)found_gconv=no; \
21 for d in $(TOOLCHAIN_EXTERNAL_PREFIX) ''; do \
22 [ -d "$(STAGING_DIR)/usr/lib/$${d}/gconv" ] || continue; \
23 found_gconv=yes; \
24 break; \
25 done; \
26 if [ "$${found_gconv}" = "no" ]; then \
27 printf "Unable to find gconv modules\n" >&2; \
28 exit 1; \
29 fi; \
30 if [ -z "$(GCONV_LIBS)" ]; then \
31 $(INSTALL) -m 0644 -D $(STAGING_DIR)/usr/lib/$${d}/gconv/gconv-modules \
32 $(TARGET_DIR)/usr/lib/gconv/gconv-modules && \
33 $(INSTALL) -m 0644 $(STAGING_DIR)/usr/lib/$${d}/gconv/*.so \
34 $(TARGET_DIR)/usr/lib/gconv \
35 || exit 1; \
36 else \
37 for l in $(GCONV_LIBS); do \
38 $(INSTALL) -m 0644 -D $(STAGING_DIR)/usr/lib/$${d}/gconv/$${l}.so \
39 $(TARGET_DIR)/usr/lib/gconv/$${l}.so \
40 || exit 1; \
41 $(TARGET_READELF) -d $(STAGING_DIR)/usr/lib/$${d}/gconv/$${l}.so |\
42 sort -u |\
43 sed -e '/.*(NEEDED).*\[\(.*\.so\)\]$$/!d; s//\1/;' |\
44 while read lib; do \
45 $(INSTALL) -m 0644 -D $(STAGING_DIR)/usr/lib/$${d}/gconv/$${lib} \
46 $(TARGET_DIR)/usr/lib/gconv/$${lib} \
47 || exit 1; \
48 done; \
49 done; \
50 ./support/scripts/expunge-gconv-modules "$(GCONV_LIBS)" \
51 <$(STAGING_DIR)/usr/lib/$${d}/gconv/gconv-modules \
52 >$(TARGET_DIR)/usr/lib/gconv/gconv-modules; \
54 endef
55 TOOLCHAIN_TARGET_FINALIZE_HOOKS += COPY_GCONV_LIBS
56 endif