guix.scm 3.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. ;;; guix.scm -- Guix package definition
  2. ;;; mescc-tools
  3. ;;; Copyright © 2017 Jan Nieuwenhuizen <janneke@gnu.org>
  4. ;;; Copyright 2016 Jeremiah Orians
  5. ;;; Also borrowing code from:
  6. ;;; guile-sdl2 --- FFI bindings for SDL2
  7. ;;; Copyright © 2015 David Thompson <davet@gnu.org>
  8. ;;;
  9. ;;; guix.scm: This file is part of mescc-tools.
  10. ;;;
  11. ;;; mescc-tools is free software; you can redistribute it and/or modify it
  12. ;;; under the terms of the GNU General Public License as published by
  13. ;;; the Free Software Foundation; either version 3 of the License, or (at
  14. ;;; your option) any later version.
  15. ;;;
  16. ;;; mescc-tools is distributed in the hope that it will be useful, but
  17. ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
  18. ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  19. ;;; GNU General Public License for more details.
  20. ;;;
  21. ;;; You should have received a copy of the GNU General Public License
  22. ;;; along with mescc-tools. If not, see <http://www.gnu.org/licenses/>.
  23. ;;; Commentary:
  24. ;; GNU Guix development package. To build and install, run:
  25. ;; guix package -f guix.scm
  26. ;;
  27. ;; To build it, but not install it, run:
  28. ;; guix build -f guix.scm
  29. ;;
  30. ;; To use as the basis for a development environment, run:
  31. ;; guix environment -l guix.scm
  32. ;;
  33. ;;; Code:
  34. (use-modules (srfi srfi-1)
  35. (srfi srfi-26)
  36. (ice-9 match)
  37. (ice-9 popen)
  38. (ice-9 rdelim)
  39. (gnu packages)
  40. (gnu packages gcc)
  41. (gnu packages base)
  42. ((guix build utils) #:select (with-directory-excursion))
  43. (guix build-system gnu)
  44. (guix gexp)
  45. (guix git-download)
  46. (guix licenses)
  47. (guix packages))
  48. (define %source-dir (dirname (current-filename)))
  49. (define git-file?
  50. (let* ((pipe (with-directory-excursion %source-dir
  51. (open-pipe* OPEN_READ "git" "ls-files")))
  52. (files (let loop ((lines '()))
  53. (match (read-line pipe)
  54. ((? eof-object?)
  55. (reverse lines))
  56. (line
  57. (loop (cons line lines))))))
  58. (status (close-pipe pipe)))
  59. (lambda (file stat)
  60. (match (stat:type stat)
  61. ('directory #t)
  62. ((or 'regular 'symlink)
  63. (any (cut string-suffix? <> file) files))
  64. (_ #f)))))
  65. (define-public mescc-tools.git
  66. (package
  67. (name "mescc-tools.git")
  68. (build-system gnu-build-system)
  69. (inputs `(("which", which) ("coreutils", coreutils)))
  70. (arguments
  71. `(#:make-flags (list (string-append "PREFIX=" (assoc-ref %outputs "out")))
  72. #:test-target "test"
  73. #:phases
  74. (modify-phases %standard-phases
  75. (delete 'configure))))
  76. (synopsis "tools for the full source bootstrapping process")
  77. (description
  78. "Mescc-tools is a collection of tools for use in full source bootstrapping process.
  79. Currently consists of the M0 macro assembler and the hex2 linker.")
  80. (home-page "https://github.com/oriansj/mescc-tools")
  81. (license gpl3+)
  82. (version (string-append "HEAD-" (string-take (read-string (open-pipe "git show HEAD | head -1 | cut -d ' ' -f 2" OPEN_READ)) 7)))
  83. (source (local-file %source-dir #:recursive? #t #:select? git-file?))))
  84. ;; Return it here so `guix build/environment/package' can consume it directly.
  85. mescc-tools.git