суббота, 3 марта 2012 г.

Installing ECL on win32

I describing here how to get, build and setup fresh version of ECL from git repository on MS windows 32bit

Requirements

You will need
  • Some version of visual studio (2005, 2008 or 2010. I haven't played with 2011 yet)
  • git client for windows
  • nasm or yasm if you want to build GMP for modern processors

Getting sources

It`s easy - just run
git clone git://ecls.git.sourceforge.net/gitroot/ecls/ecl
in some work directory

Building

cd to msvc sub-dir and edit Makefile. You need to decide if you want to support for modern processors for GMP - p3 or p4 for GMP_TYPE option. In this case patch also msvc\gmp\Makefile for rule .asm.obj - put full path to your nasm/yasm executable to it.
If your processor supports SSE2 you can also add to msvc\Makefile string
ECL_SSE = 1
If you need 64bit integers - you can apply my patch

Run Programs -> Your Visual Studio -> Visual Studio Tools -> Visual Studio Command Prompt. This command gives you console with properly configured environment for calling nmake. cd to ecl\msvc sub-dir and run
nmake

Installing

In the same sub-dir msvc just run
nmake install prefix=c:\dir\2\install\ecl

After installing you can run
nmake clean
to kill all temporary files used for building

Tuning

I strictly recommend to download this pre-builded packages for ecl and exract it in directory containing your ecl installation. Then you have to add two new directories to PATH system variable
  • directory in which ecl was installed
  • sub-dir packages\bin
Now you need to create your personal ecl startup file. Usually it must be located somewhere in user home directory (something like c:\Documents and Settings\%USERNAME%. You can also try cd to %HOMEPATH%) and has name .ecl.lisp

(require 'asdf)

(in-package #:asdf)

(defvar *subdir-search-registry* (list "c:\\dir\\with\\installed\\ecl\\packages\\")
  "List of directories to search subdirectories within.")

(defvar *subdir-search-wildcard* :wild
  "Value of :wild means search only one level of subdirectories; value of :wild-inferiors means search all levels of subdirectories (I don't advise using this in big directories!)")

(defun sysdef-subdir-search (system)
  (let ((latter-path (make-pathname :name (coerce-name system)
                                    :directory (list :relative
                                                     *subdir-search-wildcard*)
                                    :type "asd"
                                    :version :newest
                                    :case :local)))
    (dolist (d *subdir-search-registry*)
      (let* ((wild-path (merge-pathnames latter-path d))
             (files (directory wild-path)))
        (when files
          (return (first files)))))))
(pushnew 'sysdef-subdir-search *system-definition-search-functions*)

(in-package #:cl-user)

;;; Load as source versions - old ECL couldn't handle doing a compile of these

(defun load-ltk ()
    (asdf:oos 'asdf:load-source-op 'ltk)
    (asdf:oos 'asdf:load-source-op 'ltk-mw)
    (asdf:oos 'asdf:load-source-op 'ltk-remote))

(defun load-opengl ()
    (asdf:oos 'asdf:load-source-op 'cl-glut-examples))

(defun load-sdl ()
    (asdf:operate 'asdf:load-source-op :lispbuilder-sdl)
    (asdf:operate 'asdf:load-source-op :lispbuilder-sdl-examples))
    ;;(asdf:operate 'asdf:load-source-op :lispbuilder-sdl-gfx-examples)
    ;;(asdf:operate 'asdf:load-source-op :lispbuilder-sdl-cl-vectors-examples)
    ;;(asdf:operate 'asdf:load-source-op :lispbuilder-sdl-vecto-examples))
    ;;(asdf:operate 'asdf:load-source-op :lispbuilder-sdl-image-examples)
    ;;(asdf:operate 'asdf:load-source-op :lispbuilder-sdl-TTF-examples)

(defun load-win ()
    (asdf:operate 'asdf:load-source-op :lispbuilder-windows)
    (asdf:operate 'asdf:load-source-op :lispbuilder-windows-examples))

(defun load-plot ()
    (asdf:operate 'asdf:load-source-op :cl-2d))
   
;;; Load compiled versions - lets see if the new ECL can handle it, or if this is going to be CLisp only.

(defun load-ltk-compiled ()
    (asdf:oos 'asdf:load-op 'ltk)
    (asdf:oos 'asdf:load-op 'ltk-mw)
    (asdf:oos 'asdf:load-op 'ltk-remote))

(defun load-opengl-compiled ()
    (asdf:oos 'asdf:load-op 'cl-glut-examples))

(defun load-sdl-compiled ()
    (asdf:operate 'asdf:load-op :lispbuilder-sdl)
    (asdf:operate 'asdf:load-op :lispbuilder-sdl-examples)
    (asdf:operate 'asdf:load-op :lispbuilder-sdl-gfx-examples)
    (asdf:operate 'asdf:load-op :lispbuilder-sdl-cl-vectors-examples)
    (asdf:operate 'asdf:load-op :lispbuilder-sdl-vecto-examples))
    ;;(asdf:operate 'asdf:load-op :lispbuilder-sdl-image-examples)
    ;;(asdf:operate 'asdf:load-op :lispbuilder-sdl-TTF-examples)

(defun load-win-compiled ()
    (asdf:operate 'asdf:load-op :lispbuilder-windows)
    (asdf:operate 'asdf:load-op :lispbuilder-windows-examples))

(defun load-plot-compiled ()
    (asdf:operate 'asdf:load-op :cl-2d))


You must change *subdir-search-registry* var value in this example to your actual directory with packages
Now you can use one of the following commands to load its respective library immediately after starting the ecl:

(load-ltk)
(load-opengl)
(load-sdl)
(load-win)
(load-plot)

Big thanks to Greg Santucci for his .ecl.lisp sample !

Комментариев нет:

Отправить комментарий