From 3fa29d2b92204d33ba286f81c868f7764da1d78d Mon Sep 17 00:00:00 2001 From: Ivy Foster Date: Thu, 27 Nov 2008 03:17:53 -0600 Subject: [PATCH] Miscellaneous fixes - Makefile.in: Fixed install-info error on `make uninstall'. - Makefile.in: Added optional `destdir' option for `make install'. This is useful for packaging. - module.lisp: contrib/ directory no longer uses hardcoded name/path, allowing greater flexibility. Use `contrib-dir-set' to change where stumpwm looks for your modules. --- Makefile.in | 18 ++++++++++-------- module.lisp | 36 +++++++++++++++++++++++------------- 2 files changed, 33 insertions(+), 21 deletions(-) diff --git a/Makefile.in b/Makefile.in index 06cfa72..181ada0 100644 --- a/Makefile.in +++ b/Makefile.in @@ -57,13 +57,15 @@ clean: rm -f *.fasl *.fas *.lib *.*fsl stumpwm stumpwm.texi stumpwm.info install: stumpwm.info stumpwm - test -z "$(bindir)" || mkdir -p "$(bindir)" - cp stumpwm $(bindir) - test -z "$(infodir)" || mkdir -p "$(infodir)" - cp stumpwm.info "$(infodir)" - install-info --info-dir="$(infodir)" "$(infodir)/stumpwm.info" + test -z "$(destdir)$(bindir)" || mkdir -p "$(destdir)$(bindir)" + cp stumpwm "$(destdir)$(bindir)" + test -z "$(destdir)$(infodir)" || mkdir -p "$(destdir)$(infodir)" + cp stumpwm.info "$(destdir)$(infodir)" + install-info --info-dir="$(destdir)$(infodir)" "$(destdir)$(infodir)/stumpwm.info" uninstall: - rm "$(bindir)/stumpwm" - rm "$(infodir)/stumpwm.info" - install-info --info-dir="$(infodir)" --remove "$(infodir)/stumpwm.info" + rm "$(destdir)$(bindir)/stumpwm" + install-info --info-dir="$(destdir)$(infodir)" --remove "$(destdir)$(infodir)/stumpwm.info" + rm "$(destdir)$(infodir)/stumpwm.info" + +# End of file diff --git a/module.lisp b/module.lisp index 9357737..011cbdf 100644 --- a/module.lisp +++ b/module.lisp @@ -1,4 +1,4 @@ -;; Copyright (C) 2008 Julian Stecklina, Shawn Betts +;; Copyright (C) 2008 Julian Stecklina, Shawn Betts, Ivy Foster ;; ;; This file is part of stumpwm. ;; @@ -19,9 +19,7 @@ ;; Commentary: ;; -;; FIXME: What happens when stumpwm is installed somewhere? The -;; contrib modules should probably be installed somewhere and this -;; code updated to load the modules from the correct place. +;; Use `contrib-dir-set' to set the location stumpwm searches for modules. ;; Code: @@ -29,6 +27,8 @@ (export '(load-module list-modules + *contrib-dir* + contrib-dir-set find-module)) ;; Handy functions from the unClog blog @@ -59,6 +59,17 @@ :directory directory) (asdf-system-source-directory system)))) +(defvar *contrib-dir* (system-relative-pathname + (asdf:find-system :stumpwm) + (make-pathname :directory '(:relative "contrib"))) + "The location of the contrib modules on your system.") + +(defcommand contrib-dir-set (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))) + (define-stumpwm-type :module (input prompt) (or (argument-pop-rest input) (completing-read (current-screen) prompt (list-modules)))) @@ -66,17 +77,14 @@ (defun list-modules () "Return a list of the available modules." (mapcar 'pathname-name - (directory (system-relative-pathname - (asdf:find-system :stumpwm) - (make-pathname :directory '(:relative "contrib") - :name :wild - :type "lisp"))))) + (directory (make-pathname :directory *contrib-dir* + :name :wild + :type "lisp")))) (defun find-module (name) - (system-relative-pathname (asdf:find-system :stumpwm) - (make-pathname :directory '(:relative "contrib") - :name name - :type "lisp"))) + (make-pathname :directory *contrib-dir* + :name name + :type "lisp")) (defcommand load-module (name) ((:module "Load Module: ")) "Loads the contributed module with the given NAME." @@ -86,3 +94,5 @@ (if module (load module) (error "No such module: ~a" name)))) + +;; End of file -- 1.6.0.4