guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

01/05: gnu: Add cpp-httplib.


From: guix-commits
Subject: 01/05: gnu: Add cpp-httplib.
Date: Fri, 3 Sep 2021 16:38:09 -0400 (EDT)

civodul pushed a commit to branch master
in repository guix.

commit ed4dd53b1ee1dca1740b72ddc798a27cc4a012e6
Author: nixo <nicolo@nixo.xyz>
AuthorDate: Wed Jan 27 23:44:04 2021 +0100

    gnu: Add cpp-httplib.
    
    * gnu/packages/cpp.scm (cpp-httplib): New variable.
    
    Signed-off-by: Ludovic Courtès <ludo@gnu.org>
---
 gnu/packages/cpp.scm | 63 +++++++++++++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 62 insertions(+), 1 deletion(-)

diff --git a/gnu/packages/cpp.scm b/gnu/packages/cpp.scm
index ba921fa..f4708ed 100644
--- a/gnu/packages/cpp.scm
+++ b/gnu/packages/cpp.scm
@@ -18,7 +18,7 @@
 ;;; Copyright © 2020 Brett Gilio <brettg@gnu.org>
 ;;; Copyright © 2020 Milkey Mouse <milkeymouse@meme.institute>
 ;;; Copyright © 2021 Raghav Gururajan <rg@raghavgururajan.name>
-
+;;; Copyright © 2021 Nicolò Balzarotti <nicolo@nixo.xyz>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -66,6 +66,7 @@
   #:use-module (gnu packages maths)
   #:use-module (gnu packages onc-rpc)
   #:use-module (gnu packages perl)
+  #:use-module (gnu packages python)
   #:use-module (gnu packages pkg-config)
   #:use-module (gnu packages popt)
   #:use-module (gnu packages pretty-print)
@@ -556,6 +557,66 @@ tools:
 @end itemize\n")
     (license license:bsd-3)))
 
+(define-public cpp-httplib
+  ;; this package is not graftable, as everything is implemented in a single
+  ;; header
+  (package
+    (name "cpp-httplib")
+    (version "0.8.8")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/yhirose/cpp-httplib";)
+             (commit (string-append "v" version))))
+       (sha256
+        (base32 "0c0gyfbvm34bgrqy9fhfxw1f8nb9zhf063j7xq91k892flb7qm1c"))
+       (file-name (git-file-name name version))))
+    (build-system cmake-build-system)
+    (arguments
+     `(#:configure-flags
+       '("-DBUILD_SHARED_LIBS=ON"
+         "-DHTTPLIB_COMPILE=ON"
+         "-DHTTPLIB_REQUIRE_BROTLI=ON"
+         "-DHTTPLIB_REQUIRE_OPENSSL=ON"
+         "-DHTTPLIB_REQUIRE_ZLIB=ON")
+       #:phases
+       (modify-phases %standard-phases
+         (add-after 'unpack 'disable-network-tests
+           (lambda _
+             (for-each
+              (lambda (test)
+                (substitute* "test/test.cc"
+                  (((string-append "\\(" test))
+                   (string-append "(DISABLED_" test))))
+              ;; There are tests requiring network access, disable them
+              '("AbsoluteRedirectTest" "BaseAuthTest" "CancelTest"
+                "ChunkedEncodingTest" "ChunkedEncodingTest"
+                "DecodeWithChunkedEncoding" "DefaultHeadersTest"
+                "DigestAuthTest" "HttpsToHttpRedirectTest"
+                "RangeTest" "RedirectTest" "RelativeRedirectTest"
+                "SSLClientTest" "SendAPI" "TooManyRedirectTest" "UrlWithSpace"
+                "YahooRedirectTest" "YahooRedirectTest"))))
+         (replace 'check
+           (lambda* (#:key source tests? #:allow-other-keys)
+             ;; openssl genrsa wants to write a file in the git checkout
+             (when tests?
+               (with-directory-excursion "../source/test"
+                 (invoke "make"))))))))
+    (native-inputs
+     ;; required to build shared lib
+     `(("python" ,python)))
+    (inputs
+     `(("brotli" ,brotli)
+       ("openssl" ,openssl)
+       ("zlib" ,zlib)))
+    (home-page "https://github.com/yhirose/cpp-httplib";)
+    (synopsis "C++ HTTP/HTTPS server and client library")
+    (description "cpp-httplib is a C++11 single-file cross platform blocking
+HTTP/HTTPS library, easy to setup.  It can also be used as a single-header
+library.")
+    (license license:expat)))
+
 (define-public cpplint
   (package
     (name "cpplint")



reply via email to

[Prev in Thread] Current Thread [Next in Thread]