;;; GNU Guix --- Functional package management for GNU ;;; Copyright © 2013, 2017, 2019, 2021-2022 Ludovic Courtès ;;; Copyright © 2013, 2015, 2016 Andreas Enge ;;; Copyright © 2014, 2015, 2016, 2020 Mark H Weaver ;;; Copyright © 2014, 2015 Alex Kost ;;; Copyright © 2014, 2016, 2017, 2018, 2019 Ricardo Wurmus ;;; Copyright © 2015 Taylan Ulrich Bayırlı/Kammer ;;; Copyright © 2015 Amirouche Boubekki ;;; Copyright © 2014, 2017 John Darrington ;;; Copyright © 2016, 2017, 2018, 2020 Leo Famulari ;;; Copyright © 2016-2023 Efraim Flashner ;;; Copyright © 2016–2022 Tobias Geerinckx-Rice ;;; Copyright © 2016 Eric Bavier ;;; Copyright © 2016, 2017, 2020, 2021, 2022 Arun Isaac ;;; Copyright © 2016, 2017 Kei Kebreau ;;; Copyright © 2017 Nikita ;;; Co
aboutsummaryrefslogtreecommitdiff
blob: 334e014a39871d17361fbcaf4d0a51bb591b1966 (about) (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2020 Danny Milosavljevic <dannym@scratchpost.org>
;;; Copyright © 2021 Stefan <stefan-guix@vodafonemail.de>
;;; Copyright © 2022, 2023 Maxim Cournoyer <maxim.cournoyer@gmail.com>
;;;
;;; This file is part of GNU Guix.
;;;
;;; GNU Guix is free software; you can redistribute it and/or modify it
;;; under the terms of the GNU General Public License as published by
;;; the Free Software Foundation; either version 3 of the License, or (at
;;; your option) any later version.
;;;
;;; GNU Guix is distributed in the hope that it will be useful, but
;;; WITHOUT ANY WARRANTY; without even the implied warranty of
;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;;; GNU General Public License for more details.
;;;
;;; You should have received a copy of the GNU General Public License
;;; along with GNU Guix.  If not, see <http://www.gnu.org/licenses/>.

(define-module (gnu packages raspberry-pi)
  #:use-module (gnu bootloader)
  #:use-module (gnu bootloader grub)
  #:use-module (gnu packages)
  #:use-module (gnu packages admin)
  #:use-module (gnu packages algebra)
  #:use-module (gnu packages backup)
  #:use-module (gnu packages base)
  #:use-module (gnu packages bash)
  #:use-module (gnu packages bootloaders)
  #:use-module (gnu packages commencement)
  #:use-module (gnu packages cross-base)
  #:use-module (gnu packages curl)
  #:use-module (gnu packages documentation)
  #:use-module (gnu packages embedded)
  #:use-module (gnu packages file)
  #:use-module (gnu packages gcc)
  #:use-module (gnu packages guile)
  #:use-module (gnu packages linux)
  #:use-module (gnu packages pkg-config)
  #:use-module (gnu packages qt)
  #:use-module (gnu packages tls)
  #:use-module (guix build-system cmake)
  #:use-module (guix build-system copy)
  #:use-module (guix build-system gnu)
  #:use-module (guix build-system qt)
  #:use-module (guix download)
  #:use-module (guix git-download)
  #:use-module ((guix licenses) #:prefix license:)
  #:use-module (guix packages)
  #:use-module (guix gexp)
  #:use-module (guix store)
  #:use-module (guix monads)
  #:use-module (guix utils)
  #:use-module (srfi srfi-1)
  #:use-module (srfi srfi-2)
  #:use-module (srfi srfi-26)
  #:use-module (ice-9 match)
  #:export (make-raspi-bcm28-dtbs
            raspi-config-file
            raspi-custom-txt))

