Changeset 764

Show
Ignore:
Timestamp:
08/14/07 23:32:02 (1 year ago)
Author:
Gregor
Message:

rebuild/mars.c: Should now handle non-DMD compilers derived from DMD more easily (see ticket #115).

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/docs/ChangeLog

    r761 r764  
    77        - `dsss install` now installs .di files in libraries (see ticket #92). 
    88        - Added 'installdir' hook command (see ticket #84). 
     9        - Rebuild: Should now handle non-DMD compilers derived from DMD more 
     10          easily (see ticket #115). 
    911 
    10120.70 from 0.69: 
  • trunk/rebuild/mars.c

    r746 r764  
    397397        std::string compiler = masterConfig[""]["compiler"]; 
    398398         
    399         if (compiler == "dmd") { 
    400             // we have this built in 
    401             char *inif; 
    402              
    403             if (masterConfig[""].find("inifile") != masterConfig[""].end()) 
    404                 inif = mem.strdup(masterConfig[""]["inifile"].c_str()); 
    405             else 
    406                 inif = mem.strdup("sc.ini"); 
    407              
    408             // trick whereami into giving us a path 
    409             char *dir, *fil, *full; 
    410             if (!whereAmI("dmd", &dir, &fil)) { 
    411                 error("dmd is not in $PATH"); 
    412                 exit(1); 
    413             } 
    414             full = (char *) mem.malloc(strlen(dir) + 5); 
    415             sprintf(full, "%s%cdmd", dir, 
    416 #if __WIN32 
    417                     '\\' 
    418 #else 
    419                     '/' 
    420 #endif 
    421                    ); 
    422             inifile(full, inif); 
    423             mem.free(full); 
    424              
    425             mem.free(inif); 
    426              
    427         } else if (compiler.substr(compiler.length() - 3) == "gdc") { 
     399        if (compiler.substr(compiler.length() - 3) == "gdc") { 
    428400            // a bit more complicated 
    429401#define READBUFSIZ 1024 
     
    466438            global.params.imppath->push(strdup( 
    467439                (std::string(gdcdir) + "/../" + cmachine + "/include/d/" + cversion + "/" + cmachine + "/").c_str())); 
     440        } 
     441        // assume dmd based compiler if inifile is set 
     442        else if (masterConfig[""].find("inifile") != masterConfig[""].end()) { 
     443            std::string inif = masterConfig[""]["inifile"]; 
     444 
     445            // trick whereami into giving us a path 
     446            char *dir, *fil; 
     447            if (!whereAmI(compiler.c_str(), &dir, &fil)) { 
     448                error("%s is not in $PATH", compiler.c_str()); 
     449                exit(1); 
     450            } 
     451            std::string full = dir; 
     452#if __WIN32 
     453            full.append("\\"); 
     454#else 
     455            full.append("/"); 
     456#endif 
     457            full.append(compiler); 
     458 
     459            inifile((char*)full.c_str(), (char*)inif.c_str()); 
    468460        } 
    469461    }