improved windows compilation script

This commit is contained in:
vscosta 2014-11-04 01:51:50 +00:00
parent 58734fe2e7
commit fdadf7d477

View File

@ -1,4 +1,4 @@
#!/bin/sh # !/bin/sh
# #
# script for compiling and installing YAP under msys. Uses a mingw64 # script for compiling and installing YAP under msys. Uses a mingw64
# compiler, msys shell and nsis to do the installing # compiler, msys shell and nsis to do the installing
@ -27,10 +27,6 @@ do
fi fi
done done
#!/bin/sh
#
# /**
#
# assumes o mingw32/mingw64 compiler # assumes o mingw32/mingw64 compiler
# native sh like env: msys usually, such as # native sh like env: msys usually, such as
# http://msys2.sourceforge.net/ # http://msys2.sourceforge.net/
@ -41,9 +37,9 @@ VER="6.3"
# Patch # Patch
PATCHID="4" PATCHID="4"
# SRC in the way it loks to the script # 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 # 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=/l/work/noth/git
#SRC_WIN=L:\\work\\noth\\git #SRC_WIN=L:\\work\\noth\\git
#SRC="$HOME"/git/yap-6.3 #SRC="$HOME"/git/yap-6.3
@ -55,6 +51,7 @@ NSIS="/c/Program Files (x86)/NSIS/makensis"
PREFIX_CMD=wine PREFIX_CMD=wine
VERSION="$VER"."$PATCHID" VERSION="$VER"."$PATCHID"
ABI=64
I=$# I=$#
while test $I -gt 0 while test $I -gt 0
do do
@ -64,6 +61,14 @@ do
elif test $1 = no_threads elif test $1 = no_threads
then then
THREADS=no 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 elif test $1 = 32
then then
ABI=32 ABI=32
@ -74,6 +79,7 @@ do
echo "received \"$1\", should be one of threads, no_threads, 32, 64" echo "received \"$1\", should be one of threads, no_threads, 32, 64"
fi fi
I=$(( $I - 1 )) I=$(( $I - 1 ))
shift
done done
# srcdir comes from here, please avoid relative paths # srcdir comes from here, please avoid relative paths
@ -90,12 +96,6 @@ do_install=yes
# DOCS_DIR=/l/work/noth/yapdocs # DOCS_DIR=/l/work/noth/yapdocs
DOCS_DIR="$YHOME"/Yap/doxout DOCS_DIR="$YHOME"/Yap/doxout
if test "$THREADS" = yes; then
FULL_VERSION="$VERSION"-threads
else
FULL_VERSION="$VERSION"
fi
if test $ABI = 64; then if test $ABI = 64; then
TARGET=YAP64 TARGET=YAP64
case $( uname ) in case $( uname ) in
@ -107,12 +107,12 @@ if test $ABI = 64; then
*MINGW64*) *MINGW64*)
# GCC_DIR=/l/Work/noth/mingw-w64/x86_64-4.9.0-posix-seh-rt_v3-rev1/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/TDM-GCC-64
GCC_DIR=/c/MinGW64 GCC_DIR=/c/msys64/MinGW64
HOST="x86_64-w64-mingw32" HOST="x86_64-w64-mingw32"
;; ;;
MSYS*) MSYS*)
# GCC_DIR=/c/TDM-GCC-64 # GCC_DIR=/c/TDM-GCC-64
GCC_DIR=/usr GCC_DIR=/c/msys64
HOST="x86_64-pc-msys" HOST="x86_64-pc-msys"
BLD="--build=$HOST" BLD="--build=$HOST"
;; ;;
@ -124,8 +124,9 @@ if test $ABI = 64; then
CUDD=/c/cygwin/Yap/cudd-2.5.0-mingw64 CUDD=/c/cygwin/Yap/cudd-2.5.0-mingw64
GECODE=no # "/c/Program Files/Gecode" GECODE=no # "/c/Program Files/Gecode"
JAVA="$( echo /c/Program\ Files/Java/jdk* )" JAVA="$( echo /c/Program\ Files/Java/jdk* )"
PYTHON="/c/Python33-64" # "/c/Python33-64"
R="$( echo /c/Program\ Files/R/R-*/bin/x64 )" PYTHON=yes
R="$( echo /c/Program\ Files/R/R-*/bin/x64* )"
# HOME WIN32 configuration # HOME WIN32 configuration
elif test $ABI = 32; then elif test $ABI = 32; then
TARGET=YAP TARGET=YAP
@ -137,7 +138,7 @@ elif test $ABI = 32; then
GMP=/c/msys64/usr/win32 GMP=/c/msys64/usr/win32
;; ;;
*MINGW32*) *MINGW32*)
GCC_DIR=/mingw32 GCC_DIR=/c/msys64/mingw32
HOST="i686-w64-mingw32" HOST="i686-w64-mingw32"
GMP=yes GMP=yes
;; ;;
@ -148,15 +149,25 @@ elif test $ABI = 32; then
CUDD=/c/cygwin/Yap/cudd-2.5.0-mingw32 CUDD=/c/cygwin/Yap/cudd-2.5.0-mingw32
GECODE=no # "/c/Program Files/Gecode" GECODE=no # "/c/Program Files/Gecode"
JAVA="$( echo /c/Program\ Files\ *x86*/Java/jdk* )" 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* )" R="$( echo /c/Program\ Files/R/R-*/bin/i* )"
# HOST=" --enable-abi=32" # HOST=" --enable-abi=32"
fi 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" export PATH="$GCC_DIR"/bin:"$PATH"
# echo "gcc= " $GCC_DIR # echo "gcc= " $GCC_DIR
echo "host= " $HOST
if test x"$JAVA" != xno if test x"$JAVA" != xno
then then
export PATH="$PATH":"$JAVA"/bin export PATH="$PATH":"$JAVA"/bin
@ -170,14 +181,6 @@ then
export PATH="$PATH":"$R" export PATH="$PATH":"$R"
fi 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 if test $CUDD != no
then then
BDDLIB="yes" BDDLIB="yes"
@ -212,15 +215,10 @@ then
export PATH="$PATH":"$R" export PATH="$PATH":"$R"
fi fi
if test do_compile = true
then
make distclean
fi
export INSTALL_SH=$SRC/yap-"$VERSION"/install.sh export INSTALL_SH=$SRC/yap-"$VERSION"/install.sh
# avoid using relative paths # avoid using relative paths
if test "$do_compile" = true; then if test "$do_compile" = yes; then
BUILD=/c/cygwin/Yap/mingw"$ABI"
mkdir -p "$BUILD" mkdir -p "$BUILD"
cd "$BUILD" cd "$BUILD"
# make distclean # make distclean
@ -241,19 +239,26 @@ if test "$do_install" = yes; then
make install make install
cp -a $DOCS_DIR/html /c/$TARGET/share/doc/Yap cp -a $DOCS_DIR/html /c/$TARGET/share/doc/Yap
cp $DOCS_DIR/latex/*pdf /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 if test $ABI = 64; then
"$NSIS" -DREGKEY=SOFTWARE\\YAP\\Prolog64 \ "$NSIS" -DREGKEY=SOFTWARE\\YAP\\Prolog64 \
-DROOTDIR=/c/$TARGET \ -DROOTDIR=/c/$TARGET -DTARGET="$TARGET""$EXTRA_THREADS" \
-DABI="$ABI" \ -DABI="$ABI" \
-DVERSION="$FULL_VERSION" \ -DVERSION="$VERSION""$EXTRA_THREADS" \
-DOPTIONS="$SRC_WIN\\misc\\options.ini" \ -DOPTIONS="$SRC_WIN\\misc\\options.ini" \
-DOUT_DIR=".." -D"WIN64=1" \ -DOUT_DIR=".." -D"WIN64=1" \
-NOCD $SRC/misc/Yap.nsi -NOCD $SRC/misc/Yap.nsi
else else
"$NSIS" -DREGKEY=SOFTWARE\\YAP\\Prolog \ "$NSIS" -DREGKEY=SOFTWARE\\YAP\\Prolog \
-DROOTDIR=/c/$TARGET\ -DROOTDIR=/c/$TARGET -DTARGET="$TARGET""$EXTRA_THREADS" \
-DABI="$ABI" \ -DABI="$ABI" \
-DVERSION="$FULL_VERSION" \ -DVERSION="$VERSION""$EXTRA_THREADS" \
-DOPTIONS="$SRC_WIN\\misc\\options.ini" \ -DOPTIONS="$SRC_WIN\\misc\\options.ini" \
-DOUT_DIR=".." \ -DOUT_DIR=".." \
-NOCD $SRC/misc/Yap.nsi -NOCD $SRC/misc/Yap.nsi