Change from release numbering to ABI numbering for the plugin directory.
authorDarren Salt <linux@youmustbejoking.demon.co.uk>
Wed, 06 Feb 2008 18:27:31 +0000
changeset 91665d01b16fcdfe
parent 9165 a62d6f482a69
child 9167 8661ed842578
Change from release numbering to ABI numbering for the plugin directory.
This is to avoid having to rebuild external plugins for each new release.
ChangeLog
configure.ac
src/xine-engine/load_plugins.c
     1.1 --- a/ChangeLog	Mon Feb 04 15:08:25 2008 +0000
     1.2 +++ b/ChangeLog	Wed Feb 06 18:27:31 2008 +0000
     1.3 @@ -1,5 +1,11 @@
     1.4  xine-lib (1.1.11) unreleased
     1.5    * Fix a RealPlayer codec detection bug.
     1.6 +  * Reworked the plugin directory naming so that external plugins don't have
     1.7 +    to be rebuilt for every release. We now use a naming scheme based on the
     1.8 +    API/ABI versioning, checking older directories - with this release, the
     1.9 +    plugin directory name is 1.19, and if this gets bumped to 1.20 in a
    1.10 +    future release, 1.19 will still be available for external plugins.
    1.11 +    (Any directories not 1.* won't be looked in.)
    1.12  
    1.13  xine-lib (1.1.10) 2008-01-26
    1.14    * Security fixes:
     2.1 --- a/configure.ac	Mon Feb 04 15:08:25 2008 +0000
     2.2 +++ b/configure.ac	Wed Feb 06 18:27:31 2008 +0000
     2.3 @@ -78,6 +78,9 @@
     2.4  AC_SUBST(XINE_LT_REVISION)
     2.5  AC_SUBST(XINE_LT_AGE)
     2.6  
     2.7 +AC_DEFINE_UNQUOTED(XINE_LT_CURRENT, $XINE_LT_CURRENT, [xine interface version number])
     2.8 +AC_DEFINE_UNQUOTED(XINE_LT_AGE, $XINE_LT_AGE, [xine interface version age])
     2.9 +
    2.10  SPEC_VERSION=$XINE_MAJOR.$XINE_MINOR${XINE_SUBPART}$XINE_PRE
    2.11  TAR_NAME="xine-lib-"$SPEC_VERSION
    2.12  dnl TAR_NAME="xine-lib-"$XINE_MAJOR-$XINE_PRE
    2.13 @@ -2399,38 +2402,45 @@
    2.14  AC_SUBST(xinedatadir)
    2.15  AC_SUBST(pkgconfigdir)
    2.16  
    2.17 -XINE_PLUGINDIR="\${xinelibdir}/plugins/$XINE_MAJOR.$XINE_MINOR.$XINE_SUB$XINE_PATCH"
    2.18 +XINE_PLUGINROOT="\${xinelibdir}/plugins/$(($XINE_LT_CURRENT-$XINE_LT_AGE))"
    2.19 +XINE_PLUGINDIR="$XINE_PLUGINROOT.$XINE_LT_AGE"
    2.20  XINE_FONTDIR="\${xinedatadir}/libxine$XINE_MAJOR/fonts"
    2.21  XINE_LOCALEDIR='${datadir}/locale'
    2.22 -XINE_REL_PLUGINDIR="`makeexpand "$XINE_PLUGINDIR"`"
    2.23 -XINE_REL_PLUGINDIR="`makeexpand "$XINE_REL_PLUGINDIR" | sed -e "s,^${prefix}/,,"`"
    2.24 +XINE_REL_PLUGINROOT="`makeexpand "$XINE_PLUGINROOT"`"
    2.25 +XINE_REL_PLUGINROOT="`makeexpand "$XINE_REL_PLUGINROOT" | sed -e "s,^${prefix}/,,"`"
    2.26 +XINE_REL_PLUGINDIR="$XINE_REL_PLUGINROOT.$XINE_LT_AGE"
    2.27  XINE_REL_FONTDIR="`makeexpand "$XINE_FONTDIR" | sed -e "s,^${prefix}/,,"`"
    2.28  XINE_REL_LOCALEDIR="`makeexpand "$XINE_LOCALEDIR" | sed -e "s,^${prefix}/,,"`"
    2.29  XINE_PKGCONFIG_DIR="`makeexpand "$pkgconfigdir"`"
    2.30  if test "x$SYS" = "xmingw32" -o "x$SYS" = "xcygwin"; then
    2.31    dnl polish paths (MinGW runtime accepts both \ and / anyway)
    2.32 -  XINE_REL_PLUGINDIR="`echo "$XINE_REL_PLUGINDIR" | sed -e 's/\\//\\\\\\\\/g'`"
    2.33 +  XINE_REL_PLUGINROOT="`echo "$XINE_REL_PLUGINROOT" | sed -e 's/\\//\\\\\\\\/g'`"
    2.34 +  XINE_REL_PLUGINDIR="$XINE_REL_PLUGINROOT.$XINE_LT_AGE"
    2.35    XINE_REL_FONTDIR="`echo "$XINE_REL_FONTDIR" | sed -e 's/\\//\\\\\\\\/g'`"
    2.36    XINE_REL_LOCALEDIR="`echo "$XINE_REL_LOCALEDIR" | sed -e 's/\\//\\\\\\\\/g'`"
    2.37    dnl prefix in xine-config
    2.38    XINE_CONFIG_PREFIX="\$(cd \$(dirname \$0)/..; pwd)"
    2.39    dnl installation directories (in xine-config)
    2.40 -  XINE_PLUGINPATH="$XINE_CONFIG_PREFIX/$XINE_REL_PLUGINDIR"
    2.41 +  XINE_PLUGINROOTPATH="$XINE_CONFIG_PREFIX/$XINE_REL_PLUGINROOT"
    2.42 +  XINE_PLUGINPATH="$XINE_PLUGINROOTPATH.$XINE_LT_AGE"
    2.43    XINE_FONTPATH="$XINE_CONFIG_PREFIX/$XINE_REL_FONTDIR"
    2.44    XINE_LOCALEPATH="$XINE_CONFIG_PREFIX/$XINE_REL_LOCALEDIR"
    2.45    dnl runtime directories
    2.46 -  AC_DEFINE(XINE_PLUGINDIR,[xine_get_plugindir()],[Define this to plugins directory location])
    2.47 +  AC_DEFINE(XINE_PLUGINROOT,[xine_get_pluginroot()],[Define this to general plugins directory location])
    2.48 +  AC_DEFINE(XINE_PLUGINDIR,[xine_get_plugindir()],[Define this to specific plugins directory location])
    2.49    AC_DEFINE(XINE_FONTDIR,[xine_get_fontdir()],[Define this to osd fonts dir location])
    2.50    AC_DEFINE(XINE_LOCALEDIR,[xine_get_localedir()],[Path where catalog files will be.])
    2.51  else
    2.52    dnl prefix in xine-config
    2.53    XINE_CONFIG_PREFIX="`makeexpand "${prefix}"`"
    2.54    dnl directories from xine-config and runtime directories
    2.55 -  XINE_PLUGINPATH="`makeexpand "$XINE_PLUGINDIR"`"
    2.56 +  XINE_PLUGINROOTPATH="`makeexpand "$XINE_PLUGINROOT"`"
    2.57 +  XINE_PLUGINPATH="$XINE_PLUGINROOTPATH.$XINE_LT_AGE"
    2.58    XINE_FONTPATH="`makeexpand "$XINE_FONTDIR"`"
    2.59    XINE_LOCALEPATH="`makeexpand "$XINE_LOCALEDIR"`"
    2.60    dnl defining runtime directories
    2.61 -  AC_DEFINE_UNQUOTED(XINE_PLUGINDIR,"$XINE_PLUGINPATH",[Define this to plugins directory location])
    2.62 +  AC_DEFINE_UNQUOTED(XINE_PLUGINROOT,"$XINE_PLUGINROOTPATH",[Define this to general plugins directory location])
    2.63 +  AC_DEFINE_UNQUOTED(XINE_PLUGINDIR,"$XINE_PLUGINPATH",[Define this to specific plugins directory location])
    2.64    AC_DEFINE_UNQUOTED(XINE_FONTDIR,"$XINE_FONTPATH",[Define this to osd fonts dir location])
    2.65    AC_DEFINE_UNQUOTED(XINE_LOCALEDIR, "$XINE_LOCALEPATH",[Path where catalog files will be.])
    2.66  fi
     3.1 --- a/src/xine-engine/load_plugins.c	Mon Feb 04 15:08:25 2008 +0000
     3.2 +++ b/src/xine-engine/load_plugins.c	Wed Feb 06 18:27:31 2008 +0000
     3.3 @@ -1119,14 +1119,24 @@
     3.4  }
     3.5  
     3.6  
     3.7 +/* helper function for _x_scan_plugins */
     3.8 +static void push_if_dir (xine_list_t *plugindirs, void *path)
     3.9 +{
    3.10 +  struct stat st;
    3.11 +  if (!stat (path, &st) && S_ISDIR (st.st_mode))
    3.12 +    xine_list_push_back (plugindirs, path);
    3.13 +  else
    3.14 +    free (path);
    3.15 +}
    3.16 +
    3.17  /*
    3.18   *  initialize catalog, load all plugins into new catalog
    3.19   */
    3.20  void _x_scan_plugins (xine_t *this) {
    3.21 -  
    3.22 -  char *homedir, *plugindir, *pluginpath;
    3.23 -  int i,j;
    3.24 -  int lenpluginpath;
    3.25 +
    3.26 +  char *homedir, *pluginpath;
    3.27 +  xine_list_t *plugindirs = xine_list_new ();
    3.28 +  xine_list_iterator_t iter;
    3.29    
    3.30    lprintf("_x_scan_plugins()\n");
    3.31  
    3.32 @@ -1140,41 +1150,38 @@
    3.33    this->plugin_catalog = _new_catalog();
    3.34    load_cached_catalog (this);
    3.35  
    3.36 -  if ((pluginpath = getenv("XINE_PLUGIN_PATH")) != NULL) {
    3.37 -    pluginpath = strdup(pluginpath);
    3.38 +  if ((pluginpath = getenv("XINE_PLUGIN_PATH")) != NULL && *pluginpath) {
    3.39 +    char *p = pluginpath - 1;
    3.40 +    while (p[1])
    3.41 +    {
    3.42 +      char *dir, *q = p;
    3.43 +      p = strchr (p + 1, XINE_PATH_SEPARATOR_CHAR);
    3.44 +      if (q[0] == '~' && q[1] == '/')
    3.45 +	asprintf (&dir, "%s%.*s", homedir, (int)(p - q - 1), q + 1);
    3.46 +      else
    3.47 +	dir = strndup (q, p - q);
    3.48 +      push_if_dir (plugindirs, dir); /* store or free it */
    3.49 +    }
    3.50    } else {
    3.51 -    const char *str1, *str2;
    3.52 -    int len;
    3.53 -
    3.54 -    str1 = "~/.xine/plugins";
    3.55 -    str2 = XINE_PLUGINDIR;
    3.56 -    len = strlen(str1) + strlen(str2) + 2;
    3.57 -    pluginpath = xine_xmalloc(len);
    3.58 -    snprintf(pluginpath, len, "%s" XINE_PATH_SEPARATOR_STRING "%s", str1, str2);
    3.59 -  }
    3.60 -  plugindir = xine_xmalloc(strlen(pluginpath)+strlen(homedir)+2);
    3.61 -  j=0;
    3.62 -  lenpluginpath = strlen(pluginpath);
    3.63 -  for (i=0; i <= lenpluginpath; ++i){
    3.64 -    switch (pluginpath[i]){
    3.65 -    case XINE_PATH_SEPARATOR_CHAR:
    3.66 -    case '\0':
    3.67 -      plugindir[j] = '\0';
    3.68 -      collect_plugins(this, plugindir);
    3.69 -      j = 0;
    3.70 -      break;
    3.71 -    case '~':
    3.72 -      if (j == 0){
    3.73 -	strcpy(plugindir, homedir);
    3.74 -	j = strlen(plugindir);
    3.75 -	break;
    3.76 -      }
    3.77 -    default:
    3.78 -      plugindir[j++] = pluginpath[i];
    3.79 +    char *dir;
    3.80 +    int i;
    3.81 +    asprintf (&dir, "%s/.xine/plugins", homedir);
    3.82 +    push_if_dir (plugindirs, dir);
    3.83 +    for (i = 0; i <= XINE_LT_AGE; ++i)
    3.84 +    {
    3.85 +      asprintf (&dir, "%s.%d", XINE_PLUGINROOT, i);
    3.86 +      push_if_dir (plugindirs, dir);
    3.87      }
    3.88    }
    3.89 -  free(plugindir);
    3.90 -  free(pluginpath);
    3.91 +  for (iter = xine_list_front (plugindirs); iter;
    3.92 +       iter = xine_list_next (plugindirs, iter))
    3.93 +  {
    3.94 +    char *dir = xine_list_get_value (plugindirs, iter);
    3.95 +fprintf (stderr, "%s\n", dir);
    3.96 +    collect_plugins(this, dir);
    3.97 +    free (dir);
    3.98 +  }
    3.99 +  xine_list_delete (plugindirs);
   3.100    free(homedir);
   3.101  
   3.102    save_catalog (this);