Remove Android build using Android.mk.

CMake support in Android is now standard and the CMake file
has fuller richer functionality than the Android.mk file ever did.

https://github.com/ceres-solver/ceres-solver/issues/364

Change-Id: Ib79bcc19dd47495a81a5d07fafdf06eb8005984e
diff --git a/docs/source/installation.rst b/docs/source/installation.rst
index 51ad156..781cd09 100644
--- a/docs/source/installation.rst
+++ b/docs/source/installation.rst
@@ -546,13 +546,6 @@
 your project must also be present in your android build config and
 your test directory on Android.
 
-Legacy Android
-==============
-
-Download the ``Android NDK`` version ``r9d`` or later. Run
-``ndk-build`` from inside the ``jni`` directory. Use the
-``libceres.a`` that gets created.
-
 .. _section-ios:
 
 iOS
diff --git a/jni/Android.mk b/jni/Android.mk
deleted file mode 100644
index 668f651..0000000
--- a/jni/Android.mk
+++ /dev/null
@@ -1,261 +0,0 @@
-# Ceres Solver - A fast non-linear least squares minimizer
-# Copyright 2015 Google Inc. All rights reserved.
-# http://ceres-solver.org/
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions are met:
-#
-# * Redistributions of source code must retain the above copyright notice,
-#   this list of conditions and the following disclaimer.
-# * Redistributions in binary form must reproduce the above copyright notice,
-#   this list of conditions and the following disclaimer in the documentation
-#   and/or other materials provided with the distribution.
-# * Neither the name of Google Inc. nor the names of its contributors may be
-#   used to endorse or promote products derived from this software without
-#   specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
-# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-# POSSIBILITY OF SUCH DAMAGE.
-#
-# Author: settinger@google.com (Scott Ettinger)
-#         keir@google.com (Keir Mierle)
-#
-# Builds Ceres for Android, using the standard toolchain (not
-# standalone). It uses LLVM's libc++ as the standard library. It is a
-# modern BSD licensed implementation of the standard c++ library. We
-# do this to avoid any licensing issues that may arise from using
-# GCC's libstdc++ which is licensed under GPL3.
-#
-# Building
-# --------
-#
-# You will have to specify the environment EIGEN_PATH to point to the
-# Eigen sources when building. For example:
-#
-#   EIGEN_PATH=/home/keir/src/eigen-3.0.5 ndk-build -j
-#
-# It is also possible to specify CERES_EXTRA_DEFINES, in case you need
-# to pass more definitions to the C compiler.
-#
-# Using the library
-# -----------------
-# Copy the static library:
-#
-#   ../obj/local/armeabi-v7a/libceres.a
-#
-# into your own project, then link it into your binary in your
-# Android.mk file.
-#
-# Reducing binary size
-# --------------------
-# This build includes the Schur specializations, which increase the
-# size of the binary. If you don't need them for your application,
-# consider adding:
-#
-#   -DCERES_RESTRICT_SCHUR_SPECIALIZATION
-#
-# to the LOCAL_CFLAGS variable below.
-#
-# Changing the logging library
-# ----------------------------
-# Ceres Solver ships with a replacement for glog that provides a
-# simple and small implementation that builds on Android. However, if
-# you wish to supply a header only version yourself, then you may
-# define CERES_GLOG_DIR to point to it.
-
-LOCAL_PATH := $(call my-dir)
-
-# Ceres requires at least NDK version r9d to compile.
-ifneq ($(shell $(LOCAL_PATH)/assert_ndk_version.sh "r9d" $(NDK_ROOT)), true)
-  $(error Ceres requires NDK version r9d or greater)
-endif
-
-# Ceres requires Eigen to build.
-ifndef EIGEN_PATH
-  $(error Ceres requires Eigen; please invoke via EIGEN_PATH=... ndk-build)
-endif
-
-EIGEN_PATH := $(EIGEN_PATH)
-CERES_INCLUDE_PATHS := $(CERES_EXTRA_INCLUDES)
-CERES_INCLUDE_PATHS += $(LOCAL_PATH)/../internal
-CERES_INCLUDE_PATHS += $(LOCAL_PATH)/../internal/ceres
-CERES_INCLUDE_PATHS += $(LOCAL_PATH)/../include
-CERES_INCLUDE_PATHS += $(LOCAL_PATH)/../config
-
-# Use the alternate glog implementation if provided by the user.
-ifdef CERES_GLOG_DIR
-  CERES_INCLUDE_PATHS += $(CERES_GLOG_DIR)
-else
-  CERES_INCLUDE_PATHS += $(LOCAL_PATH)/../internal/ceres/miniglog
-endif
-CERES_SRC_PATH := ../internal/ceres
-
-include $(CLEAR_VARS)
-LOCAL_C_INCLUDES := $(CERES_INCLUDE_PATHS)
-LOCAL_C_INCLUDES += $(EIGEN_PATH)
-
-LOCAL_CPP_EXTENSION := .cc
-LOCAL_CFLAGS := $(CERES_EXTRA_DEFINES) \
-                -DCERES_NO_LAPACK \
-                -DCERES_NO_SUITESPARSE \
-                -DCERES_NO_CXSPARSE \
-                -DCERES_NO_ACCELERATE_SPARSE \
-                -DCERES_USE_EIGEN_SPARSE \
-                -DCERES_USE_OPENMP
-
-LOCAL_SRC_FILES := $(CERES_SRC_PATH)/accelerate_sparse.cc \
-                   $(CERES_SRC_PATH)/array_utils.cc \
-                   $(CERES_SRC_PATH)/blas.cc \
-                   $(CERES_SRC_PATH)/block_evaluate_preparer.cc \
-                   $(CERES_SRC_PATH)/block_jacobian_writer.cc \
-                   $(CERES_SRC_PATH)/block_jacobi_preconditioner.cc \
-                   $(CERES_SRC_PATH)/block_random_access_dense_matrix.cc \
-                   $(CERES_SRC_PATH)/block_random_access_diagonal_matrix.cc \
-                   $(CERES_SRC_PATH)/block_random_access_matrix.cc \
-                   $(CERES_SRC_PATH)/block_random_access_sparse_matrix.cc \
-                   $(CERES_SRC_PATH)/block_sparse_matrix.cc \
-                   $(CERES_SRC_PATH)/block_structure.cc \
-                   $(CERES_SRC_PATH)/callbacks.cc \
-                   $(CERES_SRC_PATH)/canonical_views_clustering.cc \
-                   $(CERES_SRC_PATH)/cgnr_solver.cc \
-                   $(CERES_SRC_PATH)/compressed_row_jacobian_writer.cc \
-                   $(CERES_SRC_PATH)/compressed_row_sparse_matrix.cc \
-                   $(CERES_SRC_PATH)/conditioned_cost_function.cc \
-                   $(CERES_SRC_PATH)/conjugate_gradients_solver.cc \
-                   $(CERES_SRC_PATH)/context.cc \
-                   $(CERES_SRC_PATH)/context_impl.cc \
-                   $(CERES_SRC_PATH)/coordinate_descent_minimizer.cc \
-                   $(CERES_SRC_PATH)/corrector.cc \
-                   $(CERES_SRC_PATH)/covariance.cc \
-                   $(CERES_SRC_PATH)/covariance_impl.cc \
-                   $(CERES_SRC_PATH)/dense_normal_cholesky_solver.cc \
-                   $(CERES_SRC_PATH)/dense_qr_solver.cc \
-                   $(CERES_SRC_PATH)/dense_sparse_matrix.cc \
-                   $(CERES_SRC_PATH)/detect_structure.cc \
-                   $(CERES_SRC_PATH)/dogleg_strategy.cc \
-                   $(CERES_SRC_PATH)/dynamic_compressed_row_jacobian_writer.cc \
-                   $(CERES_SRC_PATH)/dynamic_compressed_row_sparse_matrix.cc \
-                   $(CERES_SRC_PATH)/dynamic_sparse_normal_cholesky_solver.cc \
-                   $(CERES_SRC_PATH)/eigensparse.cc \
-                   $(CERES_SRC_PATH)/evaluator.cc \
-                   $(CERES_SRC_PATH)/file.cc \
-                   $(CERES_SRC_PATH)/function_sample.cc \
-                   $(CERES_SRC_PATH)/gradient_checker.cc \
-                   $(CERES_SRC_PATH)/gradient_checking_cost_function.cc \
-                   $(CERES_SRC_PATH)/gradient_problem.cc \
-                   $(CERES_SRC_PATH)/gradient_problem_solver.cc \
-                   $(CERES_SRC_PATH)/is_close.cc \
-                   $(CERES_SRC_PATH)/implicit_schur_complement.cc \
-                   $(CERES_SRC_PATH)/inner_product_computer.cc \
-                   $(CERES_SRC_PATH)/iterative_refiner.cc \
-                   $(CERES_SRC_PATH)/iterative_schur_complement_solver.cc \
-                   $(CERES_SRC_PATH)/lapack.cc \
-                   $(CERES_SRC_PATH)/levenberg_marquardt_strategy.cc \
-                   $(CERES_SRC_PATH)/line_search.cc \
-                   $(CERES_SRC_PATH)/line_search_direction.cc \
-                   $(CERES_SRC_PATH)/line_search_minimizer.cc \
-                   $(CERES_SRC_PATH)/linear_least_squares_problems.cc \
-                   $(CERES_SRC_PATH)/linear_operator.cc \
-                   $(CERES_SRC_PATH)/line_search_preprocessor.cc \
-                   $(CERES_SRC_PATH)/linear_solver.cc \
-                   $(CERES_SRC_PATH)/local_parameterization.cc \
-                   $(CERES_SRC_PATH)/loss_function.cc \
-                   $(CERES_SRC_PATH)/low_rank_inverse_hessian.cc \
-                   $(CERES_SRC_PATH)/minimizer.cc \
-                   $(CERES_SRC_PATH)/normal_prior.cc \
-                   $(CERES_SRC_PATH)/parallel_utils.cc \
-                   $(CERES_SRC_PATH)/parallel_for_openmp.cc \
-                   $(CERES_SRC_PATH)/parameter_block_ordering.cc \
-                   $(CERES_SRC_PATH)/partitioned_matrix_view.cc \
-                   $(CERES_SRC_PATH)/polynomial.cc \
-                   $(CERES_SRC_PATH)/preconditioner.cc \
-                   $(CERES_SRC_PATH)/preprocessor.cc \
-                   $(CERES_SRC_PATH)/problem.cc \
-                   $(CERES_SRC_PATH)/problem_impl.cc \
-                   $(CERES_SRC_PATH)/program.cc \
-                   $(CERES_SRC_PATH)/reorder_program.cc \
-                   $(CERES_SRC_PATH)/residual_block.cc \
-                   $(CERES_SRC_PATH)/residual_block_utils.cc \
-                   $(CERES_SRC_PATH)/schur_complement_solver.cc \
-                   $(CERES_SRC_PATH)/schur_eliminator.cc \
-                   $(CERES_SRC_PATH)/schur_jacobi_preconditioner.cc \
-                   $(CERES_SRC_PATH)/schur_templates.cc \
-                   $(CERES_SRC_PATH)/scratch_evaluate_preparer.cc \
-                   $(CERES_SRC_PATH)/single_linkage_clustering.cc \
-                   $(CERES_SRC_PATH)/solver.cc \
-                   $(CERES_SRC_PATH)/solver_utils.cc \
-                   $(CERES_SRC_PATH)/sparse_cholesky.cc \
-                   $(CERES_SRC_PATH)/sparse_matrix.cc \
-                   $(CERES_SRC_PATH)/sparse_normal_cholesky_solver.cc \
-                   $(CERES_SRC_PATH)/split.cc \
-                   $(CERES_SRC_PATH)/stringprintf.cc \
-                   $(CERES_SRC_PATH)/subset_preconditioner.cc \
-                   $(CERES_SRC_PATH)/suitesparse.cc \
-                   $(CERES_SRC_PATH)/thread_token_provider.cc \
-                   $(CERES_SRC_PATH)/triplet_sparse_matrix.cc \
-                   $(CERES_SRC_PATH)/trust_region_minimizer.cc \
-                   $(CERES_SRC_PATH)/trust_region_preprocessor.cc \
-                   $(CERES_SRC_PATH)/trust_region_step_evaluator.cc \
-                   $(CERES_SRC_PATH)/trust_region_strategy.cc \
-                   $(CERES_SRC_PATH)/types.cc \
-                   $(CERES_SRC_PATH)/visibility_based_preconditioner.cc \
-                   $(CERES_SRC_PATH)/visibility.cc \
-                   $(CERES_SRC_PATH)/wall_time.cc \
-                   $(CERES_SRC_PATH)/generated/schur_eliminator_d_d_d.cc \
-                   $(CERES_SRC_PATH)/generated/schur_eliminator_2_2_2.cc \
-                   $(CERES_SRC_PATH)/generated/schur_eliminator_2_2_3.cc \
-                   $(CERES_SRC_PATH)/generated/schur_eliminator_2_2_4.cc \
-                   $(CERES_SRC_PATH)/generated/schur_eliminator_2_2_d.cc \
-                   $(CERES_SRC_PATH)/generated/schur_eliminator_2_3_3.cc \
-                   $(CERES_SRC_PATH)/generated/schur_eliminator_2_3_4.cc \
-                   $(CERES_SRC_PATH)/generated/schur_eliminator_2_3_6.cc \
-                   $(CERES_SRC_PATH)/generated/schur_eliminator_2_3_9.cc \
-                   $(CERES_SRC_PATH)/generated/schur_eliminator_2_3_d.cc \
-                   $(CERES_SRC_PATH)/generated/schur_eliminator_2_4_3.cc \
-                   $(CERES_SRC_PATH)/generated/schur_eliminator_2_4_4.cc \
-                   $(CERES_SRC_PATH)/generated/schur_eliminator_2_4_6.cc \
-                   $(CERES_SRC_PATH)/generated/schur_eliminator_2_4_8.cc \
-                   $(CERES_SRC_PATH)/generated/schur_eliminator_2_4_9.cc \
-                   $(CERES_SRC_PATH)/generated/schur_eliminator_2_4_d.cc \
-                   $(CERES_SRC_PATH)/generated/schur_eliminator_2_d_d.cc \
-                   $(CERES_SRC_PATH)/generated/schur_eliminator_4_4_2.cc \
-                   $(CERES_SRC_PATH)/generated/schur_eliminator_4_4_3.cc \
-                   $(CERES_SRC_PATH)/generated/schur_eliminator_4_4_4.cc \
-                   $(CERES_SRC_PATH)/generated/schur_eliminator_4_4_d.cc \
-                   $(CERES_SRC_PATH)/generated/partitioned_matrix_view_d_d_d.cc \
-                   $(CERES_SRC_PATH)/generated/partitioned_matrix_view_2_2_2.cc \
-                   $(CERES_SRC_PATH)/generated/partitioned_matrix_view_2_2_3.cc \
-                   $(CERES_SRC_PATH)/generated/partitioned_matrix_view_2_2_4.cc \
-                   $(CERES_SRC_PATH)/generated/partitioned_matrix_view_2_2_d.cc \
-                   $(CERES_SRC_PATH)/generated/partitioned_matrix_view_2_3_3.cc \
-                   $(CERES_SRC_PATH)/generated/partitioned_matrix_view_2_3_4.cc \
-                   $(CERES_SRC_PATH)/generated/partitioned_matrix_view_2_3_6.cc \
-                   $(CERES_SRC_PATH)/generated/partitioned_matrix_view_2_3_9.cc \
-                   $(CERES_SRC_PATH)/generated/partitioned_matrix_view_2_3_d.cc \
-                   $(CERES_SRC_PATH)/generated/partitioned_matrix_view_2_4_3.cc \
-                   $(CERES_SRC_PATH)/generated/partitioned_matrix_view_2_4_4.cc \
-                   $(CERES_SRC_PATH)/generated/partitioned_matrix_view_2_4_6.cc \
-                   $(CERES_SRC_PATH)/generated/partitioned_matrix_view_2_4_8.cc \
-                   $(CERES_SRC_PATH)/generated/partitioned_matrix_view_2_4_9.cc \
-                   $(CERES_SRC_PATH)/generated/partitioned_matrix_view_2_4_d.cc \
-                   $(CERES_SRC_PATH)/generated/partitioned_matrix_view_2_d_d.cc \
-                   $(CERES_SRC_PATH)/generated/partitioned_matrix_view_4_4_2.cc \
-                   $(CERES_SRC_PATH)/generated/partitioned_matrix_view_4_4_3.cc \
-                   $(CERES_SRC_PATH)/generated/partitioned_matrix_view_4_4_4.cc \
-                   $(CERES_SRC_PATH)/generated/partitioned_matrix_view_4_4_d.cc
-
-ifndef CERES_GLOG_DIR
-LOCAL_SRC_FILES += $(CERES_SRC_PATH)/miniglog/glog/logging.cc
-endif
-
-LOCAL_MODULE := ceres
-include $(BUILD_STATIC_LIBRARY)
diff --git a/jni/Application.mk b/jni/Application.mk
deleted file mode 100644
index e3b7114..0000000
--- a/jni/Application.mk
+++ /dev/null
@@ -1,39 +0,0 @@
-# Ceres Solver - A fast non-linear least squares minimizer
-# Copyright 2015 Google Inc. All rights reserved.
-# http://ceres-solver.org/
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions are met:
-#
-# * Redistributions of source code must retain the above copyright notice,
-#   this list of conditions and the following disclaimer.
-# * Redistributions in binary form must reproduce the above copyright notice,
-#   this list of conditions and the following disclaimer in the documentation
-#   and/or other materials provided with the distribution.
-# * Neither the name of Google Inc. nor the names of its contributors may be
-#   used to endorse or promote products derived from this software without
-#   specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
-# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-# POSSIBILITY OF SUCH DAMAGE.
-
-APP_BUILD_SCRIPT := $(call my-dir)/Android.mk
-APP_PROJECT_PATH := $(call my-dir)
-
-APP_CPPFLAGS += -fno-exceptions
-APP_CPPFLAGS += -fno-rtti
-APP_OPTIM := release
-
-# Use libc++ from LLVM. It is a modern BSD licensed implementation of
-# the standard C++ library.
-APP_STL := c++_static
-APP_ABI := armeabi-v7a
diff --git a/jni/assert_ndk_version.sh b/jni/assert_ndk_version.sh
deleted file mode 100755
index 3932e1c..0000000
--- a/jni/assert_ndk_version.sh
+++ /dev/null
@@ -1,137 +0,0 @@
-#!/bin/bash
-
-# Bash script to assert that the current version of the NDK is at least the
-# specified version. Prints 'true' to standard out if it's the right version,
-# 'false' if it's not.
-#
-# Typically used like this, in your jni/Android.mk:
-#
-#   ifneq ($(shell $(LOCAL_PATH)/assert_ndk_version.sh "r5c" "ndk-dir"), true)
-#     $(error NDK version r5c or greater required)
-#   endif
-#
-# See https://gist.github.com/2878774 for asserting SDK version.
-#
-# Retrieved from: https://gist.github.com/jorgenpt/1961404 on 2014-06-03.
-#
-# Copyright (c) 2012, Lookout, Inc. All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions are met:
-#
-# 1. Redistributions of source code must retain the above copyright notice,
-#    this list of conditions and the following disclaimer.
-#
-# 2. Redistributions in binary form must reproduce the above copyright
-#    notice, this list of conditions and the following disclaimer in the
-#    documentation and/or other materials provided with the distribution.
-#
-# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
-# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
-# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
-# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
-# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
-# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
-# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-# Author: jorgenpt@gmail.com (Jorgen Tjerno)
-#         alexs.mac@gmail.com (Alex Stewart)
-
-# Extracts 'r5c' into '5 c', also handles newer versions of the form
-# 'r9d (64-bit)' and versions >= 10.
-function get_major_minor_rNx_style() {
-  # r9d (64-bit) -> '9d', also handle versions >= 10.
-  local version=$(echo "$1" | sed 's/r\([0-9]\{1,2\}[a-z]\{0,1\}\).*/\1/')
-  local major=$(echo "$version" | sed 's/\([0-9]\{1,2\}\).*/\1/')
-  local minor=$(echo "$version" | sed 's/^[0-9]*//')
-  echo "$major $minor"
-}
-
-# Extracts the major and minor versions from the <NDK_ROOT>/source.properties
-# file and converts to the standard <NUMBER> <LETTER> format, e.g. 15 c.
-#
-# Usage: get_major_minor_from_source_properties <SOURCE_PROPERTIES_CONTENTS>
-function get_major_minor_from_source_properties() {
-  # <NDK_ROOT>/source.properties contains (e.g. for r15c):
-  #
-  # Pkg.Desc = Android NDK
-  # Pkg.Revision = 15.2.4203891
-  #
-  # match to 15 c
-  version=$(echo $1 | sed 's/.*Pkg.Revision[[:space:]]*=[[:space:]]*//')
-  declare -r major=$(echo $version | sed 's/\([0-9]\{1,2\}\).*/\1/')
-  declare -r minor=$(echo $version | sed 's/\([0-9]\{1,2\}\)\.\([0-9]\{1,2\}\).*/\2/')
-  declare -r patch=$(echo $version | sed 's/\([0-9]\{1,2\}\)\.\([0-9]\{1,2\}\)\.\([0-9]*\)/\3/')
-  # Convert numeric minor version to letter version, e.g: 0 -> a, 1 -> b, 2 -> c etc.
-  minor_letter_ascii_code=$(($minor + 97)) # 97 = 'a' in ASCII.
-  minor_letter=($(printf "\\$(printf %o "$minor_letter_ascii_code")"))
-  echo "$major $minor_letter"
-}
-
-if [[ -z "$2" ]]; then
-  echo "Usage: $0 <required version> <NDK_ROOT>" >&2
-  echo " For example: $0 r5c android-ndk-r9d" >&2
-  exit 1
-fi
-
-# Assert that the expected version is at least 4.
-declare -a expected_version
-expected_version=( $(get_major_minor_rNx_style "$1") )
-if [[ ${expected_version[0]} -le 4 ]]; then
-  echo "Cannot test for versions less than r5: r4 doesn't have a version file." >&2
-  echo false
-  exit 1
-fi
-
-# NDK versions <= r4 did not have RELEASE.TXT, nor do versions >= r11, where it was
-# replaced by source.properties.  As we just asserted that we are looking for >= r5
-# if RELEASE.TXT is not present, source.properties should be.
-declare -r release_file="$2/RELEASE.TXT"
-declare -r source_properties_file="$2/source.properties"
-declare -a actual_version
-if [ ! -s "$release_file" ]; then
-  if [ ! -s "$source_properties_file" ]; then
-    echo "ERROR: Failed to find either RELEASE.TXT or source.properties in NDK_ROOT=$2" >&2
-    echo false
-    exit 1
-  fi
-  # NDK version >= r11.
-  if [ ! -s "$source_properties_file" ]; then
-     echo "ERROR: Failed to find source.properties file in NDK_ROOT=$1" >&2
-     echo false
-     exit 1
-  fi
-  source_properties=$(<"$source_properties_file")
-  actual_version=($(get_major_minor_from_source_properties "$source_properties"))
-  if [ -z "$source_properties" ] || [ -z "${actual_version[0]}" ]; then
-    echo "ERROR: Invalid source.properties: $(cat $source_properties_file)" >&2
-    echo false
-    exit 1
-  fi
-else
-  # NDK version >= r5 && < r11.
-  version=$(grep '^r' $release_file)
-  actual_version=( $(get_major_minor_rNx_style "$version") )
-  if [ -z "$version" ] || [ -z "${actual_version[0]}" ]; then
-    echo "ERROR: Invalid RELEASE.TXT: $(cat $release_file)" >&2
-    echo false
-    exit 1
-  fi
-fi
-
-if [[ ${actual_version[0]} -lt ${expected_version[0]} ]]; then
-  echo "false"
-elif [[ ${actual_version[0]} -eq ${expected_version[0]} ]]; then
-  # This uses < and not -lt because they're string identifiers (a, b, c, etc)
-  if [[ "${actual_version[1]}" < "${expected_version[1]}" ]]; then
-    echo "false"
-  else
-    echo "true"
-  fi
-else
-  echo "true"
-fi