1
0
mirror of https://git.FreeBSD.org/ports.git synced 2024-12-28 05:29:48 +00:00

net/gerbera: Update to 2.1.0

Changelog: https://github.com/gerbera/gerbera/releases/tag/v2.1.0
This commit is contained in:
Daniel Engberg 2024-04-27 12:26:21 +02:00
parent 247528a717
commit f2334e7ccf
4 changed files with 21 additions and 245 deletions

View File

@ -1,6 +1,6 @@
PORTNAME= gerbera
DISTVERSIONPREFIX= v
DISTVERSION= 2.0.0
DISTVERSION= 2.1.0
CATEGORIES= net multimedia
MAINTAINER= diizzy@FreeBSD.org
@ -21,17 +21,17 @@ USES= cmake compiler:c++17-lang iconv localbase:ldflags \
USE_GITHUB= yes
USE_RC_SUBR= gerbera
CMAKE_ON= WITH_MAGIC
CMAKE_OFF= WITH_EXIF WITH_LASTFM WITH_MYSQL WITH_SYSTEMD
USERS= gerbera
GROUPS= gerbera
SUB_FILES= pkg-message
SUB_LIST= USER=${USERS} GROUP=${GROUPS}
USERS= gerbera
GROUPS= gerbera
PLIST_SUB= USER=${USERS} GROUP=${GROUPS}
CMAKE_OFF= WITH_EXIF WITH_LASTFM WITH_MYSQL WITH_SYSTEMD
CMAKE_ON= WITH_MAGIC
OPTIONS_DEFINE= CURL DEBUG DUKTAPE EXIV2 FFMPEG FFMPEGTHUMBNAILER \
MATROSKA TAGLIB TEST
OPTIONS_DEFAULT= CURL DUKTAPE EXIV2 FFMPEG TAGLIB LIBNPUPNP

View File

@ -1,3 +1,3 @@
TIMESTAMP = 1705147817
SHA256 (gerbera-gerbera-v2.0.0_GH0.tar.gz) = db2015a9e67ce896600221d912b402cbdeee9d1898761f6c6425c7182fffac2e
SIZE (gerbera-gerbera-v2.0.0_GH0.tar.gz) = 4219702
TIMESTAMP = 1714211035
SHA256 (gerbera-gerbera-v2.1.0_GH0.tar.gz) = 50af65e5570930b543176d6a2906ba2bd36fd548716818024285d79eb4977a1d
SIZE (gerbera-gerbera-v2.1.0_GH0.tar.gz) = 5828980

View File

