[Buildroot] [PATCH v2] Makefile: respect strip exclusions for special libraries
Yann E. MORIN
yann.morin.1998 at free.fr
Mon Jul 2 21:04:11 UTC 2018
Thomas, John, All,
On 2018-07-02 22:25 +0200, Thomas Petazzoni spake thusly:
> [...] I find this whole thing pretty complex/noisy. Can we do
> better ?
>
> Here is some untested initial proposal:
>
> # When stripping, obey to BR2_STRIP_EXCLUDE_DIRS and
> # BR2_STRIP_EXCLUDE_FILES
> STRIP_FIND_COMMON_CMD = \
> find $(TARGET_DIR) \
> $(if $(call qstrip,$(BR2_STRIP_EXCLUDE_DIRS)),, \
> \( $(call finddirclauses,$(TARGET_DIR),$(call qstrip,$(BR2_STRIP_EXCLUDE_DIRS))) \) -prune -o
> ) \
> -not $(call findfileclauses,$(call qstrip,$(BR2_STRIP_EXCLUDE_FILES))) \) \
> -print0
>
> # Regular stripping for everything, except libpthread, ld-*.so and
> # kernel modules.
> STRIP_FIND_CMD = \
> $(STRIP_FIND_COMMON_CMD) \
> -type f \( -perm /111 -o -name '*.so*' \) \
> -not \( $(call findfileclauses,libpthread*.so* ld-*.so* *.ko) \)
>
> # Special stripping (only debugging symbols) for libpthread and ld-*.so.
> STRIP_FIND_SPECIAL_LIBS_CMD = \
> $(STRIP_FIND_COMMON_CMD) \
> \( -name 'ld-*.so*' -o -name 'libpthread*.so*' \)
>
> And then:
>
> $(STRIP_FIND_CMD) | xargs -0 $(STRIPCMD) 2>/dev/null || true
> $(STRIP_FIND_SPECIAL_LIBS_CMD) | xargs -0 $(STRIPCMD) $(STRIP_STRIP_DEBUG) || true
>
> Thoughts ?
Not tested, but it really looks nice.
Regards,
Yann E. MORIN.
--
.-----------------.--------------------.------------------.--------------------.
| Yann E. MORIN | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software Designer | \ / CAMPAIGN | ___ |
| +33 223 225 172 `------------.-------: X AGAINST | \e/ There is no |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL | v conspiracy. |
'------------------------------^-------^------------------^--------------------'
More information about the buildroot
mailing list