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() endif()
# Handle OpenSSL, used for sha256sum on binary updates and light wallet ssl http # 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 (APPLE AND NOT IOS)
if (NOT OpenSSL_DIR) if (NOT OpenSSL_DIR)
EXECUTE_PROCESS(COMMAND brew --prefix openssl EXECUTE_PROCESS(COMMAND brew --prefix openssl
@ -675,6 +679,8 @@ elseif(FREEBSD)
elseif(DRAGONFLY) elseif(DRAGONFLY)
find_library(COMPAT compat) find_library(COMPAT compat)
set(EXTRA_LIBRARIES execinfo ${COMPAT}) set(EXTRA_LIBRARIES execinfo ${COMPAT})
elseif(CMAKE_SYSTEM_NAME MATCHES "(SunOS|Solaris)")
set(EXTRA_LIBRARIES socket nsl resolv)
elseif(NOT MSVC) elseif(NOT MSVC)
find_library(RT rt) find_library(RT rt)
set(EXTRA_LIBRARIES ${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` 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): ### On Linux for Android (using docker):
# Build image (select android64.Dockerfile for aarch64) # 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_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" AND NOT CMAKE_SYSTEM_NAME STREQUAL "DragonFly") 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) 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

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

View file

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

View file

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

View file

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

View file

@ -31,8 +31,13 @@
#pragma once #pragma once
#if defined(__GNUC__) #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 INITIALIZER(name) __attribute__((constructor(101))) static void name(void)
#define FINALIZER(name) __attribute__((destructor(101))) static void name(void) #define FINALIZER(name) __attribute__((destructor(101))) static void name(void)
#endif
#define REGISTER_FINALIZER(name) ((void) 0) #define REGISTER_FINALIZER(name) ((void) 0)
#elif defined(_MSC_VER) #elif defined(_MSC_VER)

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__) || defined(__DragonFly__) #if defined (__APPLE__) || defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__DragonFly__) || defined(__sun)
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__) || defined(__DragonFly__) #if defined(__APPLE__) || defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__DragonFly__) || defined(__sun)
return; return;
#elif defined(BOOST_WINDOWS) #elif defined(BOOST_WINDOWS)
::SetPriorityClass(::GetCurrentProcess(), HIGH_PRIORITY_CLASS); ::SetPriorityClass(::GetCurrentProcess(), HIGH_PRIORITY_CLASS);