Port 186.crafty benchmark

This doesn't currently work as fuchsia does not support redirection
operation for stdin

Change-Id: Ie99c534cc669ffe5482ec0b27ee5aa741259c1f7
diff --git a/186.crafty/BUILD.gn b/186.crafty/BUILD.gn
new file mode 100644
index 0000000..37eb0f4
--- /dev/null
+++ b/186.crafty/BUILD.gn
@@ -0,0 +1,54 @@
+# Copyright 2016 The Fuchsia Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+executable("186.crafty") {
+  sources = [
+    "src/attacks.c",
+    "src/boolean.c",
+    "src/draw.c",
+    "src/drawn.c",
+    "src/edit.c",
+    "src/enprise.c",
+    "src/evaluate.c",
+    "src/history.c",
+    "src/init.c",
+    "src/input.c",
+    "src/interupt.c",
+    "src/iterate.c",
+    "src/lookup.c",
+    "src/main.c",
+    "src/make.c",
+    "src/movgen.c",
+    "src/next.c",
+    "src/nexte.c",
+    "src/nextr.c",
+    "src/option.c",
+    "src/output.c",
+    "src/phase.c",
+    "src/ponder.c",
+    "src/preeval.c",
+    "src/quiesce.c",
+    "src/repeat.c",
+    "src/root.c",
+    "src/search.c",
+    "src/searchr.c",
+    "src/setboard.c",
+    "src/store.c",
+    "src/swap.c",
+    "src/time.c",
+    "src/unmake.c",
+    "src/utility.c",
+    "src/valid.c",
+    "src/validate.c",
+  ]
+  defines = [ "SPEC_CPU2000" ]
+  cflags_c = [
+    "-Wno-dangling-else",
+    "-Wno-implicit-function-declaration",
+    "-Wno-unused-variable",
+  ]
+  data = [
+    "data/ref/input/crafty.in",
+  ]
+}
diff --git a/186.crafty/fuchsia.patch b/186.crafty/fuchsia.patch
new file mode 100644
index 0000000..e1254dd
--- /dev/null
+++ b/186.crafty/fuchsia.patch
@@ -0,0 +1,15 @@
+diff -Nau0rbB src/chess.h src.patched/chess.h
+--- src/chess.h	2016-09-01 15:33:08.697210614 -0700
++++ src.patched/chess.h	2016-09-07 14:19:33.324383889 -0700
+@@ -157,0 +158,5 @@
++#if defined(__Fuchsia__)
++#  define  LONG_HAS_64BITS      /* the data type "long [int]" is represented in 64 bits either as the compiler's default option.*/
++#  define HAS_LONGLONG         /* the C compilation system supports the data-type "long long"(which is an extension to ANSI C) and represents data of this type with 64 bits  */
++#  define UNIX                 /* system is posix-based */
++#endif
+diff -Nau0rbB src/utility.c src.patched/utility.c
+--- src/utility.c	2016-09-01 15:33:08.697210614 -0700
++++ src.patched/utility.c	2016-09-07 14:16:31.965597129 -0700
+@@ -23 +23 @@
+-#  if !defined(LINUX) && !defined(ALPHA) && !defined(HP) && !defined(CRAY1) && !defined(FreeBSD)
++#  if !defined(LINUX) && !defined(ALPHA) && !defined(HP) && !defined(CRAY1) && !defined(FreeBSD) && !defined(__Fuchsia__)
diff --git a/BUILD.gn b/BUILD.gn
index 980f48f..5521c3a 100644
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -11,5 +11,6 @@
     "179.art",
     "181.mcf",
     "183.equake",
+    "186.crafty",
   ]
 }