comparison builder.d @ 29:960b408d3ac5

Builds and runs ok with builder now. Still heaps of cleaning up to do, especially code roughly imported from dog.
author Graham St Jack <graham.stjack@internode.on.net>
date Mon, 03 Aug 2009 23:19:55 +0930
parents 1754cb773d41
children 4a688da41f1a
comparison
equal deleted inserted replaced
28:1754cb773d41 29:960b408d3ac5
42 // Bundles are the mechanism for reusing source code in other repositories. 42 // Bundles are the mechanism for reusing source code in other repositories.
43 // We do this by lines in a bundle "uses" file that specify where to find a used bundle. 43 // We do this by lines in a bundle "uses" file that specify where to find a used bundle.
44 // 44 //
45 // The directory structure within a bundle is: 45 // The directory structure within a bundle is:
46 // 46 //
47 // +--configure Script to set up the build directory and check for assumed system libraries 47 // +--README Introductory information
48 // | 48 // +--configure.d D script to set up a build directory
49 // +--repackage Script to produce a source tarball that can be built with dsss 49 // +--builder.d This file
50 // | 50 // +--options Compiler options
51 // +--uses Specifies which other bundles to use, with paths relative to this bundle 51 // +--uses Specifies which other bundles to use, with paths relative to this bundle
52 // | 52 // |
53 // +--product-name(s) Provides namespace - only contains packages 53 // +--product-name(s) Provides namespace - only contains packages
54 // | 54 // |
55 // +--package-name(s) Can contain library code 55 // +--package-name(s) Can contain library code
503 // an object file is built from its source 503 // an object file is built from its source
504 override void build() { 504 override void build() {
505 writefln("Object %s", mPath); 505 writefln("Object %s", mPath);
506 scope cmd = new StringFormatter; 506 scope cmd = new StringFormatter;
507 507
508 cmd.format("dmd -c @%s", Global.optionsPath); 508 cmd.format("dmd -c");
509 foreach (path; Global.bundlePaths) { 509 foreach (path; Global.bundlePaths) {
510 cmd.format(" -I", path); 510 cmd.format(" -I", path);
511 } 511 }
512 cmd.format(" -od%s -of%s %s", dirname(mPath), basename(mPath), mSource.mPath); 512 cmd.format(" -od%s -of%s %s", dirname(mPath), basename(mPath), mSource.mPath);
513 cmd.format(" @%s", Global.optionsPath);
513 514
514 if (std.process.system(cmd.str)) { 515 if (std.process.system(cmd.str)) {
515 writefln("%s", cmd.str); 516 writefln("%s", cmd.str);
516 error(format("build of %s failed", mPath)); 517 error(format("build of %s failed", mPath));
517 } 518 }
588 // the object needs, transitively 589 // the object needs, transitively
589 override void build() { 590 override void build() {
590 writefln("Program %s", mPath); 591 writefln("Program %s", mPath);
591 scope cmd = new StringFormatter(); 592 scope cmd = new StringFormatter();
592 593
593 cmd.format("dmd -g @%s -L-L%s", Global.optionsPath, join(Global.buildPath, "lib")); 594 cmd.format("dmd -g -L-L%s", join(Global.buildPath, "lib"));
594 cmd.format(" -of%s %s", mPath, mObject.mPath); 595 cmd.format(" -of%s %s", mPath, mObject.mPath);
595 596
596 // add the libraries we need 597 // add the libraries we need
597 LibraryItem[] libs; 598 LibraryItem[] libs;
598 foreach (item; mDepends) { 599 foreach (item; mDepends) {
602 } 603 }
603 } 604 }
604 foreach_reverse (lib; libs) { 605 foreach_reverse (lib; libs) {
605 cmd.format(" -L-l%s", lib.mName); 606 cmd.format(" -L-l%s", lib.mName);
606 } 607 }
608 cmd.format(" @%s", Global.optionsPath);
607 609
608 if (std.process.system(cmd.str)) { 610 if (std.process.system(cmd.str)) {
609 writefln("%s", cmd.str); 611 writefln("%s", cmd.str);
610 error("command failed"); 612 error("command failed");
611 } 613 }