[asdf-devel] new asdf does not like matlisp.asd
Mario S. Mommer
m_mommer at yahoo.com
Fri Apr 9 18:36:17 UTC 2010
Oh and the .asd:
;;; -*- Mode: lisp; Syntax: ansi-common-lisp; Base: 10 -*-
;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; Copyright (c) 2000 The Regents of the University of California.
;;; All rights reserved.
;;;
;;; Permission is hereby granted, without written agreement and without
;;; license or royalty fees, to use, copy, modify, and distribute this
;;; software and its documentation for any purpose, provided that the
;;; above copyright notice and the following two paragraphs appear in all
;;; copies of this software.
;;;
;;; IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY
;;; FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
;;; ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF
;;; THE UNIVERSITY OF CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF
;;; SUCH DAMAGE.
;;;
;;; THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
;;; INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
;;; MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE
;;; PROVIDED HEREUNDER IS ON AN "AS IS" BASIS, AND THE UNIVERSITY OF
;;; CALIFORNIA HAS NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES,
;;; ENHANCEMENTS, OR MODIFICATIONS.
;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; $Id: matlisp.lisp,v 1.21 2003/06/01 15:21:59 rtoy Exp $
;;;
;;; $Log: matlisp.lisp,v $
;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;(in-package "COMMON-LISP-USER")
(defpackage :matlisp.system
(:use :cl
:asdf))
(in-package :matlisp.system)
(defvar *fortran-compiler* "gfortran")
(defvar *c-compiler* "gcc")
(defvar *linker* "gfortran")
;; just warn on warnings. Some of the f2cl generated files cause problems
;; without this. See http://article.gmane.org/gmane.lisp.cclan.general/206
(setf asdf:*compile-file-failure-behaviour* :warn)
;;;BEGIN: code to do alien-files
(defclass unix-dso (module)
((dso-name :reader dso-name
:initarg :dso-name)))
(defun unix-name (pathname)
(namestring
(typecase pathname
(logical-pathname (translate-logical-pathname pathname))
(t pathname))))
;; FIXME: this needs to know about alien-modules
(defmethod asdf::input-files ((operation compile-op) (dso unix-dso))
(mapcar #'component-pathname (module-components dso)))
; (mapcar #'(lambda (x)
; (funcall #'asdf::input-files operation x))
; (module-components dso)))
(defmethod output-files ((operation compile-op) (dso unix-dso))
(let ((dir (component-pathname dso)))
(list
(make-pathname :type "so"
:name (dso-name dso) ;(car (last (pathname-directory dir)))
:directory (pathname-directory dir)
;; (butlast (pathname-directory dir))
:defaults dir))))
(defclass alien-module (module) ())
(defmethod output-files ((op compile-op) (m alien-module))
(mapcan (lambda (c)
(output-files op c))
(module-components m)))
(defmethod perform :after ((operation compile-op) (dso unix-dso))
(let ((dso-name (unix-name (car (output-files operation dso)))))
(unless (or (operation-done-p operation dso)
(zerop
(run-shell-command
"~A ~A -o ~S ~{~S ~} ~A"
*linker*
; (if (sb-ext:posix-getenv "LDFLAGS")
; (sb-ext:posix-getenv "LDFLAGS")
#+sunos "-shared -lresolv -lsocket -lnsl"
#+darwin "-bundle -flat_namespace -undefined suppress"
#-(or darwin sunos) "-shared"
; )
dso-name
(mapcar #'unix-name
(mapcan (lambda (c)
(output-files operation c))
(module-components dso)))
#+darwin
; "-L/sw/lib -lg2c -lm" ;;probably need more here...
"-L/sw/lib -lf2c -lSystem -lcc_dynamic /usr/lib/bundle1.o"
#-darwin
"")));"-L/usr/lib/gcc-lib/i486-linux/3.3.3 -L/usr/lib/gcc-lib/i486-linux/3.3.3/../../.. -lfrtbegin -lg2c -lm")))
(error 'operation-error :operation operation :component dso))))
(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))))
(defclass fortran-source-file (source-file) ())
(defmethod asdf:source-file-type ((f fortran-source-file) (s module)) "f")
(defmethod output-files ((op compile-op) (f fortran-source-file))
(list
(make-pathname :type "o" :defaults
(component-pathname f))))
(defmethod perform ((op compile-op) (f fortran-source-file))
(unless
(= 0 (run-shell-command "~A ~A -o ~S -c ~S"
*fortran-compiler*
#+darwin "-fPIC -O3"
#-darwin "-fPIC -O3"
(unix-name (car (output-files op f)))
(unix-name (component-pathname f))))
(error 'operation-error :operation op :component f)))
(defmethod perform ((operation load-op) (f fortran-source-file))
t)
(defclass brittle-fortran-source-file (source-file) ())
(defmethod asdf:source-file-type ((f brittle-fortran-source-file) (s module)) "f")
(defmethod output-files ((op compile-op) (f brittle-fortran-source-file))
(list
(make-pathname :type "o" :defaults
(component-pathname f))))
(defmethod perform ((op compile-op) (f brittle-fortran-source-file))
(unless
(= 0 (run-shell-command "~A ~A -o ~S -c ~S"
*fortran-compiler*
#+darwin "-fPIC -O0"
#-darwin "-fPIC -O0"
(unix-name (car (output-files op f)))
(unix-name (component-pathname f))))
(error 'operation-error :operation op :component f)))
(defmethod perform ((operation load-op) (f brittle-fortran-source-file))
t)
;;;END: code to do alien-files
;; This is for macros.l which has a nonstandard suffix.
(defclass cl-source-file* (cl-source-file) ())
(defmethod asdf:source-file-type ((c cl-source-file*) (s module)) "l")
(defsystem :matlisp
; :depends-on ("lazy-loader"
; "matlisp-packages")
:components
((:unix-dso "alien code"
:pathname ""
:dso-name "libmatlisp"
:components
((:alien-module "BLAS"
:pathname "LAPACK/BLAS/SRC/"
:components
#.(mapcar (lambda (x)
`(:fortran-source-file ,x))
'("dgemm" "dswap" "dtrmv" "lsame" "zdotu"
"zhemv" "ztrmv" "dgemv" "dsymv" "dtrsm"
"zher2" "ztrsm" "dasum" "dger" "dsyr"
"dtrsv" "zdscal" "zher2k" "ztrsv" "daxpy"
"dsyr2" "dzasum" "xerbla" "zgemm" "zherk"
"dcabs1" "dnrm2" "dsyr2k" "dznrm2" "zaxpy"
"zgemv" "zscal" "dcopy" "drot" "dsyrk"
"idamax" "zcopy" "zgerc" "zswap" "ddot"
"dscal" "dtrmm" "izamax" "zdotc" "zgeru"
"ztrmm" "dsymm")))
(:alien-module "LAPACK"
:pathname "LAPACK/SRC/"
:components
#.(cons '(:brittle-fortran-source-file "dlamch")
(mapcar (lambda (x)
`(:fortran-source-file ,x))
'("dlasq5" "dlasq6" "ieeeck" "zdrot" "dlabad"
"dlarf" "dorglq" "zhetd2" "zlatrs" "dbdsqr"
"dlabrd" "dlarfb" "dorgql" "zhetrd" "zpotf2"
"dgebak" "dlacon" "dlarfg" "dorgqr" "zhseqr"
"zpotrf" "dgebal" "dlacpy" "dlarft" "dorgtr"
"zbdsqr" "zlabrd" "zrot" "dgebd2" "dladiv"
"dlarfx" "dorm2r" "zdrscl" "zlacgv" "zsteqr"
"dgebrd" "dlae2" "dlartg" "dormbr"
"zgebak" "zlacon" "ztrevc" "dgeesx" "dlaev2"
"dlas2" "dorml2" "zgebal" "zlacpy" "ztrexc"
"dgeev" "dlaexc" "dlascl" "dormlq" "zgebd2"
"zladiv" "ztrsen" "dgehd2" "dlag2" "dlaset"
"dormqr" "zgebrd" "zlahqr" "ztrsyl"
"dgehrd" "dlahqr" "dlasq1" "drscl" "zgeesx"
"zlahrd" "zung2l" "dgelq2" "dlahrd" "dlasq2"
"dsteqr" "zgeev" "zlange" "zung2r" "dgelqf"
"dlaln2" "dlasq3" "dsterf" "zgehd2" "zlanhe"
"zungbr" "dgelss" "dlasq4" "dsyev" "zgehrd"
"zlanhs" "zunghr" "dgeqp3" "dlaqp2" "dlaqps"
"zgeqp3" "zlaqp2" "zlaqps" "dgeqpf" "dlasr"
"dsytd2" "zgelq2" "zlarf" "zungl2" "dgeqr2"
"dlasrt" "dsytrd" "zgelqf" "zlarfb" "zunglq"
"dgeqrf" "dlassq" "dtrevc" "zgelss" "zlarfg"
"zungql" "dlasv2" "dtrexc" "zgeqpf" "zlarft"
"zungqr" "dgesvd" "dtrsen" "zgeqr2"
"zlarfx" "zungtr" "dgetf2" "dlange" "dlasy2"
"dtrsyl" "zgeqrf" "zlartg" "zunm2r" "dlanhs"
"dlatrd" "dzsum1" "zlascl" "zunmbr" "dlanst"
"dorg2l""ilaenv" "zgesvd" "zlaset" "zunml2"
"dggbal" "dlansy" "dorg2r""izmax1" "zgetf2"
"zlasr" "zunmlq" "dgghrd" "dlanv2" "dorgbr"
"zlassq" "zunmqr" "dhgeqz" "dlapy2" "dorghr"
"dhseqr" "dlapy3" "dorgl2" "zheev"
"zlatrd"
;;Atlas lapack objects
"dgetrf" "zgetrf" "dgetrs" "zgetrs" "dlaswp"
"zlaswp" "dgesv" "zgesv"
))))
(:alien-module "DFFTPACK"
:pathname "dfftpack/"
:components
#.(mapcar (lambda (x)
`(:fortran-source-file ,x))
'("zfftb" "cfftb1" "zfftf" "cfftf1" "zffti"
"cffti1" "dcosqb" "cosqb1" "dcosqf"
"cosqf1" "dcosqi" "dcost" "dcosti" "ezfft1"
"dzfftb" "dzfftf" "dzffti" "passb" "passb2"
"passb3" "passb4" "passb5" "passf" "passf2"
"passf3" "passf4" "passf5" "radb2" "radb3"
"radb4" "radb5" "radbg" "radf2" "radf3"
"radf4" "radf5" "radfg" "dfftb" "rfftb1"
"dfftf" "rfftf1" "dffti" "rffti1" "dsinqb"
"dsinqf" "dsinqi" "dsint" "sint1"
"dsinti")))
(:alien-module "CPOLY"
:pathname "lib-src/cpoly/"
:components
((:fortran-source-file "cpoly")))
(:alien-module "SPECFUN"
:pathname "lib-src/toms715/"
:components
#.(mapcar (lambda (x)
`(:fortran-source-file ,x))
'("anorm" "besei0" "besei1" "besek0"
"besek1" "besi0" "besi1" "besj0" "besj1"
"besk0" "besk1" "besy0" "besy1" "calcei"
"calci0" "calci1" "calck0" "calck1" "calerf"
"caljy0" "caljy1" "daw" "derf" "derfc"
"derfcx" "dgamma" "dlgama" "dsubn" "ei"
"eone" "expei" "machar" "psi" "ribesl"
"rjbesl" "rkbesl" "rybesl")))))
(:file "packages")
#+(or) ;; asdf now does the loading
(:module "alien code"
:pathname "lib/"
:depends-on ("packages")
:components
((:file "lazy-loader")))
(:module "foreign-interface"
:pathname "src/"
:depends-on ("packages" "alien code")
:components ((:file "f77-mangling")
#+:cmu (:file "ffi-cmu")
#+:sbcl (:file "ffi-sbcl")
#+:allegro (:file "ffi-acl")
))
(:module "foreign-functions"
:pathname "src/"
:depends-on ("foreign-interface" "alien code")
:components ((:file "blas")
(:file "lapack")
#-:mswindows (:file "dfftpack")
#+nil (:file "ranlib")))
(:module "matlisp-essentials"
:pathname "src/"
:depends-on ("foreign-interface"
"foreign-functions"
"alien code")
:components ((:file "conditions")
(:file "matrix")
(:file "ref")
(:file "print")
(:file "copy")))
(:module "matlisp-blas-wrappers"
:pathname "src/"
:depends-on ("foreign-interface"
"foreign-functions"
"matlisp-essentials"
"alien code")
:components ((:file "axpy")
(:file "scal")
(:file "swap")
(:file "gemm")))
(:module "matlisp-lapack-wrappers"
:pathname "src/"
:depends-on ("foreign-interface"
"foreign-functions"
"matlisp-essentials"
"alien code")
:components ((:file "gesv")
(:file "geev")
(:file "getrf")
(:file "getrs")
(:file "trsv")))
(:module "matlisp-functions"
:pathname "src/"
:depends-on ("foreign-interface"
"foreign-functions"
"matlisp-essentials"
"matlisp-blas-wrappers"
"matlisp-lapack-wrappers"
"alien code")
:components ((:file "compat")
(:file "help")
(:file "diag")
(:file "special")
(:file "reader")
(:file "trans")
(:file "realimag")
(:file "reshape")
(:file "join")
(:file "svd")
(:file "sum")
(:file "norm")
(:file "dot")
(:file "trace")
(:file "seq")
(:file "vec")
(:file "map")
(:file "mplus")
(:file "mminus")
(:file "mtimes")
(:file "mdivide")
(:file "msqrt")
#-:mswindows (:file "fft")
(:file "geqr")))
(:module "special-functions"
:pathname "src/"
:depends-on ("matlisp-functions" "alien code")
:components
((:file "specfun")))
;; Various add-on packages for matlisp
;; This is just the f2cl macros we need, not all of f2cl.
(:module "f2cl-macros"
:pathname "lib-src/"
; :source-extension "l"
:components
((:cl-source-file* "macros")))
;; This is Quadpack, converted from the Fortran
;; implementation to Lisp via f2cl.
(:module "quadpack-functions"
:pathname ""
; :source-pathname ""
; :binary-pathname ""
:depends-on ("f2cl-macros" "alien code")
:components
((:module "quadpack-interface"
:pathname "src/"
:components
((:file "quadpack")))
(:module "quadpack-lib"
:pathname "lib-src/quadpack/"
;; :package "QUADPACK"
:components
(
#+nil
(:module mach-par
:components
((:file "d1mach")
(:file "i1mach")))
(:module src
;; :depends-on ("mach-par")
:pathname ""
:components
(
;; Support
(:file "dqwgtf")
(:file "dqcheb")
(:file "dqk15w")
(:file "dqwgts")
(:file "dqwgtc")
(:file "dgtsl")
(:file "xerror")
;; Core integration routines
(:file "dqk15")
(:file "dqk31")
(:file "dqk41")
(:file "dqk51")
(:file "dqk61")
(:file "dqk21")
(:file "dqk15i")
(:file "dqelg")
(:file "dqpsrt")
(:file "dqc25s"
:depends-on ("dqcheb" "dqk15w"))
(:file "dqmomo")
(:file "dqc25c"
:depends-on ("dqcheb"
"dqk15w"))
(:file "dqc25f"
:depends-on ("dgtsl"
"dqcheb"
"dqk15w"
"dqwgtf"))
;; Basic integrators
(:file "dqage"
:depends-on ("dqk15"
"dqk31"
"dqk41"
"dqk51"
"dqk61"
"dqk21"
"dqpsrt"))
(:file "dqagie"
:depends-on ("dqelg"
"dqk15i"
"dqpsrt"))
(:file "dqagpe"
:depends-on ("dqelg"
"dqpsrt"
"dqk21"
))
(:file "dqagse"
:depends-on ("dqk21"
"dqelg"
"dqpsrt"))
(:file "dqawfe"
:depends-on ("dqagie"
"dqawoe"
"dqelg"))
(:file "dqawoe"
:depends-on ("dqc25f"
"dqpsrt"
"dqelg"))
(:file "dqawse"
:depends-on ("dqc25s"
"dqmomo"
"dqpsrt"))
(:file "dqawce"
:depends-on ("dqc25c"
"dqpsrt"))
;; Simplified interface routines
(:file "dqng"
:depends-on ("xerror"))
(:file "dqag"
:depends-on ("dqage"
"xerror"))
(:file "dqags"
:depends-on ("dqagse"
"xerror"))
(:file "dqagi"
:depends-on ("dqagie"
"xerror"))
(:file "dqawf"
:depends-on ("dqawfe"
"xerror"))
(:file "dqawo"
:depends-on ("dqawoe"
"xerror"))
(:file "dqaws"
:depends-on ("dqawse"
"xerror"))
(:file "dqawc"
:depends-on ("dqawce"
"xerror"))))))))
(:module "minpack-functions"
:depends-on ("f2cl-macros" "alien code")
:pathname ""
:components
(
#+nil
(:module "quadpack-interface"
:pathname "src/"
:components
((:file "quadpack")))
(:module "minpack-lib"
:pathname "lib-src/minpack/"
;; :package "MINPACK"
:components
((:file "dpmpar")
(:file "enorm")
(:file "fdjac2")
(:file "qrsolv")
(:file "lmpar")
(:file "qrfac")
(:file "lmdif")
(:file "lmdif1")
(:file "lmder")
(:file "lmder1")
(:file "dogleg")
(:file "qform")
(:file "r1mpyq")
(:file "r1updt")
(:file "hybrj" :depends-on ("dogleg" "qform" "r1mpyq" "r1updt"))
(:file "hybrj1" :depends-on ("hybrj"))
))))
(:module "lib-src"
:components
(#+nil
(:file "d1mach"
:package "MATLISP-LIB")
(:module "cpoly"
:components
((:file "cpoly")
(:file "zeroin")))
#+(or :cmu :sbcl)
(:module "gnuplot"
:components
((:file "gnuplot")))))))
;; needed for lazy-loader
(setf (logical-pathname-translations "matlisp")
(let ((matlisp-pathname
(asdf:component-pathname (asdf:find-system :matlisp))))
`(("**;*.*.*"
,(namestring (merge-pathnames "**/*.*" matlisp-pathname)))
("*.*.*"
,(namestring (merge-pathnames "*.*" matlisp-pathname))))))
More information about the asdf-devel
mailing list