From 839129b86453f0b0b2b47dac5502ecc3dae7ffb3 Mon Sep 17 00:00:00 2001
From: Daniel Engberg <daniel.engberg.lists@pyret.net>
Date: Sat, 30 Sep 2017 11:00:32 +0200
Subject: [PATCH] tools/cmake: Update to 3.9.3

Update CMake to 3.9.3
Remove FreeBSD patch (not needed)
Rearrage and update patches

Signed-off-by: Daniel Engberg <daniel.engberg.lists@pyret.net>
---
 tools/cmake/Makefile                          |  6 +--
 .../cmake/patches/100-disable_qt_tests.patch  |  4 +-
 ...pat.patch => 110-alpine_musl-compat.patch} |  0
 tools/cmake/patches/110-freebsd-compat.patch  | 39 -------------------
 ... 120-libarchive-fix-libressl-compat.patch} |  0
 ...ch => 130-curl-fix-libressl-linking.patch} | 23 +++++------
 ...=> 140-bootstrap_parallel_make_flag.patch} |  2 +-
 7 files changed, 18 insertions(+), 56 deletions(-)
 rename tools/cmake/patches/{120-alpine_musl-compat.patch => 110-alpine_musl-compat.patch} (100%)
 delete mode 100644 tools/cmake/patches/110-freebsd-compat.patch
 rename tools/cmake/patches/{130-libarchive-fix-libressl-compat.patch => 120-libarchive-fix-libressl-compat.patch} (100%)
 rename tools/cmake/patches/{140-curl-fix-libressl-linking.patch => 130-curl-fix-libressl-linking.patch} (66%)
 rename tools/cmake/patches/{150-bootstrap_parallel_make_flag.patch => 140-bootstrap_parallel_make_flag.patch} (89%)

diff --git a/tools/cmake/Makefile b/tools/cmake/Makefile
index a94942f84c..2c7b53e5c4 100644
--- a/tools/cmake/Makefile
+++ b/tools/cmake/Makefile
@@ -7,12 +7,12 @@
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=cmake
-PKG_VERSION:=3.8.1
+PKG_VERSION:=3.9.3
 
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
-PKG_SOURCE_URL:=https://cmake.org/files/v3.8/ \
+PKG_SOURCE_URL:=https://cmake.org/files/v3.9/ \
 		https://fossies.org/linux/misc/
-PKG_HASH:=ce5d9161396e06501b00e52933783150a87c33080d4bdcef461b5b7fd24ac228
+PKG_HASH:=8eaf75e1e932159aae98ab5e7491499545554be62a08cbcbc7c75c84b999f28a
 
 HOST_BUILD_PARALLEL:=1
 HOST_CONFIGURE_PARALLEL:=1
diff --git a/tools/cmake/patches/100-disable_qt_tests.patch b/tools/cmake/patches/100-disable_qt_tests.patch
index 54a75bc776..f8baafe333 100644
--- a/tools/cmake/patches/100-disable_qt_tests.patch
+++ b/tools/cmake/patches/100-disable_qt_tests.patch
@@ -1,6 +1,6 @@
 --- a/Tests/RunCMake/CMakeLists.txt
 +++ b/Tests/RunCMake/CMakeLists.txt
-@@ -244,15 +244,6 @@ add_RunCMake_test(no_install_prefix)
+@@ -246,15 +246,6 @@ add_RunCMake_test(no_install_prefix)
  add_RunCMake_test(configure_file)
  add_RunCMake_test(CTestTimeoutAfterMatch)
  
@@ -18,7 +18,7 @@
    add_RunCMake_test(FindPkgConfig)
 --- a/Tests/CMakeLists.txt
 +++ b/Tests/CMakeLists.txt
-@@ -398,10 +398,6 @@ if(BUILD_TESTING)
+@@ -403,10 +403,6 @@ if(BUILD_TESTING)
  
    list(APPEND TEST_BUILD_DIRS ${CMake_TEST_INSTALL_PREFIX})
  
