cmake_build: support SKIA_OUT and BUILDTYPE

And, fix BUILDTYPE=Debug build.
EQUAL is for numbers, STREQUAL for strings.

BUG=skia:

Review URL: https://codereview.chromium.org/1341763003
diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt
index ea02ddd..36a6d1e 100644
--- a/cmake/CMakeLists.txt
+++ b/cmake/CMakeLists.txt
@@ -54,7 +54,7 @@
 remove_srcs (../src/animator/* ../src/*nacl* ../src/svg/* ../src/views/* ../src/xml/*)
 
 # Some files only contain code in Debug mode.  This quiets down some linker warnings.
-if (NOT CMAKE_BUILD_TYPE EQUAL Debug)
+if (NOT CMAKE_BUILD_TYPE STREQUAL Debug)
     remove_srcs (../src/core/SkDebug.cpp ../src/utils/SkDumpCanvas.cpp)
 endif()
 
@@ -83,10 +83,10 @@
 endif()
 
 # Remove processor-specific source files.
-if (NOT CMAKE_SYSTEM_PROCESSOR EQUAL ARM)
+if (NOT CMAKE_SYSTEM_PROCESSOR STREQUAL ARM)
     remove_srcs(../src/*arm* ../src/*ARM* ../src/*neon* ../src/*NEON*)
 endif()
-if (NOT CMAKE_SYSTEM_PROCESSOR EQUAL MIPS)
+if (NOT CMAKE_SYSTEM_PROCESSOR STREQUAL MIPS)
     remove_srcs(../src/*mips* ../src/*MIPS*)
 endif()
 
diff --git a/cmake/cmake_build b/cmake/cmake_build
index 2ff7a9c..0d45d7d 100755
--- a/cmake/cmake_build
+++ b/cmake/cmake_build
@@ -10,9 +10,20 @@
 set -e
 set -x
 
-here=`dirname $0`
+fulldir() {
+    cd `dirname $1`
+    echo `pwd`
+}
+
+here=`fulldir $0`
 cores=32
 
+if [[ -z "$BUILDTYPE" || -z "$SKIA_OUT" ]]; then
+    echo "If you're a bot, you should be setting BUILDTYPE ($BUILDTYPE) and SKIA_OUT ($SKIA_OUT)."
+    echo "If you're not a bot, you don't want to run this script."
+    exit 1
+fi
+
 echo "Bootstrapping CMake"
 pushd $here/../third_party/externals/cmake
 ./bootstrap --parallel=$cores
@@ -20,7 +31,8 @@
 popd
 
 echo "Building with bootstrapped CMake"
-pushd $here
-../third_party/externals/cmake/bin/cmake . -G Ninja
+mkdir -p $SKIA_OUT
+pushd $SKIA_OUT
+$here/../third_party/externals/cmake/bin/cmake -DCMAKE_BUILD_TYPE=$BUILDTYPE $here -G Ninja
 ninja skia  # The default also builds `example`, which I'm leaving a TODO for now.
 popd