python311Packages.moto: 4.2.6 -> 4.2.10
[NixPkgs.git] / pkgs / build-support / setup-hooks / prune-libtool-files.sh
blob0ec56549645c36f481e753aaf61d88e554f82a9e
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
12 return
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" \;