• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..03-May-2022-

bench/H23-Nov-2020-7,2106,244

boot/H23-Nov-2020-17,95015,579

cmake/H03-May-2022-2,7142,279

customize/H23-Nov-2020-278200

debian/H23-Nov-2020-

demo/H23-Nov-2020-7961

doc/H23-Nov-2020-245166

library/H23-Nov-2020-79,19266,324

man/H07-May-2022-40,19233,681

packages/H03-May-2022-765,361610,867

scripts/H23-Nov-2020-2,3251,718

snap/H23-Nov-2020-230198

src/H03-May-2022-275,413212,976

.clang-formatH A D23-Nov-20202.6 KiB9189

.fileheaderH A D23-Nov-20201.5 KiB3528

.gitignoreH A D23-Nov-20203.2 KiB171167

.gitmodulesH A D23-Nov-20202.9 KiB112111

.travis.ymlH A D23-Nov-20201.7 KiB7568

CMAKE.mdH A D23-Nov-202017.2 KiB441331

Code-of-Conduct.mdH A D23-Nov-20203.3 KiB7857

INSTALLH A D23-Nov-2020481 139

LICENSEH A D23-Nov-20201.8 KiB4232

README.mdH A D23-Nov-20201.8 KiB5235

README.mingwH A D23-Nov-202014.2 KiB584346

VERSIONH A D23-Nov-20206 21

swipl.rcH A D23-Nov-20205.3 KiB137114

README.md

