From 10cdee0326e9e8a5bbfe1d8312a73d58f023fb5f Mon Sep 17 00:00:00 2001 From: Christophe Rhodes Date: Tue, 7 Mar 2006 12:04:24 +0000 Subject: [PATCH] 0.9.10.20: Move the stub definitions for contrib-type stuff into the main runtime ... and don't build unix-dsos in contribs any more; ... should make binary distribution easier. --- NEWS | 8 ++- contrib/sb-bsd-sockets/alien/get-h-errno.c | 6 --- contrib/sb-bsd-sockets/alien/undefs.c | 9 ---- contrib/sb-bsd-sockets/sb-bsd-sockets.asd | 70 +------------------------ contrib/sb-posix/alien/stat-macros.c | 61 ---------------------- contrib/sb-posix/alien/waitpid-macros.c | 29 ----------- contrib/sb-posix/sb-posix.asd | 75 +-------------------------- src/runtime/wrap.c | 76 +++++++++++++++++++++++++++- version.lisp-expr | 2 +- 9 files changed, 84 insertions(+), 252 deletions(-) delete mode 100755 contrib/sb-bsd-sockets/alien/get-h-errno.c delete mode 100644 contrib/sb-bsd-sockets/alien/undefs.c delete mode 100644 contrib/sb-posix/alien/stat-macros.c delete mode 100644 contrib/sb-posix/alien/waitpid-macros.c diff --git a/NEWS b/NEWS index 8caf4d8..69c4092 100644 --- a/NEWS +++ b/NEWS @@ -1,9 +1,13 @@ ;;;; -*- coding: utf-8; -*- changes in sbcl-0.9.11 relative to sbcl-0.9.10: - * new port: SBCL now works on x86/Darwin, including MacOS X 10.4.5 - on Intel. + * new platform: experimental support for SBCL x86/Darwin, including + MacOS X 10.4.5 on Intel. * new feature: Unicode character names are now known to the system (through CHAR-NAME and NAME-CHAR). + * minor incompatible change: the contrib modules SB-POSIX and + SB-BSD-SOCKETS no longer depend on stub C libraries; the intent of + this change is to make it easier to distribute + location-independent binaries. * bug fix: as implied by AMOP, standardized classes no longer have slots named by external symbols of public packages. (reported by Pascal Costanza) diff --git a/contrib/sb-bsd-sockets/alien/get-h-errno.c b/contrib/sb-bsd-sockets/alien/get-h-errno.c deleted file mode 100755 index a1d22a6..0000000 --- a/contrib/sb-bsd-sockets/alien/get-h-errno.c +++ /dev/null @@ -1,6 +0,0 @@ -#include - -int get_h_errno() -{ - return h_errno; -} diff --git a/contrib/sb-bsd-sockets/alien/undefs.c b/contrib/sb-bsd-sockets/alien/undefs.c deleted file mode 100644 index fca6cde..0000000 --- a/contrib/sb-bsd-sockets/alien/undefs.c +++ /dev/null @@ -1,9 +0,0 @@ -/* create a .o file with undefined references to all the C stuff we need - * that cmucl hasn't already fouind for us. Not needed on Linux/i386 - * because it has dynamic loading anyway - */ - -void likewecare() { - getprotobyname(); -} - diff --git a/contrib/sb-bsd-sockets/sb-bsd-sockets.asd b/contrib/sb-bsd-sockets/sb-bsd-sockets.asd index 267cbc3..7da9c86 100644 --- a/contrib/sb-bsd-sockets/sb-bsd-sockets.asd +++ b/contrib/sb-bsd-sockets/sb-bsd-sockets.asd @@ -4,71 +4,6 @@ (defpackage #:sb-bsd-sockets-system (:use #:asdf #:sb-grovel #:cl)) (in-package #:sb-bsd-sockets-system) -;;; we also have a shared library with some .o files in it - -(defclass unix-dso (module) ()) -(defun unix-name (pathname) - (namestring - (typecase pathname - (logical-pathname (translate-logical-pathname pathname)) - (t pathname)))) - -(defmethod asdf::input-files ((operation compile-op) (dso unix-dso)) - (mapcar #'component-pathname (module-components dso))) - -(defmethod output-files ((operation compile-op) (dso unix-dso)) - (let ((dir (component-pathname dso))) - (list - (make-pathname :type "so" - :name (car (last (pathname-directory dir))) - :directory (butlast (pathname-directory dir)) - :defaults dir)))) - - -(defmethod perform :after ((operation compile-op) (dso unix-dso)) - (let ((dso-name (unix-name (car (output-files operation dso))))) - (unless (zerop - (run-shell-command - "gcc ~A -o ~S ~{~S ~}" - (concatenate 'string - (sb-ext:posix-getenv "EXTRA_LDFLAGS") - " " - #+sunos "-shared -lresolv -lsocket -lnsl" - #+darwin "-bundle" - #-(or darwin sunos) "-shared") - dso-name - (mapcar #'unix-name - (mapcan (lambda (c) - (output-files operation c)) - (module-components dso))))) - (error 'operation-error :operation operation :component dso)))) - -;;; if this goes into the standard asdf, it could reasonably be extended -;;; to allow cflags to be set somehow -(defmethod output-files ((op compile-op) (c c-source-file)) - (list - (make-pathname :type "o" :defaults - (component-pathname c)))) -(defmethod perform ((op compile-op) (c c-source-file)) - (unless - (= 0 (run-shell-command "gcc ~A -o ~S -c ~S" - (concatenate 'string - (sb-ext:posix-getenv "EXTRA_CFLAGS") - " " - "-fPIC") - (unix-name (car (output-files op c))) - (unix-name (component-pathname c)))) - (error 'operation-error :operation op :component c))) - -(defmethod perform ((operation load-op) (c c-source-file)) - t) - -(defmethod perform ((o load-op) (c unix-dso)) - (let ((co (make-instance 'compile-op))) - (let ((filename (car (output-files co c)))) - #+cmu (ext:load-foreign filename) - #+sbcl (sb-alien:load-shared-object filename)))) - (defsystem sb-bsd-sockets :version "0.58" :depends-on (sb-grovel) @@ -76,9 +11,6 @@ #+sb-building-contrib "SYS:CONTRIB;SB-BSD-SOCKETS;" :components ((:file "defpackage") (:file "split" :depends-on ("defpackage")) - (:unix-dso "alien" - :components ((:c-source-file "undefs") - (:c-source-file "get-h-errno"))) (:file "malloc" :depends-on ("defpackage")) (sb-grovel:grovel-constants-file "constants" @@ -90,7 +22,7 @@ (:file "sockopt" :depends-on ("sockets")) (:file "inet" :depends-on ("sockets" "split" "constants" )) (:file "local" :depends-on ("sockets" "split" "constants" )) - (:file "name-service" :depends-on ("sockets" "constants" "alien")) + (:file "name-service" :depends-on ("sockets" "constants")) (:file "misc" :depends-on ("sockets" "constants")) (:static-file "NEWS") diff --git a/contrib/sb-posix/alien/stat-macros.c b/contrib/sb-posix/alien/stat-macros.c deleted file mode 100644 index 80e94cd..0000000 --- a/contrib/sb-posix/alien/stat-macros.c +++ /dev/null @@ -1,61 +0,0 @@ -/* - * stat-macros.c - * - * Inspired mostly by section 4.3 and 4.21 of APUE - * - */ - -#include -#include -#include - -int s_isreg(mode_t mode) -{ - return S_ISREG(mode); -} - - -int s_isdir(mode_t mode) -{ - return S_ISDIR(mode); -} - - -int s_ischr(mode_t mode) -{ - return S_ISCHR(mode); -} - - -int s_isblk(mode_t mode) -{ - return S_ISBLK(mode); -} - - -int s_isfifo(mode_t mode) -{ - return S_ISFIFO(mode); -} - - -int s_islnk(mode_t mode) -{ -#ifdef S_ISLNK - return S_ISLNK(mode); -#else - return ((mode & S_IFMT) == S_IFLNK); -#endif -} - - -int s_issock(mode_t mode) -{ -#ifdef S_ISSOCK - return S_ISSOCK(mode); -#else - return ((mode & S_IFMT) == S_IFSOCK); -#endif -} - - diff --git a/contrib/sb-posix/alien/waitpid-macros.c b/contrib/sb-posix/alien/waitpid-macros.c deleted file mode 100644 index 10eee01..0000000 --- a/contrib/sb-posix/alien/waitpid-macros.c +++ /dev/null @@ -1,29 +0,0 @@ -#include -#include - -int wifexited(int status) { - return WIFEXITED(status); -} - -int wexitstatus(int status) { - return WEXITSTATUS(status); -} - -int wifsignaled(int status) { - return WIFSIGNALED(status); -} - -int wtermsig(int status) { - return WTERMSIG(status); -} - -int wifstopped(int status) { - return WIFSTOPPED(status); -} - -int wstopsig(int status) { - return WSTOPSIG(status); -} - -/* FIXME: POSIX also defines WIFCONTINUED, but that appears not to - exist on at least Linux... */ diff --git a/contrib/sb-posix/sb-posix.asd b/contrib/sb-posix/sb-posix.asd index b3fd54d..3fe72a0 100644 --- a/contrib/sb-posix/sb-posix.asd +++ b/contrib/sb-posix/sb-posix.asd @@ -4,90 +4,17 @@ (defpackage #:sb-posix-system (:use #:asdf #:cl #:sb-grovel)) (in-package #:sb-posix-system) - -;;; we also have a shared library with some .o files in it -;;; -;;; FIXME: we share this with SB-BSD-SOCKETS. This should either (a) -;;; be part of ASDF itself, or (b) be in a shared file that we can -;;; LOAD at this point. -(defclass unix-dso (module) ()) -(defun unix-name (pathname) - (namestring - (typecase pathname - (logical-pathname (translate-logical-pathname pathname)) - (t pathname)))) - -(defmethod asdf::input-files ((operation compile-op) (dso unix-dso)) - (mapcar #'component-pathname (module-components dso))) - -(defmethod output-files ((operation compile-op) (dso unix-dso)) - (let ((dir (component-pathname dso))) - (list - (make-pathname :type "so" - :name (car (last (pathname-directory dir))) - :directory (butlast (pathname-directory dir)) - :defaults dir)))) - - -(defmethod perform :after ((operation compile-op) (dso unix-dso)) - (let ((dso-name (unix-name (car (output-files operation dso))))) - (unless (zerop - (run-shell-command - "gcc ~A -o ~S ~{~S ~}" - (concatenate 'string - (sb-ext:posix-getenv "EXTRA_LDFLAGS") - " " - #+sunos "-shared -lresolv -lsocket -lnsl" - #+darwin "-bundle" - #-(or darwin sunos) "-shared") - dso-name - (mapcar #'unix-name - (mapcan (lambda (c) - (output-files operation c)) - (module-components dso))))) - (error 'operation-error :operation operation :component dso)))) - -;;; if this goes into the standard asdf, it could reasonably be extended -;;; to allow cflags to be set somehow -(defmethod output-files ((op compile-op) (c c-source-file)) - (list - (make-pathname :type "o" :defaults - (component-pathname c)))) -(defmethod perform ((op compile-op) (c c-source-file)) - (unless - (= 0 (run-shell-command "gcc ~A -o ~S -c ~S" - (concatenate - 'string - (sb-ext:posix-getenv "EXTRA_CFLAGS") - " " - "-fPIC") - (unix-name (car (output-files op c))) - (unix-name (component-pathname c)))) - (error 'operation-error :operation op :component c))) - -(defmethod perform ((operation load-op) (c c-source-file)) - t) - -(defmethod perform ((o load-op) (c unix-dso)) - (let ((co (make-instance 'compile-op))) - (let ((filename (car (output-files co c)))) - #+cmu (ext:load-foreign filename) - #+sbcl (sb-alien:load-shared-object filename)))) - (defsystem sb-posix :depends-on (sb-grovel) #+sb-building-contrib :pathname #+sb-building-contrib "SYS:CONTRIB;SB-POSIX;" :components ((:file "defpackage") (:file "designator" :depends-on ("defpackage")) - (:unix-dso "alien" - :components ((:c-source-file "stat-macros") - (:c-source-file "waitpid-macros"))) (:file "macros" :depends-on ("designator")) (sb-grovel:grovel-constants-file "constants" :package :sb-posix :depends-on ("defpackage")) - (:file "interface" :depends-on ("constants" "macros" "designator" "alien")))) + (:file "interface" :depends-on ("constants" "macros" "designator")))) (defsystem sb-posix-tests :depends-on (sb-rt) diff --git a/src/runtime/wrap.c b/src/runtime/wrap.c index 29a79e1..153ebd5 100644 --- a/src/runtime/wrap.c +++ b/src/runtime/wrap.c @@ -1,6 +1,6 @@ /* * wrappers around low-level operations to provide a simpler interface - * to the operations that Lisp needs + * to the operations that Lisp (and some contributed modules) needs. * * The functions in this file are typically called directly from Lisp. * Thus, when their signature changes, they don't need updates in a .h @@ -34,6 +34,8 @@ #include #ifndef LISP_FEATURE_WIN32 #include +#include +#include #endif #include @@ -420,3 +422,75 @@ int gettimeofday(long *timeval, long *timezone) return 0; } #endif + + +/* We will need to define these things or their equivalents for Win32 + eventually, but for now let's get it working for everyone else. */ +#ifndef LISP_FEATURE_WIN32 +/* From SB-BSD-SOCKETS, to get h_errno */ +int get_h_errno() +{ + return h_errno; +} + +/* From SB-POSIX, wait-macros */ +int wifexited(int status) { + return WIFEXITED(status); +} +int wexitstatus(int status) { + return WEXITSTATUS(status); +} +int wifsignaled(int status) { + return WIFSIGNALED(status); +} +int wtermsig(int status) { + return WTERMSIG(status); +} +int wifstopped(int status) { + return WIFSTOPPED(status); +} +int wstopsig(int status) { + return WSTOPSIG(status); +} + +/* FIXME: POSIX also defines WIFCONTINUED, but that appears not to + exist on at least Linux... */ + +/* From SB-POSIX, stat-macros */ +int s_isreg(mode_t mode) +{ + return S_ISREG(mode); +} +int s_isdir(mode_t mode) +{ + return S_ISDIR(mode); +} +int s_ischr(mode_t mode) +{ + return S_ISCHR(mode); +} +int s_isblk(mode_t mode) +{ + return S_ISBLK(mode); +} +int s_isfifo(mode_t mode) +{ + return S_ISFIFO(mode); +} +int s_islnk(mode_t mode) +{ +#ifdef S_ISLNK + return S_ISLNK(mode); +#else + return ((mode & S_IFMT) == S_IFLNK); +#endif +} +int s_issock(mode_t mode) +{ +#ifdef S_ISSOCK + return S_ISSOCK(mode); +#else + return ((mode & S_IFMT) == S_IFSOCK); +#endif +} +#endif /* !LISP_FEATURE_WIN32 */ diff --git a/version.lisp-expr b/version.lisp-expr index 5b66969..8991c75 100644 --- a/version.lisp-expr +++ b/version.lisp-expr @@ -17,4 +17,4 @@ ;;; checkins which aren't released. (And occasionally for internal ;;; versions, especially for internal versions off the main CVS ;;; branch, it gets hairier, e.g. "0.pre7.14.flaky4.13".) -"0.9.10.19" +"0.9.10.20" -- 1.7.10.4