From d88b380a8839f2f9f3b8f62da68ffc084241ef46 Mon Sep 17 00:00:00 2001 From: "Andre A. Gomes" Date: Sat, 21 Sep 2024 18:01:50 +0300 Subject: guix.scm: Refactor as to use git submodules. The CL libraries are dictated by Nyxt's git submodules. This way there's a single source of truth for the CL dependencies versions. --- build-scripts/nyxt.scm | 116 ---------------------------------------- guix.scm | 141 +++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 141 insertions(+), 116 deletions(-) delete mode 100644 build-scripts/nyxt.scm create mode 100644 guix.scm diff --git a/build-scripts/nyxt.scm b/build-scripts/nyxt.scm deleted file mode 100644 index e1cefa723..000000000 --- a/build-scripts/nyxt.scm +++ /dev/null @@ -1,116 +0,0 @@ -;;;; SPDX-FileCopyrightText: Atlas Engineer LLC -;;;; SPDX-License-Identifier: BSD-3-Clause - -;;; Commentary: -;; -;; GNU Guix development package. -;; -;; To install: -;; -;; guix package --install-from-file=path/to/build-scripts/nyxt.scm -;; -;; To build a local executable: -;; -;; guix shell -D -f build-scripts/nyxt.scm -- make all NYXT_SUBMODULES=false -;; -;; To start the REPL: -;; -;; guix shell -D -f build-scripts/nyxt.scm -- sbcl -;; -;; See documents/README.org on how to setup the development environment. -;; -;;; Code: - -(use-modules (guix packages) - (guix gexp) - (gnu packages gstreamer) - (gnu packages web-browsers) - (gnu packages glib) - (gnu packages gtk) - (gnu packages webkit) - (gnu packages gnome) - (gnu packages pkg-config) - (gnu packages lisp) - (gnu packages lisp-xyz) - (gnu packages lisp-check)) - -(package - (inherit nyxt) - (version "dev") - (source (local-file (dirname (dirname (current-filename))) #:recursive? #t)) - (native-inputs - (list sbcl - cl-lisp-unit2 - ;; Useful for development, not needed upstream. - ccl - cl-trivial-benchmark)) - ;; `cl-*' inputs instead of `sbcl-*', since it defines a development - ;; environment for any CL implementation. Upstream uses `sbcl-*' to define - ;; the Nyxt program. - (inputs (list cl-alexandria - cl-base64 - cl-bordeaux-threads - cl-calispel - cl-cffi-gtk ; WebKitGTK - cl-closer-mop - cl-clss - cl-cluffer - cl-colors2 - cl-containers - cl-custom-hash-table - cl-dexador - cl-dissect - cl-enchant - cl-flexi-streams - cl-gobject-introspection ; WebKitGTK - cl-gopher - cl-history-tree - cl-iolib - cl-json - cl-lass - cl-local-time - cl-log4cl - cl-lparallel - cl-moptilities - cl-nclasses - cl-ndebug - cl-nfiles - cl-nhooks - cl-njson - cl-nkeymaps - cl-nsymbols - cl-parenscript - cl-phos - cl-plump - cl-ppcre - cl-prevalence - cl-prompter - cl-py-configparser - cl-qrencode - cl-quri - cl-serapeum - cl-slime-swank - cl-slynk - cl-spinneret - cl-sqlite - cl-str - cl-tld - cl-trivia - cl-trivial-clipboard - cl-trivial-features - cl-trivial-package-local-nicknames - cl-trivial-types - cl-unix-opts - cl-webkit ; WebKitGTK - glib-networking - gobject-introspection - gsettings-desktop-schemas - gst-libav - gst-plugins-bad - gst-plugins-base - gst-plugins-good - gst-plugins-ugly - gtk+ ; For the main loop - pkg-config - webkitgtk-for-gtk3 ; Required when we use its typelib - ))) diff --git a/guix.scm b/guix.scm new file mode 100644 index 000000000..915edf15b --- /dev/null +++ b/guix.scm @@ -0,0 +1,141 @@ +;;;; SPDX-FileCopyrightText: Atlas Engineer LLC +;;;; SPDX-License-Identifier: BSD-3-Clause + +;;; Commentary: +;; +;; GNU Guix development package. +;; +;; To install: +;; +;; guix package -f guix.scm +;; +;; To build: +;; +;; guix build -f guix.scm +;; +;; To start the REPL: +;; +;; guix shell -D -f guix.scm -- bash -c 'env LD_LIBRARY_PATH="$GUIX_ENVIRONMENT/lib" sbcl' +;; +;; See documents/README.org on how to setup the development environment. +;; +;;; Code: + +(use-modules (guix build-system gnu) + (guix gexp) + (guix packages) + (gnu packages c) + (gnu packages glib) + (gnu packages gnome) + (gnu packages gstreamer) + (gnu packages gtk) + (gnu packages lisp) + (gnu packages pkg-config) + (gnu packages sqlite) + (gnu packages tls) + (gnu packages webkit) + ((guix licenses) #:prefix license:)) + +(package + (name "nyxt") + (version "dev") + (source (local-file (dirname (current-filename)) #:recursive? #t)) + (build-system gnu-build-system) + (arguments + `(#:make-flags (list "nyxt" + (string-append "DESTDIR=" (assoc-ref %outputs "out")) + "PREFIX=") + #:strip-binaries? #f ; Stripping breaks SBCL binaries. + #:phases + (modify-phases %standard-phases + (delete 'configure) + (add-after 'unpack 'fix-so-paths + (lambda* (#:key inputs #:allow-other-keys) + (substitute* "_build/cl-plus-ssl/src/reload.lisp" + (("libssl.so" all) + (string-append (assoc-ref inputs "openssl") "/lib/" all)) + (("libcrypto.so" all) + (string-append (assoc-ref inputs "openssl") "/lib/" all))) + (substitute* "_build/iolib/src/syscalls/ffi-functions-unix.lisp" + (("\\(:default \"libfixposix\"\\)") + (string-append "(:default \"" + (assoc-ref inputs "libfixposix") + "/lib/libfixposix\")"))) + (substitute* "_build/cl-sqlite/sqlite-ffi.lisp" + (("libsqlite3" all) + (string-append (assoc-ref inputs "sqlite") "/lib/" all))) + (substitute* "_build/cl-gobject-introspection/src/init.lisp" + (("libgobject-2\\.0\\.so") + (search-input-file inputs "/lib/libgobject-2.0.so")) + (("libgirepository-1\\.0\\.so") + (search-input-file inputs "/lib/libgirepository-1.0.so"))) + (substitute* "_build/cl-webkit/webkit2/webkit2.init.lisp" + (("libwebkit2gtk" all) + (string-append (assoc-ref inputs "webkitgtk-for-gtk3") "/lib/" all))) + (substitute* "_build/cl-cffi-gtk/glib/glib.init.lisp" + (("libglib-[0-9.]*\\.so" all) + (search-input-file inputs (string-append "/lib/" all))) + (("libgthread-[0-9.]*\\.so" all) + (search-input-file inputs (string-append "/lib/" all)))) + (substitute* "_build/cl-cffi-gtk/gobject/gobject.init.lisp" + (("libgobject-[0-9.]*\\.so" all) + (search-input-file inputs (string-append "/lib/" all)))) + (substitute* "_build/cl-cffi-gtk/gio/gio.init.lisp" + (("libgio-[0-9.]*\\.so" all) + (search-input-file inputs (string-append "/lib/" all)))) + (substitute* "_build/cl-cffi-gtk/cairo/cairo.init.lisp" + (("libcairo\\.so" all) + (search-input-file inputs (string-append "/lib/" all)))) + (substitute* "_build/cl-cffi-gtk/pango/pango.init.lisp" + (("libpango-[0-9.]*\\.so" all) + (search-input-file inputs (string-append "/lib/" all))) + (("libpangocairo-[0-9.]*\\.so" all) + (search-input-file inputs (string-append "/lib/" all)))) + (substitute* "_build/cl-cffi-gtk/gdk-pixbuf/gdk-pixbuf.init.lisp" + (("libgdk_pixbuf-[0-9.]*\\.so" all) + (search-input-file inputs (string-append "/lib/" all)))) + (substitute* "_build/cl-cffi-gtk/gdk/gdk.init.lisp" + (("libgdk-[0-9]\\.so" all) + (search-input-file inputs (string-append "/lib/" all)))) + (substitute* "_build/cl-cffi-gtk/gdk/gdk.package.lisp" + (("libgtk-[0-9]\\.so" all) + (search-input-file inputs (string-append "/lib/" all)))))) + (add-before 'build 'fix-common-lisp-cache-folder + (lambda _ (setenv "HOME" "/tmp"))) + (add-before 'check 'configure-tests + (lambda _ (setenv "NASDF_TESTS_NO_NETWORK" "1"))) + (add-after 'install 'wrap-program + (lambda* (#:key inputs outputs #:allow-other-keys) + (let ((gsettings (assoc-ref inputs "gsettings-desktop-schemas"))) + (wrap-program (string-append (assoc-ref outputs "out") "/bin/nyxt") + `("GIO_EXTRA_MODULES" prefix + (,(string-append (assoc-ref inputs "glib-networking") + "/lib/gio/modules"))) + `("GI_TYPELIB_PATH" prefix (,(getenv "GI_TYPELIB_PATH"))) + `("LD_LIBRARY_PATH" ":" prefix (,(string-append gsettings "/lib"))) + `("XDG_DATA_DIRS" ":" prefix (,(string-append gsettings "/share")))))))))) + (native-inputs (list sbcl)) + (inputs (list cairo + gdk-pixbuf + glib + glib-networking + gobject-introspection + gsettings-desktop-schemas + gst-libav + gst-plugins-bad + gst-plugins-base + gst-plugins-good + gst-plugins-ugly + gtk+ + libfixposix + openssl + pango + pkg-config + sqlite + webkitgtk-for-gtk3)) + (synopsis "Extensible web-browser in Common Lisp") + (home-page "https://nyxt-browser.com/") + (description "Nyxt is a keyboard-oriented, extensible web-browser designed +for power users. The application has familiar Emacs and VI key-bindings and +is fully configurable and extensible in Common Lisp.") + (license license:bsd-3)) -- cgit v1.2.3-70-g09d2