rygel: add package
authorFlorian Fainelli <florian@openwrt.org>
Wed, 5 Dec 2012 17:31:34 +0000 (17:31 +0000)
committerFlorian Fainelli <florian@openwrt.org>
Wed, 5 Dec 2012 17:31:34 +0000 (17:31 +0000)
Plugins other than playbin are untested.

Rygel is normally run as a desktop service under a user account. It
doesn't behave like a system daemon. Since running as a desktop service
doesn't make sense for OpenWrt, I've included an init script and made a
crude change to send the output to syslog.

Signed-off-by: Andy Leiserson <andy@leiserson.org>
Signed-off-by: Florian Fainelli <florian@openwrt.org>
SVN-Revision: 34528

multimedia/rygel/Makefile [new file with mode: 0644]
multimedia/rygel/files/etc/config/rygel [new file with mode: 0644]
multimedia/rygel/files/etc/init.d/rygel [new file with mode: 0755]
multimedia/rygel/files/etc/rygel.conf [new file with mode: 0644]
multimedia/rygel/patches/010-conftest-honor-cc.patch [new file with mode: 0644]
multimedia/rygel/patches/010-identify-libs-by-suffix.patch [new file with mode: 0644]
multimedia/rygel/patches/010-vapidirs-from-pkg-config.patch [new file with mode: 0644]
multimedia/rygel/patches/020-playbin-mime-types.patch [new file with mode: 0644]
multimedia/rygel/patches/030-output-to-syslog.patch [new file with mode: 0644]