diff --git a/tools/cmake/patches/120-alpine_musl-compat.patch b/tools/cmake/patches/110-alpine_musl-compat.patch
similarity index 100%
rename from tools/cmake/patches/120-alpine_musl-compat.patch
rename to tools/cmake/patches/110-alpine_musl-compat.patch
diff --git a/tools/cmake/patches/110-freebsd-compat.patch b/tools/cmake/patches/110-freebsd-compat.patch
deleted file mode 100644
index 4f11078461..0000000000
--- a/tools/cmake/patches/110-freebsd-compat.patch
+++ /dev/null
@@ -1,39 +0,0 @@
-From 6eab64c3adc7a38c322cd4d9a1a1881f2d49cb9c Mon Sep 17 00:00:00 2001
-From: Raphael Kubo da Costa <rakuco@FreeBSD.org>
-Date: Tue, 15 Oct 2013 00:10:56 +0300
-Subject: [PATCH] SystemInformation: Include backtrace-related headers on
- FreeBSD
-
-This was probably broken for a long while, but the problem was not apparent
-because the check for execinfo.h would fail by default because
--I/usr/local/include was not being passed to the compiler when making the
-checks for the header's existence.
-
-Now that very recent FreeBSD versions (ie. 10-CURRENT) have NetBSD's
-libexecinfo in base (and it is thus installed into /usr), the
-backtrace-related checks would pass, but the required headers were not being
-included in SystemInformation.cxx.
-
-Change-Id: I3b91ed7ac0e6878035aee202b3336c536cc6d2ff
----
- Source/kwsys/SystemInformation.cxx |    9 +++++++++
- 1 file changed, 9 insertions(+)
-
---- a/Source/kwsys/SystemInformation.cxx
-+++ b/Source/kwsys/SystemInformation.cxx
-@@ -82,6 +82,15 @@ typedef int siginfo_t;
- #include <net/if.h>
- #define KWSYS_SYSTEMINFORMATION_IMPLEMENT_FQDN
- #endif
-+# if defined(KWSYS_SYSTEMINFORMATION_HAS_BACKTRACE)
-+#  include <execinfo.h>
-+#  if defined(KWSYS_SYSTEMINFORMATION_HAS_CPP_DEMANGLE)
-+#    include <cxxabi.h>
-+#  endif
-+#  if defined(KWSYS_SYSTEMINFORMATION_HAS_SYMBOL_LOOKUP)
-+#    include <dlfcn.h>
-+#  endif
-+# endif
- #endif
- 
- #if defined(KWSYS_SYS_HAS_MACHINE_CPU_H)
diff --git a/tools/cmake/patches/130-libarchive-fix-libressl-compat.patch b/tools/cmake/patches/120-libarchive-fix-libressl-compat.patch
similarity index 100%
rename from tools/cmake/patches/130-libarchive-fix-libressl-compat.patch
rename to tools/cmake/patches/120-libarchive-fix-libressl-compat.patch
diff --git a/tools/cmake/patches/140-curl-fix-libressl-linking.patch b/tools/cmake/patches/130-curl-fix-libressl-linking.patch
similarity index 66%
rename from tools/cmake/patches/140-curl-fix-libressl-linking.patch
rename to tools/cmake/patches/130-curl-fix-libressl-linking.patch
index c16e927ff3..1a15ff47af 100644
--- a/tools/cmake/patches/140-curl-fix-libressl-linking.patch
+++ b/tools/cmake/patches/130-curl-fix-libressl-linking.patch
@@ -17,16 +17,17 @@ Modify the cmcurl CMakeLists.txt to check for clock_gettime() in librt
 and unconditionally link the rt library when the symbol is found.
 
 Signed-off-by: Jo-Philipp Wich <jo@mein.io>
+---
 --- a/Utilities/cmcurl/CMakeLists.txt
 +++ b/Utilities/cmcurl/CMakeLists.txt
-@@ -374,6 +374,10 @@ set(HAVE_LIBSSL OFF)
- if(CMAKE_USE_OPENSSL)
-   find_package(OpenSSL)
-   if(OPENSSL_FOUND)
-+    check_library_exists("rt" clock_gettime "" HAVE_LIBRT)
-+    if(HAVE_LIBRT)
-+      list(APPEND OPENSSL_LIBRARIES rt)
-+    endif()
-     list(APPEND CURL_LIBS ${OPENSSL_LIBRARIES})
-     set(USE_OPENSSL ON)
-     set(HAVE_LIBCRYPTO ON)
+@@ -471,6 +471,10 @@ if(CMAKE_USE_OPENSSL)
+   check_symbol_exists(RAND_status "${CURL_INCLUDES}" HAVE_RAND_STATUS)
+   check_symbol_exists(RAND_screen "${CURL_INCLUDES}" HAVE_RAND_SCREEN)
+   check_symbol_exists(RAND_egd    "${CURL_INCLUDES}" HAVE_RAND_EGD)
++  check_library_exists("rt" clock_gettime "" HAVE_LIBRT)
++  if(HAVE_LIBRT)
++    list(APPEND OPENSSL_LIBRARIES rt)
++  endif()
+ 
+   # Optionally build with a specific CA cert bundle.
+   if(CURL_CA_BUNDLE)
diff --git a/tools/cmake/patches/150-bootstrap_parallel_make_flag.patch b/tools/cmake/patches/140-bootstrap_parallel_make_flag.patch
similarity index 89%
rename from tools/cmake/patches/150-bootstrap_parallel_make_flag.patch
rename to tools/cmake/patches/140-bootstrap_parallel_make_flag.patch
index 4d432dcc1e..734e8cb1cc 100644
--- a/tools/cmake/patches/150-bootstrap_parallel_make_flag.patch
+++ b/tools/cmake/patches/140-bootstrap_parallel_make_flag.patch
@@ -1,6 +1,6 @@
 --- a/bootstrap
 +++ b/bootstrap
-@@ -1046,7 +1046,10 @@ int main(){ printf("1%c", (char)0x0a); r
+@@ -1094,7 +1094,10 @@ int main(){ printf("1%c", (char)0x0a); r
  ' > "test.c"
  cmake_original_make_flags="${cmake_make_flags}"
  if [ "x${cmake_parallel_make}" != "x" ]; then
-- 
2.30.2