Support compiling modules

Bug #1162727 reported by Adam Dingle
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Bake
Triaged
Medium
Unassigned

Bug Description

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.

Revision history for this message
Adam Dingle (adam-yorba) wrote :

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.

Revision history for this message
Robert Ancell (robert-ancell) wrote :

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.

summary: - support installing .so without .pc/.h/.vapi
+ Support compiling modules
Changed in bake:
status: New → Triaged
importance: Undecided → Medium
Revision history for this message
Adam Dingle (adam-yorba) wrote :

That sounds fine to me.

Revision history for this message
Robert Ancell (robert-ancell) wrote :

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)
}

Revision history for this message
Robert Ancell (robert-ancell) wrote :

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

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.