aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gnu/packages/cpp.scm63
1 files changed, 62 insertions, 1 deletions
diff --git a/gnu/packages/cpp.scm b/gnu/packages/cpp.scm
index ba921fac11..f4708eda91 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")