Subject: [bug#53319] [PATCH] gnu: Add n2n.

From: 路辉 <[email-masked]>
Date: Mon, 17 Jan 2022 14:47:36 +0000

>From c9d69917251e377c3291443dda0090cfa5e46956 Mon Sep 17 00:00:00 2001
From: Lu Hui <[email-masked]>
Date: Mon, 17 Jan 2022 10:48:44 +0800
Subject: [PATCH] gnu: Add n2n.

* gnu/packages/vpn.scm (n2n-2): New variable
---
 gnu/packages/vpn.scm | 37 +++++++++++++++++++++++++++++++++++++
 1 file changed, 37 insertions(+)

diff --git a/gnu/packages/vpn.scm b/gnu/packages/vpn.scm
index 4ad555ef1b..542d6518fd 100644
--- a/gnu/packages/vpn.scm
+++ b/gnu/packages/vpn.scm
@@ -18,6 +18,7 @@
 ;;; Copyright © 2021 Domagoj Stolfa <[email-masked]>
 ;;; Copyright © 2021 Raghav Gururajan <[email-masked]>
 ;;; Copyright © 2021 jgart <[email-masked]>
+;;; Copyright © 2022 Lu hui <[email-masked]>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -1093,3 +1094,39 @@ (define-public xl2tpd
      "xl2tpd is an implementation of the Layer 2 Tunnelling Protocol
(RFC 2661).
 L2TP allows you to tunnel PPP over UDP.")
     (license license:gpl2)))
+
+(define-public n2n-2
+  (package
+    (name "n2n")
+    (version "2.8")
+    (source (origin
+              (method git-fetch)
+              (uri (git-reference
+                    (url "https://github.com/ntop/n2n")
+                    (commit version)))
+              (file-name (git-file-name name version))
+              (sha256
+               (base32
+                "1ph2npvnqh1xnmkp96pdzpxm033jkb8zznd3nc59l9arhn0pq4nv"))))
+    (build-system gnu-build-system)
+    (native-inputs (list autoconf automake))
+    (arguments
+     `(#:make-flags (list (string-append "PREFIX=" %output) "CC=gcc")
+       #:phases
+       (modify-phases %standard-phases
+         (add-before 'bootstrap 'move-configure
+           ;; don't execute configure script in bootstrap
+           (lambda* (#:key inputs #:allow-other-keys)
+             (substitute* "autogen.sh"
+               (("./configure") ""))))
+         (add-before 'configure 'fix-configure
+           (lambda* (#:key inputs #:allow-other-keys)
+             (substitute* "configure"
+               (("/bin/sh") (which "sh"))))))
+       #:tests? #f)) ;there is no check target
+    (home-page "https://github.com/ntop/n2n")
+    (synopsis "Peer-to-peer VPN client and server")
+    (description
+     "A light VPN software which makes it
+easy to create virtual networks bypassing intermediate firewalls.")
+    (license license:gpl3+)))
-- 
2.34.0