Codebase list swi-prolog / upstream/5.10.5 README.mingw32
upstream/5.10.5

Tree @upstream/5.10.5 (Download .tar.gz)

README.mingw32 @upstream/5.10.5raw · history · blame

Compiling SWI-Prolog using MinGW
--------------------------------

Below are some notes from Roberto Bagnara to compile a static version of
SWI-Prolog using the MinGW cross-compiler  on   a  Linux system. Roberto
submitted patches to 5.11.22 and 5.11.23 to   get the core Prolog system
compiled using MinGW.

Ideally, it should be possible to compile  the entire suite using MinGW,
either natively on Windows or cross-compile   it from e.g., Linux. Using
MinGW would eliminate the need to  maintain   two  sets of Makefiles and
achieves a much more lightweight and   truly  free development toolchain
for SWI-Prolog on Windows.  There is a lot to do:

    - Build a dll
    - Make the packages portable.  Most of the work is similar as for
      the kernel: identify the places where the __WINDOWS__ preprocessor
      symbol is used for MSVC rather than Windows and replace this by
      _MSC_VER and/or __MINGW32__.

================================================================

Download and install the Pthreads-win32 library.  Select a directory
to hold its sources, call it $src, and then:

cd $src
wget -c ftp://sourceware.org/pub/pthreads-win32/pthreads-w32-2-8-0-release.tar.gz

Select a build directory and an installation directory, call them $build
and $install; then:

cd $build
tar xzf $src/pthreads-w32-2-8-0-release.tar.gz
cd pthreads-w32-2-8-0
make -f GNUmakefile CROSS=i586-mingw32msvc- GC-static
mkdir -p $install/include
mkdir -p $install/lib
cp pthread.h semaphore.h sched.h $install/include/
cp libpthreadGC2.a $install/lib/

Download and install the GMP library.  Select a directory
to hold its sources and one (possibly the same) to make the build;
call them $src and $build.  Then:

$ cd $src
$ tar jxf gmp-5.0.2.tar.bz2
$ cd $build
$ $src/configure --host=i586-mingw32msvc --prefix=$install
$ make
$ make check
$ make install

Download and unpack a SWI-Prolog source distribution.  Do a `cd' in
the distribution's top directory and then:

export CIFLAGS="-I$install/include -DPTW32_STATIC_LIB"
export LDFLAGS="-L$install/lib"
./configure --host=i586-mingw32msvc --prefix=$install --disable-readline --disable-libdirversion --disable-shared
make