Fix build on FreeBSD (#656)

* Fix build on FreeBSD

* Add missing dependency on qtWidgets
This commit is contained in:
Kevin Zheng 2020-10-18 14:43:28 -07:00 committed by GitHub
parent 591d4a5c37
commit 96123c3429
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 21 additions and 2 deletions

View File

@ -160,7 +160,7 @@ equals(HAVE_QT, "0") {
} else {
DEFINES += HAVE_QT
QT += core network xml sql
QT += core network xml sql widgets
equals(HAVE_QT5, "1") {
QT += designer printsupport

View File

@ -450,7 +450,7 @@ void install_signal_handlers ()
act.sa_sigaction = signal_handler;
sigemptyset (&act.sa_mask);
act.sa_flags = SA_SIGINFO;
#if !defined(__APPLE__) && !defined(__OpenBSD__)
#if !defined(__APPLE__) && !defined(__FreeBSD__) && !defined(__OpenBSD__)
act.sa_restorer = 0;
#endif

View File

@ -59,6 +59,13 @@
#endif
#if defined(__FreeBSD__)
#include <sys/types.h>
#include <sys/sysctl.h>
#endif
namespace tl
{
@ -816,6 +823,16 @@ get_inst_path_internal ()
return tl::absolute_path (buffer);
}
#elif defined (__FreeBSD__)
char path[PATH_MAX];
size_t len = PATH_MAX;
const int mib[4] = {CTL_KERN, KERN_PROC, KERN_PROC_PATHNAME, -1};
if (sysctl(&mib[0], 4, &path, &len, NULL, 0) == 0) {
return tl::absolute_path(path);
}
return "";
#else
std::string pf = tl::sprintf ("/proc/%d/exe", getpid ());

View File

@ -32,6 +32,8 @@
#include <zlib.h>
#ifdef _WIN32
# include <io.h>
#else
# include <unistd.h>
#endif
#include "tlStream.h"