diff mbox series

[bug#66049,v2,2/4] gnu: Add foma.

Message ID 167dc20d70d817afae1742aa587bc13ce7313609.1695678993.git.jussi.timperi@iki.fi
State New
Headers show
Series [bug#66049,v2,1/4] gnu: Add hfst-ospell. | expand

Commit Message

Jussi Timperi Sept. 26, 2023, 12:09 p.m. UTC
* gnu/packages/language.scm (foma): New variable.
---
 gnu/packages/language.scm | 54 +++++++++++++++++++++++++++++++++++++++
 1 file changed, 54 insertions(+)
diff mbox series

Patch

diff --git a/gnu/packages/language.scm b/gnu/packages/language.scm
index 241b145440..f2dd1aba2f 100644
--- a/gnu/packages/language.scm
+++ b/gnu/packages/language.scm
@@ -32,10 +32,12 @@  (define-module (gnu packages language)
   #:use-module (gnu packages audio)
   #:use-module (gnu packages backup)
   #:use-module (gnu packages base)
+  #:use-module (gnu packages bison)
   #:use-module (gnu packages compression)
   #:use-module (gnu packages dbm)
   #:use-module (gnu packages docbook)
   #:use-module (gnu packages emacs)
+  #:use-module (gnu packages flex)
   #:use-module (gnu packages freedesktop)
   #:use-module (gnu packages gettext)
   #:use-module (gnu packages glib)
@@ -55,6 +57,7 @@  (define-module (gnu packages language)
   #:use-module (gnu packages python)
   #:use-module (gnu packages perl-check)
   #:use-module (gnu packages qt)
+  #:use-module (gnu packages readline)
   #:use-module (gnu packages ruby)
   #:use-module (gnu packages scheme)
   #:use-module (gnu packages sqlite)
@@ -1212,3 +1215,54 @@  (define-public hfst-ospell
 optimized-lookup format based spell checker library and a demonstrational
 implementation of command line based spell checker.")
     (license license:asl2.0)))
+
+(define-public foma
+  (let ((commit "fe40aceea1797642dd1cf0fa61fd024c7a7f7095")
+        (revision "0"))
+    (package
+      (name "foma")
+      (version (git-version "0.10.0" revision commit))
+      (source (origin
+                (method git-fetch)
+                (uri (git-reference
+                      (url "https://github.com/mhulden/foma")
+                      (commit commit)))
+                (file-name (git-file-name name version))
+                (sha256
+                 (base32
+                  "1y6yjc72wh6gqqip6jjnrzwv95inr1kncnnfd144vfnvv9bj3msx"))))
+      (build-system cmake-build-system)
+      (arguments
+       (list
+        #:phases
+        #~(modify-phases %standard-phases
+            (add-after 'unpack 'chdir
+              (lambda _
+                (chdir "foma")))
+            (replace 'check
+              (lambda* (#:key tests? out-of-source? #:allow-other-keys)
+                (if tests?
+                    (let* ((builddir (getcwd))
+                           (srcdir (if out-of-source?
+                                       (string-append builddir "/../foma")
+                                       builddir))
+                           (testdir (string-append srcdir "/tests")))
+                      (with-directory-excursion testdir
+                        (setenv "PATH" (string-append builddir
+                                                      ":"
+                                                      (getenv "PATH")))
+                        (invoke "./run.sh")))
+                    (format #t "test suite not run~%")))))))
+      (inputs (list ncurses readline zlib))
+      (native-inputs (list bison flex pkg-config))
+      (home-page "https://fomafst.github.io/")
+      (synopsis "Finite-state compiler and C library")
+      (description
+       "Foma is a compiler, programming language, and C library for
+constructing finite-state automata and transducers for various uses.
+
+It has specific support for many natural language processing applications such
+as producing morphological analyzers.  Although NLP applications are probably
+the main use of foma, it is sufficiently generic to use for a large number of
+purposes.")
+      (license license:asl2.0))))