From 35e9b3d639d97e9d615487766f0db245596452da Mon Sep 17 00:00:00 2001 From: Jan Nieuwenhuizen 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 + +;;; Also borrowing code from: +;;; guile-sdl2 --- FFI bindings for SDL2 +;;; Copyright © 2015 David Thompson + +;;; 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 + +;;; 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