Added target support for Apple's iOS devices.

Tom Pelaia II and Mark Engbretson contributed the build configuration
and OS-dependent files, I modified the build config to bring it up to
R3.14.12 standards and added the Release Notes.
This commit is contained in:
Andrew Johnson
2010-09-22 16:26:15 -05:00
parent a9b5f0c6a0
commit 4e99cfc763
12 changed files with 448 additions and 2 deletions

View File

@@ -0,0 +1,22 @@
# CONFIG.Common.ios-arm
#
# This file is maintained by the build community.
#
# Definitions for ios-arm target builds
#-------------------------------------------------------
IOS_PLATFORM = iPhoneOS
#
# Architecture-specific information
#
ARCH_CLASS = armv6
OP_SYS_CFLAGS += -fno-inline-functions
# iOS optimization flags for arm architecture
OPT_CFLAGS_YES = -O2
OPT_CXXFLAGS_YES = -O2
# Include definitions common to all iphone targets
include $(CONFIG)/os/CONFIG.Common.iosCommon

View File

@@ -0,0 +1,16 @@
# CONFIG.Common.ios-x86
#
# This file is maintained by the build community.
#
# Definitions for ios-x86 target builds
#-------------------------------------------------------
IOS_PLATFORM = iPhoneSimulator
#
# Architecture-specific information
#
ARCH_CLASS = i386
# Include definitions common to all iOS targets
include $(CONFIG)/os/CONFIG.Common.iosCommon

View File

@@ -0,0 +1,86 @@
# CONFIG.Common.iosCommon
#
# $Id$
# This file is maintained by the build community.
#
# Definitions for iOS target archs
# Sites may override these definitions in CONFIG_SITE.Common.iosCommon
# or CONFIG_SITE.<host>.iosCommon
#-------------------------------------------------------
# Include definitions common to all Unix targets
include $(CONFIG)/os/CONFIG.Common.UnixCommon
# Include common gnu compiler definitions
include $(CONFIG)/CONFIG.gnuCommon
#-------------------------------------------------------
# Valid build types
VALID_BUILDS = Ioc
#-------------------------------------------------------
# operating system class (include/os/<os_class>)
OS_CLASS = iOS
#--------------------------------------------------
# GNU and SDK directories
GNU_DIR = $(PLATFORM_DIR)/Developer/usr
SDK_DIR = $(PLATFORM_DIR)/Developer/SDKs/$(IOS_PLATFORM)$(IOS_VERSION).sdk
#-------------------------------------------------------
# Build architecture flags
ARCH_DEP_CFLAGS += -arch $(ARCH_CLASS)
ARCH_DEP_LDFLAGS += -arch $(ARCH_CLASS)
#--------------------------------------------------
# Operating system flags
OP_SYS_CFLAGS += -isysroot $(SDK_DIR) -D__IPHONE_OS_VERSION_MIN_REQUIRED=30200
#--------------------------------------------------
# Don't try to use precompiled headers when converting sequencer files
CPPSNCFLAGS += -no-cpp-precomp
#--------------------------------------------------
# Always compile in debugging symbol table information
#
OPT_CFLAGS_YES += -g
OPT_CXXFLAGS_YES += -g
#-------------------------------------------------------
# Compiler definitions:
# Use clang instead of gcc
# Must use g++ still
CC = $(GNU_BIN)/clang
CCC = $(GNU_BIN)/c++
#-------------------------------------------------------
# Linker flags
OP_SYS_LDFLAGS += -dynamic -Z -L$(SDK_DIR)/usr/lib
#-------------------------------------------------------
# Shared libraries
SHRLIB_VERSION = $(EPICS_VERSION).$(EPICS_REVISION).$(EPICS_MODIFICATION)
SHRLIB_LDFLAGS = -dynamiclib -flat_namespace -undefined suppress \
-install_name $(shell perl $(TOOLS)/fullPathName.pl $(INSTALL_LIB))/$@ \
-compatibility_version $(EPICS_VERSION).$(EPICS_REVISION) \
-current_version $(SHRLIB_VERSION)
SHRLIB_SUFFIX = .$(SHRLIB_VERSION).dylib
LOADABLE_SHRLIB_LDFLAGS = -bundle -flat_namespace -undefined suppress
#--------------------------------------------------
# code flags
CODE_CFLAGS = -fno-common -Wno-unused-value
CODE_CXXFLAGS = -fno-common
#
# Add support for Objective-C source
#
vpath %.m $(USR_VPATH) $(ALL_SRC_DIRS)
%.o: %.m
$(COMPILE.c) -c $<
#--------------------------------------------------
# Allow site overrides
-include $(CONFIG)/os/CONFIG_SITE.Common.iosCommon
-include $(CONFIG)/os/CONFIG_SITE.$(EPICS_HOST_ARCH).iosCommon

View File

