This commit is contained in:
Maxime Coste 2015-11-04 19:49:21 +00:00
commit 2ce0a5a8a8
2 changed files with 13 additions and 0 deletions

View File

@ -28,6 +28,10 @@ os := $(shell uname)
ifeq ($(os),Darwin) ifeq ($(os),Darwin)
LIBS += -lncurses -lboost_regex-mt LIBS += -lncurses -lboost_regex-mt
else ifeq ($(os),FreeBSD)
LIBS += -ltinfow -lncursesw -lboost_regex
CPPFLAGS += -I/usr/local/include
LDFLAGS += -L/usr/local/lib
else ifeq ($(os),Haiku) else ifeq ($(os),Haiku)
LIBS += -lncursesw -lboost_regex -lnetwork -lbe LIBS += -lncursesw -lboost_regex -lnetwork -lbe
else ifeq ($(os),DragonFly) else ifeq ($(os),DragonFly)

View File

@ -12,6 +12,10 @@
#include <unistd.h> #include <unistd.h>
#include <dirent.h> #include <dirent.h>
#if defined(__FreeBSD__)
#include <sys/sysctl.h>
#endif
#if defined(__APPLE__) #if defined(__APPLE__)
#include <mach-o/dyld.h> #include <mach-o/dyld.h>
#define st_mtim st_mtimespec #define st_mtim st_mtimespec
@ -491,6 +495,11 @@ String get_kak_binary_path()
kak_assert(res != -1); kak_assert(res != -1);
buffer[res] = '\0'; buffer[res] = '\0';
return buffer; return buffer;
#elif defined(__FreeBSD__)
int mib[] = {CTL_KERN, KERN_PROC, KERN_PROC_PATHNAME, -1};
size_t res = sizeof(buffer);
sysctl(mib, 4, buffer, &res, NULL, 0);
return buffer;
#elif defined(__APPLE__) #elif defined(__APPLE__)
uint32_t bufsize = 2048; uint32_t bufsize = 2048;
_NSGetExecutablePath(buffer, &bufsize); _NSGetExecutablePath(buffer, &bufsize);