1 # Clear dependency_libs in libtool files for shared libraries.
3 # Shared libraries already encode their dependencies with locations. .la
4 # files do not always encode those locations, and sometimes encode the
5 # locations in the wrong Nix output. .la files are not needed for shared
6 # libraries, but without dependency_libs they do not hurt either.
8 fixupOutputHooks
+=(_pruneLibtoolFiles
)
10 _pruneLibtoolFiles
() {
11 if [ "${dontPruneLibtoolFiles-}" ] ||
[ ! -e "$prefix" ]; then
15 # Libtool uses "dlname" and "library_names" fields for shared libraries and
16 # the "old_library" field for static libraries. We are processing only
17 # those .la files that do not describe static libraries.
18 find "$prefix" -type f
-name '*.la' \
19 -exec grep -q '^# Generated by .*libtool' {} \
; \
20 -exec grep -q "^old_library=''" {} \
; \
21 -exec sed -i {} -e "/^dependency_libs='[^']/ c dependency_libs='' #pruned" \
;