(define-public bcm2835
  (package
    (name "bcm2835")
    (version "1.64")
    (source (origin
              (method url-fetch)
              (uri (string-append
                    "http://www.airspayce.com/mikem/bcm2835/bcm2835-"
                    version ".tar.gz"))
              (sha256
               (base32
                "06s81540iz4vsh0cm6jwah2x0hih79v42pfa4pgr8kcbv56158h6"))))
    (build-system gnu-build-system)
    (arguments
     `(#:tests? #f))    ; Would need to be root
    ;; doc/html docs would not be installed anyway.
    ;(native-inputs
    ; `(("doxygen" ,doxygen)))
    (synopsis "C library for Broadcom BCM 2835 as used in Raspberry Pi")
    (description "This package provides a C library for Broadcom BCM 2835 as
used in the Raspberry Pi")
    (home-page "https://www.airspayce.com/mikem/bcm2835/")
    (supported-systems '("armhf-linux" "aarch64-linux"))
    (license license:gpl3)))

(define raspi-gpio
  (let ((commit "6d0769ac04760b6e9f33b4aa1f11c682237bf368")
        (revision "1"))
    (package
      (name "raspi-gpio")
      (version (git-version "0.1" revision commit))
      (source (origin
                (method git-fetch)
                (uri (git-reference
                      (url "https://github.com/RPi-Distro/raspi-gpio")
                      (commit commit)))
                (file-name (git-file-name name version))
                (sha256
                 (base32
                  "1fia1ma586hwhpda0jz86j6i55andq0wncbhzhzvhf7yc773cpi4"))))
      (build-system gnu-build-system)
      (synopsis "State dumper for BCM270x GPIOs")
      (description "Tool to help debug / hack at the BCM283x GPIO. You can dump
  the state of a GPIO or (all GPIOs). You can change a GPIO mode and pulls (and
  level if set as an output).  Beware this tool writes directly to the BCM283x
  GPIO reisters, ignoring anything else that may be using them (like Linux
  drivers).")
      (home-page "https://github.com/RPi-Distro/raspi-gpio")
      (supported-systems '("armhf-linux" "aarch64-linux"))
      (license license:bsd-3))))

(define %rpi-open-firmware-version "0.1")
(define %rpi-open-firmware-origin
  (origin
   (method git-fetch)
   (uri (git-reference
         (url "https://github.com/librerpi/rpi-open-firmware")
         (commit "6be45466e0be437a1b0b3512a86f3d9627217006")))
   (file-name "rpi-open-firmware-checkout")
   (sha256
    (base32 "1wyxvv62i3rjicg4hd94pzbgpadinnrgs27sk39md706mm0qixbh"))))

(define-public raspi-arm-chainloader
  (package
    (name "raspi-arm-chainloader")
    (version %rpi-open-firmware-version)
    (source %rpi-open-firmware-origin)
    (build-system gnu-build-system)
    (arguments
     `(#:tests? #f                   ; No tests exist
       #:phases
       (modify-phases %standard-phases
         (delete 'configure)
         (add-before 'build 'setenv
           (lambda _
             (setenv "CC" "arm-none-eabi-gcc")
             (setenv "CXX" "arm-none-eabi-g++")
             (setenv "AS" "arm-none-eabi-as")
             (setenv "OBJCOPY" "arm-none-eabi-objcopy")
             (setenv "BAREMETAL" "1")
             #t))
         (add-after 'setenv 'build-tlsf
           (lambda _
             (with-directory-excursion "tlsf"
               ;; Note: Adding "-I../common -I../notc/include".
               (invoke "make"
                       "CFLAGS=-mtune=arm1176jzf-s -march=armv6zk -mfpu=vfp -mfloat-abi=softfp -I../common -I../notc/include"))))
         (add-after 'build-tlsf 'build-common
           (lambda _
             (with-directory-excursion "common"
               (invoke "make"
                       ;; Note: Adding "-I.. -I../notc/include".
                       "ARMCFLAGS=-mtune=arm1176jzf-s -march=armv6zk -marm -I.. -I../notc/include"))))
         (add-after 'build-common 'build-notc
           (lambda _
             (with-directory-excursion "notc"
               (invoke "make"))))
         (add-after 'build-notc 'chdir
           (lambda _
             (chdir "arm_chainloader")
             (substitute* "Makefile"
              (("-I[.][.]/")
               "-I../common -I../common/include -I../notc/include -I../")
              (("-ltlsf")
               "-L../common -L../notc -L../tlsf -ltlsf"))
             #t))
         (replace 'install
           (lambda* (#:key outputs #:allow-other-keys)
             (let* ((out (assoc-ref outputs "out"))
                    (libexec (string-append out "/libexec")))
               (mkdir-p libexec)
               (install-file "build/arm_chainloader.elf" libexec)
               (install-file "build/arm_chainloader.map" libexec)
               (install-file "build/arm_chainloader.bin" libexec)
               #t))))))
    (native-inputs
     `(("binutils" ,(cross-binutils "arm-none-eabi"))
       ("gcc" ,gcc-arm-none-eabi-6)))
    (inputs
     `())
    (synopsis "Raspberry Pi ARM bootloader")
    (description "This package provides a bootloader for the ARM part of a
Raspberry Pi.  Note: It does not work on Raspberry Pi 1.")
    (home-page "https://github.com/librerpi/rpi-open-firmware/")
    (license license:gpl2+)))

(define-public raspi-arm64-chainloader
  (package
    (inherit raspi-arm-chainloader)
    (name "raspi-arm64-chainloader")
    ;; These native-inputs especially don't contain a libc.
    (native-inputs
     `(("bash" ,bash)
       ("binutils" ,binutils)
       ("coreutils" ,coreutils)
       ("file" ,file)
       ("ld-wrapper" ,ld-wrapper)
       ("make" ,gnu-make)
       ("gcc" ,gcc-6)
       ("locales" ,glibc-utf8-locales)))
    (inputs
     `())
    (arguments
     `(#:implicit-inputs? #f
       ,@(substitute-keyword-arguments (package-arguments raspi-arm-chainloader)
         ((#:phases phases)
          `(modify-phases ,phases
             (replace 'setenv
               (lambda _
                 (setenv "AS" "as") ; TODO: as-for-target
                 (setenv "OBJCOPY" "objcopy")
                 (setenv "CC" ,(cc-for-target))
                 (setenv "CXX" ,(cc-for-target))
                 (setenv "BAREMETAL" "1")
                 #t))
             (add-after 'setenv 'build-tlsf
               (lambda _
                 (with-directory-excursion "tlsf"
                   (invoke "make"
                           "CFLAGS=-I../common -I../notc/include"))))
             (replace 'build-common
               (lambda _
                 (with-directory-excursion "common"
                   ;; Autodetection uses the CC filename for detecting the architecture.
                   ;; Since we are not using a cross-compiler, we side-step that.
                   (invoke "make"
                           "CFLAGS=-Ilib -I. -Iinclude -ffunction-sections -Wall -g -nostdlib -nostartfiles -ffreestanding -DBAREMETAL"))))
             (replace 'build-notc
               (lambda _
                 (with-directory-excursion "notc"
                   ;; Autodetection uses the CC filename for detecting the architecture.
                   ;; Since we are not using a cross-compiler, we side-step that.
                   (invoke "make"
                           "CFLAGS=-Iinclude -g"))))
             (replace 'chdir
               (lambda _
                 (chdir "arm64")
                 (substitute* "Makefile"
                  (("CFLAGS =")
                   "CFLAGS = -I../common -I../common/include -I../notc/include -I.. -DBAREMETAL")
                  (("-lcommon")
                   "-L../common -L../notc -lcommon"))
                 #t))
         (replace 'install
           (lambda* (#:key outputs #:allow-other-keys)
             (let* ((out (assoc-ref outputs "out"))
                    (libexec (string-append out "/libexec")))
               (mkdir-p libexec)
               (install-file "arm64.elf" libexec)
               (install-file "arm64.map" libexec)
               (install-file "arm64.bin" libexec)
               #t))))))))
    (supported-systems '("aarch64-linux"))))

(define (raspi-config-file name content)
  "Make a configuration file like config.txt for the Raspberry Pi firmware.
CONTENT can be a list of strings, which are concatenated with a newline
character.  Alternatively CONTENT can be a string with the full file content."
  (plain-file
   name
   (if (list? content)
       (string-join content "\n" 'suffix)
       content)))

(define-public %raspi-config-txt
  ;; A config.txt file to start the ARM cores up in 64-bit mode if necessary
  ;; and to include a dtb.txt, bootloader.txt, and a custom.txt, each with
  ;; separated configurations for the Raspberry Pi firmware.
  (raspi-config-file
   "config.txt"
   `("# See https://www.raspberrypi.org/documentation/configuration/config-txt/README.md for details."
     ""
     ,(string-append "arm_64bit=" (if (target-aarch64?) "1" "0"))
     "include dtb.txt"
     "include bootloader.txt"
     "include custom.txt")))

(define-public %raspi-bcm27-dtb-txt
  ;; A dtb.txt file to be included by the config.txt to ensure that the
  ;; downstream device tree files bcm27*.dtb will be used.
  (raspi-config-file
   "dtb.txt"
   "upstream_kernel=0"))

(define-public %raspi-bcm28-dtb-txt
  ;; A dtb.txt file to be included by the config.txt to ensure that the
  ;; upstream device tree files bcm28*.dtb will be used.
  ;; This also implies the use of the dtoverlay=upstream.
  (raspi-config-file
   "dtb.txt"
   "upstream_kernel=1"))

(define-public %raspi-u-boot-bootloader-txt
  ;; A bootloader.txt file to be included by the config.txt to load the
  ;; U-Boot bootloader.
  (raspi-config-file
   "bootloader.txt"
   '("dtoverlay=upstream"
     "enable_uart=1"
     "kernel=u-boot.bin")))

(define (raspi-custom-txt content)
  "Make a custom.txt file for the Raspberry Pi firmware.
CONTENT can be a list of strings, which are concatenated with a newline
character.  Alternatively CONTENT can be a string with the full file content."
  (raspi-config-file "custom.txt" content))

(define (make-raspi-bcm28-dtbs linux)
  "Make a package with the device-tree files for Raspberry Pi models from the
kernel LINUX."
  (package
    (inherit linux)
    (name "raspi-bcm28-dtbs")
    (source #f)
    (build-system copy-build-system)
    (arguments
     #~(list
        #:phases #~(modify-phases %standard-phases (delete 'unpack))
        #:install-plan
        (list (list (search-input-directory %build-inputs
                                            "lib/dtbs/broadcom/")
                    "." #:include-regexp '("/bcm....-rpi.*\\.dtb")))))
    (inputs (list linux))
    (synopsis "Device-tree files for a Raspberry Pi")
    (description
     (format #f "The device-tree files for Raspberry Pi models from ~a."
             (package-name linux)))))

(define-public grub-efi-bootloader-chain-raspi-64
  ;; A bootloader capable to boot a Raspberry Pi over network via TFTP or from
  ;; a local storage like a micro SD card.  It neither installs firmware nor
  ;; device-tree files for the Raspberry Pi.  It just assumes them to be
  ;; existing in boot/efi in the same way that some UEFI firmware with ACPI
  ;; data is usually assumed to be existing on PCs.  It creates firmware
  ;; configuration files and a bootloader-chain with U-Boot to provide an EFI
  ;; API for the final GRUB bootloader.  It also serves as a blue-print to
  ;; create an a custom bootloader-chain with firmware and device-tree
  ;; packages or files.
  (efi-bootloader-chain grub-efi-netboot-removable-bootloader
                        #:packages (list u-boot-rpi-arm64-efi-bin)
                        #:files (list %raspi-config-txt
                                      %raspi-bcm27-dtb-txt
                                      %raspi-u-boot-bootloader-txt)))

(define (make-raspi-defconfig arch defconfig sha256-as-base32)
  "Make for the architecture ARCH a file-like object from the DEFCONFIG file
with the hash SHA256-AS-BASE32.  This object can be used as the #:defconfig
argument of the function (modify-linux)."
  (make-defconfig
   (string-append
    ;; This is from commit 7838840 on branch rpi-5.18.y,
    ;; see https://github.com/raspberrypi/linux/tree/rpi-5.18.y/
    ;; and https://github.com/raspberrypi/linux/commit/7838840b5606a2051b31da4c598466df7b1c3005
    "https://raw.githubusercontent.com/raspberrypi/linux/7838840b5606a2051b31da4c598466df7b1c3005/arch/"
    arch "/configs/" defconfig)
   sha256-as-base32))

(define-public %bcm2709-defconfig
  (make-raspi-defconfig
   "arm" "bcm2709_defconfig"
   "1hcxmsr131f92ay3bfglrggds8ajy904yj3vw7c42i4c66256a79"))

(define-public %bcm2711-defconfig
  (make-raspi-defconfig
   "arm" "bcm2711_defconfig"
   "1n7g5yq0hdp8lh0x6bfxph2ff8yn8zisdj3qg0gbn83j4v8i1zbd"))

(define-public %bcm2711-defconfig-64
  (make-raspi-defconfig
   "arm64" "bcm2711_defconfig"
   "0k9q7qvw826v2hrp49xnxnw93pnnkicwx869chvlf7i57461n4i7"))

(define-public %bcmrpi3-defconfig
  (make-raspi-defconfig
   "arm64" "bcmrpi3_defconfig"
   "1bfnl4p0ddx3200dg91kmh2pln36w95y05x1asc312kixv0jgd81"))

(define-public raspberrypi-userland
  ;; There are no release nor tag; use the latest commit.
  (let ((revision "0")
        (commit "54fd97ae4066a10b6b02089bc769ceed328737e0"))
    (package
      (name "raspberrypi-userland")
      (version (git-version "0.0.0" revision commit))
      (source (origin
                (method git-fetch)
                (uri (git-reference
                      (url "https://github.com/raspberrypi/userland")
                      (commit commit)))
                (file-name (git-file-name name version))
                (sha256
                 (base32
                  "01853x2kx36vcm1wd0p20v72kw2p4xhnzp36jivh06mhma9b3h2v"))))
      (build-system cmake-build-system)
      (arguments
       (list
        #:tests? #f                     ;no test suite
        #:configure-flags #~(list (string-append "-DVMCS_INSTALL_PREFIX="
                                                 #$output))
        #:phases
        #~(modify-phases %standard-phases
            (add-after 'unpack 'patch-paths
              (lambda _
                (substitute* "interface/khronos/ext/egl_khr_image_client.c"
                  (("/opt/vc/lib/libvcsm.so")
                   (string-append #$output "/lib/libvcsm.so")))))
            (add-after 'unpack 'disable-hello_pi
              (lambda _
                ;; Do not build hello_pi, which installs 32 MiB of binaries
                ;; and source files to src/.
                (substitute* "host_applications/linux/CMakeLists.txt"
                  ((".*add_subdirectory\\(apps/hello_pi).*")
                   ""))
                (substitute* "makefiles/cmake/vmcs.cmake"
                  (("install.*host_applications/linux/apps/hello_pi" all)
                   (string-append "# " all))
                  ((".*DESTINATION \\$\\{VMCS_INSTALL_PREFIX}/src)" all)
                   (string-append "# " all))))))))
      (native-inputs (list pkg-config))
      (home-page "https://github.com/raspberrypi/userland/")
      (supported-systems (list "armhf-linux" "aarch64-linux"))
      (synopsis "Raspberry Pi GPU-related libraries")
      (description "This package package contains libraries to interface to
EGL, mmal, GLESv2, vcos, openmaxil, vchiq_arm, bcm_host, VFC and OpenVG.  It
also provides the @command{dtmerge}, @command{dtoverlay}, @command{dtparam},
@command{raspivid} and @command{tvservice} commands, among others.")
      (license license:bsd-3))))

(define-public rpi-fbcp
  ;; There are no release nor tag; use the latest commit.
  (let ((revision "0")
        (commit "af8d32246c23cb23e4030e6588668a14341f5ddc"))
    (package
      (name "rpi-fbcp")
      (version (git-version "0.0.0" revision commit))
      (source (origin
                (method git-fetch)
                (uri (git-reference
                      (url "https://github.com/tasanakorn/rpi-fbcp")
                      (commit commit)))
                (file-name (git-file-name name version))
                (sha256
                 (base32
                  "10wym2jckicxm5iwqgby6gbhkznyi1q8x41v0qahzv71x85xpsl5"))))
      (build-system cmake-build-system)
      (arguments
       (list
        #:tests? #f                     ;no test suite
        #:phases
        #~(modify-phases %standard-phases
            (replace 'install
              ;; There is no installation target.
              (lambda _
                (install-file "fbcp" (string-append #$output "/bin")))))))
      (inputs (list raspberrypi-userland))
      (home-page "https://github.com/tasanakorn/rpi-fbcp")
      (synopsis "Mirror primary to secondary frame buffer on Raspberry Pi")
      (description "The @command{fbcp} command provided by this package can be
used to copy the primary frame buffer to the secondary frame buffer of a
Raspberry Pi.  It can for example mirror the primary HDMI output to a
secondary LCD display connected to the Raspberry Pi board.")
      (license license:expat))))

(define-public rpi-imager
  (package
    (name "rpi-imager")
    (version "1.7.4")
    (source (origin
              (method git-fetch)
              (uri (git-reference
                    (url "https://github.com/raspberrypi/rpi-imager")
                    (commit (string-append "v" version))))
              (file-name (git-file-name name version))
              (modules '((guix build utils)
                         (ice-9 ftw)
                         (srfi srfi-26)))
              (snippet '(begin
                          ;; Remove all but the following bundled libraries,
                          ;; which are not yet packaged in Guix.
                          (define keep '("." ".."
                                         "drivelist"
                                         "mountutils"
                                         "sha256crypt"))
                          (with-directory-excursion "src/dependencies"
                            (for-each delete-file-recursively
                                      (scandir "." (negate
                                                    (cut member <> keep)))))))
              (sha256
               (base32
                "0m0dmga049banm79221ilmrqpb2bd6p0rcqrlzirsgb592ci64ba"))))
    (build-system qt-build-system)
    (arguments
     (list
      #:tests? #f                       ;no test suite
      #:configure-flags #~(list "-DENABLE_TELEMETRY=OFF")
      #:phases
      #~(modify-phases %standard-phases
          (add-after 'unpack 'chdir
            (lambda _
              (chdir "src")))
          (add-after 'chdir 'customize-os-list.json
            ;; The default operating system JSON list contains non-FSDG
            ;; systems.
            (lambda _
              (let* ((datadir (string-append #$output
                                             "/share/rpi-imager"))
                     (os-list.json (string-append datadir "/os-list.json")))
                (mkdir-p datadir)
                #$(with-extensions (list guile-json-4)
                    #~(begin
                        (use-modules (json))
                        (call-with-output-file os-list.json
                          ;; TODO: Register FSDG and RPi compatible OS
                          ;; images here.
                          (lambda (port)
                            (scm->json '() port)))))
                (substitute* "config.h"
                  (("#define OSLIST_URL.*")
                   (string-append "#define OSLIST_URL \"file:///"
                                  os-list.json "\"\n"))))))
          (add-after 'chdir 'patch-cmake
            (lambda _
              (substitute* "CMakeLists.txt"
                ;; lsblk expects to have access to /sys/dev/block,
                ;; which doesn't exist in the build container;
                ;; prevent the check to fail the build.
                (("ret EQUAL \"1\"")
                 "FALSE")))))))
    (inputs
     (list gnutls
           curl
           libarchive
           qtdeclarative-5
           qtquickcontrols2-5
           qtsvg-5
           qttools-5
           util-linux))
    (home-page "https://github.com/raspberrypi/rpi-imager/")
    (synopsis "Raspberry Pi Imaging Utility")
    (description "rpi-imager is graphical utility to easily provision and
flash a memory card with an operating system image suitable for the Raspberry
Pi single board computer.")
    (license license:asl2.0)))

(define-public waveshare-dtoverlays
  (let ((commit "6ea99d4afb4776fdb008708f3f30df1de6fc24e3")
        (revision "0"))
    (package
      (name "waveshare-dtoverlays")
      (version (git-version "0.0.0" revision commit))
      (source (origin
                (method git-fetch)
                (uri (git-reference
                      (url "https://github.com/swkim01/waveshare-dtoverlays")
                      (commit commit)))
                (file-name (git-file-name name version))
                (modules '((guix build utils)))
                ;; Delete pre-compiled device tree overlay binary files.
                (snippet '(for-each delete-file (find-files "." "\\.dtbo$")))
                (sha256
                 (base32
                  "1c30wnlinicwlivlri25wns6x8nx7asf5fh2zqxkzr9h1jsxbzwz"))))
      (build-system gnu-build-system)
      (arguments (list #:tests? #f      ;no test suite
                       #:make-flags #~(list (string-append "PREFIX="
                                                           #$output))
                       #:phases #~(modify-phases %standard-phases
                                    (delete 'configure))))
      (native-inputs (list dtc))
      (home-page "https://github.com/swkim01/waveshare-dtoverlays/")
      (synopsis "Device tree overlays for WaveShare SpotPear TFT LCDs")
      (description "This package contains device tree overlay binaries to
support the WaveShare SpotPear @acronym{TFT, Thin-Film Transistor}
@acronym{LCDs, Liquid Crystal Display} on the Raspberry Pi.")
      (license license:gpl3+))))
eforge.net/") (synopsis "Library for working with WFM, EMF and EMF+ images") (description "The libUEMF library is a portable C99 implementation for reading and writing @acronym{WFM, Windows Metafile}, @acronym{EMF, Enhanced Metafile}, and @acronym{EMF+, Enhanced Metafile Plus} files.") (license license:gpl2+))) (define-public libungif (package (name "libungif") (version "4.1.4") (source (origin (method url-fetch) (uri (string-append "mirror://sourceforge/giflib/libungif-4.x/" "libungif-" version "/libungif-" version ".tar.bz2")) (sha256 (base32 "0cnksimmmjngdrys302ik1385sg1sj4i0gxivzldhgwd46n7x2kh")))) (build-system gnu-build-system) (inputs (list perl)) ;package ships some perl tools (home-page "http://giflib.sourceforge.net/") (synopsis "GIF decompression library") (description "libungif is the old GIF decompression library by the GIFLIB project.") (license license:expat))) (define-public imlib2 (package (name "imlib2") (version "1.10.0") (source (origin (method url-fetch) (uri (string-append "mirror://sourceforge/enlightenment/imlib2-src/" version "/imlib2-" version ".tar.xz")) (sha256 (base32 "1fnbh6vj0d9l1c2bzw9psxh3wnlbr1nlfzi16w60hp48gj9ilz3j")))) (build-system gnu-build-system) (arguments '(#:configure-flags (list "--disable-static"))) (native-inputs (list pkg-config)) (inputs (list bzip2 freetype giflib libid3tag libjpeg-turbo libpng libtiff libx11 libxext libwebp)) (home-page "https://sourceforge.net/projects/enlightenment/") (synopsis "Loading, saving, rendering and manipulating image files") (description "Imlib2 is a library that does image file loading and saving as well as rendering, manipulation, arbitrary polygon support, etc. It does ALL of these operations FAST. Imlib2 also tries to be highly intelligent about doing them, so writing naive programs can be done easily, without sacrificing speed. This is a complete rewrite over the Imlib 1.x series. The architecture is more modular, simple, and flexible.") (license license:imlib2))) (define-public imlib2-1.7 (package (inherit imlib2) (version "1.7.1") (source (origin (method url-fetch) (uri (string-append "mirror://sourceforge/enlightenment/imlib2-src/" version "/imlib2-" version ".tar.bz2")) (sha256 (base32 "01y45cdml2dr9cqgybrgxr86sd77d1qfa1gzclzy1j6bkminlfh3")))))) (define-public giblib (package (name "giblib") (version "1.2.4") (source (origin (method url-fetch) (uri (list (string-append "http://linuxbrit.co.uk/downloads/giblib-" version ".tar.gz") (string-append "https://src.fedoraproject.org/repo/pkgs/giblib/giblib-" version ".tar.gz/c810ef5389baf24882a1caca2954385e/giblib-" version ".tar.gz") (string-append "https://sourceforge.net/projects/slackbuildsdirectlinks/" "files/giblib/giblib-" version ".tar.gz"))) (sha256 (base32 "1b4bmbmj52glq0s898lppkpzxlprq9aav49r06j2wx4dv3212rhp")))) (build-system gnu-build-system) (inputs (list libx11 ;; Needs an old imlib2 with the 'imlib2-config' program. imlib2-1.7)) (home-page ;; This vanished page is universally accepted as giblib's home despite not ;; mentioning the package once. (string-append "https://web.archive.org/web/20140907071208/" "https://linuxbrit.co.uk/software/")) (synopsis "Wrapper library for imlib2") (description "Giblib is a simple library which wraps imlib2's context API, avoiding all the context_get/set calls, adds fontstyles to the truetype renderer and supplies a generic doubly-linked list and some string functions.") ;; This license removes a clause about X Consortium from the original ;; X11 license. (license (license:x11-style "file://COPYING" "See 'COPYING' in the distribution.")))) (define-public freeimage (package (name "freeimage") (version "3.18.0") (source (origin (method url-fetch) (uri (string-append "mirror://sourceforge/freeimage/Source%20Distribution/" version "/FreeImage" (string-concatenate (string-split version #\.)) ".zip")) (sha256 (base32 "1z9qwi9mlq69d5jipr3v2jika2g0kszqdzilggm99nls5xl7j4zl")) (modules '((guix build utils))) (snippet '(begin (for-each (lambda (dir) (delete-file-recursively (string-append "Source/" dir))) '("LibJPEG" "LibOpenJPEG" "LibPNG" "LibRawLite" "LibJXR" "LibWebP" "OpenEXR" "ZLib")))) (patches (append (search-patches "freeimage-unbundle.patch" "freeimage-libtiff-compat.patch") ;; Take one patch from Arch Linux that adds LibRaw 0.20 compatibility. (list (origin (method url-fetch) (uri "https://raw.githubusercontent.com/archlinux\ /svntogit-community/ca3e6a52f5a46dec87cbf85e9d84fe370e282c8c/trunk\ /freeimage-libraw-0.20.patch") (file-name "freeimage-libraw-compat.patch") (sha256 (base32 "0cwjxjz0f4gs6igvwqg0p99mnrsrwzkal1l2n08yvz2xq9s5khki")))))))) (build-system gnu-build-system) (arguments (list #:phases #~(modify-phases %standard-phases ;; According to Fedora these files depend on private headers, but their ;; presence is required for building, so we replace them with empty files. (add-after 'unpack 'delete-unbuildable-files (lambda _ (for-each (lambda (file) (delete-file file) (close (open file O_CREAT))) '("Source/FreeImage/PluginG3.cpp" "Source/FreeImageToolkit/JPEGTransform.cpp")))) ;; These scripts generate the Makefiles. (replace 'configure (lambda _ (invoke "sh" "gensrclist.sh") (invoke "sh" "genfipsrclist.sh"))) (add-before 'build 'patch-makefile (lambda* (#:key outputs #:allow-other-keys) (substitute* "Makefile.gnu" (("/usr") (assoc-ref outputs "out")) (("-o root -g root") ""))))) #:make-flags #~(let ((jxrlib (search-input-directory %build-inputs "include/jxrlib"))) (list (string-append "CC=" #$(cc-for-target)) ;; We need '-fpermissive' for Source/FreeImage.h. ;; libjxr doesn't have a pkg-config file. (string-append "CFLAGS+=-O2 -fPIC -fvisibility=hidden " "-fpermissive -I" jxrlib))) #:tests? #f)) ; no check target (native-inputs (list pkg-config unzip)) (inputs (list libjpeg-turbo libjxr libpng libraw libtiff libwebp openexr-2 openjpeg zlib)) (synopsis "Library for handling popular graphics image formats") (description "FreeImage is a library for developers who would like to support popular graphics image formats like PNG, BMP, JPEG, TIFF and others.") (license license:gpl2+) (home-page "https://freeimage.sourceforge.io/"))) (define-public vigra (let ((commit "9b514fa00a136f5fd81bb57ee9f6293c333ffc1f") (revision "0")) (package (name "vigra") (version (git-version "1.11.1" revision commit)) (source (origin ;; The last release is 1.11.1, from 2017. It's becoming more and more ;; difficult to build this old release, and the upstream developers ;; suggest on their home page to build from the Git repo, saying "It is ;; generally safe to use the 'master' branch of the development snapshot, ;; as we avoid uploading untested or incompatible changes to this branch." (method git-fetch) (uri (git-reference (url "https://github.com/ukoethe/vigra") (commit commit))) (file-name (git-file-name name version)) (sha256 (base32 "1vzlypviala109imwxkp46lqhhxszf79ypfb8wxg6z7g02j7mm73")))) (build-system cmake-build-system) (inputs `(("boost" ,boost) ("fftw" ,fftw) ("fftwf" ,fftwf) ("hdf5" ,hdf5) ("ilmbase" ,ilmbase) ; propagated by openexr, but needed explicitly ; to create a configure-flag ("libjpeg" ,libjpeg-turbo) ("libpng" ,libpng) ("libtiff" ,libtiff) ("openexr" ,openexr-2) ("python" ,python-wrapper) ;("python-numpy" ,python-numpy) ("zlib" ,zlib))) (native-inputs `(("doxygen" ,doxygen) ("python-nose" ,python-nose) ("sphinx" ,python-sphinx))) (arguments `(#:test-target "check" #:phases (modify-phases %standard-phases (add-after 'unpack 'disable-broken-tests (lambda _ ;; See https://github.com/ukoethe/vigra/issues/432 (substitute* "test/fourier/CMakeLists.txt" (("VIGRA_ADD_TEST.*") "")) ;; This test fails with Numpy 1.15: ;; . (substitute* "vigranumpy/test/CMakeLists.txt" (("test1\\.py") "")) #t))) #:configure-flags (list "-Wno-dev" ; suppress developer mode with lots of warnings (string-append "-DVIGRANUMPY_INSTALL_DIR=" (assoc-ref %outputs "out") "/lib/python" ,(version-major+minor (package-version python)) "/site-packages") ;; Vigranumpy isn't compatible with numpy >= 1.20. "-DWITH_VIGRANUMPY=0" ;; OpenEXR is not enabled by default. "-DWITH_OPENEXR=1" ;; Fix rounding error on 32-bit machines "-DCMAKE_C_FLAGS=-ffloat-store" ;; The header files of ilmbase are not found when included ;; by the header files of openexr, and an explicit flag ;; needs to be set. (string-append "-DCMAKE_CXX_FLAGS=-I" (assoc-ref %build-inputs "ilmbase") "/include/OpenEXR" " -ffloat-store")))) (synopsis "Computer vision library") (description "VIGRA stands for Vision with Generic Algorithms. It is an image processing and analysis library that puts its main emphasis on customizable algorithms and data structures. It is particularly strong for multi-dimensional image processing.") (license license:expat) (home-page "https://ukoethe.github.io/vigra/") (properties '((max-silent-time . 7200)))))) ;2 hours, to avoid timing out (define-public vigra-c (let* ((commit "66ff4fa5a7d4a77415caa676a45c2c6ea16562e7") (revision "1")) (package (name "vigra-c") (version (git-version "0.0.0" revision commit)) (home-page "https://github.com/BSeppke/vigra_c") (source (origin (method git-fetch) (uri (git-reference (url home-page) (commit commit))) (sha256 (base32 "1pnd92s284dvsg8zp6md7p8ck55bmcsryz58gzic7jh6m72hg689")) (file-name (git-file-name name version)))) (build-system cmake-build-system) (arguments `(#:tests? #f)) ; No test target. (native-inputs (list doxygen)) (inputs (list fftw fftwf hdf5 vigra)) (synopsis "C interface to the VIGRA computer vision library") (description "This package provides a C interface to the VIGRA C++ computer vision library. It is designed primarily to ease the implementation of higher-level language bindings to VIGRA.") (license license:expat)))) (define-public libwebp (package (name "libwebp") (version "1.2.4") (source (origin ;; No tarballs are provided for >0.6.1. (method git-fetch) (uri (git-reference (url "https://chromium.googlesource.com/webm/libwebp") (commit (string-append "v" version)))) (file-name (git-file-name name version)) (sha256 (base32 "1jndbc99dd19a6d7h4ds51xyak7gfddkbi41nxdm8n23w7ks35r8")))) (build-system gnu-build-system) (inputs (list freeglut giflib libjpeg-turbo libpng libtiff)) (native-inputs (list autoconf automake libtool)) (arguments '(#:configure-flags '("--enable-libwebpmux" "--enable-libwebpdemux" "--enable-libwebpdecoder" "--disable-static"))) (home-page "https://developers.google.com/speed/webp/") (synopsis "Lossless and lossy image compression") (description "WebP is a new image format that provides lossless and lossy compression for images. WebP lossless images are 26% smaller in size compared to PNGs. WebP lossy images are 25-34% smaller in size compared to JPEG images at equivalent SSIM index. WebP supports lossless transparency (also known as alpha channel) with just 22% additional bytes. Transparency is also supported with lossy compression and typically provides 3x smaller file sizes compared to PNG when lossy compression is acceptable for the red/green/blue color channels.") (license license:bsd-3))) (define-public libmng (package (name "libmng") (version "2.0.3") (source (origin (method url-fetch) (uri (string-append "mirror://sourceforge/libmng/libmng-devel/" version "/" name "-" version ".tar.xz")) (sha256 (base32 "1lvxnpds0vcf0lil6ia2036ghqlbl740c4d2sz0q5g6l93fjyija")))) (build-system gnu-build-system) (propagated-inputs ;; These are all in the 'Libs.private' field of libmng.pc. (list lcms libjpeg-turbo zlib)) (home-page "https://www.libmng.com/") (synopsis "Library for handling MNG files") (description "Libmng is the MNG (Multiple-image Network Graphics) reference library.") (license license:bsd-3))) (define-public exiv2 (package (name "exiv2") (version "0.27.5") (source (origin (method url-fetch) (uri (string-append "https://www.exiv2.org/builds/exiv2-" version "-Source.tar.gz")) (sha256 (base32 "1qm6bvj28l42km009nc60gffn1qhngc0m2wjlhf90si3mcc8d99m")))) (build-system cmake-build-system) (arguments `(#:test-target "tests" #:configure-flags (list "-DEXIV2_BUILD_UNIT_TESTS=ON" ;; darktable needs BMFF to support ;; CR3 files. "-DEXIV2_ENABLE_BMFF=ON") #:phases (modify-phases %standard-phases (add-after 'install 'delete-static-libraries (lambda* (#:key outputs #:allow-other-keys) (let* ((out (assoc-ref outputs "out")) (lib (string-append out "/lib"))) (for-each delete-file (find-files lib "\\.a$"))))) ,@(if (or (target-ppc64le?) (target-aarch64?) (target-riscv64?)) '((add-after 'unpack 'adjust-tests (lambda _ ;; Adjust test on ppc64 and aarch64, where no exception ;; is raised and thus the return value is different. See ;; and ;; . (substitute* "tests/bugfixes/github/test_CVE_2018_12265.py" (("\\$uncaught_exception \\$addition_overflow_message\n") "") (("retval = \\[1\\]") "retval = [0]"))))) '())))) (propagated-inputs (list expat zlib)) (native-inputs (list googletest python)) (home-page "https://www.exiv2.org/") (synopsis "Library and command-line utility to manage image metadata") (description "Exiv2 is a C++ library and a command line utility to manage image metadata. It provides fast and easy read and write access to the Exif, IPTC and XMP metadata of images in various formats.") ;; Files under `xmpsdk' are a copy of Adobe's XMP SDK, licensed under the ;; 3-clause BSD license: . ;; The core is GPLv2+: ;; . (license license:gpl2+))) (define-public devil (package (name "devil") (version "1.8.0") (source (origin (method url-fetch) (uri (string-append "http://downloads.sourceforge.net/openil/" "DevIL-" version ".tar.gz")) (sha256 (base32 "02dpzvi493r09c9hfjnk54nladl3qw55iqkkg18g12fxwwz9fx80")))) (build-system cmake-build-system) (arguments '(;; XXX: Not supported in the released CMakeLists.txt. ;; Enable this for > 1.8.0. #:tests? #f #:phases (modify-phases %standard-phases (add-before 'configure 'change-directory (lambda _ (chdir "DevIL") #t))))) (native-inputs (list pkg-config)) (inputs `(("lcms" ,lcms) ("libjpeg" ,libjpeg-turbo) ("libmng" ,libmng) ("libpng" ,libpng) ("libtiff" ,libtiff) ("openexr" ,openexr-2) ("zlib" ,zlib))) (synopsis "Library for manipulating many image formats") (description "Developer's Image Library (DevIL) is a library to develop applications with support for many types of images. DevIL can load, save, convert, manipulate, filter and display a wide variety of image formats.") (home-page "https://openil.sourceforge.net") (license license:lgpl2.1+))) (define-public jasper (package (name "jasper") (version "2.0.33") (source (origin (method git-fetch) (uri (git-reference (url "https://github.com/mdadams/jasper") (commit (string-append "version-" version)))) (file-name (git-file-name name version)) (sha256 (base32 "0p3fj89gkhd2ys5ci75cwb6p7rvb2pf52jd8c9d4g76qp846njnx")))) (build-system cmake-build-system) (inputs (list libjpeg-turbo)) (synopsis "JPEG-2000 library") (description "The JasPer Project is an initiative to provide a reference implementation of the codec specified in the JPEG-2000 Part-1 standard (i.e., ISO/IEC 15444-1).") (home-page "https://www.ece.uvic.ca/~frodo/jasper/") (license (license:x11-style "file://LICENSE")))) (define-public zimg (package (name "zimg") (version "3.0.3") (source (origin (method git-fetch) (uri (git-reference (url "https://github.com/sekrit-twc/zimg") (commit (string-append "release-" version)))) (file-name (git-file-name name version)) (sha256 (base32 "0pwgf1mybpa3fs13p6jryzm32vfldyql9biwaypqdcimlnlmyk20")))) (build-system gnu-build-system) (native-inputs (list autoconf automake libtool)) (synopsis "Scaling, colorspace conversion, and dithering library") (description "Zimg implements the commonly required image processing basics of scaling, colorspace conversion, and depth conversion. A simple API enables conversion between any supported formats to operate with minimal knowledge from the programmer.") (home-page "https://github.com/sekrit-twc/zimg") ;; test/extra/ contains musl-libm, ;; which is MIT/expat licensed, but only used for tests (license license:wtfpl2))) (define-public perceptualdiff (package (name "perceptualdiff") (version "1.3") (source (origin (method git-fetch) (uri (git-reference (url "https://github.com/myint/perceptualdiff") (commit (string-append "v" version)))) (file-name (git-file-name name version)) (sha256 (base32 "0yys55f9i9g3wjjg0j2m0p0k21zwnid8520a8lrr30khm4k5gibp")))) (build-system cmake-build-system) (inputs (list freeimage)) (arguments '(#:phases (modify-phases %standard-phases (add-after 'unpack 'fix-tests ;; cmake-build-system uses a build/ directory outside ;; of the source tree, one level higher than expected (lambda _ (substitute* "test/run_tests.bash" (("../build") "../../build")) #t))))) (home-page "https://github.com/myint/perceptualdiff") (synopsis "Perceptual image comparison utility") (description "PerceptualDiff visually compares two images to determine whether they look alike. It uses a computational model of the human visual system to detect similarities. This allows it too see beyond irrelevant differences in file encoding, image quality, and other small variations.") (license license:gpl2+))) (define-public steghide (package (name "steghide") (version "0.5.1") (source (origin (method url-fetch) (uri (string-append "mirror://sourceforge/steghide/steghide/" version "/steghide-" version ".tar.bz2")) (sha256 (base32 "18bxlhbdc3zsmxj84i417xjh0q28kv26q449k23n0a72ldwziix2")) (patches (list (search-patch "steghide-fixes.patch"))))) (build-system gnu-build-system) (arguments (list #:make-flags #~(list "CXXFLAGS=-fpermissive") ; required for MHashPP.cc #:phases #~(modify-phases %standard-phases (add-before 'configure 'set-perl-search-path (lambda _ ;; Work around "dotless @INC" build failure. (setenv "PERL5LIB" (string-append (getcwd) "/tests:" (getenv "PERL5LIB")))))))) (native-inputs (list gettext-minimal libtool perl)) (inputs (list libjpeg-turbo libmhash libmcrypt zlib)) (home-page "https://steghide.sourceforge.net") (synopsis "`Hide' (nonconfidential) data in image or audio files") (description "Steghide is a program to `hide' data in various kinds of image and audio files. This practice is known as @dfn{steganography}, but the method used by steghide is not very secure and should not be used where security is at stake. Even if a password is used, steghide offers little plausible deniability. Nonetheless, neither color nor sample frequencies are changed, making the embedding resistant against first-order statistical tests not aimed specifically at this tool.") (license license:gpl2+))) (define-public optipng (package (name "optipng") (version "0.7.7") (source (origin (method url-fetch) (uri (string-append "http://prdownloads.sourceforge.net/optipng/optipng-" version ".tar.gz")) (sha256 (base32 "0lj4clb851fzpaq446wgj0sfy922zs5l5misbpwv6w7qrqrz4cjg")) (modules '((guix build utils))) (snippet '(begin (delete-file-recursively "src/libpng") (delete-file-recursively "src/zlib") #t)))) (build-system gnu-build-system) (inputs (list libpng zlib)) (arguments '(#:phases (modify-phases %standard-phases (replace 'configure (lambda* (#:key outputs #:allow-other-keys) ;; configure script doesn't accept arguments CONFIG_SHELL and SHELL (invoke "sh" "configure" (string-append "--prefix=" (assoc-ref outputs "out")) "-with-system-libs") #t))))) (synopsis "Optimizer that recompresses PNG image files to a smaller size") (description "OptiPNG is a PNG optimizer that recompresses image files to a smaller size, without losing any information. This program also converts external formats (BMP, GIF, PNM and TIFF) to optimized PNG, and performs PNG integrity checks and corrections.") (home-page "https://optipng.sourceforge.net/") (license license:zlib))) (define-public imgp (package (name "imgp") (version "2.8") (source (origin (method url-fetch) (uri (pypi-uri "imgp" version)) (sha256 (base32 "0q99h9wv9rynig0s0flnr9mxi541zzl0gw8vh4y6m5x132diilri")))) (build-system python-build-system) (arguments `(#:tests? #f ;there are no tests #:phases (modify-phases %standard-phases ;; setup.py expects the file to be named 'imgp'. (add-after 'unpack 'rename-imgp (lambda _ (rename-file "imgp.py" "imgp") #t))))) (inputs (list python-pillow)) (home-page "https://github.com/jarun/imgp") (synopsis "High-performance CLI batch image resizer & rotator") (description "@code{imgp} is a command line image resizer and rotator for JPEG and PNG images. It can resize (or thumbnail) and rotate thousands of images in a go while saving significantly on storage. This package may optionally be built with @code{python-pillow-simd} in place of @{python-pillow} for SIMD parallelism.") (license license:gpl3+))) (define-public pngsuite (package (name "pngsuite") (version "2017jul19") (source (origin (method url-fetch/tarbomb) (uri (string-append "http://www.schaik.com/pngsuite2011/PngSuite-" version ".tgz")) (sha256 (base32 "1j7xgd9iffcnpphhzz9ld9ybrjmx9brhq0803g0450ssr52b5502")))) (build-system gnu-build-system) (arguments '(#:tests? #f ; there is no test target #:license-file-regexp "PngSuite.LICENSE" #:phases (modify-phases %standard-phases (replace 'install (lambda* (#:key outputs #:allow-other-keys) (let ((out (assoc-ref outputs "out"))) (copy-recursively "." (string-append out "/")) #t))) (delete 'build) (delete 'configure)))) (home-page "http://www.schaik.com/pngsuite2011/pngsuite.html") (synopsis "Example PNGs for use in test suites") (description "Collection of graphics images created to test PNG applications like viewers, converters and editors. As far as that is possible, all formats supported by the PNG standard are represented.") (license (license:fsdg-compatible "file://PngSuite.LICENSE" "Permission to use, copy, modify and distribute these images for any purpose and without fee is hereby granted.")))) (define-public libjpeg-turbo (package (name "libjpeg-turbo") (version "2.1.4") (source (origin (method url-fetch) (uri (string-append "mirror://sourceforge/libjpeg-turbo/" version "/libjpeg-turbo-" version ".tar.gz")) (sha256 (base32 "0arl61ici38ann5xjidwdzkhmjdp1r95x4x4zinnh4qs2fhjdvfk")))) (build-system cmake-build-system) (native-inputs (list nasm)) (arguments (list #:configure-flags #~'("-DCMAKE_INSTALL_LIBDIR:PATH=lib" "-DENABLE_STATIC=0" ;; djpeg-shared-3x2-float-prog-cmp fails on some systems. #$@(if (or (target-ppc32?) (target-riscv64?)) '("-DFLOATTEST=NO") '()) ;; The build system probes for the current CPU, but ;; that fails when cross-compiling. #$@(let ((target (%current-target-system))) (if target (cond ((string-prefix? "arm" target) '("-DCMAKE_SYSTEM_PROCESSOR=arm")) ((string-prefix? "aarch64" target) '("-DCMAKE_SYSTEM_PROCESSOR=aarch64")) ((string-prefix? "i686" target) '("-DCMAKE_SYSTEM_PROCESSOR=x86")) ((string-prefix? "x86_64" target) '("-DCMAKE_SYSTEM_PROCESSOR=x86_64")) ;; 32-bit and 64-bit ((string-prefix? "powerpc" target) '("-DCMAKE_SYSTEM_PROCESSOR=powerpc")) ((string-prefix? "riscv64" target) '("-DCMAKE_SYSTEM_PROCESSOR=riscv64")) (else '())) '()))))) (home-page "https://libjpeg-turbo.org/") (synopsis "SIMD-accelerated JPEG image handling library") (description "libjpeg-turbo is a JPEG image codec that accelerates baseline JPEG compression and decompression using SIMD instructions: MMX on x86, SSE2 on x86-64, NEON on ARM, and AltiVec on PowerPC processors. Even on other systems, its highly-optimized Huffman coding routines allow it to outperform libjpeg by a significant amount. libjpeg-turbo implements both the traditional libjpeg API and the less powerful but more straightforward TurboJPEG API, and provides a full-featured Java interface. It supports color space extensions that allow it to compress from and decompress to 32-bit and big-endian pixel buffers (RGBX, XBGR, etc.).") ;; libjpeg-turbo is covered by three different licenses; see LICENSE.md. (license (list license:bsd-3 ;the TurboJPEG API library and programs license:ijg ;the libjpeg library and associated tools license:zlib)))) ;the libjpeg-turbo SIMD extensions (define-public niftilib (package (name "niftilib") (version "2.0.0") (source (origin (method url-fetch) (uri (list (string-append "mirror://sourceforge/niftilib/" "nifticlib/nifticlib_" (string-join (string-split version #\.) "_") "/nifticlib-" version ".tar.gz"))) (sha256 (base32 "123z9bwzgin5y8gi5ni8j217k7n683whjsvg0lrpii9flgk8isd3")))) (build-system gnu-build-system) (arguments '(#:tests? #f ; there is no test target #:parallel-build? #f ; not supported #:make-flags (list "SHELL=bash" (string-append "ZLIB_INC=" (assoc-ref %build-inputs "zlib") "/include") ;; Append "-fPIC" to CFLAGS. (string-append "CFLAGS=" "-Wall -ansi -pedantic -fPIC")) #:phases (modify-phases %standard-phases (replace 'install (lambda* (#:key outputs #:allow-other-keys) (let ((out (assoc-ref outputs "out"))) (for-each (lambda (dir) (copy-recursively dir (string-append out "/" dir))) '("bin" "lib" "include"))) #t)) (delete 'configure)))) (inputs (list zlib)) (synopsis "Library for reading and writing files in the nifti-1 format") (description "Niftilib is a set of i/o libraries for reading and writing files in the nifti-1 data format - a binary file format for storing medical image data, e.g. magnetic resonance image (MRI) and functional MRI (fMRI) brain images.") (home-page "https://niftilib.sourceforge.net") (license license:public-domain))) (define-public gpick (package (name "gpick") (version "0.2.6") (source (origin (method git-fetch) (uri (git-reference (url "https://github.com/thezbyg/gpick") (commit (string-append name "-" version)))) (file-name (git-file-name name version)) (sha256 (base32 "0nl89gca5nmbyycv5rl5bm6k7facapdk4pab9pl949aa3cjw9bk7")))) (build-system scons-build-system) (native-inputs `(("boost" ,boost) ("gettext" ,gettext-minimal) ("pkg-config" ,pkg-config) ("ragel" ,ragel))) (inputs `(("expat" ,expat) ("gtk2" ,gtk+-2) ("lua" ,lua-5.2))) (arguments `(#:tests? #f #:scons ,scons-python2 #:scons-flags (list (string-append "DESTDIR=" %output)) #:phases (modify-phases %standard-phases (add-before 'build 'fix-lua-reference (lambda _ (substitute* "SConscript" (("lua5.2") "lua-5.2")) #t))))) (home-page "http://www.gpick.org/") (synopsis "Color picker") (description "Gpick is an advanced color picker and palette editing tool.") (license license:bsd-3))) (define-public libiptcdata (package (name "libiptcdata") (version "1.0.5") (source (origin (method url-fetch) (uri (string-append "https://github.com/ianw/libiptcdata" "/releases/download/release_" (string-join (string-split version #\.) "_") "/" name "-" version ".tar.gz")) (sha256 (base32 "17m2bscc76r1bymjgb44fbbfrdsjfqyb2ivg9wchyllm8pgx1560")))) (build-system gnu-build-system) (home-page "https://github.com/ianw/libiptcdata") (synopsis "IPTC metadata manipulation library") (description "Libiptcdata is a C library for manipulating the International Press Telecommunications Council (@dfn{IPTC}) metadata stored within multimedia files such as images. This metadata can include captions and keywords, often used by popular photo management applications. The library provides routines for parsing, viewing, modifying, and saving this metadata.") (license license:lgpl2.0+))) (define-public flameshot (package (name "flameshot") (version "12.1.0") (source (origin (method git-fetch) (uri (git-reference (url "https://github.com/flameshot-org/flameshot") (commit (string-append "v" version)))) (file-name (git-file-name name version)) (sha256 (base32 "1p7gqs5vqzbddlgl38lbanchwb14m6lx8f2cn2c5p0vyqwvqqv52")))) (build-system qt-build-system) (native-inputs (list qttools-5)) (inputs (list qtbase-5 qtsvg-5)) (arguments `(#:tests? #f)) ;no tests (home-page "https://github.com/flameshot-org/flameshot") (synopsis "Powerful yet simple to use screenshot software") (description "Flameshot is a screenshot program. Features: @itemize @item Customizable appearance. @item Easy to use. @item In-app screenshot edition. @item DBus interface. @item Upload to Imgur. @end itemize\n") (license license:gpl3+))) (define-public swappy (package (name "swappy") (version "1.4.0") (source (origin (method git-fetch) (uri (git-reference (url "https://github.com/jtheoof/swappy") (commit (string-append "v" version)))) (file-name (git-file-name name version)) (sha256 (base32 "1s2lp3bz30svqdg6467jvncim0qgl0q1b1nqxnnci6kljbp5g0xh")))) (build-system meson-build-system) (native-inputs (list pkg-config scdoc `(,glib "bin"))) ; for 'glib-compile-resources' (inputs (list gtk+ libnotify gettext-minimal)) (propagated-inputs ;; Needed to properly render the icons. (list font-awesome)) (home-page "https://github.com/jtheoof/swappy") (synopsis "Grab and edit on the fly snapshots of a Wayland compositor") (description "@command{swappy} is a command-line utility to take and edit screenshots of Wayland desktops. Works great with grim, slurp and sway. But can easily work with other screen copy tools that can output a final PNG image to stdout.") (license license:expat))) (define-public gifsicle (package (name "gifsicle") (version "1.93") (source (origin (method url-fetch) (uri (string-append "https://www.lcdf.org/gifsicle/gifsicle-" version ".tar.gz")) (sha256 (base32 "0irljjm76anicsm5rfkpqxd6x105aa8f0sky13dc3x1bfdwp1xlj")))) (build-system gnu-build-system) (arguments '(#:phases (modify-phases %standard-phases (add-before 'check 'patch-tests (lambda _ (substitute* "test/testie" (("/usr/bin/perl") (which "perl")) (("/bin/sh") (which "sh")) (("/bin/rm") (which "rm"))) #t))))) (native-inputs (list perl)) ; only for tests (inputs (list libx11)) (home-page "https://www.lcdf.org/gifsicle/") (synopsis "Edit GIF images and animations") (description "Gifsicle is a command-line GIF image manipulation tool that: @itemize @item Provides a batch mode for changing GIFs in place. @item Prints detailed information about GIFs, including comments. @item Control over interlacing, comments, looping, transparency, etc. @item Creates well-behaved GIFs: removes redundant colors, only uses local color tables, etc. @item Shrinks colormaps and change images to use the Web-safe palette. @item Optimizes GIF animations, or unoptimizes them for easier editing. @end itemize Two other programs are included with Gifsicle: @command{gifview} is a lightweight animated-GIF viewer, and @command{gifdiff} compares two GIFs for identical visual appearance.") (license license:gpl2+))) (define-public jp2a (package (name "jp2a") (version "1.1.1") (source (origin (method url-fetch) (uri (string-append "https://github.com/Talinx/jp2a/releases/download/v" version "/jp2a-" version ".tar.gz")) (sha256 (base32 "10kwhh1a0ivrzagl2vcxrbqmlr2q8x29ymqwzchpiriy6xqxck8l")))) (build-system gnu-build-system) (inputs (list curl libpng libjpeg-turbo ncurses)) (native-inputs (list doxygen)) (home-page "https://csl.name/jp2a/") (synopsis "Convert JPEG images to ASCII") (description "Jp2a is a small utility that converts JPEG images to ASCII.") (license license:gpl2))) (define-public grim (package (name "grim") (version "1.4.0") (source (origin (method git-fetch) (uri (git-reference (url "https://github.com/emersion/grim") (commit (string-append "v" version)))) (file-name (git-file-name name version)) (sha256 (base32 "1b1k5cmmk7gzis0rncyl98lnhdwpjkdsv9pada5mmgxcpka6f0lp")))) (build-system meson-build-system) (native-inputs (list pkg-config scdoc)) (inputs (list pixman libpng libjpeg-turbo wayland wayland-protocols)) (home-page "https://github.com/emersion/grim") (synopsis "Create screenshots from a Wayland compositor") (description "grim can create screenshots from a Wayland compositor.") ;; MIT license. (license license:expat))) (define-public slurp (package (name "slurp") (version "1.4.0") (source (origin (method git-fetch) (uri (git-reference (url "https://github.com/emersion/slurp") (commit (string-append "v" version)))) (file-name (git-file-name name version)) (sha256 (base32 "1i6g4dfiv2mwkjvvrx3wizb1n05xmd4j9nkhdii4klwd1gdrhjwd")))) (build-system meson-build-system) (native-inputs (list pkg-config scdoc)) (inputs (list cairo libxkbcommon wayland wayland-protocols)) (home-page "https://github.com/emersion/slurp") (synopsis "Select a region in a Wayland compositor") (description "Slurp can select a region in a Wayland compositor and print it to the standard output. It works well together with grim.") (license license:expat))) (define-public sng (package (name "sng") (version "1.1.0") (source (origin (method url-fetch) (uri (string-append "mirror://sourceforge/sng/sng-" version ".tar.gz")) (sha256 (base32 "06a6ydvx9xb3vxvrzdrg3hq0rjwwj9ibr7fyyxjxq6qx1j3mb70i")))) (build-system gnu-build-system) (arguments `(#:phases (modify-phases %standard-phases (add-before 'check 'link-pngsuite ;; tests expect pngsuite in source dir (lambda* (#:key inputs #:allow-other-keys) (symlink (assoc-ref inputs "pngsuite") "pngsuite") #t))) #:configure-flags (list (string-append "--with-rgbtxt=" (assoc-ref %build-inputs "xorg-rgb") "/share/X11/rgb.txt")))) (inputs (list xorg-rgb libpng)) (native-inputs (list pngsuite)) (home-page "https://sng.sourceforge.net") (synopsis "Markup language for representing PNG contents") (description "SNG (Scriptable Network Graphics) is a minilanguage designed specifically to represent the entire contents of a PNG (Portable Network Graphics) file in an editable form. Thus, SNGs representing elaborate graphics images and ancillary chunk data can be readily generated or modified using only text tools. SNG is implemented by a compiler/decompiler called sng that losslessly translates between SNG and PNG.") (license license:zlib))) (define-public blurhash (package (name "blurhash") (version "0.2.0") (source (origin (method git-fetch) (uri (git-reference (url "https://github.com/Nheko-Reborn/blurhash") (commit (string-append "v" version)))) (file-name (git-file-name name version)) (sha256 (base32 "0hx15fspava43z47kv17ivxv56g03fb2zf45dl07v3shickqxw0x")))) (build-system meson-build-system) (native-inputs (list doctest pkg-config)) (home-page "https://github.com/Nheko-Reborn/blurhash") (synopsis "C++ blurhash encoder/decoder") (description "Simple encoder and decoder for blurhashes. Contains a command line program as well as a shared library.") (license license:boost1.0))) (define-public lodepng ;; There are no tags in the repository, so we take the version as defined in ;; lodepng.cpp. (let ((commit "48e5364ef48ec2408f44c727657ac1b6703185f8") (revision "1") (version "20200215")) (package (name "lodepng") (version (git-version version revision commit)) (source (origin (method git-fetch) (uri (git-reference (url "https://github.com/lvandeve/lodepng") (commit commit))) (sha256 (base32 "1a1x8ag2scanzb2066jm9hg2y9kaa3wmpgmz10l1x9bkpik612lw")) (file-name (git-file-name name version)))) (build-system gnu-build-system) (arguments '(#:phases (modify-phases %standard-phases (delete 'configure) (replace 'build (lambda _ (setenv "CXXFLAGS" "-fPIC") (invoke "make" "lodepng.o") (invoke "make" "lodepng_util.o") (invoke "g++" "-fPIC" "-O3" "-o" "liblodepng.so" "-shared" "lodepng.o" "lodepng_util.o") #t)) (replace 'check (lambda _ (invoke "make" "unittest") (invoke "./unittest") #t)) (replace 'install (lambda* (#:key outputs #:allow-other-keys) (let* ((out (assoc-ref outputs "out")) (doc (string-append out "/share/doc")) (lib (string-append out "/lib")) (include (string-append out "/include"))) (install-file "lodepng.h" include) (install-file "lodepng_util.h" include) (install-file "liblodepng.so" lib) (install-file "README.md" doc) #t)))))) (home-page "https://lodev.org/lodepng/") (synopsis "PNG encoder and decoder in C and C++, without dependencies") (description "LodePNG is a PNG image decoder and encoder, all in one, no dependency or linkage required. It's made for C (ISO C90), and has a C++ wrapper with a more convenient interface on top.") (license license:zlib)))) (define-public icoutils (package (name "icoutils") (version "0.32.3") (source (origin (method url-fetch) (uri (string-append "mirror://savannah/icoutils/icoutils-" version ".tar.bz2")) (sha256 (base32 "1q66cksms4l62y0wizb8vfavhmf7kyfgcfkynil3n99s0hny1aqp")))) (build-system gnu-build-system) (inputs (list libpng perl)) (propagated-inputs (list perl-libwww)) (home-page "https://www.nongnu.org/icoutils/") (synopsis "Extract and convert bitmaps from Windows icon and cursor files") (description "Icoutils are a set of program for extracting and converting bitmaps from Microsoft Windows icon and cursor files. These files usually have the extension @code{.ico} or @code{.cur}, but they can also be embedded in executables and libraries (@code{.dll}-files). (Such embedded files are referred to as resources.) Conversion of these files to and from PNG images is done @command{icotool}. @command{extresso} automates these tasks with the help of special resource scripts. Resources such can be extracted from MS Windows executable and library files with @command{wrestool}. This package can be used to create @code{favicon.ico} files for web sites.") (license license:gpl3+))) (define-public libavif (package (name "libavif") (version "0.11.1") (source (origin (method git-fetch) (uri (git-reference (url "https://github.com/AOMediaCodec/libavif") (commit (string-append "v" version)))) (file-name (git-file-name name version)) (sha256 (base32 "02zmb62g0yx6rfz4w1isyzfrckv5i7dzyz26rp2mspbx9w6v8j4r")))) (build-system cmake-build-system) (arguments (list #:modules '((guix build cmake-build-system) (guix build utils) (srfi srfi-26)) #:configure-flags #~(list "-DAVIF_CODEC_AOM=ON" "-DAVIF_CODEC_DAV1D=ON" #$@(if (this-package-input "rav1e") '("-DAVIF_CODEC_RAV1E=ON") '()) "-DAVIF_BUILD_TESTS=ON" "-DAVIF_ENABLE_GTEST=ON" "-DAVIF_BUILD_APPS=ON" "-DAVIF_BUILD_GDK_PIXBUF=ON") #:phases #~(modify-phases %standard-phases (add-before 'configure 'patch-thumbnailer (lambda _ (substitute* "contrib/gdk-pixbuf/avif.thumbnailer.in" (("@CMAKE_INSTALL_FULL_BINDIR@/gdk-pixbuf-thumbnailer") (string-append #$gdk-pixbuf "/bin/gdk-pixbuf-thumbnailer"))))) (add-after 'install 'install-readme (lambda _ (let ((doc (string-append #$output "/share/doc/libavif-" #$(package-version this-package)))) (install-file "../source/README.md" doc)))) (add-after 'install 'split (lambda _ (let* ((avifenc (string-append #$output "/bin/avifenc")) (avifenc* (string-append #$output:tools "/bin/avifenc")) (avifdec (string-append #$output "/bin/avifdec")) (avifdec* (string-append #$output:tools "/bin/avifdec")) (thumbnailer (string-append #$output "/share/thumbnailers/avif.thumbnailer")) (thumbnailer* (string-append #$output:pixbuf-loader "/share/thumbnailers/avif.thumbnailer")) (pixbuf-loader (string-append #$output "/lib/gdk-pixbuf-2.0/2.10.0/loaders/" "libpixbufloader-avif.so")) (pixbuf-loader* (string-append #$output:pixbuf-loader "/lib/gdk-pixbuf-2.0/2.10.0/loaders/" "libpixbufloader-avif.so"))) (mkdir-p (string-append #$output:tools "/bin")) (for-each (compose mkdir-p (cut string-append #$output:pixbuf-loader <>)) '("/share/thumbnailers" "/lib/gdk-pixbuf-2.0/2.10.0/loaders/")) (for-each (lambda (old new) (copy-file old new) (delete-file old) (chmod new #o555)) (list avifenc avifdec thumbnailer pixbuf-loader) (list avifenc* avifdec* thumbnailer* pixbuf-loader*)))))))) (native-inputs (list googletest pkg-config)) (inputs (append (if (member (%current-system) (package-transitive-supported-systems rav1e)) (list rav1e) '()) (list dav1d libaom zlib libpng libjpeg-turbo gdk-pixbuf))) (outputs (list "out" "tools" ; avifenc & avifdec "pixbuf-loader")) (synopsis "Encode and decode AVIF files") (description "Libavif is a C implementation of @acronym{AVIF, the AV1 Image File Format}. It can encode and decode all YUV formats and bit depths supported by AOM, including with alpha.") (home-page "https://github.com/AOMediaCodec/libavif") (license (list license:bsd-2)))) (define-public libheif (package (name "libheif") (version "1.12.0") (source (origin (method git-fetch) (uri (git-reference (url "https://github.com/strukturag/libheif") (commit (string-append "v" version)))) (file-name (git-file-name name version)) (sha256 (base32 "0cp2d216hp7gw3n56x3g5q5n8jb9ganyanrlibxw8fw16il8nca6")))) (build-system cmake-build-system) (arguments `(#:tests? #f)) ;no test target although there is a tests folder (native-inputs (list autoconf automake libtool pkg-config)) (inputs `(("gdk-pixbuf" ,gdk-pixbuf) ;optional ("libjpeg" ,libjpeg-turbo) ("libpng" ,libpng))) ;; Propagated to satisfy 'libheif.pc'. (propagated-inputs (list dav1d libaom libde265 x265)) (home-page "https://github.com/strukturag/libheif") (synopsis "HEIF and AVIF file format decoder and encoder") (description "@code{libheif} is an ISO/IEC 23008-12:2017 HEIF and AVIF (AV1 Image File Format) file format decoder and encoder.") (license license:lgpl3+))) (define-public libjxl (package (name "libjxl") (version "0.8.2") (source (origin (method git-fetch) (uri (git-reference (url "https://github.com/libjxl/libjxl") (commit (string-append "v" version)) (recursive? #t))) (file-name (git-file-name name version)) (sha256 (base32 "1alhnnxkwy5bdwahfsdh87xk9rg1s2fm3r9y2w11ka8p3n1ccwr3")) (modules '((guix build utils))) (snippet ;; Delete the bundles that will not be used. '(begin (for-each (lambda (directory) (delete-file-recursively (string-append "third_party/" directory))) '("brotli" "googletest" "highway" "lcms" "libpng" "zlib")))))) (build-system cmake-build-system) (arguments `(#:configure-flags (list "-DJPEGXL_FORCE_SYSTEM_GTEST=true" "-DJPEGXL_FORCE_SYSTEM_BROTLI=true" "-DJPEGXL_FORCE_SYSTEM_LCMS2=true" "-DJPEGXL_FORCE_SYSTEM_HWY=true" "-DJPEGXL_BUNDLE_LIBPNG=false"))) (native-inputs (list asciidoc doxygen googletest pkg-config python)) (inputs (list freeglut gflags giflib imath lcms libavif libjpeg-turbo libpng libwebp openexr zlib)) ;; These are in Requires.private of libjxl.pc. (propagated-inputs (list brotli google-highway)) (home-page "https://github.com/libjxl/libjxl") (synopsis "JPEG XL image format reference implementation") (description "This package contains a reference implementation of JPEG XL (encoder and decoder).") (license license:bsd-3))) (define-public mtpaint (package (name "mtpaint") ;; The author neither releases tarballs nor uses git version tags. ;; Instead, author puts version in git commit title. (version "3.49.33") (source (origin (method git-fetch) (uri (git-reference (url "https://github.com/wjaguar/mtPaint") (commit "5272e2b1e773c8e02ac3506b2d3bde82ad946b21"))) (file-name (git-file-name name version)) (sha256 (base32 "1bmq4m0dxczl18n1yiqb75g05a4c3pal1vdcyypkilx7ijsr0cmc")))) (build-system gnu-build-system) (native-inputs `(("gettext" ,gettext-minimal) ("pkg-config" ,pkg-config) ("which" ,which))) (inputs `(("imlib2" ,imlib2) ("libtiff" ,libtiff) ("libpng" ,libpng) ("libungif" ,libungif) ("libjpeg" ,libjpeg-turbo) ("libwebp" ,libwebp) ("openjpeg" ,openjpeg) ("lcms" ,lcms) ("zlib" ,zlib) ("glib" ,glib) ;; Support for gtk3 is in the testing stage. ("gtk+" ,gtk+-2))) (arguments `(#:configure-flags (list "intl" ; build internationalized version "man") ; build the man page #:tests? #f)) ; no test suite (home-page "https://mtpaint.sourceforge.net/") (synopsis "Create pixel art and manipulate digital images") (description "Mtpaint is a graphic editing program which uses the GTK+ toolkit. It can create and edit indexed palette or 24bit RGB images, offers basic painting and palette manipulation tools. It also handles JPEG, JPEG2000, GIF, TIFF, WEBP, BMP, PNG, XPM formats.") (license license:gpl3+))) (define-public mypaint (package (name "mypaint") (version "2.0.1") (source (origin (method url-fetch) (uri (string-append "https://github.com/mypaint/mypaint/" "releases/download/v" version "/mypaint-" version ".tar.xz")) (sha256 (base32 "05mvay73vb9d2sh1ckv4vny45n059dmsps1jcppjizfmrpbkgr7k")))) (build-system python-build-system) (arguments `(#:imported-modules ((guix build glib-or-gtk-build-system) ,@%python-build-system-modules) #:modules ((guix build python-build-system) ((guix build glib-or-gtk-build-system) #:prefix glib-or-gtk:) (guix build utils)) #:phases (modify-phases %standard-phases (add-after 'install 'glib-or-gtk-wrap (assoc-ref glib-or-gtk:%standard-phases 'glib-or-gtk-wrap)) (add-after 'install 'wrap-program (lambda* (#:key outputs inputs #:allow-other-keys) (let* ((out (assoc-ref outputs "out")) (gdk-pixbuf (assoc-ref inputs "gdk-pixbuf")) (gtk+ (assoc-ref inputs "gtk+"))) (wrap-program (string-append out "/bin/mypaint") `("GI_TYPELIB_PATH" ":" prefix (,(getenv "GI_TYPELIB_PATH")))) #t))) (add-before 'check 'pre-check (lambda _ ;; Tests need writing access (setenv "HOME" "/tmp") #t))))) (native-inputs `(("pkg-config" ,pkg-config) ("gobject-introspection" ,gobject-introspection) ("swig" ,swig) ("gettext" ,gettext-minimal))) (inputs (list gtk+ librsvg hicolor-icon-theme libmypaint mypaint-brushes json-c lcms python-numpy python-pycairo python-pygobject)) (home-page "http://mypaint.org/") (synopsis "Fast and simple painting app for artists") (description "MyPaint is a simple drawing and painting program that works well with Wacom-style graphics tablets.") (license license:gpl2+))) (define-public phockup (package (name "phockup") (version "1.9.2") (source (origin (method git-fetch) (uri (git-reference (url "https://github.com/ivandokov/phockup") (commit version))) (file-name (git-file-name name version)) (sha256 (base32 "0j4mnsy12bhsmd80vgqknv004xbqd165y8gpalw87gp8i8xv172r")))) (build-system copy-build-system) (arguments `(#:install-plan '(("src" "share/phockup/") ("phockup.py" "share/phockup/")) #:phases (modify-phases %standard-phases (add-after 'unpack 'configure (lambda* (#:key inputs #:allow-other-keys) (substitute* (list "src/dependency.py" "src/exif.py") (("'exiftool") (string-append "'" (search-input-file inputs "bin/exiftool")))))) (add-before 'install 'check (lambda _ ;; Test without PATH to make sure ‘exiftool’ is properly found. (let ((path (getenv "PATH")) (pytest (which "pytest"))) (setenv "PATH" "") (invoke pytest) (setenv "PATH" path)))) (add-after 'install 'install-bin (lambda* (#:key outputs #:allow-other-keys) (let ((out (assoc-ref outputs "out"))) (mkdir (string-append out "/bin")) (symlink (string-append out "/share/phockup/phockup.py") (string-append out "/bin/phockup"))))) (add-after 'install-bin 'wrap-program (lambda* (#:key inputs outputs #:allow-other-keys) (let ((out (assoc-ref outputs "out"))) (wrap-program (string-append out "/bin/phockup") `("GUIX_PYTHONPATH" prefix ,(search-path-as-string->list (getenv "GUIX_PYTHONPATH")))))))))) (inputs (list bash-minimal perl-image-exiftool python python-tqdm)) (native-inputs (list python-pytest python-pytest-mock)) (home-page "https://github.com/ivandokov/phockup") (synopsis "Organize photos and videos in folders") (description "Phockup is a media sorting tool that uses creation date and time information in photos and videos to organize them into folders by year, month and day. All files which are not images or videos or those which do not have creation date information will be placed in a folder called @file{unknown}.") (license license:expat))) (define-public spng (package (name "spng") (version "0.7.2") (source (origin (method git-fetch) (uri (git-reference (url "https://github.com/randy408/libspng") (commit (string-append "v" version)))) (file-name (git-file-name name version)) (sha256 (base32 "0src9ii9w9afz2vgridn9r38pa6888myk28x2bjw0ynw5xcd62hs")))) (build-system meson-build-system) (inputs (list zlib)) (native-inputs (list libpng)) (home-page "https://libspng.org") (synopsis "Simple PNG loading library") (description "@code{libspng} is a simple C library for loading Portable Network Graphics (PNGs), intended as an easy-to-use replacement for @code{libpng}.") (license license:bsd-2) ;; Supports SSE on x86-64 and NEON on AArch64. (properties '((tunable? . #t)))))