anchor.diff:    (sb-ext:assert-version->= 2 0 0)
     (require 'sb-bsd-sockets))
   
  -(defvar *prefix* (uiop:merge-pathnames* (if (uiop:getenv "PREFIX")
  -                                            (uiop:relativize-pathname-directory (uiop:getenv "PREFIX"))
  +(defvar *prefix* (merge-pathnames* (if (getenv "PREFIX")
  +                                            (relativize-pathname-directory (getenv "PREFIX"))
                                               #p"usr/local/")
  -                                        (if (uiop:getenv "DESTDIR")
  -                                            (uiop:ensure-directory-pathname (uiop:getenv "DESTDIR"))
  +                                        (if (getenv "DESTDIR")
  +                                            (ensure-directory-pathname (getenv "DESTDIR"))
                                               #p"/")))
  -(defvar *datadir* (if (uiop:getenv "DATADIR")
  -                      (uiop:ensure-directory-pathname (uiop:getenv "DATADIR"))
  -                      (uiop:merge-pathnames* "share/" *prefix*)))
  -(defvar *bindir* (if (uiop:getenv "BINDIR")
  -                     (uiop:ensure-directory-pathname (uiop:getenv "BINDIR"))
  -                     (uiop:merge-pathnames* "bin/" *prefix*)))
  -
  -(defvar *nyxt-renderer* (or (uiop:getenv "NYXT_RENDERER")
  +(defvar *datadir* (if (getenv "DATADIR")
  +                      (ensure-directory-pathname (getenv "DATADIR"))
  +                      (merge-pathnames* "share/" *prefix*)))
  +(defvar *bindir* (if (getenv "BINDIR")
  +                     (ensure-directory-pathname (getenv "BINDIR"))
  +                     (merge-pathnames* "bin/" *prefix*)))
  +
  +(defvar *nyxt-renderer* (or (getenv "NYXT_RENDERER")
                               "gi-gtk"))
   
  -(defvar *submodules-dir* (or (uiop:getenv "NYXT_SUBMODULES_DIR")
  +(defvar *submodules-dir* (or (getenv "NYXT_SUBMODULES_DIR")
                                "_build"))
   
  -(defvar *submodules-jobs* (or (uiop:getenv "NYXT_SUBMODULES_JOBS")
  +(defvar *submodules-jobs* (or (getenv "NYXT_SUBMODULES_JOBS")
                                 4)
     "Number of parallel 'git clone' jobs to fetch the Git submodules.
   A naive benchmark on a 16 Mpbs bandwidth gives us
  
positive.code:   ;; We must set this globally because the information would be lost within a
    ;; Lisp compiler subprocess (e.g. as used by linux-packaging).
    (flet ((ensure-absolute-path (path component)
             (if (uiop:absolute-pathname-p path)
                 path
                 (system-relative-pathname component path))))
      (setf (getenv "CL_SOURCE_REGISTRY")
  
negative.code:   :perform (compile-op
              (o c)
              (flet ((ensure-parent-exists (file)
                       (ensure-all-directories-exist
                        (list (directory-namestring file)))))
                (let ((desktop-file (merge-pathnames* "applications/nyxt.desktop" *datadir*)))
                  (ensure-parent-exists desktop-file)
                  (copy-file (system-relative-pathname c "assets/nyxt.desktop")
                                  desktop-file))
                (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)
                          (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 (merge-pathnames* "nyxt" *bindir*)))
                  (ensure-parent-exists binary-file)
                  (copy-file (system-relative-pathname c "nyxt") binary-file)
                  ;; TODO: Use iolib/os:file-permissions instead of chmod?  Too verbose?
                  (run-program (list "chmod" "+x" (native-namestring binary-file))))
                (let ((source-dir (merge-pathnames* "nyxt/" *datadir*)))
                  (flet ((copy-directory (source destination)
                           "Copy the content (the file tree) of SOURCE to DESTINATION."
                           (collect-sub*directories
                            (ensure-directory-pathname source)
                            (constantly t)
                            t
                            (lambda (subdirectory)
                              (mapc (lambda (file)
                                      (unless (member (pathname-type file) '("o" "fasl") :test 'equalp)
                                        (let ((destination-file
                                                (merge-pathnames*
                                                 (subpathp file (ensure-directory-pathname source))
                                                 (ensure-pathname destination :truenamize t :ensure-directory t))))
                                          (ensure-parent-exists destination-file)
                                          (copy-file file destination-file))))
                                    (directory-files subdirectory))))))
                    (handler-case
                        (progn
                          (dolist (file (cons
                                         ;; Find `libnyxt' file regardless of its extension:
                                         (subpathp (first (delete-if
                                                           (complement (lambda (file)
                                                                         (string-prefix-p "libnyxt" (pathname-name file))))
                                                           (directory-files (system-relative-pathname
                                                                             :nyxt "libraries/web-extensions"))))
                                                   (system-source-directory :nyxt))
                                         (mapcan (lambda (dir)
                                                   (split-string
                                                    (run-program `("git" "-C" ,(native-namestring
                                                                                (system-source-directory :nyxt))
                                                                         "ls-files" ,dir)
                                                                 :output '(:string :stripped t))
                                                    :separator '(#\newline #\return #\linefeed)))
                                                 '("source" "libraries"))))
                            (let ((dest (merge-pathnames* file source-dir)))
                              (ensure-parent-exists dest)
                              (copy-file (system-relative-pathname :nyxt file)
                                         dest))))
                      (t ()
                        (dolist (dir '("source" "libraries"))
                          (copy-directory (system-relative-pathname :nyxt dir)
                                          (merge-pathnames* dir source-dir)))))
                    (copy-file (system-source-file :nyxt) (merge-pathnames* "nyxt.asd" source-dir)))))))
  
  ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  ;; Library subsystems:
  