From patchwork Mon Jan 6 23:57:35 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Brett Gilio X-Patchwork-Id: 19651 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id EE68717A0B; Mon, 6 Jan 2020 23:58:35 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTP id E806017A09 for ; Mon, 6 Jan 2020 23:58:28 +0000 (GMT) Received: from localhost ([::1]:53510 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iocGR-0005As-U6 for patchwork@mira.cbaines.net; Mon, 06 Jan 2020 18:58:27 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:45225) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iocG4-00055d-HS for guix-patches@gnu.org; Mon, 06 Jan 2020 18:58:07 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iocG2-00007R-D7 for guix-patches@gnu.org; Mon, 06 Jan 2020 18:58:04 -0500 Received: from debbugs.gnu.org ([209.51.188.43]:41041) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iocG2-00007D-9K for guix-patches@gnu.org; Mon, 06 Jan 2020 18:58:02 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1iocG2-00068S-8X for guix-patches@gnu.org; Mon, 06 Jan 2020 18:58:02 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#38603] [WIP v2 1/1] gnu: Add mercury. References: <87tv637ffm.fsf@posteo.net> In-Reply-To: <87tv637ffm.fsf@posteo.net> Resent-From: Brett Gilio Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Mon, 06 Jan 2020 23:58:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 38603 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: To: 38603@debbugs.gnu.org Received: via spool by 38603-submit@debbugs.gnu.org id=B38603.157835507023559 (code B ref 38603); Mon, 06 Jan 2020 23:58:02 +0000 Received: (at 38603) by debbugs.gnu.org; 6 Jan 2020 23:57:50 +0000 Received: from localhost ([127.0.0.1]:47013 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iocFf-00067k-Ig for submit@debbugs.gnu.org; Mon, 06 Jan 2020 18:57:49 -0500 Received: from eggs.gnu.org ([209.51.188.92]:34643) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iocFZ-00067Q-IY for 38603@debbugs.gnu.org; Mon, 06 Jan 2020 18:57:37 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]:37678) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1iocFU-0007lg-A8 for 38603@debbugs.gnu.org; Mon, 06 Jan 2020 18:57:28 -0500 Received: from [2605:6000:1a0d:4c95::3d] (port=49544 helo=oryx) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1iocFS-0004wf-HN for 38603@debbugs.gnu.org; Mon, 06 Jan 2020 18:57:27 -0500 From: Brett Gilio Date: Mon, 06 Jan 2020 17:57:35 -0600 Message-ID: <87a770uoi8.fsf@gnu.org> MIME-Version: 1.0 Content-Disposition: inline; filename=v2-0001-gnu-Add-mercury.patch Content-Description: [WIP v2 1/1] gnu: Add mercury. X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.43 X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: "Guix-patches" X-getmail-retrieved-from-mailbox: Patches From 1a78e1b20f015f2f7297eb17becb7b740a991fd5 Mon Sep 17 00:00:00 2001 From: Brett Gilio Date: Mon, 6 Jan 2020 17:51:29 -0600 Subject: [WIP v2 1/1] gnu: Add mercury. To: guix-patches@gnu.org * gnu/local.mk (GNU_SYSTEM_MODULES): Add mercury.scm * gnu/packages/mercury.scm: New file. --- gnu/local.mk | 3 +- gnu/packages/mercury.scm | 157 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 159 insertions(+), 1 deletion(-) create mode 100644 gnu/packages/mercury.scm diff --git a/gnu/local.mk b/gnu/local.mk index b7fa503257..e488424056 100644 --- a/gnu/local.mk +++ b/gnu/local.mk @@ -24,7 +24,7 @@ # Copyright © 2019 John Soo # Copyright © 2019 Jonathan Brielmaier # Copyright © 2019 Evan Straw -# Copyright © 2019 Brett Gilio +# Copyright © 2019, 2020 Brett Gilio # Copyright © 2019 Amin Bandali # # This file is part of GNU Guix. @@ -340,6 +340,7 @@ GNU_SYSTEM_MODULES = \ %D%/packages/mc.scm \ %D%/packages/mcrypt.scm \ %D%/packages/medical.scm \ + %D%/packages/mercury.scm \ %D%/packages/mes.scm \ %D%/packages/messaging.scm \ %D%/packages/mingw.scm \ diff --git a/gnu/packages/mercury.scm b/gnu/packages/mercury.scm new file mode 100644 index 0000000000..f3c0bc9fa7 --- /dev/null +++ b/gnu/packages/mercury.scm @@ -0,0 +1,157 @@ +;;; GNU Guix --- Functional package management for GNU +;;; Copyright © 2020 Brett Gilio +;;; +;;; 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 mercury) + #:use-module (guix download) + #:use-module (guix git-download) + #:use-module (guix packages) + #:use-module (guix utils) + #:use-module ((guix licenses) #:prefix license:) + #:use-module (guix build-system gnu) + #:use-module (gnu packages autotools) + #:use-module (gnu packages bdw-gc) + #:use-module (gnu packages readline) + #:use-module (gnu packages texinfo) + #:use-module (gnu packages flex) + #:use-module (gnu packages shells) + #:use-module (gnu packages bison) + #:use-module (gnu packages pkg-config) + #:use-module (ice-9 match)) ; match-lambda + +;; NOTE: Package `mercury` requires a specific revision and fork of +;; upstream Boehm `libgc`. We use this method to obtain that fork +;; and patch it into `mercury` manually. +(define (bdwgc-mercury commit-bdwgc hash) + (let ((commit commit-bdwgc)) + (package (inherit libgc) + (source + (origin + (method git-fetch) + (uri (git-reference + (url "https://github.com/Mercury-Language/bdwgc.git") + (commit commit))) + (sha256 (base32 hash)))) + (native-inputs + `(("autoconf" ,autoconf) + ("automake" ,automake) + ("libtool" ,libtool) + ,@(package-native-inputs libgc)))))) + +(define-public mercury + (package + (name "mercury") + (version "14.01.1") + (source (origin + (method url-fetch) + (uri (string-append + "https://dl.mercurylang.org/release/mercury-srcdist-" + version ".tar.gz")) + (sha256 + (base32 + "12z8qi3da8q50mcsjsy5bnr4ia6ny5lkxvzy01a3c9blgbgcpxwq")))) + (build-system gnu-build-system) + (arguments + `(#:modules ((guix build gnu-build-system) + (guix build utils) + (ice-9 match)) + #:tests? #f ; TODO: tests are cryptic. Figure it out later. + #:phases + (modify-phases %standard-phases + (add-after 'unpack 'patch + (lambda _ + (substitute* + (list "Makefile" + "Mmakefile" + "scripts/mercury_update_interface.in" + "scripts/mercury_config.in" + "scripts/mmake.in" + "scripts/mmake.sh" + "scripts/Mmake.vars.in" + "scripts/mdb.in" + "scripts/rs6000_hack" + "scripts/fullarch" + "scripts/mmc.in" + "scripts/canonical_grade" + "scripts/mprof.in" + "scripts/gud.el" + "scripts/ml.in" + "scripts/canonical_grade.in" + "scripts/mdprof.in" + "scripts/vpath_find" + "scripts/mkfifo_using_mknod.in" + "scripts/prepare_install_dir.in" + "scripts/ml.sh" + "scripts/mprof_merge_runs" + "scripts/mtc" + "scripts/mgnuc.in" + "scripts/c2init.in" + "bindist/bindist.Makefile") + (("/bin/sh") (which "sh")) + (("/bin/pwd") (which "pwd")) + (("/bin/rm") (which "rm"))) + #t)) + (add-after 'unpack 'replace-boehm-gc + (lambda* (#:key inputs outputs #:allow-other-keys) + (let ((out (assoc-ref outputs "out")) + (libgc (assoc-ref inputs "libgc")) + (unpack (assoc-ref %standard-phases 'unpack)) + (patch-source-shebangs + (assoc-ref %standard-phases 'patch-source-shebangs))) + (map (match-lambda + ((src orig-name new-name) + (with-directory-excursion "." + (apply unpack (list #:source src)) + (apply patch-source-shebangs (list #:source src))) + (delete-file-recursively new-name) + (invoke "mv" orig-name new-name))) + `((,libgc "source/include/gc" "boehm_gc")))) + #t))))) + (native-inputs + `(("texinfo" ,texinfo) + ("flex" ,flex) + ("tcsh", tcsh) + ("bison" ,bison) + ("readline" ,readline) + ("libatomic-ops" ,libatomic-ops) + ("libgc" ,(bdwgc-mercury + "5287fbab8a6f2284a12beeb9e3ba592301436b98" + "1crlw7zhjik39qdfqp5w317dskxdrklfw48g4jzrjzry12hkmq9y")) + ("pkg-config" ,pkg-config))) + (synopsis "A pure logic programming language") + (description "Mercury is a logic/functional programming language which +combines the clarity and expressiveness of declarative programming with advanced +static analysis and error detection features. Its highly optimized execution +algorithm delivers efficiency far in excess of existing logic programming +systems, and close to conventional programming systems. Mercury addresses +the problems of large-scale program development, allowing modularity, +separate compilation, and numerous optimization/time trade-offs.") + (home-page "https://mercurylang.org") + (license license:gpl2))) + +(define-public mercury-minimal + (package (inherit mercury) + (name "mercury-minimal") + (build-system gnu-build-system) + (arguments + (substitute-keyword-arguments (package-arguments mercury) + ((#:configure-flags flags ''()) + `(list "--enable-minimal-install")))) + (inputs + `(("gcc-toolchain" ,gcc-toolchain))) + (synopsis "A pure logic programming language (used only for +compiling packages dependent on base Mercury)"))) -- 2.24.1