1# SWI-Prolog: A comprehensive Prolog implementation
2
3## Forking, cloning and submitting patches
4
5This repositories uses many [Git
6submodules](https://git-scm.com/book/en/v1/Git-Tools-Submodules). This
7causes the common issue that __fork and clone doesn't work__. Instead, _clone_ from
8https://github.com/SWI-Prolog/swipl-devel.git and then associate your
9clone with your _fork_ (replace `me` with your github user name).
10
11    git clone https://github.com/SWI-Prolog/swipl-devel.git
12    cd swipl-devel
13    git submodule update --init
14    git remote add myfork git@github.com:me/swipl-devel.git
15
16See [How to submit a patch](http://www.swi-prolog.org/howto/SubmitPatch.html)
17for details.
18
19See also the discussion at
20[Being friendly to quick contributions](https://swi-prolog.discourse.group/t/being-friendly-to-quick-contributions/493/6)
21
22## Building
23
24See
25[CMAKE.md](https://github.com/SWI-Prolog/swipl-devel/blob/master/CMAKE.md)
26and [Build SWI-Prolog from source](http://www.swi-prolog.org/build/)
27
28
29## Web home
30
31Please find the up-to-date information on SWI-Prolog at
32http://www.swi-prolog.org.
33
34## Documentation
35
36Documentation is available from several locations and in several formats.
37
38  - Paper format can be ordered as [print on
39  demand](http://books.google.de/books?id=7AeiAwAAQBAJ&hl=en) and is
40  available as PDF from the [download
41  page](http://www.swi-prolog.org/download/devel).
42
43  - Several tutorials can be accessed from the __Tutorials__ menu on
44  the [home page](http://www.swi-prolog.org)
45
46  - A HTML version of the documentation is in the `doc/Manual` directory
47  of the installation.  Note that some packagers put this documentation
48  elsewhere or require it to be installed separately.
49
50You can also install the website locally to use its complete functionality if you are
51offline. It is available at https://github.com/SWI-Prolog/plweb.
52

README.mingw

1#!/bin/bash
2
3# Compiling SWI-Prolog using MinGW
4# --------------------------------
5#
6# This file provides an overview for building SWI-Prolog using MinGW, in
7# particular using the cross-compilers that   are  distributed with most
8# todays Linux distributions. This  work  is   mostly  done  by  Roberto
9# Bagnara (initial port of the Prolog   kernel), Abramo Bagnara and Keri
10# Harris.
11#
12# The current releases are  configured  and   build  using  CMake.  As a
13# result, this README only applies for   building the PREREQUISITES. See
14# CMAKE.md and/or scripts/make-distribution for configuring and building
15# SWI-Prolog.
16#
17# USE DOCKER INSTEAD
18#
19# These instructions are only required if  you   want  to  build in your
20# local (Linux) environment. We have created   a  Docker image for doing
21# the build which is a lot easier to manage. See:
22#
23#   https://github.com/SWI-Prolog/docker-swipl-build-mingw.git
24#
25# USAGE
26#
27# You have been warned! Make sure  to  have   a  lot  of time and coffee
28# before proceeding.
29#
30# The remainder of the  file  is   an  executable  specification  of the
31# installation process. The setup is designed to create ~/mingw32 and/or
32# ~/mingw64 for building and installing   the prerequisites. We describe
33# the setup for Win64. Simply replace  64   with  32 to build for 32-bit
34# Windows. First, install the requires tools from the Linux packages:
35#
36#    % sudo apt-get install wine wine-binfmt mingw-w64
37#    % sudo apt-get install cmake ninja-build nsis
38#
39# Next, create and prepare the prerequisite location (the script changes
40# your prompt to `W64`
41#
42#    % cd ~
43#    % mkdir -p mingw64/src
44#    % cd mingw64/src
45#    % source <path/to/swipl-devel/README.mingw win64
46#    W64 download_prerequisites
47#
48# Unfortunately some of the download locations  tend to be unreliable or
49# require some registration or acceptance  of   license.  So,  check for
50# empty .tar.gz files and try  to  get   the  archive  by  hand from the
51# internet. Than re-run ``download_<package>`` to extract the archive.
52#
53# Once all is there, get the MinGW   runtime  libs in `bin`. The details
54# may depend on exact versions of MinGW, so please check.
55#
56#    % mkdir -p ~/mingw64/bin
57#    % cd ~/mingw64/bin
58#    % cp /usr/x86_64-w64-mingw32/lib/libwinpthread-1.dll .
59#    % cp /usr/lib/gcc/x86_64-w64-mingw32/9.2-win32/libgcc_s_seh-1.dll .
60#
61# Now, build the prerequisites:
62#
63#    W64 build_prerequisites
64#
65# If this worked successfully, build SWI-Prolog.   Below  is the default
66# command, see CMAKE.md for various options:
67#
68#    % cd /path/to/swipl-devel
69#    % mkdir build.win64
70#    % cd build.win64
71#    % cmake -DCMAKE_BUILD_TYPE=Release \
72#         -DCMAKE_TOOLCHAIN_FILE=../cmake/cross/linux_win64.cmake \
73#         -DJAVA_COMPATIBILITY=ON \
74#         -G Ninja ..
75#    % ninja
76#
77# If this succeeds you should be   able  to run `./src/swipl-win.exe` or
78# `./src/swipl.exe`
79#
80# To build an installer for installation on other systems, run
81#
82#    % cpack
83#
84#
85# PREREQUISITES
86#
87# The open source libraries on which   SWI-Prolog depends are downloaded
88# and   built   using   the   functions   download_prerequisites()   and
89# build_prerequisites().  In  addition,  the  following    need   to  be
90# installed:
91#
92#   - The Oracle Java SDK for building JPL
93#	- jdk-<version>-windows-i586.exe into
94#	  /C/Program Files (x86)/... (default on 64-bit Windows)
95#	- jdk-<version>-windows-x64.exe into
96#	  /C/Program Files/... (default on 64-bit Windows)
97
98TARGETHOST="$1"
99MAKE="make -j 4"
100
101case "$TARGETHOST" in
102    win64) BITS=64
103	 ;;
104    win32) BITS=32
105	 ;;
106    *)	   echo "Please run as . $BASH_SOURCE 'win32|win64'"
107	   return
108esac
109
110PS1=W$BITS' (\W\[\e[36m\]$(__git_ps1 "; %s")\[\e[0m\]) \!_> '
111
112export BUILDARCH=$TARGETHOST
113
114# Versions of prerequisite packages. Used to  download the right release
115# file.
116
117GMP_VERSION=6.1.2
118PTHREADS_VERSION=2-9-1-release
119LIBDWARF_VERSION=20120410
120SSL_VERSION=1.1.1d
121JPEG_VERSION=9b
122ZLIB_VERSION=1.2.11
123ARCHIVE_VERSION=3.4.0
124UUID_VERSION=1.6.2
125BDB_VERSION=6.1.26
126PCRE_VERSION=8.43
127FFI_VERSION=3.3
128YAML_VERSION=0.2.2
129PLDIR=pl-devel
130
131# installation prefix.  This path should not have spaces in one of the
132# directory names.
133
134install="${install-$HOME/mingw$BITS}"
135src="$(pwd)"
136PATH=$install/swipl/bin:$PATH
137
138# Check whether we are cross-compiling or running under MSYS in Windows.
139# Note that the MSYS version has not yet been tested.
140
141case "$(uname)" in
142    MINGW*)
143	CROSSCOMPILING=no
144	export PATH=$install/bin:$PATH
145	DRIVEC="/C"
146	MINGWGCC=gcc
147	;;
148    *)
149	export CROSSCOMPILING=yes
150	export WINEDEBUG=-all
151	DRIVEC="$HOME/.wine/drive_c"
152	export WINEPATH="$(winepath -w $install/bin)"
153	;;
154esac
155
156if [ "$CROSSCOMPILING" = yes ]; then
157  if [ -z "$CROSS" ]; then
158    case $TARGETHOST in
159      win64)
160	CROSS=x86_64-w64-mingw32
161	;;
162      win32)
163        if [ -r /usr/bin/i686-w64-mingw32-gcc ]; then
164	  CROSS=i686-w64-mingw32
165	else
166	  CROSS=i586-mingw32msvc
167	fi
168	;;
169    esac
170  fi
171  MINGWGCC=$CROSS-gcc
172  export WINDRES=$CROSS-windres
173fi
174
175# See whether pthread is built-in
176
177if [ -r "$($MINGWGCC -print-file-name=libwinpthread-1.dll)" ]; then
178  PTHREADS_VERSION=
179fi
180
181# Java configuration
182# Note that Win64 javac and javadoc crash under Wine (1.5.6).  But, we
183# can use the native Linux versions
184
185if [ -z "$JAVAROOT" ]; then
186  case $TARGETHOST in
187    win64)
188      JAVAROOT="$DRIVEC/Program Files/Java"
189      if [ "$CROSSCOMPILING" = yes ]; then
190        export JAVAC=javac
191	export JAVADOC=javadoc
192      fi
193      ;;
194    win32)
195      JAVAROOT="$DRIVEC/Program Files (x86)/Java"
196      ;;
197  esac
198fi
199JAVAPREFIX="$(echo "$JAVAROOT"/jdk*)/bin"
200export JAVAPREFIX
201
202# Set some variables to find the Windows libraries and include files
203
204# export COFLAGS=-g
205export CIFLAGS="-I$install/include"
206export CPPFLAGS=-I$install/include
207export LDFLAGS="-L$install/lib"
208export PKGLDFLAGS=-I$install/lib
209
210
211################################################################
212# end of gathering info about the environment; the remainder are
213# functions that perform steps of the build process
214################################################################
215
216################
217# Handy for running autoconf from a directory
218
219config()
220{ if [ -r ./configure ]; then
221    ./configure --host=$CROSS --prefix=$install
222  elif  [ -r ../src/configure ]; then
223    ./configure --host=$CROSS --prefix=$install
224  fi
225}
226
227
228################
229# Create target directories
230
231make_mingw_dirs()
232{ mkdir -p $install/include
233  mkdir -p $install/lib
234  mkdir -p $install/bin
235}
236
237
238###########################
239# Download and install the GMP library.
240
241download_gmp()
242{ GMP_FILE=gmp-$GMP_VERSION.tar.bz2
243
244  [ -f $GMP_FILE ] || \
245    wget ftp://ftp.gmplib.org/pub/gmp-$GMP_VERSION/$GMP_FILE
246  tar jxf $GMP_FILE
247}
248
249build_gmp()
250{ ( cd gmp-$GMP_VERSION
251    ./configure --host=$CROSS --prefix=$install \
252       --enable-shared --disable-static
253    make
254    make install
255  )
256}
257
258###########################
259# Download and install the Pthreads-win32 library.  Only if PTHREADS_VERSION
260# is set. Else we assume a recent MinGW64, which ships with
261# libwinpthread
262
263download_pthread_win32()
264{ if [ ! -z "$PTHREADS_VERSION" ]; then
265    PTHREADS_FILE=pthreads-w32-$PTHREADS_VERSION.tar.gz
266
267    cd $src
268    [ -f $PTHREADS_FILE ] || \
269      wget ftp://sourceware.org/pub/pthreads-win32/$PTHREADS_FILE
270
271    tar xzf $PTHREADS_FILE
272  fi
273}
274
275build_pthread_win32()
276{ if [ -d pthreads-w32-$PTHREADS_VERSION ]; then
277    ( cd pthreads-w32-$PTHREADS_VERSION
278      make -f GNUmakefile CROSS=$CROSS- \
279	  LFLAGS="-lwsock32 -Wl,--out-implib=libpthreadGC2.dll.a" GC
280      cp pthread.h semaphore.h sched.h $install/include/
281      cp pthreadGC2.dll $install/bin/
282      cp libpthreadGC2.dll.a $install/lib/
283    )
284  fi
285}
286
287###########################
288# Download and install the DWARF debugging library.
289
290download_libdwarf()
291{ LIBDWARF_FILE=libdwarf-$LIBDWARF_VERSION.tar.gz
292
293  [ -f $LIBDWARF_FILE ] || \
294    wget http://www.prevanders.net/$LIBDWARF_FILE
295  tar xzf $LIBDWARF_FILE
296}
297
298build_libdwarf()
299{ ( cd dwarf-$LIBDWARF_VERSION/libdwarf
300    ./configure --host=$CROSS --enable-shared
301    sed -i -e "s|libdwarf.so|libdwarf.dll|" \
302           -e "s|\$(CFLAGS) -shared|\$(LDFLAGS) -shared|" \
303           -e "/_elf_/d" -e "/[ \t]pro_/d" -e "/dwarf_addr_finder/d" Makefile
304    make PRELIBS="-Wl,--out-implib=libdwarf.dll.a"
305    mkdir -p $install/bin
306    cp libdwarf.dll $install/bin/
307    mkdir -p $install/lib
308    cp libdwarf.a libdwarf.dll.a $install/lib/
309    mkdir -p $install/include
310    cp dwarf.h libdwarf.h $install/include
311  )
312}
313
314###########################
315# Download and install ssl
316
317download_ssl()
318{ SSL_FILE=openssl-$SSL_VERSION.tar.gz
319  [ -f $SSL_FILE ] || wget http://www.openssl.org/source/$SSL_FILE
320  tar xzf $SSL_FILE
321}
322
323build_ssl()
324{ ( cd openssl-$SSL_VERSION
325    export CC=$MINGWGCC
326    case $CROSS in
327	i?86*)	 MINGW=mingw
328		 ;;
329	x86_64*) MINGW=mingw64
330		 ;;
331	*)	 echo "SSL: Unknown CROSS: $CROSS"
332		 exit 1
333		 ;;
334    esac;
335    ./Configure $MINGW --prefix=$install shared threads
336    make depend
337    make
338    make install_sw
339  )
340}
341
342###########################
343# Download and install BerkeleyDB
344# http://www.oracle.com/technetwork/database/database-technologies/berkeleydb/overview/index.html
345
346download_libdb()
347{ BDB_FILE=db-$BDB_VERSION.tar.gz
348
349  [ -f $BDB_FILE ] || \
350  curl http://download.oracle.com/berkeley-db/$BDB_FILE > $BDB_FILE
351  tar zxvf $BDB_FILE
352}
353
354build_libdb()
355{ ( cd db-$BDB_VERSION/build_unix
356    sed -i -e "s:WinIoCtl.h:winioctl.h:" ../src/dbinc/win_db.h
357    ../dist/configure --enable-mingw --host=$CROSS --prefix=$install \
358       --enable-shared --disable-static
359    make library_build
360    make install_lib install_include
361    ( cd $install/lib
362      [ -f libdb.dll.a ] || ln -s libdb-*.dll.a libdb.dll.a
363      [ -f libdb.la ] || ln -s libdb-*.la libdb.la
364    )
365  )
366}
367
368###########################
369# Download and install jpeg
370
371download_jpeg()
372{ JPEG_FILE=jpegsrc.v$JPEG_VERSION.tar.gz
373
374  [ -f $JPEG_FILE ] || wget http://www.ijg.org/files/$JPEG_FILE
375  tar xzf $JPEG_FILE
376}
377
378build_jpeg()
379{ ( cd jpeg-$JPEG_VERSION
380    ./configure --host=$CROSS --prefix=$install --enable-shared
381    make
382    make install
383  )
384}
385
386###########################
387# Download and install libXpm
388
389download_libxpm()
390{ if [ -d libXpm ]; then
391     (cd libXpm && git pull)
392  else
393     git clone https://github.com/SWI-Prolog/libXpm.git
394  fi
395}
396
397build_libxpm()
398{ ( cd libXpm/lib
399    autoconf
400    ./configure --host=$CROSS --prefix=$install
401    make -f Makefile.mingw
402    make -f Makefile.mingw install
403  )
404}
405
406###########################
407# Download and install zlib
408
409download_zlib()
410{ ZLIB_FILE=zlib-$ZLIB_VERSION.tar.gz
411
412  [ -f $ZLIB_FILE ] || wget http://zlib.net/$ZLIB_FILE
413  tar xzf $ZLIB_FILE
414}
415
416build_zlib()
417{ ( cd zlib-$ZLIB_VERSION
418    make -f win32/Makefile.gcc PREFIX=$CROSS- BINARY_PATH=$install/bin INCLUDE_PATH=$install/include LIBRARY_PATH=$install/lib SHARED_MODE=1 IMPLIB=libz.dll.a install
419  )
420}
421
422#################################
423# Download and install libarchive
424
425download_libarchive()
426{ ARCHIVE_FILE=libarchive-$ARCHIVE_VERSION.tar.gz
427
428  [ -f $ARCHIVE_FILE ] || \
429    wget http://www.libarchive.org/downloads/$ARCHIVE_FILE
430  tar xzf $ARCHIVE_FILE
431}
432
433# lt_cv_deplibs_check_method=pass_all works around a bug in libtool
434# causing: "linker path does not have real file for library" error on MinGW
435# See http://lists.cairographics.org/archives/cairo/2009-July/017686.html
436
437build_libarchive()
438{ ( cd libarchive-$ARCHIVE_VERSION
439    export CFLAGS="-I$install/include"
440    export LDFLAGS="-L$install/lib"
441    export lt_cv_deplibs_check_method='pass_all'
442    export ac_cv_func__localtime64_s='no'
443    export ac_cv_func__ctime64_s='no'
444    ./configure --host=$CROSS --prefix=$install --with-pic --with-zlib \
445    --without-iconv --without-openssl --without-nettle --without-xml2 \
446    --without-expat --without-libregex --without-bz2lib \
447    --without-lzmadec --without-lzma --without-lzo2
448    make
449    make install
450  )
451}
452
453
454#################################
455# Download and install libpcre
456
457
458download_libpcre()
459{ PCRE_FILE=pcre-$PCRE_VERSION.tar.gz
460
461  [ -f $PCRE_FILE ] || \
462    wget https://ftp.pcre.org/pub/pcre/$PCRE_FILE
463  tar xzf $PCRE_FILE
464}
465
466
467build_libpcre()
468{ ( cd pcre-$PCRE_VERSION
469    ./configure --host=$CROSS --prefix=$install \
470	--disable-static --disable-cpp --enable-utf8 --enable-unicode-properties
471    make pcre.dll
472    make install
473  )
474}
475
476
477#################################
478# Download and install libuuid
479
480download_libuuid()
481{ UUID_FILE=uuid-$UUID_VERSION.tar.gz
482
483  [ -f $UUID_FILE ] || \
484  curl ftp://ftp.ossp.org/pkg/lib/uuid/$UUID_FILE > $UUID_FILE
485  tar zxvf $UUID_FILE
486}
487
488build_libuuid()
489{ ( cd uuid-$UUID_VERSION
490    ./configure --host=$CROSS --prefix=$install
491    make
492    make install
493  )
494}
495
496################################
497# Download and install libffi
498
499download_libffi()
500{ FFI_FILE=libffi-$FFI_VERSION.tar.gz
501  [ -f $FFI_FILE ] || \
502  curl ftp://sourceware.org/pub/libffi/$FFI_FILE > $FFI_FILE
503  tar zxvf $FFI_FILE
504}
505
506build_libffi()
507{ ( cd libffi-$FFI_VERSION
508    ./configure --host=$CROSS --prefix=$install
509    make
510    make install
511    # Bit strange location for the headers
512    cp $install/lib/libffi-$FFI_VERSION/include/*.h $install/include
513  )
514}
515
516
517################################
518# Download and install libyaml
519
520download_libyaml()
521{ #tested 01f3a8786127748b5bbd4614880c4484570bbd44
522  git clone https://github.com/yaml/libyaml
523}
524
525build_libyaml()
526{ ( cd libyaml
527    ./bootstrap
528    ./configure --host=$CROSS --prefix=$install
529    make
530    make install
531  )
532}
533
534
535###########################
536# Do the whole lot for all prerequisites
537
538clean_prerequisites()
539{ ( cd gmp-$GMP_VERSION && make distclean )
540  ( cd openssl-$SSL_VERSION && make distclean )
541  ( cd jpeg-$JPEG_VERSION && make distclean )
542  ( cd libXpm/lib && make distclean )
543  ( cd zlib-$ZLIB_VERSION && make distclean )
544  ( cd libarchive-$ARCHIVE_VERSION && make distclean )
545  ( cd uuid-$UUID_VERSION && make distclean )
546  ( cd ffi-$FFI_VERSION && make distclean )
547  if [ -d pthreads-w32-$PTHREADS_VERSION ]; then
548    ( cd pthreads-w32-$PTHREADS_VERSION && make distclean )
549  fi
550}
551
552
553download_prerequisites()
554{ download_gmp
555  download_pthread_win32
556  download_libdwarf
557  download_ssl
558  download_jpeg
559  download_libxpm
560  download_zlib
561  download_libarchive
562  download_libuuid
563  download_libdb
564  download_libpcre
565  download_libffi
566  download_libyaml
567}
568
569build_prerequisites()
570{ build_gmp
571  build_pthread_win32
572  build_libdwarf
573  build_ssl
574  build_jpeg
575  build_libxpm
576  build_zlib
577  build_libarchive
578  build_libuuid
579  build_libdb
580  build_libpcre
581  build_libffi
582  build_libyaml
583}
584