@@ -0,0 +1,24 @@
# CONFIG_SITE.Common.iosCommon
#
# $Id$
# This file is maintained by the build community.
#
# Site-specific settings for Apple iOS builds
#-------------------------------------------------------
# iOS Version number
#IOS_VERSION = 3.2
IOS_VERSION = 4.1
# Most sites will want shared libraries
STATIC_BUILD=NO
SHARED_LIBRARIES=YES
# Platform path, this is probably correct
XCODE_PATH := $(shell xcode-select -print-path)
PLATFORM_DIR = $(XCODE_PATH)/Platforms/$(IOS_PLATFORM).platform

View File

@@ -1,7 +1,11 @@
# CONFIG_SITE.darwin-x86.Common
#
# $Id$
# This file is maintained by the build community.
#
# $Id$
# Site override definitions for darwin-x86 host builds
#-------------------------------------------------------
# Uncomment the following line to cross-compile the
# iOS device (arm) and simulator (x86) binaries
#CROSS_COMPILER_TARGET_ARCHS = ios-arm ios-x86

View File

@@ -12,9 +12,20 @@
<h2 align="center">Changes between 3.14.11 and 3.14.12</h2>
<!-- Insert new items immediately below here ... -->
<h4>Added Apple iOS target architectures</h4>
<p>Tom Pelaia II and Mark Engbretson contributed build configuration files to
cross-compile Base for Apple's iOS operating system as used in the iPhone and
iPad. The target architecture for these is ios-arm, and there is also an ios-x86
target which compiles for the iPhone Simulator running on darwin-x86.</p>
<p>To build these for iOS, uncomment the <tt>CROSS_COMPILER_TARGET_ARCHS</tt>
definition in <tt>configure/os/CONFIG_SITE.darwin-x86.Common</tt> and check the
settings in <tt>configure/os/CONFIG_SITE.Common.iosCommon</tt>.</p>
<h4>Dynamic arrays over CA</h4>
<p>Dymanic array sizing was developed by Michael Abbott at the 2010 EPICS
<p>Dynamic array sizing was developed by Michael Abbott at the 2010 EPICS
Codeathon. It permits a CA client to fetch only the currently valid elements of
an array by specifying a COUNT of zero to either of the ca_array_get_callback()
or ca_create_subscription() routines. It has never before been legal to pass a

View File

@@ -0,0 +1,27 @@
/*************************************************************************\
* Copyright (c) 2010 UChicago Argonne LLC, as Operator of Argonne
* National Laboratory.
* EPICS BASE is distributed subject to a Software License Agreement found
* in file LICENSE that is included with this distribution.
\*************************************************************************/
#ifndef epicsMathh
#define epicsMathh
#include <math.h>
#include <shareLib.h>
#define finite(x) isfinite(x)
#ifdef __cplusplus
extern "C" {
#endif
epicsShareExtern float epicsNAN;
epicsShareExtern float epicsINF;
#ifdef __cplusplus
}
#endif
#endif /* epicsMathh */

View File

@@ -0,0 +1,78 @@
/*************************************************************************\
* Copyright (c) 2002 The University of Saskatchewan
* EPICS BASE is distributed subject to a Software License Agreement found
* in file LICENSE that is included with this distribution.
\*************************************************************************/
/* osdEnv.c */
/*
* $Id$
*
* Author: Eric Norum
* Date: May 7, 2001
*
* Routines to modify/display environment variables and EPICS parameters
*
*/
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#include <ctype.h>
#include <errno.h>
#define epicsExportSharedSymbols
#include <epicsStdioRedirect.h>
#include <errlog.h>
#include <cantProceed.h>
#include <envDefs.h>
#include <osiUnistd.h>
#include "epicsFindSymbol.h"
/*
* Set the value of an environment variable
* Leaks memory, but the assumption is that this routine won't be
* called often enough for the leak to be a problem.
*/
epicsShareFunc void epicsShareAPI epicsEnvSet (const char *name, const char *value)
{
char *cp;
cp = mallocMustSucceed (strlen (name) + strlen (value) + 2, "epicsEnvSet");
strcpy (cp, name);
strcat (cp, "=");
strcat (cp, value);
if (putenv (cp) < 0) {
errPrintf(
-1L,
__FILE__,
__LINE__,
"Failed to set environment parameter \"%s\" to \"%s\": %s\n",
name,
value,
strerror (errno));
free (cp);
}
}
/*
* Show the value of the specified, or all, environment variables
*/
epicsShareFunc void epicsShareAPI epicsEnvShow (const char *name)
{
if (name == NULL) {
extern char **environ;
char **sp;
for (sp = environ ; (sp != NULL) && (*sp != NULL) ; sp++)
printf ("%s\n", *sp);
}
else {
const char *cp = getenv (name);
if (cp == NULL)
printf ("%s is not an environment variable.\n", name);
else
printf ("%s=%s\n", name, cp);
}
}

View File

