upnp.scm 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  1. ;;; GNU Guix --- Functional package management for GNU
  2. ;;; Copyright © 2014 Sree Harsha Totakura <sreeharsha@totakura.in>
  3. ;;; Copyright © 2015 Federico Beffa <beffa@fbengineering.ch>
  4. ;;; Copyright © 2016, 2017, 2018 Tobias Geerinckx-Rice <me@tobias.gr>
  5. ;;; Copyright © 2018 Theodoros Foradis <theodoros@foradis.org>
  6. ;;;
  7. ;;; This file is part of GNU Guix.
  8. ;;;
  9. ;;; GNU Guix is free software; you can redistribute it and/or modify it
  10. ;;; under the terms of the GNU General Public License as published by
  11. ;;; the Free Software Foundation; either version 3 of the License, or (at
  12. ;;; your option) any later version.
  13. ;;;
  14. ;;; GNU Guix is distributed in the hope that it will be useful, but
  15. ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
  16. ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  17. ;;; GNU General Public License for more details.
  18. ;;;
  19. ;;; You should have received a copy of the GNU General Public License
  20. ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
  21. (define-module (gnu packages upnp)
  22. #:use-module (gnu packages)
  23. #:use-module (gnu packages python)
  24. #:use-module (guix build-system gnu)
  25. #:use-module (guix utils)
  26. #:use-module (guix download)
  27. #:use-module (guix git-download)
  28. #:use-module (guix licenses)
  29. #:use-module (guix packages))
  30. (define-public miniupnpc
  31. (package
  32. (name "miniupnpc")
  33. (version "2.1.20190210")
  34. (source
  35. (origin
  36. (method url-fetch)
  37. (uri (string-append "https://miniupnp.tuxfamily.org/files/"
  38. name "-" version ".tar.gz"))
  39. (sha256
  40. (base32 "05w8p51yd71ksapajb9nag464ncakk72v9dxr01y168wix707d49"))))
  41. (build-system gnu-build-system)
  42. (native-inputs
  43. `(("python" ,python-2)))
  44. (arguments
  45. ;; The build system does not use a configure script but depends on
  46. ;; `make'. Hence we should pass parameters to `make' instead and remove
  47. ;; the configure phase.
  48. '(#:make-flags
  49. (list
  50. (string-append "SH=" (assoc-ref %build-inputs "bash") "/bin/sh")
  51. (string-append "INSTALLPREFIX=" (assoc-ref %outputs "out"))
  52. "CC=gcc"
  53. ;; Allow executables to find libminiupnpc.so.
  54. (string-append "LDFLAGS=-Wl,-rpath="
  55. (assoc-ref %outputs "out") "/lib"))
  56. #:phases
  57. (modify-phases %standard-phases
  58. (delete 'configure)
  59. (add-before 'install 'qualify-paths
  60. (lambda* (#:key outputs #:allow-other-keys)
  61. (substitute* "external-ip.sh"
  62. (("upnpc")
  63. (string-append (assoc-ref outputs "out") "/bin/upnpc")))
  64. #t)))))
  65. (home-page "http://miniupnp.free.fr/")
  66. (synopsis "UPnP protocol client library")
  67. (description
  68. "The MiniUPnPc client library facilitates access to the services provided
  69. by any @dfn{Universal Plug and Play} (UPnP) @dfn{Internet Gateway Device} (IGD)
  70. present on the network. In UPnP terminology, MiniUPnPc is a UPnP Control Point.
  71. It is useful whenever an application needs to listen for incoming connections
  72. while running behind a UPnP-enabled router or firewall. Such applications
  73. include peer-to-peer applications, active-mode FTP clients, DCC file transfers
  74. over IRC, instant messaging, network games, and most server software.")
  75. (license
  76. (x11-style "file://LICENSE" "See 'LICENSE' file in the distribution"))))
  77. (define-public monero-miniupnpc
  78. ;; This package is the bundled version of miniupnpc used with monero.
  79. ;; Monero-project has been maintaining its own version of the package since
  80. ;; release 0.12.2.0. It includes security fixes not included in upstream
  81. ;; releases.
  82. (let ((revision "0")
  83. (commit "6a63f9954959119568fbc4af57d7b491b9428d87"))
  84. (package
  85. (inherit miniupnpc)
  86. (name "miniupnpc-monero")
  87. (version (string-append "2.1-monero-0.12.3.0-" revision "."
  88. (string-take commit 7)))
  89. (source (origin
  90. (method git-fetch)
  91. (uri (git-reference
  92. (url "https://github.com/monero-project/miniupnp/")
  93. (commit commit)))
  94. (sha256
  95. (base32
  96. "0s67zcz978iapjlq30yy9dl8qda9xhrl3jdi5f99cnbglh5gy16a"))
  97. (file-name (string-append name "-" version "-checkout"))
  98. (modules '((guix build utils)))
  99. (snippet
  100. '(begin
  101. ;; Delete miniupnp subprojects except for miniupnpc.
  102. (for-each
  103. delete-file-recursively
  104. '("minissdpd" "miniupnpc-async" "miniupnpc-libevent"
  105. "miniupnpd" ))
  106. #t))))
  107. (arguments
  108. (substitute-keyword-arguments (package-arguments miniupnpc)
  109. ((#:phases phases)
  110. `(modify-phases ,phases
  111. (add-before 'build 'change-directory
  112. (lambda _
  113. (chdir "miniupnpc")
  114. #t))
  115. (add-after 'change-directory 'chmod-header-file
  116. (lambda _
  117. (chmod "miniupnpc.h" #o644)
  118. #t)))))))))
  119. (define-public libupnp
  120. (package
  121. (name "libupnp")
  122. (version "1.6.25")
  123. (source
  124. (origin
  125. (method url-fetch)
  126. (uri (string-append "mirror://sourceforge/pupnp/pupnp/libUPnP%20"
  127. version "/" name "-" version ".tar.bz2"))
  128. (sha256
  129. (base32
  130. "0hzsd7rvfa87b4hxg9yj4xhdfxx9sp09r9sqdl3mqhvmcyw018y5"))))
  131. (build-system gnu-build-system)
  132. (arguments
  133. ;; The tests require a network device capable of multicasting which is
  134. ;; not available in the build environment. See
  135. ;; https://lists.gnu.org/archive/html/guix-devel/2015-01/msg00312.html.
  136. `(#:tests? #f
  137. #:configure-flags '("--enable-ipv6")))
  138. (home-page "http://pupnp.sourceforge.net")
  139. (synopsis "Portable SDK for UPnP Devices")
  140. (description
  141. "The portable SDK for UPnP Devices (libupnp) provides developers with an
  142. API and code for building control points, devices, and bridges that are
  143. compliant with Version 1.0 of the Universal Plug and Play Device Architecture
  144. Specification and support several operating systems like Linux, *BSD, Solaris
  145. and others.")
  146. (license bsd-3)))