2018-08-20 20:43:41 +02:00
|
|
|
{ stdenv, appleDerivation, lib
|
|
|
|
, enableStatic ? stdenv.targetPlatform.isiOS
|
|
|
|
, enableShared ? !stdenv.targetPlatform.isiOS
|
2018-06-23 03:49:41 +02:00
|
|
|
}:
|
2015-02-08 07:53:52 +01:00
|
|
|
|
|
|
|
appleDerivation {
|
2018-05-01 05:42:44 +02:00
|
|
|
postUnpack = "sourceRoot=$sourceRoot/libiconv";
|
2016-10-06 20:56:32 +02:00
|
|
|
|
2018-06-23 03:49:41 +02:00
|
|
|
preConfigure = lib.optionalString stdenv.hostPlatform.isiOS ''
|
2018-05-16 21:16:08 +02:00
|
|
|
sed -i 's/darwin\*/ios\*/g' configure libcharset/configure
|
|
|
|
'';
|
2016-10-06 20:56:32 +02:00
|
|
|
|
2018-07-03 22:51:30 +02:00
|
|
|
configureFlags = [
|
|
|
|
(lib.enableFeature enableStatic "static")
|
|
|
|
(lib.enableFeature enableShared "shared")
|
|
|
|
];
|
2018-06-07 16:53:02 +02:00
|
|
|
|
2018-06-23 03:49:41 +02:00
|
|
|
postInstall = lib.optionalString (!enableStatic) ''
|
2016-10-06 20:56:32 +02:00
|
|
|
mv $out/lib/libiconv.dylib $out/lib/libiconv-nocharset.dylib
|
2018-05-01 05:42:44 +02:00
|
|
|
${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
|
2018-05-01 05:42:44 +02:00
|
|
|
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
|
|
|
|
'';
|
2017-09-04 18:04:05 +02:00
|
|
|
|
2018-05-23 20:09:45 +02:00
|
|
|
setupHooks = [
|
|
|
|
../../../../build-support/setup-hooks/role.bash
|
|
|
|
../../../../development/libraries/libiconv/setup-hook.sh
|
|
|
|
];
|
2018-03-14 22:55:27 +01:00
|
|
|
|
2017-09-04 18:04:05 +02:00
|
|
|
meta = {
|
2018-06-23 03:49:41 +02:00
|
|
|
platforms = lib.platforms.darwin;
|
2017-09-04 18:04:05 +02:00
|
|
|
};
|
2015-02-08 07:53:52 +01:00
|
|
|
}
|