summaryrefslogtreecommitdiff
path: root/packages/komodo/komodo.scm
blob: 598f1393ddcbfadfcdba1edb48dc78514811f7e5 (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
(define-module (komodo)
  #:use-module (cpprestsdk)
  #:use-module (doom-meta)
  #:use-module (gnu packages)
  #:use-module (gnu packages boost)
  #:use-module (gnu packages calendar)
  #:use-module (gnu packages check)
  #:use-module (gnu packages compression)
  #:use-module (gnu packages cpp)
  #:use-module (gnu packages game-development)
  #:use-module (gnu packages logging)
  #:use-module (gnu packages pretty-print)
  #:use-module (gnu packages qt)
  #:use-module (gnu packages tls)
  #:use-module (gnu packages version-control)
  #:use-module (guix build utils)
  #:use-module (guix build-system qt)
  #:use-module (guix download)
  #:use-module (guix gexp)
  #:use-module (guix git-download)
  #:use-module ((guix licenses)
		#:prefix license:)
  #:use-module (guix packages)
  #:use-module (libsodium-komodo)
  #:use-module (refl-cpp)
  #:use-module (strong-type))

;;; DATA LAYER

(define build-deps-prefix "../build/_deps/")

(define expected-hash "17akrv80h0n4cfmxwvlvbb8ycqza7y3qqygjyphv95rrabqm9r02")

(define expected-src "expected-src/")

(define jl777-coins-hash "1icbd6f8nridzc93vz7hsr5dnkrf328zfsw6rrzifc7nvsr559w8")

(define jl777-coins-src "jl777-coins-src/")

(define komodo-wallet-hash
  "0pfkgas0xkixf99zqzyri80ksp89b7dw7hbcgpp60ni2cnchxk2n")

(define komodo-wallet-home-page "https://atomicdex.io/")

(define komodo-wallet-description-lines
  (list "Komodo Wallet is a secure wallet and non-custodial decentralized "
	"exchange rolled into one application. Store your coins, trade "
	"peer-to-peer with minimal fees and never give up control over your "
	"digital assets."))

(define komodo-wallet-name "komodo-wallet")

(define komodo-wallet-synopsis-lines
  (list "Komodo Wallet Desktop GUI"))

(define komodo-wallet-version "0.7.0-beta")

(define mm2-hash "1bn2sjcrp9ih44h3p96prnwg74aids7fgzcnlv3c68nan6y2lysi")

(define mm2-src "mm2-src/")

;;; ABSTRACTION LAYER -8

(define expected-file-name
  (git-file-name "libexpected" "1.1.0"))

(define expected-git-reference
  (git-reference (url "https://github.com/TartanLlama/expected")
		 (commit "v1.1.0")
		 (recursive? #t)))

(define expected-patches
  (search-patches "libexpected-use-provided-catch2.patch"))

(define komodo-wallet-git-reference
  (git-reference (url "https://github.com/KomodoPlatform/komodo-wallet-desktop")
		 (commit komodo-wallet-version)))

(define expected-content-hash
  (content-hash (base32 expected-hash)))

(define jl777-coins-content-hash
  (content-hash (base32 jl777-coins-hash)))

(define komodo-wallet-content-hash
  (content-hash (base32 komodo-wallet-hash)))

(define mm2-content-hash
  (content-hash (base32 mm2-hash)))

;;; ABSTRACTION LAYER -7

(define build-path-mm2
  (string-append build-deps-prefix
		 mm2-src))

(define build-path-jl777-coins
  (string-append build-deps-prefix
		 jl777-coins-src))

(define build-path-expected
  (string-append build-deps-prefix
		 expected-src))

(define expected-origin
  (origin (uri expected-git-reference)
	  (method git-fetch)
	  (hash expected-content-hash)
	  (file-name expected-file-name)
	  (patches expected-patches)))

(define jl777-coins-origin
  (origin (uri "https://github.com/KomodoPlatform/coins/archive/master.zip")
	  (method url-fetch)
	  (hash jl777-coins-content-hash)))

(define komodo-wallet-origin
  (origin (uri komodo-wallet-git-reference)
	  (method git-fetch)
	  (hash komodo-wallet-content-hash)))

(define mm2-origin
  (origin (uri "https://sdk.devbuilds.komodo.earth/main/mm2_b0fd99e-linux-x86-64.zip")
	  (method url-fetch)
	  (hash mm2-content-hash)))

;;; ABSTRACTION LAYER -6

(define prepare-build-paths
  `(string-append "file(MAKE_DIRECTORY \"" ,build-path-expected "\")\n"
		  "file(MAKE_DIRECTORY \"" ,build-path-jl777-coins "\")\n"
		  "file(MAKE_DIRECTORY \"" ,build-path-mm2 "\")\n"))

(define prepare-expected-src
  `(string-append "file(COPY " ,expected-origin "/ "
		  "DESTINATION " ,build-path-expected " "
		  "NO_SOURCE_PERMISSIONS FOLLOW_SYMLINK_CHAIN)\n"))

(define prepare-jl777-coins-src
  `(string-append "file(ARCHIVE_EXTRACT INPUT " ,jl777-coins-origin " "
		  "DESTINATION " ,build-path-jl777-coins ")\n"
		  "file(COPY " ,build-path-jl777-coins "/coins-master/ "
		  "DESTINATION " ,build-path-jl777-coins ")\n"))

(define prepare-mm2-src
  `(string-append "file(ARCHIVE_EXTRACT INPUT " ,mm2-origin " "
		  "DESTINATION " ,build-path-mm2 ")\n"))

;;; ABSTRACTION LAYER -5

(define vcpkg-replacement
  `(string-append "\n"
		  ,prepare-build-paths
		  ,prepare-expected-src
		  ,prepare-jl777-coins-src
		  ,prepare-mm2-src
		  "\n"))


;;; ABSTRACTION LAYER -4

(define fix-date
  `(substitute* "cmake/dependencies.cmake"
		(("date-tz")
		 "date")))

(define fix-doom-meta
  `(substitute* (list "vendor/antara-gaming_sdk/modules/event/CMakeLists.txt"
		      "vendor/antara-gaming_sdk/modules/ecs/CMakeLists.txt")
		(("doom::meta")
		 "doom")))

(define replace-vcpkg
  `(substitute* "CMakeLists.txt"
		(("include\\(vcpkg_prerequisites\\)")
		 ,vcpkg-replacement)))

;;; ABSTRACTION LAYER -3

(define cmake-modification
  `(lambda _
     ,replace-vcpkg
     ,fix-date
     ,fix-doom-meta))

;;; ABSTRACTION LAYER -2

(define modify-cmake-configuration
  `(add-after 'unpack
	      'delete-vcpkg
	      ,cmake-modification))

;;; ABSTRACTION LAYER -1

(define komodo-wallet-configure-flags
  '(list "-DFETCHCONTENT_FULLY_DISCONNECTED=ON"
	 "-Wno-dev"))

(define komodo-wallet-phases
  #~(modify-phases %standard-phases
		   #+modify-cmake-configuration))

;;; ABSTRACTION LAYER 0

(define komodo-wallet-arguments
  (list #:phases komodo-wallet-phases
	#:configure-flags komodo-wallet-configure-flags))

(define komodo-wallet-description
  (string-concatenate komodo-wallet-description-lines))

(define komodo-wallet-native-inputs
  (list boost cpprestsdk date doctest doom-meta entt fmt git libsodium-komodo
	nlohmann-json openssl qtcharts qtdeclarative-5 qttools-5 qtsvg-5
	qtwebengine-5 range-v3 refl-cpp spdlog strong-type zlib))

(define komodo-wallet-synopsis
  (string-concatenate komodo-wallet-synopsis-lines))

;;; SURFACE LAYER

(define-public komodo-wallet
  (package (name komodo-wallet-name)
	   (version komodo-wallet-version)
	   (source komodo-wallet-origin)
	   (build-system qt-build-system)
	   (arguments komodo-wallet-arguments)
	   (native-inputs komodo-wallet-native-inputs)
	   (synopsis komodo-wallet-synopsis)
	   (description komodo-wallet-description)
	   (license license:gpl2)
	   (home-page komodo-wallet-home-page)))