diff options
author | Jason A. Donenfeld <Jason@zx2c4.com> | 2010-08-07 05:12:31 +0200 |
---|---|---|
committer | Jason A. Donenfeld <Jason@zx2c4.com> | 2010-08-07 05:12:31 +0200 |
commit | b3b63b420a683d6920dd6f0ef6f833d1035901be (patch) | |
tree | cd15aef100629dd8edcaadbf8b7630168f049a99 | |
parent | Infrastructure to deal with incompletly configured components (diff) | |
download | bldit-b3b63b420a683d6920dd6f0ef6f833d1035901be.tar.xz bldit-b3b63b420a683d6920dd6f0ef6f833d1035901be.zip |
Build on Linux.
-rw-r--r-- | FileSystemUtilities.cc | 4 | ||||
-rw-r--r-- | FileSystemUtilities.posix.cc (renamed from FileSystemUtilities.mac.cc) | 21 | ||||
-rw-r--r-- | Gcc4Compiler.cc | 2 | ||||
-rw-r--r--[-rwxr-xr-x] | HostPlatform.h | 10 | ||||
-rw-r--r-- | ProcessUtilities.cc | 4 | ||||
-rw-r--r-- | ProcessUtilities.posix.cc (renamed from ProcessUtilities.mac.cc) | 6 | ||||
-rw-r--r-- | Project.cc | 2 | ||||
-rw-r--r-- | ProjectParser.cc | 2 | ||||
-rw-r--r--[-rwxr-xr-x] | SystemConfiguration.cc | 0 | ||||
-rw-r--r--[-rwxr-xr-x] | SystemConfiguration.h | 0 | ||||
-rwxr-xr-x | bootstrap.posix.sh (renamed from bootstrap.mac.sh) | 0 | ||||
-rw-r--r--[-rwxr-xr-x] | stdafx.h | 0 |
12 files changed, 33 insertions, 18 deletions
diff --git a/FileSystemUtilities.cc b/FileSystemUtilities.cc index d92bdd3..004d455 100644 --- a/FileSystemUtilities.cc +++ b/FileSystemUtilities.cc @@ -3,8 +3,8 @@ #if defined(HOST_IS_WINDOWS) #include "FileSystemUtilities.win.cc" -#elif defined(HOST_IS_MACOSX) -#include "FileSystemUtilities.mac.cc" +#elif defined(HOST_IS_POSIX) +#include "FileSystemUtilities.posix.cc" #endif std::string findExecutableInPath(const std::string& ProcessName, diff --git a/FileSystemUtilities.mac.cc b/FileSystemUtilities.posix.cc index 021e106..d2ab4e2 100644 --- a/FileSystemUtilities.mac.cc +++ b/FileSystemUtilities.posix.cc @@ -5,7 +5,9 @@ #include <sys/errno.h> #include <sys/stat.h> #include <sys/types.h> +#include <sys/wait.h> #include <stdlib.h> +#include <string.h> #include <unistd.h> bool createDirectoryComponent(const std::string& Name, std::string::size_type& idx) @@ -98,10 +100,16 @@ bool fileIsNewer(const std::string& Name1, const std::string& Name2) res = stat(Name2.c_str(), &info2); if (res) return true; if (S_IFDIR & info2.st_mode) return true; - if (info1.st_mtimespec.tv_sec == info2.st_mtimespec.tv_sec) - return info1.st_mtimespec.tv_nsec > info2.st_mtimespec.tv_nsec; - return info1.st_mtimespec.tv_sec > info2.st_mtimespec.tv_sec; - +#if defined(__APPLE__) || defined(__BSD_VISIBLE) + struct timespec mtime1 = info1.st_mtimespec; + struct timespec mtime2 = info2.st_mtimespec; +#else + struct timespec mtime1 = info1.st_mtim; + struct timespec mtime2 = info2.st_mtim; +#endif + if (mtime1.tv_sec == mtime2.tv_sec) + return mtime1.tv_nsec > mtime2.tv_nsec; + return mtime1.tv_sec > mtime2.tv_sec; } std::string pathAppend(const std::string& A, const std::string& B) @@ -155,3 +163,8 @@ std::string pathOf(const std::string& P) return "."; return P.substr(0,idx); } + +std::string toNativePath(const std::string& path) +{ + return path; +} diff --git a/Gcc4Compiler.cc b/Gcc4Compiler.cc index d182d9b..c587be4 100644 --- a/Gcc4Compiler.cc +++ b/Gcc4Compiler.cc @@ -1,5 +1,5 @@ #include "Gcc4Compiler.h" -#include "CcSource.h" +#include "CCSource.h" #include "Component.h" #include "Executable.h" #include "FileSystemUtilities.h" diff --git a/HostPlatform.h b/HostPlatform.h index b828ebb..e66ff0f 100755..100644 --- a/HostPlatform.h +++ b/HostPlatform.h @@ -4,9 +4,9 @@ #ifdef _WIN32
// Windows host platform
#define HOST_IS_WINDOWS
-#elif defined (__APPLE__)
-// MacOs X host platform
-#define HOST_IS_MACOSX
+#elif defined (__APPLE__) || defined(__linux__) || defined(__linux) || defined(__GNU__) || defined(__sun) || defined(sun) || defined(__FreeBSD__) || defined(__DragonFly__) || defined(__NetBSD__) || defined(__OpenBSD__)
+// Posix host platform
+#define HOST_IS_POSIX
#endif
inline bool hostIsWindows()
@@ -18,9 +18,9 @@ inline bool hostIsWindows() #endif
}
-inline bool hostIsMacOSX()
+inline bool hostIsPosix()
{
-#ifdef HOST_IS_MACOSX
+#ifdef HOST_IS_POSIX
return true;
#else
return false;
diff --git a/ProcessUtilities.cc b/ProcessUtilities.cc index f8086e7..3c90375 100644 --- a/ProcessUtilities.cc +++ b/ProcessUtilities.cc @@ -2,8 +2,8 @@ #include "HostPlatform.h" #if defined(HOST_IS_WINDOWS) #include "ProcessUtilities.win.cc" -#elif defined(HOST_IS_MACOSX) -#include "ProcessUtilities.mac.cc" +#elif defined(HOST_IS_POSIX) +#include "ProcessUtilities.posix.cc" #endif #include "FileSystemUtilities.h" diff --git a/ProcessUtilities.mac.cc b/ProcessUtilities.posix.cc index 20e6572..3cb041f 100644 --- a/ProcessUtilities.mac.cc +++ b/ProcessUtilities.posix.cc @@ -1,8 +1,10 @@ #include "ProcessUtilities.h" -#include <vector> - +#include <sys/wait.h> +#include <string.h> #include <errno.h> +#include <stdlib.h> +#include <vector> class ProcessInfo { @@ -1,5 +1,5 @@ #include "Project.h" -#include "FilesystemUtilities.h" +#include "FileSystemUtilities.h" #include "ProcessUtilities.h" #include "ProjectParser.h" #include "ToolChain.h" diff --git a/ProjectParser.cc b/ProjectParser.cc index b2b2dcf..fa38501 100644 --- a/ProjectParser.cc +++ b/ProjectParser.cc @@ -1018,7 +1018,7 @@ SharedPtr<Expression> evaluateHostPlatformBuiltIn(Context& Here, const std::vect if (*Begin == "is_windows") return new BoolExpression(hostIsWindows()); else if (*Begin == "is_macosx") - return new BoolExpression(hostIsMacOSX()); + return new BoolExpression(hostIsPosix()); else Here.Input.error("Unknown variable "+*Begin); return new VoidExpression; diff --git a/SystemConfiguration.cc b/SystemConfiguration.cc index 144d379..144d379 100755..100644 --- a/SystemConfiguration.cc +++ b/SystemConfiguration.cc diff --git a/SystemConfiguration.h b/SystemConfiguration.h index c9a25ea..c9a25ea 100755..100644 --- a/SystemConfiguration.h +++ b/SystemConfiguration.h diff --git a/bootstrap.mac.sh b/bootstrap.posix.sh index 488f38b..488f38b 100755 --- a/bootstrap.mac.sh +++ b/bootstrap.posix.sh |