iconv: init (portable attribute for iconv(1))
This obsoletes this pattern: if stdenv.isDarwin then libiconv else buildPackages.stdenv.cc.libc Which was not portable, as some platforms don't have libiconv in libc, and some of those that do still don't have iconv(1) in their libc package.
This commit is contained in:
parent
4e9efbd52a
commit
e525b687f4
3 changed files with 13 additions and 15 deletions
|
@ -1,4 +1,4 @@
|
|||
{ lib, stdenv, fetchurl, buildPackages, libiconv, skktools }:
|
||||
{ lib, stdenv, fetchurl, buildPackages, iconv, skktools }:
|
||||
|
||||
let
|
||||
# kana to kanji
|
||||
|
@ -25,15 +25,13 @@ let
|
|||
url = "https://raw.githubusercontent.com/skk-dev/dict/8b35d07a7d2044d48b063d2774d9f9d00bb7cb48/SKK-JISYO.assoc";
|
||||
sha256 = "1smcbyv6srrhnpl7ic9nqds9nz3g2dgqngmhzkrdlwmvcpvakp1v";
|
||||
};
|
||||
|
||||
iconvBin = if stdenv.isDarwin then libiconv else buildPackages.stdenv.cc.libc;
|
||||
in
|
||||
|
||||
stdenv.mkDerivation {
|
||||
pname = "skk-dicts-unstable";
|
||||
version = "2020-03-24";
|
||||
srcs = [ small medium large edict assoc ];
|
||||
nativeBuildInputs = [ skktools ] ++ lib.optional stdenv.isDarwin libiconv;
|
||||
nativeBuildInputs = [ iconv skktools ];
|
||||
|
||||
strictDeps = true;
|
||||
|
||||
|
@ -51,8 +49,7 @@ stdenv.mkDerivation {
|
|||
for src in $srcs; do
|
||||
dst=$out/share/$(dictname $src)
|
||||
echo ";;; -*- coding: utf-8 -*-" > $dst # libskk requires this on the first line
|
||||
${lib.getBin iconvBin}/bin/iconv \
|
||||
-f EUC-JP -t UTF-8 $src | skkdic-expr2 >> $dst
|
||||
iconv -f EUC-JP -t UTF-8 $src | skkdic-expr2 >> $dst
|
||||
done
|
||||
|
||||
# combine .L .edict and .assoc for convenience
|
||||
|
|
|
@ -1,11 +1,8 @@
|
|||
{ lib, stdenv, fetchFromGitHub, buildPackages
|
||||
, libiconv, nkf, perl, which
|
||||
, iconv, nkf, perl, which
|
||||
, skk-dicts
|
||||
}:
|
||||
|
||||
let
|
||||
iconvBin = if stdenv.isDarwin then libiconv else buildPackages.stdenv.cc.libc;
|
||||
in
|
||||
stdenv.mkDerivation {
|
||||
pname = "cmigemo";
|
||||
version = "1.3e";
|
||||
|
@ -17,7 +14,7 @@ stdenv.mkDerivation {
|
|||
sha256 = "00a6kdmxp16b8x0p04ws050y39qspd1bqlfq74bkirc55b77a2m1";
|
||||
};
|
||||
|
||||
nativeBuildInputs = [ libiconv nkf perl which ];
|
||||
nativeBuildInputs = [ iconv nkf perl which ];
|
||||
|
||||
postUnpack = ''
|
||||
cp ${skk-dicts}/share/SKK-JISYO.L source/dict/
|
||||
|
@ -27,10 +24,6 @@ stdenv.mkDerivation {
|
|||
|
||||
makeFlags = [ "INSTALL=install" ];
|
||||
|
||||
preBuild = ''
|
||||
makeFlagsArray+=(FILTER_UTF8="${lib.getBin iconvBin}/bin/iconv -t utf-8 -f cp932")
|
||||
'';
|
||||
|
||||
buildFlags = [ (if stdenv.isDarwin then "osx-all" else "gcc-all") ];
|
||||
|
||||
installTargets = [ (if stdenv.isDarwin then "osx-install" else "gcc-install") ];
|
||||
|
|
|
@ -21163,6 +21163,14 @@ with pkgs;
|
|||
|
||||
libiconvReal = callPackage ../development/libraries/libiconv { };
|
||||
|
||||
iconv =
|
||||
if lib.elem stdenv.hostPlatform.libc [ "glibc" "musl" ] then
|
||||
lib.getBin stdenv.cc.libc
|
||||
else if stdenv.hostPlatform.isDarwin then
|
||||
lib.getBin darwin.libiconv
|
||||
else
|
||||
lib.getBin libiconvReal;
|
||||
|
||||
# On non-GNU systems we need GNU Gettext for libintl.
|
||||
libintl = if stdenv.hostPlatform.libc != "glibc" then gettext else null;
|
||||
|
||||
|
|
Loading…
Reference in a new issue