gnu: Use 'modify-phases' syntax.
[jackhill/guix/guix.git] / gnu / packages / guile-wm.scm
CommitLineData
0af626ff 1;;; GNU Guix --- Functional package management for GNU
c36b2228 2;;; Copyright © 2013, 2014 Ludovic Courtès <ludo@gnu.org>
23de5cbd 3;;; Copyright © 2016 Alex ter Weele <alex.ter.weele@gmail.com>
3f8efbb9 4;;; Copyright © 2017 Ricardo Wurmus <rekado@elephly.net>
0af626ff
LC
5;;;
6;;; This file is part of GNU Guix.
7;;;
8;;; GNU Guix is free software; you can redistribute it and/or modify it
9;;; under the terms of the GNU General Public License as published by
10;;; the Free Software Foundation; either version 3 of the License, or (at
11;;; your option) any later version.
12;;;
13;;; GNU Guix is distributed in the hope that it will be useful, but
14;;; WITHOUT ANY WARRANTY; without even the implied warranty of
15;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16;;; GNU General Public License for more details.
17;;;
18;;; You should have received a copy of the GNU General Public License
19;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
20
21(define-module (gnu packages guile-wm)
22 #:use-module (guix licenses)
23 #:use-module (gnu packages)
24 #:use-module (gnu packages xorg)
25 #:use-module (gnu packages guile)
26 #:use-module (gnu packages pkg-config)
27 #:use-module (guix packages)
28 #:use-module (guix download)
29 #:use-module (guix build-system gnu))
30
31(define-public guile-xcb
32 (package
33 (name "guile-xcb")
9037ea2c 34 (version "1.3")
0af626ff
LC
35 (source (origin
36 (method url-fetch)
44aca1a3
RW
37 (uri (string-append "http://web.archive.org/web/20150803094848/"
38 "http://www.markwitmer.com/dist/guile-xcb-"
0af626ff
LC
39 version ".tar.gz"))
40 (sha256
41 (base32
9037ea2c 42 "04dvbqdrrs67490gn4gkq9zk8mqy3mkls2818ha4p0ckhh0pm149"))))
0af626ff
LC
43 (build-system gnu-build-system)
44 (arguments '(;; Parallel builds fail.
45 #:parallel-build? #f
46
0af626ff 47 #:configure-flags (list (string-append
9037ea2c 48 "--with-guile-site-dir="
0af626ff 49 (assoc-ref %outputs "out")
9037ea2c
LC
50 "/share/guile/site/2.0")
51 (string-append
52 "--with-guile-site-ccache-dir="
53 (assoc-ref %outputs "out")
54 "/share/guile/site/2.0"))))
0af626ff
LC
55 (native-inputs `(("pkg-config" ,pkg-config)))
56 (inputs `(("guile" ,guile-2.0)
57 ("xcb" ,xcb-proto)))
58 (home-page "http://www.markwitmer.com/guile-xcb/guile-xcb.html")
59 (synopsis "XCB bindings for Guile")
60 (description
61 "Guile-XCB implements the XCB protocol and provides all the tools
62necessary to write X client code in Guile Scheme without any external
63dependencies.")
64 (license gpl3+)))
901eee2c
LC
65
66(define-public guile-wm
67 (package
68 (name "guile-wm")
c36b2228 69 (version "1.0")
23de5cbd 70 (synopsis "X11 window manager toolkit in Scheme")
901eee2c
LC
71 (source (origin
72 (method url-fetch)
3f8efbb9
RW
73 (uri (string-append "http://web.archive.org/web/20161005084324/"
74 "http://www.markwitmer.com/dist/guile-wm-"
901eee2c
LC
75 version ".tar.gz"))
76 (sha256
77 (base32
c36b2228 78 "1l9qcz236jxvryndimjy62cf8zxf8i3f8vg3zpqqjhw15j9mdk3r"))))
901eee2c 79 (build-system gnu-build-system)
23de5cbd
AW
80 (arguments
81 `( ;; The '.scm' files go to $(datadir), so set that to the
82 ;; standard value.
83 #:configure-flags (list (string-append "--datadir="
84 (assoc-ref %outputs "out")
85 "/share/guile/site/2.0"))
dc1d3cde
KK
86 #:phases
87 (modify-phases %standard-phases
88 (add-before 'configure 'set-go-directory
89 (lambda* (#:key outputs #:allow-other-keys)
90 ;; Install .go files to $out/share/guile/site/2.0.
91 (let ((out (assoc-ref outputs "out")))
92 (substitute* "module/Makefile.in"
93 (("^wmdir = .*$")
94 (string-append "wmdir = " out
95 "/share/guile/site/2.0\n"))))
96 #t))
97 (add-after 'install 'set-load-path
98 (lambda* (#:key inputs outputs #:allow-other-keys)
99 ;; Put Guile-XCB's and Guile-WM's modules in the
100 ;; search path of PROG.
101 (let* ((out (assoc-ref outputs "out"))
102 (prog (string-append out "/bin/guile-wm"))
103 (mods (string-append
104 out "/share/guile/site/2.0"))
105 (xcb (string-append
106 (assoc-ref inputs "guile-xcb")
107 "/share/guile/site/2.0")))
108 (wrap-program
109 prog
110 `("GUILE_LOAD_PATH" ":" prefix (,mods ,xcb))
111 `("GUILE_LOAD_COMPILED_PATH" ":" prefix
112 (,mods ,xcb))))
113 #t))
114 (add-after 'install 'install-xsession
115 (lambda* (#:key outputs #:allow-other-keys)
116 ;; add a .desktop file to xsessions
117 (let ((xsessions (string-append
118 %output "/share/xsessions")))
119 (mkdir-p xsessions)
120 (call-with-output-file (string-append
121 xsessions "/guile-wm.desktop")
122 (lambda (port)
123 (format port
124 "[Desktop Entry]~@
23de5cbd
AW
125 Name=~a~@
126 Comment=~a~@
127 Exec=~a/bin/guile-wm~@
128 Type=Application~%"
dc1d3cde
KK
129 ,name ,synopsis %output))))
130 #t)))))
901eee2c
LC
131 (native-inputs `(("pkg-config" ,pkg-config)))
132 (inputs `(("guile" ,guile-2.0)
133 ("guile-xcb" ,guile-xcb)))
134 (home-page "http://www.markwitmer.com/guile-xcb/guile-wm.html")
901eee2c
LC
135 (description
136 "Guile-WM is a simple window manager that's completely customizable—you
137have total control of what it does by choosing which modules to include.
138Included with it are a few modules that provide basic TinyWM-like window
139management, some window record-keeping, multi-monitor support, and emacs-like
35b9e423 140keymaps and minibuffer. At this point, it's just enough to get you started.")
901eee2c 141 (license gpl3+)))