--- ./build.d.orig Tue Feb 15 12:05:04 2005 +++ ./build.d Sun Feb 20 20:48:49 2005 @@ -45,6 +45,9 @@ version(linux) { import std.c.linux.linux; } + version(darwin) { + import std.c.darwin.darwin; + } // --------- C externals ---------------- extern (C) @@ -71,6 +74,11 @@ StringN kLibExtention=`lib`; StringN kObjExtention=`o`; } + version(darwin) { + StringN kExeExtention=``; + StringN kLibExtention=`a`; + StringN kObjExtention=`o`; + } } @@ -90,6 +98,13 @@ StringN vConfigPath=`/etc/`; } + version(darwin) { + StringN vCompiler=`dmd`; + StringN vConfigFile; + StringN vCompilerPath=`/opt/gdc/bin`; + StringN vConfigPath; + } + StringN vUnitTest = "-unittest"; bool vNoLink = false; bool vForceCompile = false; @@ -443,7 +458,11 @@ lOutText=std.string.replace(lOutText,std.path.linesep," "); command = vCompiler ~ " " ~ lOutText; } - + version(darwin) { // using commandline, may run into limits + lOutText=std.string.replace(lOutText,std.path.linesep," "); + command = vCompiler ~ " " ~ lOutText; + } + if (vVerbose) { writefln("Compiling with ..........\n%s\n", lOutText); } @@ -481,6 +500,10 @@ lOutText=std.string.replace(lOutText,std.path.linesep," "); command = "lib " ~ lOutText; } + version(darwin) { // using commandline, may run into limits + lOutText=std.string.replace(lOutText,std.path.linesep," "); + command = "lib " ~ lOutText; + } if (vVerbose) { writefln("Librarian with ..........\n%s\n", lOutText); } @@ -580,6 +603,7 @@ lFullName = pathex.CanonicalPath(pRootName); version(Windows) lSearchName = std.string.tolower(lFullName); version(linux) lSearchName = lFullName; + version(darwin) lSearchName = lFullName; if( !(lSearchName in lRootHash) ) { vImportRoots ~= lFullName; lRootHash[lSearchName] = true; @@ -614,7 +638,7 @@ if (lSymName == "@P") { // Special symbol that refers to the configuration file's directory. - lSymName = vConfigPath[0..length-1]; + lSymName = vConfigPath ? vConfigPath[0..length-1] : ""; } else { @@ -635,6 +659,7 @@ // ------------------------------------------- void ReadConfigFile() { // ------------------------------------------- + if (!vConfigFile) return; StringN lPath = vConfigPath ~ vConfigFile ; StringN[] lTextLines = source.GetFileTextLines(lPath); StringN lRootName; @@ -758,11 +783,14 @@ version(DigitalMars) vActiveVersions ["DigitalMars"] = true; version(X86) vActiveVersions ["X86"] = true; + version(PPC) vActiveVersions ["PPC"] = true; version(AMD64) vActiveVersions ["AMD64"] = true; + version(PPC64) vActiveVersions ["PPC64"] = true; version(Windows) vActiveVersions ["Windows"] = true; version(Win32) vActiveVersions ["Win32"] = true; version(Win64) vActiveVersions ["Win64"] = true; version(linux) vActiveVersions ["linux"] = true; + version(darwin) vActiveVersions ["darwin"] = true; version(LittleEndian) vActiveVersions ["LittleEndian"] = true; version(BigEndian) vActiveVersions ["BigEndian"] = true; version(D_InlineAsm) vActiveVersions ["D_InlineAsm"] = true; @@ -1030,8 +1058,9 @@ }; } +version(DigitalMars) ReadConfigFile(); - + // Rationalize the ignored modules list. foreach(StringN m; vModulesToNotice) { for (int i=0; i < vModulesToIgnore.length; i++) { --- ./fdt.d.orig Fri Feb 11 23:07:10 2005 +++ ./fdt.d Sun Feb 20 20:18:12 2005 @@ -11,6 +11,10 @@ version(linux) { import std.c.linux.linux; } + version(darwin) { + import std.c.darwin.darwin; + import std.string; + } } public { @@ -106,6 +110,41 @@ } } + version(darwin){ + class FileDateTime + { + ulong mDT; + bool mSet; + + this(ulong pInitValue) { mSet = true; mDT = pInitValue; } + this() { mSet = false; mDT = 0;} + + int opCmp(FileDateTime pOther) + { + if (mSet == false) + return -1; + + if (pOther.mSet == false) + return 1; + + if (mDT > pOther.mDT) + return 1; + if (mDT < pOther.mDT) + return -1; + return 0; + }; + + StringN toString() + { + if ( mSet == false ) + return "not recorded"; + else + return std.string.format("%d", mDT); + } + + } + } + } version(Windows) { @@ -182,3 +221,42 @@ } + +version(darwin) { + +/* seconds between timebase and last modification - zero if it doesn't exist. */ +FileDateTime GetFileTime(StringW pFileName) +{ + return GetFileTime( toUTF8(pFileName) ); +} + +FileDateTime GetFileTime(String pFileName) +{ + return GetFileTime( toUTF8(pFileName) ); +} + +FileDateTime GetFileTime(StringN pFileName) +body { + FileDateTime lDateTime; + + int lFileHandle; + struct_stat lFileInfo; + char *lFileName; + + lFileName = toStringz(pFileName); + lFileHandle = std.c.darwin.darwin.open(lFileName, O_RDONLY); + if (lFileHandle != -1) { + if(std.c.darwin.darwin.fstat(lFileHandle, &lFileInfo) == 0 ) + lDateTime = new FileDateTime(lFileInfo.st_mtime); + else + lDateTime = new FileDateTime(); + + std.c.darwin.darwin.close(lFileHandle); + } + else + lDateTime = new FileDateTime(); + + return lDateTime; +} + +} --- ./pathex.d.orig Sat Feb 12 20:02:16 2005 +++ ./pathex.d Sun Feb 20 20:05:21 2005 @@ -60,6 +60,12 @@ lPath = CurDir ~ lPath; }; } + version(darwin){ + if (lPath[0] != std.path.sep[0]) + { + lPath = CurDir ~ lPath; + }; + } if (pFinal && (lPath[length-1] != std.path.sep[0]) ){ lPath ~= std.path.sep; }; --- ./source.d.orig Tue Feb 15 12:45:14 2005 +++ ./source.d Sun Feb 20 20:47:57 2005 @@ -24,6 +24,12 @@ StringN LibExt=`lib`; StringN ObjExt=`o`; } + + version(darwin) { + StringN ExeExt=``; + StringN LibExt=`a`; + StringN ObjExt=`o`; + } } @@ -165,6 +171,9 @@ version(linux) { lFindPos = std.string.find(lNextFile, std.path.sep ~ lNextModule ~ std.path.sep ); } + version(darwin) { + lFindPos = std.string.find(lNextFile, std.path.sep ~ lNextModule ~ std.path.sep ); + } if( lFindPos >= 0) { lCanUse = false; @@ -514,6 +523,11 @@ } } version(linux) { + if (getExt(lPragmaId) == LibExt) { + lPragmaId.length = lPragmaId.length - LibExt.length - 1; + } + } + version(darwin) { if (getExt(lPragmaId) == LibExt) { lPragmaId.length = lPragmaId.length - LibExt.length - 1; }