Tup doesn't have many string manipulating functions, so there isn't a
way to do it just in the Tupfile. However, you can use a wildcard for
the VAPISFILES variable rather than listing each explicitly. For the
VAPISPARAMS it is a little trickier. One thing I tried is to generate
a list of .vapi files in the windows directory, and then use a shell
script to generate the --use-fast-vapi flags when the main valac is
executed. I don't know how this will scale up to a larger project, or
one with more intricate dependencies, but maybe it will give you some
ideas to try. Feel free to write back if you run into other issues.
(See attached patch for your git repo)
-Mike
Sounds inefficient to me as well. Maybe the projects are small enough
that people don't care about doing a find & re-parsing *.vala?
-Mike
I applied this patch to valatup in order to wild-card object files:
diff --git a/src/Tupfile b/src/Tupfile
index aea95d2..57c13b7 100644
--- a/src/Tupfile
+++ b/src/Tupfile
@@ -15,4 +15,4 @@ VAPISPARAMS += `./gen_vapisparams.sh windows/vapilist.txt`
: foreach *.c |> !ccobj |>
# Now that all the .o files should be generated, build object file.
-: main.o windows/sync_sample_1.o windows/sync_sample_2.o |> !ccbin |> main
+: main.o windows/*.o |> !ccbin |> main
Then I was able to do the following:
$ mv sync_sample_1.vala new_sync_sample_1.vala
$ tup upd
And get a correctly built executable. (If you don't apply the patch
above, tup just reports an error because the Tupfile now refers to an
old object file, so you have to edit that to continue).
In the valaninja repo I tried the same thing:
$ mv sync_sample_1.vala new_sync_sample_1.vala
$ ninja
ninja: ERROR: 'src/windows/sync_sample_1.vala', needed by
'_obj/src/windows/sync_sample_1.vapi', missing and no known rule to
make it
So instead to get it to work I had to re-generate the vala.ninja file:
$ ./build/configure > build/vala.ninja && ninja
But if I always re-generate the vala.ninja file then it will
needlessly rebuild parts of the project (which seems like different
parts every time?). The difference here is you have to remember to run
an arbitrary command to try to get things working. In tup you just
have to edit files (Tupfiles, source files, etc) and the only command
to run is 'tup upd'.
So for me it is not so useful because it breaks my 3rd rule of build
systems -- the user must only have one way of building the project
(ie: "tup upd" or "ninja" in this case). Are there other ways to write
the ninja file so that it does the configure step automatically when
it needs to? Of course maybe you don't care about my rules, so if it
works for you then have fun with it. It would just drive me crazy :)
-Mike