# !/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 path, # it freaks winres out. # http://nsis.sourceforge.net/Main_Page # # for YHOME in /y/vsc /z /home/vsc /home/vitor /Users/vsc /u/vitor; do if test -d $YHOME/Yap then break fi done # 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 SRC=/c/cygwin/yap-"$VER" # the way it looks to win32 SRC_WIN="c:\\cygwin\\yap-${VER}" #SRC=/l/work/noth/git #SRC_WIN=L:\\work\\noth\\git #SRC="$HOME"/git/yap-6.3 # do we support THREADS THREADS=no # makes install bundle NSIS="/c/Program Files (x86)/NSIS/makensis" # emulator, by default, "" PREFIX_CMD=wine VERSION="$VER"."$PATCHID" ABI=64 I=$# while test $I -gt 0 do if test $1 = threads then THREADS=yes elif test $1 = no_threads then THREADS=no elif test $1 = all then rm -rf /c/Yap/* rm -rf /c/Yap64/* "$SRC"/misc/mkwin 32 "$SRC"/misc/mkwin 32 threads "$SRC"/misc/mkwin 64 "$SRC"/misc/mkwin 64 threads elif test $1 = 32 then ABI=32 elif test $1 = 64 then ABI=64 else echo "received \"$1\", should be one of threads, no_threads, 32, 64" fi I=$(( $I - 1 )) shift done # srcdir comes from here, please avoid relative paths CONFIGURE="$SRC"/configure #DEBUG=" --enable-debug-yap --enable-low-level-tracer" DEBUG= # debugging setup do_compile=yes do_install=yes # HOME WIN64 configuration # DOCS_DIR=/l/work/noth/yapdocs DOCS_DIR="$YHOME"/Yap/doxout if test $ABI = 64; then TARGET=YAP64 case $( uname ) in *Darwin*) GCC_DIR="$MXE" HOST="x86_64-w64-mingw32" BUILD=/c/cygwin/Yap/mingw"$ABI" ;; *MINGW64*) # GCC_DIR=/l/Work/noth/mingw-w64/x86_64-4.9.0-posix-seh-rt_v3-rev1/mingw64 # GCC_DIR=/c/TDM-GCC-64 GCC_DIR=/c/msys64/MinGW64 HOST="x86_64-w64-mingw32" ;; MSYS*) # GCC_DIR=/c/TDM-GCC-64 GCC_DIR=/c/msys64 HOST="x86_64-pc-msys" BLD="--build=$HOST" ;; esac # ok. # BDD compiler package. Get version that compiles on Windows from Vitor! # GMP=/l/Work/noth/msys/1.0/local 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* )" # "/c/Python33-64" PYTHON=yes R="$( echo /c/Program\ Files/R/R-*/bin/x64* )" # HOME WIN32 configuration elif test $ABI = 32; then TARGET=YAP case $( uname ) in *Darwin*) #use mxe as a cross compiler 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 # 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" JAVA="$( echo /c/Program\ Files\ *x86*/Java/jdk* )" #"/c/Python27/DLLs" PYTHON=yes R="$( echo /c/Program\ Files/R/R-*/bin/i* )" # HOST=" --enable-abi=32" fi 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" export PATH="$GCC_DIR"/bin:"$PATH" # echo "gcc= " $GCC_DIR if test x"$JAVA" != xno then export PATH="$PATH":"$JAVA"/bin fi if test x"$PYTHON" != xno then export PATH="$PATH":"$PYTHON" fi if test x"$R" != xno then export PATH="$PATH":"$R" fi if test $CUDD != no then BDDLIB="yes" CPLINT="yes" else BDDLIB="no" CPLINT="no" fi if test x"$GECODE" != xno then export PATH="$PATH":"$GECODE"/bin fi if test x"$JAVA" != xno then export PATH="$PATH":"$JAVA"/bin fi if test "$PYTHON" = yes then export PATH="$PATH":"$PYTHON" fi if test x"$R" != xno then if test $ABI = 32; then R_ABI=i386 else R_ABI=x64 fi export PATH="$PATH":"$R" fi export INSTALL_SH=$SRC/yap-"$VERSION"/install.sh # avoid using relative paths if test "$do_compile" = yes; then mkdir -p "$BUILD" cd "$BUILD" # make distclean # /bin/rm -rf "$BUILD"/* "$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 make #-j 4 install fi if test "$do_install" = yes; then make install cp -a $DOCS_DIR/html /c/$TARGET/share/doc/Yap cp $DOCS_DIR/latex/*pdf /c/$TARGET/share/doc/Yap 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 if test $ABI = 64; then "$NSIS" -DREGKEY=SOFTWARE\\YAP\\Prolog64 \ -DROOTDIR=/c/$TARGET -DTARGET="$TARGET""$EXTRA_THREADS" \ -DABI="$ABI" \ -DVERSION="$VERSION""$EXTRA_THREADS" \ -DOPTIONS="$SRC_WIN\\misc\\options.ini" \ -DOUT_DIR=".." -D"WIN64=1" \ -NOCD $SRC/misc/Yap.nsi else "$NSIS" -DREGKEY=SOFTWARE\\YAP\\Prolog \ -DROOTDIR=/c/$TARGET -DTARGET="$TARGET""$EXTRA_THREADS" \ -DABI="$ABI" \ -DVERSION="$VERSION""$EXTRA_THREADS" \ -DOPTIONS="$SRC_WIN\\misc\\options.ini" \ -DOUT_DIR=".." \ -NOCD $SRC/misc/Yap.nsi fi fi