Skip to content

Commit

Permalink
fix compilation under FreeBSD
Browse files Browse the repository at this point in the history
sys headers must come before libprocstat

meson is missing a libprocstat dependency. iconv is also broken with
meson and freebsd.

Signed-off-by: Rosen Penev <[email protected]>
  • Loading branch information
neheb committed Mar 19, 2023
1 parent 6a3025d commit 4a26eba
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
3 changes: 2 additions & 1 deletion meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ cdata.set('EXV_ENABLE_VIDEO', get_option('video'))

deps = []
deps += cpp.find_library('ws2_32', required: host_machine.system() == 'windows')
deps += cpp.find_library('procstat', required: host_machine.system() == 'freebsd')

if cpp.get_argument_syntax() == 'gcc' and cpp.version().version_compare('<9')
if host_machine.system() == 'linux' and cpp.get_define('_LIBCPP_VERSION', prefix: '#include <new>') == ''
Expand Down Expand Up @@ -83,7 +84,7 @@ if zlib_dep.found()
deps += zlib_dep
endif

if meson.version().version_compare('>= 0.60')
if meson.version().version_compare('>= 0.60') and host_machine.system() != 'freebsd'
iconv_dep = dependency('iconv', disabler: true, required: get_option('iconv'))
else
iconv_dep = dependency('', disabler: true, required: false)
Expand Down
4 changes: 3 additions & 1 deletion src/futils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,16 @@ namespace fs = std::experimental::filesystem;
#endif

#if defined(__FreeBSD__)
#include <libprocstat.h>
// clang-format off
#include <sys/mount.h>
#include <sys/param.h>
#include <sys/queue.h>
#include <sys/socket.h>
#include <sys/sysctl.h>
#include <sys/types.h>
#include <sys/un.h>
#include <libprocstat.h>
// clang-format on
#endif

#ifndef _MAX_PATH
Expand Down
4 changes: 3 additions & 1 deletion src/version.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,14 @@
#elif defined(__APPLE__)
#include <mach-o/dyld.h>
#elif defined(__FreeBSD__)
#include <libprocstat.h>
// clang-format off
#include <sys/param.h>
#include <sys/queue.h>
#include <sys/socket.h>
#include <sys/sysctl.h>
#include <unistd.h>
#include <libprocstat.h>
// clang-format on
#elif defined(__sun__)
#include <dlfcn.h>
#include <link.h>
Expand Down

0 comments on commit 4a26eba

Please sign in to comment.