1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
|
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 <mkennedy@gentoo.org>
+;;;;
+;;;; 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*
|