diff options
author | Vladimír Čunát <vcunat@gmail.com> | 2017-03-15 19:09:33 +0100 |
---|---|---|
committer | Vladimír Čunát <vcunat@gmail.com> | 2017-03-15 19:09:56 +0100 |
commit | e99bc64552fae15668ddcd98749e1ce4c4fe24f7 (patch) | |
tree | 3ceb06e37d44412705b19655011d19397f750a09 /pkgs/build-support | |
parent | 20d9edff1723363b0df1d7f44301cefffd8b3881 (diff) | |
parent | 6505c6e3df519bbf800f302e9ba14923b9dabee5 (diff) | |
download | nixlib-e99bc64552fae15668ddcd98749e1ce4c4fe24f7.tar nixlib-e99bc64552fae15668ddcd98749e1ce4c4fe24f7.tar.gz nixlib-e99bc64552fae15668ddcd98749e1ce4c4fe24f7.tar.bz2 nixlib-e99bc64552fae15668ddcd98749e1ce4c4fe24f7.tar.lz nixlib-e99bc64552fae15668ddcd98749e1ce4c4fe24f7.tar.xz nixlib-e99bc64552fae15668ddcd98749e1ce4c4fe24f7.tar.zst nixlib-e99bc64552fae15668ddcd98749e1ce4c4fe24f7.zip |
Merge branch 'master' into staging
More larger rebuilds from master, unfortunately.
Diffstat (limited to 'pkgs/build-support')
-rw-r--r-- | pkgs/build-support/setup-hooks/fix-darwin-frameworks.sh | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/pkgs/build-support/setup-hooks/fix-darwin-frameworks.sh b/pkgs/build-support/setup-hooks/fix-darwin-frameworks.sh new file mode 100644 index 000000000000..e3a08b2598d9 --- /dev/null +++ b/pkgs/build-support/setup-hooks/fix-darwin-frameworks.sh @@ -0,0 +1,31 @@ +# On Mac OS X, frameworks are linked to the system CoreFoundation but +# dynamic libraries built with nix use a pure version of CF this +# causes segfaults for binaries that depend on it at runtime. This +# can be solved in two ways. +# 1. Rewrite references to the pure CF using this setup hook, this +# works for the simple case but this can still cause problems if other +# dependencies (eg. python) use the pure CF. +# 2. Create a wrapper for the binary that sets DYLD_FRAMEWORK_PATH to +# /System/Library/Frameworks. This will make everything load the +# system's CoreFoundation framework while still keeping the +# dependencies pure for other packages. + +fixupOutputHooks+=('fixDarwinFrameworksIn $prefix') + +fixDarwinFrameworks() { + local systemPrefix='/System/Library/Frameworks' + + for fn in "$@"; do + if [ -L "$fn" ]; then continue; fi + echo "$fn: fixing dylib" + + for framework in $(otool -L "$fn" | awk '/CoreFoundation\.framework/ {print $1}'); do + install_name_tool -change "$framework" "$systemPrefix/CoreFoundation.framework/Versions/A/CoreFoundation" "$fn" >&2 + done + done +} + +fixDarwinFrameworksIn() { + local dir="$1" + fixDarwinFrameworks $(find "$dir" -name "*.dylib") +} |