MinGW32 with alpha-dsk


Compilation Policy
The final outputs (flow_se and flow_ig) must be independent of the following Windows DLLs: Then, complication with "-static-libgcc", and msys related libraries are installed from source code.

Install MinGW
Install following packages from mingw-get.exe (version 0.6.2-beta-20131004-1).
important assuming the working directory is $HOME/tmp.

Preparation
Open the msys.bat (normally, c:¥MinGW¥msys¥1.0¥msys.bat), and execute the following commands:
[~]$ mkdir tmp
[~]$ cd tmp
[~/tmp]$ export PATH=/c/MinGW/bin:/usr/local/bin:$PATH
[~/tmp]$ mingw-get install msys-wget
[~/tmp]$ mingw-get install msys-unzip
[~/tmp]$ mingw-get install msys-patch
Install lua
[~/tmp]$ wget http://www.lua.org/ftp/lua-5.3.1.tar.gz
[~/tmp]$ tar zxvf lua-5.3.1.tar.gz
[~/tmp]$ cd lua-5.3.1
[~/tmp/lua-5.3.1]$ make mingw
[~/tmp/lua-5.3.1]$ make install
[~/tmp/lua-5.3.1]$ cp src/lua53.dll /usr/local/bin/
[~/tmp/lua-5.3.1]$ cd ..

Install libxml2
[~/tmp]$ wget ftp://xmlsoft.org/libxml2/libxml2-git-snapshot.tar.gz
[~/tmp]$ tar zxvf libxml2-git-snapshot.tar.gz
[~/tmp]$ cd libxml2*
[~/tmp/libxml2-2.9.2]$ CC="gcc -static-libgcc" ./configure
[~/tmp/libxml2-2.9.2]$ make
[~/tmp/libxml2-2.9.2]$ make install
[~/tmp/libxml2-2.9.2]$ cd ..

Install regex
[~/tmp]$ mingw-get source msys-regex
[~/tmp]$ tar xvf regex-20090805.tar.xz
[~/tmp]$ cd regex-20090805
[~/tmp/regex-20090805]$ CC="gcc -static-libgcc" ./configure
[~/tmp/regex-20090805]$ make
[~/tmp/regex-20090805]$ make install
[~/tmp/regex-20090805]$ cd ..

Install pthread
Do not ask why you must do 'make package' three times. Also, LFLAGS is not a typo of LDFLAGS.
[~/tmp]$ mingw-get source mingw32-libpthreadgc
[~/tmp]$ cd pthreads-w32-2.9.1-1-mingw32
[~/tmp/pthreads-w32-2.9.1-1-mingw32]$ make clean
[~/tmp/pthreads-w32-2.9.1-1-mingw32]$ PTW32_FLAGS="-static-libgcc" LFLAGS="-static-libgcc" make package
[~/tmp/pthreads-w32-2.9.1-1-mingw32]$ PTW32_FLAGS="-static-libgcc" LFLAGS="-static-libgcc" make package
[~/tmp/pthreads-w32-2.9.1-1-mingw32]$ PTW32_FLAGS="-static-libgcc" LFLAGS="-static-libgcc" make package
[~/tmp/pthreads-w32-2.9.1-1-mingw32]$ make install PREFIX=/usr/local
[~/tmp/pthreads-w32-2.9.1-1-mingw32]$ cd ..

Install zlib
[~/tmp]$ mingw-get source mingw32-zlib
[~/tmp]$ cd zlib-1.2.8-1-mingw32
[~/tmp/zlib-1.2.8-1-mingw32]$ make clean
[~/tmp/zlib-1.2.8-1-mingw32]$ LOC="-static-libgcc" make package
[~/tmp/zlib-1.2.8-1-mingw32]$ make install PREFIX=/usr/local
[~/tmp/zlib-1.2.8-1-mingw32]$ cd ..

Install pkg-config
[~/tmp]$ wget http://pkgconfig.freedesktop.org/releases/pkg-config-0.28.tar.gz
[~/tmp]$ tar zxvf pkg-config-0.28.tar.gz
[~/tmp/pkg-config-0.28]$ ./configure --with-internal-glib
[~/tmp/pkg-config-0.28]$ make
[~/tmp/pkg-config-0.28]$ make install
[~/tmp/pkg-config-0.28]$ cd ..

