This repository has been archived on 2023-08-20. You can view files and clone it, but cannot push or open issues or pull requests.
yap-6.3/misc/mkwin

254 lines
5.7 KiB
Plaintext
Raw Normal View History

#!/bin/sh
#
# script for compiling and installing YAP under msys. Uses a mingw64
# compiler, msys shell and nsis to do the installing
# Please read the script before trying to execute it.
# Legal arguments for the script are
# 'threads' - enable threads
# 'no_threads',
# '32', '64' - compile for 32 or 64 bit architecture.
# By default threads are turned off and we use 64 bits.
#
# please check if you have gcc 64 bits in your path and a clone
# of msys shell like smartgit:
#
# http://sourceforge.net/projects/mingwbuilds/
# PS: don't install in the default location.
# mingw should avoid space in its directory,
# it freaks winres out.
# http://nsis.sourceforge.net/Main_Page
#
#
2014-10-30 07:47:16 +00:00
YHOME=/y/vsc
VERSION=6.3.4
2014-10-28 12:56:26 +00:00
#cross-compiler for OSX, see http://mxe.cc/
#notice that OSX does not allow WIN64 emulation (wine64)
MXE=$HOME/Yap/mxe/usr
# by default, compile without threads
THREADS=no
# use 64 bits
ABI=64
2014-10-30 16:38:24 +00:00
2014-10-30 07:47:16 +00:00
SRC=/c/cygwin/Yap/yap-6.3
#SRC=/l/work/noth/git
#SRC_WIN=L:\\work\\noth\\git
2014-10-30 07:47:16 +00:00
#SRC="$HOME"/git/yap-6.3
TARGET=/c/Yap64
NSIS="/c/Program Files (x86)/NSIS/makensis"
# by default, ""
PREFIX_CMD=wine
I=$#
while test $I -gt 0
do
if test $1 = threads
then
2014-10-28 12:56:26 +00:00
THREADS=yes
elif test $1 = no_threads
then
2014-10-28 12:56:26 +00:00
THREADS=no
elif test $1 = 32
then
2014-10-28 12:56:26 +00:00
ABI=32
elif test $1 = 64
then
2014-10-28 12:56:26 +00:00
ABI=64
else
2014-10-28 12:56:26 +00:00
echo "received \"$1\", should be one of threads, no_threads, 32, 64"
fi
I=$(( $I - 1 ))
done
# srcdir comes from here, please avoid relative paths
2014-10-30 07:47:16 +00:00
CONFIGURE="$SRC"/configure
2014-10-30 16:38:24 +00:00
DEBUG=" --enable-debug-yap --enable-low-level-tracer"
# debugging setup
do_compile=true
do_install=true
# HOME WIN64 configuration
# DOCS_DIR=/l/work/noth/yapdocs
2014-10-30 07:47:16 +00:00
DOCS_DIR="$YHOME"/Yap/bins/threads
if test "$THREADS" = yes; then
FULL_VERSION="$VERSION"-threads
else
FULL_VERSION="$VERSION"
2014-10-30 07:47:16 +00:00
fi
if test $ABI = 64; then
2014-10-30 07:47:16 +00:00
BUILD=/c/cygwin/Yap/mingw"$ABI"
#GCC_DIR=/l/Work/noth/mingw-w64/x86_64-4.9.0-posix-seh-rt_v3-rev1/mingw64
2014-10-28 12:56:26 +00:00
case $( uname ) in
*Darwin*)
2014-10-30 07:47:16 +00:00
GCC_DIR="$MXE"
2014-10-28 12:56:26 +00:00
HOST="x86_64-w64-mingw32"
LIB_PATH="$MXE"/"$HOST"/lib
;;
2014-10-30 07:47:16 +00:00
*MINGW64*)
GCC_DIR=/c/TDM-GCC-64
HOST="x86_64-w64-mingw32"
LIB_PATH="$GCC_DIR"/"$HOST"/lib
;;
esac
2014-10-28 12:56:26 +00:00
# ok.
2014-10-30 07:47:16 +00:00
# BDD compiler package. Get version that compiles on Windows from Vitor!
2014-10-28 12:56:26 +00:00
# GMP=/l/Work/noth/msys/1.0/local
2014-10-30 07:47:16 +00:00
GMP=/c/msys64/usr/win64
CUDD=/c/cygwin/Yap/cudd-2.5.0-mingw64
GECODE=no # "/c/Program Files/Gecode"
JAVA="$( echo /c/Program\ Files/Java/jdk* )"
PYTHON="/c/Python33-64"
R="$( echo /c/Program\ Files/R/R-*/bin/x64 )"
fi
# HOME WIN32 configuration
if test $ABI = 32; then
2014-10-30 16:38:24 +00:00
ABI=32
2014-10-28 12:56:26 +00:00
case $( uname ) in
*Darwin*)
#use mxe as a cross compiler
2014-10-30 07:47:16 +00:00
GCC_DIR="$MXE"/bin
PATH="$GCC_DIR":"$PATH"
2014-10-28 12:56:26 +00:00
HOST="i686-pc-mingw32"
LIB_PATH="$MXE"/"$HOST"/lib
GECODE=no # install only allows one of 32 or 64 bits
GMP=yes
JAVA=no
PYTHON=no
REAL=no
;;
esac
2014-10-30 16:38:24 +00:00
case $( uname ) in
*Darwin*)
GCC_DIR="$MXE"
HOST="x86_64-w64-mingw32"
LIB_PATH="$MXE"/"$HOST"/lib
;;
*MINGW64*)
GCC_DIR=/c/TDM-GCC-64
HOST="x86_64-w64-mingw32"
LIB_PATH="$GCC_DIR"/"$HOST"/lib
;;
esac
# ok.
# BDD compiler package. Get version that compiles on Windows from Vitor!
# GMP=/l/Work/noth/msys/1.0/local
GMP=/c/msys64/usr/win32
CUDD=/c/cygwin/Yap/cudd-2.5.0-mingw32
GECODE=no # "/c/Program Files/Gecode"
JAVA="$( echo /c/Program\ Files\ */Java/jdk* )"
PYTHON="/c/Python27"
R="$( echo /c/Program\ Files/R/R-*/bin/i* )"
2014-10-28 12:56:26 +00:00
HOST+=" --enable-abi=32"
2014-10-28 12:56:26 +00:00
fi
2014-10-30 07:47:16 +00:00
export PATH="$GCC_DIR"/bin:"$PATH"
# echo "gcc= " $GCC_DIR
# echo "host= " $HOST
if test x"$JAVA" != xno
then
export PATH="$PATH":"$JAVA"/bin
fi
if test x"$PYTHON" != xno
then
export PATH="$PATH":"$PYTHON"/"python.exe"
fi
if test x"$R" != xno
then
export PATH="$PATH":"$R"
fi
if test ${THREADS} = yes
2014-10-28 12:56:26 +00:00
then
cp "$LIB_PATH"/libwinpthread-1.dll .
cp libwinpthread-1.dll pthreadGC2.dll
fi
2014-10-28 12:56:26 +00:00
if test $CUDD != no
then
2014-10-28 12:56:26 +00:00
BDDLIB="yes"
CPLINT="yes"
else
2014-10-28 12:56:26 +00:00
BDDLIB="no"
CPLINT="no"
fi
2014-10-28 12:56:26 +00:00
2014-10-30 07:47:16 +00:00
if test x"$GECODE" != xno
then
2014-10-30 07:47:16 +00:00
export PATH="$PATH":"$GECODE"/bin
fi
2014-10-28 12:56:26 +00:00
2014-10-30 07:47:16 +00:00
if test "$JAVA" = yes
then
2014-10-30 07:47:16 +00:00
export PATH="$PATH":"$JAVA"/bin
fi
2014-10-28 12:56:26 +00:00
2014-10-30 07:47:16 +00:00
if test "$PYTHON" = yes
then
2014-10-30 07:47:16 +00:00
export PATH="$PATH":"$PYTHON"
fi
2014-10-28 12:56:26 +00:00
2014-10-30 07:47:16 +00:00
if test x"$R" != xno
then
if test $ABI = 32; then
R_ABI=i386
else
R_ABI=x64
fi
2014-10-30 07:47:16 +00:00
export PATH="$PATH":"$R"
fi
if test do_compile = true
then
make distclean
fi
export INSTALL_SH=$SRC/yap-6.3/install.sh
# avoid using relative paths
if test "$do_compile" = true; then
2014-10-30 07:47:16 +00:00
BUILD=/c/cygwin/Yap/mingw"$ABI"
mkdir -p "$BUILD"
# /bin/rm -rf "$BUILD"/*
"$CONFIGURE" --host="$HOST" \
2014-10-30 16:38:24 +00:00
--prefix="$TARGET" $DEBUG\
2014-10-30 07:47:16 +00:00
--with-R="$R" \
2014-10-28 12:56:26 +00:00
--with-java="$JAVA" \
--with-gmp="$GMP" \
--with-python="$PYTHON" \
--with-cudd="$CUDD" --enable-bddlib="$BDDLIB" --with-cplint="$CPLINT" \
--with-gecode="$GECODE" \
2014-10-30 16:38:24 +00:00
--enable-threads="$THREADS" --enable-pthread-locking
2014-10-28 12:56:26 +00:00
make #-j 4 install
fi
if test "$do_install" = true; then
2014-10-28 12:56:26 +00:00
if test $ABI = 64; then
cp $DOCS_DIR/*html $TARGET/share/doc/Yap
cp $DOCS_DIR/*pdf $TARGET/share/doc/Yap
"$NSIS" -DREGKEY=SOFTWARE\\YAP\\Prolog64 \
-DROOTDIR=$TARGET \
-DABI="$ABI" \
-DVERSION="$FULL_VERSION" \
2014-10-30 07:47:16 +00:00
-DOPTIONS="$SRC_WIN\\misc\\options.ini" \
2014-10-28 12:56:26 +00:00
-DOUT_DIR=".." -D"WIN64=1" \
-NOCD $SRC/yap-6.3/misc/Yap.nsi
else
cp $DOCS_DIR/*html $TARGET/share/doc/Yap
cp $DOCS_DIR/*pdf $TARGET/share/doc/Yap
"$NSIS" -DREGKEY=SOFTWARE\\YAP\\Prolog \
-DROOTDIR=$TARGET \
-DABI="$ABI" \
-DVERSION="$FULL_VERSION" \
2014-10-30 07:47:16 +00:00
-DOPTIONS="$SRC_WIN\\misc\\options.ini" \
2014-10-28 12:56:26 +00:00
-DOUT_DIR=".." \
-NOCD $SRC/yap-6.3/misc/Yap.nsi
fi
fi