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

292 lines
6.3 KiB
Plaintext
Raw Permalink Normal View History

2014-11-09 12:08:23 +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-09 12:08:23 +00:00
# newline
2014-11-03 00:13:34 +00:00
for YHOME in /y/vsc /z /home/vsc /home/vitor /Users/vsc /u/vitor;
do
2014-11-09 12:08:23 +00:00
if test -d $YHOME/Yap
then
break
fi
2014-11-03 00:13:34 +00:00
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
2014-11-09 12:08:23 +00:00
case $1 in
threads)
THREADS=yes
;;
no_threads)
THREADS=no
;;
reuse)
CLEAN=no
;;
exe)
CLEAN=exe
;;
clean)
CLEAN=yes
;;
32)
ABI=32
;;
64)
ABI=64
;;
**)
echo "received \"$1\", should be one of threads, no_threads, 32, 64, reuse, clean"
;;
esac
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-09 12:08:23 +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-09 12:08:23 +00:00
TARGET=YAP64
case $( uname ) in
*Darwin*)
GCC_DIR="$MXE"
HOST="x86_64-w64-mingw32"
BUILD=/c/cygwin/Yap/mingw"$ABI"
;;
*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-09 12:08:23 +00:00
GCC_DIR=/c/msys64/MinGW64
HOST="x86_64-w64-mingw32"
;;
MSYS*)
2014-11-03 00:13:34 +00:00
# GCC_DIR=/c/TDM-GCC-64
2014-11-09 12:08:23 +00:00
GCC_DIR=/c/msys64
HOST="x86_64-pc-msys"
BLD="--build=$HOST"
;;
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-09 12:08:23 +00:00
GMP=yes #/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* )"
2014-11-04 01:51:50 +00:00
# "/c/Python33-64"
2014-11-09 12:08:23 +00:00
PYTHON=yes
R=yes
# HOME WIN32 configuration
2014-11-03 00:13:34 +00:00
elif test $ABI = 32; then
2014-11-09 12:08:23 +00:00
TARGET=YAP
case $( uname ) in
*Darwin*)
2014-10-28 12:56:26 +00:00
#use mxe as a cross compiler
2014-11-09 12:08:23 +00:00
GCC_DIR="$MXE"
HOST="i686-pc-mingw32"
GMP=/c/msys64/usr/win32
;;
*MINGW32*)
GCC_DIR=/c/msys64/mingw32
HOST="i686-w64-mingw32"
GMP=yes
;;
esac
2014-10-30 16:38:24 +00:00
# ok.
# BDD compiler package. Get version that compiles on Windows from Vitor!
# GMP=/l/Work/noth/msys/1.0/local
2014-11-09 12:08:23 +00:00
CUDD=/c/cygwin/Yap/cudd-2.5.0-mingw32
GECODE=no # "/c/Program Files/Gecode"
JAVA="$( echo /c/Program\ Files\ *x86*/Java/jdk* )"
2014-11-04 01:51:50 +00:00
#"/c/Python27/DLLs"
2014-11-09 12:08:23 +00:00
PYTHON=yes
R=yes
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
2014-11-09 12:08:23 +00:00
EXTRA_THREADS="-threads"
2014-11-04 01:51:50 +00:00
fi
for BUILD in /c/cygwin/Yap "$HOME"/Yap/bins .
do
2014-11-09 12:08:23 +00:00
if test -d $BUILD; then break; fi
2014-11-04 01:51:50 +00:00
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-09 12:08:23 +00:00
echo "host= " $HOST
2014-10-30 07:47:16 +00:00
if test x"$JAVA" != xno
then
2014-11-09 12:08:23 +00:00
export PATH="$PATH":"$JAVA"/bin
2014-10-30 07:47:16 +00:00
fi
2014-11-09 12:08:23 +00:00
if test x"$PYTHON" != xno -a x"$PYTHON" != yes
2014-10-30 07:47:16 +00:00
then
2014-11-09 12:08:23 +00:00
export PATH="$PATH":"$PYTHON"
2014-10-30 07:47:16 +00:00
fi
2014-11-09 12:08:23 +00:00
if test x"$R" != yes
then
if test "$ABI" = 32
then
RPATH="$( echo /c/Program\ Files/R/R-*/bin/i386 )"
else
RPATH="$( echo /c/Program\ Files/R/R-*/bin/x64 )"
fi
export PATH="$PATH":"$RPATH"
elif test x"$R" != xno
2014-10-30 07:47:16 +00:00
then
export PATH="$PATH":"$R"
fi
2014-10-28 12:56:26 +00:00
if test $CUDD != no
then
2014-11-09 12:08:23 +00:00
BDDLIB="yes"
CPLINT="yes"
else
2014-11-09 12:08:23 +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-11-09 12:08:23 +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-11-09 12:08:23 +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-11-09 12:08:23 +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
2014-11-09 12:08:23 +00:00
if test $ABI = 32; then
R_ABI=i386
else
R_ABI=x64
fi
export PATH="$PATH":"$R"
2014-10-30 07:47:16 +00:00
fi
2014-11-05 07:47:43 +00:00
if test $CLEAN = yes
then
2014-11-09 12:08:23 +00:00
rm -rf /c/$TARGET
2014-11-05 07:47:43 +00:00
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-09 12:08:23 +00:00
if test "$do_compile" = yes -a "$CLEAN" = yes; then
rm -rf "$BUILD"/*
mkdir -p "$BUILD"
cd "$BUILD"
2014-10-30 07:47:16 +00:00
# /bin/rm -rf "$BUILD"/*
2014-11-09 12:08:23 +00:00
"$CONFIGURE" --host="$HOST" "$BLD" \
--prefix=/c/"$TARGET" $DEBUG\
--with-R="$R" \
--with-java="$JAVA" \
--with-gmp="$GMP" \
--with-python="$PYTHON"/python.exe \
--with-cudd="$CUDD" --enable-bddlib="$BDDLIB" --with-cplint="$CPLINT" \
--with-gecode="$GECODE" \
--enable-threads="$THREADS" --enable-pthread-locking
2014-10-28 12:56:26 +00:00
fi
2014-11-09 12:08:23 +00:00
make -j 4
2014-11-03 00:13:34 +00:00
if test "$do_install" = yes; then
2014-11-09 12:08:23 +00:00
make install
cp -a "$DOCS_DIR"0/html /c/$TARGET/share/doc/Yap
cp $DOCS_DIR/latex/*pdf /c/$TARGET/share/doc/Yap
2014-11-04 01:51:50 +00:00
2014-11-09 12:08:23 +00:00
DLL_PATH="$GCC_DIR"/bin
2014-11-04 01:51:50 +00:00
2014-11-09 12:08:23 +00:00
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-11-04 01:51:50 +00:00
2014-11-09 12:08:23 +00:00
if test $ABI = 64; then
"$NSIS" -DREGKEY=SOFTWARE\\YAP\\Prolog64 \
-DROOTDIR=/c/$TARGET -DTARGET="$TARGET" \
-DABI="$ABI" \
-DVERSION="$VERSION""$EXTRA_THREADS" \
2014-10-30 07:47:16 +00:00
-DOPTIONS="$SRC_WIN\\misc\\options.ini" \
2014-11-09 12:08:23 +00:00
-DOUT_DIR=".." -D"WIN64=1" \
-NOCD $SRC/misc/Yap.nsi
else
"$NSIS" -DREGKEY=SOFTWARE\\YAP\\Prolog \
-DROOTDIR=/c/$TARGET -DTARGET="$TARGET" \
-DABI="$ABI" \
-DVERSION="$VERSION""$EXTRA_THREADS" \
2014-10-30 07:47:16 +00:00
-DOPTIONS="$SRC_WIN\\misc\\options.ini" \
2014-11-09 12:08:23 +00:00
-DOUT_DIR=".." \
-NOCD $SRC/misc/Yap.nsi
fi
fi