shebang launcher for D programs

Andrei Alexandrescu (See Website For Email) SeeWebsiteForEmail at erdani.org
Wed Mar 21 13:00:22 PDT 2007


Anders F Björklund wrote:
> Andrei Alexandrescu (See Website For Email) wrote:
> 
>>> Rebuild has a similar feature (-exec), but it's a program not a script.
>>> I think build/bud also did, but I had problems with it and GDC/Tango...
>>
>> Sounds great. Where is rebuild? (Bud aka build is easy to find on 
>> dsource.org).
> 
> It's part of the DSSS project: (the "D Shared Software System")
> http://www.dsource.org/projects/dsss/wiki/Rebuild
> 
> I did a RPM package and manpage for it, will post them* on gdcgnu
> as part of the requirements for using Tango instead of Phobos...
> 
> --anders
> 
> * See http://www.algonet.se/~afb/d/rebuild.spec for a preview

I gave rebuild's dox a quick read, and it looks like it's almost there. 
Just in case you don't have enough work on your plate, here are two 
suggestions:

1. I'm not sure whether rebuild caches dependency information (it 
should, and the dox should emphatically reflect that).

2. rebuild should come with a companion program "launch" or something, 
which does not need any flags to compile a program - just takes the main 
program in argv[1], builds it, and launches it pasing to it argv[2 .. 
$]. This is necessary for the shebang syntax:

#!/usr/bin/env launch
... D code ...

On some platforms, env can't handle multiple words, e.g. this will not work:

#!/usr/bin/env launch -someflag
... D code ...

So launch needs to make-do flag-free. More about shebang at 
http://en.wikipedia.org/wiki/Shebang_(Unix).

Bottom line: rebuild is very close to the above, and implementing that 
will add much value for little effort.


Andrei



More information about the Digitalmars-d mailing list