@@ -0,0 +1,82 @@
/*************************************************************************\
* Copyright (c) 2002 The University of Saskatchewan
* EPICS BASE is distributed subject to a Software License Agreement found
* in file LICENSE that is included with this distribution.
\*************************************************************************/
/*
* $Id$
*
* Author: Eric Norum
*/
#ifndef osdSockH
#define osdSockH
#ifdef __cplusplus
extern "C" {
#endif
#include <errno.h>
#include <sys/types.h>
#include <sys/param.h> /* for MAXHOSTNAMELEN */
#include <sys/time.h>
#include <sys/socket.h>
#include <sys/ioctl.h>
/*#include <sys/filio.h>
#include <sys/sockio.h>*/
#include <netinet/in.h>
#include <netinet/tcp.h>
#include <arpa/inet.h>
#include <net/if.h>
#include <netdb.h>
#include <unistd.h> /* close() and others */
#ifdef __cplusplus
}
#endif
typedef int SOCKET;
#define INVALID_SOCKET (-1)
#define SOCKERRNO errno
#define socket_ioctl(A,B,C) ioctl(A,B,C)
typedef int osiSockIoctl_t;
typedef socklen_t osiSocklen_t;
#define FD_IN_FDSET(FD) ((FD)<FD_SETSIZE)
#define SOCK_EWOULDBLOCK EWOULDBLOCK
#define SOCK_ENOBUFS ENOBUFS
#define SOCK_ECONNRESET ECONNRESET
#define SOCK_ETIMEDOUT ETIMEDOUT
#define SOCK_EADDRINUSE EADDRINUSE
#define SOCK_ECONNREFUSED ECONNREFUSED
#define SOCK_ECONNABORTED ECONNABORTED
#define SOCK_EINPROGRESS EINPROGRESS
#define SOCK_EISCONN EISCONN
#define SOCK_EALREADY EALREADY
#define SOCK_EINVAL EINVAL
#define SOCK_EINTR EINTR
#define SOCK_EPIPE EPIPE
#define SOCK_EMFILE EMFILE
#define SOCK_SHUTDOWN ESHUTDOWN
#define SOCK_ENOTSOCK ENOTSOCK
#define SOCK_EBADF EBADF
#ifndef SHUT_RD
#define SHUT_RD 0
#endif
#ifndef SHUT_WR
#define SHUT_WR 1
#endif
#ifndef SHUT_RDWR
#define SHUT_RDWR 2
#endif
#define ifreq_size(pifreq) ((pifreq)->ifr_addr.sa_len + sizeof((pifreq)->ifr_name))
#endif /*osdSockH*/

View File

@@ -0,0 +1,48 @@
/*************************************************************************\
* Copyright (c) 2010 UChicago Argonne LLC, as Operator of Argonne
* National Laboratory.
* Copyright (c) 2002 The Regents of the University of California, as
* Operator of Los Alamos National Laboratory.
* EPICS BASE is distributed subject to a Software License Agreement found
* in file LICENSE that is included with this distribution.
\*************************************************************************/
/*
* $Id$
* Author: Jeff Hill
*/
#define epicsExportSharedSymbols
#include "osiSock.h"
#include "errlog.h"
epicsShareFunc void epicsShareAPI
epicsSocketEnableAddressReuseDuringTimeWaitState ( SOCKET s )
{
int yes = true;
int status;
status = setsockopt ( s, SOL_SOCKET, SO_REUSEADDR,
(char *) & yes, sizeof ( yes ) );
if ( status < 0 ) {
errlogPrintf (
"epicsSocketEnablePortUseForDatagramFanout: "
"unable to set SO_REUSEADDR?\n");
}
}
/*
* SO_REUSEPORT is not in POSIX
*/
epicsShareFunc void epicsShareAPI
epicsSocketEnableAddressUseForDatagramFanout ( SOCKET s )
{
int yes = true;
int status;
status = setsockopt ( s, SOL_SOCKET, SO_REUSEPORT,
(char *) & yes, sizeof ( yes ) );
if ( status < 0 ) {
errlogPrintf (
"epicsSocketEnablePortUseForDatagramFanout: "
"unable to set SO_REUSEPORT?\n");
}
}

View File

@@ -0,0 +1,30 @@
/*************************************************************************\
* Copyright (c) 2002 The University of Saskatchewan
* EPICS BASE is distributed subject to a Software License Agreement found
* in file LICENSE that is included with this distribution.
\*************************************************************************/
/*
* $Id$
*
* Author: Eric Norum
*/
#ifndef osdTimeh
#define osdTimeh
#include <sys/time.h>
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
epicsShareFunc void convertDoubleToWakeTime(double timeout,
struct timespec *wakeTime);
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* ifndef osdTimeh */

View File

@@ -0,0 +1,18 @@
/*************************************************************************\
* Copyright (c) 2002 The University of Saskatchewan
* EPICS BASE is distributed subject to a Software License Agreement found
* in file LICENSE that is included with this distribution.
\*************************************************************************/
/*
* $Id$
*
* Author: Eric Norum
*/
#ifndef osiFileNameH
#define osiFileNameH
#include "unixFileName.h"
#endif /* osiFileNameH */