mirror of
https://github.com/The-Powder-Toy/The-Powder-Toy.git
synced 2025-08-22 16:02:54 +02:00
Fix Platform::ExecutableName on freebsd
Also fix release (but somehow only release) builds failing to link because execinfo is a library on freebsd.
This commit is contained in:
@@ -6,6 +6,9 @@
|
|||||||
#include "Config.h"
|
#include "Config.h"
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
#include <ctime>
|
#include <ctime>
|
||||||
|
#ifdef __FreeBSD__
|
||||||
|
# include <sys/sysctl.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
namespace Platform
|
namespace Platform
|
||||||
{
|
{
|
||||||
@@ -26,7 +29,26 @@ long unsigned int GetTime()
|
|||||||
|
|
||||||
ByteString ExecutableNameFirstApprox()
|
ByteString ExecutableNameFirstApprox()
|
||||||
{
|
{
|
||||||
return "/proc/self/exe";
|
if (Stat("/proc/self/exe"))
|
||||||
|
{
|
||||||
|
return "/proc/self/exe";
|
||||||
|
}
|
||||||
|
#ifdef __FreeBSD__
|
||||||
|
{
|
||||||
|
int mib[4];
|
||||||
|
mib[0] = CTL_KERN;
|
||||||
|
mib[1] = KERN_PROC;
|
||||||
|
mib[2] = KERN_PROC_PATHNAME;
|
||||||
|
mib[3] = -1;
|
||||||
|
std::array<char, 1000> buf;
|
||||||
|
size_t cb = buf.size();
|
||||||
|
if (!sysctl(mib, 4, &buf[0], &cb, NULL, 0))
|
||||||
|
{
|
||||||
|
return ByteString(&buf[0], &buf[0] + cb);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CanUpdate()
|
bool CanUpdate()
|
||||||
|
@@ -16,6 +16,11 @@ elif host_platform == 'linux'
|
|||||||
stacktrace_files = files('Execinfo.cpp')
|
stacktrace_files = files('Execinfo.cpp')
|
||||||
# export symbols so backtrace_symbols works, see above
|
# export symbols so backtrace_symbols works, see above
|
||||||
bluescreen_export_symbols = true
|
bluescreen_export_symbols = true
|
||||||
|
if host_machine.system() in [ 'freebsd' ]
|
||||||
|
project_deps += [
|
||||||
|
c_compiler.find_library('execinfo'),
|
||||||
|
]
|
||||||
|
endif
|
||||||
else
|
else
|
||||||
stacktrace_files = files('Null.cpp')
|
stacktrace_files = files('Null.cpp')
|
||||||
endif
|
endif
|
||||||
|
Reference in New Issue
Block a user