views:

153

answers:

5

I am currently developing/hacking an image analyzing/transforming tool. The filters therein will be loaded at runtime using dlopen&co.

My question is where do *nix tools usually put plugins (*.so files) when installed?

bin/program
lib/program/plugins/thisandthat.so

maybe?

Secondly how do I use it and where do I put it during development without installing it. (this is probably the tricky part)

I want to avoid shell-scripts if possible.

thanks in regard Ronny

+5  A: 

Usually /usr/lib/programmname should be a good spot

During development I'd create a command line paramter to specify the plugin search path and just leave the plugins in the build-dir for example.

tliff
it's sad that I cannot accept two answers ~~. sorry
Ronny
+1  A: 

The layout seems sensible. You can, for instance, look in current directory, look up environment variable or command line switch during development. It depends on the details of your development environment and workflow.

Michael Krelin - hacker
+3  A: 

Consider:

/usr/lib/program/*.so
Andrejs Cainikovs
+2  A: 

Do not forget:

$HOME/.program/
ebo
+3  A: 

A good guide for choosing is Filesystem Hierarchy Standard. Most Linux distribuitions use this standard.

Here is a very short summary.

Place application binary in: /usr/bin/progname, /usr/local/bin/progname or /opt/progname

Place plugins or library files in: /usr/lib/progname, /usr/local/lib/progname or /opt/progname/lib

Place host configuration for the application in: /etc/progname or /etc/opt/progname

Place user configuration in: $HOME/.progname

Place application manual page in: /usr/shar/man/man1/

There is separate hierachy for /var. As an example use /var/log/progname for logging.

In responce to caf's comment. I find it very usefull to choose target directory at compile time. Using a $PREFIX also makes it easy to separate devellopment build's from shippment. Most use /usr/progname, /usr/lib/progname and /etc/progname

Tobias
so really `$PREFIX/lib/program/`, where `PREFIX` might be `/usr`, `/usr/local`, `/opt` or even `/home/foo`.
caf
I would only use /opt for library files if the entire application is installed in /opt.I use $HOME/.program/ for user specific configuration. The similar to how ssh use $HOME/.ssh
Tobias
Sorry, I wasn't very clear - typically `PREFIX` would be set at build time, so yes the entire app would be installed in various locations under it, like `$PREFIX/bin/` and `$PREFIX/share/doc/`.
caf
Found the edit button. I hope the new text is clearer.
Tobias
+1, I have been looking for a guide like that for a long time!
SteveL