gnu: Use 'modify-phases' syntax.
[jackhill/guix/guix.git] / gnu / packages / photo.scm
1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2014, 2015 Ludovic Courtès <ludo@gnu.org>
3 ;;; Copyright © 2015 Ricardo Wurmus <rekado@elephly.net>
4 ;;; Copyright © 2015, 2017 Andreas Enge <andreas@enge.fr>
5 ;;; Copyright © 2016, 2017 Efraim Flashner <efraim@flashner.co.il>
6 ;;; Copyright © 2017 Roel Janssen <roel@gnu.org>
7 ;;;
8 ;;; This file is part of GNU Guix.
9 ;;;
10 ;;; GNU Guix is free software; you can redistribute it and/or modify it
11 ;;; under the terms of the GNU General Public License as published by
12 ;;; the Free Software Foundation; either version 3 of the License, or (at
13 ;;; your option) any later version.
14 ;;;
15 ;;; GNU Guix is distributed in the hope that it will be useful, but
16 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
17 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 ;;; GNU General Public License for more details.
19 ;;;
20 ;;; You should have received a copy of the GNU General Public License
21 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
22
23 (define-module (gnu packages photo)
24 #:use-module (guix build-system cmake)
25 #:use-module (guix build-system gnu)
26 #:use-module (guix build-system perl)
27 #:use-module (guix download)
28 #:use-module ((guix licenses) #:prefix license:)
29 #:use-module (guix packages)
30 #:use-module (guix utils)
31 #:use-module (gnu packages algebra)
32 #:use-module (gnu packages autotools)
33 #:use-module (gnu packages base)
34 #:use-module (gnu packages boost)
35 #:use-module (gnu packages compression)
36 #:use-module (gnu packages curl)
37 #:use-module (gnu packages databases)
38 #:use-module (gnu packages gettext)
39 #:use-module (gnu packages ghostscript)
40 #:use-module (gnu packages gl)
41 #:use-module (gnu packages gnome)
42 #:use-module (gnu packages glib)
43 #:use-module (gnu packages graphics)
44 #:use-module (gnu packages gtk)
45 #:use-module (gnu packages image)
46 #:use-module (gnu packages imagemagick)
47 #:use-module (gnu packages libusb)
48 #:use-module (gnu packages llvm)
49 #:use-module (gnu packages man)
50 #:use-module (gnu packages maths)
51 #:use-module (gnu packages perl)
52 #:use-module (gnu packages pkg-config)
53 #:use-module (gnu packages popt)
54 #:use-module (gnu packages python)
55 #:use-module (gnu packages readline)
56 #:use-module (gnu packages tex)
57 #:use-module (gnu packages web)
58 #:use-module (gnu packages wxwidgets)
59 #:use-module (gnu packages xfig)
60 #:use-module (gnu packages xorg)
61 #:use-module (gnu packages xml)
62 #:use-module (srfi srfi-1)
63 #:use-module (srfi srfi-26))
64
65 (define-public libraw
66 (package
67 (name "libraw")
68 (version "0.18.4")
69 (source (origin
70 (method url-fetch)
71 (uri (string-append "https://www.libraw.org/data/LibRaw-"
72 version ".tar.gz"))
73 (sha256
74 (base32
75 "15qc7g5y1m6yi6w9ia79cd6yk0836z7lqw5yigl62n768qdr7x7a"))))
76 (build-system gnu-build-system)
77 (home-page "https://www.libraw.org")
78 (synopsis "Raw image decoder")
79 (description
80 "LibRaw is a library for reading RAW files obtained from digital photo
81 cameras (CRW/CR2, NEF, RAF, DNG, and others).")
82 (license license:lgpl2.1+)))
83
84 (define-public libexif
85 (package
86 (name "libexif")
87 (version "0.6.21")
88 (source (origin
89 (method url-fetch)
90 (uri (string-append "mirror://sourceforge/libexif/libexif/"
91 version "/libexif-" version ".tar.bz2"))
92 (sha256
93 (base32
94 "06nlsibr3ylfwp28w8f5466l6drgrnydgxrm4jmxzrmk5svaxk8n"))))
95 (build-system gnu-build-system)
96 (home-page "http://libexif.sourceforge.net/")
97 (synopsis "Read and manipulate EXIF data in digital photographs")
98 (description
99 "The libexif C library allows applications to read, edit, and save EXIF
100 data as produced by digital cameras.")
101 (license license:lgpl2.1+)))
102
103 (define-public libgphoto2
104 (package
105 (name "libgphoto2")
106 (version "2.5.11")
107 (source (origin
108 (method url-fetch)
109 (uri (string-append "mirror://sourceforge/gphoto/libgphoto/"
110 version "/libgphoto2-" version ".tar.bz2"))
111 (sha256
112 (base32
113 "1ap070zz6l4kn2mbyxb1yj4x5ar8hpdbmf2pvjxgnly1ss319dkz"))))
114 (build-system gnu-build-system)
115 (native-inputs `(("pkg-config" ,pkg-config)))
116 (inputs
117 `(("libjpeg-turbo" ,libjpeg-turbo)
118 ("libltdl" ,libltdl)
119 ("libusb" ,libusb)
120 ("libxml2" ,libxml2)))
121 (propagated-inputs
122 `(;; The .pc refers to libexif.
123 ("libexif" ,libexif)))
124 (home-page "http://www.gphoto.org/proj/libgphoto2/")
125 (synopsis "Accessing digital cameras")
126 (description
127 "This is the library backend for gphoto2. It contains the code for PTP,
128 MTP, and other vendor specific protocols for controlling and transferring data
129 from digital cameras.")
130
131 ;; 'COPYING' says LGPLv2.1+, but in practices files are under LGPLv2+.
132 (license license:lgpl2.1+)))
133
134 (define-public gphoto2
135 (package
136 (name "gphoto2")
137 (version "2.5.11")
138 (source (origin
139 (method url-fetch)
140 (uri (string-append "mirror://sourceforge/gphoto/gphoto/" version
141 "/gphoto2-" version ".tar.bz2"))
142 (sha256
143 (base32
144 "1sgr6rsvzzagcwhc8fxbnvz3k02wr2hab0vrbvcb04k5l3b48a1r"))))
145 (build-system gnu-build-system)
146 (native-inputs
147 `(("pkg-config" ,pkg-config)))
148 (inputs
149 `(("readline" ,readline)
150 ("libjpeg-turbo" ,libjpeg-turbo)
151 ("popt" ,popt)
152 ("libexif" ,libexif)
153 ("libgphoto2" ,libgphoto2)))
154 (arguments
155 '(#:phases
156 (modify-phases %standard-phases
157 (add-before 'check 'pre-check
158 (lambda* (#:key inputs #:allow-other-keys)
159 (substitute* (find-files "tests/data" "\\.param$")
160 (("/usr/bin/env")
161 (which "env")))
162 #t)))
163
164 ;; FIXME: There are 2 test failures, most likely related to the build
165 ;; environment.
166 #:tests? #f))
167
168 (home-page "http://www.gphoto.org/")
169 (synopsis "Command-line tools to access digital cameras")
170 (description
171 "Gphoto2 is a set of command line utilities for manipulating a large
172 number of different digital cameras. Through libgphoto2, it supports PTP,
173 MTP, and much more.")
174
175 ;; Files are typically under LGPLv2+, but 'COPYING' says GPLv2+.
176 (license license:gpl2+)))
177
178 (define-public perl-image-exiftool
179 (package
180 (name "perl-image-exiftool")
181 (version "10.55")
182 (source (origin
183 (method url-fetch)
184 (uri (string-append
185 "mirror://cpan/authors/id/E/EX/EXIFTOOL/Image-ExifTool-"
186 version ".tar.gz"))
187 (sha256
188 (base32
189 "0z8zwjjfvyllnhsafhddbybywpgqv0pl1dbn1g034cs27yj836q2"))))
190 (build-system perl-build-system)
191 (arguments
192 '(#:phases
193 (modify-phases %standard-phases
194 (add-after 'install 'post-install
195 (lambda* (#:key outputs #:allow-other-keys)
196 ;; Make sure the 'exiftool' commands finds the library.
197 ;; XXX: Shouldn't it be handled by PERL-BUILD-SYSTEM?
198 (let* ((out (assoc-ref outputs "out"))
199 (pm (find-files out "^ExifTool\\.pm$"))
200 (lib (dirname (dirname (car pm)))))
201 (wrap-program (string-append out "/bin/exiftool")
202 `("PERL5LIB" prefix (,lib)))))))))
203 (home-page "http://search.cpan.org/dist/Image-ExifTool")
204 (synopsis "Program and Perl library to manipulate EXIF and other metadata")
205 (description "This package provides the @code{exiftool} command and the
206 @code{Image::ExifTool} Perl library to manipulate EXIF tags of digital images
207 and a wide variety of other metadata.")
208 (license license:perl-license)))
209
210 (define-public libpano13
211 (package
212 (name "libpano13")
213 (version "2.9.19")
214 (source (origin
215 (method url-fetch)
216 (uri (string-append "mirror://sourceforge/panotools/libpano13/"
217 "libpano13-" version "/"
218 "libpano13-" version ".tar.gz"))
219 (sha256
220 (base32
221 "1a4m3plmfcrrplqs9zfzhc5apibn10m5sajpizm1sd3q74w5fwq3"))))
222 (build-system cmake-build-system)
223 (inputs
224 `(("libjpeg" ,libjpeg)
225 ("libpng" ,libpng)
226 ("libtiff" ,libtiff)
227 ("zlib" ,zlib)))
228 (home-page "http://panotools.sourceforge.net/")
229 (synopsis "Library for panoramic images")
230 (description
231 "The libpano13 package contains the backend library written by the
232 Panorama Tools project for building panoramic images from a set of
233 overlapping images, as well as some command line tools.")
234 (license license:gpl2+)))
235
236 (define-public enblend-enfuse
237 (package
238 (name "enblend-enfuse")
239 (version "4.2")
240 (source (origin
241 (method url-fetch)
242 (uri (string-append "mirror://sourceforge/enblend/"
243 name "/"
244 name "-" (version-major+minor version) "/"
245 name "-" version ".tar.gz"))
246 (sha256
247 (base32
248 "0j5x011ilalb47ssah50ag0a4phgh1b0wdgxdbbp1gcyjcjf60w7"))))
249 (build-system gnu-build-system)
250 (native-inputs
251 `(("pkg-config" ,pkg-config)
252 ("perl" ,perl)
253 ("perl-timedate" ,perl-timedate)
254 ;; for building the documentation
255 ("gnuplot" ,gnuplot)
256 ("help2man" ,help2man)
257 ("imagemagick" ,imagemagick)
258 ("libxml2" ,libxml2)
259 ("texlive-minimal" ,texlive-tiny)
260 ("tidy" ,tidy)
261 ("transfig" ,transfig)))
262 (inputs
263 `(("boost" ,boost)
264 ("gsl" ,gsl)
265 ("lcms" ,lcms)
266 ("libjpeg" ,libjpeg)
267 ("libpng" ,libpng)
268 ("libtiff" ,libtiff)
269 ("openexr" ,openexr)
270 ("vigra" ,vigra)
271 ("zlib" ,zlib)))
272 (arguments
273 `(#:configure-flags `("--enable-openmp")))
274 (home-page "http://enblend.sourceforge.net/")
275 (synopsis "Tools for combining and blending images")
276 (description
277 "Enblend blends away the seams in a panoramic image mosaic using a
278 multi-resolution spline. Enfuse merges different exposures of the same
279 scene to produce an image that looks much like a tone-mapped image.")
280 (license license:gpl2+)))
281
282 (define-public lensfun
283 (package
284 (name "lensfun")
285 (version "0.3.2")
286 (source (origin
287 (method url-fetch)
288 (uri (string-append
289 "mirror://sourceforge/lensfun/"
290 version "/lensfun-" version ".tar.gz"))
291 (sha256
292 (base32
293 "0cfk8jjhs9nbfjfdy98plrj9ayi59aph0nx6ppslgjhlcvacm2xf"))))
294 (build-system cmake-build-system)
295 (arguments
296 `(,@(if (any (cute string-prefix? <> (or (%current-system)
297 (%current-target-system)))
298 '("x86_64" "i686"))
299 ;; SSE and SSE2 are supported only on Intel processors.
300 '()
301 '(#:configure-flags '("-DBUILD_FOR_SSE=OFF" "-DBUILD_FOR_SSE2=OFF")))
302 #:tests? #f)) ; There are no tests to run.
303 (native-inputs
304 `(("pkg-config" ,pkg-config)))
305 (inputs
306 `(("glib" ,glib)))
307 (home-page "https://sourceforge.net/projects/lensfun/")
308 (synopsis "Library to correct optical lens defects with a lens database")
309 (description "Digital photographs are not ideal. Of course, the better is
310 your camera, the better the results will be, but in any case if you look
311 carefully at shots taken even by the most expensive cameras equipped with the
312 most expensive lenses you will see various artifacts. It is very hard to make
313 ideal cameras, because there are a lot of factors that affect the final image
314 quality, and at some point camera and lens designers have to trade one factor
315 for another to achieve the optimal image quality, within the given design
316 restrictions and budget. But we all want ideal shots, don't we? So that's
317 what's Lensfun is all about: rectifying the defects introduced by your
318 photographic equipment.")
319 ;; The libraries are licensed under the LGPL3, the programs are
320 ;; licensed GPL3, and the database is license CC-BY-SA 3.0. See the
321 ;; README.md file for this clarification.
322 (license (list license:lgpl3 license:gpl3 license:cc-by-sa3.0))))
323
324 (define-public darktable
325 (package
326 (name "darktable")
327 (version "2.2.5")
328 (source (origin
329 (method url-fetch)
330 (uri (string-append
331 "https://github.com/darktable-org/darktable/releases/"
332 "download/release-"
333 version "/darktable-" version ".tar.xz"))
334 (sha256
335 (base32
336 "10gjzd4irxhladh4jyss9kgp627k8vgx2divipsb33pp6cms80z3"))))
337 (build-system cmake-build-system)
338 (arguments
339 `(#:tests? #f ; There are no tests.
340 #:configure-flags '("-DCMAKE_INSTALL_LIBDIR=lib")
341 #:make-flags
342 (list
343 (string-append "CPATH=" (assoc-ref %build-inputs "ilmbase")
344 "/include/OpenEXR:" (or (getenv "CPATH") "")))
345 #:phases
346 (modify-phases %standard-phases
347 (add-before 'configure 'set-ldflags
348 (lambda* (#:key outputs #:allow-other-keys)
349 (setenv "LDFLAGS"
350 (string-append
351 "-Wl,-rpath="
352 (assoc-ref outputs "out") "/lib/darktable"))
353 #t)))))
354 (native-inputs
355 `(("llvm" ,llvm-3.9.1)
356 ("clang" ,clang-3.9.1)))
357 (inputs
358 `(("libxslt" ,libxslt)
359 ("libxml2" ,libxml2)
360 ("pugixml" ,pugixml)
361 ("gtk+" ,gtk+)
362 ("sqlite" ,sqlite)
363 ("libjpeg" ,libjpeg)
364 ("libpng" ,libpng)
365 ("cairo" ,cairo)
366 ("lcms" ,lcms)
367 ("exiv2" ,exiv2)
368 ("libtiff" ,libtiff)
369 ("curl" ,curl)
370 ("libgphoto2" ,libgphoto2)
371 ("dbus-glib" ,dbus-glib)
372 ("openexr" ,openexr)
373 ("ilmbase" ,ilmbase)
374 ("libsoup" ,libsoup)
375 ("python-jsonschema" ,python-jsonschema)
376 ("intltool" ,intltool)
377 ("perl" ,perl)
378 ("pkg-config" ,pkg-config)
379 ("libwebp" ,libwebp)
380 ("lensfun" ,lensfun)
381 ("librsvg" ,librsvg)
382 ("json-glib" ,json-glib)
383 ("freeimage" ,freeimage)))
384 (home-page "https://www.darktable.org")
385 (synopsis "Virtual lighttable and darkroom for photographers")
386 (description "Darktable is a photography workflow application and RAW
387 developer. It manages your digital negatives in a database, lets you view
388 them through a zoomable lighttable and enables you to develop raw images
389 and enhance them.")
390 ;; see src/is_supported_platform.h for supported platforms
391 (supported-systems '("i686-linux" "x86_64-linux" "aarch64-linux"))
392 (license license:gpl3+)))
393
394 (define-public hugin
395 (package
396 (name "hugin")
397 (version "2016.2.0")
398 (source (origin
399 (method url-fetch)
400 (uri (string-append "mirror://sourceforge/hugin/hugin/hugin-"
401 (version-major+minor version)
402 "/hugin-" version ".tar.bz2"))
403 (sha256
404 (base32
405 "058zd63vx29yrx2pphbbll7kzcxkai22q26lpw13rn4lvp41pasl"))))
406 (build-system cmake-build-system)
407 (native-inputs
408 `(("gettext" ,gnu-gettext)
409 ("pkg-config" ,pkg-config)))
410 (inputs
411 `(("boost" ,boost)
412 ("enblend-enfuse" ,enblend-enfuse)
413 ("exiv2" ,exiv2)
414 ("fftw" ,fftw)
415 ("flann" ,flann)
416 ("freeglut" ,freeglut)
417 ("glew" ,glew)
418 ("lcms" ,lcms)
419 ("libjpeg" ,libjpeg)
420 ("libpano13" ,libpano13)
421 ("libpng" ,libpng)
422 ("libtiff" ,libtiff)
423 ("libxi" ,libxi)
424 ("libxmu" ,libxmu)
425 ("mesa" ,mesa)
426 ("openexr" ,openexr)
427 ("sqlite" ,sqlite)
428 ("vigra" ,vigra)
429 ("wxwidgets" ,wxwidgets)
430 ("zlib" ,zlib)))
431 (arguments
432 `(#:tests? #f ; no check target
433 #:configure-flags
434 (list
435 ;; The header files of ilmbase (propagated by openexr) are not found
436 ;; when included by the header files of openexr, and an explicit
437 ;; flag needs to be set.
438 (string-append "-DCMAKE_CXX_FLAGS=-I"
439 (assoc-ref %build-inputs "ilmbase")
440 "/include/OpenEXR")
441 ;; Disable installation of the Python scripting interface.
442 ;; It would require the additional inputs python and swig.
443 ;; Installation would need to be tweaked, as it tries to install
444 ;; into the python directory.
445 "-DBUILD_HSI=OFF")
446 #:phases
447 (modify-phases %standard-phases
448 (add-before 'configure 'substitute
449 (lambda _
450 (substitute* "src/hugin1/base_wx/StitchingExecutor.cpp"
451 (("wxT\\(\"enblend\"\\)")
452 (string-append "wxT(\"" (which "enblend") "\")"))
453 (("wxT\\(\"enfuse\"\\)")
454 (string-append "wxT(\"" (which "enfuse") "\")")))
455 #t)))))
456 (home-page "http://hugin.sourceforge.net/")
457 (synopsis "Panorama photo stitcher")
458 (description
459 "Hugin is an easy to use panoramic imaging toolchain with a graphical
460 user interface. It can be used to assemble a mosaic of photographs into
461 a complete panorama and stitch any series of overlapping pictures.")
462 (license license:gpl2+)))
463