2024-05-02 00:46:19 +00:00
|
|
|
{ ... }:
|
|
|
|
res: pkgs: super:
|
|
|
|
|
2024-06-30 08:12:46 +00:00
|
|
|
with pkgs; {
|
2024-05-02 00:46:19 +00:00
|
|
|
# GNU libc provides libiconv so systems with glibc don't need to
|
|
|
|
# build libiconv separately. Additionally, Apple forked/repackaged
|
|
|
|
# libiconv so we use that instead of the vanilla version on that OS,
|
|
|
|
# and BSDs include libiconv in libc.
|
|
|
|
#
|
|
|
|
# We also provide `libiconvReal`, which will always be a standalone libiconv,
|
|
|
|
# just in case you want it regardless of platform.
|
|
|
|
libiconv =
|
2024-06-30 08:12:46 +00:00
|
|
|
if
|
|
|
|
lib.elem stdenv.hostPlatform.libc [
|
|
|
|
"glibc"
|
|
|
|
"musl"
|
|
|
|
"nblibc"
|
|
|
|
"wasilibc"
|
|
|
|
]
|
2024-05-02 00:46:19 +00:00
|
|
|
then
|
2024-06-30 08:12:46 +00:00
|
|
|
libcIconv (if stdenv.hostPlatform != stdenv.buildPlatform then libcCross else stdenv.cc.libc)
|
2024-05-02 00:46:19 +00:00
|
|
|
# else if stdenv.hostPlatform.isDarwin
|
|
|
|
# then darwin.libiconv
|
2024-06-30 08:12:46 +00:00
|
|
|
else
|
|
|
|
libiconvReal;
|
2024-05-02 00:46:19 +00:00
|
|
|
|
2024-06-30 08:12:46 +00:00
|
|
|
libcIconv =
|
|
|
|
libc:
|
2024-05-02 00:46:19 +00:00
|
|
|
let
|
|
|
|
inherit (libc) pname version;
|
|
|
|
libcDev = lib.getDev libc;
|
|
|
|
in
|
|
|
|
runCommand "${pname}-iconv-${version}" { strictDeps = true; } ''
|
|
|
|
mkdir -p $out/include
|
|
|
|
ln -sv ${libcDev}/include/iconv.h $out/include
|
|
|
|
'';
|
|
|
|
|
|
|
|
libiconvReal = callPackage ./. { };
|
|
|
|
|
|
|
|
iconv =
|
2024-06-30 08:12:46 +00:00
|
|
|
if
|
|
|
|
lib.elem stdenv.hostPlatform.libc [
|
|
|
|
"glibc"
|
|
|
|
"musl"
|
|
|
|
]
|
|
|
|
then
|
2024-05-02 00:46:19 +00:00
|
|
|
lib.getBin stdenv.cc.libc
|
|
|
|
else if stdenv.hostPlatform.isDarwin then
|
|
|
|
lib.getBin darwin.libiconv
|
|
|
|
else
|
|
|
|
lib.getBin libiconvReal;
|
|
|
|
}
|