diff mbox series

[bug#46788] gnu: Add qhttp.

Message ID 1696eb36-ffe5-18ce-81fa-7ddb87f486a7@raghavgururajan.name
State Accepted
Headers show
Series [bug#46788] gnu: Add qhttp. | expand

Checks

Context Check Description
cbaines/comparison success View comparision
cbaines/git branch success View Git branch
cbaines/applying patch fail View Laminar job
cbaines/issue success View issue

Commit Message

Raghav Gururajan Feb. 26, 2021, 1:37 a.m. UTC

diff mbox series

Patch

From 0b32a63b75d1faffcb7c7b5c71414eacce4b46e8 Mon Sep 17 00:00:00 2001
From: Raghav Gururajan <rg@raghavgururajan.name>
Date: Thu, 25 Feb 2021 19:45:04 -0500
Subject: [PATCH 2/3] gnu: Add qhttp.

* gnu/packages/web.scm (qhttp): New variable.
---
 gnu/packages/web.scm | 62 ++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 62 insertions(+)

diff --git a/gnu/packages/web.scm b/gnu/packages/web.scm
index e4ba0d5bf9..cb277947e9 100644
--- a/gnu/packages/web.scm
+++ b/gnu/packages/web.scm
@@ -170,6 +170,68 @@ 
   #:use-module (gnu packages xml)
   #:use-module ((srfi srfi-1) #:select (delete-duplicates)))
 
+(define-public qhttp
+  (package
+    (name "qhttp")
+    (version "3.1")
+    (source
+     (origin
+       (method git-fetch)
+       (uri
+        (git-reference
+         (url "https://github.com/azadkuh/qhttp.git")
+         (commit
+          (string-append "version-" version))))
+       (file-name
+        (git-file-name name version))
+       (sha256
+        (base32 "0cx23g4y4k4v9p5ph6h7gfhp8sfy1gcdv1g6bl44hppar1y0zfdq"))))
+    (build-system gnu-build-system)
+    (arguments
+     `(#:tests? #f                      ; No target
+       #:phases
+       (modify-phases %standard-phases
+         (add-after 'unpack 'patch-source
+           (lambda* (#:key outputs #:allow-other-keys)
+             (substitute* "commondir.pri"
+               (("\\$\\$PRJDIR/xbin")
+                (string-append (assoc-ref outputs "out") "/lib"))
+               (("-L")
+                "-lhttp_parser -L")
+               (("\\$\\$PRJDIR/3rdparty")
+                ""))
+             (substitute* "src/src.pro"
+               (("SOURCES  \\+= \\$\\$PRJDIR/3rdparty/http-parser/http_parser.c")
+                "")
+               (("HEADERS  \\+= \\$\\$PRJDIR/3rdparty/http-parser/http_parser.h")
+                ""))
+             (substitute* '("src/private/qhttpbase.hpp" "src/qhttpabstracts.cpp")
+               (("http-parser/http_parser.h")
+                "http_parser.h"))
+             #t))
+         (replace 'configure
+           (lambda _
+             (invoke "qmake")
+             #t))
+         (add-after 'install 'remove-examples
+           (lambda* (#:key outputs #:allow-other-keys)
+             (with-directory-excursion
+                 (string-append (assoc-ref outputs "out") "/lib")
+               (for-each delete-file
+                         (list
+                          "basic-server"
+                          "helloworld"
+                          "postcollector")))
+             #t)))))
+    (inputs
+     `(("http-parser" ,http-parser)
+       ("qtbase" ,qtbase)))
+    (synopsis "Qt-based HTTP Library")
+    (description "Qhttp is a light-weight and asynchronous HTTP library
+(both server & client) in Qt5 and c++14.")
+    (home-page "https://github.com/azadkuh/qhttp/")
+    (license license:expat)))
+
 (define-public httpd
   (package
     (name "httpd")
-- 
2.30.1