Merge pull request #212171 from alyssais/iconv

iconv: init (portable attribute for iconv(1))
This commit is contained in:
John Ericson 2023-02-01 09:51:18 -05:00 committed by GitHub
commit d35fb99d2d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 13 additions and 15 deletions

View File

@ -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

View File

@ -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") ];

View File

@ -21331,6 +21331,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;