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

275 lines
6.1 KiB
Plaintext
Raw Normal View History

2014-11-04 01:51:50 +00:00
# !/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.
2014-11-03 00:13:34 +00:00
# mingw should avoid space in its directory path,
# it freaks winres out.
# http://nsis.sourceforge.net/Main_Page
#
#
2014-11-03 00:13:34 +00:00
for YHOME in /y/vsc /z /home/vsc /home/vitor /Users/vsc /u/vitor;
do
if test -d $YHOME/Yap
then
break
fi
done
2014-10-30 16:38:24 +00:00
2014-11-05 07:47:43 +00:00
#!/bin/sh
#
# /**
#
2014-11-03 00:13:34 +00:00
# assumes o mingw32/mingw64 compiler
# native sh like env: msys usually, such as
# http://msys2.sourceforge.net/
#
# Major and Minor
VER="6.3"
# Patch
PATCHID="4"
# SRC in the way it loks to the script
2014-11-04 01:51:50 +00:00
SRC=/c/cygwin/yap-"$VER"
2014-11-03 00:13:34 +00:00
# the way it looks to win32
2014-11-04 01:51:50 +00:00
SRC_WIN="c:\\cygwin\\yap-${VER}"
#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
2014-11-03 00:13:34 +00:00
# do we support THREADS
THREADS=no
# makes install bundle
NSIS="/c/Program Files (x86)/NSIS/makensis"
2014-11-03 00:13:34 +00:00
# emulator, by default, ""
PREFIX_CMD=wine
2014-11-05 07:47:43 +00:00
# work from scratch
CLEAN=yes
2014-11-03 00:13:34 +00:00
VERSION="$VER"."$PATCHID"
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
2014-11-05 07:47:43 +00:00
elif test $1 = reuse
then
CLEAN=no
elif test $1 = clean
2014-11-04 01:51:50 +00:00
then
2014-11-05 07:47:43 +00:00
CLEAN=yes
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-11-05 07:47:43 +00:00
echo "received \"$1\", should be one of threads, no_threads, 32, 64, reuse, clean"
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-11-03 00:13:34 +00:00
#DEBUG=" --enable-debug-yap --enable-low-level-tracer"
DEBUG=
# debugging setup
2014-11-03 00:13:34 +00:00
do_compile=yes
do_install=yes
# HOME WIN64 configuration
# DOCS_DIR=/l/work/noth/yapdocs
2014-11-03 00:13:34 +00:00
DOCS_DIR="$YHOME"/Yap/doxout
2014-10-30 07:47:16 +00:00
if test $ABI = 64; then
2014-11-03 00:13:34 +00:00
TARGET=YAP64
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"
2014-11-03 00:13:34 +00:00
BUILD=/c/cygwin/Yap/mingw"$ABI"
2014-10-28 12:56:26 +00:00
;;
2014-10-30 07:47:16 +00:00
*MINGW64*)
2014-11-03 00:13:34 +00:00
# GCC_DIR=/l/Work/noth/mingw-w64/x86_64-4.9.0-posix-seh-rt_v3-rev1/mingw64
# GCC_DIR=/c/TDM-GCC-64
2014-11-04 01:51:50 +00:00
GCC_DIR=/c/msys64/MinGW64
2014-10-30 07:47:16 +00:00
HOST="x86_64-w64-mingw32"
2014-11-03 00:13:34 +00:00
;;
MSYS*)
# GCC_DIR=/c/TDM-GCC-64
2014-11-04 01:51:50 +00:00
GCC_DIR=/c/msys64
2014-11-03 00:13:34 +00:00
HOST="x86_64-pc-msys"
BLD="--build=$HOST"
2014-10-30 07:47:16 +00:00
;;
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-11-03 00:13:34 +00:00
GMP=yes #/c/msys64/usr/win64
2014-10-30 07:47:16 +00:00
CUDD=/c/cygwin/Yap/cudd-2.5.0-mingw64
GECODE=no # "/c/Program Files/Gecode"
JAVA="$( echo /c/Program\ Files/Java/jdk* )"
2014-11-04 01:51:50 +00:00
# "/c/Python33-64"
PYTHON=yes
R="$( echo /c/Program\ Files/R/R-*/bin/x64* )"
# HOME WIN32 configuration
2014-11-03 00:13:34 +00:00
elif test $ABI = 32; then
TARGET=YAP
2014-10-28 12:56:26 +00:00
case $( uname ) in
*Darwin*)
#use mxe as a cross compiler
2014-11-03 00:13:34 +00:00
GCC_DIR="$MXE"
2014-10-28 12:56:26 +00:00
HOST="i686-pc-mingw32"
2014-11-03 00:13:34 +00:00
GMP=/c/msys64/usr/win32
2014-10-28 12:56:26 +00:00
;;
2014-11-03 00:13:34 +00:00
*MINGW32*)
2014-11-04 01:51:50 +00:00
GCC_DIR=/c/msys64/mingw32
2014-11-03 00:13:34 +00:00
HOST="i686-w64-mingw32"
GMP=yes
2014-10-30 16:38:24 +00:00
;;
esac
# ok.
# BDD compiler package. Get version that compiles on Windows from Vitor!
# GMP=/l/Work/noth/msys/1.0/local
CUDD=/c/cygwin/Yap/cudd-2.5.0-mingw32
GECODE=no # "/c/Program Files/Gecode"
2014-11-03 00:13:34 +00:00
JAVA="$( echo /c/Program\ Files\ *x86*/Java/jdk* )"
2014-11-04 01:51:50 +00:00
#"/c/Python27/DLLs"
PYTHON=yes
2014-10-30 16:38:24 +00:00
R="$( echo /c/Program\ Files/R/R-*/bin/i* )"
2014-11-03 00:13:34 +00:00
# HOST=" --enable-abi=32"
2014-10-28 12:56:26 +00:00
fi
2014-11-04 01:51:50 +00:00
if test x"$THREADS" = xyes; then
EXTRA_THREADS="-threads"
fi
for BUILD in /c/cygwin/Yap "$HOME"/Yap/bins .
do
if test -d $BUILD; then break; fi
done
BUILD+="/mingw""$ABI""$EXTRA_THREADS"
2014-10-30 07:47:16 +00:00
export PATH="$GCC_DIR"/bin:"$PATH"
# echo "gcc= " $GCC_DIR
2014-11-05 07:47:43 +00:00
echo "host= " $HOST
2014-10-30 07:47:16 +00:00
if test x"$JAVA" != xno
then
export PATH="$PATH":"$JAVA"/bin
fi
if test x"$PYTHON" != xno
then
2014-11-03 00:13:34 +00:00
export PATH="$PATH":"$PYTHON"
2014-10-30 07:47:16 +00:00
fi
if test x"$R" != xno
then
export PATH="$PATH":"$R"
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-11-03 00:13:34 +00:00
if test x"$JAVA" != xno
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
2014-11-05 07:47:43 +00:00
if test $CLEAN = yes
then
make distclean
fi
2014-11-03 00:13:34 +00:00
export INSTALL_SH=$SRC/yap-"$VERSION"/install.sh
2014-11-04 01:51:50 +00:00
# avoid using relative paths
2014-11-04 01:51:50 +00:00
if test "$do_compile" = yes; then
2014-10-30 07:47:16 +00:00
mkdir -p "$BUILD"
2014-11-03 00:13:34 +00:00
cd "$BUILD"
# make distclean
2014-10-30 07:47:16 +00:00
# /bin/rm -rf "$BUILD"/*
2014-11-03 00:13:34 +00:00
"$CONFIGURE" --host="$HOST" "$BLD" \
--prefix=/c/"$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" \
2014-11-03 00:13:34 +00:00
--with-python="$PYTHON"/python.exe \
2014-10-28 12:56:26 +00:00
--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
2014-11-05 07:47:43 +00:00
make -j 4
fi
2014-11-03 00:13:34 +00:00
if test "$do_install" = yes; then
make install
2014-11-05 07:47:43 +00:00
cp -a "$DOCS_DIR"0/html /c/$TARGET/share/doc/Yap
2014-11-03 00:13:34 +00:00
cp $DOCS_DIR/latex/*pdf /c/$TARGET/share/doc/Yap
2014-11-04 01:51:50 +00:00
DLL_PATH="$GCC_DIR"/bin
cp "$DLL_PATH"/libwinpthread-1.dll /c/"$TARGET"/bin
cp "$DLL_PATH"/libgmp*.dll /c/"$TARGET"/bin
cp /c/"$TARGET"/bin/libwinpthread-1.dll /c/"$TARGET"/bin/pthreadGC2.dll
2014-10-28 12:56:26 +00:00
if test $ABI = 64; then
"$NSIS" -DREGKEY=SOFTWARE\\YAP\\Prolog64 \
2014-11-05 07:47:43 +00:00
-DROOTDIR=/c/$TARGET -DTARGET="$TARGET" \
2014-10-28 12:56:26 +00:00
-DABI="$ABI" \
2014-11-04 01:51:50 +00:00
-DVERSION="$VERSION""$EXTRA_THREADS" \
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" \
2014-11-03 00:13:34 +00:00
-NOCD $SRC/misc/Yap.nsi
2014-10-28 12:56:26 +00:00
else
"$NSIS" -DREGKEY=SOFTWARE\\YAP\\Prolog \
2014-11-05 07:47:43 +00:00
-DROOTDIR=/c/$TARGET -DTARGET="$TARGET" \
2014-10-28 12:56:26 +00:00
-DABI="$ABI" \
2014-11-04 01:51:50 +00:00
-DVERSION="$VERSION""$EXTRA_THREADS" \
2014-10-30 07:47:16 +00:00
-DOPTIONS="$SRC_WIN\\misc\\options.ini" \
2014-10-28 12:56:26 +00:00
-DOUT_DIR=".." \
2014-11-03 00:13:34 +00:00
-NOCD $SRC/misc/Yap.nsi
2014-10-28 12:56:26 +00:00
fi
fi