···81 preBuild = ''
82 mkdir -p $out/
83 ln -sv $PWD/lib $out
84+ ''
85+ + # This is a good candidate for using the `placeholder` primitive when it's released
86+ # This should hopefully be unnecessary once
87+ # https://github.com/NixOS/nixpkgs/pull/25047 is merged
88+ stdenv.lib.optionalString (buildPlatform != hostPlatform && enableSharedLibraries) ''
89+ export NIX_CROSS_LDFLAGS="-rpath $lib/lib -rpath $lib/lib64 $NIX_CROSS_LDFLAGS"
90 '';
9192 cmakeFlags = with stdenv; [