gnu: Add SWT.
[jackhill/guix/guix.git] / gnu / packages / music.scm
CommitLineData
1b6826d3
RW
1;;; GNU Guix --- Functional package management for GNU
2;;; Copyright © 2015 Ricardo Wurmus <rekado@elephly.net>
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(define-module (gnu packages music)
20 #:use-module (guix utils)
21 #:use-module (guix packages)
22 #:use-module (guix download)
23 #:use-module ((guix licenses) #:prefix license:)
24 #:use-module (guix build-system gnu)
25 #:use-module (gnu packages)
c267cc15 26 #:use-module (gnu packages audio)
1b6826d3
RW
27 #:use-module (gnu packages bison)
28 #:use-module (gnu packages docbook)
29 #:use-module (gnu packages flex)
30 #:use-module (gnu packages fonts)
31 #:use-module (gnu packages fontutils)
32 #:use-module (gnu packages gettext)
33 #:use-module (gnu packages ghostscript)
c267cc15 34 #:use-module (gnu packages gnome)
1b6826d3
RW
35 #:use-module (gnu packages gtk)
36 #:use-module (gnu packages guile)
c267cc15 37 #:use-module (gnu packages image)
1b6826d3 38 #:use-module (gnu packages imagemagick)
c267cc15
RW
39 #:use-module (gnu packages linux) ; for alsa-utils
40 #:use-module (gnu packages man)
41 #:use-module (gnu packages mp3)
1b6826d3
RW
42 #:use-module (gnu packages netpbm)
43 #:use-module (gnu packages perl)
44 #:use-module (gnu packages pkg-config)
45 #:use-module (gnu packages python)
46 #:use-module (gnu packages rsync)
47 #:use-module (gnu packages texinfo)
48 #:use-module (gnu packages texlive)
c267cc15
RW
49 #:use-module (gnu packages xml)
50 #:use-module (gnu packages xiph)
1b6826d3
RW
51 #:use-module (gnu packages zip))
52
53(define-public lilypond
54 (package
55 (name "lilypond")
56 (version "2.18.2")
57 (source (origin
58 (method url-fetch)
59 (uri (string-append
60 "http://download.linuxaudio.org/lilypond/sources/v"
61 (version-major+minor version) "/"
62 name "-" version ".tar.gz"))
63 (sha256
64 (base32
65 "01xs9x2wjj7w9appaaqdhk15r1xvvdbz9qwahzhppfmhclvp779j"))))
66 (build-system gnu-build-system)
67 (arguments
68 `(;; Tests fail with this error:
69 ;; Undefined subroutine &main::get_index called at
70 ;; ./lilypond-2.18.2/Documentation/lilypond-texi2html.init line 2127.
71 #:tests? #f
72 #:out-of-source? #t
73 #:phases
74 (alist-cons-before
75 'configure 'prepare-configuration
76 (lambda _
77 (substitute* "configure"
78 (("SHELL=/bin/sh") "SHELL=sh"))
79 (setenv "out" "")
80 #t)
81 %standard-phases)))
82 (inputs
83 `(("guile" ,guile-1.8)
84 ("font-dejavu" ,font-dejavu)
85 ("fontconfig" ,fontconfig)
86 ("freetype" ,freetype)
87 ("ghostscript" ,ghostscript)
88 ("pango" ,pango)
89 ("python" ,python-2)))
90 (native-inputs
91 `(("bison" ,bison)
92 ("perl" ,perl)
93 ("flex" ,flex)
94 ("fontforge" ,fontforge)
95 ("dblatex" ,dblatex)
96 ("gettext" ,gnu-gettext)
97 ("imagemagick" ,imagemagick)
98 ("netpbm" ,netpbm) ;for pngtopnm
99 ("texlive" ,texlive) ;metafont and metapost
100 ("texinfo" ,texinfo)
101 ("texi2html" ,texi2html)
102 ("rsync" ,rsync)
103 ("pkg-config" ,pkg-config)
104 ("zip" ,zip)))
105 (home-page "http://www.lilypond.org/")
106 (synopsis "Music typesetting")
107 (description
108 "GNU LilyPond is a music typesetter, which produces high-quality sheet
109music. Music is input in a text file containing control sequences which are
110interpreted by LilyPond to produce the final document. It is extendable with
111Guile.")
112 (license license:gpl3+)))
c267cc15
RW
113
114(define-public solfege
115 (package
116 (name "solfege")
117 (version "3.22.2")
118 (source (origin
119 (method url-fetch)
120 (uri (string-append
121 "mirror://gnu/solfege/solfege-"
122 version ".tar.xz"))
123 (sha256
124 (base32
125 "1w25rxdbj907nsx285k9nm480pvy12w3yknfh4n1dfv17cwy072i"))))
126 (build-system gnu-build-system)
127 (arguments
128 `(#:tests? #f ; xmllint attempts to download DTD
129 #:test-target "test"
130 #:phases
131 (alist-cons-after
132 'unpack 'fix-configuration
133 (lambda* (#:key inputs #:allow-other-keys)
134 (substitute* "default.config"
135 (("csound=csound")
136 (string-append "csound="
137 (assoc-ref inputs "csound")
138 "/bin/csound"))
139 (("/usr/bin/aplay")
140 (string-append (assoc-ref inputs "aplay")
141 "/bin/aplay"))
142 (("/usr/bin/timidity")
143 (string-append (assoc-ref inputs "timidity")
144 "/bin/timidity"))
145 (("/usr/bin/mpg123")
146 (string-append (assoc-ref inputs "mpg123")
147 "/bin/mpg123"))
148 (("/usr/bin/ogg123")
149 (string-append (assoc-ref inputs "ogg123")
150 "/bin/ogg123"))))
151 (alist-cons-before
152 'build 'patch-python-shebangs
153 (lambda _
154 ;; Two python scripts begin with a Unicode BOM, so patch-shebang
155 ;; has no effect.
156 (substitute* '("solfege/parsetree.py"
157 "solfege/presetup.py")
158 (("#!/usr/bin/python") (string-append "#!" (which "python")))))
159 (alist-cons-before
160 'build 'add-sitedirs
161 ;; .pth files are not automatically interpreted unless the
162 ;; directories containing them are added as "sites". The directories
163 ;; are then added to those in the PYTHONPATH. This is required for
164 ;; the operation of pygtk and pygobject.
165 (lambda _
166 (substitute* "run-solfege.py"
167 (("import os")
168 "import os, site
169for path in [path for path in sys.path if 'site-packages' in path]: site.addsitedir(path)")))
170 (alist-cons-before
171 'build 'adjust-config-file-prefix
172 (lambda* (#:key outputs #:allow-other-keys)
173 (substitute* "run-solfege.py"
174 (("prefix = os.path.*$")
175 (string-append "prefix = " (assoc-ref outputs "out")))))
176 (alist-cons-after
177 'install 'wrap-program
178 (lambda* (#:key inputs outputs #:allow-other-keys)
179 ;; Make sure 'solfege' runs with the correct PYTHONPATH. We
180 ;; also need to modify GDK_PIXBUF_MODULE_FILE for SVG support.
181 (let* ((out (assoc-ref outputs "out"))
182 (path (getenv "PYTHONPATH"))
183 (rsvg (assoc-ref inputs "librsvg"))
184 (pixbuf (find-files rsvg "^loaders\\.cache$")))
185 (wrap-program (string-append out "/bin/solfege")
186 `("PYTHONPATH" ":" prefix (,path))
187 `("GDK_PIXBUF_MODULE_FILE" ":" prefix ,pixbuf))))
188 %standard-phases)))))))
189 (inputs
190 `(("python" ,python-2)
191 ("pygtk" ,python2-pygtk)
192 ("gettext" ,gnu-gettext)
193 ("gtk" ,gtk+)
194 ;; TODO: Lilypond is optional. Produces errors at build time:
195 ;; Drawing systems...Error: /undefinedresult in --glyphshow--
196 ;; Fontconfig is needed to fix one of the errors, but other similar
197 ;; errors remain.
198 ;;("lilypond" ,lilypond)
199 ("librsvg" ,librsvg) ; needed at runtime for icons
200 ("libpng" ,libpng) ; needed at runtime for icons
201 ;; players needed at runtime
202 ("aplay" ,alsa-utils)
203 ("csound" ,csound) ; optional, needed for some exercises
204 ("mpg123" ,mpg123)
205 ("ogg123" ,vorbis-tools)
206 ("timidity" ,timidity++)))
207 (native-inputs
208 `(("pkg-config" ,pkg-config)
209 ("txt2man" ,txt2man)
210 ("libxml2" ,libxml2) ; for tests
211 ("ghostscript" ,ghostscript)
212 ;;("fontconfig" ,fontconfig) ; only needed with lilypond
213 ;;("freetype" ,freetype) ; only needed with lilypond
214 ("texinfo" ,texinfo)))
215 (home-page "https://www.gnu.org/software/solfege/")
216 (synopsis "Ear training")
217 (description
218 "GNU Solfege is a program for practicing musical ear-training. With it,
219you can practice your recognition of various musical intervals and chords. It
220features a statistics overview so you can monitor your progress across several
221sessions. Solfege is also designed to be extensible so you can easily write
222your own lessons.")
223 (license license:gpl3+)))