Skip to content

Commit

Permalink
Made module system independent from ASDF.
Browse files Browse the repository at this point in the history
  • Loading branch information
blitz committed Mar 16, 2010
1 parent 6b555dc commit 0d65411
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 40 deletions.
6 changes: 6 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
AC_PREREQ(2.59)
AC_INIT(Stump Window Manager, 0.9.7-git, sabetts@gmail.com)

AC_SUBST(CONTRIB_DIR)
AC_SUBST(LISP_PROGRAM)
AC_SUBST(LISP)
AC_SUBST(PPCRE_PATH)
Expand All @@ -16,6 +17,10 @@ AC_ARG_WITH(ccl, [ --with-ccl=PATH specify location of ccl], CCL_PA
AC_ARG_WITH(ecl, [ --with-ecl=PATH specify location of ecl], ECL_PATH=$withval, ECL_PATH="")
AC_ARG_WITH(ppcre, [ --with-ppcre=PATH specify location of cl-ppcre], PPCRE_PATH=$withval, PPCRE_PATH="`pwd`/cl-ppcre")

AC_ARG_WITH(contrib-dir,
[ --with-contrib-dir=PATH specify location of contrib modules],
CONTRIB_DIR=$withval, CONTRIB_DIR="`pwd`/contrib")

if test -x "$SBCL_PATH"; then
SBCL=$SBCL_PATH
AC_MSG_CHECKING([for sbcl])
Expand Down Expand Up @@ -117,3 +122,4 @@ fi
AC_OUTPUT(Makefile)
AC_OUTPUT(make-image.lisp)
AC_OUTPUT(version.lisp)
AC_OUTPUT(module.lisp)
49 changes: 9 additions & 40 deletions module.lisp → module.lisp.in
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,6 @@

;; Code:

#+ ecl
(eval-when (load compile eval)
(require :asdf))

(in-package #:stumpwm)

(export '(load-module
Expand All @@ -35,44 +31,17 @@
set-contrib-dir
find-module))

;; Handy functions from the unClog blog
;; http://metabang.com/unclogit/?p=98

;; FIXME: These functions are part of the current version of asdf so
;; at some point we should remove them when there's no chance anyone
;; is running an older version.
(defun asdf-system-source-directory (system-name)
(make-pathname :name nil
:type nil
:defaults (asdf-system-source-file system-name)))

(defun asdf-system-source-file (system-name)
(let ((system (asdf:find-system system-name)))
(make-pathname
:type "asd"
:name (asdf:component-name system)
:defaults (asdf:component-relative-pathname system))))

(defun system-relative-pathname (system pathname &key name type)
(let ((directory (pathname-directory pathname)))
(when (eq (car directory) :absolute)
(setf (car directory) :relative))
(merge-pathnames
(make-pathname :name (or name (pathname-name pathname))
:type (or type (pathname-type pathname))
:directory directory)
(asdf-system-source-directory system))))
(flet ((string-as-directory (dir)
(unless (string= "/" (subseq dir (1- (length dir))))
(setf dir (concat dir "/")))
(pathname dir)))

(defvar *contrib-dir* (system-relative-pathname
(asdf:find-system :stumpwm)
(make-pathname :directory '(:relative "contrib")))
"The location of the contrib modules on your system.")
(defvar *contrib-dir* (string-as-directory "@CONTRIB_DIR@")
"The location of the contrib modules on your system.")

(defcommand set-contrib-dir (dir) ((:string "Directory: "))
"Sets the location of the contrib modules"
(unless (string= "/" (subseq dir (1- (length dir))))
(setf dir (concat dir "/")))
(setf *contrib-dir* (pathname dir)))
(defcommand set-contrib-dir (dir) ((:string "Directory: "))
"Sets the location of the contrib modules"
(setf *contrib-dir* (string-as-directory dir))))

(define-stumpwm-type :module (input prompt)
(or (argument-pop-rest input)
Expand Down

0 comments on commit 0d65411

Please sign in to comment.