Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support installing library in subdirectory #580

Closed
arteymix opened this issue Jun 4, 2016 · 13 comments
Closed

Support installing library in subdirectory #580

arteymix opened this issue Jun 4, 2016 · 13 comments

Comments

@arteymix
Copy link
Contributor

@arteymix arteymix commented Jun 4, 2016

In some cases (e.g. plugins), it's useful to install shared library in a subdirectory. For instance, libgda install its database providers in /usr/lib64/libgda-5.0/providers.

This is already supported for install_headers, so I suggest that we use the same subdir option.

@nirbheek
Copy link
Member

@nirbheek nirbheek commented Jun 4, 2016

You can do this with install_dir. The path is relative to the prefix option. Something like this would work for your case:

install_dir : '@0@/lib@1@-@2@/providers'.format(get_option('libdir'), name, version)

If you have multiple places where you want to use it, you can store it in a variable and reuse it.

@nirbheek nirbheek closed this Jun 4, 2016
@arteymix
Copy link
Contributor Author

@arteymix arteymix commented Jun 4, 2016

This can work for now, but you should really consider a subdir option to avoid that kind of hack.

@arteymix
Copy link
Contributor Author

@arteymix arteymix commented Jun 4, 2016

I'm happy :) 👍

@nirbheek
Copy link
Member

@nirbheek nirbheek commented Jun 4, 2016

I've added it to the documentation so that people don't have to guess how this works. If we get more bug reports asking for this, we can look into adding this.

@arteymix
Copy link
Contributor Author

@arteymix arteymix commented Jun 4, 2016

Unrelated, but how do you build the path with GModule to refer to library in subfolder like that?

@nirbheek
Copy link
Member

@nirbheek nirbheek commented Jun 4, 2016

I'm not sure I understand the question. g_module_open takes a filename argument (full path), so you can use that. Or you can use g_module_build_path.

@arteymix
Copy link
Contributor Author

@arteymix arteymix commented Jun 4, 2016

The absolute path (eg. /usr/lib64/libgda-5.0/providers has to be hard-coded during the build? This does not look easily feasible in Vala.. :(

@arteymix
Copy link
Contributor Author

@arteymix arteymix commented Jun 4, 2016

Does Meson write the libdir option in a configuration header? And does it support --use-header?

@arteymix
Copy link
Contributor Author

@arteymix arteymix commented Jun 4, 2016

Nevermind, I can always use vala_args for the latter.

@nirbheek
Copy link
Member

@nirbheek nirbheek commented Jun 4, 2016

In GStreamer we use an environment variable GST_PLUGIN_PATH which can contain a list of paths to look for additional plugins. GST_PLUGIN_SYSTEM_PATH is for overriding the 'system' path, so it will ignore plugins in /usr/lib/gstreamer-1.0. See: https://cgit.freedesktop.org/gstreamer/gstreamer/tree/gst/gstregistry.c#n1585

@arteymix
Copy link
Contributor Author

@arteymix arteymix commented Jun 4, 2016

I might introduce an environment variable for the purpose of loading server implementation.

How do you define PLUGINDIR with Meson?

@tp-m
Copy link
Member

@tp-m tp-m commented Jun 4, 2016

@arteymix
Copy link
Contributor Author

@arteymix arteymix commented Jun 4, 2016

@tp-m I was essentially building a config header, but then I saw that one can use relative RPATH, which is considerably more convenient

Thanks! It has been really helpful for valum-framework/valum#182 :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants
You can’t perform that action at this time.