From 3edc21dfc5182d4e96888b1667f05f9aaef88623 Mon Sep 17 00:00:00 2001 From: Andreas Baumann Date: Sat, 30 May 2015 17:21:37 +0200 Subject: ported and added docu for NetBSD --- INSTALL | 21 +++++++++++++++++++++ src/GNUmakefile | 6 ++++++ src/system.c | 14 ++++++++++---- 3 files changed, 37 insertions(+), 4 deletions(-) diff --git a/INSTALL b/INSTALL index d1712ee..e5be7e6 100644 --- a/INSTALL +++ b/INSTALL @@ -61,6 +61,27 @@ Install the following packages via 'pkg install' (pkgng) or via ports: * nanomsg * libdaemon * libmicrohttpd + +NetBSD 6 +-------- + +Install the following packages via 'pkgin install': + + * gengetopt + * libconfuse + * json-c + * libdaemon + * libmicrohttpd + +nanomsg you have to build on your own: + + ./configure --prefix=/usr/local + gmake + gmake install + +Make sure '/usr/pkg/bin' is part of your PATH (for 'pkg-config' to be found). +Make sure '/usr/pkg/lib' and '/usr/local/lib' are part of your +LD_LIBRARY_PATH. Building on Windows ------------------- diff --git a/src/GNUmakefile b/src/GNUmakefile index 2f32b49..bba3ad0 100644 --- a/src/GNUmakefile +++ b/src/GNUmakefile @@ -8,8 +8,14 @@ CFLAGS = -g -O0 -std=c99 -Wall -pedantic -D_XOPEN_SOURCE=600 -D_DEFAULT_SOURCE #CFLAGS = -g CFLAGS += -I/usr/local/include -I3rdParty/linenoise -I3rdParty/http_tiny CFLAGS += `pkg-config --cflags glib-2.0` +CFLAGS += `pkg-config --cflags libconfuse` +CFLAGS += `pkg-config --cflags json-c` +CFLAGS += `pkg-config --cflags libmicrohttpd` LDFLAGS = -L/usr/local/lib LDFLAGS += `pkg-config --libs-only-L glib-2.0` +LDFLAGS += `pkg-config --libs-only-L libconfuse` +LDFLAGS += `pkg-config --libs-only-L json-c` +LDFLAGS += `pkg-config --libs-only-L libmicrohttpd` LIBS = -lconfuse -lpthread -lnanomsg -ljson-c -lmicrohttpd LIBS += `pkg-config --libs-only-l glib-2.0` diff --git a/src/system.c b/src/system.c index c1a2ee3..07eab37 100644 --- a/src/system.c +++ b/src/system.c @@ -1,6 +1,8 @@ -#include "system.h" +#ifdef __NetBSD__ +#define _NETBSD_SOURCE +#endif -#include "port.h" +#include "system.h" #ifdef _WIN32 #define WIN32_LEAN_AND_MEAN @@ -13,6 +15,10 @@ #else /* __FreeBSD__ */ #include #include +#ifdef __NetBSD__ +#include +#else /* __NetBSD__ */ +#endif /* __NetBSD__ */ #endif /* __FreeBSD__ */ #endif /* _WIN32 */ @@ -342,7 +348,7 @@ void system_os( char *name, size_t len ) fclose( f ) ; -#elif defined( __FreeBSD__ ) +#elif defined( __FreeBSD__ ) || defined( __NetBSD__ ) /* resort to uname */ struct utsname uts; uname( &uts ); @@ -391,7 +397,7 @@ unsigned int system_phys_memory( ) memState.dwLength = sizeof( MEMORYSTATUSEX ); GlobalMemoryStatusEx( &memState ); return memState.ullTotalPhys / 1024; -#elif defined( linux ) || defined( __linux ) || defined( __linux__ ) || defined( __FreeBSD__ ) +#elif defined( linux ) || defined( __linux ) || defined( __linux__ ) || defined( __FreeBSD__ ) || defined( __NetBSD__ ) size_t pageSize; size_t nofPages; -- cgit v1.2.3-54-g00ecf