summary refs log tree commit diff
path: root/gnu/packages/networking.scm
diff options
context:
space:
mode:
authorMaxim Cournoyer <maxim.cournoyer@gmail.com>2023-08-20 23:25:37 -0400
committerMaxim Cournoyer <maxim.cournoyer@gmail.com>2024-01-09 22:10:11 -0500
commit504b46cd87dae437fec1949aeed2394951a92f77 (patch)
tree73fdb5e3017d0c4d2490c66384218f46af89832c /gnu/packages/networking.scm
parent0860b612f25361de198c59a82ce474a126e417af (diff)
downloadguix-504b46cd87dae437fec1949aeed2394951a92f77.tar.gz
gnu: libnatpmp: Update to 20230423-0.6a850fd.
* gnu/packages/networking.scm (libnatpmp): Update to 20230423-0.6a850fd.
[source]: Fetch from git.
[build-system]: Use cmake-build-system.
[arguments]: Add patch-build-system and fix-version phases.  Reinstate
configure and check phase, but set #:tests? to #f.  New #:configure-flags
argument.
[native-inputs]: Add which.
Diffstat (limited to 'gnu/packages/networking.scm')
-rw-r--r--gnu/packages/networking.scm67
1 files changed, 42 insertions, 25 deletions
diff --git a/gnu/packages/networking.scm b/gnu/packages/networking.scm
index dedbc9e1ea..cc9b8e46ae 100644
--- a/gnu/packages/networking.scm
+++ b/gnu/packages/networking.scm
@@ -1414,33 +1414,50 @@ files contain direct mappings of the abstractions provided by the ØMQ C API.")
     (license license:expat)))
 
 (define-public libnatpmp
-  (package
-    (name "libnatpmp")
-    (version "20230423")
-    (source (origin
-              (method url-fetch)
-              (uri (string-append
-                    "http://miniupnp.free.fr/files/"
-                    name "-" version ".tar.gz"))
-              (sha256
-               (base32
-                "0w7wvf4yi8qv659dg9d3ndqvh3bqhgm21gd135spwhq6hhnfv106"))))
-    (build-system gnu-build-system)
-    (arguments
-     (list #:phases #~(modify-phases %standard-phases
-                        (delete 'configure)
-                        (delete 'check)) ; no tests
-           #:make-flags
-           #~(list (string-append "CC=" #$(cc-for-target))
-                   (string-append "INSTALLPREFIX=" #$output)
-                   (string-append "LDFLAGS=-Wl,-rpath=" #$output "/lib"))))
-    (home-page "https://miniupnp.tuxfamily.org/libnatpmp.html")
-    (synopsis "C library implementing NAT-PMP")
-    (description
-     "@code{libnatpmp} is a portable and asynchronous implementation of
+  ;; Install the latest commit as it provides a pkg-config (.pc) file.
+  (let ((base-version "20230423")
+        (commit "6a850fd2bd9b08e6edc886382a1dbae2a7df55ec")
+        (revision "0"))
+    (package
+      (name "libnatpmp")
+      (version (git-version base-version revision commit))
+      (source (origin
+                (method git-fetch)
+                (uri (git-reference
+                      (url "https://github.com/miniupnp/libnatpmp")
+                      (commit commit)))
+                (file-name (git-file-name name version))
+                (sha256
+                 (base32
+                  "18hf9a3i3mncl3w80nzi1684iac3by86bv0hgmbm1v2w8gbfjyw0"))))
+      (build-system cmake-build-system)
+      (arguments
+       (list
+        #:tests? #f                     ;no test suite
+        #:configure-flags #~(list "-DBUILD_SHARED_LIBS=ON")
+        #:phases
+        #~(modify-phases %standard-phases
+            (add-after 'unpack 'patch-build-system
+              ;; Have CMake install the natpmp_declspec.h missing header file
+              ;; that is referenced by natpmp.h (see:
+              ;; https://github.com/miniupnp/libnatpmp/issues/41).
+              (lambda _
+                (substitute* "CMakeLists.txt"
+                  (("install\\(FILES natpmp.h")
+                   "install(FILES natpmp.h natpmp_declspec.h"))))
+            (add-after 'unpack 'fix-version
+              (lambda _
+                (with-output-to-file "VERSION"
+                  (lambda ()
+                    (display #$base-version))))))))
+      (native-inputs (list which))
+      (home-page "https://miniupnp.tuxfamily.org/libnatpmp.html")
+      (synopsis "C library implementing NAT-PMP")
+      (description
+       "@code{libnatpmp} is a portable and asynchronous implementation of
 the Network Address Translation - Port Mapping Protocol (NAT-PMP)
 written in the C programming language.")
-    (license license:bsd-3)))
+      (license license:bsd-3))))
 
 (define-public librdkafka
   (package