* NaCl support

This commit is contained in:
Rangel Reale 2015-03-20 11:28:49 -03:00
parent 9279794ee9
commit d6fcca806e
9 changed files with 162 additions and 9 deletions

View File

@ -39,6 +39,7 @@
#define POCO_OS_QNX 0x000b
#define POCO_OS_VXWORKS 0x000c
#define POCO_OS_CYGWIN 0x000d
#define POCO_OS_NACL 0x000e
#define POCO_OS_UNKNOWN_UNIX 0x00ff
#define POCO_OS_WINDOWS_NT 0x1001
#define POCO_OS_WINDOWS_CE 0x1011
@ -58,6 +59,9 @@
#elif defined(__digital__) || defined(__osf__)
#define POCO_OS_FAMILY_UNIX 1
#define POCO_OS POCO_OS_TRU64
#elif defined(__NACL__)
#define POCO_OS_FAMILY_UNIX 1
#define POCO_OS POCO_OS_NACL
#elif defined(linux) || defined(__linux) || defined(__linux__) || defined(__TOS_LINUX__) || defined(EMSCRIPTEN)
#define POCO_OS_FAMILY_UNIX 1
#define POCO_OS POCO_OS_LINUX

View File

@ -33,7 +33,7 @@
namespace Poco {
#if (POCO_OS == POCO_OS_LINUX) || (POCO_OS == POCO_OS_CYGWIN) || (POCO_OS == POCO_OS_FREE_BSD)
#if (POCO_OS == POCO_OS_LINUX) || (POCO_OS == POCO_OS_CYGWIN) || (POCO_OS == POCO_OS_FREE_BSD) || (POCO_OS == POCO_OS_NACL)
union semun
{
int val;

View File

@ -33,7 +33,7 @@
namespace Poco {
#if (POCO_OS == POCO_OS_LINUX) || (POCO_OS == POCO_OS_CYGWIN) || (POCO_OS == POCO_OS_FREE_BSD)
#if (POCO_OS == POCO_OS_LINUX) || (POCO_OS == POCO_OS_CYGWIN) || (POCO_OS == POCO_OS_FREE_BSD) || (POCO_OS == POCO_OS_NACL)
union semun
{
int val;

View File

@ -67,7 +67,8 @@ std::string PathImpl::homeImpl()
if (pwd)
path = pwd->pw_dir;
else
path = EnvironmentImpl::getImpl("HOME");
if (EnvironmentImpl::hasImpl("HOME"))
path = EnvironmentImpl::getImpl("HOME");
}
std::string::size_type n = path.size();
if (n > 0 && path[n - 1] != '/') path.append("/");

View File

@ -186,7 +186,7 @@ private:
void handlePidFile(const std::string& name, const std::string& value);
bool isDaemon(int argc, char** argv);
void beDaemon();
#if defined(POCO_ANDROID)
#if defined(POCO_ANDROID) || defined(__NACL__)
static Poco::Event _terminate;
#endif
#elif defined(POCO_OS_FAMILY_WINDOWS)

View File

@ -438,7 +438,7 @@ void Application::getApplicationPath(Poco::Path& appPath) const
}
else
{
if (!Path::find(Environment::get("PATH"), _command, appPath))
if (!Environment::has("PATH") || !Path::find(Environment::get("PATH"), _command, appPath))
appPath = Path(_workingDirAtLaunch, _command);
appPath.makeAbsolute();
}

View File

@ -64,7 +64,7 @@ SERVICE_STATUS ServerApplication::_serviceStatus;
SERVICE_STATUS_HANDLE ServerApplication::_serviceStatusHandle = 0;
#endif
#endif
#if defined(POCO_VXWORKS) || defined(POCO_ANDROID)
#if defined(POCO_VXWORKS) || defined(POCO_ANDROID) || defined(__NACL__)
Poco::Event ServerApplication::_terminate;
#endif
@ -102,7 +102,7 @@ void ServerApplication::terminate()
{
#if defined(POCO_OS_FAMILY_WINDOWS)
_terminate.set();
#elif defined(POCO_VXWORKS) || defined(POCO_ANDROID)
#elif defined(POCO_VXWORKS) || defined(POCO_ANDROID) || defined(__NACL__)
_terminate.set();
#else
Poco::Process::requestTermination(Process::id());
@ -592,7 +592,7 @@ void ServerApplication::defineOptions(OptionSet& options)
//
void ServerApplication::waitForTerminationRequest()
{
#ifndef POCO_ANDROID
#if !defined(POCO_ANDROID) && !defined(__NACL__)
sigset_t sset;
sigemptyset(&sset);
if (!std::getenv("POCO_ENABLE_DEBUGGER"))
@ -604,7 +604,7 @@ void ServerApplication::waitForTerminationRequest()
sigprocmask(SIG_BLOCK, &sset, NULL);
int sig;
sigwait(&sset, &sig);
#else // POCO_ANDROID
#else // POCO_ANDROID || __NACL__
_terminate.wait();
#endif
}

74
build/config/NaCl-x86 Normal file
View File

@ -0,0 +1,74 @@
#
# $Id: //poco/1.4/build/config/Linux#2 $
#
# Linux
#
# Make settings for Linux 2.6/gcc 3.3
#
#
#
# General Settings
#
LINKMODE ?= SHARED
POCO_TARGET_OSNAME = NaCl
POCO_TARGET_OSARCH = i686
CROSS_COMPILE = i686-nacl-
#
# Define Tools
#
CC = ${CROSS_COMPILE}gcc
CXX = ${CROSS_COMPILE}g++
LINK = $(CXX)
LIB = ${AR} -cr
RANLIB = ${CROSS_COMPILE}ranlib
SHLIB = $(CXX) -shared -Wl,-soname,$(notdir $@) -o $@
SHLIBLN = $(POCO_BASE)/build/script/shlibln
STRIP = ${CROSS_COMPILE}strip
DEP = $(POCO_BASE)/build/script/makedepend.gcc
SHELL = sh
RM = rm -rf
CP = cp
MKDIR = mkdir -p
#
# Extension for Shared Libraries
#
SHAREDLIBEXT = .so.$(target_version)
SHAREDLIBLINKEXT = .so
#
# Compiler and Linker Flags
#
CFLAGS =
CFLAGS32 =
CFLAGS64 =
CXXFLAGS = -Wall -Wno-sign-compare
CXXFLAGS32 =
CXXFLAGS64 =
LINKFLAGS =
LINKFLAGS32 =
LINKFLAGS64 =
STATICOPT_CC =
STATICOPT_CXX =
STATICOPT_LINK = -static
SHAREDOPT_CC = -fPIC
SHAREDOPT_CXX = -fPIC
SHAREDOPT_LINK = -Wl,-rpath,$(LIBPATH)
DEBUGOPT_CC = -g -D_DEBUG
DEBUGOPT_CXX = -g -D_DEBUG
DEBUGOPT_LINK = -g
RELEASEOPT_CC = -O2 -DNDEBUG
RELEASEOPT_CXX = -O2 -DNDEBUG
RELEASEOPT_LINK = -O2
#
# System Specific Flags
#
SYSFLAGS = -D_XOPEN_SOURCE=500 -D_REENTRANT -D_THREAD_SAFE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -DPOCO_HAVE_FD_EPOLL -D__NACL__
#
# System Specific Libraries
#
SYSLIBS = -lpthread -ldl -lrt

74
build/config/NaCl-x86_64 Normal file
View File

@ -0,0 +1,74 @@
#
# $Id: //poco/1.4/build/config/Linux#2 $
#
# Linux
#
# Make settings for Linux 2.6/gcc 3.3
#
#
#
# General Settings
#
LINKMODE ?= SHARED
POCO_TARGET_OSNAME = NaCl
POCO_TARGET_OSARCH = x86_64
CROSS_COMPILE = x86_64-nacl-
#
# Define Tools
#
CC = ${CROSS_COMPILE}gcc
CXX = ${CROSS_COMPILE}g++
LINK = $(CXX)
LIB = ${AR} -cr
RANLIB = ${CROSS_COMPILE}ranlib
SHLIB = $(CXX) -shared -Wl,-soname,$(notdir $@) -o $@
SHLIBLN = $(POCO_BASE)/build/script/shlibln
STRIP = ${CROSS_COMPILE}strip
DEP = $(POCO_BASE)/build/script/makedepend.gcc
SHELL = sh
RM = rm -rf
CP = cp
MKDIR = mkdir -p
#
# Extension for Shared Libraries
#
SHAREDLIBEXT = .so.$(target_version)
SHAREDLIBLINKEXT = .so
#
# Compiler and Linker Flags
#
CFLAGS =
CFLAGS32 =
CFLAGS64 =
CXXFLAGS = -Wall -Wno-sign-compare
CXXFLAGS32 =
CXXFLAGS64 =
LINKFLAGS =
LINKFLAGS32 =
LINKFLAGS64 =
STATICOPT_CC = -fPIC
STATICOPT_CXX = -fPIC
STATICOPT_LINK = -static
SHAREDOPT_CC = -fPIC
SHAREDOPT_CXX = -fPIC
SHAREDOPT_LINK = -Wl,-rpath,$(LIBPATH)
DEBUGOPT_CC = -g -D_DEBUG
DEBUGOPT_CXX = -g -D_DEBUG
DEBUGOPT_LINK = -g
RELEASEOPT_CC = -O2 -DNDEBUG
RELEASEOPT_CXX = -O2 -DNDEBUG
RELEASEOPT_LINK = -O2
#
# System Specific Flags
#
SYSFLAGS = -D_XOPEN_SOURCE=500 -D_REENTRANT -D_THREAD_SAFE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -DPOCO_HAVE_FD_EPOLL -D__NACL__
#
# System Specific Libraries
#
SYSLIBS = -lpthread -ldl -lrt