Re: GtkD: Build script

2017-08-20 Thread Johnson Jones via Digitalmars-d-learn

On Sunday, 20 August 2017 at 20:13:17 UTC, Mike Wey wrote:

On 20-08-17 20:41, Johnson Jones wrote:

I guess I see why now you did what you did! ;)

.LIB pagesize exceeds 512

https://issues.dlang.org/show_bug.cgi?id=15418

Wanna take bets on how many *years* this takes to get fixed?!?


That one happens when GtkD is build with debug symbols.

The main library is build by package because optlink or omf 
doesn't support more that 32767 symbols in one object file, and 
i hit that limit.


;/

After all, who will ever need more than 32767 symbols?

Is this a problem with the linker or the object format? Maybe 
both oplink and dmd could be upgraded to use an extended omf 
format that allows more symbols?


Re: GtkD: Build script

2017-08-20 Thread Mike Wey via Digitalmars-d-learn

On 20-08-17 20:41, Johnson Jones wrote:

I guess I see why now you did what you did! ;)

.LIB pagesize exceeds 512

https://issues.dlang.org/show_bug.cgi?id=15418

Wanna take bets on how many *years* this takes to get fixed?!?


That one happens when GtkD is build with debug symbols.

The main library is build by package because optlink or omf doesn't 
support more that 32767 symbols in one object file, and i hit that limit.


--
Mike Wey


Re: GtkD: Build script

2017-08-20 Thread Johnson Jones via Digitalmars-d-learn

I guess I see why now you did what you did! ;)

.LIB pagesize exceeds 512

https://issues.dlang.org/show_bug.cgi?id=15418

Wanna take bets on how many *years* this takes to get fixed?!?


GtkD: Build script

2017-08-20 Thread Johnson Jones via Digitalmars-d-learn

I've modified the build script:

changed 2 things: 1. Builds for all archs. 2. Replaced the 
specialized x86 build with the generic used for 64-bit. You were 
building for each individual directory for some reason, I guess 
for more granularity, but it produced a different result than the 
64 build because it left out the root gtk dir, when I put some 
package files in to help make it easier to deal with all the 
modules.


It might be better to put the libs in their own unique 
directories. I was just tired of having to build for each version 
so I simplified it. Probably could use some output mentioning 
what is going on, although it works well, so maybe not.


I assume for 2 you just did that for more control? The lib file 
was quite a bit larger(I think it went from 30 megs to 50 or 
something).



Maybe a script such as this could be added and called buildAll.

module Build;

import core.stdc.stdlib: exit;

import std.algorithm;
import std.array;
import std.file;
import std.getopt;
import std.path;
import std.process;
import std.stdio;
import std.string;

string dcflags;
string ldflags;


int main(string[] args)
{
version(Posix)
{
writeln("This build script is currently Windows only.");
return(1);
}

getopt(args, "dcflags", , "ldflags", );
args.popFront();

foreach ( arg; args )
{
		if ( !["gtkd", "gtkdgl", "sv", "gstreamer", "vte", "peas", 
"all"].canFind(arg) )

{
writefln("Unknown option: %s", arg);
return 1;
}
}

if ( args.length == 0 )
args = ["gtkd", "sv"];

if ( args.canFind("all") )
args = ["gtkd", "sv", "gstreamer", "peas"];

foreach ( arg; args )
{
switch ( arg )
{
case "gtkd":  
build("generated\\gtkd", "gtkd");
break;
case "gtkdgl":
build("generated\\gtkdgl", "gtkdgl");
break;
case "sv":
build("generated\\sourceview", "gtkdsv");
break;
case "gstreamer":
build("generated\\gstreamer", "gstreamerd");
break;
case "peas":
build("generated\\peas", "peasd");
break;
default:
assert(false);
break;
}
}

return(0);
}

void build(string dir, string lib)
{
import std.algorithm;
foreach(i; [0,1,2])
switch(i)
{
// 64bit
case 1: 
			std.file.write("build.rf", format("-m64 -c -lib %s %s 
-Igenerated/gtkd -of%sx64.lib %s ", dcflags, ldflags, lib, 
dFiles(dir)));

auto pid = spawnProcess(["dmd", "@build.rf"]);
if ( wait(pid) != 0 ) exit(1);
break;
default: goto case 0;
case 0:
			std.file.write("build.rf", format("-m32 -c -lib %s %s 
-Igenerated/gtkd -of%sx86.lib %s ", dcflags, ldflags, lib, 
dFiles(dir)));

auto pid = spawnProcess(["dmd", "@build.rf"]);
if ( wait(pid) != 0 ) exit(1);

break;  
case 2:
			std.file.write("build.rf", format("-m32mscoff -c -lib %s %s 
-Igenerated/gtkd -of%sx86coff.lib %s", dcflags, ldflags, lib, 
dFiles(dir)));

auto pid = spawnProcess(["dmd", "@build.rf"]);
if ( wait(pid) != 0 ) exit(1);  
break;
}

std.file.remove("build.rf");
}

string dFiles(string sourceDir)
{
string files;
auto entries = dirEntries(sourceDir, SpanMode.breadth);

foreach ( DirEntry entry; entries )
{
if ( entry.isDir == false && entry.name.extension == ".d" )
{
files ~= entry.name ~ " ";
}
}

return files;
}