Changeset 592
- Timestamp:
- 05/09/07 04:08:42 (1 year ago)
- Files:
-
- branches/tango/sss/build.d (modified) (22 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
branches/tango/sss/build.d
r589 r592 29 29 module sss.build; 30 30 31 import std.file; 32 import std.process; 33 import std.stdio; 34 import std.string; 35 36 import std.c.stdlib; 31 import tango.io.Console; 32 import tango.io.File; 33 import tango.io.FileConst; 34 import tango.io.FilePath; 35 import tango.io.FileSystem; 36 37 import tango.text.Ascii; 38 import tango.text.Util; 37 39 38 40 import hcf.path; … … 83 85 84 86 if (type == "library" && libsSafe()) { 85 writefln("Creating imports for %s", target);87 Cout("Creating imports for ")(target).newline; 86 88 87 89 // do the predigen … … 95 97 // generate .di files 96 98 foreach (file; srcFiles) { 97 char[] ifile = "dsss_imports" ~ std.path.sep~ file ~ "i";98 if (! exists(ifile) ||99 char[] ifile = "dsss_imports" ~ FileConst.PathSeparatorChar ~ file ~ "i"; 100 if (!(new FilePath(ifile)).exists() || 99 101 fileNewer(file, ifile)) { 100 102 /* BIG FAT NOTE slash FIXME: … … 106 108 107 109 // usname = name_with_underscores 108 char[] usname = replace(build, std.path.sep, "_"); 110 char[] usname = replace(build.dup, FileConst.PathSeparatorChar, '_'); 111 112 File iff = new File(ifile); 109 113 110 114 if (shLibSupport() && 111 115 ("shared" in settings)) { 112 std.file.write(ifile, std.file.read(file) ~ `116 iff.write(iff.read() ~ ` 113 117 version (build) { 114 118 version (DSSS_Static_` ~ usname ~ `) { … … 120 124 `); 121 125 } else { 122 std.file.write(ifile, std.file.read(file) ~ `126 iff.write(iff.read() ~ ` 123 127 version (build) { 124 128 pragma(link, "S` ~ target ~ `"); … … 134 138 } 135 139 136 writefln("");140 Cout.newline; 137 141 138 142 } … … 156 160 char[] shlibflag = getShLibFlag(settings); 157 161 158 if ( exists(shlibname)) continue;159 160 writefln("Building stub shared library for %s", target);162 if ((new FilePath(shlibname)).exists()) continue; 163 164 Cout("Building stub shared library for ")(target).newline; 161 165 162 166 // make the stub … … 174 178 } 175 179 176 writefln("");180 Cout.newline; 177 181 } 178 182 } … … 188 192 189 193 if (type == "library" || type == "sourcelibrary") { 190 char[] dotname = std.string.replace(build, std.path.sep, ".");194 char[] dotname = tango.text.Util.replace(build.dup, FileConst.PathSeparatorChar, '.'); 191 195 192 196 // get the list of files … … 202 206 203 207 // output what we're building 204 writefln("%s => %s", build, target);208 Cout(build)(" => ")(target).newline; 205 209 206 210 // prepare for documentation 207 211 char[] docbl = ""; 208 212 if (doDocs) { 209 char[] docdir = "dsss_docs" ~ std.path.sep~ build;213 char[] docdir = "dsss_docs" ~ FileConst.PathSeparatorChar ~ build; 210 214 mkdirP(docdir); 211 215 docbl ~= "-Dq" ~ docdir ~ " -candydoc "; 212 216 213 217 // now extract candydoc there 214 char[] origcwd = getcwd();215 chdir(docdir);218 char[] origcwd = FileSystem.getDirectory(); 219 FileSystem.setDirectory(docdir); 216 220 217 221 version (Windows) { … … 221 225 } 222 226 223 chdir(origcwd);227 FileSystem.setDirectory(origcwd); 224 228 } 225 229 … … 230 234 231 235 // get the file list 232 char[] fileList = std.string.join(targetToFiles(build, conf), " ");236 char[] fileList = tango.text.Util.join(targetToFiles(build, conf), " "); 233 237 234 238 // if we should, build the library … … 238 242 if (targetGNUOrPosix()) { 239 243 // first do a static library 240 if (exists("libS" ~ target ~ ".a")) std.file.remove("libS" ~ target ~ ".a"); 244 if ((new FilePath("libS" ~ target ~ ".a")).exists()) 245 (new FilePath("libS" ~ target ~ ".a")).remove(); 246 241 247 char[] stbl = bl ~ docbl ~ bflags ~ " -explicit -lib -full " ~ fileList ~ " -oflibS" ~ target ~ ".a"; 242 248 saySystemRDie(stbl, "-rf", "temp.rf"); … … 245 251 ("shared" in settings)) { 246 252 // then make the shared library 247 if (exists(shlibname)) std.file.remove(shlibname); 253 if ((new FilePath(shlibname)).exists()) 254 (new FilePath(shlibname)).remove(); 255 248 256 char[] shbl = bl ~ bflags ~ " -fPIC -explicit -shlib -full " ~ fileList ~ " -of" ~ shlibname ~ 249 257 " " ~ shlibflag; … … 255 263 } else if (targetVersion("Windows")) { 256 264 // for the moment, only do a static library 257 if (exists("S" ~ target ~ ".lib")) std.file.remove("S" ~ target ~ ".lib"); 265 if ((new FilePath("S" ~ target ~ ".lib")).exists()) 266 (new FilePath("S" ~ target ~ ".lib")).remove(); 267 258 268 char[] stbl = bl ~ docbl ~ bflags ~ " -explicit -lib -full " ~ fileList ~ " -ofS" ~ target ~ ".lib"; 259 269 saySystemRDie(stbl, "-rf", "temp.rf"); … … 270 280 271 281 // an extra line for clarity 272 writefln("");282 Cout.newline; 273 283 274 284 } else if (type == "special") { 275 285 // special type, do pre/post 276 writefln("%s", target);286 Cout(target).newline; 277 287 if ("prebuild" in settings) { 278 288 dsssScriptedStep(conf, settings["prebuild"]); … … 282 292 dsssScriptedStep(conf, settings["postbuild"]); 283 293 } 284 writefln("");294 Cout.newline; 285 295 286 296 } else if (type == "subdir") { 287 297 // recurse 288 char[] origcwd = getcwd();289 chdir(build);298 char[] origcwd = FileSystem.getDirectory(); 299 FileSystem.setDirectory(build); 290 300 291 301 // the one thing that's passed in is build flags … … 296 306 297 307 int buildret = sss.build.build(null); 298 chdir(origcwd);308 FileSystem.setDirectory(origcwd); 299 309 300 310 dsss_build = orig_dsss_build; … … 321 331 322 332 // output what we're building 323 writefln("%s => %s", build, target);333 Cout(build)(" => ")(target).newline; 324 334 325 335 // do the prebuild … … 329 339 330 340 // build a build line 331 char[] ext = std.string.tolower(getExt(build));341 char[] ext = tango.text.Ascii.toLower(getExt(build)); 332 342 if (ext == "d") { 333 343 bbl ~= build ~ " -of" ~ target ~ " "; … … 335 345 bbl ~= "@" ~ getName(build) ~ " "; 336 346 } else { 337 writefln("ERROR: I don't know how to build something with extension %s", ext);347 Cout("ERROR: I don't know how to build something with extension ")(ext).newline; 338 348 return 1; 339 349 } … … 348 358 349 359 // an extra line for clarity 350 writefln("");360 Cout.newline; 351 361 352 362 }
