guix.scm 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  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. ((guix build utils) #:select (with-directory-excursion))
  42. (guix build-system gnu)
  43. (guix gexp)
  44. (guix git-download)
  45. (guix licenses)
  46. (guix packages))
  47. (define %source-dir (dirname (current-filename)))
  48. (define git-file?
  49. (let* ((pipe (with-directory-excursion %source-dir
  50. (open-pipe* OPEN_READ "git" "ls-files")))
  51. (files (let loop ((lines '()))
  52. (match (read-line pipe)
  53. ((? eof-object?)
  54. (reverse lines))
  55. (line
  56. (loop (cons line lines))))))
  57. (status (close-pipe pipe)))
  58. (lambda (file stat)
  59. (match (stat:type stat)
  60. ('directory #t)
  61. ((or 'regular 'symlink)
  62. (any (cut string-suffix? <> file) files))
  63. (_ #f)))))
  64. (define-public mescc-tools.git
  65. (package
  66. (name "mescc-tools.git")
  67. (build-system gnu-build-system)
  68. (arguments
  69. `(#:make-flags (list (string-append "PREFIX=" (assoc-ref %outputs "out")))
  70. #:test-target "test"
  71. #:phases
  72. (modify-phases %standard-phases
  73. (delete 'configure))))
  74. (synopsis "tools for the full source bootstrapping process")
  75. (description
  76. "Mescc-tools is a collection of tools for use in full source bootstrapping process.
  77. Currently consists of the M0 macro assembler and the hex2 linker.")
  78. (home-page "https://github.com/oriansj/mescc-tools")
  79. (license gpl3+)
  80. (version (string-append "HEAD-" (string-take (read-string (open-pipe "git show HEAD | head -1 | cut -d ' ' -f 2" OPEN_READ)) 7)))
  81. (source (local-file %source-dir #:recursive? #t #:select? git-file?))))
  82. ;; Return it here so `guix build/environment/package' can consume it directly.
  83. mescc-tools.git