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 texinfo)
28
  #:use-module (gnu packages tls)
29
  #:use-module (guix build-system gnu)
30
  #:use-module (guix git-download)
31
  #:use-module (guix packages)
32
  #:use-module (guix licenses))
33
34
(define my-guile-git
35
  (package
36
    (inherit guile-git)
37
    (source (origin
38
              (method git-fetch)
39
              (uri (git-reference
40
                     (url "https://gitlab.com/roptat/guile-git")
41
                     (commit "c39ab944d8004d3ab751a9e27336469afec081eb")))
42
              (file-name (git-file-name "guile-git" "0.4.0.c39ab94"))
43
              (sha256
44
               (base32
45
                "0hknsv9r7pjahmxkvd7zpz93saki5kymh88xs6pb4h9d0ssp4fmp"))))
46
    (native-inputs
47
     `(("autoconf" ,autoconf)
48
       ("automake" ,automake)
49
       ("texinfo" ,texinfo)
50
       ,@(package-native-inputs guile-git)))))
51
52
(define my-guile-syntax-highlight
53
  (package
54
    (inherit guile-syntax-highlight)
55
    (source (origin
56
              (method git-fetch)
57
              (uri (git-reference
58
                     (url "https://git.dthompson.us/guile-syntax-highlight.git")
59
                     (commit "51727cbb7fc05ef743aab2d7b16314ea1ed790e4")))
60
              (file-name (git-file-name "guile-syntax-highlight" "0.1.51727cb"))
61
              (sha256
62
               (base32
63
                "1cvacy4y5qxajygb1qg8hvhjdf2xnnwnm5j918cabsi8wfwchig7"))))
64
    (native-inputs
65
     `(("autoconf" ,autoconf)
66
       ("automake" ,automake)
67
       ("texinfo" ,texinfo)
68
       ,@(package-native-inputs guile-syntax-highlight)))))
69
70
(define-public gitile
71
  (let ((commit "fac1f0ccdbaca794451ae43526b1bbffacd8161a")
72
	(revision "0"))
73
    (package
74
      (name "gitile")
75
      (version (git-version "0.0" revision commit))
76
      (source (origin
77
                (method git-fetch)
78
                (uri (git-reference
79
                       (url "https://git.lepiller.eu/git/gitile")
80
                       (commit commit)))
81
                (file-name (git-file-name name version))
82
                (sha256
83
                 (base32
84
                  "048pm743gnxashggngw3zlsr13wf0k686n3j23czc4988gz7mfvp"))))
85
      (build-system gnu-build-system)
86
      (arguments
87
       `(#:modules ((guix build utils)
88
                    (guix build gnu-build-system)
89
                    (ice-9 rdelim)
90
                    (ice-9 popen))
91
         #:make-flags (list "GUILE_AUTO_COMPILE=0")
92
         #:phases
93
         (modify-phases %standard-phases
94
           (add-after 'install 'install-bin
95
             (lambda* (#:key outputs #:allow-other-keys)
96
               (install-file "scripts/gitile"
97
                             (string-append (assoc-ref outputs "out")
98
                                            "/bin"))
99
               #t))
100
           (add-after 'install-bin 'wrap-program
101
               (lambda* (#:key inputs outputs #:allow-other-keys)
102
                 ;; Wrap the 'cuirass' command to refer to the right modules.
103
                 (let* ((out    (assoc-ref outputs "out"))
104
                        (commonmark (assoc-ref inputs "guile-commonmark"))
105
                        (git    (assoc-ref inputs "guile-git"))
106
                        (bytes  (assoc-ref inputs "guile-bytestructures"))
107
                        (fibers (assoc-ref inputs "guile-fibers"))
108
                        (gcrypt (assoc-ref inputs "guile-gcrypt"))
109
			(syntax-highlight (assoc-ref inputs "guile-syntax-highlight"))
110
                        (deps   (list out commonmark git bytes fibers gcrypt
111
				      syntax-highlight))
112
                        (guile  (assoc-ref %build-inputs "guile"))
113
                        (effective (read-line
114
                                    (open-pipe* OPEN_READ
115
                                                (string-append guile "/bin/guile")
116
                                                "-c" "(display (effective-version))")))
117
                        (mods   (string-drop-right  ;drop trailing colon
118
                                 (string-join deps
119
                                              (string-append "/share/guile/site/"
120
                                                             effective ":")
121
                                              'suffix)
122
                                 1))
123
                        (objs   (string-drop-right
124
                                 (string-join deps
125
                                              (string-append "/lib/guile/" effective
126
                                                             "/site-ccache:")
127
                                              'suffix)
128
                                 1)))
129
                   (wrap-program (string-append out "/bin/gitile")
130
                     `("GUILE_LOAD_PATH" ":" prefix (,mods))
131
                     `("GUILE_LOAD_COMPILED_PATH" ":" prefix (,objs)))
132
                   #t))))))
133
      (native-inputs
134
       `(("autoconf" ,autoconf)
135
         ("automake" ,automake)
136
         ("guile" ,guile-3.0)
137
         ("pkg-config" ,pkg-config)))
138
      (inputs
139
       `(("guile" ,guile-3.0)
140
	 ("guile-commonmark" ,guile-commonmark)
141
         ("guile-fibers" ,guile-fibers)
142
         ("guile-gcrypt" ,guile-gcrypt)
143
         ("guile-git" ,my-guile-git)
144
	 ("guile-syntax-highlight" ,my-guile-syntax-highlight)
145
         ("gnutls" ,gnutls)))
146
      (home-page "")
147
      (synopsis "")
148
      (description "")
149
      (license gpl3+))))
150
151
gitile
152