desiderantes / stew

Simple buid system for the 21st century
GNU General Public License v3.0
2 stars 0 forks source link

Support compiling modules #11

Open desiderantes opened 7 years ago

desiderantes commented 7 years ago

When building a shared library in Vala, bake installs several files:

$ sudo bake install MKDIR /usr/lib CP libtest.so /usr/lib/libtest.so CP libtest.so.0 /usr/lib/libtest.so.0 MKDIR /usr/lib/pkgconfig CP test-0.pc /usr/lib/pkgconfig/test-0.pc MKDIR /usr/include/test-0 CP test.h /usr/include/test-0/test.h MKDIR /usr/share/vala/vapi CP test-0.vapi /usr/share/vala/vapi/test-0.vapi [Build complete] $

I don't always want all of these. For example, if I'm building a plugin for Nautilus or gedit I just want a .so file to be copied to /usr/lib/nautilus/extensions-3.0 or /usr/lib/gedit/plugins. Since the .so is a plugin it will always be loaded dynamically, so there's no need for the .pc, .h or .vapi files, or even for the .so.0 file. So it would be nice to have a variable setting to exclude these.

Launchpad Details: #LP1162727 Adam Dingle - 2013-04-01 09:37:16 +0000

desiderantes commented 7 years ago

I realized I can work around this limitation like this:

=== project.name = test project.version = 0.0.1

libraries.test { sources = test.vala install = false }

data.test { files = libtest.so install-directory = /usr/local/foo }

That's fine for now. It still might be nice to have a variable I could specify in libraries.test above to achieve the same without having to play this trick.

Launchpad Details: #LPC Adam Dingle - 2013-04-01 09:43:04 +0000

desiderantes commented 7 years ago

My thoughts here are there should be a new type of compiled object - "modules". Modules are different to libraries so you'd specify:

modules.test { sources = test.vala install-directory = /usr/local/foo }

Modules would not be installed by default and would not have symlinks / metadata.

Launchpad Details: #LPC Robert Ancell - 2013-04-01 19:44:32 +0000

desiderantes commented 7 years ago

That sounds fine to me.

Launchpad Details: #LPC Adam Dingle - 2013-04-01 20:14:50 +0000

desiderantes commented 7 years ago

I think this should be possible with Bake at least 0.1.44 since I backed off a lot of the automatic files that were generated. The main issue with libraries is both static and dynamic forms are generated and installed (bug 1335022).

project { name = test }

options { module-directory { description = Place to install the modules default = $(options.library-directory)/test-modules } }

libraries.testmodule { sources = testmodule.c install-directory = $(options.module-directory) }

Launchpad Details: #LPC Robert Ancell - 2014-06-27 09:02:45 +0000

desiderantes commented 7 years ago

I think it would also be useful to make some pages in the documentation about common project types that show this sort of recipe.

Launchpad Details: #LPC Robert Ancell - 2014-06-27 09:03:21 +0000