Re: Vala support for automake

2009-04-16 Thread Ralf Wildenhues
Hi Jürg,

* Jürg Billeter wrote on Wed, Apr 15, 2009 at 08:56:44PM CEST:
 On Wed, 2009-04-15 at 20:42 +0200, Ralf Wildenhues wrote:
  I'm looking at adding per-target flag support for vala sources.
  
  Say I have baz.vala and want to create from that
foo-baz.c foo-baz.h
  
  in one valac invocation, as well as
bar-baz.c bar-baz.h
  
  in another 'valac -D BAR' invocation.  Is there some flag I can pass to
  valac that will use these output names for me?  If yes, does it do so
  without generating intermediate baz.c baz.h files or any other temporary
  files that have a name  which would conflict with parallel make -jN
  execution?
 
 valac does not currently support any transformation on the output names
 of the .c files. It's not as easy as a simple -o option because you have
 multiple input and output files per invocation in general (see below).

Ah.  Good to know.

 If you think it would make sense to add a --suffix option or similar to
 valac, I could certainly take a look at it.

I think a --prefix option should do the trick, but I haven't thought
this through yet.

  Also, I see that your vala compile passes all sources to valac.  Is that
  intentional (or just because that was good enough)?  I.e., if you have
bin_PROGRAMS = foo
foo_SOURCES = a.c b.vala c.l d.java e.vala
  
  do you really want to invoke
valac -C a.c b.vala c.l d.java e.vala
 
 That was not intentional. valac won't mind unnecessary .c files but will
 reject files with other extensions.

Ah; that looks like a bug we should fix and test.

  rather than
valac -C b.vala e.vala
 
 This would be the correct commandline.

OK.

  or even
valac -C b.vala
valac -C e.vala
 
 This would not work, valac requires all Vala source files of the same
 program / library on the same commandline. The reason is that the source
 files can depend on each other, but there is no header/include
 mechanism.

Hmm.  What if I do something like this:

bin_PROGRAMS = foo
foo_SOURCES = foo1.vala foo2.vala
foo_LDADD = libbar.a
noinst_LIBRARIES = libbar.a
libbar_a_SOURCES = bar1.vala bar2.vala

How would valac cope with the necessarily separate invocations for
foo*.vala and bar*.vala?  And what happens if you try to put vala
code into shared libraries, and use them from other vala code?

Thanks,
Ralf




Re: Vala support for automake

2009-04-16 Thread Jürg Billeter
Hi Ralf,

On Thu, 2009-04-16 at 20:49 +0200, Ralf Wildenhues wrote:
 * Jürg Billeter wrote on Wed, Apr 15, 2009 at 08:56:44PM CEST:
  On Wed, 2009-04-15 at 20:42 +0200, Ralf Wildenhues wrote:
   or even
 valac -C b.vala
 valac -C e.vala
  
  This would not work, valac requires all Vala source files of the same
  program / library on the same commandline. The reason is that the source
  files can depend on each other, but there is no header/include
  mechanism.
 
 Hmm.  What if I do something like this:
 
 bin_PROGRAMS = foo
 foo_SOURCES = foo1.vala foo2.vala
 foo_LDADD = libbar.a
 noinst_LIBRARIES = libbar.a
 libbar_a_SOURCES = bar1.vala bar2.vala
 
 How would valac cope with the necessarily separate invocations for
 foo*.vala and bar*.vala?  And what happens if you try to put vala
 code into shared libraries, and use them from other vala code?

In this case you instruct valac to generate a bar.vapi and a bar.h file
and use those files in the program by specifying

libbar_a_VALAFLAGS = --library bar -H bar.h
foo_VALAFLAGS = bar.vapi

A .vapi file contains declarations for Vala libraries, similar to a .h
file for C libraries.

Thanks,
Jürg








Re: Vala support for automake

2009-04-16 Thread Ralf Wildenhues
* Jürg Billeter wrote on Thu, Apr 16, 2009 at 09:02:30PM CEST:
 On Thu, 2009-04-16 at 20:49 +0200, Ralf Wildenhues wrote:
  bin_PROGRAMS = foo
  foo_SOURCES = foo1.vala foo2.vala
  foo_LDADD = libbar.a
  noinst_LIBRARIES = libbar.a
  libbar_a_SOURCES = bar1.vala bar2.vala
  
  How would valac cope with the necessarily separate invocations for
  foo*.vala and bar*.vala?  And what happens if you try to put vala
  code into shared libraries, and use them from other vala code?
 
 In this case you instruct valac to generate a bar.vapi and a bar.h file
 and use those files in the program by specifying
 
 libbar_a_VALAFLAGS = --library bar -H bar.h
 foo_VALAFLAGS = bar.vapi
 
 A .vapi file contains declarations for Vala libraries, similar to a .h
 file for C libraries.

How is the semantic relationship between the .vapi name and its library?
  s/^lib//; s/\.a$//; s/$/.vapi/?

What about shared libraries, do they have .vapi's, too?

What if I want to build one big shared (or static) library from a set of
convenience archives (uninstalled .a libraries with PIC code)?  Do you
have means to generate a .vapi for the big library from the .vapi's of
the several small ones (plus maybe a couple of loose objects, too)?

Just trying to find out how far we can push it.

Thanks,
Ralf