mirror of
https://github.com/Relintai/osxcross.git
synced 2025-02-03 22:45:56 +01:00
Cleanup: Remove the native Windows bits.
There will be no *native* Windows port of OSXCross anyway. This does not affect Cygwin.
This commit is contained in:
parent
b3e53726b0
commit
24753b8178
@ -76,8 +76,8 @@ if [ -n "$BWPLATFORM" ]; then
|
|||||||
PLATFORM=$BWPLATFORM
|
PLATFORM=$BWPLATFORM
|
||||||
|
|
||||||
if [ $PLATFORM = "Darwin" -a $(uname -s) != "Darwin" ]; then
|
if [ $PLATFORM = "Darwin" -a $(uname -s) != "Darwin" ]; then
|
||||||
CXX=o32-clang++
|
CXX=$(xcrun -f clang++)
|
||||||
#CXX=o32-g++
|
#CXX=$(xcrun -f g++)
|
||||||
FLAGS+="-fvisibility-inlines-hidden "
|
FLAGS+="-fvisibility-inlines-hidden "
|
||||||
elif [ $PLATFORM = "FreeBSD" -a $(uname -s) != "FreeBSD" ]; then
|
elif [ $PLATFORM = "FreeBSD" -a $(uname -s) != "FreeBSD" ]; then
|
||||||
CXX=amd64-pc-freebsd10.1-clang++
|
CXX=amd64-pc-freebsd10.1-clang++
|
||||||
@ -85,14 +85,6 @@ if [ -n "$BWPLATFORM" ]; then
|
|||||||
elif [ $PLATFORM = "NetBSD" -a $(uname -s) != "NetBSD" ]; then
|
elif [ $PLATFORM = "NetBSD" -a $(uname -s) != "NetBSD" ]; then
|
||||||
CXX=amd64-pc-netbsd6.1.3-clang++
|
CXX=amd64-pc-netbsd6.1.3-clang++
|
||||||
#CXX=amd64-pc-netbsd6.1.3-g++
|
#CXX=amd64-pc-netbsd6.1.3-g++
|
||||||
elif [ $PLATFORM = "Windows" ]; then
|
|
||||||
CXX=w32-clang++
|
|
||||||
FLAGS+="-wc-static-runtime -g "
|
|
||||||
EXESUFFIX=".exe"
|
|
||||||
elif [ $PLATFORM = "MWindows" ]; then
|
|
||||||
CXX=i686-w64-mingw32-g++
|
|
||||||
FLAGS+="-static-libgcc -static-libstdc++ -g "
|
|
||||||
EXESUFFIX=".exe"
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
[ -z "$BWCOMPILEONLY" ] && BWCOMPILEONLY=1
|
[ -z "$BWCOMPILEONLY" ] && BWCOMPILEONLY=1
|
||||||
|
@ -34,11 +34,8 @@
|
|||||||
#include <cstdio>
|
#include <cstdio>
|
||||||
#include <climits>
|
#include <climits>
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
|
|
||||||
#ifndef _WIN32
|
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <sys/wait.h>
|
#include <sys/wait.h>
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "tools.h"
|
#include "tools.h"
|
||||||
#include "target.h"
|
#include "target.h"
|
||||||
@ -196,15 +193,11 @@ bool checkincludepath(Target &, const char *opt, const char *path, char **) {
|
|||||||
if (noinccheck)
|
if (noinccheck)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
#ifndef _WIN32
|
|
||||||
char buf[PATH_MAX + 1];
|
char buf[PATH_MAX + 1];
|
||||||
const char *rpath = realpath(path, buf);
|
const char *rpath = realpath(path, buf);
|
||||||
|
|
||||||
if (!rpath)
|
if (!rpath)
|
||||||
rpath = path;
|
rpath = path;
|
||||||
#else
|
|
||||||
const char *rpath = path;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
for (const char *dpath : DangerousIncludePaths) {
|
for (const char *dpath : DangerousIncludePaths) {
|
||||||
if (!strncmp(rpath, dpath, strlen(dpath))) {
|
if (!strncmp(rpath, dpath, strlen(dpath))) {
|
||||||
|
@ -21,12 +21,9 @@
|
|||||||
|
|
||||||
#include "proginc.h"
|
#include "proginc.h"
|
||||||
|
|
||||||
#ifndef _WIN32
|
|
||||||
#include <unistd.h>
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/wait.h>
|
#include <sys/wait.h>
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
#endif
|
|
||||||
|
|
||||||
using namespace tools;
|
using namespace tools;
|
||||||
|
|
||||||
@ -140,7 +137,6 @@ int dsymutil(int argc, char **argv, Target &target) {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef _WIN32
|
|
||||||
//
|
//
|
||||||
// A glorious workaround to make the vanilla llvm-dsymutil find lipo.
|
// A glorious workaround to make the vanilla llvm-dsymutil find lipo.
|
||||||
//
|
//
|
||||||
@ -148,7 +144,7 @@ int dsymutil(int argc, char **argv, Target &target) {
|
|||||||
// 2. Store a lipo symlink there.
|
// 2. Store a lipo symlink there.
|
||||||
// 3. Append <tmpdir> to PATH.
|
// 3. Append <tmpdir> to PATH.
|
||||||
// 4. Fork the process and wait until the child process exited.
|
// 4. Fork the process and wait until the child process exited.
|
||||||
// 5. Remove the temporary directory and return the llvm-dsymutil.
|
// 5. Remove the temporary directory and return the llvm-dsymutil
|
||||||
// exit code.
|
// exit code.
|
||||||
//
|
//
|
||||||
|
|
||||||
@ -209,7 +205,6 @@ int dsymutil(int argc, char **argv, Target &target) {
|
|||||||
removeTemporaryDirectory();
|
removeTemporaryDirectory();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (execvp(dsymutil.c_str(), argv))
|
if (execvp(dsymutil.c_str(), argv))
|
||||||
|
@ -21,10 +21,6 @@
|
|||||||
|
|
||||||
#include "proginc.h"
|
#include "proginc.h"
|
||||||
|
|
||||||
#ifndef _WIN32
|
|
||||||
#include <unistd.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
using namespace tools;
|
using namespace tools;
|
||||||
using namespace target;
|
using namespace target;
|
||||||
|
|
||||||
|
@ -21,10 +21,6 @@
|
|||||||
|
|
||||||
#include "proginc.h"
|
#include "proginc.h"
|
||||||
|
|
||||||
#ifndef _WIN32
|
|
||||||
#include <unistd.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
extern char **environ;
|
extern char **environ;
|
||||||
using namespace tools;
|
using namespace tools;
|
||||||
|
|
||||||
|
@ -7,6 +7,7 @@
|
|||||||
#include <cstring>
|
#include <cstring>
|
||||||
#include <climits>
|
#include <climits>
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
|
#include <unistd.h>
|
||||||
|
|
||||||
#include "tools.h"
|
#include "tools.h"
|
||||||
#include "target.h"
|
#include "target.h"
|
||||||
|
@ -21,10 +21,6 @@
|
|||||||
|
|
||||||
#include "proginc.h"
|
#include "proginc.h"
|
||||||
|
|
||||||
#ifndef _WIN32
|
|
||||||
#include <unistd.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
using namespace tools;
|
using namespace tools;
|
||||||
using namespace target;
|
using namespace target;
|
||||||
|
|
||||||
|
@ -35,15 +35,10 @@
|
|||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
|
|
||||||
#ifndef _WIN32
|
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/wait.h>
|
#include <sys/wait.h>
|
||||||
#include <dirent.h>
|
#include <dirent.h>
|
||||||
#else
|
|
||||||
#include <windows.h>
|
|
||||||
#include <tlhelp32.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef __APPLE__
|
#ifdef __APPLE__
|
||||||
#include <mach-o/dyld.h>
|
#include <mach-o/dyld.h>
|
||||||
@ -72,7 +67,6 @@ namespace tools {
|
|||||||
//
|
//
|
||||||
|
|
||||||
bool isTerminal() {
|
bool isTerminal() {
|
||||||
#ifndef _WIN32
|
|
||||||
static bool first = false;
|
static bool first = false;
|
||||||
static bool val;
|
static bool val;
|
||||||
|
|
||||||
@ -82,9 +76,6 @@ bool isTerminal() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return val;
|
return val;
|
||||||
#else
|
|
||||||
return false;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
@ -143,8 +134,6 @@ char *getExecutablePath(char *buf, size_t len) {
|
|||||||
else
|
else
|
||||||
l = 0;
|
l = 0;
|
||||||
delete[] argv;
|
delete[] argv;
|
||||||
#elif defined(_WIN32)
|
|
||||||
size_t l = GetModuleFileName(nullptr, buf, (DWORD)len);
|
|
||||||
#else
|
#else
|
||||||
ssize_t l = readlink("/proc/self/exe", buf, len);
|
ssize_t l = readlink("/proc/self/exe", buf, len);
|
||||||
assert(l > 0 && "/proc not mounted?");
|
assert(l > 0 && "/proc not mounted?");
|
||||||
@ -160,58 +149,6 @@ char *getExecutablePath(char *buf, size_t len) {
|
|||||||
|
|
||||||
const std::string &getParentProcessName() {
|
const std::string &getParentProcessName() {
|
||||||
static std::string name;
|
static std::string name;
|
||||||
#ifdef _WIN32
|
|
||||||
HANDLE h = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);
|
|
||||||
PROCESSENTRY32 pe;
|
|
||||||
|
|
||||||
auto zerope = [&]() {
|
|
||||||
memset(&pe, 0, sizeof(pe));
|
|
||||||
pe.dwSize = sizeof(PROCESSENTRY32);
|
|
||||||
};
|
|
||||||
|
|
||||||
zerope();
|
|
||||||
|
|
||||||
auto pid = GetCurrentProcessId();
|
|
||||||
decltype(pid) ppid = -1;
|
|
||||||
|
|
||||||
if (Process32First(h, &pe)) {
|
|
||||||
do {
|
|
||||||
if (pe.th32ProcessID == pid) {
|
|
||||||
ppid = pe.th32ParentProcessID;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
} while (Process32Next(h, &pe));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (ppid != static_cast<decltype(ppid)>(-1)) {
|
|
||||||
PROCESSENTRY32 *ppe = nullptr;
|
|
||||||
zerope();
|
|
||||||
|
|
||||||
if (Process32First(h, &pe)) {
|
|
||||||
do {
|
|
||||||
if (pe.th32ProcessID == ppid) {
|
|
||||||
ppe = &pe;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
} while (Process32Next(h, &pe));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (ppe) {
|
|
||||||
char *p = strrchr(ppe->szExeFile, '\\');
|
|
||||||
if (p) {
|
|
||||||
name = p + 1;
|
|
||||||
} else {
|
|
||||||
name = ppe->szExeFile;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
CloseHandle(h);
|
|
||||||
|
|
||||||
if (!name.empty()) {
|
|
||||||
return name;
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
auto getName = [](const char * path)->const char * {
|
auto getName = [](const char * path)->const char * {
|
||||||
if (const char *p = strrchr(path, '/')) {
|
if (const char *p = strrchr(path, '/')) {
|
||||||
return p + 1;
|
return p + 1;
|
||||||
@ -250,22 +187,11 @@ const std::string &getParentProcessName() {
|
|||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
#endif
|
#endif
|
||||||
name = "unknown";
|
name = "unknown";
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef _WIN32
|
|
||||||
std::string &fixPathDiv(std::string &path) {
|
|
||||||
for (auto &c : path) {
|
|
||||||
if (c == '/')
|
|
||||||
c = '\\';
|
|
||||||
}
|
|
||||||
return path;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Environment
|
// Environment
|
||||||
//
|
//
|
||||||
@ -389,7 +315,6 @@ bool isDirectory(const char *file, const char *prefix) {
|
|||||||
|
|
||||||
bool listFiles(const char *dir, std::vector<std::string> *files,
|
bool listFiles(const char *dir, std::vector<std::string> *files,
|
||||||
listfilescallback cmp) {
|
listfilescallback cmp) {
|
||||||
#ifndef _WIN32
|
|
||||||
DIR *d = opendir(dir);
|
DIR *d = opendir(dir);
|
||||||
dirent *de;
|
dirent *de;
|
||||||
|
|
||||||
@ -404,25 +329,6 @@ bool listFiles(const char *dir, std::vector<std::string> *files,
|
|||||||
|
|
||||||
closedir(d);
|
closedir(d);
|
||||||
return true;
|
return true;
|
||||||
#else
|
|
||||||
WIN32_FIND_DATA fdata;
|
|
||||||
HANDLE handle;
|
|
||||||
|
|
||||||
handle = FindFirstFile(dir, &fdata);
|
|
||||||
|
|
||||||
if (handle == INVALID_HANDLE_VALUE)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
do {
|
|
||||||
if ((!cmp || cmp(fdata.cFileName)) && files) {
|
|
||||||
files->push_back(fdata.cFileName);
|
|
||||||
}
|
|
||||||
} while (FindNextFile(handle, &fdata));
|
|
||||||
|
|
||||||
FindClose(handle);
|
|
||||||
|
|
||||||
return true;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
typedef bool (*realpathcmp)(const char *file, const struct stat &st);
|
typedef bool (*realpathcmp)(const char *file, const struct stat &st);
|
||||||
@ -455,7 +361,6 @@ bool realPath(const char *file, std::string &result,
|
|||||||
result += file;
|
result += file;
|
||||||
|
|
||||||
if (!stat(result.c_str(), &st)) {
|
if (!stat(result.c_str(), &st)) {
|
||||||
#ifndef _WIN32
|
|
||||||
char buf[PATH_MAX + 1];
|
char buf[PATH_MAX + 1];
|
||||||
|
|
||||||
if (realpath(result.c_str(), buf)) {
|
if (realpath(result.c_str(), buf)) {
|
||||||
@ -492,7 +397,6 @@ bool realPath(const char *file, std::string &result,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
if ((!cmp1 || cmp1(result.c_str(), st)) &&
|
if ((!cmp1 || cmp1(result.c_str(), st)) &&
|
||||||
(!cmp2 || cmp2(result.c_str(), st)))
|
(!cmp2 || cmp2(result.c_str(), st)))
|
||||||
@ -621,23 +525,4 @@ OSVersion parseOSVersion(const char *OSVer) {
|
|||||||
return OSNum;
|
return OSNum;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
|
||||||
// OS Compat
|
|
||||||
//
|
|
||||||
|
|
||||||
#ifdef _WIN32
|
|
||||||
int setenv(const char *name, const char *value, int overwrite) {
|
|
||||||
std::string buf;
|
|
||||||
(void)overwrite; // TODO
|
|
||||||
|
|
||||||
buf = name;
|
|
||||||
buf += '=';
|
|
||||||
buf += value;
|
|
||||||
|
|
||||||
return putenv(buf.c_str());
|
|
||||||
}
|
|
||||||
|
|
||||||
int unsetenv(const char *name) { return setenv(name, "", 1); }
|
|
||||||
#endif
|
|
||||||
|
|
||||||
} // namespace tools
|
} // namespace tools
|
||||||
|
@ -145,6 +145,8 @@ bool hasPath(const std::vector<std::string> &path, const char *find);
|
|||||||
// Files and directories
|
// Files and directories
|
||||||
//
|
//
|
||||||
|
|
||||||
|
constexpr char PATHDIV = '/';
|
||||||
|
|
||||||
std::string *getFileContent(const std::string &file, std::string &content);
|
std::string *getFileContent(const std::string &file, std::string &content);
|
||||||
bool writeFileContent(const std::string &file, const std::string &content);
|
bool writeFileContent(const std::string &file, const std::string &content);
|
||||||
|
|
||||||
@ -341,18 +343,6 @@ static const auto &parseClangVersion = parseOSVersion;
|
|||||||
typedef OSVersion LLVMVersion;
|
typedef OSVersion LLVMVersion;
|
||||||
static const auto &parseLLVMVersion = parseOSVersion;
|
static const auto &parseLLVMVersion = parseOSVersion;
|
||||||
|
|
||||||
//
|
|
||||||
// OS Compat
|
|
||||||
//
|
|
||||||
|
|
||||||
#ifdef _WIN32
|
|
||||||
int setenv(const char *name, const char *value, int overwrite);
|
|
||||||
int unsetenv(const char *name);
|
|
||||||
constexpr char PATHDIV = '\\';
|
|
||||||
#else
|
|
||||||
constexpr char PATHDIV = '/';
|
|
||||||
#endif
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Arch
|
// Arch
|
||||||
//
|
//
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<CodeLite_Workspace Name="wrapper" Database="wrapper.tags">
|
<CodeLite_Workspace Name="wrapper" Database="wrapper.tags" SWTLW="No">
|
||||||
<Project Name="wrapper" Path="./wrapper.project" Active="Yes"/>
|
<Project Name="wrapper" Path="./wrapper.project" Active="Yes"/>
|
||||||
<BuildMatrix>
|
<BuildMatrix>
|
||||||
<WorkspaceConfiguration Name="Debug" Selected="yes">
|
<WorkspaceConfiguration Name="Debug" Selected="yes">
|
||||||
|
Loading…
Reference in New Issue
Block a user