diff --git a/multimedia/rygel/Makefile b/multimedia/rygel/Makefile
new file mode 100644 (file)
index 0000000..ce9c4e7
--- /dev/null
@@ -0,0 +1,195 @@
+#
+# Copyright (C) 2006-2012 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=rygel
+PKG_VERSION:=0.14.1
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
+PKG_SOURCE_URL:=@GNOME/rygel/0.14/
+PKG_SHA256SUM:=c4f79fb30bc1a062a2ffdadc7a55dd91fa58240302f152fb070d8c674bdddd67
+
+PKG_FIXUP:=autoreconf
+PKG_BUILD_DEPENDS:=vala/host intltool/host vala gupnp-vala
+
+include $(INCLUDE_DIR)/package.mk
+include $(INCLUDE_DIR)/nls.mk
+
+TARGET_LDFLAGS+=\
+        -Wl,-rpath-link=$(STAGING_DIR)/usr/lib
+
+define Package/rygel/Default
+  SECTION:=multimedia
+  CATEGORY:=Multimedia
+  TITLE:=GNOME UPnP/DLNA services
+  URL:=http://live.gnome.org/Rygel
+endef
+
+define Package/rygel/description/Default
+ Rygel is a collection of DLNA (UPnP AV) services (devices in UPnP speak),
+ implemented through a plug-in mechanism.
+endef
+
+define Package/rygel
+$(call Package/rygel/Default)
+  DEPENDS:=+libgssdp +libgupnp +libgupnp-av +libgupnp-dlna +libgee \
+    +libsoup +gstreamer +libgstvideo +libgstpbutils
+endef
+
+define Package/rygel/conffiles
+/etc/config/rygel
+endef
+
+define Package/rygel/description
+$(call Package/rygel/description/Default)
+ .
+ This package contains the main rygel binary.
+endef
+
+define RemoveValaStamps
+       find $(PKG_BUILD_DIR) -name "*_vala.stamp" | xargs rm -f
+endef
+
+Hooks/Configure/Pre += RemoveValaStamps
+
+define Build/Configure
+       $(call Build/Configure/Default,--without-ui,)
+endef
+
+define Build/Compile
+       $(MAKE) -C $(PKG_BUILD_DIR) \
+               DESTDIR="$(PKG_INSTALL_DIR)" \
+               all install
+endef
+
+define Package/rygel/install
+       $(INSTALL_DIR) $(1)/usr/bin
+
+       $(INSTALL_BIN) \
+               $(PKG_INSTALL_DIR)/usr/bin/rygel \
+               $(1)/usr/bin
+
+       $(INSTALL_DIR) $(1)/usr/share/rygel/xml
+
+       $(INSTALL_DATA) \
+               $(PKG_INSTALL_DIR)/usr/share/rygel/xml/*.xml \
+               $(1)/usr/share/rygel/xml
+
+       $(INSTALL_DIR) $(1)/etc
+       $(INSTALL_DATA) files/etc/rygel.conf $(1)/etc
+
+       $(INSTALL_DIR) $(1)/etc/init.d
+       $(INSTALL_BIN) files/etc/init.d/rygel $(1)/etc/init.d/rygel
+
+       $(INSTALL_DIR) $(1)/etc/config
+       $(INSTALL_CONF) files/etc/config/rygel $(1)/etc/config/rygel
+
+       $(INSTALL_DIR) $(1)/usr/share/icons/hicolor/{32x32,48x48,128x128}/apps
+       $(INSTALL_DATA) \
+               $(PKG_INSTALL_DIR)/usr/share/icons/hicolor/32x32/apps/rygel.png \
+               $(1)/usr/share/icons/hicolor/32x32/apps/rygel.png
+       $(INSTALL_DATA) \
+               $(PKG_INSTALL_DIR)/usr/share/icons/hicolor/48x48/apps/rygel.png \
+               $(1)/usr/share/icons/hicolor/48x48/apps/rygel.png
+       $(INSTALL_DATA) \
+               $(PKG_INSTALL_DIR)/usr/share/icons/hicolor/128x128/apps/rygel.png \
+               $(1)/usr/share/icons/hicolor/128x128/apps/rygel.png
+endef
+
+# 1: plugin name as used in shared library filename
+# 2: additional dependencies, if any
+define RygelBuildPlugin
+
+  define Package/rygel-$(1)
+    $(call Package/rygel/Default)
+    TITLE+= - $(1) plugin
+    DEPENDS:=+rygel $(2)
+  endef
+
+  define Package/rygel-$(1)/install
+       $(INSTALL_DIR) $$(1)/usr/lib/rygel-1.0
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/rygel-1.0/librygel-$(1).so \
+               $$(1)/usr/lib/rygel-1.0
+  endef
+
+  $$(eval $$(call BuildPackage,rygel-$(1)))
+endef
+
+define Package/rygel-external/description
+  $(call Package/rygel/description/Default)
+  .
+  This package contains the external plugin, a MediaServer plugin that exports
+  media provided by applications implementing the D-Bus MediaServer interface.
+endef
+$(eval $(call RygelBuildPlugin,external))
+
+define Package/rygel-media-export/description
+  $(call Package/rygel/description/Default)
+  .
+  This package contains the media-export plugin, a MediaServer plugin that
+  recursively exports files and folders specified in the user configuration.
+endef
+$(eval $(call RygelBuildPlugin,media-export,+libsqlite3 +libgstapp +libgsttag))
+
+define Package/rygel-mpris/description
+  $(call Package/rygel/description/Default)
+  .
+  This package contains the mpris plugin, a MediaServer plugin that exports
+  media provided by applications implementing the D-Bus MPRIS2 interface.
+endef
+$(eval $(call RygelBuildPlugin,mpris))
+
+define Package/rygel-tracker/description
+  $(call Package/rygel/description/Default)
+  .
+  This package contains the tracker plugin, a MediaServer plugin that exports
+  media known to Tracker.
+endef
+$(eval $(call RygelBuildPlugin,tracker))
+
+define Package/rygel-playbin/description
+  $(call Package/rygel/description/Default)
+  .
+  This package contains the playbin plugin, the MediaRenderer plugin.
+endef
+$(eval $(call RygelBuildPlugin,playbin))
+
+define Package/rygel-playbin-gst-suggested/description
+  $(call Package/rygel/description/Default)
+  .
+  This optional metapackage installs a suggested set of gstreamer plugins to
+  support audio playback in rygel-playbin.
+endef
+
+define Package/rygel-playbin-gst-suggested
+  $(call Package/rygel/Default)
+  TITLE:=Suggested GStreamer plugins for rygel-playbin
+  DEPENDS:= \
+    +gst-mod-alsa \
+    +gst-mod-audioconvert \
+    +gst-mod-audioparsers \
+    +gst-mod-audioresample \
+    +gst-mod-autodetect \
+    +gst-mod-decodebin2 \
+    +gst-mod-flac \
+    +gst-mod-icydemux \
+    +gst-mod-id3demux \
+    +gst-mod-isomp4 \
+    +gst-mod-ogg \
+    +gst-mod-playbin \
+    +gst-mod-souphttpsrc \
+    +gst-mod-typefindfunctions \
+    +gst-mod-volume \
+    +gst-mod-vorbis \
+    +BUILD_PATENTED:gst-mod-faad \
+    +BUILD_PATENTED:gst-mod-mad
+endef
+$(eval $(call BuildPackage,rygel-playbin-gst-suggested))
+$(eval $(call BuildPackage,rygel))
diff --git a/multimedia/rygel/files/etc/config/rygel b/multimedia/rygel/files/etc/config/rygel
new file mode 100644 (file)
index 0000000..3dd222e
--- /dev/null
@@ -0,0 +1,6 @@
+# This file is converted to the rygel config syntax.
+# Underscores in option names are changed to hyphens.
+
+config plugin Playbin
+       option enabled true
+       option title 'Audio/Video playback on @HOSTNAME@'
diff --git a/multimedia/rygel/files/etc/init.d/rygel b/multimedia/rygel/files/etc/init.d/rygel
new file mode 100755 (executable)
index 0000000..9d1ede4
--- /dev/null
@@ -0,0 +1,30 @@
+#!/bin/sh /etc/rc.common
+# Copyright (C) 2012 OpenWrt.org
+START=90
+STOP=10
+SERVICE_DAEMONIZE=1
+
+cfgfile="/var/run/rygel.conf"
+rm -f $cfgfile
+
+config_cb() {
+       local section="$2"
+       [ -n "$section" ] && echo "[$section]" >> $cfgfile
+}
+
+option_cb() {
+       local name=$(echo "$1" | tr _ -)
+       local value="$2"
+       echo "$name=$value" >> $cfgfile
+}
+
+start() {        
+       config_load rygel
+       service_start /usr/bin/rygel -c $cfgfile
+}                 
+stop() {          
+       service_stop /usr/bin/rygel
+}
diff --git a/multimedia/rygel/files/etc/rygel.conf b/multimedia/rygel/files/etc/rygel.conf
new file mode 100644 (file)
index 0000000..7e86d5a
--- /dev/null
@@ -0,0 +1,9 @@
+# Rygel requires that /etc/rygel.conf exists in order to start properly.
+# This file contains some simple default configuration.
+# Configuration changes should be made in /etc/config/rygel.
+
+[general]
+upnp-enabled=true
+log-level=*:4
+interface=
+port=0
diff --git a/multimedia/rygel/patches/010-conftest-honor-cc.patch b/multimedia/rygel/patches/010-conftest-honor-cc.patch
new file mode 100644 (file)
index 0000000..3eab47c
--- /dev/null
@@ -0,0 +1,16 @@
+--- a/m4/vala.m4
++++ b/m4/vala.m4
+@@ -28,7 +28,12 @@
+ void main(){}
+ _ACEOF
+-  AS_IF([vala_error=`$VALAC $1 -q -o conftest$ac_exeext conftest.vala 2>&1`],
++  unset vala_cc_args
++  for cflag in $CFLAGS $CPPFLAGS $LDFLAGS; do
++    vala_cc_args="${vala_cc_args:+$vala_cc_args }-X $cflag"
++  done
++
++  AS_IF([vala_error=`$VALAC $1 -q $VALAFLAGS --cc $CC $vala_cc_args -o conftest$ac_exeext conftest.vala 2>&1`],
+         [$2], [$3])
+ ])
diff --git a/multimedia/rygel/patches/010-identify-libs-by-suffix.patch b/multimedia/rygel/patches/010-identify-libs-by-suffix.patch
new file mode 100644 (file)
index 0000000..50df4fc
--- /dev/null
@@ -0,0 +1,18 @@
+--- a/src/rygel/rygel-plugin-loader.vala
++++ b/src/rygel/rygel-plugin-loader.vala
+@@ -126,13 +126,12 @@
+         foreach (var info in infos) {
+             var file = dir.get_child (info.get_name ());
+             FileType file_type = info.get_file_type ();
+-            string content_type = info.get_content_type ();
+-            string mime = ContentType.get_mime_type (content_type);
++            string file_name = info.get_name ();
+             if (file_type == FileType.DIRECTORY) {
+                 // Recurse into directories
+                 this.load_modules_from_dir.begin (file);
+-            } else if (mime == "application/x-sharedlib") {
++            } else if (file_name.has_suffix (Module.SUFFIX)) {
+                 // Seems like we found a module
+                 this.load_module_from_file (file);
+             }
diff --git a/multimedia/rygel/patches/010-vapidirs-from-pkg-config.patch b/multimedia/rygel/patches/010-vapidirs-from-pkg-config.patch
new file mode 100644 (file)
index 0000000..70023c5
--- /dev/null
@@ -0,0 +1,28 @@
+--- a/m4/rygel.m4      2012-04-12 08:47:08.000000000 -0700
++++ b/m4/rygel.m4      2012-06-15 11:55:36.000000000 -0700
+@@ -99,6 +99,25 @@
+           [dnl check for vala
+            AM_PROG_VALAC([$1])
++            dnl See where we should look for vapi files. If it's under
++            dnl $datadir, then assume it's one of the standard locations where
++            dnl vala will look. Otherwise, specify explicitly.
++            dnl
++            dnl Note the distinction between these directories (where we look
++            dnl for APIs when we do vala builds) and VAPIDIR, which is where we
++            dnl install our own vapi files.
++
++            for var in vapidir vapidir_versioned; do
++                AS_IF([dir=`$PKG_CONFIG --variable=$var vapigen`],
++                    [
++                        AC_MSG_NOTICE([got $var=$dir from pkg-config])
++                        AS_IF([expr "$dir" : "${datadir}"],
++                            [],
++                            [RYGEL_ADD_VALAFLAGS([--vapidir $dir])])
++                    ],
++                    [AC_MSG_NOTICE([pkg-config didn't return a value for $var, relying on valac built-in defaults])])
++            done
++
+             AS_IF([test x$VALAC = "x"],
+                 [AC_MSG_ERROR([Cannot find the "valac" compiler in your PATH])],
+                 [
diff --git a/multimedia/rygel/patches/020-playbin-mime-types.patch b/multimedia/rygel/patches/020-playbin-mime-types.patch
new file mode 100644 (file)
index 0000000..7ef4333
--- /dev/null
@@ -0,0 +1,10 @@
+--- a/src/plugins/playbin/rygel-playbin-player.vala
++++ b/src/plugins/playbin/rygel-playbin-player.vala
+@@ -37,6 +37,7 @@
+                                         "audio/x-wav",
+                                         "audio/x-ac3",
+                                         "audio/x-m4a",
++                                        "audio/mp4",
+                                         "image/jpeg",
+                                         "image/png",
+                                         "video/x-theora",
diff --git a/multimedia/rygel/patches/030-output-to-syslog.patch b/multimedia/rygel/patches/030-output-to-syslog.patch
new file mode 100644 (file)
index 0000000..0ed15cd
--- /dev/null
@@ -0,0 +1,35 @@
+Take all the output and send it to syslog.
+This isn't great, but it's better than sending it to the bitbucket, at least
+for troubleshooting.
+--- a/src/rygel/rygel-log-handler.vala
++++ b/src/rygel/rygel-log-handler.vala
+@@ -56,6 +56,29 @@
+     private LogHandler () {
+         this.log_level_hash = new HashMap<string,LogLevelFlags> ();
++        string[] argv = { "/usr/bin/logger", "-t", "rygel" };
++        int logger_fd;
++
++        try {
++            GLib.Process.spawn_async_with_pipes (null,          // working_directory
++                                                 argv,
++                                                 null,          // envp
++                                                 SpawnFlags.STDOUT_TO_DEV_NULL |
++                                                 SpawnFlags.STDERR_TO_DEV_NULL,
++                                                 null,         // child_setup
++                                                 null,         // child_pid
++                                                 out logger_fd, // standard_input
++                                                 null,          // standard_output
++                                                 null);         // standard_error
++
++            Posix.dup2 (logger_fd, Posix.STDOUT_FILENO);
++            Posix.dup2 (logger_fd, Posix.STDERR_FILENO);
++            Posix.close (logger_fd);
++        } catch (Error err) {
++            warning (_("Unable to send output to /usr/bin/logger: %s"),
++                     err.message);
++        }
++
+         // Get the allowed log levels from the config
+         var config = MetaConfig.get_default ();
+         string log_levels;