Unverified Commit 3ea8f62a authored by Pol Dellaiera's avatar Pol Dellaiera Committed by GitHub
Browse files

Merge pull request #238378 from Lurkki14/lurkki/omorfi

omorfi: init at 0.9.9
parents ef4a59fa a7e43128
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -9963,6 +9963,12 @@
    githubId = 782440;
    name = "Luna Nova";
  };
  lurkki = {
    email = "jussi.kuokkanen@protonmail.com";
    github = "Lurkki14";
    githubId = 44469719;
    name = "Jussi Kuokkanen";
  };
  lux = {
    email = "lux@lux.name";
    github = "luxzeitlos";
+46 −0
Original line number Diff line number Diff line
{ lib
, stdenv
, autoreconfHook
, fetchFromGitHub
, icu
, libarchive
, pkg-config
}:

stdenv.mkDerivation (finalAttrs: {
  pname = "hfst-ospell";
  version = "0.5.3";

  src = fetchFromGitHub {
    owner = "hfst";
    repo = "hfst-ospell";
    rev = "refs/tags/v${finalAttrs.version}";
    hash = "sha256-16H1nbAIe+G71+TnlLG0WnH9LktZwmc0d0O+oYduH1k=";
  };

  buildInputs = [
    icu
    libarchive
  ];

  nativeBuildInputs = [
    autoreconfHook
    pkg-config
  ];

  # libxmlxx is listed as a dependency but Darwin build fails with it,
  # might also be better in general since libxmlxx in Nixpkgs is 8 years old
  # https://github.com/hfst/hfst-ospell/issues/48#issuecomment-546535653
  configureFlags = [
    "--without-libxmlpp"
    "--without-tinyxml2"
  ];

  meta = with lib; {
    homepage = "https://github.com/hfst/hfst-ospell/";
    description = "HFST spell checker library and command line tool ";
    license = licenses.asl20;
    maintainers = with maintainers; [ lurkki ];
    platforms = platforms.unix;
  };
})
+53 −0
Original line number Diff line number Diff line
{ lib
, autoreconfHook
, bison
, flex
, foma
, fetchFromGitHub
, gettext
, icu
, stdenv
, swig
, pkg-config
, zlib
}:

stdenv.mkDerivation (finalAttrs: {
  pname = "hfst";
  version = "3.16.0";

  src = fetchFromGitHub {
    owner = "hfst";
    repo = "hfst";
    rev = "refs/tags/v${finalAttrs.version}";
    hash = "sha256-2ST0s08Pcp+hTn7rUTgPE1QkH6PPWtiuFezXV3QW0kU=";
  };

  nativeBuildInputs = [
    autoreconfHook
    bison
    flex
    pkg-config
    swig
  ];

  buildInputs = [
    foma
    gettext
    icu
    zlib
  ];

  configureFlags = [
    "--enable-all-tools"
    "--with-foma-upstream=true"
  ];

  meta = with lib; {
    description = "FST language processing library";
    homepage = "https://github.com/hfst/hfst";
    license = licenses.gpl3Plus;
    maintainers = with maintainers; [ lurkki ];
    platforms = platforms.unix;
  };
})
+40 −0
Original line number Diff line number Diff line
{ stdenv
, lib
, autoreconfHook
, hfst-ospell
, fetchFromGitHub
, pkg-config
, python3
}:

stdenv.mkDerivation (finalAttrs: {
  pname = "libvoikko";
  version = "4.3.2";

  src = fetchFromGitHub {
    owner = "voikko";
    repo = "corevoikko";
    rev = "refs/tags/rel-libvoikko-${finalAttrs.version}";
    hash = "sha256-0MIQ54dCxyAfdgYWmmTVF+Yfa15K2sjJyP1JNxwHP2M=";
  };

  sourceRoot = "${finalAttrs.src.name}/libvoikko";

  nativeBuildInputs = [
    autoreconfHook
    pkg-config
    python3
  ];

  buildInputs = [
    hfst-ospell
  ];

  meta = with lib; {
    homepage = "https://voikko.puimula.org/";
    description = "Finnish language processing library";
    license = licenses.lgpl21Plus;
    maintainers = with maintainers; [ lurkki ];
    platforms = platforms.unix;
  };
})
+81 −0
Original line number Diff line number Diff line
{ lib
, stdenv
, autoreconfHook
, cg3
, fetchFromGitHub
, hfst
, hfst-ospell
, icu
, libvoikko
, makeWrapper
, pkg-config
, python3
, zip
}:

stdenv.mkDerivation (finalAttrs: {
  pname = "omorfi";
  version = "0.9.9";

  src = fetchFromGitHub {
    owner = "flammie";
    repo = "omorfi";
    rev = "refs/tags/v${finalAttrs.version}";
    hash = "sha256-UoqdwNWCNOPX6u1YBlnXUcB/fmcvcy/HXbYciVrMBOY=";
  };

  # Fix for omorfi-hyphenate.sh file not found error
  postInstall = ''
    ln -s $out/share/omorfi/{omorfi.hyphenate-rules.hfst,omorfi.hyphenate.hfst}
  '';

  nativeBuildInputs = [
    autoreconfHook
    cg3
    makeWrapper
    pkg-config
    python3
    zip
    python3.pkgs.wrapPython
  ];

  buildInputs = [
    python3.pkgs.hfst
    hfst-ospell
    libvoikko
  ];

  # Supplied pkg-config file doesn't properly expose these
  propagatedBuildInputs = [
    hfst
    icu
  ];

  # Wrap shell scripts so they find the Python scripts
  # omorfi.bash inexplicably fails when wrapped
  preFixup = ''
    wrapPythonProgramsIn "$out/bin" "$out ${python3.pkgs.hfst}"
    for i in "$out/bin"/*.{sh,bash}; do
      if [ $(basename "$i") != "omorfi.bash" ]; then
        wrapProgram "$i" --prefix "PATH" : "$out/bin/"
      fi
    done
  '';

  # Enable all features
  configureFlags = [
    "--enable-labeled-segments"
    "--enable-lemmatiser"
    "--enable-segmenter"
    "--enable-hyphenator"
  ];

  meta = with lib; {
    description = "Analysis for Finnish text";
    homepage = "https://github.com/flammie/omorfi";
    license = licenses.gpl3;
    maintainers = with maintainers; [ lurkki ];
    # Darwin build fails due to hfst not being found
    broken = stdenv.isDarwin;
  };
})
Loading