;;; --------------------------------------------------------------------- ;;; ;;; Copyright (C) 2012 - Sergey Goldgaber ;;; ;;; This program is free software: you can redistribute it and/or modify ;;; it under the terms of the GNU Affero General Public License as published by ;;; the Free Software Foundation, either version 3 of the License, or ;;; (at your option) any later version. ;;; ;;; This program is distributed in the hope that it will be useful, ;;; but WITHOUT ANY WARRANTY; without even the implied warranty of ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;;; GNU Affero General Public License for more details. ;;; ;;; You should have received a copy of the GNU Affero General Public License ;;; along with this program. If not, see . ;;; ;;; --------------------------------------------------------------------- ;;; --------------------------------------------------------------------- ;;; ;;; Dependency check ;;; ;;; First, we'll do a basic check to make sure that libproccpuinfo ;;; is installed somewhere chicken-install can find it. If it can't ;;; be found, we'll give the user and informative error message. ;;; We'll need the following module, for the header-search procedure, ;;; which respects CFLAGS: (include "proccpuinfo-utils.scm") (import proccpuinfo-utils) ;;; A list of foreign headers that need to be searched for: (define required-headers '("proccpuinfo.h")) ;;; Try to find all the required headers, exiting with an error ;;; and a helpful message if any of them aren't found. (header-search required-headers) ;;; Unfortunately, we can't rely on the built-in (find-library ...) ;;; routine to search for "libproccpuinfo.so", since find-library ;;; does not respect LDFLAGS. And it's a real pain to write a ;;; replacement. So we'll just assume it's installed and go on ;;; with the rest of the egg's compile and build cycle. ;;; ;;; If it's not installed, the compile will fail with an error anyway, ;;; though the error will be a lot uglier than the "header-search" ;;; procedure generates in case a required header is missing. ;;; ;;; End of dependency check ;;; ;;; --------------------------------------------------------------------- ;;; --------------------------------------------------------------------- ;;; ;;; Compilation ;;; ;;; All the magic of compilation takes place in the Makefile (print "; starting compilation ...") ;;; If make fails, (run ...) will spit out an ugly exception. Rather ;;; than allowing an unhandled exception to spit out an ugly and mostly ;;; useless error message, we'll capture the exception and simply exit. ;;; The errors generated by make itself should be enough to debug ;;; what went wrong. (handle-exceptions _ (exit 1) (run (make))) ;;; ;;; End of compilation ;;; ;;; --------------------------------------------------------------------- ;;; --------------------------------------------------------------------- ;;; ;;; Installation (install-extension ; Name of your extension: 'proccpuinfo ; Files to install for your extension: '("proccpuinfo.o" "proccpuinfo.so" "proccpuinfo.import.so") ; Assoc list with properties for your extension: '((version 0.1) (static "proccpuinfo.o"))) ;; for static linking ;;; ;;; End of installation ;;; ;;; ---------------------------------------------------------------------