Install libpng
[~/tmp] tar zxvf (somewhere)/libpng-1.6.18.tar.gz
[~/tmp] cd libpng-1.6.18
[~/tmp/libpng-1.6.18] CC="gcc -static-libgcc" CFLAGS="-I/usr/local/include" CPPFLAGS="-I/usr/local/include" LDFLAGS="-L/usr/local/lib" ./configure
[~/tmp/libpng-1.6.18] make
[~/tmp/libpng-1.6.18] make test
[~/tmp/libpng-1.6.18] make install
[~/tmp/libpng-1.6.18] cd ..

Install jpeglib
[~/tmp]$ wget http://www.ijg.org/files/jpegsrc.v9a.tar.gz
[~/tmp]$ tar zxvf jpegsrc.v9a.tar.gz
[~/tmp]$ cd jpeg-9a
[~/tmp/jpeg-9a]$ CC="gcc -static-libgcc" ./configure
[~/tmp/jpeg-9a]$ make
[~/tmp/jpeg-9a]$ make test
[~/tmp/jpeg-9a]$ make install
[~/tmp/jpeg-9a]$ cd ..

Install libcurl
[~/tmp]$ wget http://curl.haxx.se/download/curl-7.44.0.tar.gz
[~/tmp]$ tar zxvf curl-7.44.0.tar.gz
[~/tmp]$ cd curl-7.44.0
[~/tmp/cd curl-7.44.0] CC="gcc -static-libgcc" ./configure
[~/tmp/cd curl-7.44.0] make
[~/tmp/cd curl-7.44.0] make install
[~/tmp/cd curl-7.44.0] cd ..

Install cfitsio
[~/tmp]$ wget ftp://heasarc.gsfc.nasa.gov/software/fitsio/c/cfitsio3370.tar.gz
[~/tmp]$ tar zxvf cfitsio3370.tar.gz
[~/tmp]$ cd cfitsio
[~/tmp/cfitsio]$ CC="gcc -static-libgcc" ./configure
[~/tmp/cfitsio]$ make
[~/tmp/cfitsio]$ make install
[~/tmp/cfitsio]$ cd ..

Install SPICE Toolkits for C (alpha_dsk_c)
[~/tmp]$ wget 'http://naif.jpl.nasa.gov/pub/naif/misc/alpha_dsk/C/PC_Windows_VisualC_32bit/packages/alpha_dsk_c.zip'
[~/tmp]$ unzip alpha_dsk_c.zip
[~/tmp]$ cd alpha_dsk_c/src/cspice
[~/tmp/alpha_dsk_c/src/cspice]$ find . -name "*.c" -ls -exec gcc -c -D_COMPLEX_DEFINED -DMSDOS -DOMIT_BLANK_CC {} \;
[~/tmp/alpha_dsk_c/src/cspice]$ ar crv ../../lib/cspice.a *.o
[~/tmp/alpha_dsk_c/src/cspice]$ ranlib ../../lib/cspice.a
[~/tmp/alpha_dsk_c/src/cspice]$ cd ../dsklib_c
[~/tmp/alpha_dsk_c/src/dsklib_c]$ find . -name "*.c" -ls -exec gcc -c -D_COMPLEX_DEFINED -DMSDOS -DOMIT_BLANK_CC {} \;
[~/tmp/alpha_dsk_c/src/dsklib_c]$ ar crv ../../lib/dsklib_c.a *.o
[~/tmp/alpha_dsk_c/src/dsklib_c]$ ranlib ../../lib/dsklib_c.a
[~/tmp/alpha_dsk_c/src/dsklib_c]$ cd ~/tmp

Install "FLOW"
[~/tmp]$ wget http://darts.isas.jaxa.jp/planet/tools/flow/flow-1.3.tar.gz
[~/tmp]$ tar zxvf flow-1.3.tar.gz
[~/tmp/flow-1.3]$ CC="gcc -static-libgcc" CFLAGS="-I/usr/local/include" LIBS="-L/usr/local/lib -lregex -lpthreadGC2" \
./configure \
--with-cspice=$HOME/tmp/alpha_dsk_c \
--with-lua-prefix=/usr/local \
--with-cfitsio=$HOME/tmp/cfitsio \
--enable-wms \
--enable-spice-dsk \
--with-libjpeg=/usr/local
[~/tmp/flow-1.3]$ make
[~/tmp/flow-1.3]$ make install

license and policy

darts c-soda isas jaxa