Commit 83d4d3de authored by Francois-Rene Rideau's avatar Francois-Rene Rideau

Make it build with ASDF 3.3

Clean up the ASDF support, with compatibility back to ASDF 3.0.
This is necessary to work with ASDF 3.3.

There are still test failures, but they do not seem to be build-related.
parent d0997e7b
;;; -*- Mode: lisp -*-
(in-package :asdf)
(defclass cl-source-file.l (cl-source-file)
((type :initform "l"))
(:documentation "Component class for a Common Lisp source file using type \"l\""))
(defsystem :f2cl
:components
((:file "f2cl0")
(defsystem "f2cl"
:default-component-class cl-source-file.l
:components
((:file "f2cl-asdf")
(:file "f2cl0")
(:file "f2cl1" :depends-on ("f2cl0"))
(:file "f2cl2" :depends-on ("f2cl1"))
(:file "f2cl3" :depends-on ("f2cl2"))
......@@ -14,7 +18,3 @@
(:file "f2cl7" :depends-on ("f2cl6"))
(:file "f2cl8" :depends-on ("f2cl7"))
(:file "macros" :depends-on ("f2cl8"))))
(defmethod source-file-type ((c cl-source-file) (s (eql (find-system :f2cl))))
"l")
;;; -*- Mode: lisp -*-
;; f2cl asd file
(defpackage #:f2cl-asd
(:use :cl :asdf))
(in-package #:f2cl-asd)
(defclass f2cl-cl-source-file (asdf:cl-source-file)
())
(defmethod source-file-type ((f f2cl-cl-source-file) (m module))
"l")
(defclass cl-source-file.l (cl-source-file)
((type :initform "l"))
(:documentation "Component class for a Common Lisp source file using type \"l\""))
(defsystem f2cl
:description "F2CL: Fortran to Lisp converter"
:components
((:module src
:default-component-class f2cl-cl-source-file
((:module "src"
:default-component-class cl-source-file.l
:serial t
:components
((:file "f2cl0")
((:file "f2cl-asdf")
(:file "f2cl0")
(:file "f2cl1")
(:file "f2cl2")
(:file "f2cl3")
......
;;; -*- Mode: lisp -*-
(require :f2cl)
(load-system :f2cl)
(defpackage blas-complex-system
(:use #:cl #:asdf))
(in-package :f2cl-asdf)
(in-package #:blas-complex-system)
(defclass blas-complex-fortran-file (cl-source-file)
()
(:default-initargs :type "f"))
(defun fortran-compile (op c &key (array-slicing t) (array-type :array) package declare-common)
(let ((file (component-pathname c)))
(f2cl:f2cl-compile file
:output-file (first (output-files op c))
:array-slicing array-slicing
:array-type array-type
:package package
:relaxed-array-decls t
:declare-common declare-common
)))
(defmethod perform ((op compile-op) (c blas-complex-fortran-file))
(fortran-compile op c :package "BLAS"))
(defmethod perform ((op load-op) (c blas-complex-fortran-file))
(load (first (input-files op c))))
(defsystem blas-complex
(defsystem "blas-complex"
:description "BLAS routines for complex double-float matrices"
:class f2cl-system
:f2cl-options (:package "BLAS" :array-slicing t :array-type :array :relaxed-array-decls t)
:depends-on ("blas-real")
:components
((:module "blas"
:pathname "blas/"
:default-component-class blas-complex-fortran-file
:components
((:file "zaxpy")
(:file "zcopy")
......
......@@ -2,46 +2,20 @@
;;;
;; Need f2cl to be loaded before we can even read this file.
(eval-when (:compile-toplevel :load-toplevel :execute)
(asdf:load-system :f2cl))
(load-system "f2cl")
(defpackage blas-hompack-system
(:use #:cl #:asdf))
(in-package :f2cl-asdf)
(in-package #:blas-hompack-system)
(defclass blas-hompack-fortran-file (cl-source-file)
()
(:default-initargs :type "f"))
(defun fortran-compile (op c &key (array-slicing t) (array-type :array) package declare-common)
(let ((file (component-pathname c)))
(f2cl:f2cl-compile file
:output-file (first (output-files op c))
:array-slicing array-slicing
:array-type array-type
:package package
:relaxed-array-decls nil
:declare-common declare-common
)))
(defmethod perform ((op compile-op) (c blas-hompack-fortran-file))
(fortran-compile op c :package "BLAS"))
(defmethod perform ((op load-op) (c blas-hompack-fortran-file))
(load (first (input-files op c))))
(defsystem blas-hompack
(defsystem "blas-hompack"
:class f2cl-system
:f2cl-options (:package "BLAS" :array-slicing t :array-type :array :relaxed-array-decls nil)
:depends-on ("blas-package")
:pathname "blas"
;; These are the ones needed for HOMPACK
:components
( ;; These are the ones needed for HOMPACK
(:module "blas"
:default-component-class blas-hompack-fortran-file
:components
((:file "daxpy")
(:file "dcopy")
(:file "ddot")
(:file "dnrm2")
(:file "dscal")
(:file "idamax")))))
\ No newline at end of file
((:file "daxpy")
(:file "dcopy")
(:file "ddot")
(:file "dnrm2")
(:file "dscal")
(:file "idamax")))
;;; -*- Mode: lisp -*-
;;;
(asdf:defsystem blas-package
(defsystem "blas-package"
:description "Package definition for BLAS"
:components
((:module "blas"
......
;;; -*- Mode: lisp -*-
(require :f2cl)
(load-system "f2cl")
(defpackage blas-real-system
(:use #:cl #:asdf))
(in-package :f2cl-asdf)
(in-package #:blas-real-system)
(defclass blas-real-fortran-file (cl-source-file)
()
(:default-initargs :type "f"))
(defun fortran-compile (op c &key (array-slicing t) (array-type :array) package declare-common)
(let ((file (component-pathname c)))
(f2cl:f2cl-compile file
:output-file (first (output-files op c))
:array-slicing array-slicing
:array-type array-type
:package package
:relaxed-array-decls t
:declare-common declare-common
)))
(defmethod perform ((op compile-op) (c blas-real-fortran-file))
(fortran-compile op c :package "BLAS"))
(defmethod perform ((op load-op) (c blas-real-fortran-file))
(load (first (input-files op c))))
(defsystem blas-real
(defsystem "blas-real"
:description "BLAS routines for real double-float matrices"
:class f2cl-system
:f2cl-options (:package "BLAS" :array-slicing t :relaxed-array-decls t :array-type :array)
:depends-on ("blas-hompack")
:components
((:module "blas"
:default-component-class blas-real-fortran-file
:components
( ;; Here are the rest of the BLAS routines
(:file "dasum")
......
;;; -*- Mode: lisp -*-
(defpackage blas-system
(:use #:cl #:asdf))
(in-package #:blas-system)
(defclass blas-fortran-file (cl-source-file)
()
(:default-initargs :type "f"))
;;
(defun fortran-compile (op c &key
(array-slicing t)
(array-type :array)
(relaxed-array-decls t)
(package "BLAS"))
(let ((file (component-pathname c)))
(f2cl:f2cl-compile file
:output-file (first (output-files op c))
:array-slicing array-slicing
:array-type array-type
:package package
:relaxed-array-decls relaxed-array-decls
)))
(defmethod perform ((op compile-op) (c blas-fortran-file))
(fortran-compile op c))
(defmethod perform ((op load-op) (c blas-fortran-file))
(load (first (input-files op c))))
#+nil
(defsystem blas-package
:description "Package definition for BLAS"
:components
((:module "blas"
:components
((:file "blas-package")))))
#+nil
(defsystem blas-hompack
:description "BLAS routines needed by HOMPACK"
:depends-on ("blas-package")
:components
((:module "blas-hompack"
:pathname "blas/"
:default-component-class blas-fortran-file
:components
(
;; These are the ones needed for HOMPACK
(:file "daxpy")
(:file "dcopy")
(:file "ddot")
(:file "dnrm2")
(:file "dscal")
(:file "idamax")))))
#+nil
(defsystem blas-real
:description "BLAS routines for real double-float matrices"
:depends-on ("blas-hompack")
:components
((:module "blas"
:default-component-class blas-fortran-file
:components
( ;; Here are the rest of the BLAS routines
(:file "dasum")
(:file "dcabs1")
(:file "dgbmv"
:depends-on ("lsame" "xerbla"))
(:file "dgemm"
:depends-on ("lsame" "xerbla"))
(:file "dgemv"
:depends-on ("lsame" "xerbla"))
(:file "dger"
:depends-on ("xerbla"))
(:file "drot")
(:file "drotg")
(:file "dsbmv"
:depends-on ("lsame" "xerbla"))
(:file "dspmv"
:depends-on ("lsame" "xerbla"))
(:file "dspr"
:depends-on ("lsame" "xerbla"))
(:file "dspr2"
:depends-on ("lsame" "xerbla"))
(:file "dswap")
(:file "dsymm"
:depends-on ("lsame" "xerbla"))
(:file "dsymv"
:depends-on ("lsame" "xerbla"))
(:file "dsyr"
:depends-on ("lsame" "xerbla"))
(:file "dsyr2"
:depends-on ("lsame" "xerbla"))
(:file "dsyr2k"
:depends-on ("lsame" "xerbla"))
(:file "dsyrk"
:depends-on ("lsame" "xerbla"))
(:file "dtbmv"
:depends-on ("lsame" "xerbla"))
(:file "dtbsv"
:depends-on ("lsame" "xerbla"))
(:file "dtpmv"
:depends-on ("lsame" "xerbla"))
(:file "dtpsv"
:depends-on ("lsame" "xerbla"))
(:file "dtrmm"
:depends-on ("lsame" "xerbla"))
(:file "dtrmv"
:depends-on ("lsame" "xerbla"))
(:file "dtrsm"
:depends-on ("lsame" "xerbla"))
(:file "dtrsv"
:depends-on ("lsame" "xerbla"))
(:file "dzasum"
:depends-on ("dcabs1"))
(:file "dznrm2")
(:file "icamax")
(:file "isamax")
(:file "izamax"
:depends-on ("dcabs1"))
(:file "lsame")
(:file "xerbla")))))
#+nil
(defsystem blas-complex
:description "BLAS routines for complex double-float matrices"
:depends-on ("blas-real")
:components
((:module "blas"
:pathname "blas/"
:default-component-class blas-fortran-file
:components
((:file "zaxpy")
(:file "zcopy")
(:file "zdotc")
(:file "zdotu")
(:file "zdscal")
(:file "zgbmv")
(:file "zgemm")
(:file "zgemv")
(:file "zgerc")
(:file "zgeru")
(:file "zhbmv")
(:file "zhemm")
(:file "zhemv")
(:file "zher")
(:file "zher2")
(:file "zher2k")
(:file "zherk")
(:file "zhpmv")
(:file "zhpr")
(:file "zhpr2")
(:file "zrotg")
(:file "zscal")
(:file "zswap")
(:file "zsymm")
(:file "zsyr2k")
(:file "zsyrk")
(:file "ztbmv")
(:file "ztbsv")
(:file "ztpmv")
(:file "ztpsv")
(:file "ztrmm")
(:file "ztrmv")
(:file "ztrsm")
(:file "ztrsv")))))
(defsystem blas
(defsystem "blas"
:description "BLAS (Basic Linear Algebra Subprograms) for double-float matrices."
:pathname "blas/"
:depends-on ("blas-package" "blas-real" "blas-complex"))
......
;;; -*- Mode: lisp; Package: CL-USER -*-
;; Need f2cl to be loaded before we can even read this file.
(eval-when (:compile-toplevel :load-toplevel :execute)
(asdf:load-system :f2cl))
(defpackage colnew-system
(:use #:cl #:asdf))
(in-package #:colnew-system)
(defclass colnew-fortran-file (cl-source-file)
()
(:default-initargs :type "f"))
(defun fortran-compile (op c &key (array-slicing t) (array-type :array) (package "COLNEW")
declare-common (common-as-array t))
(let ((file (component-pathname c)))
(f2cl:f2cl-compile file
:keep-lisp-file t
:output-file (first (output-files op c))
:array-slicing array-slicing
:array-type array-type
:package package
:declare-common declare-common
:common-as-array common-as-array
)))
(defmethod perform ((op compile-op) (c colnew-fortran-file))
(fortran-compile op c :package "COLNEW"))
(defmethod perform ((op load-op) (c colnew-fortran-file))
(load (first (input-files op c))))
(load-system :f2cl)
(in-package :f2cl-asdf)
;; Defsystem for colnew.
(defsystem colnew
(defsystem "colnew"
:description "F2CL conversion of COLNEW: Solution of boundary-value problems for ODEs"
:class f2cl-system
:f2cl-options (:package "COLNEW" :array-slicing t :array-type :array :common-as-array t :keep-lisp-file t)
:components
((:module package
:pathname "colnew"
:components
((:file "package")))
((:cl-source-file "package")))
(:module "colnew"
:depends-on ("package")
:default-component-class colnew-fortran-file
:components
(
;; Linpack routines needed by colnew
......@@ -61,9 +32,7 @@
;; Simple compatibility to define all of the needed
;; common blocks in one place.
(:file "compat"
:perform (compile-op :around (op c)
(fortran-compile op c
:declare-common t :common-as-array t)))
:f2cl-options (:declare-common t :common-as-array t))
;; COLNEW itself, broken down into one subroutine per
;; file.
(:file "colnew"
......@@ -102,23 +71,20 @@
(:file "sbblok"
:depends-on ("subfor" "subbak"))
(:file "subfor")
(:file "subbak")))))
(defmethod perform ((op test-op) (c (eql (find-system "colnew"))))
(oos 'test-op "colnew-test-1")
(oos 'test-op "colnew-test-2")
(oos 'test-op "colnew-test-3"))
(:file "subbak"))))
:in-order-to ((test-op (test-op "colnew-test-1" "colnew-test-2" "colnew-test-3"))))
;; Test problem 1 from TOMS 569.
;;
;; Run (*main*). Appears to work since the error tolerance is satisfied.
(defsystem colnew-test-1
;; Run (*main*). Appears to work since the error tolerance is satisfied.
(defsystem "colnew-test-1"
:class f2cl-system
:f2cl-options (:package "COLNEW" :array-slicing t :array-type :array :common-as-array t :keep-lisp-file t)
:depends-on ("colnew")
:pathname "colnew/"
:components
((:module problem-1
:default-component-class colnew-fortran-file
:components
((:file "prob1"
:depends-on ("fsub" "dfsub" "gsub" "dgsub" "exact"))
......@@ -126,53 +92,44 @@
(:file "gsub")
(:file "dfsub")
(:file "dgsub")
(:file "exact")))))
(defmethod perform ((op test-op) (c (eql (find-system "colnew-test-1"))))
(funcall (intern "PROB1" (find-package '#:colnew))))
(:file "exact"))))
:perform (test-op (o c) (symbol-call :colnew :prob1)))
;; Test problem 2 from TOMS 569. Appears to work.
(defsystem colnew-test-2
(defsystem "colnew-test-2"
:class f2cl-system
:f2cl-options (:package "COLNEW" :array-slicing t :array-type :array :common-as-array t :keep-lisp-file t)
:depends-on ("colnew")
:pathname "colnew/"
:components
((:module problem-2
:default-component-class colnew-fortran-file
:components
((:file "prob2"
:perform (compile-op :around (op c)
(fortran-compile op c
:declare-common t :common-as-array t))
:f2cl-options (:declare-common t :common-as-array t)
:depends-on ("fsub" "dfsub" "gsub" "dgsub" "solutn"))
(:file "fsub")
(:file "gsub")
(:file "dfsub")
(:file "dgsub")
(:file "solutn")))))
(defmethod perform ((op test-op) (c (eql (find-system "colnew-test-2"))))
(funcall (intern "PROB2" (find-package '#:colnew))))
(:file "solutn"))))
:perform (test-op (o c) (symbol-call :colnew :prob2)))
;; Test problem 3 from TOMS 569.
(defsystem colnew-test-3
(defsystem "colnew-test-3"
:class f2cl-system
:f2cl-options (:package "COLNEW" :array-slicing t :array-type :array :common-as-array t :keep-lisp-file t)
:depends-on ("colnew")
:pathname "colnew/"
:components
((:module problem-3
:default-component-class colnew-fortran-file
:components
((:file "prob3"
:perform (compile-op :around (op c)
(fortran-compile op c
:declare-common t :common-as-array t))
((:file "prob3" :f2cl-options (:declare-common t :common-as-array t)
:depends-on ("fsub" "dfsub" "gsub" "dgsub" "solutn"))
(:file "fsub")
(:file "gsub")
(:file "dfsub")
(:file "dgsub")
(:file "solutn")))))
(defmethod perform ((op test-op) (c (eql (find-system "colnew-test-3"))))
(funcall (intern "PROB3" (find-package '#:colnew))))
(:file "solutn"))))
:perform (test-op (o c) (symbol-call :colnew :PROB3)))
This diff is collapsed.
......@@ -2,51 +2,24 @@
;;;
;; Need f2cl to be loaded before we can even read this file.
(eval-when (:compile-toplevel :load-toplevel :execute)
(asdf:load-system :f2cl))
(load-system "f2cl")
(defpackage hompack-system
(:use #:cl #:asdf))
(in-package :f2cl-asdf)
(in-package #:hompack-system)
(defclass hompack-fortran-file (cl-source-file)
()
(:default-initargs :type "f"))
(defun fortran-compile (op c &key (array-slicing t) (array-type :array) package declare-common)
(let ((file (component-pathname c)))
(f2cl:f2cl-compile file
:keep-lisp-file t
:output-file (first (output-files op c))
:array-slicing array-slicing
:array-type array-type
:package "HOMPACK"
:relaxed-array-decls t
:declare-common declare-common
)))
(defmethod perform ((op compile-op) (c hompack-fortran-file))
(fortran-compile op c))
(defmethod perform ((op load-op) (c hompack-fortran-file))
(load (first (input-files op c))))
(defsystem hompack
(defsystem "hompack"
:description "F2CL conversion of HOMPACK: Solution of non-linear systems of equations by homotopy methods."
:class f2cl-system
:f2cl-options (:package "HOMPACK" :array-slicing t :array-type :array :common-as-array t :keep-lisp-file t :relaxed-array-decls t)
:depends-on ("blas-hompack")
:components
((:module "package"
:pathname "hompack"
:components
((:file "hompack-package")))
((:cl-source-file "hompack-package")))
(:module "hompack"
:default-component-class hompack-fortran-file
:depends-on ("package")
:components
(
;; The following are :compile-only here because HOMPACK only
(;; The following are :compile-only here because HOMPACK only
;; gives skeletons for them. We make them :compile-only so that
;; f2cl will get the function definitions so it can generate
;; calls to them appropriately.
......@@ -60,7 +33,6 @@
(:file "rhojs")
(:file "rhoa")
(:file "rho")
(:file "rhojac" :depends-on ("hfunp"))
......@@ -114,32 +86,20 @@
(:file "tangqf" :depends-on ("rhojac" "qrfaqf" "qrslqf" "r1upqf" "fjac"))
(:file "tangqs" :depends-on ("rhojs" "pcgqs" "fjac"))
(:file "upqrqf" :depends-on ("r1upqf"))
))))
(defmethod perform ((op test-op) (c (eql (find-system "hompack"))))
(oos 'test-op "hompack-test-mainf")
(oos 'test-op "hompack-test-mainp")
(oos 'test-op "hompack-test-mains"))
)))
:in-order-to ((test-op (test-op "hompack/test-mainf" "hompack/test-mainp" "hompack/test-mains"))))
;; Run (hompack::mainf). Compare with hompack/ref-main.txt.
;;
;; Results are identical.
(defsystem hompack-test-mainf
(defsystem "hompack/test-mainf"
:class f2cl-system
:f2cl-options (:package "HOMPACK" :array-slicing t :array-type :array :common-as-array t :keep-lisp-file t :relaxed-array-decls t)
:depends-on ("hompack")
:default-component-class hompack-fortran-file
:components
((:module mainf
:pathname "hompack"
:components
((:file "mainf"
:perform (compile-op :around (op c)
(fortran-compile op c :declare-common t)))))))
(defmethod perform ((op test-op) (c (eql (find-system "hompack-test-mainf"))))
(let ((*default-pathname-defaults*
(merge-pathnames "package/hompack"
(load-time-value *load-pathname*))))
(funcall (find-symbol "MAINF" (find-package "HOMPACK")))))
:components ((:file "hompack/mainf" :f2cl-options (:declare-common t)))
:perform (test-op (o c)
(let ((*default-pathname-defaults* (system-source-directory "hompack")))
(symbol-call :hompack :mainf))))
;; This wants to read from innhp.dat in the hompack directory, so you
......@@ -148,36 +108,20 @@
;; the results since the main program doesn't. Use something like
;; (close (f2cl-lib:lun->stream 6)).
(defsystem hompack-test-mainp
(defsystem "hompack/test-mainp"
:class f2cl-system
:f2cl-options (:package "HOMPACK" :array-slicing t :array-type :array :common-as-array t :keep-lisp-file t :relaxed-array-decls t)
:depends-on ("hompack")
:components
((:module mainp
:pathname "hompack"
:default-component-class hompack-fortran-file
:components
((:file "mainp"
:perform (compile-op :around (op c)
(fortran-compile op c :declare-common t)))))))
(defmethod perform ((op test-op) (c (eql (find-system "hompack-test-mainp"))))
(let ((*default-pathname-defaults*
(merge-pathnames (make-pathname :directory '(:relative "hompack"))
(load-time-value *load-pathname*))))
(funcall (find-symbol "MAINP" (find-package "HOMPACK")))))
(defsystem hompack-test-mains
:components ((:file "hompack/mainp" :f2cl-options (:declare-common t)))
:perform (test-op (o c)
(let ((*default-pathname-defaults* (system-source-directory "hompack")))
(symbol-call :hompack :mainp))))
(defsystem "hompack/test-mains"
:class f2cl-system
:f2cl-options (:package "HOMPACK" :array-slicing t :array-type :array :common-as-array t :keep-lisp-file t :relaxed-array-decls t)
:depends-on ("hompack")
:components
((:module mains
:pathname "hompack"
:default-component-class hompack-fortran-file
:components
((:file "mains"
:perform (compile-op :around (op c)
(fortran-compile op c :declare-common t)))))))
(defmethod perform ((op test-op) (c (eql (find-system "hompack-test-mains"))))
(let ((*default-pathname-defaults*
(merge-pathnames (make-pathname :directory '(:relative "hompack"))
(load-time-value *load-pathname*))))
(funcall (find-symbol "MAINS" (find-package "HOMPACK")))))
\ No newline at end of file
:components ((:file "hompack/mains" :f2cl-options (:declare-common t)))
:perform (test-op (o c)
(let ((*default-pathname-defaults* (system-source-directory "hompack")))
(symbol-call :hompack :mains))))
;;; -*- Mode: lisp -*-
(require :f2cl)
(load-system "f2cl")
(defpackage lapack-system
(:use #:cl #:asdf))
(in-package :f2cl-asdf)