Subject: [bug#39197] [PATCH core-updates 2/4] gnu: cmake-minimal: Build with a minimal variant of cURL.

From: Marius Bakke <[email-masked]>
Date: Mon, 20 Jan 2020 00:20:04 +0100

This is necessary to avoid a circular dependency in the next commit.

* gnu/packages/curl.scm (curl-minimal): New public variable.
* gnu/packages/cmake.scm (cmake-minimal)[inputs]: Change from CURL to CURL-MINIMAL.
(cmake)[inputs]: Do the opposite.
---
 gnu/packages/cmake.scm |  5 ++++-
 gnu/packages/curl.scm  | 16 ++++++++++++++--
 2 files changed, 18 insertions(+), 3 deletions(-)

diff --git a/gnu/packages/cmake.scm b/gnu/packages/cmake.scm
index e24b6dea7d..d053935a86 100644
--- a/gnu/packages/cmake.scm
+++ b/gnu/packages/cmake.scm
@@ -152,7 +152,7 @@
              (apply invoke "./configure" configure-flags))))))
     (native-inputs
      `(("bzip2" ,bzip2)
-       ("curl" ,curl)
+       ("curl" ,curl-minimal)
        ("expat" ,expat)
        ("file" ,file)
        ("libarchive" ,libarchive)
@@ -221,6 +221,9 @@ and workspaces that can be used in the compiler environment of your choice.")
      `(,@(package-native-inputs cmake-minimal)
        ("python-sphinx" ,python-sphinx)
        ("texinfo" ,texinfo)))
+    (inputs
+     `(("curl" ,curl)
+       ,@(alist-delete "curl" (package-inputs cmake-minimal))))
     (outputs '("out" "doc"))
     (properties (alist-delete 'hidden? (package-properties cmake-minimal)))))
 
diff --git a/gnu/packages/curl.scm b/gnu/packages/curl.scm
index 3d230dc1f0..4a73b1f34c 100644
--- a/gnu/packages/curl.scm
+++ b/gnu/packages/curl.scm
@@ -4,7 +4,7 @@
 ;;; Copyright © 2015 Tomáš Čech <[email-masked]>
 ;;; Copyright © 2015 Ludovic Courtès <[email-masked]>
 ;;; Copyright © 2016, 2017, 2019 Leo Famulari <[email-masked]>
-;;; Copyright © 2017, 2019 Marius Bakke <[email-masked]>
+;;; Copyright © 2017, 2019, 2020 Marius Bakke <[email-masked]>
 ;;; Copyright © 2017 Efraim Flashner <[email-masked]>
 ;;; Copyright © 2017, 2018 Tobias Geerinckx-Rice <[email-masked]>
 ;;; Copyright © 2018 Roel Janssen <[email-masked]>
@@ -46,7 +46,8 @@
   #:use-module (gnu packages pkg-config)
   #:use-module (gnu packages python)
   #:use-module (gnu packages tls)
-  #:use-module (gnu packages web))
+  #:use-module (gnu packages web)
+  #:use-module (srfi srfi-1))
 
 (define-public curl
   (package
@@ -154,6 +155,17 @@ tunneling, and so on.")
                                   "See COPYING in the distribution."))
    (home-page "https://curl.haxx.se/")))
 
+;; This package is used to solve a cyclic dependency between 'cmake-minimal' and
+;; packages that use cmake-build-system such as 'libjpeg-turbo' (via ghostscript).
+;; It must not depend on anything that uses cmake-build-system.
+(define-public curl-minimal
+  (hidden-package
+   (package/inherit
+    curl
+    (name "curl-minimal")
+    (native-inputs (alist-delete "groff" (package-native-inputs curl)))
+    (inputs (alist-delete "openldap" (package-inputs curl))))))
+
 (define-public kurly
   (package
     (name "kurly")
-- 
2.24.1