diff --git a/multimedia/gerbera/Makefile b/multimedia/gerbera/Makefile new file mode 100644 index 000000000..9e7c0bba4 --- /dev/null +++ b/multimedia/gerbera/Makefile @@ -0,0 +1,78 @@ +# +# Copyright (C) 2011-2020 Entware +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +include $(TOPDIR)/rules.mk + +PKG_NAME:=gerbera +PKG_VERSION:=1.4.0 +PKG_RELEASE:=1 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=https://codeload.github.com/gerbera/gerbera/tar.gz/v$(PKG_VERSION)? +PKG_HASH:=904a9031c85ac805e4c139f363510226952683d7257acd1dee25ba1e97fd7651 + +PKG_MAINTAINER:= +PKG_LICENSE:=GPL-2.0-or-later +PKG_LICENSE_FILES:=LICENSE.md + +PKG_BUILD_PARALLEL:=1 + +include $(INCLUDE_DIR)/package.mk +include $(INCLUDE_DIR)/cmake.mk +include $(INCLUDE_DIR)/nls.mk + +define Package/gerbera + SECTION:=multimedia + CATEGORY:=Multimedia + DEPENDS:=+file +libupnp +libsqlite3 +libexif +libexpat +libuuid +libstdcpp $(ICONV_DEPENDS) + TITLE:=A free media server + URL:=https://gerbera.io + USERID:=gerbera:gerbera +endef + +define Package/gerbera/description + Gerbera - UPnP Media Server based on Mediatomb. +endef + +define Package/gerbera/conffiles +/etc/gerbera/config.xml +endef + +CMAKE_OPTIONS += \ + -DICONV_INCLUDE_DIR=$(ICONV_PREFIX)/include \ + -DICONV_LIBRARIES=$(ICONV_PREFIX)/lib/libiconv.a \ + -DWITH_MAGIC=1 \ + -DWITH_MYSQL=0 \ + -DWITH_CURL=0 \ + -DWITH_INOTIFY=1 \ + -DWITH_JS=0 \ + -DWITH_TAGLIB=0 \ + -DWITH_AVCODEC=0 \ + -DWITH_FFMPEGTHUMBNAILER=0 \ + -DWITH_EXIF=1 \ + -DWITH_EXIV2=0 \ + -DWITH_MATROSKA=0 \ + -DWITH_SYSTEMD=0 \ + -DWITH_LASTFM=0 \ + -DWITH_DEBUG=0 \ + -DWITH_TESTS=0 + +TARGET_CFLAGS += -ffunction-sections -fdata-sections -flto +TARGET_LDFLAGS += -Wl,--gc-sections,--as-needed + +define Package/gerbera/install + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/gerbera $(1)/usr/bin + $(INSTALL_DIR) $(1)/usr/share + $(CP) $(PKG_INSTALL_DIR)/usr/share/gerbera $(1)/usr/share + $(INSTALL_DIR) $(1)/etc/config + $(INSTALL_CONF) ./files/gerbera.config $(1)/etc/config/gerbera + $(INSTALL_DIR) $(1)/etc/init.d + $(INSTALL_BIN) ./files/gerbera.init $(1)/etc/init.d/gerbera +endef + +$(eval $(call BuildPackage,gerbera)) diff --git a/multimedia/gerbera/files/gerbera.config b/multimedia/gerbera/files/gerbera.config new file mode 100644 index 000000000..811005a70 --- /dev/null +++ b/multimedia/gerbera/files/gerbera.config @@ -0,0 +1,3 @@ +config gerbera config + option enabled '0' + option home '/tmp/gerbera' diff --git a/multimedia/gerbera/files/gerbera.init b/multimedia/gerbera/files/gerbera.init new file mode 100644 index 000000000..2cc0a52bb --- /dev/null +++ b/multimedia/gerbera/files/gerbera.init @@ -0,0 +1,38 @@ +#!/bin/sh /etc/rc.common + +START=82 + +USE_PROCD=1 +PROG=/usr/bin/gerbera + +start_service() { + local enabled + local home + + config_load 'gerbera' + config_get_bool enabled config 'enabled' '0' + + [ "$enabled" -eq 0 ] && { + echo "Gerbera not enabled. Please enable in /etc/config/gerbera" + return 1 + } + + config_get home config 'home' '/tmp/gerbera' + + [ -d "$home" ] || { + mkdir -p "$home" + chown gerbera:gerbera "$home" + + gerbera -m "$home" -f '' --create-config > "$home/config.xml" 2> /dev/null + echo "Created default gerbera config at $home/config.xml" + echo "Please edit to your liking and restart." + return 2 + } + + procd_open_instance + procd_set_param user gerbera + procd_set_param group gerbera + procd_set_param command "$PROG" -c "$home/config.xml" + procd_set_param stderr 1 + procd_close_instance +}