summaryrefslogtreecommitdiffstats
path: root/throne/deps.scm
blob: c3dae1f46fdb919a30255822c4e1680e4acff95d (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
(define-module (throne deps)
  #:use-module (guix packages)
  #:use-module (guix git-download)
  #:use-module (guix download)
  #:use-module (guix build-system gnu)
  #:use-module (guix build-system cmake)
  #:use-module ((guix licenses) #:prefix license:)
  #:use-module (guix gexp)
  #:use-module (guix utils)
  #:use-module (gnu packages base)
  #:use-module (gnu packages qt)
  #:use-module (gnu packages cpp)
  #:use-module (gnu packages protobuf)
  #:use-module (gnu packages databases)
  #:use-module (gnu packages commencement)
  #:use-module (gnu packages sdl)
  #:use-module (gnu packages pkg-config)
  #:use-module (gnu packages compression)
  #:use-module (gnu packages elf)
  #:export (throne))

(define quirc
  (package
    (name "quirc")
    (version "1.2")
    (source
     (origin
       (method git-fetch)
       (uri
        (git-reference
         (url "https://github.com/dlbeer/quirc.git")
         (commit (string-append "v" version))))
       (file-name (git-file-name name version))
       (sha256
        (base32
         "1pbym7cf34z9za31bdpbi52snklp11jal4axddbk5pppl9hbznnd"))))
    (build-system gnu-build-system)
    (native-inputs
     (list gcc-toolchain pkg-config sdl12-compat))
    (arguments
     (list
      #:tests? #f
      #:phases
      #~(modify-phases %standard-phases
          (delete 'configure)
          (replace 'build
            (lambda _
              (invoke "make" "CC=gcc" "libquirc.so")))
          (replace 'install
            (lambda _
              (let ((out (assoc-ref %outputs "out")))
                (mkdir-p (string-append out "/lib"))
                (mkdir-p (string-append out "/include"))
                (install-file
                 "libquirc.so.1.2"
                 (string-append out "/lib"))
                (symlink
                 (string-append out "/lib/libquirc.so.1.2")
                 (string-append out "/lib/libquirc.so.1"))
                (symlink
                 (string-append out "/lib/libquirc.so.1.2")
                 (string-append out "/lib/libquirc.so"))
                (install-file
                 "lib/quirc.h"
                 (string-append out "/include"))))))))
    (synopsis "QR code recognition library")
    (description "Quirc is a QR code recognition library.")
    (home-page "https://github.com/dlbeer/quirc")
    (license license:isc)))

(define fkyaml
  (package
    (name "fkyaml")
    (version "0.4.1")
    (source
     (origin
       (method git-fetch)
       (uri
        (git-reference
         (url "https://github.com/fktn-k/fkYAML.git")
         (commit (string-append "v" version))))
       (file-name (git-file-name name version))
       (sha256
        (base32
         "1aq658bj2bay31j5300pyxwc2aqpnx4ycgr684b7bb1kcvm4a80i"))))
    (build-system cmake-build-system)
    (arguments
     (list #:tests? #f))
    (synopsis "Header-only YAML library for C++")
    (description "fkYAML is a header-only YAML library for C++.")
    (home-page "https://github.com/fktn-k/fkYAML")
    (license license:expat)))

(define simple-protobuf
  (package
    (name "simple-protobuf")
    (version "0.0.1")
    (source
     (origin
       (method git-fetch)
       (uri
        (git-reference
         (url "https://github.com/tonda-kriz/simple-protobuf.git")
         (commit "master")))
       (file-name (git-file-name name version))
       (sha256
        (base32
         "1l66dd57b8f6whmaf023b9w1kfqpvqx7nr8gn7y5rq0s0afpsz7k"))))
    (build-system cmake-build-system)
    (arguments
     (list #:tests? #f))
    (synopsis "Simple protobuf implementation")
    (description "Simple protobuf implementation.")
    (home-page "https://github.com/tonda-kriz/simple-protobuf")
    (license license:expat)))

(define srslist
  (origin
    (method url-fetch)
    (uri
     "https://raw.githubusercontent.com/throneproj/routeprofiles/rule-set/srslist.h")
    (sha256
     (base32
      "0c3lnd3s524wihiln5pr8iyrj0jwsyjc346mm2kfsp86kapw3dw8"))))

(define throne-core
  (origin
    (method url-fetch)
    (uri
     "https://github.com/throneproj/Throne/releases/download/1.2.4/Throne-1.2.4-linux-amd64.zip")
    (sha256
     (base32
      "13j47z829frk6qs5d6znsxx8kl4gymbhj3y8fpbjpgk6iprr07cj"))))

(define throne
  (package
    (name "throne")
    (version "1.2.4")
    (source
     (origin
       (method git-fetch)
       (uri
        (git-reference
         (url "https://github.com/throneproj/Throne.git")
         (commit version)
         (recursive? #t)))
       (file-name (git-file-name name version))
       (sha256
        (base32
         "1w137s2hcvdqvk67yhyddbc8klb8z6l0b3y7y2b3g9pb33gr8dkw"))))
    (build-system cmake-build-system)
    (native-inputs
     `(("pkg-config" ,pkg-config)
       ("srslist.h" ,srslist)
       ("throne-core" ,throne-core)
       ("unzip" ,unzip)
       ("patchelf" ,patchelf)
       ("glibc" ,glibc)))
    (inputs
     (list
      qtbase
      qtdeclarative
      qtsvg
      qttools
      abseil-cpp
      protobuf
      qhotkey
      quirc
      fkyaml
      sqlitecpp
      simple-protobuf))
    (arguments
     (list
      #:tests? #f
      #:validate-runpath? #f
      #:configure-flags
      #~'("-DNKR_PACKAGE=true")
      #:phases
      #~(modify-phases %standard-phases
          (add-after 'unpack 'patch-core-path
            (lambda _
              (substitute*
                  '("src/global/Configs.cpp"
                    "src/ui/mainWindow/mainwindow_setup.cpp")
                (("auto fn = QApplication::applicationDirPath\\(\\) \\+ \"/ThroneCore\";")
                 "auto fn = QFileInfo::exists(\"/run/privileged/bin/ThroneCore\") ? QString(\"/run/privileged/bin/ThroneCore\") : QApplication::applicationDirPath() + \"/ThroneCore\";")
                (("auto core_path = QApplication::applicationDirPath\\(\\) \\+ \"/\";")
                 "auto core_path = QFileInfo::exists(\"/run/privileged/bin/ThroneCore\") ? QString(\"/run/privileged/bin/ThroneCore\") : QApplication::applicationDirPath() + \"/\";")
                (("core_path \\+= \"ThroneCore\";")
                 "if (!QFileInfo::exists(\"/run/privileged/bin/ThroneCore\")) core_path += \"ThroneCore\";"))))
          (add-after 'unpack 'fetch-srslist
            (lambda _
              (copy-file
               (assoc-ref %build-inputs "srslist.h")
               "srslist.h")))
          (replace 'install
            (lambda _
              (let* ((out (assoc-ref %outputs "out"))
                     (bin (string-append out "/bin"))
                     (libexec (string-append out "/libexec"))
                     (core-archive
                      (assoc-ref %build-inputs "throne-core"))
                     (core-path
                      "throne-core/ThroneCore")
                     (glibc-path
                      (assoc-ref %build-inputs "glibc")))
                (mkdir-p bin)
                (mkdir-p libexec)
                (copy-file
                 "Throne"
                 (string-append libexec "/Throne"))
                (chmod
                 (string-append libexec "/Throne")
                 #o555)
                (symlink
                 "/run/privileged/bin/Throne"
                 (string-append bin "/Throne"))
                (mkdir-p "throne-core")
                (invoke
                 "unzip"
                 "-q"
                 "-j"
                 core-archive
                 "Throne/ThroneCore"
                 "-d"
                 "throne-core")
                (invoke
                 "patchelf"
                 "--set-interpreter"
                 (string-append
                  glibc-path
                  "/lib/ld-linux-x86-64.so.2")
                 core-path)
                (copy-file
                 core-path
                 (string-append libexec "/ThroneCore"))
                (chmod
                 (string-append libexec "/ThroneCore")
                 #o555)))))))
    (synopsis "Qt desktop proxy utility")
    (description "Throne is a Qt-based desktop proxy utility.")
    (home-page "https://github.com/throneproj/Throne")
    (license license:gpl3)))

throne