comparison configure.d @ 123:0d427170a805

Move to 64-bit
author David Bryant <bagnose@gmail.com>
date Wed, 04 May 2011 22:19:44 +0930
parents 6c3993f4c3eb
children 1da160a2c373
comparison
equal deleted inserted replaced
122:403c34305a39 123:0d427170a805
44 string targetPath = args[1]; 44 string targetPath = args[1];
45 45
46 // check that source_path looks like a source tree by making sure 46 // check that source_path looks like a source tree by making sure
47 // that a README and options file are present 47 // that a README and options file are present
48 writefln("Examining source"); 48 writefln("Examining source");
49 if (!sourcePath.join("README").exists || !sourcePath.join("options").exists) { 49 if (!std.path.join(sourcePath, "README").exists || !std.path.join(sourcePath, "options").exists) {
50 writefln("Error - current directory must contain README and options"); 50 writefln("Error - current directory must contain README and options");
51 return -1; 51 return -1;
52 } 52 }
53 53
54 // ensure that target_path exists 54 // ensure that target_path exists
56 if (targetPath.exists) { 56 if (targetPath.exists) {
57 writefln("Error - %s exists - abandoning configure", targetPath); 57 writefln("Error - %s exists - abandoning configure", targetPath);
58 return -1; 58 return -1;
59 } 59 }
60 targetPath.mkdirRecurse; 60 targetPath.mkdirRecurse;
61 string binPath = targetPath.join("bin"); 61 string binPath = std.path.join(targetPath, "bin");
62 binPath.mkdir; 62 binPath.mkdir;
63 63
64 // compile builder into bin_path 64 // compile builder into bin_path
65 writefln("Building the builder"); 65 writefln("Building the builder");
66 int ret = system(format("dmd -w -wi %s -O -of%s", 66 int ret = system(format("dmd -m64 -w -wi %s -O -of%s",
67 sourcePath.join("builder.d"), binPath.join("builder"))); 67 std.path.join(sourcePath, "builder.d"), std.path.join(binPath, "builder")));
68 if (ret) { 68 if (ret) {
69 writefln("Error - builder failed to compile"); 69 writefln("Error - builder failed to compile");
70 return -1; 70 return -1;
71 } 71 }
72 binPath.join("builder.o").remove; 72 std.path.join(binPath, "builder.o").remove;
73 73
74 // set up scripts 74 // set up scripts
75 { 75 {
76 auto file = File(targetPath.join("build"), "w"); 76 auto file = File(std.path.join(targetPath, "build"), "w");
77 file.writefln("#!/bin/bash"); 77 file.writefln("#!/bin/bash");
78 file.writefln("%s %s %s", binPath.join("builder"), sourcePath, targetPath); 78 file.writefln("%s %s %s", std.path.join(binPath, "builder"), sourcePath, targetPath);
79 } 79 }
80 system("chmod +x " ~ targetPath.join("build")); 80 system("chmod +x " ~ std.path.join(targetPath, "build"));
81 writefln("All done"); 81 writefln("All done");
82 82
83 return 0; 83 return 0;
84 } 84 }