November 28, 2012
On 11/28/2012 01:32 PM, Jacob Carlborg wrote:
> On 2012-11-28 20:23, 1100110 wrote:
>
>> pragma(build, "rdmd -Jviews -Isrc/debug --version=debug");
>
> How would the compiler handle flags which add new import paths? Should
> it first scan all source files after this special pragma(build). Then
> rescan the source files again to see if any new pragma(build) was found.
> Then, yet again, it need to rescan the files for the regular compile phase.
>

I'll obviously need a little help defining the semantics.  =P

I can see this going 3 different ways, with different levels of complexity.

Halt and run this cmd(Gor wants.  I can sense his longing from here..)

November 28, 2012
On 11/28/2012 01:33 PM, Jacob Carlborg wrote:
> On 2012-11-28 17:23, Andrei Alexandrescu wrote:
>
>> I disagree.
>
> Have you looked at the makefile for any of the D projects, how would you
> do that with your comments?
>

If you need something that complex then you need something that complex.


It doesn't change the fact that most of the time, I simply create a shell file that says: rdmd -O -g -gc --version=web main.d

or similar.  Its all I need 99% of the time.
November 28, 2012
On 28 November 2012 16:22, Andrei Alexandrescu <SeeWebsiteForEmail@erdani.org> wrote:
> On 11/28/12 10:43 AM, Gor Gyolchanyan wrote:
>>
>> How about:
>>
>> //! -L-lmylib
>
>
> Sux for multiple lines.
>
> Andrei
>

Wouldn't keeping it on the shebang work?

#!/usr/bin/rdmd -L-lmylib


-- 
Iain Buclaw

*(p < e ? p++ : p) = (c & 0x0f) + '0';
November 28, 2012
On 2012-11-28 21:25, 1100110 wrote:

> Good question.  You could require it to be in the file passed to the
> compiler, which I like.

RDMD will pass all files to the compiler, how would it know which one to look in? Or should RDMD handle the pragma?

> Or you could simply look for pragma(build) at
> the same time you look for imports.  look *once* per file.

That won't work. Example:

module foo;

import bar.baz;

module main;

pragma(build, "-I/usr/local/include/d/barlib/");

If compiler sees the "foo" module first it will fail to find "bar.baz" since it doesn't yet know about the import path added in the "main" module.

> I don't know how the compiler handles the arguments passed internally.
> You know what? Just say it's in the file passed to rdmd.  If you need
> something more complex that a simple place to put the args, you need
> something bigger than what this can give.

Yes, that's what I'm trying to say. Why settle with that when we could support both simple projects with a single source file and more complex ones with many files.

> rdmd main.d
>
> cat main.d
> module main
>
> import std.stdio;
> import std.string;
> static import(file.jpg);//I forget the syntax...
> pragma(build, "-jviews -src -O -release -inline");
> pragma(lib, "ssl");
> pragma(lib, "dl");
> pragma(lib, "event_pthreads");
>
> void main(){} blah blah blah...
> EOF
>
> If that doesn't cover 99% of your use-case, you obviously need something
> way bigger.

How about this use case, building a library. RDMD cannot handle this.

> Tell people to compile using rdmd main.d.  If args are passed on the
> cmdline, then don't even bother looking for pragma(build).


-- 
/Jacob Carlborg
November 28, 2012
On 2012-11-28 21:29, 1100110 wrote:

> I'll obviously need a little help defining the semantics.  =P
>
> I can see this going 3 different ways, with different levels of complexity.
>
> Halt and run this cmd(Gor wants.  I can sense his longing from here..)

If you put the flags on the command line or in a separate file then you won't have this problems.

-- 
/Jacob Carlborg
November 28, 2012
On 2012-11-28 21:32, 1100110 wrote:

> If you need something that complex then you need something that complex.
>
>
> It doesn't change the fact that most of the time, I simply create a
> shell file that says: rdmd -O -g -gc --version=web main.d
>
> or similar.  Its all I need 99% of the time.

It also doesn't change the fact that these uses cases can be supported by the same tool. Just try to think about it a bit not just rushing on with the first idea that pops up.

-- 
/Jacob Carlborg
November 28, 2012
On 11/28/2012 02:52 PM, Iain Buclaw wrote:
> On 28 November 2012 16:22, Andrei Alexandrescu
> <SeeWebsiteForEmail@erdani.org>  wrote:
>> On 11/28/12 10:43 AM, Gor Gyolchanyan wrote:
>>>
>>> How about:
>>>
>>> //! -L-lmylib
>>
>>
>> Sux for multiple lines.
>>
>> Andrei
>>
>
> Wouldn't keeping it on the shebang work?
>
> #!/usr/bin/rdmd -L-lmylib
>
>

Yeah and so would pragma(lib).  But only for that specific case.  =P shebang only takes one (1) argument.
November 28, 2012
On 11/28/2012 03:11 PM, Jacob Carlborg wrote:
> On 2012-11-28 21:32, 1100110 wrote:
>
>> If you need something that complex then you need something that complex.
>>
>>
>> It doesn't change the fact that most of the time, I simply create a
>> shell file that says: rdmd -O -g -gc --version=web main.d
>>
>> or similar. Its all I need 99% of the time.
>
> It also doesn't change the fact that these uses cases can be supported
> by the same tool. Just try to think about it a bit not just rushing on
> with the first idea that pops up.
>

Of course.  I just can't remember the last time I needed something more complex than a shell script.  It would be *really* nice if the syntax were nice and simple.  Makefiles kick my @$$.  Implicit rules, and all that.

I would prefer stupidly simple to "Dang it stop calling gcc.  Where are you even getting the idea that I need gcc, much less want it.(yes gcc is linker, but it was trying to compile D files as C files.)"
November 29, 2012
On 2012-11-28 22:24, 1100110 wrote:

> Of course.  I just can't remember the last time I needed something more
> complex than a shell script.  It would be *really* nice if the syntax
> were nice and simple.  Makefiles kick my @$$.  Implicit rules, and all
> that.

I'm just trying to stop you guys from investing in a new build system that cannot be used for the whole community.

In most cases I also just need a shell script containing some compile/link flags. But what I don't like is that I need to duplicate the shell script, one version for Posix and one version for Windows. That's why I'm advocating for using build scripts written in a full blow language that already exists and works cross platform.

I do also manage DWT which requires a bit more complex build system then a simple shell script with some compile flags.

Also, I can't for my life understand why the compiler can't have flags for handling common linking flags, like adding a library or a search path for libraries. That should of course be platform independent. If the compiler won't do that I'll add that to my build tool.

-- 
/Jacob Carlborg
November 29, 2012
On 11/29/12 2:36 AM, Jacob Carlborg wrote:
> On 2012-11-28 22:24, 1100110 wrote:
>
>> Of course. I just can't remember the last time I needed something more
>> complex than a shell script. It would be *really* nice if the syntax
>> were nice and simple. Makefiles kick my @$$. Implicit rules, and all
>> that.
>
> I'm just trying to stop you guys from investing in a new build system
> that cannot be used for the whole community.
>
> In most cases I also just need a shell script containing some
> compile/link flags. But what I don't like is that I need to duplicate
> the shell script, one version for Posix and one version for Windows.
> That's why I'm advocating for using build scripts written in a full blow
> language that already exists and works cross platform.

Why not use D for that full-blown language? I know you insist on using Ruby, and I fail to grasp why we'd have D users learn Ruby in addition to D, when D is presumably already installed (since this is all about building D programs!) and D is as convenient for build scripting as Ruby.

Andrei