nixpkgs-suyu/pkgs/os-specific/darwin/apple-source-releases/libiconv/default.nix

38 lines
1.3 KiB
Nix
Raw Normal View History

{ stdenv, appleDerivation, lib
, enableStatic ? stdenv.hostPlatform.isStatic
, enableShared ? !stdenv.hostPlatform.isStatic
}:
appleDerivation {
postUnpack = "sourceRoot=$sourceRoot/libiconv";
2016-10-06 20:56:32 +02:00
preConfigure = lib.optionalString stdenv.hostPlatform.isiOS ''
sed -i 's/darwin\*/ios\*/g' configure libcharset/configure
'';
2016-10-06 20:56:32 +02:00
configureFlags = [
(lib.enableFeature enableStatic "static")
(lib.enableFeature enableShared "shared")
];
postInstall = lib.optionalString enableShared ''
2016-10-06 20:56:32 +02:00
mv $out/lib/libiconv.dylib $out/lib/libiconv-nocharset.dylib
${stdenv.cc.bintools.targetPrefix}install_name_tool -id $out/lib/libiconv-nocharset.dylib $out/lib/libiconv-nocharset.dylib
2016-10-06 20:56:32 +02:00
# re-export one useless symbol; ld will reject a dylib that only reexports other dylibs
echo 'void dont_use_this(){}' | ${stdenv.cc.bintools.targetPrefix}clang -dynamiclib -x c - -current_version 2.4.0 \
2016-10-06 20:56:32 +02:00
-compatibility_version 7.0.0 -current_version 7.0.0 -o $out/lib/libiconv.dylib \
-Wl,-reexport_library -Wl,$out/lib/libiconv-nocharset.dylib \
-Wl,-reexport_library -Wl,$out/lib/libcharset.dylib
'';
setupHooks = [
../../../../build-support/setup-hooks/role.bash
../../../../development/libraries/libiconv/setup-hook.sh
];
2018-03-14 22:55:27 +01:00
meta = {
platforms = lib.platforms.darwin;
};
}