projects/guix·blob python-team · refs

186 lines · 9.0 KiB

1;;; GNU Guix --- Functional package management for GNU
2;;; Copyright © 2013, 2014 Ludovic Courtès <[email protected]>
3;;; Copyright © 2016 Alex ter Weele <[email protected]>
4;;; Copyright © 2017, 2019 Ricardo Wurmus <[email protected]>
5;;; Copyright © 2017 Nikita <[email protected]>
6;;; Copyright © 2019 Pierre-Moana Levesque <[email protected]>
7;;; Copyright © 2022 Tobias Geerinckx-Rice <[email protected]>
8;;;
9;;; This file is part of GNU Guix.
10;;;
11;;; GNU Guix 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;;; GNU Guix 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 GNU Guix. If not, see <http://www.gnu.org/licenses/>.
23
24(define-module (gnu packages guile-wm)
25 #:use-module (guix licenses)
26 #:use-module (gnu packages)
27 #:use-module (gnu packages bash)
28 #:use-module (gnu packages xorg)
29 #:use-module (gnu packages guile)
30 #:use-module (gnu packages pkg-config)
31 #:use-module (gnu packages texinfo)
32 #:use-module (guix packages)
33 #:use-module (guix download)
34 #:use-module (guix git-download)
35 #:use-module (guix build-system gnu)
36 #:use-module (guix utils))
37
38(define-public guile-xcb
39 (let ((commit "db7d5a393cc37a56f66541b3f33938b40c6f35b3")
40 (revision "1"))
41 (package
42 (name "guile-xcb")
43 (version (git-version "1.3" revision commit))
44 (source (origin
45 (method git-fetch)
46 (uri (git-reference
47 (url "https://github.com/mwitmer/guile-xcb")
48 (commit commit)))
49 (file-name (git-file-name name version))
50 (sha256
51 (base32
52 "16w4vgzbmnwih4bgfn8rw85ryfvzhc6hyly6bic9sd7hhc82rcnd"))))
53 (build-system gnu-build-system)
54 (arguments
55 `( ;; Parallel builds fail.
56 #:parallel-build? #f
57 #:configure-flags
58 (let ((out (assoc-ref %outputs "out"))
59 (effective ,(version-major+minor
60 (package-version (this-package-input "guile")))))
61 (list (string-append "--with-guile-site-dir=" out
62 "/share/guile/site/" effective)
63 (string-append "--with-guile-site-ccache-dir=" out
64 "/lib/guile/" effective "/site-ccache")))))
65 (native-inputs (list guile-2.2 pkg-config texinfo))
66 (inputs (list guile-2.2 xcb-proto))
67 (home-page "https://github.com/mwitmer/guile-xcb")
68 (synopsis "XCB bindings for Guile")
69 (description
70 "Guile-XCB implements the XCB protocol and provides all the tools
71necessary to write X client code in Guile Scheme without any external
72dependencies.")
73 (license gpl3+))))
74
75(define-public guile-wm
76 (let ((commit "f3c7b3be719f425ffb87265d34855a73366351be")
77 (revision "1"))
78 (package
79 (name "guile-wm")
80 (version (git-version "1.0" revision commit))
81 (synopsis "X11 window manager toolkit in Scheme")
82 (source (origin
83 (method git-fetch)
84 (uri (git-reference
85 (url "https://github.com/mwitmer/guile-wm")
86 (commit commit)))
87 (file-name (git-file-name name version))
88 (sha256
89 (base32
90 "086dijnpl5dpglf70d6f9sizyakr313y7blpdjrmbi687j1x3qcl"))))
91 (build-system gnu-build-system)
92 (arguments
93 `(#:modules ((guix build gnu-build-system)
94 (guix build utils)
95 (ice-9 rdelim)
96 (ice-9 popen))
97 ;; The '.scm' files go to $(datadir), so set that to the
98 ;; standard value.
99 #:configure-flags
100 (let ((out (assoc-ref %outputs "out"))
101 (effective ,(version-major+minor
102 (package-version (this-package-input "guile")))))
103 (list (string-append "--datadir=" out
104 "/share/guile/site/" effective)))
105 #:phases
106 (modify-phases %standard-phases
107 (add-before 'configure 'set-module-directory
108 (lambda* (#:key outputs #:allow-other-keys)
109 ;; Install .scm files to $out/share/guile/site/x.y.
110 (let ((out (assoc-ref outputs "out"))
111 (effective (read-line
112 (open-pipe* OPEN_READ
113 "guile" "-c"
114 "(display (effective-version))"))))
115 (substitute* "module/Makefile.in"
116 (("^wmdir = .*$")
117 (string-append "wmdir = " out
118 "/share/guile/site/"
119 effective "\n"))))))
120 (add-after 'install 'set-load-path
121 (lambda* (#:key inputs outputs #:allow-other-keys)
122 ;; Put Guile-XCB's and Guile-WM's modules in the
123 ;; search path of PROG.
124 (let* ((out (assoc-ref outputs "out"))
125 (effective (read-line
126 (open-pipe* OPEN_READ
127 "guile" "-c"
128 "(display (effective-version))")))
129 (prog (string-append out "/bin/guile-wm"))
130 (mods (string-append out "/share/guile/site/" effective))
131 (gos (string-append out "/lib/guile/" effective "/site-ccache"))
132 (xcb (assoc-ref inputs "guile-xcb")))
133 (wrap-program prog
134 `("GUILE_AUTO_COMPILE" ":" = ("0"))
135 `("GUILE_LOAD_PATH" ":" prefix
136 (,mods ,(string-append xcb "/share/guile/site/" effective)))
137 `("GUILE_LOAD_COMPILED_PATH" ":" prefix
138 (,gos ,(string-append xcb "/lib/guile/"
139 effective "/site-ccache")))))))
140 (add-after 'install 'install-go-files
141 (lambda* (#:key outputs inputs #:allow-other-keys)
142 (let* ((out (assoc-ref outputs "out"))
143 (effective (read-line
144 (open-pipe* OPEN_READ
145 "guile" "-c"
146 "(display (effective-version))")))
147 (module-dir (string-append out "/share/guile/site/"
148 effective))
149 (object-dir (string-append out "/lib/guile/" effective
150 "/site-ccache"))
151 (prefix (string-length module-dir)))
152 (setenv "GUILE_AUTO_COMPILE" "0")
153 ;; compile to the destination
154 (for-each (lambda (file)
155 (let* ((base (string-drop (string-drop-right file 4)
156 prefix))
157 (go (string-append object-dir base ".go")))
158 (invoke "guild" "compile" "-L" module-dir
159 file "-o" go)))
160 (find-files module-dir "\\.scm$")))))
161 (add-after 'install 'install-xsession
162 (lambda* (#:key outputs #:allow-other-keys)
163 ;; add a .desktop file to xsessions
164 (let ((xsessions (string-append
165 %output "/share/xsessions")))
166 (mkdir-p xsessions)
167 (call-with-output-file (string-append
168 xsessions "/guile-wm.desktop")
169 (lambda (port)
170 (format port
171 "[Desktop Entry]~@
172 Name=~a~@
173 Comment=~a~@
174 Exec=~a/bin/guile-wm~@
175 Type=Application~%"
176 ,name ,synopsis %output)))))))))
177 (native-inputs (list guile-2.2 guile-xcb pkg-config texinfo))
178 (inputs (list bash-minimal guile-2.2 guile-xcb))
179 (home-page "https://github.com/mwitmer/guile-wm/releases")
180 (description
181 "Guile-WM is a simple window manager that's completely customizable—you
182have total control of what it does by choosing which modules to include.
183Included with it are a few modules that provide basic TinyWM-like window
184management, some window record-keeping, multi-monitor support, and emacs-like
185keymaps and minibuffer. At this point, it's just enough to get you started.")
186 (license gpl3+))))