(use-modules (guix packages)) (use-modules (guix download)) (use-modules (guix git-download)) (use-modules (guix build-system dune)) (use-modules (gnu packages ocaml)) (use-modules ((guix licenses) #:prefix license:)) (define-public ocaml-compiler-libs (package (name "ocaml-compiler-libs") (version "0.12.3") (home-page "https://github.com/janestreet/ocaml-compiler-libs") (source (origin (method git-fetch) (uri (git-reference (url (string-append home-page ".git")) (commit (string-append "v" version)))) (file-name (git-file-name name version)) (sha256 (base32 "00nrar7h2pyflbdiq6wwwrb4k5jh9iff0jllihzm6ms8d5pspsg5")))) (build-system dune-build-system) (arguments `(#:tests? #f)) (properties `((upstream-name . "ocaml-compiler-libs"))) (synopsis "Compiler libraries repackaged") (description "This package simply repackages the OCaml compiler libraries so they don't expose everything at toplevel. For instance, @code{Ast_helper} is now @code{Ocaml_common.Ast_helper}.") (license license:expat))) (define-public ocaml-migrate-parsetree (package (name "ocaml-migrate-parsetree") (version "1.8.0") (home-page "https://github.com/ocaml-ppx/ocaml-migrate-parsetree") (source (origin (method git-fetch) (uri (git-reference (url (string-append home-page ".git")) (commit (string-append "v" version)))) (file-name (git-file-name name version)) (sha256 (base32 "16x8sxc4ygxrr1868qpzfqyrvjf3hfxvjzmxmf6ibgglq7ixa2nq")))) (build-system dune-build-system) (arguments `(#:tests? #f)) (propagated-inputs `(("ocaml-ppx-derivers" ,ocaml-ppx-derivers) ("ocamlbuild" ,ocamlbuild) ("ocaml-result" ,ocaml-result))) (properties `((upstream-name . "ocaml-migrate-parsetree"))) (synopsis "OCaml parsetree converter") (description "This library converts between parsetrees of different OCaml versions. For each version, there is a snapshot of the parsetree and conversion functions to the next and/or previous version.") (license license:lgpl2.1+))) (define-public ocaml-ppxlib (package (name "ocaml-ppxlib") (version "0.20.0") (home-page "https://github.com/ocaml-ppx/ppxlib") (source (origin (method git-fetch) (uri (git-reference (url (string-append home-page ".git")) (commit version))) (file-name (git-file-name name version)) (sha256 (base32 "0nwwvh58hf18wpfh6i5mgsykiaw0rj9vy5id4xmja36s3pm5bcn3")))) (build-system dune-build-system) (propagated-inputs `(("ocaml-ppx-derivers" ,ocaml-ppx-derivers) ("ocaml-compiler-libs" ,ocaml-compiler-libs) ("ocaml-stdlib-shims" ,ocaml-stdlib-shims) ("ocaml-migrate-parsetree" ,ocaml-migrate-parsetree) ("ocaml-sexplib0" ,ocaml-sexplib0))) (arguments `(#:phases (modify-phases %standard-phases (add-before 'check 'set-topfind (lambda* (#:key inputs #:allow-other-keys) ;; add the line #directory ".." at the top of each file ;; using #use "topfind";; to be able to find topfind (let* ((findlib-path (assoc-ref inputs "findlib")) (findlib-libdir (string-append findlib-path "/lib/ocaml/site-lib"))) (substitute* '("test/base/test.ml" "test/code_path/test.ml" "test/deriving/test.ml" "test/driver/attributes/test.ml" "test/driver/non-compressible-suffix/test.ml" "test/driver/transformations/test.ml") (("#use \"topfind\";;" all) (string-append "#directory \"" findlib-libdir "\"\n" all)))) #t))))) (synopsis "Base library and tools for ppx rewriters") (description "A comprehensive toolbox for ppx development. It features: @itemize @item an OCaml AST / parser / pretty-printer snapshot, to create a full frontend independent of the version of OCaml; @item a library for library for ppx rewriters in general, and type-driven code generators in particular; @item a feature-full driver for OCaml AST transformers; @item a quotation mechanism allowing to write values representing the OCaml AST in the OCaml syntax; @item a generator of open recursion classes from type definitions. @end itemize") (license license:expat))) (package (name "ocaml-js-of-ocaml") (version "3.8.0") (source (origin (method git-fetch) (uri (git-reference (url "https://github.com/ocsigen/js_of_ocaml") (commit version))) (file-name (git-file-name name version)) (sha256 (base32 "1ls3nhavhifsfwwz45k4xw91ml9zi6rnkfp3175b2havbavbzral")))) (build-system dune-build-system) (propagated-inputs `(("ocaml-ppxlib" ,ocaml-ppxlib) ("ocaml-uchar" ,ocaml-uchar) ("ocaml-menhir" ,ocaml-menhir) ("ocaml-reactivedata" ,ocaml-reactivedata) ("ocaml-cmdliner" ,ocaml-cmdliner) ("ocaml-lwt" ,ocaml-lwt) ("ocaml-tyxml" ,ocaml-tyxml))) (properties `((upstream-name . "js_of_ocaml"))) (home-page "http://ocsigen.github.io/js_of_ocaml") (synopsis "Compiler from OCaml bytecode to Javascript") (description "Js_of_ocaml is a compiler from OCaml bytecode to JavaScript. It makes it possible to run pure OCaml programs in JavaScript environment like browsers and Node.js ") (license #f))