dleyna-core: init at 0.6.0
This commit is contained in:
parent
6c6f6a4008
commit
f2bf15a20c
@ -0,0 +1,95 @@
|
|||||||
|
From bf549a028a5da122b7a4206529711b969c2ecd48 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Jan Tojnar <jtojnar@gmail.com>
|
||||||
|
Date: Fri, 1 Sep 2017 13:49:06 +0200
|
||||||
|
Subject: [PATCH] Search connectors in DLEYNA_CONNECTOR_PATH
|
||||||
|
|
||||||
|
Previously, the connectors would only be looked for in a single
|
||||||
|
directory, specified during compilation. This patch allows to
|
||||||
|
traverse a list of directories provided by an environment variable.
|
||||||
|
---
|
||||||
|
libdleyna/core/connector-mgr.c | 63 ++++++++++++++++++++++++++++--------------
|
||||||
|
1 file changed, 42 insertions(+), 21 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/libdleyna/core/connector-mgr.c b/libdleyna/core/connector-mgr.c
|
||||||
|
index eafb16c..8041c67 100644
|
||||||
|
--- a/libdleyna/core/connector-mgr.c
|
||||||
|
+++ b/libdleyna/core/connector-mgr.c
|
||||||
|
@@ -34,33 +34,54 @@ const dleyna_connector_t *dleyna_connector_mgr_load(const gchar *name)
|
||||||
|
const dleyna_connector_t *connector;
|
||||||
|
dleyna_connector_get_interface_t get_interface;
|
||||||
|
gchar *path;
|
||||||
|
+ const gchar *connector_path;
|
||||||
|
+ gchar **connector_path_list;
|
||||||
|
+ gsize i;
|
||||||
|
|
||||||
|
DLEYNA_LOG_DEBUG("Enter");
|
||||||
|
|
||||||
|
- path = g_strdup_printf("%s/%s%s.so", CONNECTOR_DIR,
|
||||||
|
- DLEYNA_CONNECTOR_LIB_PATTERN, name);
|
||||||
|
- module = g_module_open(path, G_MODULE_BIND_LAZY);
|
||||||
|
- g_free(path);
|
||||||
|
+ connector_path = g_getenv ("DLEYNA_CONNECTOR_PATH");
|
||||||
|
+ if (!connector_path) {
|
||||||
|
+ DLEYNA_LOG_DEBUG ("DLEYNA_CONNECTOR_PATH not set");
|
||||||
|
+ connector_path = CONNECTOR_DIR;
|
||||||
|
+ } else {
|
||||||
|
+ DLEYNA_LOG_DEBUG ("DLEYNA_CONNECTOR_PATH set to %s", connector_path);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ connector_path_list = g_strsplit (connector_path, G_SEARCHPATH_SEPARATOR_S, 0);
|
||||||
|
+
|
||||||
|
+ for (i = 0; connector_path_list[i]; i++) {
|
||||||
|
+ path = g_strdup_printf("%s/%s%s.so", connector_path_list[i],
|
||||||
|
+ DLEYNA_CONNECTOR_LIB_PATTERN, name);
|
||||||
|
+ module = g_module_open(path, G_MODULE_BIND_LAZY);
|
||||||
|
+ g_free(path);
|
||||||
|
+
|
||||||
|
+ if (module) {
|
||||||
|
+ if (!g_connectors)
|
||||||
|
+ g_connectors = g_hash_table_new(g_direct_hash,
|
||||||
|
+ g_direct_equal);
|
||||||
|
+
|
||||||
|
+ if (g_module_symbol(module, "dleyna_connector_get_interface",
|
||||||
|
+ (gpointer *)&get_interface)) {
|
||||||
|
+ connector = get_interface();
|
||||||
|
+ g_hash_table_insert(g_connectors, (gpointer)connector,
|
||||||
|
+ module);
|
||||||
|
+
|
||||||
|
+ break;
|
||||||
|
+ } else {
|
||||||
|
+ connector = NULL;
|
||||||
|
+ g_module_close(module);
|
||||||
|
+ DLEYNA_LOG_CRITICAL(
|
||||||
|
+ "Connector '%s' entry point not found",
|
||||||
|
+ name);
|
||||||
|
+ }
|
||||||
|
|
||||||
|
- if (module) {
|
||||||
|
- if (!g_connectors)
|
||||||
|
- g_connectors = g_hash_table_new(g_direct_hash,
|
||||||
|
- g_direct_equal);
|
||||||
|
-
|
||||||
|
- if (g_module_symbol(module, "dleyna_connector_get_interface",
|
||||||
|
- (gpointer *)&get_interface)) {
|
||||||
|
- connector = get_interface();
|
||||||
|
- g_hash_table_insert(g_connectors, (gpointer)connector,
|
||||||
|
- module);
|
||||||
|
- } else {
|
||||||
|
- connector = NULL;
|
||||||
|
- g_module_close(module);
|
||||||
|
- DLEYNA_LOG_CRITICAL(
|
||||||
|
- "Connector '%s' entry point not found",
|
||||||
|
- name);
|
||||||
|
}
|
||||||
|
+ }
|
||||||
|
|
||||||
|
- } else {
|
||||||
|
+ g_strfreev (connector_path_list);
|
||||||
|
+
|
||||||
|
+ if (!module) {
|
||||||
|
connector = NULL;
|
||||||
|
DLEYNA_LOG_CRITICAL("Connector '%s' not found", name);
|
||||||
|
}
|
||||||
|
--
|
||||||
|
2.14.1
|
||||||
|
|
28
pkgs/development/libraries/dleyna-core/default.nix
Normal file
28
pkgs/development/libraries/dleyna-core/default.nix
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
{ stdenv, autoreconfHook, pkgconfig, fetchFromGitHub, gupnp }:
|
||||||
|
|
||||||
|
stdenv.mkDerivation rec {
|
||||||
|
name = "dleyna-core";
|
||||||
|
version = "0.6.0";
|
||||||
|
|
||||||
|
src = fetchFromGitHub {
|
||||||
|
owner = "01org";
|
||||||
|
repo = name;
|
||||||
|
rev = "v${version}";
|
||||||
|
sha256 = "1x5vj5zfk95avyg6g3nf6gar250cfrgla2ixj2ifn8pcick2d9vq";
|
||||||
|
};
|
||||||
|
|
||||||
|
setupHook = ./setup-hook.sh;
|
||||||
|
|
||||||
|
patches = [ ./0001-Search-connectors-in-DLEYNA_CONNECTOR_PATH.patch ];
|
||||||
|
|
||||||
|
nativeBuildInputs = [ autoreconfHook pkgconfig ];
|
||||||
|
propagatedBuildInputs = [ gupnp ];
|
||||||
|
|
||||||
|
meta = with stdenv.lib; {
|
||||||
|
description = "Library of utility functions that are used by the higher level dLeyna";
|
||||||
|
homepage = http://01.org/dleyna;
|
||||||
|
maintainers = [ maintainers.jtojnar ];
|
||||||
|
platforms = platforms.linux;
|
||||||
|
license = licenses.lgpl21;
|
||||||
|
};
|
||||||
|
}
|
9
pkgs/development/libraries/dleyna-core/setup-hook.sh
Normal file
9
pkgs/development/libraries/dleyna-core/setup-hook.sh
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
addDleynaConnectorPath () {
|
||||||
|
if test -d "$1/lib/dleyna-1.0/connectors"
|
||||||
|
then
|
||||||
|
export DLEYNA_CONNECTOR_PATH="${DLEYNA_CONNECTOR_PATH}${DLEYNA_CONNECTOR_PATH:+:}$1/lib/dleyna-1.0/connectors"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
envHooks+=(addDleynaConnectorPath)
|
||||||
|
|
@ -1749,6 +1749,8 @@ with pkgs;
|
|||||||
|
|
||||||
disper = callPackage ../tools/misc/disper { };
|
disper = callPackage ../tools/misc/disper { };
|
||||||
|
|
||||||
|
dleyna-core = callPackage ../development/libraries/dleyna-core { };
|
||||||
|
|
||||||
dmd_2_067_1 = callPackage ../development/compilers/dmd/2.067.1.nix {
|
dmd_2_067_1 = callPackage ../development/compilers/dmd/2.067.1.nix {
|
||||||
stdenv = if stdenv.hostPlatform.isDarwin then
|
stdenv = if stdenv.hostPlatform.isDarwin then
|
||||||
stdenv
|
stdenv
|
||||||
|
Loading…
x
Reference in New Issue
Block a user