## Building EPICS R3.13 extensions with R3.14 base

EPICS R3.13 extensions have both a Makefile and a Makefile.Host in the build directories and the EPICS R3.13 extension tree has an extensions/config directory.

### Prerequisite for building R3.13 extensions

> - The macro COMPAT_TOOLS_313 must be set to YES in base/configure/CONFIG_SITE before the base build. If it was not set, set it to YES and then do a gmake in the base/config directory. This will install some perl scripts needed for building R3.13 extensions.

### Preliminary steps for all extensions

> - Download the latest version of the extensions/config files, extensionsConfig.tar.gz, from the APS EPICS www page.
> The extensions directory can have both the base/config (for extensions with R3.13 makefiles) and base/configure (for extensions with R3.14 makefiles) directories.
> - Make certain that you have set the HOST_ARCH environment variable.
> - Set EPICS_BASE in extensions/config/RELEASE to the full path location of a built R3.14 base.
> - BASE_3_14 is now defined in the base/config/CONFIG_BASE_VERSION. The commented BASE_3_14 definition can be removed from extensions/config/RELEASE.

### Building downloaded APS distribution extensions with base R3.14

> - Download the latest version of extensions distributed from the APS EPICS www page. The latest versions of the extensions should build with both R3.13 and R3.14. Note that the order of building extensions is important, i.e. some extensions depend on other extensions being built first. The extensions/config/CONFIG_EXTENSIONS file contains notes on extension dependencies and contains a definition of DIRS (used by extensions/src/Makefile) with the proper order for building the APS distributed extensions.
> - Executing gnumake at the root level of the extensions tree or in the src directory should build the APS extensions in the proper order.

### Building your extensions with base R3.14

> - Library Db renamed

> Library Db has been renamed to dbStaticHost in EPICS base R3.14. In some extensions lib Db is not used and Db can be removed from the USR_LIBS (or PROD_LIBS) line. If the library is needed ( you get unresolved items after removing Db), the following lines should be added to Makefile.Host.

> >     ifdef BASE_3_14
> >     USR_LIBS += dbStaticHost
> >     dbStaticHost_DIR = $(EPICS_BASE_LIB)
> >     else
> >     USR_LIBS += Db
> >     Db_DIR = $(EPICS_BASE_LIB)
> >     endif

> - Library dbStaticHost names changed

> Library functions have been renamed. If there are calls with old db names, add the following lines

> >     #if  EPICS_REVISION && EPICS_REVISION == 13
> >     #define dbFindRecordType    dbFindRecdes
> >     #define dbGetNRecordTypes   dbGetNRecdes
> >     #define dbNextRecordType    dbNextRecdes
> >     #define dbFirstField        dbFirstFielddes
> >     #define dbGetRecordTypeName dbGetRecdesName
> >     #define dbFirstRecordType   dbFirstRecdes
> >     #define dbNextField         dbNextFielddes
> >     #define dbGetMenuChoices    dbGetChoices

> >     long dbReadDatabaseFP(DBBASE **ppdbbase,
> >         FILE *fp, const char *path,const char *substitutions)
> >     {
> >          return(dbRead(*ppdbbase,fp));
> >     }
> >     #endif

> and change the the old names and function calls to the R3.14 versions:

> >     dbFindRecdes         =>  dbFindRecordType
> >     dbGetNRecdes         =>  dbGetNRecordTypes
> >     dbNextRecdes         =>  dbNextRecordType
> >     dbFirstFielddes      =>  dbFirstField
> >     dbGetRecdesName      =>  dbGetRecordTypeName
> >     dbFirstRecdes        =>  dbFirstRecordType
> >     dbNextFielddes       =>  dbNextField
> >     dbGetChoices         =>  dbGetMenuChoices
> >     dbRead(pdbbase,fp)   =>  dbReadDatabaseFP(&pdbbase,fp,0,0)

> - Target architecture specifications changed

> Since target architecture specifications have been changed (solaris to solaris-sparc, win32 to win32-x86, ...) Makefile.Host references to and tests on T_A have to be changed. In most cases T_A can be replaced by OS_CLASS. Since HOST_ARCH will eventually be phased out, it would be a good idea to change any Makefile.Host references to HOST_ARCH to OS_CLASS if possible.
> For example change

> >     ifeq ($(T_A),solaris)
> >     RPCFLAGS = -K -1
> >     endif

> to

> >     ifeq ($(OS_CLASS),solaris)
> >     RPCFLAGS = -K -1
> >     endif

> - New ca_set_puser

> Statements of the form: `ca_puser(chid) = xyz`; should to be changed to: `ca_set_puser(chid,xyz)`;

> - Extern C around includes

> Remove any extern "C" braces around #includes of EPICS base header files.
> For example change

> >     extern "C" {
> >     #include "cadefs.h"
> >     } /* end extern C */

> to

> > `#include "cadefs.h"`

> - Infrequently used R3.13 timestamp functions unbundled from base

> Some infrequently used R3.13 timestamp functions and macro definitions have been removed from EPICS base and now exist in a library, ts, created and installed in the ar extension. The only ANL distributed extension that uses these unbundled functions and macros is cau. The two R3.13 functions tsStampToText and tsLocalTime along with the definitions TS_TEXT_MONDDYYYY and TS_TEXT_MMDDYY have been retained in R3.14 for extension compatibility purposes.
> If your extension gets undefines for TS_* usage and ts* function calls when built with R3.14, you must obtain and build the ar extension. Add an #include for tsSubr.h to your extension source code and add library ts to PROD_LIBS or USR_LIBS in your Makefile.Host as follows:

> >     #include "tsSubr.h"

> >     ifdef BASE_3_14
> >     PROD_LIBS += ts
> >     ts_DIR = $(EPICS_EXTENSIONS_LIB)
> >     endif

> - No Field name length restriction

> The length restriction to database record names no longer exists in R3.14 so the the `FLDNAME_SZ macro definition was removed.from dbDefs.h. Extensions which still have a field name restriction should add the field name size definition to their code until they are updated.`

> >     #ifndef FLDNAME_SZ
> >     #define FLDNAME_SZ 4 /*Field Name Size*/
> >     #endif

> - Some EPICS base version macros removed

> The EPICS base version macros that start with "BASE_" have been removed from epicsVersion.h. Extensions should now use only the existing macros which start with "EPICS_".

> > BASE_VERSION => EPICS_VERSION BASE_REVISION => EPICS_REVISION BASE_MODIFICATION => EPICS_MODIFICATION BASE_UPDATE_NAME => EPICS_UPDATE_NAME BASE_UPDATE_LEVEL => EPICS_UPDATE_LEVEL BASE_VERSION_STRING => EPICS_VERSION_STRING