Two Formulas: one installs into the filesystem tree of another


(Ryan S Elliott) #1

Hello,

I would like to create two Formulas for a “plugin library”. One formula installs the library that other programs would use to access various plugins, and the other formula installs a set of multiple plugins.

Let’s call the library ‘foo’, and the second Formula ‘bar’. Then fooinstalls a filesystem tree of (in part):

/lib/libfoo.so
/lib/foo/plugins
/lib/foo/plugins/example-plugin-1/libplugin.so
/lib/foo/plugins/example-plugin-2/libplugin.so

Then the bar formula would install a filesystem tree like:

/lib/foo/plugins/real-plugin-1/libplugin.so
/lib/foo/plugins/real-plugin-2/libplugin.so
/lib/foo/plugins/real-plugin-3/libplugin.so

The problem is that bar cannot write to the foo prefix and foo will not find the bar files if it uses its own prefix. I suppose bar could make sym-links inside the bar plugins directory. Is that possible? Is there a better way to do this with homebrew?

Thanks,

Ryan


(Steve Peters) #2

Assuming the formulae aren’t keg-only, they would each install to their own Cellar prefix and then sym-link into /usr/local. Once they are sym-linked, it should look like the pattern that you suggest inside /usr/local.


(Ryan S Elliott) #3

Thanks for the reply. However, it doesn’t seem to work as you suggest. The sym-links are not deep enough. Each package has a /usr/local/lib/foo/plugins subdirectory. Homebrew will try to sym-link /usr/local/lib/foo for each and fail. I would need homebrew to create the sym-links at least at the /usr/local/foo/plugins/ level.


(Steve Peters) #4

Can you post instructions for reproducing the error?


(Ryan S Elliott) #5

Thanks! When I created a minimal example to illustrate the situation, I discovered that I was wrong. The error was coming from an unrelated issue.

Now I see that homebrew handles the situation I described just fine. This was very helpful. Thanks for the interaction.

Ryan


(Steve Peters) #6

I’m glad you figured it out!