Commit 14076af9 authored by FliegendeWurst's avatar FliegendeWurst
Browse files

anthy: fix cross build

parent d9e98537
Loading
Loading
Loading
Loading
+27 −0
Original line number Diff line number Diff line
@@ -2,12 +2,34 @@
  lib,
  stdenv,
  fetchurl,
  buildPackages,
}:

stdenv.mkDerivation rec {
  pname = "anthy";
  version = "9100h";

  postPatch = lib.optionalString (!stdenv.buildPlatform.canExecute stdenv.hostPlatform) ''
    # for cross builds, copy build tools from the native package
    cp -r "${buildPackages.anthy}"/lib/internals/{mkdepgraph,.libs} depgraph/
    cp -r "${buildPackages.anthy}"/lib/internals/{mkworddic,.libs} mkworddic/
    cp -r "${buildPackages.anthy}"/lib/internals/{calctrans,.libs} calctrans/
    cp -r "${buildPackages.anthy}"/lib/internals/{mkfiledic,.libs} mkanthydic/
    substituteInPlace mkworddic/Makefile.in \
      --replace-fail 'anthy.wdic : mkworddic' 'anthy.wdic : ' \
      --replace-fail 'all: ' 'all: anthy.wdic #'
    substituteInPlace calctrans/Makefile.in \
      --replace-fail '$(dict_source_files): $(srcdir)/corpus_info $(srcdir)/weak_words calctrans' \
                     '$(dict_source_files): $(srcdir)/corpus_info $(srcdir)/weak_words' \
      --replace-fail 'all-am: Makefile $(PROGRAMS) $(DATA)' 'all-am: $(DATA)'
    substituteInPlace depgraph/Makefile.in \
      --replace-fail 'anthy.dep : mkdepgraph' 'anthy.dep : ' \
      --replace-fail 'all-am: Makefile $(PROGRAMS) $(DATA)' 'all-am: $(DATA)'
    substituteInPlace mkanthydic/Makefile.in \
      --replace-fail 'anthy.dic : mkfiledic' 'anthy.dic : ' \
      --replace-fail 'all-am: Makefile $(PROGRAMS) $(SCRIPTS) $(DATA)' 'all-am: $(DATA)'
  '';

  meta = with lib; {
    description = "Hiragana text to Kana Kanji mixed text Japanese input method";
    homepage = "https://anthy.osdn.jp/";
@@ -16,6 +38,11 @@ stdenv.mkDerivation rec {
    platforms = platforms.unix;
  };

  postFixup = lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) ''
    mkdir "$out/lib/internals"
    cp -r depgraph/{mkdepgraph,.libs} mkworddic/{mkworddic,.libs} calctrans/{calctrans,.libs} mkanthydic/{mkfiledic,.libs} "$out/lib/internals"
  '';

  src = fetchurl {
    url = "mirror://osdn/anthy/37536/anthy-${version}.tar.gz";
    sha256 = "0ism4zibcsa5nl77wwi12vdsfjys3waxcphn1p5s7d0qy1sz0mnj";