nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1# Clear dependency_libs in libtool files for shared libraries.
2
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.
7
8fixupOutputHooks+=(_pruneLibtoolFiles)
9
10_pruneLibtoolFiles() {
11 if [ "${dontPruneLibtoolFiles-}" ] || [ ! -e "$prefix" ]; then
12 return
13 fi
14
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" \;
22}