guix.scm 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. ;;;; guix.scm -- Guix package definition
  2. ;;; Copyright © 2016 Mathieu Lirzin <mthl@gnu.org>
  3. ;;;
  4. ;;; This file is part of GNU Mcron.
  5. ;;;
  6. ;;; GNU Mcron is free software: you can redistribute it and/or modify
  7. ;;; it under the terms of the GNU General Public License as published by
  8. ;;; the Free Software Foundation, either version 3 of the License, or
  9. ;;; (at your option) any later version.
  10. ;;;
  11. ;;; GNU Mcron is distributed in the hope that it will be useful,
  12. ;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. ;;; GNU General Public License for more details.
  15. ;;;
  16. ;;; You should have received a copy of the GNU General Public License
  17. ;;; along with GNU Mcron. If not, see <http://www.gnu.org/licenses/>.
  18. (use-modules (ice-9 popen)
  19. (ice-9 rdelim)
  20. (gnu)
  21. (guix)
  22. (srfi srfi-1))
  23. (define (keep-mcron-file? file stat)
  24. ;; Return #t if FILE in Mcron repository must be kept, #f otherwise. FILE
  25. ;; is an absolute file name and STAT is the result of 'lstat' applied to
  26. ;; FILE.
  27. (not (or (any (λ (str) (string-contains file str))
  28. '(".git" "autom4te" "Makefile.in" ".go" ".log"
  29. "stamp-vti" ".dirstamp"))
  30. (any (λ (str) (string-suffix? str file))
  31. '("trs""configure" "Makefile" "config.status" "pre-inst-env"
  32. "aclocal.m4" "bin/cron" "bin/mcron" "bin/crontab" "config.cache"
  33. "guix.scm")))))
  34. (define %srcdir
  35. (or (current-source-directory) "."))
  36. (define (git-version-gen)
  37. ;; Return a string containing Cuirass version number.
  38. (let* ((cmd "git-version-gen .version")
  39. (port (open-input-pipe (string-append %srcdir "/" cmd)))
  40. (str (read-line port)))
  41. (close-pipe port)
  42. str))
  43. (package
  44. (inherit (specification->package "mcron2"))
  45. (version (git-version-gen))
  46. (source (local-file (dirname %srcdir) #:recursive? #t
  47. #:select? keep-mcron-file?))
  48. (arguments
  49. '(#:phases
  50. (modify-phases %standard-phases
  51. (add-before 'configure 'bootstrap
  52. (λ _ (zero? (system* "autoreconf" "-vfi")))))))
  53. (inputs
  54. `(("guile" ,(specification->package "guile@2.0"))))
  55. (native-inputs
  56. `(("autoconf" ,(specification->package "autoconf"))
  57. ("automake" ,(specification->package "automake"))
  58. ("help2man" ,(specification->package "help2man"))
  59. ("pkg-config" ,(specification->package "pkg-config"))
  60. ("texinfo" ,(specification->package "texinfo"))
  61. ("which" ,(specification->package "which")))))