From 141a2c152c913e5bc4b6eba443baadd5433787d6 Mon Sep 17 00:00:00 2001 From: Rangel Reale Date: Sun, 11 Nov 2012 11:59:36 -0200 Subject: [PATCH 1/3] * use xcode-select to find correct paths for iOS build * add iOS definitions for CMake * ServerApplication on Android must use events instead of signals to wait for server termination. --- CMakeLists.txt | 5 +++++ Util/include/Poco/Util/ServerApplication.h | 3 +++ Util/src/ServerApplication.cpp | 8 ++++++-- build/config/iPhone | 2 +- 4 files changed, 15 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index feaf705c8..67ef6fb09 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -143,6 +143,11 @@ if (${CMAKE_CXX_COMPILER_ID} MATCHES "SunPro") add_definitions( -D_BSD_SOURCE -library=stlport4) endif (${CMAKE_CXX_COMPILER_ID} MATCHES "SunPro") +# iOS +if (IOS) + add_definitions( -DPOCO_HAVE_IPv6 -DPOCO_NO_FPENVIRONMENT -DPOCO_NO_STAT64 -DPOCO_NO_SHAREDLIBS -DPOCO_NO_NET_IFTYPES ) +endif(IOS) + IF (ENABLE_TESTS) add_subdirectory(CppUnit) ENDIF () diff --git a/Util/include/Poco/Util/ServerApplication.h b/Util/include/Poco/Util/ServerApplication.h index 23aa77532..e2274cba4 100644 --- a/Util/include/Poco/Util/ServerApplication.h +++ b/Util/include/Poco/Util/ServerApplication.h @@ -196,6 +196,9 @@ private: void handlePidFile(const std::string& name, const std::string& value); bool isDaemon(int argc, char** argv); void beDaemon(); +#if defined(POCO_ANDROID) + static Poco::Event _terminate; +#endif #elif defined(POCO_OS_FAMILY_WINDOWS) #if !defined(_WIN32_WCE) enum Action diff --git a/Util/src/ServerApplication.cpp b/Util/src/ServerApplication.cpp index 25abdbf58..d9a2883e7 100644 --- a/Util/src/ServerApplication.cpp +++ b/Util/src/ServerApplication.cpp @@ -84,7 +84,7 @@ SERVICE_STATUS ServerApplication::_serviceStatus; SERVICE_STATUS_HANDLE ServerApplication::_serviceStatusHandle = 0; #endif #endif -#if defined(POCO_VXWORKS) +#if defined(POCO_VXWORKS) || defined(POCO_ANDROID) Poco::Event ServerApplication::_terminate; #endif @@ -122,7 +122,7 @@ void ServerApplication::terminate() { #if defined(POCO_OS_FAMILY_WINDOWS) _terminate.set(); -#elif defined(POCO_VXWORKS) +#elif defined(POCO_VXWORKS) || defined(POCO_ANDROID) _terminate.set(); #else Poco::Process::requestTermination(Process::id()); @@ -590,6 +590,7 @@ void ServerApplication::defineOptions(OptionSet& options) // void ServerApplication::waitForTerminationRequest() { +#ifndef POCO_ANDROID sigset_t sset; sigemptyset(&sset); if (!std::getenv("POCO_ENABLE_DEBUGGER")) @@ -601,6 +602,9 @@ void ServerApplication::waitForTerminationRequest() sigprocmask(SIG_BLOCK, &sset, NULL); int sig; sigwait(&sset, &sig); +#else // POCO_ANDROID + _terminate.wait(); +#endif } diff --git a/build/config/iPhone b/build/config/iPhone index be86a3247..70c72e66f 100644 --- a/build/config/iPhone +++ b/build/config/iPhone @@ -30,7 +30,7 @@ IPHONE_SDK_VERSION_MIN ?= $(patsubst %.sdk,%,$(patsubst $(IPHONE_SDK_ROOT_DIR)%, POCO_TARGET_OSNAME ?= $(IPHONE_SDK) POCO_TARGET_OSARCH ?= armv6 -TOOL_PREFIX ?= /Developer/Platforms/$(IPHONE_SDK).platform/Developer/usr/bin +TOOL_PREFIX ?= $(shell xcode-select -print-path)/Platforms/$(IPHONE_SDK).platform/Developer/usr/bin OSFLAGS ?= -arch $(POCO_TARGET_OSARCH) -isysroot $(IPHONE_SDK_BASE) -mthumb -miphoneos-version-min=$(IPHONE_SDK_VERSION_MIN) # From 81b84ad71c6f1117a7cb41cc6e781a256a52be29 Mon Sep 17 00:00:00 2001 From: Rangel Reale Date: Sun, 11 Nov 2012 12:00:21 -0200 Subject: [PATCH 2/3] * added OpenPandora (www.openpandora.org) configuration --- build/config/OpenPandora | 73 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 73 insertions(+) create mode 100644 build/config/OpenPandora diff --git a/build/config/OpenPandora b/build/config/OpenPandora new file mode 100644 index 000000000..84130e6c5 --- /dev/null +++ b/build/config/OpenPandora @@ -0,0 +1,73 @@ +# +# $Id: //poco/1.4/build/config/Angstrom#2 $ +# +# Angstrom +# +# Make settings for Open Embedded/Angstrom +# + +# +# General Settings +# +LINKMODE ?= SHARED +POCO_TARGET_OSNAME = Linux +POCO_TARGET_OSARCH = armv5te +TOOL = arm-none-linux-gnueabi + +# +# Define Tools +# +CC = $(TOOL)-gcc +CXX = $(TOOL)-g++ +LINK = $(CXX) +STRIP = $(TOOL)-strip +LIB = $(TOOL)-ar -cr +RANLIB = $(TOOL)-ranlib +SHLIB = $(CXX) -shared -Wl,-soname,$(notdir $@) -o $@ +SHLIBLN = $(POCO_BASE)/build/script/shlibln +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 = -Isrc +CFLAGS32 = +CFLAGS64 = +CXXFLAGS = +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 = -O3 -DNDEBUG +RELEASEOPT_CXX = -O2 -DNDEBUG +RELEASEOPT_LINK = -O2 + +# +# System Specific Flags +# +SYSFLAGS = -D_XOPEN_SOURCE=500 -D_BSD_SOURCE -D_REENTRANT -D_THREAD_SAFE -DPOCO_NO_FPENVIRONMENT + +# +# System Specific Libraries +# +SYSLIBS = -lpthread -ldl -lrt From 8101b850dc7358dabea2aafa0d0fb2046e07ef34 Mon Sep 17 00:00:00 2001 From: Rangel Reale Date: Sun, 11 Nov 2012 16:49:07 -0200 Subject: [PATCH 3/3] - Android compile fixes --- Net/include/Poco/Net/ICMPv4PacketImpl.h | 2 ++ Net/include/Poco/Net/SocketDefs.h | 10 ++++++++++ Net/src/NetworkInterface.cpp | 10 ++++++++++ 3 files changed, 22 insertions(+) diff --git a/Net/include/Poco/Net/ICMPv4PacketImpl.h b/Net/include/Poco/Net/ICMPv4PacketImpl.h index dc6db4923..d30a076bb 100644 --- a/Net/include/Poco/Net/ICMPv4PacketImpl.h +++ b/Net/include/Poco/Net/ICMPv4PacketImpl.h @@ -69,10 +69,12 @@ public: }; // compile-time shield against misalignment +#ifndef POCO_ANDROID poco_static_assert (offsetof(Header, code) == 0x01); poco_static_assert (offsetof(Header, checksum) == 0x02); poco_static_assert (offsetof(Header, id) == 0x04); poco_static_assert (offsetof(Header, seq) == 0x06); +#endif enum MessageType { diff --git a/Net/include/Poco/Net/SocketDefs.h b/Net/include/Poco/Net/SocketDefs.h index dcb49eef7..efb212dba 100644 --- a/Net/include/Poco/Net/SocketDefs.h +++ b/Net/include/Poco/Net/SocketDefs.h @@ -39,6 +39,16 @@ #ifndef Net_SocketDefs_INCLUDED #define Net_SocketDefs_INCLUDED +#ifndef __THROW +# ifndef __GNUC_PREREQ +# define __GNUC_PREREQ(maj, min) (0) +# endif +# if defined __cplusplus && __GNUC_PREREQ (2,8) +# define __THROW throw () +# else +# define __THROW +# endif +#endif #if defined(POCO_OS_FAMILY_WINDOWS) #include "Poco/UnWindows.h" diff --git a/Net/src/NetworkInterface.cpp b/Net/src/NetworkInterface.cpp index df4f95cd2..6a18dccd3 100644 --- a/Net/src/NetworkInterface.cpp +++ b/Net/src/NetworkInterface.cpp @@ -1276,7 +1276,9 @@ NetworkInterface::Map NetworkInterface::map(bool ipOnly, bool upOnly) #include +#ifndef POCO_ANDROID // Android doesn't have #include +#endif #include #include #include @@ -1306,6 +1308,8 @@ static NetworkInterface::Type fromNative(unsigned arphrd) } } +#ifndef POCO_ANDROID + void setInterfaceParams(struct ifaddrs* iface, NetworkInterfaceImpl& impl) { struct sockaddr_ll* sdl = (struct sockaddr_ll*) iface->ifa_addr; @@ -1317,11 +1321,14 @@ void setInterfaceParams(struct ifaddrs* iface, NetworkInterfaceImpl& impl) impl.setType(fromNative(sdl->sll_hatype)); } +#endif + } NetworkInterface::Map NetworkInterface::map(bool ipOnly, bool upOnly) { +#ifndef POCO_ANDROID FastMutex::ScopedLock lock(_mutex); Map result; unsigned ifIndex = 0; @@ -1420,6 +1427,9 @@ NetworkInterface::Map NetworkInterface::map(bool ipOnly, bool upOnly) if (ifaces) freeifaddrs(ifaces); return result; +#else + throw Poco::NotImplementedException("Not implemented in Android"); +#endif }