summaryrefslogtreecommitdiff
path: root/nongnu/packages/music.scm
blob: 567beb25342cf9fe9a9636521f5cf3b128a3df26 (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
;;; SPDX-License-Identifier: GPL-3.0-or-later
;;; Copyright © 2022, 2025, 2026 Sughosha <sughosha@proton.me>
;;; Copyright © 2023 Jonathan Brielmaier <jonathan.brielmaier@web.de>

(define-module (nongnu packages music)
  #:use-module (gnu packages audio)
  #:use-module (gnu packages base)
  #:use-module (gnu packages cpp)
  #:use-module (gnu packages freedesktop)
  #:use-module (gnu packages gl)
  #:use-module (gnu packages gcc)
  #:use-module (gnu packages linux)
  #:use-module (gnu packages mp3)
  #:use-module (gnu packages pulseaudio)
  #:use-module (gnu packages python)
  #:use-module (gnu packages video)
  #:use-module (guix download)
  #:use-module (guix gexp)
  #:use-module (guix packages)
  #:use-module (guix utils)
  #:use-module (ice-9 match)
  #:use-module (ice-9 regex)
  #:use-module ((nonguix licenses) #:prefix license:)
  #:use-module (nonguix build-system binary))

(define-public reaper
  (package
    (name "reaper")
    (version "7.77")
    (source
      (origin
        (method url-fetch)
        (uri (string-append "https://www.reaper.fm/files/"
                            (version-major version)
                            ".x/reaper"
                            (string-replace-substring version "." "")
                            "_"
                            (match (%current-system)
                              ("x86_64-linux" "linux_x86_64")
                              ("i686-linux" "linux_i686")
                              ("aarch64-linux" "linux_aarch64")
                              ("armhf-linux" "linux_armv7l")
                              ;; We need a default case
                              (_ "unsupported"))
                            ".tar.xz"))
        (sha256
         (base32
          (match (%current-system)
            ("x86_64-linux"
             "1w8dsrdca72c2cznww869f1j206d6743hjf3afp4p02lgr1rckf9")
            ("i686-linux"
             "0iz27k59plcz1rfgs2fdyyrd7l5g2hsk8m001vnnkysxgrmy6xz1")
            ("aarch64-linux"
             "1kfn9ybk8sfhrg4r9nqy06sawqx45gjc4f0b3arzbrpvl6qwywgz")
            ("armhf-linux"
             "0wzciamkz2nqqsi7xrckfdwjczhf0faidn4fyqv6s2k6hqnyb80d")
            (_ "0000000000000000000000000000000000000000000000000000"))))))
    (build-system binary-build-system)
    (arguments
     (list #:strip-binaries? #f ;allocated section `.dynsym' not in segment
           #:modules
           '((nonguix build binary-build-system)
             (guix build utils)
             (nonguix build utils)
             (ice-9 match))
           #:patchelf-plan
           #~(map (lambda (file)
                    `(,file
                      ,(append '("libc" "gcc")
                               (match (basename file)
                                 ("reaper" '("alsa-lib" "jack" "pulseaudio"))
                                 ((or "reaper_host_x86_64"
                                      "reaper_host_i686"
                                      "reaper_host_aarch64"
                                      "reaper_host_armv7l")
                                  '("alsa-lib"))
                                 ("reaper_video.so" '("mesa" "vlc"))
                                 ("reaper_mp3dec.so" '("lame"))
                                 (_ '())))))
                  `("REAPER/reaper"
                    ,#$(string-append "REAPER/Plugins/reaper_host_"
                                      (match (%current-system)
                                        ("x86_64-linux" "x86_64")
                                        ("i686-linux" "i686")
                                        ("aarch64-linux" "aarch64")
                                        ("armf-linux" "armv7l")
                                        (_ "unsupported")))
                    ,@(find-files "REAPER/Plugins" "\\.so$")))
           #:phases
           #~(modify-phases %standard-phases
               (replace 'install
                 (lambda _
                   (setenv "HOME" "/tmp")
                   (setenv "XDG_DATA_HOME" (string-append #$output "/share"))
                   (invoke "sh" "./install-reaper.sh" "--install"
                           (string-append #$output "/opt")
                           "--integrate-user-desktop")
                   (delete-file (string-append #$output "/opt/REAPER/"
                                               "uninstall-reaper.sh"))))
               (add-after 'install 'replace-swell
                 (lambda* (#:key inputs #:allow-other-keys)
                   (with-directory-excursion (string-append #$output
                                                            "/opt/REAPER")
                     (delete-file "libSwell.so")
                     (symlink (search-input-file inputs "/lib/libSwell.so")
                              "libSwell.so"))))
               (add-after 'replace-swell 'wrap-program
                 (lambda _
                   (let ((wrapper (string-append #$output "/bin/reaper"))
                         (bin (string-append #$output "/opt/REAPER/reaper")))
                     (make-wrapper wrapper bin
                       `("PATH" ":" prefix
                         (,(string-append #$(this-package-input "ffmpeg")
                                          "/bin")))))))
               (add-after 'wrap-program 'fix-desktop-entry
                 (lambda _
                   (substitute* (string-append #$output
                                               "/share/applications/"
                                               "cockos-reaper.desktop")
                     (("opt/REAPER") "bin"))))
               (replace 'install-license-files
                 (lambda _
                   (install-file "REAPER/EULA.txt"
                                 (string-append #$output "/share/doc/reaper-"
                                                #$version)))))))
    (native-inputs
      (list xdg-utils))
    (inputs
     (list alsa-lib
           `(,gcc "lib")
           ffmpeg
           jack-1
           lame
           mesa
           pulseaudio
           python
           swell
           vlc))
    (supported-systems
      '("x86_64-linux" "i686-linux" "aarch64-linux" "armhf-linux"))
    (home-page "https://www.reaper.fm")
    (synopsis "Digital audio workstation")
    (description
     "REAPER is a digital audio production application offering multitrack
audio and MIDI recording, editing, processing, mixing and mastering toolset.
It supports a vast range of hardware, digital formats and plugins, and can be
comprehensively extended, scripted and modified.")
    (license (license:nonfree "file:///opt/REAPER/EULA.txt"))))