system-configuration/modules/packages/gitile.scm

gitile.scm

1
;;; GNU Guix --- Functional package management for GNU
2
;;; Copyright © 2020 Julien Lepiller <julien@lepiller.eu>
3
;;;
4
;;; This file is part of GNU Guix.
5
;;;
6
;;; GNU Guix is free software; you can redistribute it and/or modify it
7
;;; under the terms of the GNU General Public License as published by
8
;;; the Free Software Foundation; either version 3 of the License, or (at
9
;;; your option) any later version.
10
;;;
11
;;; GNU Guix is distributed in the hope that it will be useful, but
12
;;; 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 Guix.  If not, see <http://www.gnu.org/licenses/>.
18
;;;
19
;;; Some of the help text was taken from the default dovecot.conf files.
20
21
(define-module (packages gitile)
22
  #:use-module (gnu packages autotools)
23
  #:use-module (gnu packages gnupg)
24
  #:use-module (gnu packages guile)
25
  #:use-module (gnu packages guile-xyz)
26
  #:use-module (gnu packages pkg-config)
27
  #:use-module (gnu packages tls)
28
  #:use-module (guix build-system gnu)
29
  #:use-module (guix git-download)
30
  #:use-module (guix packages)
31
  #:use-module (guix licenses))
32
33
(define-public gitile
34
  (package
35
    (name "gitile")
36
    (version "0.1")
37
    (source (origin
38
              (method git-fetch)
39
              (uri (git-reference
40
                     (url "https://git.lepiller.eu/git/gitile")
41
                     (commit "47c1ff58e830b905a394f023f62dd7a03c111606")))
42
              (file-name (git-file-name name (string-append version "-47c1ff5")))
43
              (sha256
44
               (base32
45
                "1s6pk77glyy6rrx76kv3vzjkp9g7j5kkwn2khbx1hyhada21i63y"))))
46
    (build-system gnu-build-system)
47
    (arguments
48
     `(#:modules ((guix build utils)
49
                  (guix build gnu-build-system)
50
                  (ice-9 rdelim)
51
                  (ice-9 popen))
52
       #:make-flags (list "GUILE_AUTO_COMPILE=0")
53
       #:phases
54
       (modify-phases %standard-phases
55
         (add-after 'install 'install-bin
56
           (lambda* (#:key outputs #:allow-other-keys)
57
             (install-file "scripts/gitile"
58
                           (string-append (assoc-ref outputs "out")
59
                                          "/bin"))
60
             #t))
61
         (add-after 'install-bin 'wrap-program
62
             (lambda* (#:key inputs outputs #:allow-other-keys)
63
               ;; Wrap the 'cuirass' command to refer to the right modules.
64
               (let* ((out    (assoc-ref outputs "out"))
65
                      (git    (assoc-ref inputs "guile-git"))
66
                      (bytes  (assoc-ref inputs "guile-bytestructures"))
67
                      (fibers (assoc-ref inputs "guile-fibers"))
68
                      (gcrypt (assoc-ref inputs "guile-gcrypt"))
69
                      (deps   (list out git bytes fibers gcrypt))
70
                      (guile  (assoc-ref %build-inputs "guile"))
71
                      (effective (read-line
72
                                  (open-pipe* OPEN_READ
73
                                              (string-append guile "/bin/guile")
74
                                              "-c" "(display (effective-version))")))
75
                      (mods   (string-drop-right  ;drop trailing colon
76
                               (string-join deps
77
                                            (string-append "/share/guile/site/"
78
                                                           effective ":")
79
                                            'suffix)
80
                               1))
81
                      (objs   (string-drop-right
82
                               (string-join deps
83
                                            (string-append "/lib/guile/" effective
84
                                                           "/site-ccache:")
85
                                            'suffix)
86
                               1)))
87
                 (wrap-program (string-append out "/bin/gitile")
88
                   `("GUILE_LOAD_PATH" ":" prefix (,mods))
89
                   `("GUILE_LOAD_COMPILED_PATH" ":" prefix (,objs)))
90
                 #t))))))
91
    (native-inputs
92
     `(("autoconf" ,autoconf)
93
       ("automake" ,automake)
94
       ("guile" ,guile-3.0)
95
       ("pkg-config" ,pkg-config)))
96
    (inputs
97
     `(("guile" ,guile-3.0)
98
       ("guile-fibers" ,guile-fibers)
99
       ("guile-gcrypt" ,guile-gcrypt)
100
       ("guile-git" ,guile-git)
101
       ("gnutls" ,gnutls)))
102
    (home-page "")
103
    (synopsis "")
104
    (description "")
105
    (license gpl3+)))
106
107
gitile
108