gnu: Add cpp-httplib.

* gnu/packages/cpp.scm (cpp-httplib): New variable.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
This commit is contained in:
nixo 2021-01-27 23:44:04 +01:00 committed by Ludovic Courtès
parent 49bb544b77
commit ed4dd53b1e
No known key found for this signature in database
GPG key ID: 090B11993D9AEBB5

View file

@ -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 @@ (define-module (gnu packages cpp)
#: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 @@ (define-public gperftools
@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")