Repository navigation
Expand file tree
/
Copy pathnyxt.asd
More file actions
528 lines (490 loc) · 19.2 KB
/
Copy pathnyxt.asd
File metadata and controls
528 lines (490 loc) · 19.2 KB
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
;;;; SPDX-FileCopyrightText: Atlas Engineer LLC
;;;; SPDX-License-Identifier: BSD-3-Clause
#+sbcl
(progn
(sb-ext:assert-version->= 2 0 0)
(require 'sb-bsd-sockets))
(defvar *prefix* (format nil "~a/~a"
(or (uiop:getenv "DESTDIR") "")
(or (uiop:getenv "PREFIX")
"/usr/local")))
(defvar *datadir* (or (uiop:getenv "DATADIR")
(format nil "~a/share" *prefix*)))
(defvar *bindir* (or (uiop:getenv "BINDIR")
(format nil "~a/bin" *prefix*)))
(defvar *nyxt-renderer* (or (uiop:getenv "NYXT_RENDERER")
"gi-gtk"))
(defsystem "nyxt"
:version "2.1.1"
:author "Atlas Engineer LLC"
:homepage "https://nyxt.atlas.engineer"
:description "Extensible web-browser in Common Lisp"
:license "BSD 3-Clause"
:serial t
:depends-on (alexandria
bordeaux-threads
calispel
cl-base64
cl-css
cl-html-diff
cl-json
cl-ppcre
cl-ppcre-unicode
cl-prevalence
cl-qrencode
closer-mop
cl-containers
moptilities
dexador
enchant
flexi-streams
iolib
iolib/os
local-time
log4cl
mk-string-metrics
#-sbcl
osicat
parenscript
quri
serapeum
str
plump
clss
spinneret
swank
trivia
trivial-clipboard
trivial-features
trivial-garbage
trivial-package-local-nicknames
trivial-types
unix-opts
;; Local systems:
nyxt/user-interface
nyxt/text-buffer
nyxt/analysis
nyxt/download-manager
nyxt/history-tree
nyxt/password-manager
nyxt/keymap
nyxt/class-star
nyxt/ospm
nyxt/prompter)
:pathname "source/"
:components ((:file "package")
;; Independent utilities
(:file "time")
(:file "types")
(:file "conditions")
(:file "debug")
(:file "user-interface")
;; Core functionality
(:file "global")
(:file "concurrency")
(:file "data-storage")
(:file "configuration")
(:file "message")
(:file "command")
(:file "parenscript-macro")
(:file "renderer-script")
(:file "urls")
(:file "dom")
(:file "buffer")
(:file "window")
(:file "mode")
(:file "search-engine")
(:file "browser")
(:file "clipboard")
(:file "input")
(:file "prompt-buffer")
(:file "command-commands")
(:file "prompt-buffer-mode")
(:file "recent-buffers")
(:file "password")
(:file "bookmark")
(:file "history")
(:file "autofill")
(:file "auto-mode")
(:file "external-editor")
(:file "file-manager")
#+quicklisp
(:file "lisp-system")
;; Core Modes
(:file "editor-mode")
(:file "plaintext-editor-mode")
(:file "buffer-listing-mode")
(:file "base-mode")
(:file "repl-mode")
(:file "help-mode")
(:file "message-mode")
(:file "application-mode")
(:file "history-tree-mode")
(:file "list-history-mode")
(:file "web-mode")
(:file "reading-line-mode")
(:file "style-mode")
(:file "certificate-exception-mode")
(:file "emacs-mode")
(:file "vi-mode")
(:file "blocker-mode")
(:file "proxy-mode")
(:file "noimage-mode")
(:file "nosound-mode")
(:file "noscript-mode")
(:file "nowebgl-mode")
(:file "download-mode")
(:file "force-https-mode")
(:file "reduce-tracking-mode")
(:file "os-package-manager-mode")
(:file "visual-mode")
(:file "process-mode")
(:file "repeat-mode")
(:file "cruise-control-mode")
(:file "watch-mode")
(:file "preview-mode")
(:file "diff-mode")
(:file "expedition-mode")
;; Web-mode commands
(:file "bookmarklets")
(:file "input-edit")
(:file "element-hint")
(:file "element-hint-mode")
(:file "element-frame")
(:file "jump-heading")
(:file "summarize")
(:file "scroll")
(:file "search-buffer")
(:file "spell-check")
(:file "zoom")
;; Needs web-mode
(:file "help")
(:file "macro-edit-mode")
(:file "status")
;; Depends on everything else:
(:file "about")
(:file "start")
(:file "tutorial")
(:file "manual"))
:in-order-to ((test-op (test-op "nyxt/tests")
(test-op "nyxt/download-manager/tests")
(test-op "nyxt/history-tree/tests")
(test-op "nyxt/keymap/tests")
(test-op "nyxt/class-star/tests")
(test-op "nyxt/ospm/tests")
(test-op "nyxt/prompter/tests"))))
(defun nyxt-run-test (c path &key network-needed-p)
(and (or (not network-needed-p)
(not (uiop:getenv "NYXT_TESTS_NO_NETWORK")))
(not (funcall (read-from-string "prove:run")
(system-relative-pathname c path)))
(uiop:getenv "NYXT_TESTS_ERROR_ON_FAIL")
(uiop:quit 18)))
;; TODO: Test that Nyxt starts and that --help, --version work.
(defsystem "nyxt/tests"
:depends-on (nyxt prove)
:components ((:file "tests/package"))
:perform (test-op (op c)
(nyxt-run-test c "tests/offline/")
(nyxt-run-test c "tests/online/" :network-needed-p t)))
(defun print-benchmark (benchmark-results)
(labels ((rat->float (num)
(if (integerp num) num (float num)))
(print-times (entry)
(let ((title (first entry))
(attr (rest entry)))
(unless (or (member (symbol-name title) '("RUN-TIME" "SYSTEM-RUN-TIME")) ; Not so interesting.
(and (member (symbol-name title) '("PAGE-FAULTS" "EVAL-CALLS")
:test #'string=)
(zerop (getf attr :average))))
(format t " ~a: ~,9t~a" (string-downcase title) (rat->float (getf attr :average)))
(format t "~32,8t[~a, ~a]"
(rat->float (getf attr :minimum))
(rat->float (getf attr :maximum)))
(format t "~56,8t(median ~a, deviation ~a, total ~a)"
(rat->float (getf attr :median))
(rat->float (getf attr :deviation))
(rat->float (getf attr :total)))
(format t "~%")))))
(dolist (mark benchmark-results)
(format t "~a (~a sample~:p):~%" (first mark)
(getf (rest (second mark)) :samples))
(mapc #'print-times (rest mark)))))
(defsystem "nyxt/benchmark"
:depends-on (alexandria
nyxt
trivial-benchmark)
:pathname "tests/benchmarks"
:components ((:file "../benchmark-package")
(:file "prompter"))
:perform (test-op (op c)
(let ((results
(funcall (read-from-string "alexandria:hash-table-alist")
(funcall (read-from-string "benchmark:run-package-benchmarks")
:package :nyxt/benchmark
:verbose t))))
(print-benchmark results))))
(defsystem "nyxt/clean-fasls"
:depends-on (swank)
:perform (compile-op (o c)
(load (merge-pathnames
"contrib/swank-asdf.lisp"
(symbol-value
(read-from-string "swank-loader:*source-directory*"))))
(funcall (read-from-string "swank:delete-system-fasls") "nyxt")))
;; We use a temporary "version" file to generate the final nyxt.desktop with the
;; right version number. Since "version" is a file target, third-party
;; packaging systems can choose to generate "version" in advance before calling
;; "make install-assets", so that they won't need to rely on Quicklisp.
(defsystem "nyxt/version"
:depends-on (nyxt)
:output-files (compile-op (o c)
(values (list (system-relative-pathname c "version"))
t))
:perform (compile-op (o c)
(with-open-file (out (output-file o c)
:direction :output
:if-exists :supersede)
(princ (symbol-value (read-from-string "nyxt:+version+"))
out))))
(defsystem "nyxt/documentation" ; TODO: Only rebuild if input changed.
:depends-on (nyxt)
:output-files (compile-op (o c)
(values (list (system-relative-pathname c "manual.html"))
t))
:perform (compile-op (o c)
(with-open-file (out (output-file o c)
:direction :output
:if-exists :supersede)
(write-string (funcall (read-from-string "nyxt::manual-content"
(find-package 'nyxt)))
out))
(format *error-output* "Manual dumped to ~s.~&" (output-file o c))))
(defsystem "nyxt/gtk"
:depends-on (nyxt
cl-cffi-gtk
cl-webkit2)
:pathname "source/"
:serial t
:components ((:file "renderers/gtk-clipboard")
(:file "renderers/gtk")))
(defsystem "nyxt/gi-gtk"
:depends-on (nyxt/gtk
cl-gobject-introspection
bordeaux-threads)
:pathname "source/"
:components ((:file "renderers/gi-gtk")))
(defsystem "nyxt/qt"
:depends-on (nyxt
cl-webengine
trivial-main-thread)
:pathname "source/"
:components ((:file "renderers/qt")))
;; We should not set the build-pathname in systems that have a component.
;; Indeed, when an external program (like Guix) builds components, it needs to
;; know the name of the output. But ASDF/SYSTEM::COMPONENT-BUILD-PATHNAME is
;; non-exported so the only reliable way to know the build pathname is to use
;; the default.
;;
;; The workaround is to set a new dummy system of which the sole purpose is to
;; produce the desired binary.
(defsystem "nyxt/gtk-application"
:depends-on (nyxt/gtk)
:build-operation "program-op"
:build-pathname "nyxt"
:entry-point "nyxt:entry-point")
(defsystem "nyxt/gi-gtk-application"
:depends-on (nyxt/gi-gtk)
:build-operation "program-op"
:build-pathname "nyxt"
:entry-point "nyxt:entry-point")
(defsystem "nyxt/qt-application"
:depends-on (nyxt/qt)
:build-operation "program-op"
:build-pathname "nyxt-qt"
:entry-point "nyxt:entry-point")
#+sb-core-compression
(handler-bind ((warning #'muffle-warning))
(defmethod perform ((o image-op) (c system))
(uiop:dump-image (output-file o c)
:executable t
:compression (uiop:getenv "NYXT_COMPRESS"))))
(defmethod perform :before ((o image-op) (c system))
"Register immutable systems to prevent compiled images of Nyxt from
trying to recompile dependencies.
See `asdf::*immutable-systems*'."
(map () 'asdf:register-immutable-system (asdf:already-loaded-systems)))
(defsystem "nyxt/install"
:depends-on (alexandria
str
#.(format nil "nyxt/~a-application" *nyxt-renderer*)
nyxt/version)
:perform (compile-op
(o c)
(flet ((ensure-parent-exists (file)
(uiop:ensure-all-directories-exist
(list (directory-namestring file)))))
(let ((desktop-file (format nil "~a/applications/nyxt.desktop" *datadir*)))
(ensure-parent-exists desktop-file)
(uiop:copy-file (system-relative-pathname c "assets/nyxt.desktop")
(format nil "~a/applications/nyxt.desktop" *datadir*)))
(mapc (lambda (icon-size)
(let ((icon-file (format nil "~a/icons/hicolor/~ax~a/apps/nyxt.png"
*datadir* icon-size icon-size)))
(ensure-parent-exists icon-file)
(uiop:copy-file (system-relative-pathname
c
(format nil "assets/nyxt_~ax~a.png"
icon-size icon-size))
icon-file)))
'(16 32 128 256 512))
(let ((binary-file (format nil "~a/nyxt" *bindir*)))
(ensure-parent-exists binary-file)
(uiop:copy-file (system-relative-pathname c "nyxt") binary-file)
;; TODO: Use iolib/os:file-permissions instead of chmod? Too verbose?
(uiop:run-program (list "chmod" "+x" binary-file))))))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Library subsystems:
(defsystem "nyxt/download-manager"
:depends-on (calispel
cl-ppcre
dexador
log4cl
quri
str)
:pathname "libraries/download-manager/"
:components ((:file "package")
(:file "engine")
(:file "native"))
:in-order-to ((test-op (test-op "nyxt/download-manager/tests"))))
(defsystem "nyxt/download-manager/tests"
:depends-on (nyxt/download-manager prove)
:perform (test-op (op c)
(nyxt-run-test c "libraries/download-manager/tests/"
:network-needed-p t)))
(defsystem "nyxt/analysis"
:depends-on (str
serapeum
alexandria
cl-ppcre)
:pathname "libraries/analysis/"
:components ((:file "package")
(:file "data")
(:file "stem")
(:file "tokenize")
(:file "analysis")
(:file "document-vector")
(:file "text-rank")
(:file "dbscan")))
(defsystem "nyxt/user-interface"
:depends-on (spinneret)
:pathname "libraries/user-interface/"
:components ((:file "package")
(:file "user-interface")))
(defsystem "nyxt/text-buffer"
:depends-on (cluffer)
:pathname "libraries/text-buffer/"
:components ((:file "package")
(:file "text-buffer")))
(defsystem "nyxt/history-tree"
:depends-on (alexandria
cl-custom-hash-table
local-time
nyxt/class-star
trivial-package-local-nicknames)
:pathname "libraries/history-tree/"
:components ((:file "package")
(:file "history-tree"))
:in-order-to ((test-op (test-op "nyxt/history-tree/tests"))))
(defsystem "nyxt/history-tree/tests"
:depends-on (nyxt/history-tree prove)
:perform (test-op (op c)
(nyxt-run-test c "libraries/history-tree/tests/")))
(defsystem "nyxt/password-manager"
:depends-on (bordeaux-threads
cl-ppcre
str
trivial-clipboard
uiop
nyxt/class-star
serapeum)
:pathname "libraries/password-manager/"
:components ((:file "package")
(:file "password")
(:file "password-keepassxc")
(:file "password-security")
;; Keep password-store last so that it has higher priority.
(:file "password-pass")))
(defsystem "nyxt/keymap"
:depends-on (alexandria fset str)
:pathname "libraries/keymap/"
:components ((:file "package")
(:file "types")
(:file "conditions")
(:file "keymap")
(:file "scheme")
(:file "scheme-names"))
:in-order-to ((test-op (test-op "nyxt/keymap/tests"))))
(defsystem "nyxt/keymap/tests"
:depends-on (alexandria fset nyxt/keymap prove)
:components ((:file "libraries/keymap/test-package"))
:perform (test-op (op c)
(nyxt-run-test c "libraries/keymap/tests/")))
(defsystem "nyxt/class-star"
:depends-on (hu.dwim.defclass-star moptilities alexandria)
:pathname "libraries/class-star/"
:components ((:file "package")
(:file "patch")
(:file "class-star"))
:in-order-to ((test-op (test-op "nyxt/class-star/tests"))))
(defsystem "nyxt/class-star/tests"
:depends-on (nyxt/class-star prove)
:perform (test-op (op c)
(nyxt-run-test c "libraries/class-star/tests/")))
(defsystem "nyxt/ospm"
:depends-on (alexandria
calispel
cl-ppcre
local-time
named-readtables
#-sbcl
osicat
serapeum
str
trivia
nyxt/class-star)
:pathname "libraries/ospm/"
:components ((:file "package")
(:file "scheme-syntax")
(:file "guix-backend")
(:file "ospm")
(:file "ospm-guix"))
:in-order-to ((test-op (test-op "nyxt/ospm/tests"))))
(defsystem "nyxt/ospm/tests"
:depends-on (nyxt/ospm prove)
:components ((:file "libraries/ospm/test-package"))
:perform (test-op (op c)
(nyxt-run-test c "libraries/ospm/tests/tests.lisp")))
(defsystem "nyxt/prompter"
:depends-on (alexandria
calispel
cl-containers
closer-mop
mk-string-metrics
moptilities
serapeum
str
trivial-package-local-nicknames
nyxt/class-star)
:pathname "libraries/prompter/"
:components ((:file "package")
(:file "filter-preprocessor")
(:file "filter")
(:file "prompter-source")
(:file "prompter"))
:in-order-to ((test-op (test-op "nyxt/prompter/tests"))))
(defsystem "nyxt/prompter/tests"
:depends-on (nyxt/prompter prove)
:components ((:file "libraries/prompter/test-package"))
:perform (test-op (op c)
(nyxt-run-test c "libraries/prompter/tests/")))