@ -1,225 +0,0 @@
From 3e2f026f2281aa511f1a9106cf48a1f5344ae06b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Karl=20Strau=C3=9Fberger?= <k_straussberger@netzland.net>
Date: Tue, 9 Jan 2024 13:12:10 +0100
Subject: [PATCH] Build Support for NPUPNP
---
.github/workflows/ci.yml | 23 ++++++++
CMakeLists.txt | 43 ++++++++++++---
ChangeLog.md | 5 ++
README.md | 2 +-
cmake/FindNPUPNP.cmake | 54 +++++++++++++++++++
cmake/FindUPNP.cmake | 6 +--
scripts/debian/build-deb.sh | 33 ++++++++++--
scripts/install-googletest.sh | 4 +-
scripts/install-npupnp.sh | 83 +++++++++++++++++++++++++++++
scripts/versions.sh | 4 +-
src/iohandler/process_io_handler.cc | 1 +
src/server.cc | 2 +
src/server.h | 2 +
13 files changed, 244 insertions(+), 18 deletions(-)
create mode 100644 cmake/FindNPUPNP.cmake
create mode 100755 scripts/install-npupnp.sh
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 1c301ecd9..5299b7bee 100644
--- CMakeLists.txt
+++ CMakeLists.txt
@@ -385,14 +385,45 @@ target_compile_options(libgerbera PUBLIC ${LFS_COMPILE_OPTIONS})
target_link_libraries(libgerbera PUBLIC ${LFS_LIBRARIES})
if (WITH_NPUPNP)
- find_package(PkgConfig QUIET)
- pkg_check_modules(NPUPNP QUIET libnpupnp>=4.2.1)
- if (NOT NPUPNP_FOUND)
- find_package(NPUPNP REQUIRED)
+ set(REQ_NPUPNP_VERSION 4.2.1)
+
+ find_package(NPUPNP ${REQ_NPUPNP_VERSION} QUIET)
+
+ if (NOT TARGET NPUPNP::NPUPNP)
+ find_package(npupnp ${REQ_NPUPNP_VERSION} QUIET)
+ if(TARGET npupnp::npupnp)
+ add_library(NPUPNP::NPUPNP ALIAS npupnp::npupnp)
+ endif()
endif()
- target_include_directories(libgerbera PUBLIC ${NPUPNP_INCLUDE_DIRS})
+ if(NOT TARGET NPUPNP::NPUPNP)
+ message(FATAL_ERROR "Gerbera failed to find libnpupnp! at least version ${REQ_UPNP_VERSION} is needed.")
+ endif()
+ # Conan autogenerated targets dont set a version, but to set name_VERSION var
+ get_target_property(_UPNP_VERSION NPUPNP::NPUPNP VERSION)
+ if (NOT _UPNP_VERSION)
+ set(_UPNP_VERSION ${npupnp_VERSION})
+ endif()
+ get_target_property(_UPNP_LIB NPUPNP::NPUPNP LOCATION)
+
+ # Check and warn for libnpupnp features
+ include(CheckCXXSymbolExists)
+ get_target_property(UPNP_INCLUDE_DIR NPUPNP::NPUPNP INTERFACE_INCLUDE_DIRECTORIES)
+ check_cxx_symbol_exists(UPNP_ENABLE_IPV6 "${UPNP_INCLUDE_DIR}/upnpconfig.h" UPNP_HAS_IPV6)
+ if (NOT UPNP_HAS_IPV6)
+ message(FATAL_ERROR "Gerbera requires libnpupnp with IPv6 support.")
+ endif()
+
+ check_cxx_symbol_exists(UPNP_HAVE_TOOLS "${UPNP_INCLUDE_DIR}/upnpconfig.h" UPNP_HAS_TOOLS)
+ if (NOT UPNP_HAS_TOOLS)
+ message(WARNING [=[
+ !! It is strongly recommended to build libupnp with --enable-tools !!
+ ]=])
+ endif()
+
+ message(STATUS "Found libnpupnp: ${_UPNP_LIB} (found version ${_UPNP_VERSION})")
+
target_compile_definitions(libgerbera PUBLIC USING_NPUPNP)
- target_link_libraries(libgerbera PUBLIC ${NPUPNP_LIBRARIES})
+ target_link_libraries(libgerbera PUBLIC NPUPNP::NPUPNP)
else()
set(REQ_UPNP_VERSION 1.14.6)
# LibUPnP official target since 1.16 (Lib version 18)
new file mode 100644
index 000000000..b83168295
--- /dev/null
+++ cmake/FindNPUPNP.cmake
@@ -0,0 +1,54 @@
+# - Try to find LibNPUPnP (npupnp) 4.1.2
+# Once done this will define
+# NPUPNP_FOUND - System has LibNPUPnP
+# UPNP_INCLUDE_DIRS - The LibNPUPnP include directories
+# NPUPNP_LIBRARIES - The libraries needed to use LibNPUPnP
+# NPUPNP_VERSION_STRING - The version of LibNPUPnP found
+# NPUPNP_HAS_IPV6 - If LibNPUPnP was built with IPv6 support
+# NPUPNP_HAS_REUSEADDR - If LibNPUPnP was built with SO_REUSEADDR support
+find_package(PkgConfig QUIET)
+pkg_search_module (PC_NPUPNP libnpupnp QUIET)
+
+find_path(UPNP_INCLUDE_DIR upnp.h
+ HINTS ${PC_NPUPNP_INCLUDEDIR} ${PC_UPNP_INCLUDE_DIRS}
+ PATH_SUFFIXES npupnp)
+
+#if (STATIC_LIBUPNP)
+# set(OLD_SUFFIX ${CMAKE_FIND_LIBRARY_SUFFIXES})
+# set(CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_STATIC_LIBRARY_SUFFIX})
+#endif()
+
+find_library(NPUPNP_LIBRARY
+ NAMES libnpupnp npupnp
+ HINTS ${PC_NPUPNP_LIBDIR} ${PC_NPUPNP_LIBRARY_DIRS})
+
+# Restore
+#if (STATIC_LIBUPNP)
+# set(CMAKE_FIND_LIBRARY_SUFFIXES ${OLD_SUFFIX})
+#endif()
+
+if(EXISTS ${UPNP_INCLUDE_DIR}/upnpconfig.h)
+ file (STRINGS ${UPNP_INCLUDE_DIR}/upnpconfig.h upnp_ver_str REGEX "^#define[ \t]+NPUPNP_VERSION_STRING[ \t]+\".+\"")
+ string(REGEX REPLACE "^#define[ \t]+NPUPNP_VERSION_STRING[ \t]+\"([^\"]+)\".*" "\\1" NPUPNP_VERSION "${upnp_ver_str}")
+endif()
+
+include(FindPackageHandleStandardArgs)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(NPUPNP
+ REQUIRED_VARS NPUPNP_LIBRARY UPNP_INCLUDE_DIR
+ VERSION_VAR NPUPNP_VERSION)
+
+if (NPUPNP_FOUND)
+ if(NOT TARGET NPUPNP::NPUPNP)
+ add_library(NPUPNP::NPUPNP SHARED IMPORTED)
+ set_target_properties(NPUPNP::NPUPNP PROPERTIES
+ IMPORTED_LOCATION ${NPUPNP_LIBRARY}
+ INTERFACE_INCLUDE_DIRECTORIES ${UPNP_INCLUDE_DIR}
+ VERSION ${NPUPNP_VERSION}
+ )
+ endif()
+endif ()
+
+MARK_AS_ADVANCED(
+ UPNP_INCLUDE_DIR
+ NPUPNP_LIBRARY
+)
diff --git a/cmake/FindUPNP.cmake b/cmake/FindUPNP.cmake
index 587e1c5ef..246328806 100644
--- cmake/FindUPNP.cmake
+++ cmake/FindUPNP.cmake
@@ -3,9 +3,9 @@
# UPNP_FOUND - System has LibUPnP
# UPNP_INCLUDE_DIRS - The LibUPnP include directories
# UPNP_LIBRARIES - The libraries needed to use LibUPnP
-# UPNP_VERSION_STRING - The version of LinUPnP found
-# UPNP_HAS_IPV6 - If LinUPnP was built with IPv6 support
-# UPNP_HAS_REUSEADDR - If LinUPnP was built with SO_REUSEADDR support
+# UPNP_VERSION_STRING - The version of LibUPnP found
+# UPNP_HAS_IPV6 - If LibUPnP was built with IPv6 support
+# UPNP_HAS_REUSEADDR - If LibUPnP was built with SO_REUSEADDR support
find_package(PkgConfig QUIET)
pkg_search_module (PC_UPNP QUIET libupnp)
diff --git a/scripts/versions.sh b/scripts/versions.sh
index c859e701b..86612f3e3 100755
--- scripts/versions.sh
+++ scripts/versions.sh
@@ -30,6 +30,7 @@ if [[ "${GERBERA_ENV-head}" == "minimum" ]]; then
MATROSKA="1.5.2"
PUGIXML="1.10"
PUPNP="1.14.6"
+ NPUPNP="4.2.1"
SPDLOG="1.8.1"
WAVPACK="5.1.0"
TAGLIB="1.12"
@@ -46,6 +47,7 @@ elif [[ "${GERBERA_ENV-head}" == "default" ]]; then
MATROSKA="1.5.2"
PUGIXML="1.10"
PUPNP="1.14.17"
+ NPUPNP="5.1.2"
SPDLOG="1.11.0"
WAVPACK="5.4.0"
TAGLIB="1.12"
@@ -63,8 +65,8 @@ else
PUGIXML="1.14"
PUPNP="1.14.18"
SPDLOG="1.12.0"
+ NPUPNP="6.1.0"
WAVPACK="5.6.0"
TAGLIB="1.13.1"
fi
-
diff --git a/src/iohandler/process_io_handler.cc b/src/iohandler/process_io_handler.cc
index de174eab2..3ff9e8099 100644
--- src/iohandler/process_io_handler.cc
+++ src/iohandler/process_io_handler.cc
@@ -39,6 +39,7 @@
#include <fcntl.h>
#include <sys/select.h>
+#include <unistd.h>
#include "content/content_manager.h"
diff --git a/src/server.cc b/src/server.cc
index c8a0c2c75..bfd5d6477 100644
--- src/server.cc
+++ src/server.cc
@@ -231,8 +231,10 @@ void Server::run()
throw UpnpException(ret, fmt::format("run: UpnpSendAdvertisement {} failed", aliveAdvertisementInterval));
}
+#if !defined(USING_NPUPNP)
if (config->getBoolOption(CFG_UPNP_LITERAL_HOST_REDIRECTION))
UpnpSetAllowLiteralHostRedirection(1);
+#endif
UpnpSetHostValidateCallback(
[](auto host, auto cookie) -> int {
diff --git a/src/server.h b/src/server.h
index a91466b65..5826a1a77 100644
--- src/server.h
+++ src/server.h
@@ -34,6 +34,8 @@
#ifndef __SERVER_H__
#define __SERVER_H__
+#include <netinet/in.h>
+
#include "request_handler.h"
// forward declaration

View File

@ -50,14 +50,14 @@ bin/gerbera
%%DATADIR%%/web/js/jquery.gerbera.tree.js
%%DATADIR%%/web/js/jquery.gerbera.tweak.js
%%DATADIR%%/web/mr_reg.xml
%%DATADIR%%/web/vendor/bootstrap/css/bootstrap-grid.min.css
%%DATADIR%%/web/vendor/bootstrap/css/bootstrap-grid.min.css.map
%%DATADIR%%/web/vendor/bootstrap/css/bootstrap-reboot.min.css
%%DATADIR%%/web/vendor/bootstrap/css/bootstrap-reboot.min.css.map
%%DATADIR%%/web/vendor/bootstrap/css/bootstrap.min.css
%%DATADIR%%/web/vendor/bootstrap/css/bootstrap.min.css.map
%%DATADIR%%/web/vendor/bootstrap/js/bootstrap.min.js
%%DATADIR%%/web/vendor/bootstrap/js/bootstrap.min.js.map
%%DATADIR%%/web/vendor/bootstrap-4.6.2/css/bootstrap-grid.min.css
%%DATADIR%%/web/vendor/bootstrap-4.6.2/css/bootstrap-grid.min.css.map
%%DATADIR%%/web/vendor/bootstrap-4.6.2/css/bootstrap-reboot.min.css
%%DATADIR%%/web/vendor/bootstrap-4.6.2/css/bootstrap-reboot.min.css.map
%%DATADIR%%/web/vendor/bootstrap-4.6.2/css/bootstrap.min.css
%%DATADIR%%/web/vendor/bootstrap-4.6.2/css/bootstrap.min.css.map
%%DATADIR%%/web/vendor/bootstrap-4.6.2/js/bootstrap.min.js
%%DATADIR%%/web/vendor/bootstrap-4.6.2/js/bootstrap.min.js.map
%%DATADIR%%/web/vendor/font-awesome/css/font-awesome.css
%%DATADIR%%/web/vendor/font-awesome/css/font-awesome.min.css
%%DATADIR%%/web/vendor/font-awesome/fonts/FontAwesome.otf
@ -66,8 +66,8 @@ bin/gerbera
%%DATADIR%%/web/vendor/font-awesome/fonts/fontawesome-webfont.ttf
%%DATADIR%%/web/vendor/font-awesome/fonts/fontawesome-webfont.woff
%%DATADIR%%/web/vendor/font-awesome/fonts/fontawesome-webfont.woff2
%%DATADIR%%/web/vendor/jquery/jquery.min.js
%%DATADIR%%/web/vendor/jquery/jquery.min.map
%%DATADIR%%/web/vendor/jquery/jquery-3.7.1.min.js
%%DATADIR%%/web/vendor/jquery/jquery-3.7.1.min.map
%%DATADIR%%/web/vendor/jquery/jquery-ui.min.js
%%DATADIR%%/web/vendor/js-cookie.min.js
%%DATADIR%%/web/vendor/lato/LICENCE.md
@ -77,7 +77,8 @@ bin/gerbera
%%DATADIR%%/web/vendor/md5.min.js.map
%%DATADIR%%/web/vendor/popper/popper.min.js
%%DATADIR%%/web/vendor/popper/popper.min.js.map
%%DATADIR%%/web/vendor/tether/tether.min.js
%%DATADIR%%/web/vendor/tether/tether-2.0.0.min.css
%%DATADIR%%/web/vendor/tether/tether-2.0.0.min.js
share/man/man1/gerbera.1.gz
@owner %%USER%%
@group %%GROUP%%