diff mbox series

[bug#50062] Add cl-yxorp-cli

Message ID VkRithd8_9ZGnXvmFY4HQ7z-2wqr3-4y6ZoMbl0e7TTjxcIkmL2wSY8Qa_-PP4mai7aZib_WNX07My3ooo_qXjN7xezo7xKYxUbV8JzfHho=@protonmail.com
State Accepted
Headers show
Series [bug#50062] Add cl-yxorp-cli | expand

Checks

Context Check Description
cbaines/applying patch fail View Laminar job
cbaines/issue success View issue

Commit Message

Charles Aug. 15, 2021, 5:19 a.m. UTC
let me know if something is wrong or could be better: thanks.

Comments

Guillaume Le Vaillant Aug. 16, 2021, 8:06 a.m. UTC | #1
Patches push as 6fcaf8533792a64bc00292326f960561de591200 and following
with some modifications:
 - removed article and period in synopsis
 - added a full sentence at the beginning of the description
 - moved cl-yxorp-cli from "web.scm" to "lisp-xyz.scm" because I got
   an undefined variable error for 'sbcl-yxorp' (I think this is because
   the mutual dependency between "web.scm" and "lisp-xyz.scm" prevents
   using '(inherit sbcl-yxorp)' in this case).
 - replaced '--disable-debugger' by '--non-interactive' in the command
   line for SBCL to be sure that we can't get stuck in SBCL

To find some of the "styling mistakes", you can use:
  ./pre-inst-env guix lint sbcl-yxorp
diff mbox series

Patch

From f7273b53facac11165e91af80a182837a85c064a Mon Sep 17 00:00:00 2001
From: Charles <charles.b.jackson@protonmail.com>
Date: Sat, 14 Aug 2021 23:54:03 -0500
Subject: [PATCH] gnu: Add cl-yxorp-cli.

* gnu/packages/lisp-xyz.scm (sbcl-yxorp, ecl-yxorp, cl-yxorp): New variables.
* gnu/packages/web.scm (cl-yxorp-cli): New variable.
---
 gnu/packages/lisp-xyz.scm | 41 +++++++++++++++++++++++++++++++++++++++
 gnu/packages/web.scm      | 34 ++++++++++++++++++++++++++++++++
 2 files changed, 75 insertions(+)

diff --git a/gnu/packages/lisp-xyz.scm b/gnu/packages/lisp-xyz.scm
index 38cc7d6695..e88f920ec2 100644
--- a/gnu/packages/lisp-xyz.scm
+++ b/gnu/packages/lisp-xyz.scm
@@ -18243,6 +18243,47 @@  functions allow Lisp programs to explore the web.")
 (define-public cl-aserve
   (sbcl-package->cl-source-package sbcl-aserve))
 
+(define-public sbcl-yxorp
+  (let ((commit "d2e8f9304549e47ae5c7fa35a6b114804603eac9")
+        (revision "1"))
+    (package
+      (name "sbcl-yxorp")
+      (version (git-version "0" revision commit))
+      (source
+       (origin
+         (method git-fetch)
+         (uri (git-reference
+               (url "https://github.com/charJe/cl-yxorp")
+               (commit commit)))
+         (file-name (git-file-name "cl-yxorp" version))
+         (sha256
+          (base32 "1zz1j678vzwkf817h2z0pf0fcyf4mldv4hiv1wyam58hd4bcrjsw"))))
+      (build-system asdf-build-system/sbcl)
+      (inputs
+       `(("cl+ssl" ,sbcl-cl+ssl)
+         ("cl-binding-arrows" ,sbcl-binding-arrows)
+         ("cl-str" ,sbcl-cl-str)
+         ("cl-usocket" ,sbcl-usocket)
+         ("flexi-streams" ,sbcl-flexi-streams)
+         ("trivial-garbage" ,sbcl-trivial-garbage)))
+      (home-page "https://github.com/charje/cl-yxorp")
+      (synopsis
+       "A reverse proxy server written in and configurable in Common Lisp.")
+      (description "It supports WebSocket, HTTP, HTTPS, HTTP to HTTPS
+redirecting, port and host forwarding configuration using a real programming
+language, HTTP header and body manipulation (also using a real programming
+language).")
+      (license license:agpl3))))
+
+(define-public ecl-yxorp
+  ;; Note that due to a bug in ECL this package does not build.
+  ;; The bug has already been fixed on the development branch,
+  ;; so this package will work work in the version after 21.2.1.
+  (sbcl-package->ecl-package sbcl-yxorp))x
+
+(define-public cl-yxorp
+  (sbcl-package->cl-source-package sbcl-yxorp))
+
 (define-public sbcl-rss
   ;; No release.
   (let ((commit "51d0145e91b86327ae5c36364f9c3048052e7a58"))
diff --git a/gnu/packages/web.scm b/gnu/packages/web.scm
index ff53333169..d499fa0299 100644
--- a/gnu/packages/web.scm
+++ b/gnu/packages/web.scm
@@ -141,6 +141,7 @@ 
   #:use-module (gnu packages libunistring)
   #:use-module (gnu packages libunwind)
   #:use-module (gnu packages linux)
+  #:use-module (gnu packages lisp)
   #:use-module (gnu packages lisp-xyz)
   #:use-module (gnu packages lsof)
   #:use-module (gnu packages lua)
@@ -893,6 +894,39 @@  memory footprint compared to other webservers.  Its features include FastCGI,
 CGI, authentication, output compression, URL rewriting and many more.")
     (license license:bsd-3)))
 
+(define-public cl-yxorp-cli
+  (package
+    (inherit sbcl-yxorp)
+    (name "cl-yxorp-cli")
+    (build-system gnu-build-system)
+    (arguments
+     '(#:tests? #f
+       #:strip-binaries? #f
+       #:phases
+       (modify-phases %standard-phases
+         (delete 'configure)
+         (add-after 'unpack 'set-home
+           (lambda _
+             (setenv "HOME" "/tmp")
+             #t))
+         (replace 'build
+           (lambda _
+             (invoke
+              "sbcl" "--noinform"
+              "--disable-debugger"
+              "--no-userinit"
+              "--eval" "(require :asdf)"
+              "--eval" "(pushnew (uiop:getcwd) asdf:*central-registry*)"
+              "--load" "build.lisp")
+             #t))
+         (replace 'install
+           (lambda* (#:key outputs #:allow-other-keys)
+             (let ((bin (string-append (assoc-ref outputs "out") "/bin")))
+               (mkdir-p bin)
+               (install-file"cl-yxorp" bin))
+             #t)))))
+    (inputs (cons (list "sbcl" sbcl) (package-inputs sbcl-yxorp)))))
+
 (define-public fcgi
   (package
     (name "fcgi")
-- 
2.32.0