guile-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Nyacc patches for Mes to avoid bundling?


From: Jan Nieuwenhuizen
Subject: Re: Nyacc patches for Mes to avoid bundling?
Date: Mon, 08 May 2017 17:37:37 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.2 (gnu/linux)

Matt Wette writes:

> I have released a 0.78.1 with the following additions:
> 1) configure
> 2) README.nyacc => README, INSTALL
> 3) Makefile.in 

Wow, great; that's real simple!  I fixed two typos (see attached patch
1) and created a Guix[SD] package description in guix.scm (patch 2) that
I intend to submit for inclusion into Guix, so that I can unbundle
Nyacc from the Mes package.

Greetings,
janneke

>From 15cc53ead5d95889f763a649228801734b4250e8 Mon Sep 17 00:00:00 2001
From: Jan Nieuwenhuizen <address@hidden>
Date: Mon, 8 May 2017 07:20:55 +0200
Subject: [PATCH 1/2] Fix configure, Makefile.in typos.

* Makefile.in (SITE_SCM_GO_DIR): Typo, add missing continuation.
* configure (site_scm_go_dir): Typo: site-ccache-dir.
---
 Makefile.in | 2 +-
 configure   | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/Makefile.in b/Makefile.in
index 10dc383..9790245 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -18,7 +18,7 @@ install:
        (cd module; \
         make -f Makefile.nyacc GUILE=$(GUILE) \
                 SITE_SCM_DIR=$(SITE_SCM_DIR) \
-                SITE_SCM_GO_DIR=$(SITE_SCM_GO_DIR)
+                SITE_SCM_GO_DIR=$(SITE_SCM_GO_DIR) \
                 install)
 
 install-srcs:
diff --git a/configure b/configure
index 857beda..7541e94 100755
--- a/configure
+++ b/configure
@@ -70,7 +70,7 @@ fi
 
 if [ "X$site_scm_go_dir" == "X" ]; then
     if [ "X$prefix" == "X" ]; then
-       SITE_SCM_GO_DIR=`$GUILE -c '(display (%site-cache-dir))'`
+       SITE_SCM_GO_DIR=`$GUILE -c '(display (%site-ccache-dir))'`
     else
        EFF_VER=`$GUILE -c "(display (effective-version))"`
        SITE_SCM_GO_DIR=$prefix/lib/guile/$EFF_VER/site-ccache
-- 
2.12.2

>From 35e9b3d639d97e9d615487766f0db245596452da Mon Sep 17 00:00:00 2001
From: Jan Nieuwenhuizen <address@hidden>
Date: Mon, 8 May 2017 17:31:52 +0200
Subject: [PATCH 2/2] Add guix package.

* guix.scm: New file.  Enables to setup a build environment, build and
  install for Guix from git.
---
 guix.scm | 109 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 109 insertions(+)
 create mode 100644 guix.scm

diff --git a/guix.scm b/guix.scm
new file mode 100644
index 0000000..9e846ef
--- /dev/null
+++ b/guix.scm
@@ -0,0 +1,109 @@
+;;; guix.scm -- Guix package definition
+
+;;; NYACC (Not Yet Another Compiler Compiler!)
+;;; Copyright © 2017 Jan Nieuwenhuizen <address@hidden>
+
+;;; Also borrowing code from:
+;;; guile-sdl2 --- FFI bindings for SDL2
+;;; Copyright © 2015 David Thompson <address@hidden>
+
+;;; This library is free software; you can redistribute it and/or
+;;; modify it under the terms of the GNU Lesser General Public
+;;; License as published by the Free Software Foundation; either
+;;; version 3 of the License, or (at your option) any later version.
+;;;
+;;; This library 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
+;;; Lesser General Public License for more details.
+;;;
+;;; You should have received a copy of the GNU Lesser General Public License
+;;; along with this library; if not, see <http://www.gnu.org/licenses/>
+
+;;; Commentary:
+;;
+;; GNU Guix development package.  To build and install, run:
+;;
+;;   guix package -f guix.scm
+;;
+;; To build it, but not install it, run:
+;;
+;;   guix build -f guix.scm
+;;
+;; To use as the basis for a development environment, run:
+;;
+;;   guix environment -l guix.scm
+;;
+;;; Code:
+
+(use-modules (srfi srfi-1)
+             (srfi srfi-26)
+             (ice-9 match)
+             (ice-9 popen)
+             (ice-9 rdelim)
+             (gnu packages)
+             (gnu packages guile)
+             ((guix build utils) #:select (with-directory-excursion))
+             (guix build-system gnu)
+             (guix gexp)
+             (guix download)
+             (guix licenses)
+             (guix packages))
+
+(define %source-dir (dirname (current-filename)))
+
+(define git-file?
+  (let* ((pipe (with-directory-excursion %source-dir
+                 (open-pipe* OPEN_READ "git" "ls-files")))
+         (files (let loop ((lines '()))
+                  (match (read-line pipe)
+                    ((? eof-object?)
+                     (reverse lines))
+                    (line
+                     (loop (cons line lines))))))
+         (status (close-pipe pipe)))
+    (lambda (file stat)
+      (match (stat:type stat)
+        ('directory #t)
+        ((or 'regular 'symlink)
+         (any (cut string-suffix? <> file) files))
+        (_ #f)))))
+
+(define-public nyacc
+  (package
+    (name "nyacc")
+    (version "0.78.1")
+    (source (origin
+              (method url-fetch)
+              (uri (string-append
+                    "https://download.savannah.gnu.org/releases/nyacc/";
+                    name "-" version ".tar.gz"))
+              (patches (search-patches 
"0001-Fix-configure-Makefile.in-typos.patch"))
+              (sha256
+               (base32 
"01grl34za9avzbawvwgx8m2c1mjmjyafkbv5j366h6vyhm8ghdxy"))))
+    (build-system gnu-build-system)
+    (native-inputs
+     `(("guile" ,guile-2.2)))
+    (arguments
+     `(#:phases (modify-phases %standard-phases
+                  (add-before 'configure 'setenv
+                    (lambda _
+                      ;; quiet warnings
+                      (setenv "GUILE_AUTO_COMPILE" "0")
+                      #t)))))
+    (synopsis "a LALR(1) Parser Generator in Guile")
+    (description
+     "NYACC is a LALR(1) Parser Generator Implemented in Guile. 
+The syntax and nomenclature should be considered not stable.")
+    (home-page "")
+    (license (list gpl3+ lgpl3+))))
+
+(define nyacc.git
+  (package
+    (inherit nyacc)
+    (name "nyacc.git")
+    (version "git")
+    (source (local-file %source-dir #:recursive? #t #:select? git-file?))))
+
+;; Return it here so `guix build/environment/package' can consume it directly.
+nyacc.git
-- 
2.12.2

-- 
Jan Nieuwenhuizen <address@hidden> | GNU LilyPond http://lilypond.org
Freelance IT http://JoyofSource.com | Avatar®  http://AvatarAcademy.nl  

reply via email to

[Prev in Thread] Current Thread [Next in Thread]