From 5ea66aa57f81976d39c60f59357ddf6027fadabb Mon Sep 17 00:00:00 2001 From: nixo Date: Wed, 27 Jan 2021 23:44:04 +0100 Subject: [PATCH v5 1/4] gnu: Add cpp-httplib. * gnu/packages/cpp.scm (cpp-httplib): New variable. --- 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 58345e7c33..307e5c3028 100644 --- a/gnu/packages/cpp.scm +++ b/gnu/packages/cpp.scm @@ -18,7 +18,7 @@ ;;; Copyright © 2020 Brett Gilio ;;; Copyright © 2020 Milkey Mouse ;;; Copyright © 2021 Raghav Gururajan - +;;; Copyright © 2021 Nicolò Balzarotti ;;; ;;; This file is part of GNU Guix. ;;; @@ -65,6 +65,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) @@ -555,6 +556,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") -- 2.31.1