GNU bug report logs - #67019
[PATCH 00/16] gnu: Add KaTeX, lessc, and flow-remove-types.

Previous Next

Package: guix-patches;

Reported by: Philip McGrath <philip <at> philipmcgrath.com>

Date: Thu, 9 Nov 2023 16:09:02 UTC

Severity: normal

Tags: patch

Full log


View this message in rfc822 format

From: Liliana Marie Prikler <liliana.prikler <at> gmail.com>
To: Philip McGrath <philip <at> philipmcgrath.com>, 67019 <at> debbugs.gnu.org
Subject: [bug#67019] [PATCH v2 09/16] gnu: Add ocaml-flow-parser.
Date: Thu, 16 Nov 2023 21:29:09 +0100
Am Donnerstag, dem 16.11.2023 um 14:15 -0500 schrieb Philip McGrath:
> * gnu/packages/web.scm (ocaml-flow-parser): New variable.
> ---
>  gnu/packages/web.scm | 95
> ++++++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 95 insertions(+)
> 
> diff --git a/gnu/packages/web.scm b/gnu/packages/web.scm
> index 9efc6ebc9d..b222c2ae40 100644
> --- a/gnu/packages/web.scm
> +++ b/gnu/packages/web.scm
> @@ -96,6 +96,7 @@ (define-module (gnu packages web)
>    #:use-module (guix build-system cargo)
>    #:use-module (guix build-system cmake)
>    #:use-module (guix build-system copy)
> +  #:use-module (guix build-system dune)
>    #:use-module (guix build-system glib-or-gtk)
>    #:use-module (guix build-system gnu)
>    #:use-module (guix build-system go)
> @@ -173,6 +174,7 @@ (define-module (gnu packages web)
>    #:use-module (gnu packages node)
>    #:use-module (gnu packages node-xyz)
>    #:use-module (gnu packages nss)
> +  #:use-module (gnu packages ocaml)
>    #:use-module (gnu packages openldap)
>    #:use-module (gnu packages openstack)
>    #:use-module (gnu packages package-management)
> @@ -1938,6 +1940,99 @@ (define-public esbuild
>  and other data, for distribution on the web.")
>      (license license:expat)))
>  
> +(define-public ocaml-flow-parser
> +  (package
> +    (name "ocaml-flow-parser")
> +    (version "0.159.0")
> +    (outputs '("out" "js"))
> +    (source
> +     (origin
> +       (method git-fetch)
> +       (uri (git-reference
> +             (url "https://github.com/facebook/flow")
> +             (commit (string-append "v" version))))
> +       (sha256
> +        (base32
> "1i9svf641s24nj4w6y9vvglzg29h0lr4n9a6mvwrn9psy9x1lril"))
> +       (file-name (git-file-name "flow" version))))
> +    (build-system dune-build-system)
> +    (propagated-inputs (list ocaml-base
> +                             ocaml-core-kernel
> +                             ocaml-dtoa
> +                             ocaml-sedlex
> +                             ocaml-wtf8))
> +    (native-inputs (list js-of-ocaml
> +                         ocamlbuild
> +                         ocaml-findlib
> +                         ocaml-ounit2
> +                         ocaml-ppx-deriving
> +                         ocaml-ppx-gen-rec
> +                         ocaml-visitors))
> +    (arguments
> +     (list
> +      #:tests? #f ; tests need lwt_ppx
> +      #:package "flow_parser"
> +      #:phases
> +      #~(modify-phases %standard-phases
> +          (add-before 'build 'chdir
> +            (lambda args
> +              (chdir "src/parser")))
> +          (add-before 'build 'patch-source
> +            (lambda args
> +              ;; Avoid errors with newer OCaml:
> +              ;; "Error (warning 16 [unerasable-optional-
> argument]):"
> +              ;;   " this optional argument cannot be erased."
> +              ;; "Error (warning 69 [unused-field]):"
> +              ;;   " mutable record field buf is never mutated."
> +              ;; "Error (warning 70 [missing-mli]): Cannot find
> interface file."
> +              (substitute* "_tags"
> +                (("<\\*\\.ml\\*>: warn[(]-39[)]")
> +                 "<*.ml*>: warn(-16-39-70)"))
> +              (substitute* "../../_tags"
> +                (("<\\*\\*/\\*.ml\\*>: ")
> +                 "<**/*.ml*>: warn(-69), "))
> +              ;; Deprecation of Js.Unsafe.variable, Js.Error,
> Js.raise_js_error
> +              (substitute* "flow_parser_js.ml"
> +                (("Js\\.Unsafe\\.variable")
> +                 "Js.Unsafe.pure_js_expr"))
> +              (substitute* "flow_parser_dot_js.ml"
> +                (("Js\\.Error")
> +                 "Js_of_ocaml.Js_error.Exn")
> +                (("Js\\.raise_js_error")
> +                 "Js_of_ocaml.Js_error.raise_"))))
> +          (replace 'build
> +            (lambda args
> +              (invoke "make"
> +                      (string-append "CC=" #$(cc-for-target))
> +                      "build-parser")))
You might want to let-bind (invoke "make" "CC=..." <>) so that you can
call it with a single argument in this and other phases.
> +          (add-after 'build 'build-js
> +            (lambda args
> +              (invoke "make"
> +                      (string-append "CC=" #$(cc-for-target))
> +                      "js")))
> +          (replace 'check
> +            (lambda* (#:key tests? #:allow-other-keys)
> +              (when tests?
> +                (invoke "make"
> +                        (string-append "CC=" #$(cc-for-target))
> +                        "test-ocaml"))))
> +          (replace 'install
> +            (lambda args
> +              (invoke "make"
> +                      (string-append "CC=" #$(cc-for-target))
> +                      "ocamlfind-install")))
> +          (add-after 'install 'install-js
> +            (lambda args
> +              (install-file "flow_parser.js"
> +                            (string-append #$output:js
> +                                          
> "/share/javascript/flow")))))))
> +    (properties `((upstream-name . "flow_parser")))
> +    (home-page "https://flow.org")
> +    (synopsis "Parser for the Flow JavaScript type system")
> +    (description "Flow is a gradual type system for JavaScript. 
> This package
> +provides the Flow parser, which is an OCaml library that can also be
> compiled
> +to JavaScript.")
> +    (license license:expat)))
> +
Cheers

This bug report was last modified 1 year and 267 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.