Base Directory Specification and plugins

David Faure faure at kde.org
Thu Dec 15 02:55:21 PST 2011


On Sunday 11 December 2011 15:16:32 Yury G.  Kudryashov wrote:
> XDG_PLUGIN_DIRS: either /usr/lib${LIB_SUFFIX} or
> /usr/lib${LIB_SUFFIX}/plugins - what do you prefer?

Definitely the second one.

Otherwise people tend to confuse shared libs and plugins, and start linking to 
plugins, and this creates trouble (it's not portable, it mixes concepts, etc.)

> If we choose /usr/lib${LIB_SUFFIX}/plugins, it is easier to find all your
> plugins.
> 
> The text below is written for the /usr/lib${LIB_SUFFIX} case but it is easy
> to add "/plugins" to appropriate places.
> 
> XDG_PLUGIN_HOME: ~/.local/lib${LIB_SUFFIX} (or
> ~/.local/lib${LIB_SUFFIX}/plugins)

Yep. This might have to be adjusted for multi-arch setups, where shared libs 
are already getting installed into /usr/lib/{TUPLE}/, for instance 
/usr/lib/i386-linux-gnu/.
In that case plugins would go into /usr/lib/i386-linux-gnu/plugins.

Anyway, this could be seen as a special case of your definition, where 
LIB_SUFFIX is set to /i386-linux-gnu :-)

> Plugins should be installed to
> ${INSTALL_PREFIX}/lib${LIB_SUFFIX}${LIBRARY_SPECIFIC_SUFFIX}. ${LIB_SUFFIX}
> should be chosen in the same way that is used for shared libraries.
> 
> Buildsystem of a plugin-enabled library/application should (must?) allow
> distributions to override LIB_SUFFIX and may allow override of
> LIBRARY_SPECEFIC_SUFIX. 

Overriding the library suffix? If you install a plugin for qt, it has to go into 
/usr/lib/plugins/qt, if that's where all your qt plugins go. If a single 
plugin is compiled with an overriden library suffix of "foobar", then your 
plugin /usr/lib/plugins/foobar will feel quite alone and ignored :)

> This is important because different distros may
> prefer different ABI-specific LIB_SUFFIX'es.

Yes.

> Both LIB_SUFFIX ad LIBRARY_SPECIFIC_SUFFIX must be advertised through
> installed development files (e.g., mylib.pc or MyLibConfig.cmake).

Yes (well, or just the full path where to install plugins?)

> Buildsystem of a plugin should install plugins into
> ${prefix}/lib${LIB_SUFFIX}/${LIBRARY_SPECIFIC_SUFFIX}, where ${prefix} is
> the plugin's installation prefix (not the prefix of the original
> library/application), LIB_SUFFIX and LIBRARY_SPECIFIC_SUFFIX are taken from
> mylib.pc or MyLibConfig.cmake. If the installation prefix of the plugin
> differs from the installation prefix of the original library/application,
> plugin may (should?) tell user to adjust XDG_PLUGIN_DIRS.

Yes. May. It's not like installing a lib into /opt/foo/lib currently tells 
anyone to set LD_LIBRARY_PATH. The way to document setup should be left to 
individual implementations.

-- 
David Faure, faure at kde.org, http://www.davidfaure.fr
Sponsored by Nokia to work on KDE, incl. KDE Frameworks 5



More information about the xdg mailing list