make this build on SunOS/Solaris

This commit is contained in:
Pavel Maryanov 2017-10-10 14:05:28 +01:00 committed by moneromooo-monero
parent f48aeab5c4
commit a17efcb039
No known key found for this signature in database
GPG key ID: 686F07454D6CEFC3
9 changed files with 42 additions and 3 deletions

View file

@ -331,6 +331,10 @@ if (UNIX AND NOT APPLE)
endif()
# Handle OpenSSL, used for sha256sum on binary updates and light wallet ssl http
if (CMAKE_SYSTEM_NAME MATCHES "(SunOS|Solaris)")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pthreads")
endif ()
if (APPLE AND NOT IOS)
if (NOT OpenSSL_DIR)
EXECUTE_PROCESS(COMMAND brew --prefix openssl
@ -675,6 +679,8 @@ elseif(FREEBSD)
elseif(DRAGONFLY)
find_library(COMPAT compat)
set(EXTRA_LIBRARIES execinfo ${COMPAT})
elseif(CMAKE_SYSTEM_NAME MATCHES "(SunOS|Solaris)")
set(EXTRA_LIBRARIES socket nsl resolv)
elseif(NOT MSVC)
find_library(RT rt)
set(EXTRA_LIBRARIES ${RT})

View file

@ -430,6 +430,17 @@ doas make install
Build monero: `env DEVELOPER_LOCAL_TOOLS=1 BOOST_ROOT=/usr/local make release-static`
### On Solaris:
The default Solaris linker can't be used, you have to install GNU ld, then run cmake manually with the path to your copy of GNU ld:
mkdir -p build/release
cd build/release
cmake -DCMAKE_LINKER=/path/to/ld -D CMAKE_BUILD_TYPE=Release ../..
cd ../..
Then you can run make as usual.
### On Linux for Android (using docker):
# Build image (select android64.Dockerfile for aarch64)

View file

@ -36,6 +36,9 @@ if (NOT WIN32)
# add_definitions (-D_POSIX_C_SOURCE=200112L)
add_definitions (-D_XOPEN_SOURCE=600)
endif (NOT CMAKE_SYSTEM_NAME STREQUAL "Darwin" AND NOT CMAKE_SYSTEM_NAME STREQUAL "FreeBSD" AND NOT CMAKE_SYSTEM_NAME STREQUAL "DragonFly")
if (CMAKE_SYSTEM_NAME MATCHES "(SunOS|Solaris)")
add_definitions (-D__EXTENSIONS__ -std=c99)
endif ()
else (NOT WIN32)
add_definitions (-D_WIN32_WINNT=0x0501) # XP or higher for getnameinfo and friends
endif (NOT WIN32)

View file

@ -44,7 +44,12 @@ endif ()
set(RETSIGTYPE void)
if(CMAKE_SYSTEM_NAME MATCHES "(SunOS|Solaris)")
add_definitions(-D_XOPEN_SOURCE=600)
else()
add_definitions(-D_GNU_SOURCE)
endif()
add_definitions(-std=c99)
option(USE_ECDSA "Use ECDSA algorithms" ON)
option(USE_SHA2 "Enable SHA2 support" ON)

View file

@ -49,6 +49,11 @@ if (WIN32)
iphlpapi
ws2_32)
endif ()
if (CMAKE_SYSTEM_NAME MATCHES "(SunOS|Solaris)")
set(CMAKE_REQUIRED_LIBRARIES
socket
nsl)
endif ()
check_function_exists(_beginthreadex HAVE__BEGINTHREADEX)
check_function_exists(arc4random HAVE_ARC4RANDOM)

View file

@ -40,6 +40,10 @@
#include <byteswap.h>
#endif
#if defined(__sun) && defined(__SVR4)
#include <endian.h>
#endif
#if defined(_MSC_VER)
#include <stdlib.h>

View file

@ -405,7 +405,7 @@ namespace tools
#else
std::string get_nix_version_display_string()
{
utsname un;
struct utsname un;
if(uname(&un) < 0)
return std::string("*nix: failed to get os version");

View file

@ -31,8 +31,13 @@
#pragma once
#if defined(__GNUC__)
#if defined(__sun) && defined(__SVR4)
#define INITIALIZER(name) __attribute__((constructor)) static void name(void)
#define FINALIZER(name) __attribute__((destructor)) static void name(void)
#else
#define INITIALIZER(name) __attribute__((constructor(101))) static void name(void)
#define FINALIZER(name) __attribute__((destructor(101))) static void name(void)
#endif
#define REGISTER_FINALIZER(name) ((void) 0)
#elif defined(_MSC_VER)

View file

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