Various small fixes for non-win32 builds

This commit is contained in:
Clifford Wolf 2014-10-12 12:18:38 +02:00
parent 0b9282a779
commit 1a7684be24
2 changed files with 11 additions and 4 deletions

View File

@ -30,6 +30,11 @@
#ifdef _WIN32 #ifdef _WIN32
# include <windows.h> # include <windows.h>
#elif defined(__APPLE__)
# include <mach-o/dyld.h>
#else
# include <sys/types.h>
# include <sys/stat.h>
#endif #endif
#include <unistd.h> #include <unistd.h>
@ -263,7 +268,7 @@ std::string make_temp_dir(std::string template_str)
log_assert(suffixlen == 0); log_assert(suffixlen == 0);
char *p = strdup(template_str.c_str()); char *p = strdup(template_str.c_str());
mkdtemp(p, suffixlen); mkdtemp(p);
template_str = p; template_str = p;
free(p); free(p);
@ -282,7 +287,7 @@ void remove_directory(std::string dirname)
log_assert(n >= 0); log_assert(n >= 0);
for (int i = 0; i < n; i++) { for (int i = 0; i < n; i++) {
if (strcmp(namelist[i]->d_name, ".") && strcmp(namelist[i]->d_name, "..")) { if (strcmp(namelist[i]->d_name, ".") && strcmp(namelist[i]->d_name, "..")) {
buffer = stringf("%s/%s", dirname.c_str(), namelist[i]->d_name); std::string buffer = stringf("%s/%s", dirname.c_str(), namelist[i]->d_name);
if (!stat(buffer.c_str(), &stbuf) && S_ISREG(stbuf.st_mode)) { if (!stat(buffer.c_str(), &stbuf) && S_ISREG(stbuf.st_mode)) {
log("Removing `%s'.\n", buffer.c_str()); log("Removing `%s'.\n", buffer.c_str());
remove(buffer.c_str()); remove(buffer.c_str());
@ -455,7 +460,6 @@ std::string proc_self_dirname()
return std::string(path, buflen); return std::string(path, buflen);
} }
#elif defined(__APPLE__) #elif defined(__APPLE__)
#include <mach-o/dyld.h>
std::string proc_self_dirname() std::string proc_self_dirname()
{ {
char *path = NULL; char *path = NULL;

View File

@ -58,6 +58,10 @@
#include <string.h> #include <string.h>
#include <stdio.h> #include <stdio.h>
#ifdef YOSYS_ENABLE_TCL
# include <tcl.h>
#endif
#define PRIVATE_NAMESPACE_BEGIN namespace { #define PRIVATE_NAMESPACE_BEGIN namespace {
#define PRIVATE_NAMESPACE_END } #define PRIVATE_NAMESPACE_END }
#define YOSYS_NAMESPACE_BEGIN namespace Yosys { #define YOSYS_NAMESPACE_BEGIN namespace Yosys {
@ -107,7 +111,6 @@ void yosys_setup();
void yosys_shutdown(); void yosys_shutdown();
#ifdef YOSYS_ENABLE_TCL #ifdef YOSYS_ENABLE_TCL
#include <tcl.h>
Tcl_Interp *yosys_get_tcl_interp(); Tcl_Interp *yosys_get_tcl_interp();
#endif #endif