diff -urN cl-ncurses_0.1.1.orig/Makefile cl-ncurses_0.1.1/Makefile --- cl-ncurses_0.1.1.orig/Makefile 2004-03-07 17:24:47.000000000 -0600 +++ cl-ncurses_0.1.1/Makefile 2004-05-09 14:04:58.806607224 -0500 @@ -1,8 +1,16 @@ NAME=cl-ncurses SOURCES=ncurses.asd *.lisp glue.c README LICENSE Makefile -all: glue.o +CFLAGS=-fPIC -DPIC +LDFLAGS=-shared -L/lib -lncurses +glue.so: glue.o + $(LD) $(LDFLAGS) $^ -o $@ + +.PHONY: dist clean + +clean: + -rm -f glue.so glue.o *.fasl *.x86f *~ dist: mkdir $(NAME) cp $(SOURCES) $(NAME)/ diff -urN cl-ncurses_0.1.1.orig/cl-ncurses.asd cl-ncurses_0.1.1/cl-ncurses.asd --- cl-ncurses_0.1.1.orig/cl-ncurses.asd 2004-03-09 12:49:46.000000000 -0600 +++ cl-ncurses_0.1.1/cl-ncurses.asd 2004-05-09 13:56:44.541746904 -0500 @@ -25,30 +25,6 @@ (in-package :asdf) -(defvar *gcc* "/usr/bin/gcc") - -(defvar *gcc-options* '(#-darwin "-shared" - #+darwin "-bundle" - "-fPIC")) - -(defmethod output-files ((o compile-op) (c c-source-file)) - (list (make-pathname :name (component-name c) - :type "so" - :defaults (component-pathname c)))) - -(defmethod perform ((o load-op) (c c-source-file)) - (let ((loader (intern "LOAD-FOREIGN-LIBRARY" :uffi))) - (dolist (f (input-files o c)) - (funcall loader f)))) - -(defmethod perform ((o compile-op) (c c-source-file)) - (unless (zerop (run-shell-command "~A ~A ~{~A ~}-o ~A" - *gcc* - (namestring (component-pathname c)) - *gcc-options* - (namestring (car (output-files o c))))) - (error 'operation-error :component c :operation o))) - (defsystem :cl-ncurses :version "0.1.1" :depends-on (:uffi) @@ -77,7 +53,8 @@ (:file "getcchar" :depends-on ("package")) (:file "getch" :depends-on ("package")) (:file "getstr" :depends-on ("glue")) - (:c-source-file "glue") + (:file "glue-loader") + (:file "glue" :depends-on ("glue-loader")) (:file "getyx" :depends-on ("package" "glue")) (:file "in_wch" :depends-on ("package")) (:file "in_wchstr" :depends-on ("package")) diff -urN cl-ncurses_0.1.1.orig/glue-loader.lisp cl-ncurses_0.1.1/glue-loader.lisp --- cl-ncurses_0.1.1.orig/glue-loader.lisp 1969-12-31 18:00:00.000000000 -0600 +++ cl-ncurses_0.1.1/glue-loader.lisp 2004-05-09 13:57:48.397039424 -0500 @@ -0,0 +1,45 @@ +;;;; -*- mode: lisp; syntax: common-lisp; indent-tabs-mode: nil; base: 10; package: CL-NCURSES -*- + +;;;; Author: Matthew Kennedy +;;;; +;;;; This code is adapted from clsql-uffi-loader.lisp which is part of +;;;; CLSQL. clsql-uffi-loader.lisp comes with the following +;;;; copyright: +;;;; +;;;; This file, part of CLSQL, is Copyright (c) 2002 by Kevin M. Rosenberg +;;;; +;;;; CLSQL users are granted the rights to distribute and use this +;;;; software as governed by the terms of the Lisp Lesser GNU +;;;; Public License (http://opensource.franz.com/preamble.html), +;;;; also known as the LLGPL. +;;;; + +(in-package #:cl-ncurses) + +(defparameter *uffi-library-path* + `(,(make-pathname :directory (pathname-directory *load-truename*)) + "/usr/lib/cl-ncurses/")) + +(defparameter *uffi-library-filename* nil) + +(defvar *uffi-supporting-libraries* '("c")) + +(defvar *uffi-library-loaded* nil + "T if foreign library was able to be loaded successfully") + +(defun load-uffi-foreign-library (&optional force) + (when force (setf *uffi-library-loaded* nil)) + (unless *uffi-library-loaded* + (setf *uffi-library-filename* (find-foreign-library "glue" *uffi-library-path*)) + (unless (probe-file *uffi-library-filename*) + (error "Unable to find glue.so")) + (if (load-foreign-library *uffi-library-filename* + :module "cl-ncurses" + :supporting-libraries + *uffi-supporting-libraries*) + (setq *uffi-library-loaded* t) + (error "Unable to load helper library ~A" *uffi-library-filename*)))) + +(load-uffi-foreign-library) + +;; glue-loader.lisp ends here diff -urN cl-ncurses_0.1.1.orig/package.lisp cl-ncurses_0.1.1/package.lisp --- cl-ncurses_0.1.1.orig/package.lisp 2004-03-09 12:50:30.000000000 -0600 +++ cl-ncurses_0.1.1/package.lisp 2004-05-09 14:06:41.291027224 -0500 @@ -29,7 +29,7 @@ (in-package :cl-ncurses) -(defvar *ncurses-search-paths* '("/usr/local/lib/" "/usr/lib/" "/lib/") +(defvar *ncurses-search-paths* '("/lib/") "The paths where to search the ncurses shared library") (defparameter *ncurses-path*