;;; GNU Guix --- Functional package management for GNU ;;; Copyright © 2023 Liliana Marie Prikler ;;; ;;; This file is part of GNU Guix. ;;; ;;; GNU Guix is free software; you can redistribute it and/or modify it ;;; under the terms of the GNU General Public License as published by ;;; the Free Software Foundation; either version 3 of the License, or (at ;;; your option) any later version. ;;; ;;; GNU Guix is distributed in the hope that it will be useful, but ;;; WITHOUT ANY WARRANTY; without even the implied warranty of ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;;; GNU General Public License for more details. ;;; ;;; You should have received a copy of the GNU General Public License ;;; along with GNU Guix. If not, see . (define-module (gnu packages miking) #:use-module (guix packages) #:use-module (guix gexp) #:use-module (guix git-download) #:use-module (guix build-system copy) #:use-module (guix build-system dune) #:use-module ((guix licenses) #:prefix license:) #:use-module (gnu packages) #:use-module (gnu packages base) #:use-module (gnu packages bash) #:use-module (gnu packages ocaml)) (define-public miking-boot (let ((commit "539bd577c85d521559f630f2dbe78d2a1c80a26d") (revision "1")) (package (name "miking-boot") (version (git-version "0.0.0" revision commit)) (source (origin (method git-fetch) (uri (git-reference (url "https://github.com/miking-lang/miking") (commit commit))) (file-name (git-file-name "miking" version)) (patches (search-patches "miking-drop-acceleration.patch" "miking-preserve-OCAMLPATH.patch")) (modules '((guix build utils))) (snippet #~(begin (for-each delete-file-recursively '("src/main/accelerate.mc" "stdlib/cuda" "stdlib/futhark" "stdlib/pmexpr/build.mc" "stdlib/pmexpr/classify.mc" "stdlib/pmexpr/compile.mc" "stdlib/pmexpr/wrapper.mc" "test/examples/accelerate")) (substitute* "test-files.mk" (("special_dependencies_files \\+=.*" all) (string-append all ;; requires Domain module, which is unbound "\t$(wildcard stdlib/multicore/*.mc) \\\n" ;; require external ocaml packages "\tstdlib/ext/async-ext.mc \\\n" "\tstdlib/ext/dist-ext.mc \\\n" "\tstdlib/ext/toml-ext.mc \\\n"))))) (sha256 (base32 "1qg5w2pdsjfy03qcw8bj4nv9imyb361nws9vmr91xfbjv33m18sm")))) (build-system dune-build-system) (inputs (list ocaml-linenoise)) (home-page "https://github.com/miking-lang/miking") (synopsis "Meta language system") (description "@acronym{Miking, Meta Viking} is a meta language system for creating embedded domain-specific and general-purpose languages.") (license license:expat)))) (define-public miking (package/inherit miking-boot (name "miking") (build-system copy-build-system) (arguments (list #:install-plan #~`(("build/mi" "bin/") ("stdlib" "lib/mcore")) #:phases #~(modify-phases %standard-phases (add-before 'install 'build (lambda _ (invoke "boot" "eval" "src/main/mi-lite.mc" "--" "0" "src/main/mi-lite.mc" "mi-lite") (invoke "./mi-lite" "1" "src/main/mi.mc" "./mi") (invoke "./mi" "compile" "src/main/mi.mc") (mkdir "build") (rename-file "mi" "build/mi"))) (add-after 'build 'check (lambda* (#:key tests? #:allow-other-keys) (when tests? (for-each (compose (lambda (file check) (invoke "make" "-f" file check)) (lambda (pair) (values (car pair) (cdr pair)))) '(("test-compile.mk" . "selected") ("test-run.mk" . "selected") ("test-tune.mk" . "all")))))) (add-after 'install 'wrap (lambda* (#:key inputs outputs #:allow-other-keys) (wrap-program (string-append (assoc-ref outputs "out") "/bin/mi") `("PATH" suffix (,(dirname (search-input-file inputs "bin/dune")) ,(dirname (search-input-file inputs "bin/ocaml")) ,(dirname (search-input-file inputs "bin/which")))) `("OCAMLPATH" suffix (,(getenv "OCAMLPATH"))))))))) (inputs (list bash-minimal dune miking-boot ocaml ocaml-linenoise which)) (native-inputs (list dune gnu-make miking-boot ocaml ;; needed for tests coreutils which))))