X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=contrib%2Fsb-bsd-sockets%2Fsb-bsd-sockets.asd;h=fd251d6ee5710cda4e53f334208b474ab15552cc;hb=99501797db3d77ff2a7f32071d7fab0db3fdacae;hp=e2ec1081d06cfc23bb322a065f293eb1916b231e;hpb=bb7c5beef3a2c45f0ff99f8038409dc4787aa295;p=sbcl.git diff --git a/contrib/sb-bsd-sockets/sb-bsd-sockets.asd b/contrib/sb-bsd-sockets/sb-bsd-sockets.asd index e2ec108..fd251d6 100644 --- a/contrib/sb-bsd-sockets/sb-bsd-sockets.asd +++ b/contrib/sb-bsd-sockets/sb-bsd-sockets.asd @@ -1,41 +1,9 @@ ;;; -*- Lisp -*- - -(defpackage #:sb-bsd-sockets-system (:use #:asdf #:cl)) +(eval-when (:compile-toplevel :load-toplevel :execute) + (require :sb-grovel)) +(defpackage #:sb-bsd-sockets-system (:use #:asdf #:sb-grovel #:cl)) (in-package #:sb-bsd-sockets-system) -;;; constants.lisp requires special treatment - -(defclass constants-file (cl-source-file) ()) - -(defmethod perform ((op compile-op) (component constants-file)) - ;; we want to generate all our temporary files in the fasl directory - ;; because that's where we have write permission. Can't use /tmp; - ;; it's insecure (these files will later be owned by root) - (let* ((output-file (car (output-files op component))) - (filename (component-pathname component)) - (real-output-file - (if (typep output-file 'logical-pathname) - (translate-logical-pathname output-file) - (pathname output-file))) - (tmp-c-source (merge-pathnames #p"foo.c" real-output-file)) - (tmp-a-dot-out (merge-pathnames #p"a.out" real-output-file)) - (tmp-constants (merge-pathnames #p"constants.lisp-temp" - real-output-file))) - (princ (list filename output-file real-output-file - tmp-c-source tmp-a-dot-out tmp-constants)) - (terpri) - (funcall (intern "C-CONSTANTS-EXTRACT" - (find-package "SB-BSD-SOCKETS-SYSTEM")) - filename tmp-c-source :sb-bsd-sockets-internal) - (and - (= (run-shell-command "gcc -o ~S ~S" (namestring tmp-a-dot-out) - (namestring tmp-c-source)) 0) - (= (run-shell-command "~A >~A" - (namestring tmp-a-dot-out) - (namestring tmp-constants)) 0) - (compile-file tmp-constants :output-file output-file)))) - - ;;; we also have a shared library with some .o files in it (defclass unix-dso (module) ()) @@ -61,8 +29,14 @@ (let ((dso-name (unix-name (car (output-files operation dso))))) (unless (zerop (run-shell-command - #-sunos "gcc -shared -o ~S ~{~S ~}" - #+sunos "gcc -shared -lresolv -lsocket -lnsl -o ~S ~{~S ~}" dso-name + "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)) @@ -77,7 +51,11 @@ (component-pathname c)))) (defmethod perform ((op compile-op) (c c-source-file)) (unless - (= 0 (run-shell-command "gcc -fPIC -o ~S -c ~S" + (= 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))) @@ -93,7 +71,10 @@ (defsystem sb-bsd-sockets :version "0.58" - :components ((:file "defpackage" :depends-on ("rt")) + :depends-on (sb-grovel) + #+sb-building-contrib :pathname + #+sb-building-contrib "SYS:CONTRIB;SB-BSD-SOCKETS;" + :components ((:file "defpackage") (:file "split" :depends-on ("defpackage")) (:file "array-data" :depends-on ("defpackage")) (:unix-dso "alien" @@ -101,10 +82,10 @@ (:c-source-file "get-h-errno"))) (:file "malloc" :depends-on ("defpackage")) (:file "foreign-glue" :depends-on ("defpackage" "malloc")) - (:constants-file "constants" - :pathname "constants.lisp" - :depends-on - ("def-to-lisp" "defpackage" "foreign-glue")) + (sb-grovel:grovel-constants-file + "constants" + :package :sockint + :depends-on ("def-to-lisp" "defpackage" "foreign-glue")) (:file "sockets" :depends-on ("constants" "array-data")) @@ -114,9 +95,7 @@ (:file "name-service" :depends-on ("sockets" "constants" "alien")) (:file "misc" :depends-on ("sockets" "constants")) - (:file "rt") (:file "def-to-lisp") - (:file "tests" :depends-on ("inet" "sockopt" "rt")) (:static-file "NEWS") ;; (:static-file "INSTALL") @@ -125,3 +104,17 @@ (:static-file "doc" :pathname "doc.lisp") (:static-file "TODO"))) +(defmethod perform :after ((o load-op) (c (eql (find-system :sb-bsd-sockets)))) + (provide 'sb-bsd-sockets)) + +(defmethod perform ((o test-op) (c (eql (find-system :sb-bsd-sockets)))) + (operate 'load-op 'sb-bsd-sockets-tests) + (operate 'test-op 'sb-bsd-sockets-tests)) + +(defsystem sb-bsd-sockets-tests + :depends-on (sb-rt sb-bsd-sockets sb-posix) + :components ((:file "tests"))) + +(defmethod perform ((o test-op) (c (eql (find-system :sb-bsd-sockets-tests)))) + (or (funcall (intern "DO-TESTS" (find-package "SB-RT"))) + (error "test-op failed")))