diff --git a/H/pl-incl.h b/H/pl-incl.h index 8c3a0eb2d..093e3eba7 100755 --- a/H/pl-incl.h +++ b/H/pl-incl.h @@ -11,9 +11,12 @@ #ifdef __WINDOWS__ +#ifndef __MSYS__ #include +#endif #include + #if HAVE_XOS_H #include /* Windows POSIX enhancements */ #endif diff --git a/H/pl-shared.h b/H/pl-shared.h index baebda8ec..6c40de49d 100755 --- a/H/pl-shared.h +++ b/H/pl-shared.h @@ -23,7 +23,7 @@ #endif #ifndef __WINDOWS__ -#if defined(_MSC_VER) || defined(__MINGW32__) +#if defined(_MSC_VER) || defined(__MINGW32__) || defined(__MSYS__) #define __WINDOWS__ 1 #endif #endif diff --git a/configure.in b/configure.in index 4e3d0d424..3ba69c34c 100755 --- a/configure.in +++ b/configure.in @@ -517,7 +517,8 @@ AC_PROG_INSTALL AC_PROG_RANLIB AC_CHECK_TOOL(AR,[ar],:) AC_PATH_PROG(INSTALL_INFO,install-info,true,$PATH:/sbin:/usr/sbin:/usr/etc:/usr/local/sbin) -AC_CHECK_HEADERS(winsock.h winsock2.h) +dnl do this before windows.h +AC_CHECK_HEADERS(winsock.h winsock2.h windows.h) AC_PATH_PROG(SHELL,sh) AC_CHECK_TOOL([INDENT], [indent], [:]) @@ -661,9 +662,6 @@ if test "$yap_cv_judy" != "no"; then AC_CHECK_LIB(Judy, Judy1Set,,[AC_MSG_RESULT([libJudy not found, UDI will only work with one Index at a time])]) fi -AC_CHECK_HEADERS(IntSafe.h) -AC_CHECK_HEADERS(windows.h) - if test "$threads" = yes then AC_CHECK_HEADERS(pthread.h) @@ -1091,7 +1089,7 @@ dnl Linux has both elf and a.out, in this case we found elf INSTALL_ENV="YAPSHAREDIR=\$(DESTDIR)\$(SHAREDIR) YAPLIBDIR=\$(DESTDIR)\$(YAPLIBDIR)" fi ;; - *cyg*|*mingw*) + *cyg*|*mingw*|*msys*) # gcc on cygwin seems to have trouble with longjmp # and -fomit-frame-point -DBP_FREE YAPLIB="yap.dll" @@ -1918,11 +1916,11 @@ if test "x$PLARCH" = "x"; then *linux*) PLARCH=`echo $host | sed 's/-.*/-linux/'` ;; - i?86-*mingw32*) + i?86-*mingw32*|i?86-msys*) # Make PLARCH match the definition in src/config/win32.h PLARCH=i386-win32 ;; - x86_64-*mingw32*) + x86_64-*mingw32*|x86_64-msys*) # Make PLARCH match the definition in src/config/win64.h PLARCH=x64-win64 ;; diff --git a/docs/yap.md b/docs/yap.md index 4bf3bebe8..ecc63b32d 100644 --- a/docs/yap.md +++ b/docs/yap.md @@ -370,70 +370,91 @@ CC="gcc -mabi=64" ./configure --... Be careful. At least for some versions of `GCC`, compiling with `-g` seems to result in broken code. - + WIN32: GCC is distributed in the MINGW32 and CYGWIN packages. - -The Mingw32 environment is available from the URL: - - - -You will need to install the `msys` and `mingw` -packages. You should be able to do configure, make and make install. - -If you use mingw32 you may want to search the contributed packages for -the `gmp` multi-precision arithmetic library. If you do setup YAP -with `gmp` note that libgmp.dll must be in the path, -otherwise YAP will not be able to execute. - -The CygWin environment is available from the URL: - - - -and mirrors. We suggest using recent versions of the cygwin shell. The -compilation steps under the cygwin shell are as follows: - -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -mkdir cyg -$YAPSRC/configure --enable-coroutining \\ - --enable-depth-limit \\ - --enable-max-performance -make -make install -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -By default, YAP will use the `-mno-cygwin` option to -disable the use of the cygwin dll and to enable the mingw32 subsystem -instead. YAP thus will not need the cygwin dll. It instead accesses -the system's CRTDLL.DLL `C` run time library supplied with -Win32 platforms through the mingw32 interface. Note that some older -WIN95 systems may not have CRTDLL.DLL, in this case it should -be sufficient to import the file from a newer WIN95 or WIN98 machine. - -You should check the default installation path which is set to -/YAP in the standard Makefile. This string will usually -be expanded into c:\\YAP by Windows. - -The cygwin environment does not provide gmp on the MINGW -subsystem. You can fetch a dll for the gmp library from -. - -It is also possible to configure YAP to be a part of the cygwin -environment. In this case you should use: - -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -mkdir cyg -$YAPSRC/configure --enable-max-performance \\ - --enable-cygwin=yes -make -make install -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -YAP will then compile using the cygwin library and will be installed -in cygwin's /usr/local. You can use YAP from a cygwin console, -or as a standalone application as long as it can find -cygwin1.dll in its path. Note that you may use to use -`--enable-depth-limit` for Aleph compatibility, and that you may -want to be sure that GMP is installed. +@section Compiling_under_mingw Compiling Under MINGW's GCC +AT the time of this writing (Nov 2014), YAP uses the mkwin script to +compile in WIN32. The script requires either a WIN32 environment, or a +cross-compiler/emulator package. + +YAP has been known to compile under VISUAL C++, and should compile and +work under cygwin, but the favorite approach is to use a native +msys/mingw environment. This approach has two key advantages: + + + it does not need an interface layer and a DLL, like cygwin. + + + it enables cross-compilation. + +YAP uses rge `mkwin` script to generate a new YAP installer. The script is +controlled by a set of of variables that should be defined early on in +the text. It executes by first calling `configure`, next running `make`, and +last (if all went well) executing `nsys`. + +In more detail, the following mingw based environments have been +tested to develop YAP: + + * MSYS 1 and mingw32/64: most WIN32 development did occur in this + native environment. Best results were achieved with + MSYS-1.0.* and TDM-GCC: + + mingw: http://www.mingw.org/ + original msys: http://www.mingw.org/wiki/MSYS + mingw64: http://mingw-w64.sourceforge.net/ + TDM-GCC: http://tdm-gcc.tdragon.net/ + + * This distribution was compiled with the MSYS2 integrated + development, that supports 32 and 64 bit compilation. Setting up + MSYS2 should be done with care, but it is worth it as the + distribution works nicely in MINGW32 and MINGW64 mode. A third + compilation mode, MSYS mode, has problems with compiling sockets. + + msys2: http://sourceforge.net/projects/msys2/ + + * cygwin and cygwin64 now can generate native applications + + cygwin: https://www.cygwin.com/ + + * Linux has a nice cross-compilation environment, with some of the best + work done for Fedora. + + fedora mingw cross-compiler: http://fedoraproject.org/wiki/MinGW/CrossCompilerFramework + + One problem is that this environment requires emulation of WIN32 + executables to generate the initial saved state and to compile + `chr`. `wine` sometimes does the task, but it sometimes fails. + + * OSX has the `mxe` package, a port of mingw that is in active + development. + + mxe: http://mxe.cc/ + + Note that OSX has technical limitations that preclude porting + wine64. wine32 is distributed with package managers such as ports + and brew. + +=== Setting up WIN32 compilation + +Compiling WIN32 packages depends on a number of parameters: chosen compiler, +packages to install, directory setup. You may have to change these ones that +control the `mkwin` script: + + * `VER`: major/minor number + * `PATCHID`: third digit + * `SRC`: directory containing yap sources, in the local environment notation. + * `SRC_WIN`: same, but in WIN32 standard notation. + * `THREADS`: yes or no? controllable from the command line. + * `ABI`: "32" or "64", controllable from the command line. + * `NSIS`: installer generator, usually "/c/Program Files (x86)/NSIS/makensis". + * `DOCS_DIR`: where you have the doxygen output. + * `GCC_DIR`: root of gcc seup. + * `HOST`: argument to `--host` configure command. + * `BUILD`: build directory + * `GMP`: multi-precision package; yes, no, or the installation directory; usually in the distribution. + * `CUDD`: BDD package, usually in the distribution. + * `JAVA`: Java sdk directory, usually in the distribution. + * `PYTHON`: Python package, usually in the distribution. + * `R`: R environment package, usually in the distribution. + * `GECODE`: constraint solver package, usually not in the WIN32 distribution. @subsection Compiling_Under_Visual_C Compiling Under Visual C++ diff --git a/misc/mkwin b/misc/mkwin index 1f7f75624..885acea9a 100755 --- a/misc/mkwin +++ b/misc/mkwin @@ -14,30 +14,47 @@ # # http://sourceforge.net/projects/mingwbuilds/ # PS: don't install in the default location. -# mingw should avoid space in its directory, +# mingw should avoid space in its directory path, # it freaks winres out. # http://nsis.sourceforge.net/Main_Page # # -YHOME=/y/vsc -VERSION=6.3.4 -#cross-compiler for OSX, see http://mxe.cc/ -#notice that OSX does not allow WIN64 emulation (wine64) -MXE=$HOME/Yap/mxe/usr -# by default, compile without threads -THREADS=no -# use 64 bits -ABI=64 +for YHOME in /y/vsc /z /home/vsc /home/vitor /Users/vsc /u/vitor; +do + if test -d $YHOME/Yap + then + break + fi +done -SRC=/c/cygwin/Yap/yap-6.3 +#!/bin/sh +# +# /** +# +# 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/yap-"$VER" +# the way it looks to win32 +SRC_WIN="c:\\cygwin\\Yap\\yap-${VER}" #SRC=/l/work/noth/git #SRC_WIN=L:\\work\\noth\\git #SRC="$HOME"/git/yap-6.3 -TARGET=/c/Yap64 +# do we support THREADS +THREADS=no +# makes install bundle NSIS="/c/Program Files (x86)/NSIS/makensis" -# by default, "" +# emulator, by default, "" PREFIX_CMD=wine +VERSION="$VER"."$PATCHID" I=$# while test $I -gt 0 do @@ -61,16 +78,17 @@ done # srcdir comes from here, please avoid relative paths CONFIGURE="$SRC"/configure -DEBUG=" --enable-debug-yap --enable-low-level-tracer" +#DEBUG=" --enable-debug-yap --enable-low-level-tracer" +DEBUG= # debugging setup -do_compile=true -do_install=true +do_compile=yes +do_install=yes # HOME WIN64 configuration # DOCS_DIR=/l/work/noth/yapdocs -DOCS_DIR="$YHOME"/Yap/bins/threads +DOCS_DIR="$YHOME"/Yap/doxout if test "$THREADS" = yes; then FULL_VERSION="$VERSION"-threads @@ -79,94 +97,83 @@ else fi if test $ABI = 64; then - BUILD=/c/cygwin/Yap/mingw"$ABI" - #GCC_DIR=/l/Work/noth/mingw-w64/x86_64-4.9.0-posix-seh-rt_v3-rev1/mingw64 + TARGET=YAP64 case $( uname ) in *Darwin*) GCC_DIR="$MXE" HOST="x86_64-w64-mingw32" - LIB_PATH="$MXE"/"$HOST"/lib + BUILD=/c/cygwin/Yap/mingw"$ABI" ;; *MINGW64*) - GCC_DIR=/c/TDM-GCC-64 + # 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 HOST="x86_64-w64-mingw32" - LIB_PATH="$GCC_DIR"/"$HOST"/lib + ;; + MSYS*) + # GCC_DIR=/c/TDM-GCC-64 + GCC_DIR=/usr + 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=/c/msys64/usr/win64 + 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* )" PYTHON="/c/Python33-64" R="$( echo /c/Program\ Files/R/R-*/bin/x64 )" - -fi - # HOME WIN32 configuration -if test $ABI = 32; then - ABI=32 +elif test $ABI = 32; then + TARGET=YAP case $( uname ) in *Darwin*) #use mxe as a cross compiler - GCC_DIR="$MXE"/bin - PATH="$GCC_DIR":"$PATH" + GCC_DIR="$MXE" HOST="i686-pc-mingw32" - LIB_PATH="$MXE"/"$HOST"/lib - GECODE=no # install only allows one of 32 or 64 bits - GMP=yes - JAVA=no - PYTHON=no - REAL=no + GMP=/c/msys64/usr/win32 ;; - esac - - case $( uname ) in - *Darwin*) - GCC_DIR="$MXE" - HOST="x86_64-w64-mingw32" - LIB_PATH="$MXE"/"$HOST"/lib - ;; - *MINGW64*) - GCC_DIR=/c/TDM-GCC-64 - HOST="x86_64-w64-mingw32" - LIB_PATH="$GCC_DIR"/"$HOST"/lib + *MINGW32*) + GCC_DIR=/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 - GMP=/c/msys64/usr/win32 CUDD=/c/cygwin/Yap/cudd-2.5.0-mingw32 GECODE=no # "/c/Program Files/Gecode" - JAVA="$( echo /c/Program\ Files\ */Java/jdk* )" - PYTHON="/c/Python27" + JAVA="$( echo /c/Program\ Files\ *x86*/Java/jdk* )" + PYTHON="/c/Python27/DLLs" R="$( echo /c/Program\ Files/R/R-*/bin/i* )" - HOST+=" --enable-abi=32" + # HOST=" --enable-abi=32" fi export PATH="$GCC_DIR"/bin:"$PATH" # echo "gcc= " $GCC_DIR -# echo "host= " $HOST + echo "host= " $HOST if test x"$JAVA" != xno then export PATH="$PATH":"$JAVA"/bin fi if test x"$PYTHON" != xno then - export PATH="$PATH":"$PYTHON"/"python.exe" + export PATH="$PATH":"$PYTHON" fi if test x"$R" != xno then export PATH="$PATH":"$R" fi -if test ${THREADS} = yes +if test x${THREADS} != xno then - cp "$LIB_PATH"/libwinpthread-1.dll . + cp "$DLL_PATH"/libwinpthread-1.dll . + cp "$DLL_PATH=gmp*.dll . cp libwinpthread-1.dll pthreadGC2.dll fi @@ -185,7 +192,7 @@ then export PATH="$PATH":"$GECODE"/bin fi -if test "$JAVA" = yes +if test x"$JAVA" != xno then export PATH="$PATH":"$JAVA"/bin fi @@ -210,44 +217,45 @@ then make distclean fi -export INSTALL_SH=$SRC/yap-6.3/install.sh +export INSTALL_SH=$SRC/yap-"$VERSION"/install.sh # avoid using relative paths if test "$do_compile" = true; then BUILD=/c/cygwin/Yap/mingw"$ABI" mkdir -p "$BUILD" + cd "$BUILD" +# make distclean # /bin/rm -rf "$BUILD"/* - "$CONFIGURE" --host="$HOST" \ - --prefix="$TARGET" $DEBUG\ + "$CONFIGURE" --host="$HOST" "$BLD" \ + --prefix=/c/"$TARGET" $DEBUG\ --with-R="$R" \ --with-java="$JAVA" \ --with-gmp="$GMP" \ - --with-python="$PYTHON" \ + --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" = true; then +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 if test $ABI = 64; then - cp $DOCS_DIR/*html $TARGET/share/doc/Yap - cp $DOCS_DIR/*pdf $TARGET/share/doc/Yap "$NSIS" -DREGKEY=SOFTWARE\\YAP\\Prolog64 \ - -DROOTDIR=$TARGET \ + -DROOTDIR=/c/$TARGET \ -DABI="$ABI" \ -DVERSION="$FULL_VERSION" \ -DOPTIONS="$SRC_WIN\\misc\\options.ini" \ -DOUT_DIR=".." -D"WIN64=1" \ - -NOCD $SRC/yap-6.3/misc/Yap.nsi + -NOCD $SRC/misc/Yap.nsi else - cp $DOCS_DIR/*html $TARGET/share/doc/Yap - cp $DOCS_DIR/*pdf $TARGET/share/doc/Yap "$NSIS" -DREGKEY=SOFTWARE\\YAP\\Prolog \ - -DROOTDIR=$TARGET \ + -DROOTDIR=/c/$TARGET\ -DABI="$ABI" \ -DVERSION="$FULL_VERSION" \ -DOPTIONS="$SRC_WIN\\misc\\options.ini" \ -DOUT_DIR=".." \ - -NOCD $SRC/yap-6.3/misc/Yap.nsi + -NOCD $SRC/misc/Yap.nsi fi fi diff --git a/misc/yap.nsi b/misc/yap.nsi index 9d0920fb0..958e5b9e5 100755 --- a/misc/yap.nsi +++ b/misc/yap.nsi @@ -14,7 +14,7 @@ SetCompressor /FINAL bzip2 ; Preload files that are needed by the installer itself ReserveFile "${NSISDIR}\Plugins\x86-unicode\UserInfo.dll" -ReserveFile "${NSISDIR}\Plugins\\x86-unicode\InstallOptions.dll" +ReserveFile "${NSISDIR}\Plugins\x86-unicode\InstallOptions.dll" ReserveFile "${OPTIONS}" !ifdef WIN64 @@ -72,8 +72,8 @@ Section "Base system (required)" File /r ${ROOTDIR}\share\Yap\* SetOutPath $INSTDIR\share\doc\Yap - File ${ROOTDIR}\share\doc\Yap\yap.html - File ${ROOTDIR}\share\doc\Yap\yap.pdf + File ${ROOTDIR}\share\doc\Yap\html\index.html +; File ${ROOTDIR}\share\doc\Yap\refman.pdf ; File ${ROOTDIR}\share\doc\Yap\yap.info File ${ROOTDIR}\share\doc\Yap\Artistic File ${ROOTDIR}\share\doc\Yap\README.TXT @@ -120,13 +120,13 @@ Section "Start Menu shortcuts" "$INSTDIR\share\doc\Yap\README.TXT" 0 \ "SW_SHOWNORMAL" "" "View readme" CreateShortCut "$SMPROGRAMS\${GRP}\Manual Html.lnk" \ - "$INSTDIR\share\doc\Yap\yap.html" "" \ - "$INSTDIR\share\doc\Yap\yap.html" 0 \ - "SW_SHOWNORMAL" "" "View readme" - CreateShortCut "$SMPROGRAMS\${GRP}\Manual PDF.lnk" \ - "$INSTDIR\share\doc\Yap\yap.pdf" "" \ - "$INSTDIR\share\doc\Yap\yap.pdf" 0 \ + "$INSTDIR\share\doc\Yap\html\index.html" "" \ + "$INSTDIR\share\doc\Yap\html\index.html" 0 \ "SW_SHOWNORMAL" "" "View readme" +; CreateShortCut "$SMPROGRAMS\${GRP}\Manual PDF.lnk" \ +; "$INSTDIR\share\doc\Yap\refman.pdf" "" \ +; "$INSTDIR\share\doc\Yap\refman.pdf" 0 \ +; "SW_SHOWNORMAL" "" "View readme" CreateShortCut "$SMPROGRAMS\${GRP}\Uninstall.lnk" \ "$INSTDIR\uninstall.exe" \ "" \ diff --git a/packages/bdd/configure.in b/packages/bdd/configure.in index 5f97280a1..d5ba8e7d2 100755 --- a/packages/bdd/configure.in +++ b/packages/bdd/configure.in @@ -50,7 +50,7 @@ elif test -d "$cudd_dir/lib"; then LIBS="$LIBS -L $cudd_dir/lib" fi -if test "$target_os" = "mingw32" -o "$target_os" = "mingw64" +if test "$target_os" = "mingw32" -o "$target_os" = "mingw64" -o "$target_os" = "msys" then #mingw: we know where things are CUDD_LIBS="$cudd_dir/lib/all_cudd.dll" diff --git a/packages/cplint/Makefile.in b/packages/cplint/Makefile.in index e462a9417..f6c778e38 100644 --- a/packages/cplint/Makefile.in +++ b/packages/cplint/Makefile.in @@ -201,3 +201,4 @@ test%: distclean: clean rm -f Makefile + diff --git a/packages/cplint/approx/simplecuddLPADs/Makefile.in b/packages/cplint/approx/simplecuddLPADs/Makefile.in index de6ccd639..d6fe321f2 100644 --- a/packages/cplint/approx/simplecuddLPADs/Makefile.in +++ b/packages/cplint/approx/simplecuddLPADs/Makefile.in @@ -52,3 +52,6 @@ clean: install: default $(INSTALL_PROGRAM) LPADBDD $(DESTDIR) + +distclean: clean + rm -f Makefile