Preliminary support for DragonFly BSD

- It builds but no further testing has been done.
This commit is contained in:
Antonio Huete Jimenez 2016-12-15 02:27:53 -08:00
parent b97a2f72db
commit b00da61eab
8 changed files with 23 additions and 14 deletions

View file

@ -149,12 +149,15 @@ message(STATUS "Building for a ${ARCH_WIDTH}-bit system")
# Check if we're on FreeBSD so we can exclude the local miniupnpc (it should be installed from ports instead) # Check if we're on FreeBSD so we can exclude the local miniupnpc (it should be installed from ports instead)
# CMAKE_SYSTEM_NAME checks are commonly known, but specifically taken from libsdl's CMakeLists # CMAKE_SYSTEM_NAME checks are commonly known, but specifically taken from libsdl's CMakeLists
if(CMAKE_SYSTEM_NAME MATCHES "kFreeBSD.*") if(CMAKE_SYSTEM_NAME MATCHES "kFreeBSD.*|FreeBSD")
set(FREEBSD TRUE)
elseif(CMAKE_SYSTEM_NAME MATCHES "DragonFly.*|FreeBSD")
set(FREEBSD TRUE) set(FREEBSD TRUE)
endif() endif()
# Check if we're on DragonFly BSD. See the README.md for build instructions.
if(CMAKE_SYSTEM_NAME MATCHES "DragonFly.*")
set(DRAGONFLY TRUE)
endif()
# Check if we're on OpenBSD. See the README.md for build instructions. # Check if we're on OpenBSD. See the README.md for build instructions.
if(CMAKE_SYSTEM_NAME MATCHES "kOpenBSD.*|OpenBSD.*") if(CMAKE_SYSTEM_NAME MATCHES "kOpenBSD.*|OpenBSD.*")
set(OPENBSD TRUE) set(OPENBSD TRUE)
@ -519,7 +522,7 @@ else()
set(RELEASE_FLAGS "${RELEASE_FLAGS} -ffat-lto-objects") set(RELEASE_FLAGS "${RELEASE_FLAGS} -ffat-lto-objects")
endif() endif()
# Since gcc 4.9 the LTO format is non-standard (slim), so we need the gcc-specific ar and ranlib binaries # Since gcc 4.9 the LTO format is non-standard (slim), so we need the gcc-specific ar and ranlib binaries
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND NOT (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.9.0) AND NOT OPENBSD) if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND NOT (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.9.0) AND NOT OPENBSD AND NOT DRAGONFLY)
# When invoking cmake on distributions on which gcc's binaries are prefixed # When invoking cmake on distributions on which gcc's binaries are prefixed
# with an arch-specific triplet, the user must specify -DCHOST=<prefix> # with an arch-specific triplet, the user must specify -DCHOST=<prefix>
if (DEFINED CHOST) if (DEFINED CHOST)
@ -544,7 +547,7 @@ else()
# On Windows, this is as close to fully-static as we get: # On Windows, this is as close to fully-static as we get:
# this leaves only deps on /c/Windows/system32/*.dll # this leaves only deps on /c/Windows/system32/*.dll
set(STATIC_FLAGS "-static") set(STATIC_FLAGS "-static")
elseif (NOT (APPLE OR FREEBSD OR OPENBSD)) elseif (NOT (APPLE OR FREEBSD OR OPENBSD OR DRAGONFLY))
# On Linux, we don't support fully static build, but these can be static # On Linux, we don't support fully static build, but these can be static
set(STATIC_FLAGS "-static-libgcc -static-libstdc++") set(STATIC_FLAGS "-static-libgcc -static-libstdc++")
endif() endif()
@ -579,6 +582,9 @@ if(MINGW)
set(EXTRA_LIBRARIES mswsock;ws2_32;iphlpapi) set(EXTRA_LIBRARIES mswsock;ws2_32;iphlpapi)
elseif(APPLE OR FREEBSD OR OPENBSD) elseif(APPLE OR FREEBSD OR OPENBSD)
set(EXTRA_LIBRARIES "") set(EXTRA_LIBRARIES "")
elseif(DRAGONFLY)
find_library(COMPAT compat)
set(EXTRA_LIBRARIES ${COMPAT})
elseif(NOT MSVC) elseif(NOT MSVC)
find_library(RT rt) find_library(RT rt)
set(EXTRA_LIBRARIES ${RT}) set(EXTRA_LIBRARIES ${RT})

View file

