lol

dleyna-core: init at 0.6.0

+134
+95
pkgs/development/libraries/dleyna-core/0001-Search-connectors-in-DLEYNA_CONNECTOR_PATH.patch
··· 1 + From bf549a028a5da122b7a4206529711b969c2ecd48 Mon Sep 17 00:00:00 2001 2 + From: Jan Tojnar <jtojnar@gmail.com> 3 + Date: Fri, 1 Sep 2017 13:49:06 +0200 4 + Subject: [PATCH] Search connectors in DLEYNA_CONNECTOR_PATH 5 + 6 + Previously, the connectors would only be looked for in a single 7 + directory, specified during compilation. This patch allows to 8 + traverse a list of directories provided by an environment variable. 9 + --- 10 + libdleyna/core/connector-mgr.c | 63 ++++++++++++++++++++++++++++-------------- 11 + 1 file changed, 42 insertions(+), 21 deletions(-) 12 + 13 + diff --git a/libdleyna/core/connector-mgr.c b/libdleyna/core/connector-mgr.c 14 + index eafb16c..8041c67 100644 15 + --- a/libdleyna/core/connector-mgr.c 16 + +++ b/libdleyna/core/connector-mgr.c 17 + @@ -34,33 +34,54 @@ const dleyna_connector_t *dleyna_connector_mgr_load(const gchar *name) 18 + const dleyna_connector_t *connector; 19 + dleyna_connector_get_interface_t get_interface; 20 + gchar *path; 21 + + const gchar *connector_path; 22 + + gchar **connector_path_list; 23 + + gsize i; 24 + 25 + DLEYNA_LOG_DEBUG("Enter"); 26 + 27 + - path = g_strdup_printf("%s/%s%s.so", CONNECTOR_DIR, 28 + - DLEYNA_CONNECTOR_LIB_PATTERN, name); 29 + - module = g_module_open(path, G_MODULE_BIND_LAZY); 30 + - g_free(path); 31 + + connector_path = g_getenv ("DLEYNA_CONNECTOR_PATH"); 32 + + if (!connector_path) { 33 + + DLEYNA_LOG_DEBUG ("DLEYNA_CONNECTOR_PATH not set"); 34 + + connector_path = CONNECTOR_DIR; 35 + + } else { 36 + + DLEYNA_LOG_DEBUG ("DLEYNA_CONNECTOR_PATH set to %s", connector_path); 37 + + } 38 + + 39 + + connector_path_list = g_strsplit (connector_path, G_SEARCHPATH_SEPARATOR_S, 0); 40 + + 41 + + for (i = 0; connector_path_list[i]; i++) { 42 + + path = g_strdup_printf("%s/%s%s.so", connector_path_list[i], 43 + + DLEYNA_CONNECTOR_LIB_PATTERN, name); 44 + + module = g_module_open(path, G_MODULE_BIND_LAZY); 45 + + g_free(path); 46 + + 47 + + if (module) { 48 + + if (!g_connectors) 49 + + g_connectors = g_hash_table_new(g_direct_hash, 50 + + g_direct_equal); 51 + + 52 + + if (g_module_symbol(module, "dleyna_connector_get_interface", 53 + + (gpointer *)&get_interface)) { 54 + + connector = get_interface(); 55 + + g_hash_table_insert(g_connectors, (gpointer)connector, 56 + + module); 57 + + 58 + + break; 59 + + } else { 60 + + connector = NULL; 61 + + g_module_close(module); 62 + + DLEYNA_LOG_CRITICAL( 63 + + "Connector '%s' entry point not found", 64 + + name); 65 + + } 66 + 67 + - if (module) { 68 + - if (!g_connectors) 69 + - g_connectors = g_hash_table_new(g_direct_hash, 70 + - g_direct_equal); 71 + - 72 + - if (g_module_symbol(module, "dleyna_connector_get_interface", 73 + - (gpointer *)&get_interface)) { 74 + - connector = get_interface(); 75 + - g_hash_table_insert(g_connectors, (gpointer)connector, 76 + - module); 77 + - } else { 78 + - connector = NULL; 79 + - g_module_close(module); 80 + - DLEYNA_LOG_CRITICAL( 81 + - "Connector '%s' entry point not found", 82 + - name); 83 + } 84 + + } 85 + 86 + - } else { 87 + + g_strfreev (connector_path_list); 88 + + 89 + + if (!module) { 90 + connector = NULL; 91 + DLEYNA_LOG_CRITICAL("Connector '%s' not found", name); 92 + } 93 + -- 94 + 2.14.1 95 +
+28
pkgs/development/libraries/dleyna-core/default.nix
··· 1 + { stdenv, autoreconfHook, pkgconfig, fetchFromGitHub, gupnp }: 2 + 3 + stdenv.mkDerivation rec { 4 + name = "dleyna-core"; 5 + version = "0.6.0"; 6 + 7 + src = fetchFromGitHub { 8 + owner = "01org"; 9 + repo = name; 10 + rev = "v${version}"; 11 + sha256 = "1x5vj5zfk95avyg6g3nf6gar250cfrgla2ixj2ifn8pcick2d9vq"; 12 + }; 13 + 14 + setupHook = ./setup-hook.sh; 15 + 16 + patches = [ ./0001-Search-connectors-in-DLEYNA_CONNECTOR_PATH.patch ]; 17 + 18 + nativeBuildInputs = [ autoreconfHook pkgconfig ]; 19 + propagatedBuildInputs = [ gupnp ]; 20 + 21 + meta = with stdenv.lib; { 22 + description = "Library of utility functions that are used by the higher level dLeyna"; 23 + homepage = http://01.org/dleyna; 24 + maintainers = [ maintainers.jtojnar ]; 25 + platforms = platforms.linux; 26 + license = licenses.lgpl21; 27 + }; 28 + }
+9
pkgs/development/libraries/dleyna-core/setup-hook.sh
··· 1 + addDleynaConnectorPath () { 2 + if test -d "$1/lib/dleyna-1.0/connectors" 3 + then 4 + export DLEYNA_CONNECTOR_PATH="${DLEYNA_CONNECTOR_PATH}${DLEYNA_CONNECTOR_PATH:+:}$1/lib/dleyna-1.0/connectors" 5 + fi 6 + } 7 + 8 + envHooks+=(addDleynaConnectorPath) 9 +
+2
pkgs/top-level/all-packages.nix
··· 1749 1749 1750 1750 disper = callPackage ../tools/misc/disper { }; 1751 1751 1752 + dleyna-core = callPackage ../development/libraries/dleyna-core { }; 1753 + 1752 1754 dmd_2_067_1 = callPackage ../development/compilers/dmd/2.067.1.nix { 1753 1755 stdenv = if stdenv.hostPlatform.isDarwin then 1754 1756 stdenv