| 1 | ;;; GNU Guix --- Functional package management for GNU |
| 2 | ;;; Copyright © 2019 Amin Bandali <bandali@gnu.org> |
| 3 | ;;; Copyright © 2020 Brett Gilio <brettg@gnu.org> |
| 4 | ;;; Copyright © 2020 Tobias Geerinckx-Rice <me@tobias.gr> |
| 5 | ;;; |
| 6 | ;;; This file is part of GNU Guix. |
| 7 | ;;; |
| 8 | ;;; GNU Guix is free software; you can redistribute it and/or modify it |
| 9 | ;;; under the terms of the GNU General Public License as published by |
| 10 | ;;; the Free Software Foundation; either version 3 of the License, or (at |
| 11 | ;;; your option) any later version. |
| 12 | ;;; |
| 13 | ;;; GNU Guix is distributed in the hope that it will be useful, but |
| 14 | ;;; WITHOUT ANY WARRANTY; without even the implied warranty of |
| 15 | ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 16 | ;;; GNU General Public License for more details. |
| 17 | ;;; |
| 18 | ;;; You should have received a copy of the GNU General Public License |
| 19 | ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>. |
| 20 | |
| 21 | (define-module (gnu packages lean) |
| 22 | #:use-module (gnu packages multiprecision) |
| 23 | #:use-module (guix build-system cmake) |
| 24 | #:use-module ((guix licenses) #:prefix license:) |
| 25 | #:use-module (guix packages) |
| 26 | #:use-module (guix git-download)) |
| 27 | |
| 28 | (define-public lean |
| 29 | (package |
| 30 | (name "lean") |
| 31 | (version "3.23.0") |
| 32 | (home-page "https://github.com/leanprover-community/lean") |
| 33 | (source (origin |
| 34 | (method git-fetch) |
| 35 | (uri (git-reference (url home-page) |
| 36 | (commit (string-append "v" version)))) |
| 37 | (file-name (git-file-name name version)) |
| 38 | (sha256 |
| 39 | (base32 |
| 40 | "09mklc1p6ms1jayg2f89hqfmhca3h5744lli936l38ypn1d00sxx")))) |
| 41 | (build-system cmake-build-system) |
| 42 | (inputs |
| 43 | `(("gmp" ,gmp))) |
| 44 | (arguments |
| 45 | `(#:build-type "Release" ; default upstream build type |
| 46 | ;; XXX: Test phases currently fail on 32-bit sytems. |
| 47 | ;; Tests for those architectures have been temporarily |
| 48 | ;; disabled, pending further investigation. |
| 49 | #:tests? ,(let ((arch (or (%current-target-system) |
| 50 | (%current-system)))) |
| 51 | (not (or (string-prefix? "i686" arch) |
| 52 | (string-prefix? "armhf" arch)))) |
| 53 | #:phases |
| 54 | (modify-phases %standard-phases |
| 55 | (add-after 'patch-source-shebangs 'patch-tests-shebangs |
| 56 | (lambda _ |
| 57 | (let ((sh (which "sh")) |
| 58 | (bash (which "bash"))) |
| 59 | (substitute* (find-files "tests/lean" "\\.sh$") |
| 60 | (("#![[:blank:]]?/bin/sh") |
| 61 | (string-append "#!" sh)) |
| 62 | (("#![[:blank:]]?/bin/bash") |
| 63 | (string-append "#!" bash)) |
| 64 | (("#![[:blank:]]?usr/bin/env bash") |
| 65 | (string-append "#!" bash))) |
| 66 | #t))) |
| 67 | (add-before 'configure 'chdir-to-src |
| 68 | (lambda _ (chdir "src") #t))))) |
| 69 | (synopsis "Theorem prover and programming language") |
| 70 | (description |
| 71 | "Lean is a theorem prover and programming language with a small trusted |
| 72 | core based on dependent typed theory, aiming to bridge the gap between |
| 73 | interactive and automated theorem proving.") |
| 74 | (license license:asl2.0))) |