@ -32,10 +32,10 @@ endif (NO_GETADDRINFO)
if (NOT WIN32) if (NOT WIN32)
add_definitions (-DMINIUPNPC_SET_SOCKET_TIMEOUT) add_definitions (-DMINIUPNPC_SET_SOCKET_TIMEOUT)
add_definitions (-D_BSD_SOURCE -D_DEFAULT_SOURCE) add_definitions (-D_BSD_SOURCE -D_DEFAULT_SOURCE)
if (NOT CMAKE_SYSTEM_NAME STREQUAL "Darwin" AND NOT CMAKE_SYSTEM_NAME STREQUAL "FreeBSD") if (NOT CMAKE_SYSTEM_NAME STREQUAL "Darwin" AND NOT CMAKE_SYSTEM_NAME STREQUAL "FreeBSD" AND NOT CMAKE_SYSTEM_NAME STREQUAL "DragonFly")
# add_definitions (-D_POSIX_C_SOURCE=200112L) # add_definitions (-D_POSIX_C_SOURCE=200112L)
add_definitions (-D_XOPEN_SOURCE=600) add_definitions (-D_XOPEN_SOURCE=600)
endif (NOT CMAKE_SYSTEM_NAME STREQUAL "Darwin" AND NOT CMAKE_SYSTEM_NAME STREQUAL "FreeBSD") endif (NOT CMAKE_SYSTEM_NAME STREQUAL "Darwin" AND NOT CMAKE_SYSTEM_NAME STREQUAL "FreeBSD" AND NOT CMAKE_SYSTEM_NAME STREQUAL "DragonFly")
else (NOT WIN32) else (NOT WIN32)
add_definitions (-D_WIN32_WINNT=0x0501) # XP or higher for getnameinfo and friends add_definitions (-D_WIN32_WINNT=0x0501) # XP or higher for getnameinfo and friends
endif (NOT WIN32) endif (NOT WIN32)

View file

@ -42,7 +42,7 @@
#include "crypto.h" #include "crypto.h"
#include "hash.h" #include "hash.h"
#if !defined(__FreeBSD__) && !defined(__OpenBSD__) #if !defined(__FreeBSD__) && !defined(__OpenBSD__) && !defined(__DragonFly__)
#include <alloca.h> #include <alloca.h>
#else #else
#include <stdlib.h> #include <stdlib.h>

View file

@ -34,7 +34,8 @@
#include <stdio.h> #include <stdio.h>
// OS X, FreeBSD, and OpenBSD don't need malloc.h // OS X, FreeBSD, and OpenBSD don't need malloc.h
#if !defined(__APPLE__) && !defined(__FreeBSD__) && !defined(__OpenBSD__) #if !defined(__APPLE__) && !defined(__FreeBSD__) && !defined(__OpenBSD__) \
&& !defined(__DragonFly__)
#include <malloc.h> #include <malloc.h>
#endif #endif

View file

@ -442,7 +442,8 @@ void slow_hash_allocate_state(void)
hp_state = (uint8_t *) VirtualAlloc(hp_state, MEMORY, MEM_LARGE_PAGES | hp_state = (uint8_t *) VirtualAlloc(hp_state, MEMORY, MEM_LARGE_PAGES |
MEM_COMMIT | MEM_RESERVE, PAGE_READWRITE); MEM_COMMIT | MEM_RESERVE, PAGE_READWRITE);
#else #else
#if defined(__APPLE__) || defined(__FreeBSD__) || defined(__OpenBSD__) #if defined(__APPLE__) || defined(__FreeBSD__) || defined(__OpenBSD__) || \
defined(__DragonFly__)
hp_state = mmap(0, MEMORY, PROT_READ | PROT_WRITE, hp_state = mmap(0, MEMORY, PROT_READ | PROT_WRITE,
MAP_PRIVATE | MAP_ANON, 0, 0); MAP_PRIVATE | MAP_ANON, 0, 0);
#else #else

View file

@ -34,7 +34,7 @@
#include "hash-ops.h" #include "hash-ops.h"
#if !defined(__FreeBSD__) && !defined(__OpenBSD__) #if !defined(__FreeBSD__) && !defined(__OpenBSD__) && !defined(__DragonFly__)
#include <alloca.h> #include <alloca.h>
#else #else
#include <stdlib.h> #include <stdlib.h>

View file

@ -40,7 +40,7 @@
void set_process_affinity(int core) void set_process_affinity(int core)
{ {
#if defined (__APPLE__) || defined(__FreeBSD__) || defined(__OpenBSD__) #if defined (__APPLE__) || defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__DragonFly__)
return; return;
#elif defined(BOOST_WINDOWS) #elif defined(BOOST_WINDOWS)
DWORD_PTR mask = 1; DWORD_PTR mask = 1;
@ -62,7 +62,7 @@ void set_process_affinity(int core)
void set_thread_high_priority() void set_thread_high_priority()
{ {
#if defined(__APPLE__) || defined(__FreeBSD__) || defined(__OpenBSD__) #if defined(__APPLE__) || defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__DragonFly__)
return; return;
#elif defined(BOOST_WINDOWS) #elif defined(BOOST_WINDOWS)
::SetPriorityClass(::GetCurrentProcess(), HIGH_PRIORITY_CLASS); ::SetPriorityClass(::GetCurrentProcess(), HIGH_PRIORITY_CLASS);

View file

@ -36,7 +36,8 @@
#include "gtest/gtest.h" #include "gtest/gtest.h"
// OS X, FreeBSD, and OpenBSD don't need malloc.h // OS X, FreeBSD, and OpenBSD don't need malloc.h
#if !defined(__APPLE__) && !defined(__FreeBSD__) && !defined(__OpenBSD__) #if !defined(__APPLE__) && !defined(__FreeBSD__) && !defined(__OpenBSD__) && \
!defined(__DragonFly__)
#include <malloc.h> #include <malloc.h>
#endif #endif