From fdadf7d477f152a36ba9dcefb911d3863e8e300b Mon Sep 17 00:00:00 2001 From: vscosta Date: Tue, 4 Nov 2014 01:51:50 +0000 Subject: [PATCH] improved windows compilation script --- misc/mkwin | 85 +++++++++++++++++++++++++++++------------------------- 1 file changed, 45 insertions(+), 40 deletions(-) diff --git a/misc/mkwin b/misc/mkwin index 730868c09..df1379ce2 100755 --- a/misc/mkwin +++ b/misc/mkwin @@ -1,4 +1,4 @@ -#!/bin/sh +# !/bin/sh # # script for compiling and installing YAP under msys. Uses a mingw64 # compiler, msys shell and nsis to do the installing @@ -27,10 +27,6 @@ do fi done -#!/bin/sh -# -# /** -# # assumes o mingw32/mingw64 compiler # native sh like env: msys usually, such as # http://msys2.sourceforge.net/ @@ -41,9 +37,9 @@ VER="6.3" # Patch PATCHID="4" # SRC in the way it loks to the script -SRC=/c/cygwin/Yap/yap-"$VER" +SRC=/c/cygwin/yap-"$VER" # the way it looks to win32 -SRC_WIN="c:\\cygwin\\Yap\\yap-${VER}" +SRC_WIN="c:\\cygwin\\yap-${VER}" #SRC=/l/work/noth/git #SRC_WIN=L:\\work\\noth\\git #SRC="$HOME"/git/yap-6.3 @@ -55,6 +51,7 @@ NSIS="/c/Program Files (x86)/NSIS/makensis" PREFIX_CMD=wine VERSION="$VER"."$PATCHID" +ABI=64 I=$# while test $I -gt 0 do @@ -64,6 +61,14 @@ do 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 @@ -74,6 +79,7 @@ do 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 @@ -90,12 +96,6 @@ do_install=yes # DOCS_DIR=/l/work/noth/yapdocs DOCS_DIR="$YHOME"/Yap/doxout -if test "$THREADS" = yes; then - FULL_VERSION="$VERSION"-threads -else - FULL_VERSION="$VERSION" -fi - if test $ABI = 64; then TARGET=YAP64 case $( uname ) in @@ -107,12 +107,12 @@ if test $ABI = 64; then *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/MinGW64 + GCC_DIR=/c/msys64/MinGW64 HOST="x86_64-w64-mingw32" ;; MSYS*) # GCC_DIR=/c/TDM-GCC-64 - GCC_DIR=/usr + GCC_DIR=/c/msys64 HOST="x86_64-pc-msys" BLD="--build=$HOST" ;; @@ -124,8 +124,9 @@ if test $ABI = 64; then 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 )" + # "/c/Python33-64" + PYTHON=yes + R="$( echo /c/Program\ Files/R/R-*/bin/x64* )" # HOME WIN32 configuration elif test $ABI = 32; then TARGET=YAP @@ -137,7 +138,7 @@ elif test $ABI = 32; then GMP=/c/msys64/usr/win32 ;; *MINGW32*) - GCC_DIR=/mingw32 + GCC_DIR=/c/msys64/mingw32 HOST="i686-w64-mingw32" GMP=yes ;; @@ -148,15 +149,25 @@ elif test $ABI = 32; then CUDD=/c/cygwin/Yap/cudd-2.5.0-mingw32 GECODE=no # "/c/Program Files/Gecode" JAVA="$( echo /c/Program\ Files\ *x86*/Java/jdk* )" - PYTHON="/c/Python27/DLLs" + #"/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 - echo "host= " $HOST if test x"$JAVA" != xno then export PATH="$PATH":"$JAVA"/bin @@ -170,14 +181,6 @@ then export PATH="$PATH":"$R" fi -if test x${THREADS} != xno -then - cp "$DLL_PATH"/libwinpthread-1.dll . - cp "$DLL_PATH"/gmp*.dll . - cp libwinpthread-1.dll pthreadGC2.dll -fi - - if test $CUDD != no then BDDLIB="yes" @@ -212,15 +215,10 @@ then export PATH="$PATH":"$R" fi -if test do_compile = true -then - make distclean -fi - export INSTALL_SH=$SRC/yap-"$VERSION"/install.sh + # avoid using relative paths -if test "$do_compile" = true; then - BUILD=/c/cygwin/Yap/mingw"$ABI" +if test "$do_compile" = yes; then mkdir -p "$BUILD" cd "$BUILD" # make distclean @@ -241,19 +239,26 @@ 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 \ + -DROOTDIR=/c/$TARGET -DTARGET="$TARGET""$EXTRA_THREADS" \ -DABI="$ABI" \ - -DVERSION="$FULL_VERSION" \ + -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\ + -DROOTDIR=/c/$TARGET -DTARGET="$TARGET""$EXTRA_THREADS" \ -DABI="$ABI" \ - -DVERSION="$FULL_VERSION" \ + -DVERSION="$VERSION""$EXTRA_THREADS" \ -DOPTIONS="$SRC_WIN\\misc\\options.ini" \ -DOUT_DIR=".." \ -NOCD $SRC/misc/Yap.nsi