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:
parent
708d543d29
commit
5eb5383f08
@ -6,6 +6,9 @@
|
||||
#include "Config.h"
|
||||
#include <cstring>
|
||||
#include <ctime>
|
||||
#ifdef __FreeBSD__
|
||||
# include <sys/sysctl.h>
|
||||
#endif
|
||||
|
||||
namespace Platform
|
||||
{
|
||||
@ -26,7 +29,26 @@ long unsigned int GetTime()
|
||||
|
||||
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()
|
||||
|
@ -16,6 +16,11 @@ elif host_platform == 'linux'
|
||||
stacktrace_files = files('Execinfo.cpp')
|
||||
# export symbols so backtrace_symbols works, see above
|
||||
bluescreen_export_symbols = true
|
||||
if host_machine.system() in [ 'freebsd' ]
|
||||
project_deps += [
|
||||
c_compiler.find_library('execinfo'),
|
||||
]
|
||||
endif
|
||||
else
|
||||
stacktrace_files = files('Null.cpp')
|
||||
endif
|
||||
|
Reference in New Issue
Block a user