;; -*- mode: common-lisp; -*- ;; WARNING: Changing the *print-case* may break some packages, e.g. Mito. ;; Also see https://www.cliki.net/Case%20sensitivity. ;; (setf *print-case* :downcase) ;;; The following lines added by ql:add-to-init-file: #-quicklisp (let ((quicklisp-init (merge-pathnames ".quicklisp/setup.lisp" (user-homedir-pathname)))) (when (probe-file quicklisp-init) (load quicklisp-init))) ;; Some OSes package Lisp compilers in a way that ASDF is not automatically loaded. (require "asdf") (defpackage ambrevar (:use :cl)) (in-package :ambrevar) (export '*guix-profiles-dir*) (defvar *guix-profiles-dir* "~/.guix-extra-profiles/" "Directory in which Guix profiles are stored. The actual profiles are in the subsubdirectories.") (export '*cffi-dirs*) (defvar *cffi-dirs* '("~/.guix-profile/lib" "~/common-lisp/cl-webengine/source") "Shared library directories to be used for CFFI.") (defun find-guix-library-dirs (profiles-dir) (mapcar (lambda (d) (format nil "~a~a/lib/" (namestring d) (first (last (pathname-directory d))))) (uiop:subdirectories profiles-dir))) (export 'set-cffi-library-dirs) (defun set-cffi-library-dirs (&optional (dirs (append *cffi-dirs* (find-guix-library-dirs *guix-profiles-dir*)))) "Call this to set `cffi:*foreign-library-directories*' to DIRS." (when (ignore-errors (asdf:load-system "cffi")) (setf (symbol-value (find-symbol (string '*foreign-library-directories*) (find-package 'cffi))) (union (symbol-value (find-symbol (string '*foreign-library-directories*) (find-package 'cffi))) ;; CFFI needs a trailing "/". (delete nil (mapcar #'uiop:ensure-directory-pathname dirs)) :test #'uiop:pathname-equal)))) ;; Set it by default. (set-cffi-library-dirs) (export 'exported-symbols) (declaim (ftype (function ((or symbol package))) exported-symbols)) (defun exported-symbols (package) "List exported symbols of PACKAGE." (let ((package (if (packagep package) package (find-package package))) (symbols)) (do-external-symbols (s package symbols) (when (eq (symbol-package s) package) (push s symbols))) symbols)) (export 'system-depends-on) (declaim (ftype (function (string)) system-depends-on)) (defun system-depends-on (system) "List SYSTEM dependencies, even if SYSTEM is an inferred system. From: https://gitlab.common-lisp.net/asdf/asdf/issues/10#note_5018." (let (depends) (labels ((iter (openlist) (if (null openlist) depends ;; Is this a subsystem of SYSTEM? (let ((find (search system (first openlist)))) (if (and find (zerop find)) (iter (append (asdf:system-depends-on (asdf:find-system (first openlist))) (rest openlist))) ;; If not, it's a direct dependency: collect it. (progn (pushnew (first openlist) depends :test 'equalp) (iter (rest openlist)))))))) (iter (list system))))) (in-package :cl-user) ;; Uncomment the following to increase the debug details. ;; It's often better to do this from the REPL. ;; (declaim (optimize (speed 0) (space 0) (debug 3))) ;; Uncomment to enable full type checks (should be the default). ;; (declaim (optimize (or (>= safety 2) (>= safety speed 1))))