view INSTALL.WINDOWS @ 2675:d9267aa7726d octave-forge

Changed title describtion and date.
author treichl
date Fri, 13 Oct 2006 15:51:49 +0000
parents e55e24a0bf8f
children
line wrap: on
line source

BUILDING octave-2.1.42 for cygwin

This is a description of how I got 
octave-2.1.42 and gnuplot-3.7.1
and octave-forge to build under win2000.

This description is for a static build. As
of version 2.1.42, octave
can now be built dynamically under cygwin,
so these instructions are of less value.

However, the static build still takes up significantly
less space, as cygwin octave *oct files are still
very big, so this technique is still appropriate to 
obtain a minimal footprint octave.

Andy Adler <adler@ncf.ca>

$Id$

COPYRIGHT:

   Octave: GNU GPL

   GNUPLOT:

   OCTAVE-FORGE COMPONENTS:
      - SuperLU: BSD

   ATLAS:

/*
 *             Automatically Tuned Linear Algebra Software v3.2.1
 *                    (C) Copyright 1998 R. Clint Whaley                     
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 *   1. Redistributions of source code must retain the above copyright
 *      notice, this list of conditions and the following disclaimer.
 *   2. Redistributions in binary form must reproduce the above copyright
 *      notice, this list of conditions, and the following disclaimer in the
 *      documentation and/or other materials provided with the distribution.
 *   3. The name of the University of Tennessee, the ATLAS group,
 *      or the names of its contributers may not be used to endorse
 *      or promote products derived from this software without specific
 *      written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE UNIVERSITY OR CONTRIBUTORS BE
 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 * POSSIBILITY OF SUCH DAMAGE. 
 *
 */



PREREQUISITES:
   
   Download from www.cygwin.com
   recent version of cygwin (at least jan 2002 )
   gcc
   g77
   readline-4.2a
   libreadline5

BUILDING

   Download octave-2.1.42.tar.bz2 from www.octave.org
   tar xvfj octave-2.1.42.tar.bz2
   cd  octave-2.1.42
   ./configure --prefix=/usr --enable-static=yes

OBTAIN GNUPLOT COMPONENTS

   Download from www.gnuplot.info

   get gp371cyg.zip.
   Unzip the file wgnuplot.exe and put it in /usr/bin
   
   get gnuplot-3.7.1.tar.gz
   Compile win/pgnuplot.c

   1. comment out #include <conio.h>
   2. gcc -o pgnuplot.exe pgnuplot.c -luser32 -s
   
   copy pgnuplot.exe to /usr/bin

MODIFY octaverc FILE

for the following
$ cat /usr/share/octave/site/m/startup/octaverc
   ## System-wide startup file for Octave.
   ##
   ## This file should contain any commands that should be executed each
   ## time Octave starts for every user at this site.
   
   # find where cygwin is mounted
   putenv('TMPDIR', system('echo -n `cygpath -wsm /tmp`') );
   
   gnuplot_binary ="pgnuplot.exe";
   gnuplot_has_multiplot = 1;


BUILD OCTAVE WITH FORGE

1. EDIT /usr/src/octave-2.1.36/src/Makefile

A. REPLACE

#DLD_XSRC := balance.cc besselj.cc betainc.cc chol.cc colloc.cc dassl.cc \
#	det.cc eig.cc expm.cc fft.cc fft2.cc filter.cc find.cc \
#	fsolve.cc gammainc.cc getgrent.cc getpwent.cc getrusage.cc \
#	givens.cc hess.cc ifft.cc ifft2.cc inv.cc log.cc lpsolve.cc \
#	lsode.cc lu.cc minmax.cc pinv.cc qr.cc quad.cc qz.cc rand.cc \
#	schur.cc sort.cc svd.cc syl.cc time.cc

WITH

DLD_XSRC := $(shell cd DLD-FUNCTIONS ; ls *.cc )

B. ADD AFTER LINE

CXXFLAGS_NO_PT_FLAGS = $(filter-out $(PT_FLAGS), $(ALL_CXXFLAGS))

THESE LINES

all: octave$(EXEEXT)

OCTAVEFORGE= /usr/src/octave-forge/
SPARSE  = $(OCTAVEFORGE)/main/sparse/
SUPERLU = $(SPARSE)/SuperLU/SRC/
CPPFLAGS := -I$(SUPERLU) $(CPPFLAGS)

