Commits

Shlomi Fish committed 640169f Merge

Merge branch 'freecell-solver-3.20.x-maintenance-branch'

Comments (0)

Files changed (10)

fc-solve/source/CMakeLists.txt

 
 CHECK_FUNCTION_EXISTS(pow HAVE_POW)
 CHECK_FUNCTION_EXISTS(strndup HAVE_STRNDUP)
+CHECK_FUNCTION_EXISTS(strncasecmp HAVE_STRNCASECMP)
 
 SET(AUTOGENERATED_CONFIG_H "config.h was auto-generated from config.h.in . Do not modify directly")
 
 ENDIF ()
 
 SET (fc_solve_manpage "${CMAKE_CURRENT_SOURCE_DIR}/fc-solve.6")
-INSTALL_MAN ("${fc_solve_manpage}" 6)
+
+IF (UNIX)
+    INSTALL_MAN ("${fc_solve_manpage}" 6)
+ENDIF (UNIX)
 
 INSTALL(
     FILES

fc-solve/source/NEWS.txt

 :Date: 2009-09-05
 :Revision: $Id$
 
+Version 3.20.1: (01-Jul-2013)
+-----------------------------
+
+1. Fix the build and silenced some warnings on MinGW/GCC/Win32.
+
 Version 3.20.0: (26-Jun-2013)
 -----------------------------
 

fc-solve/source/board_gen/CMakeLists.txt

     "Freecell Solver ${VERSION}"
 )
 
-INSTALL_MAN("${CMAKE_CURRENT_BINARY_DIR}/fc-solve-board_gen.6" 6)
-# INSTALL_MAN("fc-solve-board_gen.6" 6)
+IF (UNIX)
+    INSTALL_MAN("${CMAKE_CURRENT_BINARY_DIR}/fc-solve-board_gen.6" 6)
+    # INSTALL_MAN("fc-solve-board_gen.6" 6)
 
-# Install the nroff symbolic links.
-INSTALL_MAN ("make-aisleriot-freecell-board.6" 6)
-INSTALL_MAN ("make-gnome-freecell-board.6" 6)
-INSTALL_MAN ("make_pysol_freecell_board.py.6" 6)
-INSTALL_MAN ("pi-make-microsoft-freecell-board.6" 6)
+    # Install the nroff symbolic links.
+    INSTALL_MAN ("make-aisleriot-freecell-board.6" 6)
+    INSTALL_MAN ("make-gnome-freecell-board.6" 6)
+    INSTALL_MAN ("make_pysol_freecell_board.py.6" 6)
+    INSTALL_MAN ("pi-make-microsoft-freecell-board.6" 6)
+ENDIF (UNIX)
 
 INSTALL(
     TARGETS

fc-solve/source/config.h.in

 
 #cmakedefine HAVE_STRNDUP
 
+#cmakedefine HAVE_STRNCASECMP
+
 /* Name of package */
 #define PACKAGE "${PACKAGE}"
 

fc-solve/source/fcs_strndup.h

+/* Copyright (c) 2000 Shlomi Fish
+ *
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use,
+ * copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following
+ * conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ */
+/*
+ * fcs_strndup.h: provide strndup.
+ */
+#ifndef FC_SOLVE__STRNDUP_H
+#define FC_SOLVE__STRNDUP_H
+
+#include <string.h>
+#include <stdlib.h>
+
+#include "config.h"
+#include "inline.h"
+
+#ifndef HAVE_STRNDUP
+/*
+ * This implementation of strndup is taken from:
+ * http://code.google.com/p/madp-win/source/browse/src/argp-standalone-1.3/strndup.c?r=2d96025e8ad4b150317ff6f0ff8d75c59a83cf97
+ *
+ * The notice there reads:
+ *
+ * <<<
+ * Written by Niels Möller <nisse@lysator.liu.se>
+ *
+ * This file is hereby placed in the public domain.
+ * >>>
+ *
+ * */
+static GCC_INLINE char * strndup (const char *s, size_t size)
+{
+    char *r;
+    char *end = memchr(s, 0, size);
+
+    if (end)
+    {
+        /* Length + 1 */
+        size = end - s + 1;
+    }
+
+    r = malloc(size);
+
+    if (size)
+    {
+        memcpy(r, s, size-1);
+        r[size-1] = '\0';
+    }
+    return r;
+}
+
+#endif
+
+#endif /* #ifndef FC_SOLVE__STRNDUP_H */
+

fc-solve/source/instance.c

 #include "likely.h"
 #include "count.h"
 #include "alloc_wrap.h"
+#include "fcs_strndup.h"
 
 /*
     General use of this interface:

fc-solve/source/move_funcs_order.c

 #include "str_utils.h"
 #include "inline.h"
 
-#ifndef HAVE_STRNDUP
-static GCC_INLINE char * strndup(const char * s, size_t n)
-{
-    char * ret = strdup(s);
-
-    if (n < strlen(ret))
-    {
-        ret[n] = '\0';
-    }
-
-    return ret;
-}
-#endif
+#include "fcs_strndup.h"
 
 int fc_solve_apply_tests_order(
     fcs_tests_order_t * tests_order,

fc-solve/source/scripts/build-on-win32.pl

 	}
 }
 
+mkdir("B");
+chdir("B");
+
 run(
 	[
 	qq{C:\\Program Files\\CMake 2.8\\bin\\CMake},
 	"-G", "MinGW Makefiles",
+    # These variables require libgmp which isn't provided by default.
+    "-DFCS_WITH_TEST_SUITE=", "-DFCS_ENABLE_DBM_SOLVER=",
 	@ARGV,
-	"."
+	".."
 	]
 );
 
-#my $make_path = "C:/strawberry/c/bin/mingw32-make";
-my $make_path = "C:/Dwimperl/c/bin/mingw32-make";
+my $make_path = "C:/strawberry/c/bin/mingw32-make";
+# my $make_path = "C:/Dwimperl/c/bin/mingw32-make";
 
 run( [ $make_path, ] );
 

fc-solve/source/state.h

 static const char * const fc_solve_freecells_prefixes[] = { "FC:", "Freecells:", "Freecell:", NULL};
 
 static const char * const fc_solve_foundations_prefixes[] = { "Decks:", "Deck:", "Founds:", "Foundations:", "Foundation:", "Found:", NULL};
-#ifdef WIN32
+#if defined(WIN32) && (!defined(HAVE_STRNCASECMP))
+#ifndef strncasecmp
 #define strncasecmp(a,b,c) (strnicmp((a),(b),(c)))
 #endif
+#endif
 
 #ifdef INDIRECT_STACK_STATES
 #define fc_solve_initial_user_state_to_c(string, out_state, freecells_num, stacks_num, decks_num, indirect_stacks_buffer) \

fc-solve/source/ver.txt

-3.20.0
+3.20.1