From 489d16577e4a6ccc30f3719d9263900089edd842 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= Date: Tue, 10 Sep 2019 19:04:51 +0200 Subject: [PATCH] gnu: cmake: Add package variant that knows about X.509 certificates. Fixes . * gnu/packages/patches/cmake-curl-certificates.patch: New file. * gnu/local.mk (dist_patch_DATA): Add it. * gnu/packages/cmake.scm (cmake/fixed): New variable. --- gnu/local.mk | 1 + gnu/packages/cmake.scm | 12 ++++++ .../patches/cmake-curl-certificates.patch | 40 +++++++++++++++++++ 3 files changed, 53 insertions(+) create mode 100644 gnu/packages/patches/cmake-curl-certificates.patch diff --git a/gnu/local.mk b/gnu/local.mk index d76438ca63..3f32b9cbf2 100644 --- a/gnu/local.mk +++ b/gnu/local.mk @@ -744,6 +744,7 @@ dist_patch_DATA = \ %D%/packages/patches/clementine-use-openssl.patch \ %D%/packages/patches/clisp-remove-failing-test.patch \ %D%/packages/patches/clucene-pkgconfig.patch \ + %D%/packages/patches/cmake-curl-certificates.patch \ %D%/packages/patches/coda-use-system-libs.patch \ %D%/packages/patches/combinatorial-blas-awpm.patch \ %D%/packages/patches/combinatorial-blas-io-fix.patch \ diff --git a/gnu/packages/cmake.scm b/gnu/packages/cmake.scm index 7186cf98df..95f884b36d 100644 --- a/gnu/packages/cmake.scm +++ b/gnu/packages/cmake.scm @@ -164,6 +164,18 @@ and workspaces that can be used in the compiler environment of your choice.") license:expat ; cmjsoncpp is dual MIT/public domain license:public-domain)))) ; cmlibarchive/archive_getdate.c +(define-public cmake/fixed + ;; This is a variant of CMake that fixes X.509 certificate lookup: + ;; . + (package + (inherit cmake) + (version (string-append (package-version cmake) "-1")) + (source (origin + (inherit (package-source cmake)) + (patches + (append (search-patches "cmake-curl-certificates.patch") + (origin-patches (package-source cmake)))))))) + (define-public emacs-cmake-mode (package (inherit cmake) diff --git a/gnu/packages/patches/cmake-curl-certificates.patch b/gnu/packages/patches/cmake-curl-certificates.patch new file mode 100644 index 0000000000..36252083f8 --- /dev/null +++ b/gnu/packages/patches/cmake-curl-certificates.patch @@ -0,0 +1,40 @@ +By default commands such as "ctest" would not look for certificates +at all: . + +This changes CMake such that commands honor SSL_CERT_FILE and SSL_CERT_DIR +as well as /etc/ssl/certs. + +--- cmake-3.13.1/Source/cmCurl.cxx 2019-09-10 17:27:36.926907260 +0200 ++++ cmake-3.13.1/Source/cmCurl.cxx 2019-09-10 17:52:35.475903919 +0200 +@@ -4,11 +4,8 @@ + + #include "cmThirdParty.h" + +-#if !defined(CMAKE_USE_SYSTEM_CURL) && !defined(_WIN32) && \ +- !defined(__APPLE__) && !defined(CURL_CA_BUNDLE) && !defined(CURL_CA_PATH) + # define CMAKE_FIND_CAFILE + # include "cmSystemTools.h" +-#endif + + // curl versions before 7.21.5 did not provide this error code + #if defined(LIBCURL_VERSION_NUM) && LIBCURL_VERSION_NUM < 0x071505 +@@ -29,6 +26,19 @@ std::string cmCurlSetCAInfo(::CURL* curl + ::CURLcode res = ::curl_easy_setopt(curl, CURLOPT_CAINFO, cafile); + check_curl_result(res, "Unable to set TLS/SSL Verify CAINFO: "); + } ++ ++ /* Honor the usual environment variables. */ ++ else if (cmSystemTools::GetEnv("SSL_CERT_FILE", e)) { ++ ::CURLcode res = ++ ::curl_easy_setopt(curl, CURLOPT_CAINFO, e.c_str()); ++ check_curl_result(res, "Unable to set TLS/SSL Verify CAINFO: "); ++ } ++ else if (cmSystemTools::GetEnv("SSL_CERT_DIR", e)) { ++ ::CURLcode res = ++ ::curl_easy_setopt(curl, CURLOPT_CAPATH, e.c_str()); ++ check_curl_result(res, "Unable to set TLS/SSL Verify CAINFO: "); ++ } ++ + #ifdef CMAKE_FIND_CAFILE + # define CMAKE_CAFILE_FEDORA "/etc/pki/tls/certs/ca-bundle.crt" + else if (cmSystemTools::FileExists(CMAKE_CAFILE_FEDORA, true)) {