$(SPARSE)/libsuperlu.a:
	cd $(SPARSE) && make libsuperlu.a

SPLINES = $(OCTAVEFORGE)/main/splines/
SPLINES_SRC := $(shell ls $(SPLINES)/*.f )
SPLINES_OBJ := $(patsubst %.f, %.o, $(SPLINES_SRC))

$(SPLINES_OBJ): %.o: %.f
	$(FC) -c -fPIC -O -o $@ $<


C. REPLACE

octave$(EXEEXT): stamp-prereq $(LIBRARIES) main.o $(DLD_STATIC_OBJ)
	$(LD_CXX) $(CPPFLAGS) $(ALL_CXXFLAGS) $(RDYNAMIC_FLAG) \
	$(ALL_LDFLAGS) -o $@ \
	main.o $(XERBLA) $(DLD_STATIC_OBJ) \
	$(OCTAVE_LFLAGS) \
	$(OCTAVE_LIBS) \
	$(LEXLIB) $(BLAS_LIBS) $(FFTW_LIBS) $(LIBS) $(FLIBS)

WITH

octave$(EXEEXT): stamp-prereq $(LIBRARIES) main.o $(DLD_STATIC_OBJ) \
        $(SPARSE)/libsuperlu.a $(SPLINES_OBJ)   
	$(LD_CXX) $(CPPFLAGS) $(ALL_CXXFLAGS) $(RDYNAMIC_FLAG) \
	$(ALL_LDFLAGS) -o $@ \
	main.o $(XERBLA) $(DLD_STATIC_OBJ) \
	$(OCTAVE_LFLAGS) \
	$(OCTAVE_LIBS) \
	$(LEXLIB) $(BLAS_LIBS) $(FFTW_LIBS) $(LIBS) $(FLIBS) \
        -L$(SPARSE) -lsuperlu -ljpeg $(SPLINES_OBJ) 


2. CREATE LINKS

cd /usr/src
cvs -d :pserver:anonymous@cvs.octave.sf.net:/cvsroot/octave checkout
OCTAVEFORGE=/usr/src/octave-forge
cd /usr/src/octave-2.1.42/src
mkdir octave
cd octave
ln -s ../../config.h
ln -s ../defun-dld.h
ln -s ../error.h
ln -s ../../libcruft/misc/f77-fcn.h
ln -s ../gripes.h
ln -s ../help.h
ln -s ../../liboctave/lo-ieee.h
ln -s ../../liboctave/lo-mappers.h
ln -s ../../liboctave/lo-utils.h
ln -s ../../liboctave/mx-base.h
ln -s ../../liboctave/Matrix.h 
ln -s ../oct-obj.h
ln -s ../oct.h
ln -s ../ops.h
ln -s ../ov-base.h
ln -s ../ov-complex.h
ln -s ../ov-cell.h
ln -s ../ov-cx-mat.h
ln -s ../ov-re-mat.h
ln -s ../ov-scalar.h
ln -s ../ov-typeinfo.h
ln -s ../ov.h
ln -s ../pager.h
ln -s ../parse.h
ln -s ../pr-output.h
ln -s ../pt-plot.h
ln -s ../../libcruft/misc/quit.h
ln -s ../../liboctave/str-vec.h
ln -s ../symtab.h
ln -s ../toplev.h
ln -s ../utils.h
ln -s ../variables.h
ln -s ../../liboctave/EIG.h
ln -s ../../liboctave/mx-cm-cdm.h
ln -s ../oct-strstrm.h
ln -s ../../liboctave/CmplxSCHUR.h
ln -s ../../liboctave/dbleSCHUR.h
cd ../DLD-FUNCTIONS
ln -s $OCTAVEFORGE/main/general/bitand.cc
ln -s $OCTAVEFORGE/main/general/mark_for_deletion.cc
ln -s $OCTAVEFORGE/main/general/SHA1.cc
ln -s $OCTAVEFORGE/main/general/deref.cc
ln -s $OCTAVEFORGE/main/linear-algebra/GramSchmidt.cc
ln -s $OCTAVEFORGE/main/linear-algebra/rsf2csf.cc
ln -s $OCTAVEFORGE/main/Miscellaneous/waitbar.cc
ln -s $OCTAVEFORGE/main/image/conv2.cc
ln -s $OCTAVEFORGE/main/image/cordflt2.cc
ln -s $OCTAVEFORGE/main/image/bwfill.cc
ln -s $OCTAVEFORGE/main/image/bwlabel.cc
ln -s $OCTAVEFORGE/main/image/jpgread.cc
ln -s $OCTAVEFORGE/main/image/jpgwrite.cc
ln -s $OCTAVEFORGE/main/optim/leval.cc
ln -s $OCTAVEFORGE/main/optim/lp.cc
ln -s $OCTAVEFORGE/main/specfun/ellipj.cc
ln -s $OCTAVEFORGE/main/sparse/complex_sparse_ops.cc
ln -s $OCTAVEFORGE/main/sparse/make_sparse.cc
ln -s $OCTAVEFORGE/main/sparse/make_sparse.h
ln -s $OCTAVEFORGE/main/sparse/sparse_full.cc
ln -s $OCTAVEFORGE/main/sparse/sparse_inv.cc
ln -s $OCTAVEFORGE/main/sparse/sparse_ops.cc
ln -s $OCTAVEFORGE/main/sparse/sparse_ops.h
ln -s $OCTAVEFORGE/main/signal/medfilt1.cc
ln -s $OCTAVEFORGE/main/signal/remez.cc
ln -s $OCTAVEFORGE/main/splines/pchip_deriv.cc
ln -s $OCTAVEFORGE/main/splines/trisolve.cc
ln -s $OCTAVEFORGE/main/strings/regexp.cc
ln -s $OCTAVEFORGE/main/struct/getfield.cc
ln -s $OCTAVEFORGE/main/struct/setfield.cc
ln -s $OCTAVEFORGE/extra/linear-algebra/ov-re-tri.cc
ln -s $OCTAVEFORGE/extra/linear-algebra/ov-re-tri.h
ln -s $OCTAVEFORGE/extra/testfun/pretty.cc
ln -s $OCTAVEFORGE/extra/symband/SymBand.cc
rm rand.cc
ln -s $OCTAVEFORGE/FIXES/rand.cc
ln -s $OCTAVEFORGE/FIXES/MersenneTwister.h
# rm fsolve.cc # fsolve hasn't been fixed for 2.1.42
# ln -s $OCTAVEFORGE/FIXES/fsolve.cc
rm log.cc
ln -s $OCTAVEFORGE/FIXES/logm.cc
ln -s $OCTAVEFORGE/FIXES/sqrtm.cc
#ln -s $OCTAVEFORGE/extra/mex/mex.cc
ln -s $OCTAVEFORGE/extra/Windows/grab.cc
ln -s $OCTAVEFORGE/extra/Windows/grab_win32part.cc
ln -s $OCTAVEFORGE/extra/Windows/win32api.cc
ln -s $OCTAVEFORGE/extra/Windows/win32api_win32part.cc


3. BUID ATLAS INTO OCTAVE

    cd /usr/src
    wget http://prdownloads.sf.net/math-atlas/atlas3.2.1.tar.bz2
    tar xvfj atlas3.4.1.tar.bz2
    cd ATLAS
    make config
    #### ANSWER LOTS OF QUESTIONS
    make install arch=WinNT_P4SSE1

    cd /usr/src/octave-2.1.42
    cd libcruft/
    mkdir tmp
    cd tmp
    ar x ../libcruft.a
    for i in atlas.a lapack.a cblas.a f77blas.a ; do
       ar x ../../../ATLAS/lib/WinNT_P4SSE1/lib$i
    done
    cd ..
    rm libcruft.a ; ar rc libcruft.a tmp/*.o
    cd ..
    make

4. BUILD / INSTALL OCTAVE

cd /usr/src/octave-2.1.42
make install
#make install-strip - doesn't work for some octave subdirectories
strip /usr/bin/octave*
find /usr/share/octave -type f | xargs strip


4. COPY *.M FILES INTO PLACE

OCTAVEM=/usr/share/octave/2.1.42/m/
mkdir -p  $OCTAVEM/image
mkdir -p  $OCTAVEM/integration
mkdir -p  $OCTAVEM/ode
mkdir -p  $OCTAVEM/testfun
mkdir -p  $OCTAVEM/comm
mkdir -p  $OCTAVEM/control
mkdir -p  $OCTAVEM/ident
mkdir -p  $OCTAVEM/image
mkdir -p  $OCTAVEM/io
mkdir -p  $OCTAVEM/linear-algebra
mkdir -p  $OCTAVEM/miscellaneous
mkdir -p  $OCTAVEM/optim
mkdir -p  $OCTAVEM/path
mkdir -p  $OCTAVEM/plot
mkdir -p  $OCTAVEM/set
mkdir -p  $OCTAVEM/signal
mkdir -p  $OCTAVEM/sparse
mkdir -p  $OCTAVEM/specfun
mkdir -p  $OCTAVEM/special-matrix
mkdir -p  $OCTAVEM/splines
mkdir -p  $OCTAVEM/statistics
mkdir -p  $OCTAVEM/strings
mkdir -p  $OCTAVEM/struct
mkdir -p  $OCTAVEM/symband
mkdir -p  $OCTAVEM/time
mkdir -p  $OCTAVEM/tsa

cp -r $OCTAVEFORGE/extra/Windows/*.m  $OCTAVEM/general
cp -r $OCTAVEFORGE/extra/integration/*.m  $OCTAVEM/integration
cp -r $OCTAVEFORGE/extra/ode/*.m  $OCTAVEM/ode
cp -r $OCTAVEFORGE/extra/testfun/*.m  $OCTAVEM/testfun
cp -r $OCTAVEFORGE/extra/tsa/*.m  $OCTAVEM/tsa
cp -r $OCTAVEFORGE/extra/symband/*.m  $OCTAVEM/symband
cp -r $OCTAVEFORGE/main/comm/*.m  $OCTAVEM/comm
cp -r $OCTAVEFORGE/main/control/*.m  $OCTAVEM/control
cp -r $OCTAVEFORGE/main/general/*.m  $OCTAVEM/general
cp -r $OCTAVEFORGE/main/ident/*.m  $OCTAVEM/ident
cp -r $OCTAVEFORGE/main/image/*.m  $OCTAVEM/image
cp -r $OCTAVEFORGE/main/io/*.m  $OCTAVEM/io
cp -r $OCTAVEFORGE/main/linear-algebra/*.m  $OCTAVEM/linear-algebra
cp -r $OCTAVEFORGE/main/miscellaneous/*.m  $OCTAVEM/miscellaneous
cp -r $OCTAVEFORGE/main/optim/*.m  $OCTAVEM/optim
cp -r $OCTAVEFORGE/main/path/*.m  $OCTAVEM/path
cp -r $OCTAVEFORGE/main/plot/*.m  $OCTAVEM/plot
cp -r $OCTAVEFORGE/main/set/*.m  $OCTAVEM/set
cp -r $OCTAVEFORGE/main/signal/*.m  $OCTAVEM/signal
cp -r $OCTAVEFORGE/main/sparse/*.m  $OCTAVEM/sparse
cp -r $OCTAVEFORGE/main/specfun/*.m  $OCTAVEM/specfun
cp -r $OCTAVEFORGE/main/special-matrix/*.m  $OCTAVEM/special-matrix
cp -r $OCTAVEFORGE/main/splines/*.m  $OCTAVEM/splines
cp -r $OCTAVEFORGE/main/statistics/*.m  $OCTAVEM/statistics
cp -r $OCTAVEFORGE/main/strings/*.m  $OCTAVEM/strings
cp -r $OCTAVEFORGE/main/struct/*.m  $OCTAVEM/struct
cp -r $OCTAVEFORGE/main/time/*.m  $OCTAVEM/time

ADD EPSTK

Download epstk files from www.epstk.de.
Unpack files to /usr/share/octave/site/m/epstk

Modify einit.m to take current binary for gswin

GENERATE CYGWIN PACKAGE

VER=2.1.42
tar cvfj octave-$VER-gnuplot-octaveforge.tar.bz2 \
         /usr/bin/octave \
         /usr/bin/octave-$VER* \
         /usr/bin/octave-bug \
         /usr/bin/octave-bug-$VER* \
         /usr/bin/octave-config \
         /usr/bin/octave-config-$VER* \
         /usr/bin/mkoctfile \
         /usr/bin/mkoctfile-$VER* \
         /usr/bin/pgnuplot.exe \
         /usr/bin/wgnuplot.exe \
         /usr/info/octave.info* \
         /usr/man/man1/octave* \
         /usr/share/octave/site/ \
         /usr/share/octave/$VER/ \
         /usr/doc/octave-$VER/


## NOTES: These *.cc files are not included in this build
## for the following reasons

extra/linear-algebra/chol.cc
  - this doesn't seem complete to me - I'm reluctant to
    override the chol in octave for this

extra/mex/mex.cc
  - this is a staticaly linked build - so mex capability
    doesn't help

extra/tk_octave/tk_interp.cc
  - this is fairly complicated build - I don't know how
    to do this right now.

main/audio/aurecord.cc
main/audio/endpoint.cc
  - audio for octave on cygwin doesn't seem to work

main/geometry/__voronoi__.cc
main/geometry/convhulln.cc
main/geometry/delaunayn.cc
  - this depends on qhull - I haven't looked into this - 
    I'm not sure if the extra size is worth it.
  
main/plot/grab.cc
main/plot/graphics.cc
main/plot/gtext.cc
main/plot/gzoom.cc
main/plot/ginput.cc
  - graphics functions are tied to X11 - we need some
    windows replacements

main/strings/regexp.cc
main/struct/getfield.cc
main/struct/setfield.cc
main/symbolic/differentiate.cc
main/symbolic/op-ex-mat.cc
main/symbolic/op-ex.cc
main/symbolic/op-sym.cc
main/symbolic/op-vpa.cc
main/symbolic/ov-ex-mat.cc
main/symbolic/ov-ex.cc
main/symbolic/ov-relational.cc
main/symbolic/ov-sym.cc
main/symbolic/ov-vpa.cc
main/symbolic/probably_prime.cc
main/symbolic/sym-bool.cc
main/symbolic/sym-create.cc
main/symbolic/symbols.cc
  - these depend on the GiNac library 
     which is not included with octave-forge

nonfree/gpc/gpc_clip.cc
nonfree/gpc/gpc_create.cc
nonfree/gpc/gpc_get.cc
nonfree/gpc/gpc_is_polygon.cc
nonfree/gpc/gpc_read.cc
nonfree/gpc/gpc_tristrip.cc
nonfree/gpc/gpc_write.cc
nonfree/gpc/octave-gpc.cc
nonfree/splines/gcvspl.cc
  - I don't consider these licenses GPL compatible - so they
    can't be linked to octave

## NOTES: These directories of *m files are not included

extra/NaN
- overwrites octave stat functions - do we want this
extra/civil
- too specialized? seems perhaps incomplete
extra/engine
- won't work without DLD
extra/fake-sparse
- we have real sparse
extra/integration/test
extra/integration/testfun
- I think the test functions aren't necessary for the install
extra/linear-algebra
- All *.cc files
extra/mex
- won't work without DLD
extra/patches
- not applied for this package
extra/pdb
extra/pdb/bin
extra/pdb/data
- too specialized?
extra/perl
- too specialized? - needs to be installed into perl
extra/symband
- install except Example* files
extra/tk_octave
- won't work without DLD?
extra/ver20
- not for 2.1.* build
main/audio
main/audio/bin
main/audio/data
- can't make audio work under cygwin - yet
main/optim/doc
main/symbolic
main/symbolic/doc
- looks like quite a bit of work - later ...

NOTES:

How to link windows resources to octave
information from www.cygwin.com/cygwin-ug-net/programming.html

   1. BUILD A SIMPLE RESOURCE FILE

   octave.rc 
   ----
    IDR_MAINFRAME ICON    DISCARDABLE     "octave.ico"

    VS_VERSION_INFO VERSIONINFO
      FILEVERSION   2,1,42,1

    BEGIN
      BLOCK "StringFileInfo"
      BEGIN
        BLOCK "040904b0"
        BEGIN
          VALUE "FileDescription","Octave Version 2.1.42\0"
        END
      END
    END
   ----

   2. COMPILE

   windres octave.rc -O coff -o octave.res
   
   Now, add octave.res to link
   gcc octave.c octave.res -o octave.exe