From fac37975dd471c945145e5f147932170d4f4198f Mon Sep 17 00:00:00 2001 From: Darren Salt Date: Wed, 6 Feb 2008 18:27:31 +0000 Subject: Change from release numbering to ABI numbering for the plugin directory. This is to avoid having to rebuild external plugins for each new release. --HG-- extra : transplant_source : %C2%3EF%0B%EF%16%40K%FD.%EB9%E07%CB%97GhU%98 --- ChangeLog | 6 ++++ configure.ac | 26 +++++++++----- src/xine-engine/load_plugins.c | 79 +++++++++++++++++++++++------------------- 3 files changed, 67 insertions(+), 44 deletions(-) diff --git a/ChangeLog b/ChangeLog index f05ce93eb..e9af6b424 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,11 @@ xine-lib (1.1.11) unreleased * Fix a RealPlayer codec detection bug. + * Reworked the plugin directory naming so that external plugins don't have + to be rebuilt for every release. We now use a naming scheme based on the + API/ABI versioning, checking older directories - with this release, the + plugin directory name is 1.19, and if this gets bumped to 1.20 in a + future release, 1.19 will still be available for external plugins. + (Any directories not 1.* won't be looked in.) xine-lib (1.1.10) 2008-01-26 * Security fixes: diff --git a/configure.ac b/configure.ac index 9badb9d23..51d30234b 100644 --- a/configure.ac +++ b/configure.ac @@ -78,6 +78,9 @@ AC_SUBST(XINE_LT_CURRENT) AC_SUBST(XINE_LT_REVISION) AC_SUBST(XINE_LT_AGE) +AC_DEFINE_UNQUOTED(XINE_LT_CURRENT, $XINE_LT_CURRENT, [xine interface version number]) +AC_DEFINE_UNQUOTED(XINE_LT_AGE, $XINE_LT_AGE, [xine interface version age]) + SPEC_VERSION=$XINE_MAJOR.$XINE_MINOR${XINE_SUBPART}$XINE_PRE TAR_NAME="xine-lib-"$SPEC_VERSION dnl TAR_NAME="xine-lib-"$XINE_MAJOR-$XINE_PRE @@ -2399,38 +2402,45 @@ AC_SUBST(xinelibdir) AC_SUBST(xinedatadir) AC_SUBST(pkgconfigdir) -XINE_PLUGINDIR="\${xinelibdir}/plugins/$XINE_MAJOR.$XINE_MINOR.$XINE_SUB$XINE_PATCH" +XINE_PLUGINROOT="\${xinelibdir}/plugins/$(($XINE_LT_CURRENT-$XINE_LT_AGE))" +XINE_PLUGINDIR="$XINE_PLUGINROOT.$XINE_LT_AGE" XINE_FONTDIR="\${xinedatadir}/libxine$XINE_MAJOR/fonts" XINE_LOCALEDIR='${datadir}/locale' -XINE_REL_PLUGINDIR="`makeexpand "$XINE_PLUGINDIR"`" -XINE_REL_PLUGINDIR="`makeexpand "$XINE_REL_PLUGINDIR" | sed -e "s,^${prefix}/,,"`" +XINE_REL_PLUGINROOT="`makeexpand "$XINE_PLUGINROOT"`" +XINE_REL_PLUGINROOT="`makeexpand "$XINE_REL_PLUGINROOT" | sed -e "s,^${prefix}/,,"`" +XINE_REL_PLUGINDIR="$XINE_REL_PLUGINROOT.$XINE_LT_AGE" XINE_REL_FONTDIR="`makeexpand "$XINE_FONTDIR" | sed -e "s,^${prefix}/,,"`" XINE_REL_LOCALEDIR="`makeexpand "$XINE_LOCALEDIR" | sed -e "s,^${prefix}/,,"`" XINE_PKGCONFIG_DIR="`makeexpand "$pkgconfigdir"`" if test "x$SYS" = "xmingw32" -o "x$SYS" = "xcygwin"; then dnl polish paths (MinGW runtime accepts both \ and / anyway) - XINE_REL_PLUGINDIR="`echo "$XINE_REL_PLUGINDIR" | sed -e 's/\\//\\\\\\\\/g'`" + XINE_REL_PLUGINROOT="`echo "$XINE_REL_PLUGINROOT" | sed -e 's/\\//\\\\\\\\/g'`" + XINE_REL_PLUGINDIR="$XINE_REL_PLUGINROOT.$XINE_LT_AGE" XINE_REL_FONTDIR="`echo "$XINE_REL_FONTDIR" | sed -e 's/\\//\\\\\\\\/g'`" XINE_REL_LOCALEDIR="`echo "$XINE_REL_LOCALEDIR" | sed -e 's/\\//\\\\\\\\/g'`" dnl prefix in xine-config XINE_CONFIG_PREFIX="\$(cd \$(dirname \$0)/..; pwd)" dnl installation directories (in xine-config) - XINE_PLUGINPATH="$XINE_CONFIG_PREFIX/$XINE_REL_PLUGINDIR" + XINE_PLUGINROOTPATH="$XINE_CONFIG_PREFIX/$XINE_REL_PLUGINROOT" + XINE_PLUGINPATH="$XINE_PLUGINROOTPATH.$XINE_LT_AGE" XINE_FONTPATH="$XINE_CONFIG_PREFIX/$XINE_REL_FONTDIR" XINE_LOCALEPATH="$XINE_CONFIG_PREFIX/$XINE_REL_LOCALEDIR" dnl runtime directories - AC_DEFINE(XINE_PLUGINDIR,[xine_get_plugindir()],[Define this to plugins directory location]) + AC_DEFINE(XINE_PLUGINROOT,[xine_get_pluginroot()],[Define this to general plugins directory location]) + AC_DEFINE(XINE_PLUGINDIR,[xine_get_plugindir()],[Define this to specific plugins directory location]) AC_DEFINE(XINE_FONTDIR,[xine_get_fontdir()],[Define this to osd fonts dir location]) AC_DEFINE(XINE_LOCALEDIR,[xine_get_localedir()],[Path where catalog files will be.]) else dnl prefix in xine-config XINE_CONFIG_PREFIX="`makeexpand "${prefix}"`" dnl directories from xine-config and runtime directories - XINE_PLUGINPATH="`makeexpand "$XINE_PLUGINDIR"`" + XINE_PLUGINROOTPATH="`makeexpand "$XINE_PLUGINROOT"`" + XINE_PLUGINPATH="$XINE_PLUGINROOTPATH.$XINE_LT_AGE" XINE_FONTPATH="`makeexpand "$XINE_FONTDIR"`" XINE_LOCALEPATH="`makeexpand "$XINE_LOCALEDIR"`" dnl defining runtime directories - AC_DEFINE_UNQUOTED(XINE_PLUGINDIR,"$XINE_PLUGINPATH",[Define this to plugins directory location]) + AC_DEFINE_UNQUOTED(XINE_PLUGINROOT,"$XINE_PLUGINROOTPATH",[Define this to general plugins directory location]) + AC_DEFINE_UNQUOTED(XINE_PLUGINDIR,"$XINE_PLUGINPATH",[Define this to specific plugins directory location]) AC_DEFINE_UNQUOTED(XINE_FONTDIR,"$XINE_FONTPATH",[Define this to osd fonts dir location]) AC_DEFINE_UNQUOTED(XINE_LOCALEDIR, "$XINE_LOCALEPATH",[Path where catalog files will be.]) fi diff --git a/src/xine-engine/load_plugins.c b/src/xine-engine/load_plugins.c index 71cb19d3b..11a74b097 100644 --- a/src/xine-engine/load_plugins.c +++ b/src/xine-engine/load_plugins.c @@ -1119,14 +1119,24 @@ static void load_cached_catalog (xine_t *this) { } +/* helper function for _x_scan_plugins */ +static void push_if_dir (xine_list_t *plugindirs, void *path) +{ + struct stat st; + if (!stat (path, &st) && S_ISDIR (st.st_mode)) + xine_list_push_back (plugindirs, path); + else + free (path); +} + /* * initialize catalog, load all plugins into new catalog */ void _x_scan_plugins (xine_t *this) { - - char *homedir, *plugindir, *pluginpath; - int i,j; - int lenpluginpath; + + char *homedir, *pluginpath; + xine_list_t *plugindirs = xine_list_new (); + xine_list_iterator_t iter; lprintf("_x_scan_plugins()\n"); @@ -1140,41 +1150,38 @@ void _x_scan_plugins (xine_t *this) { this->plugin_catalog = _new_catalog(); load_cached_catalog (this); - if ((pluginpath = getenv("XINE_PLUGIN_PATH")) != NULL) { - pluginpath = strdup(pluginpath); + if ((pluginpath = getenv("XINE_PLUGIN_PATH")) != NULL && *pluginpath) { + char *p = pluginpath - 1; + while (p[1]) + { + char *dir, *q = p; + p = strchr (p + 1, XINE_PATH_SEPARATOR_CHAR); + if (q[0] == '~' && q[1] == '/') + asprintf (&dir, "%s%.*s", homedir, (int)(p - q - 1), q + 1); + else + dir = strndup (q, p - q); + push_if_dir (plugindirs, dir); /* store or free it */ + } } else { - const char *str1, *str2; - int len; - - str1 = "~/.xine/plugins"; - str2 = XINE_PLUGINDIR; - len = strlen(str1) + strlen(str2) + 2; - pluginpath = xine_xmalloc(len); - snprintf(pluginpath, len, "%s" XINE_PATH_SEPARATOR_STRING "%s", str1, str2); - } - plugindir = xine_xmalloc(strlen(pluginpath)+strlen(homedir)+2); - j=0; - lenpluginpath = strlen(pluginpath); - for (i=0; i <= lenpluginpath; ++i){ - switch (pluginpath[i]){ - case XINE_PATH_SEPARATOR_CHAR: - case '\0': - plugindir[j] = '\0'; - collect_plugins(this, plugindir); - j = 0; - break; - case '~': - if (j == 0){ - strcpy(plugindir, homedir); - j = strlen(plugindir); - break; - } - default: - plugindir[j++] = pluginpath[i]; + char *dir; + int i; + asprintf (&dir, "%s/.xine/plugins", homedir); + push_if_dir (plugindirs, dir); + for (i = 0; i <= XINE_LT_AGE; ++i) + { + asprintf (&dir, "%s.%d", XINE_PLUGINROOT, i); + push_if_dir (plugindirs, dir); } } - free(plugindir); - free(pluginpath); + for (iter = xine_list_front (plugindirs); iter; + iter = xine_list_next (plugindirs, iter)) + { + char *dir = xine_list_get_value (plugindirs, iter); +fprintf (stderr, "%s\n", dir); + collect_plugins(this, dir); + free (dir); + } + xine_list_delete (plugindirs); free(homedir); save_catalog (this); -- cgit v1.2.3 From 167035abe222bad88269d296f9d819365a6c6007 Mon Sep 17 00:00:00 2001 From: Darren Salt Date: Thu, 7 Feb 2008 02:03:00 +0000 Subject: Reverse the order in which the plugin dirs are scanned; remove a stray printf. --- src/xine-engine/load_plugins.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/xine-engine/load_plugins.c b/src/xine-engine/load_plugins.c index 11a74b097..0188fb01d 100644 --- a/src/xine-engine/load_plugins.c +++ b/src/xine-engine/load_plugins.c @@ -1169,7 +1169,7 @@ void _x_scan_plugins (xine_t *this) { push_if_dir (plugindirs, dir); for (i = 0; i <= XINE_LT_AGE; ++i) { - asprintf (&dir, "%s.%d", XINE_PLUGINROOT, i); + asprintf (&dir, "%s.%d", XINE_PLUGINROOT, XINE_LT_AGE - i); push_if_dir (plugindirs, dir); } } @@ -1177,7 +1177,6 @@ void _x_scan_plugins (xine_t *this) { iter = xine_list_next (plugindirs, iter)) { char *dir = xine_list_get_value (plugindirs, iter); -fprintf (stderr, "%s\n", dir); collect_plugins(this, dir); free (dir); } -- cgit v1.2.3