From 7a38da0e44eae828f89717724989b38b7deb6913 Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Tue, 31 May 2016 11:18:29 -0500 Subject: [PATCH 1/9] Ignore RULES, TOP & TEMPLATE_TOP in new checks --- src/makeBaseApp/top/configure/RELEASE | 25 +++++++++++++++---------- src/tools/convertRelease.pl | 2 +- 2 files changed, 16 insertions(+), 11 deletions(-) diff --git a/src/makeBaseApp/top/configure/RELEASE b/src/makeBaseApp/top/configure/RELEASE index 84074fe15..ba28bcb26 100644 --- a/src/makeBaseApp/top/configure/RELEASE +++ b/src/makeBaseApp/top/configure/RELEASE @@ -14,19 +14,24 @@ # RELEASE.Common.$(T_A) # RELEASE.$(EPICS_HOST_ARCH).$(T_A) # -# This file should ONLY define paths to other support modules, -# or include statements that pull in similar RELEASE files. -# Build settings that are NOT module paths should appear in a -# CONFIG_SITE file. +# This file is parsed by both GNUmake and an EPICS Perl script, +# so it can ONLY contain definititions of paths to other support +# modules, variable definitions that are used in module paths, +# and include statements that pull in other RELEASE files. +# Variables may be used before their values have been set. +# Build variables that are NOT used in paths should be set in +# the CONFIG_SITE file. -TEMPLATE_TOP=_TEMPLATE_TOP_ +# Variables and paths to dependent modules: +#MODULES = /path/to/modules +#MYMODULE = $(MODULES)/my-module # If using the sequencer, point SNCSEQ at its top directory: -#SNCSEQ=$(EPICS_BASE)/../modules/soft/seq +#SNCSEQ = $(MODULES)/seq-ver -# EPICS_BASE usually appears last so other apps can override stuff: -EPICS_BASE=_EPICS_BASE_ +# EPICS_BASE should appear last so earlier modules can override stuff: +EPICS_BASE = _EPICS_BASE_ -# Set RULES here if you want to take build rules from somewhere +# Set RULES here if you want to use build rules from somewhere # other than EPICS_BASE: -#RULES=/path/to/epics/support/module/rules/x-y +#RULES = $(MODULES)/build-rules diff --git a/src/tools/convertRelease.pl b/src/tools/convertRelease.pl index 772ce1112..40bd8652f 100644 --- a/src/tools/convertRelease.pl +++ b/src/tools/convertRelease.pl @@ -241,7 +241,7 @@ sub checkRelease { } } - my @modules = @apps; + my @modules = grep(!m/^(RULES|TOP|TEMPLATE_TOP)$/, @apps); my $app = shift @modules; my $latest = AbsPath($macros{$app}); my %paths = ($latest => $app); From 203fcecc23cfc02fd9fb275fd40c9e335ccbcf75 Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Mon, 20 Jun 2016 14:06:42 -0500 Subject: [PATCH 2/9] Adjust linux-arm config for Xilinx SDK users --- configure/os/CONFIG_SITE.linux-x86.linux-arm | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/configure/os/CONFIG_SITE.linux-x86.linux-arm b/configure/os/CONFIG_SITE.linux-x86.linux-arm index 528c9bc6c..a6946262a 100644 --- a/configure/os/CONFIG_SITE.linux-x86.linux-arm +++ b/configure/os/CONFIG_SITE.linux-x86.linux-arm @@ -5,11 +5,12 @@ # Site specific definitions for linux-x86 host - linux-arm target builds #------------------------------------------------------- -# Tools install path -#GNU_DIR = /home/targetOS/linux-arm/host/x86-linux/gcc_3.3.3 +# Set GNU crosscompiler target name +GNU_TARGET = arm-xilinx-linux-gnueabi -# APS: +# Set GNU tools install path +# This is the install path at APS: GNU_DIR = /usr/local/vw/zynq-2011.09 -# GNU crosscompiler target name -GNU_TARGET = arm-xilinx-linux-gnueabi +# With a Xilinx SDK, it'll be something like +#GNU_DIR = /usr/local/zynq/Xilinx/SDK/2015.4/gnu/arm/lin From bf85143381df47af27c0b58c8574bfee00d76456 Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Wed, 22 Jun 2016 12:25:17 -0500 Subject: [PATCH 3/9] Fix for g++ 6.x on Fedora 24, cleanup --- src/libCom/test/epicsExceptionTest.cpp | 33 +++++++++++++++++--------- 1 file changed, 22 insertions(+), 11 deletions(-) diff --git a/src/libCom/test/epicsExceptionTest.cpp b/src/libCom/test/epicsExceptionTest.cpp index e69f7e927..e64b6c469 100644 --- a/src/libCom/test/epicsExceptionTest.cpp +++ b/src/libCom/test/epicsExceptionTest.cpp @@ -27,30 +27,41 @@ using namespace std; -#if defined(__BORLANDC__) && defined(__linux__) -namespace std { -const nothrow_t nothrow ; -} -#endif - #if defined ( _MSC_VER ) - // some interesting bugs found in the MS implementation of new + # if _MSC_VER >= 1900 + // Can't use const static size_t unsuccessfulNewSize = numeric_limits < size_t > :: max (); -# elif _MSC_VER > 1310 /* this gets fixed some release after visual studio 7 we hope */ +# elif _MSC_VER > 1310 static const size_t unsuccessfulNewSize = numeric_limits < size_t > :: max (); # else + // Bug in the older MS implementation of new static const size_t unsuccessfulNewSize = numeric_limits < size_t > :: max () - 100; # endif - // passing a size_t to printf() needs "%zu" on some platforms + + // No %z modifier support for printing a size_t # define Z_MODIFIER "" + #elif defined(vxWorks) - // Neither vxWorks 5 or 6 supply true ANSI C++ + + // Don't try to use numeric_limits < size_t > static const size_t unsuccessfulNewSize = UINT_MAX - 15u; + + // No %z modifier support for printing a size_t # define Z_MODIFIER "" + #else - static const size_t unsuccessfulNewSize = numeric_limits < size_t > :: max (); + +# if defined(__GNUC__) && (__GNUC__ >= 6) + // Can't use const + static size_t unsuccessfulNewSize = numeric_limits < size_t > :: max (); +# else + static const size_t unsuccessfulNewSize = numeric_limits < size_t > :: max (); +# endif + + // passing a size_t to printf() needs "%zu" # define Z_MODIFIER "z" + #endif class exThread : public epicsThreadRunable { From 8da6c172d1564bb13b657ce2c671eaabebcefc98 Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Wed, 6 Jul 2016 11:36:09 -0500 Subject: [PATCH 4/9] Removed epicsExceptionTest.cpp Too many build failures on newer C++ compilers. Since this is just testing that the compiler runtime follows the C++ standard it isn't really necessary any more (it was in the early days of C++ before standardization). --- src/libCom/test/Makefile | 5 - src/libCom/test/epicsExceptionTest.cpp | 128 ------------------------- 2 files changed, 133 deletions(-) delete mode 100644 src/libCom/test/epicsExceptionTest.cpp diff --git a/src/libCom/test/Makefile b/src/libCom/test/Makefile index 7f5994c0d..5f486938f 100644 --- a/src/libCom/test/Makefile +++ b/src/libCom/test/Makefile @@ -123,11 +123,6 @@ epicsMutexTest_SRCS += epicsMutexTest.cpp testHarness_SRCS += epicsMutexTest.cpp TESTS += epicsMutexTest -TESTPROD_HOST += epicsExceptionTest -epicsExceptionTest_SRCS += epicsExceptionTest.cpp -testHarness_SRCS += epicsExceptionTest.cpp -TESTS += epicsExceptionTest - TESTPROD_HOST += macEnvExpandTest macEnvExpandTest_SRCS += macEnvExpandTest.c testHarness_SRCS += macEnvExpandTest.c diff --git a/src/libCom/test/epicsExceptionTest.cpp b/src/libCom/test/epicsExceptionTest.cpp deleted file mode 100644 index e64b6c469..000000000 --- a/src/libCom/test/epicsExceptionTest.cpp +++ /dev/null @@ -1,128 +0,0 @@ -/*************************************************************************\ -* Copyright (c) 2006 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. -\*************************************************************************/ - -// -// Verify that the local c++ exception mechanism matches the ANSI/ISO standard. -// Author: Jeff Hill -// - -#include -#include -#include -#if defined(__GNUC__) && (__GNUC__<2 || (__GNUC__==2 && __GNUC_MINOR__<=96)) -#include -#else -#include -#endif - -#include "epicsUnitTest.h" -#include "epicsThread.h" -#include "testMain.h" - -using namespace std; - -#if defined ( _MSC_VER ) - -# if _MSC_VER >= 1900 - // Can't use const - static size_t unsuccessfulNewSize = numeric_limits < size_t > :: max (); -# elif _MSC_VER > 1310 - static const size_t unsuccessfulNewSize = numeric_limits < size_t > :: max (); -# else - // Bug in the older MS implementation of new - static const size_t unsuccessfulNewSize = numeric_limits < size_t > :: max () - 100; -# endif - - // No %z modifier support for printing a size_t -# define Z_MODIFIER "" - -#elif defined(vxWorks) - - // Don't try to use numeric_limits < size_t > - static const size_t unsuccessfulNewSize = UINT_MAX - 15u; - - // No %z modifier support for printing a size_t -# define Z_MODIFIER "" - -#else - -# if defined(__GNUC__) && (__GNUC__ >= 6) - // Can't use const - static size_t unsuccessfulNewSize = numeric_limits < size_t > :: max (); -# else - static const size_t unsuccessfulNewSize = numeric_limits < size_t > :: max (); -# endif - - // passing a size_t to printf() needs "%zu" -# define Z_MODIFIER "z" - -#endif - -class exThread : public epicsThreadRunable { -public: - exThread (); - void waitForCompletion (); - ~exThread() {}; -private: - epicsThread thread; - bool done; - void run (); -}; - -static void epicsExceptionTestPrivate () -{ - try { - char * p = new char [unsuccessfulNewSize]; - testFail("new char[%" Z_MODIFIER "u] returned %p", unsuccessfulNewSize, p); - } - catch ( const bad_alloc & ) { - testPass("new char[%" Z_MODIFIER "u] threw", unsuccessfulNewSize); - } - catch ( ... ) { - testFail("new: threw wrong type"); - } - try { - char * p = new ( nothrow ) - char [unsuccessfulNewSize]; - testOk(p == 0, "new (nothrow) returned %p", p); - } - catch( ... ) { - testFail("new (nothrow): threw"); - } -} - -exThread::exThread () : - thread ( *this, "testExceptions", epicsThreadGetStackSize(epicsThreadStackSmall) ), - done ( false ) -{ - this->thread.start (); -} - -void exThread::run () -{ - epicsExceptionTestPrivate (); - this->done = true; -} - -void exThread::waitForCompletion () -{ - while ( ! this->done ) { - epicsThreadSleep ( 0.1 ); - } -} - -MAIN(epicsExceptionTest) -{ - testPlan(4); - epicsExceptionTestPrivate (); - - exThread athread; - athread.waitForCompletion (); - return testDone(); -} From b9aa8777274c45ca814cc8d80e0046001a7b57cf Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Wed, 6 Jul 2016 14:06:21 -0500 Subject: [PATCH 5/9] Fix RTEMS build --- src/libCom/test/epicsRunLibComTests.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/libCom/test/epicsRunLibComTests.c b/src/libCom/test/epicsRunLibComTests.c index 3b81b15cf..81290644a 100644 --- a/src/libCom/test/epicsRunLibComTests.c +++ b/src/libCom/test/epicsRunLibComTests.c @@ -24,7 +24,6 @@ int epicsEnvTest(void); int epicsErrlogTest(void); int epicsCalcTest(void); int epicsEventTest(void); -int epicsExceptionTest(void); int epicsMathTest(void); int epicsMessageQueueTest(void); int epicsMutexTest(void); @@ -72,8 +71,6 @@ void epicsRunLibComTests(void) runTest(epicsEventTest); - runTest(epicsExceptionTest); - runTest(epicsMathTest); runTest(epicsMessageQueueTest); From 22ef5696825aa00d4868db1a996853030b7515fd Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Wed, 6 Jul 2016 15:23:58 -0500 Subject: [PATCH 6/9] Provide a systemd service file for caRepeater Also changes how the sysvinit files are generated to use the expandVars.pl script and rules instead of sed. --- documentation/RELEASE_NOTES.html | 8 +++++++ src/util/Makefile | 21 +++++++++-------- src/util/{rc2.caRepeater => S99caRepeater@} | 2 +- src/util/{rc2.logServer => S99logServer@} | 2 +- src/util/caRepeater.service@ | 25 +++++++++++++++++++++ 5 files changed, 45 insertions(+), 13 deletions(-) rename src/util/{rc2.caRepeater => S99caRepeater@} (96%) rename src/util/{rc2.logServer => S99logServer@} (96%) create mode 100644 src/util/caRepeater.service@ diff --git a/documentation/RELEASE_NOTES.html b/documentation/RELEASE_NOTES.html index 7c6692898..def2baf3c 100644 --- a/documentation/RELEASE_NOTES.html +++ b/documentation/RELEASE_NOTES.html @@ -13,6 +13,14 @@ +

Linux systemd service file for CA Repeater

+ +

Building this version of Base on a Linux system creates a systemd service +file suitable for starting the Channel Access Repeater under systemd. The file +will be installed into the target bin directory, from where it can be copied +into the appropriate systemd location and modified as necessary. Installation +instructions are included as comments in the file.

+

NTP Time Provider adjusts to OS tick rate changes

Dirk Zimoch provided code that allows the NTP Time provider (used on VxWorks diff --git a/src/util/Makefile b/src/util/Makefile index e0cd22c77..20f60572e 100644 --- a/src/util/Makefile +++ b/src/util/Makefile @@ -3,8 +3,7 @@ # National Laboratory. # Copyright (c) 2002 The Regents of the University of California, as # Operator of Los Alamos National Laboratory. -# EPICS BASE Versions 3.13.7 -# and higher are distributed subject to a Software License Agreement found +# EPICS BASE is distributed subject to a Software License Agreement found # in file LICENSE that is included with this distribution. #************************************************************************* TOP=../.. @@ -13,9 +12,6 @@ include $(TOP)/configure/CONFIG PROD_LIBS = ca Com -# -# Added winmm user32 for the non-dll build -# PROD_HOST_DEFAULT = ca_test iocLogServer PROD_HOST_WIN32 = ca_test iocLogServer PROD_SYS_LIBS_WIN32 = ws2_32 advapi32 user32 @@ -27,12 +23,15 @@ iocLogServer_SRCS = iocLogServer.c OBJS_vxWorks = ca_test -SCRIPTS_solaris := S99logServer S99caRepeater -SCRIPTS_Linux := S99logServer S99caRepeater +SCRIPTS_HOST = S99logServer S99caRepeater +SCRIPTS_Linux = caRepeater.service + +EXPAND += S99logServer@ +EXPAND += S99caRepeater@ +EXPAND += caRepeater.service@ + +EXPAND_VARS = INSTALL_BIN=$(abspath $(INSTALL_BIN)) include $(TOP)/configure/RULES - -S99%: ../rc2.% - sed -e s%:INSTALL_BIN:%`cd $(INSTALL_BIN); pwd`% $< >$@ -# EOF Makefile.Host for base/src/util +.PRECIOUS: $(EXPANDED) diff --git a/src/util/rc2.caRepeater b/src/util/S99caRepeater@ similarity index 96% rename from src/util/rc2.caRepeater rename to src/util/S99caRepeater@ index 4db37b49a..aabefb72c 100644 --- a/src/util/rc2.caRepeater +++ b/src/util/S99caRepeater@ @@ -3,7 +3,7 @@ # System-V init script for the EPICS CA Repeater. # -INSTALL_BIN=:INSTALL_BIN: +INSTALL_BIN=@INSTALL_BIN@ # To change the default values for the EPICS environment parameters, # uncomment and modify the relevant lines below. These are the only diff --git a/src/util/rc2.logServer b/src/util/S99logServer@ similarity index 96% rename from src/util/rc2.logServer rename to src/util/S99logServer@ index 407227d91..294b2ec01 100644 --- a/src/util/rc2.logServer +++ b/src/util/S99logServer@ @@ -3,7 +3,7 @@ # System-V init script for the EPICS IOC Log Server. # -INSTALL_BIN=:INSTALL_BIN: +INSTALL_BIN=@INSTALL_BIN@ # To change the default values for the EPICS Environment parameters, # uncomment and modify the relevant lines below. diff --git a/src/util/caRepeater.service@ b/src/util/caRepeater.service@ new file mode 100644 index 000000000..ee50305a1 --- /dev/null +++ b/src/util/caRepeater.service@ @@ -0,0 +1,25 @@ +# +# Linux systemd service file for the EPICS CA Repeater +# +# To install this file, as root: +# cp caRepeater.service /etc/systemd/system +# chmod 664 /etc/systemd/system/caRepeater.service +# systemctl daemon-reload +# systemctl enable caRepeater +# systemctl start caRepeater +# +# To check the status: +# systemctl status caRepeater + +[Unit] +Description=EPICS CA Repeater +Requires=network.target +After=network.target + +[Service] +ExecStart=@INSTALL_BIN@/caRepeater +Restart=always +User=daemon + +[Install] +WantedBy=multi-user.target From ddeb0a827cdf1f90a5c4b1d84afd740df975f745 Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Wed, 6 Jul 2016 17:05:04 -0500 Subject: [PATCH 7/9] Make EXPAND rule work on all arch's Fixes build for linux-arm in src/util. Don't expand files unless specifically requested. Expanded files are always precious. --- configure/RULES_EXPAND | 6 +----- src/util/Makefile | 6 ++---- 2 files changed, 3 insertions(+), 9 deletions(-) diff --git a/configure/RULES_EXPAND b/configure/RULES_EXPAND index 7bc4c863d..cf313bbb0 100644 --- a/configure/RULES_EXPAND +++ b/configure/RULES_EXPAND @@ -1,7 +1,5 @@ # /configure/RULES_EXPAND -ifeq ($(findstring Host,$(VALID_BUILDS)),Host) - # Default settings EXPAND_TOOL ?= $(PERL) $(TOOLS)/expandVars.pl @@ -10,8 +8,6 @@ EXPANDFLAGS += $(addprefix -D ,$(EXPAND_VARS)) EXPANDED = $(EXPAND:%@=%) -buildInstall: $(EXPANDED) - $(EXPANDED): %: ../%@ $(ECHO) "Expanding $< to $@" @$(RM) $@ @@ -20,4 +16,4 @@ $(EXPANDED): %: ../%@ clean:: @$(RM) $(EXPANDED) -endif +.PRECIOUS: $(EXPANDED) diff --git a/src/util/Makefile b/src/util/Makefile index 20f60572e..525d6a2cf 100644 --- a/src/util/Makefile +++ b/src/util/Makefile @@ -1,10 +1,10 @@ #************************************************************************* -# Copyright (c) 2002 The University of Chicago, as Operator of Argonne +# Copyright (c) 2016 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. +# in file LICENSE that is included with this distribution. #************************************************************************* TOP=../.. @@ -33,5 +33,3 @@ EXPAND += caRepeater.service@ EXPAND_VARS = INSTALL_BIN=$(abspath $(INSTALL_BIN)) include $(TOP)/configure/RULES - -.PRECIOUS: $(EXPANDED) From bffdfdcb28354bc0565e5b70134fd98fcbf97f3b Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Fri, 8 Jul 2016 13:18:53 -0500 Subject: [PATCH 8/9] Fix GetUser routine in makeBaseApp.pl --- src/makeBaseApp/makeBaseApp.pl | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/makeBaseApp/makeBaseApp.pl b/src/makeBaseApp/makeBaseApp.pl index b53a0541e..13d749d4c 100644 --- a/src/makeBaseApp/makeBaseApp.pl +++ b/src/makeBaseApp/makeBaseApp.pl @@ -418,7 +418,8 @@ EOF } sub GetUser { - $user = $opt_u || $ENV{USER} || $ENV{USERNAME} || Win32::LoginName(); + $user = $opt_u || $ENV{USER} || $ENV{USERNAME} || getlogin(); + $user = Win32::LoginName() if !$user && $^ eq 'MSWin32'; unless ($user) { print "Strange, I cannot figure out your user name!\n"; From c8351c329bcc141ab9f9b6b703ef1b092fbd3483 Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Mon, 18 Jul 2016 11:25:08 -0500 Subject: [PATCH 9/9] Clarify comments in exampleApp Makefile --- src/makeBaseApp/top/exampleApp/src/Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/makeBaseApp/top/exampleApp/src/Makefile b/src/makeBaseApp/top/exampleApp/src/Makefile index f3b262c77..bc9f18619 100644 --- a/src/makeBaseApp/top/exampleApp/src/Makefile +++ b/src/makeBaseApp/top/exampleApp/src/Makefile @@ -26,6 +26,7 @@ _APPNAME_Support_SRCS += initTrace.c _APPNAME_Support_LIBS += $(EPICS_BASE_IOC_LIBS) + # Build the IOC application PROD_IOC = _APPNAME_ @@ -46,9 +47,6 @@ _APPNAME__SRCS += _APPNAME__registerRecordDeviceDriver.cpp _APPNAME__SRCS_DEFAULT += _APPNAME_Main.cpp _APPNAME__SRCS_vxWorks += -nil- -# Add support from base/src/vxWorks if needed -#_APPNAME__OBJS_vxWorks += $(EPICS_BASE_BIN)/vxComLibrary - # Link in the code from our support library _APPNAME__LIBS += _APPNAME_Support @@ -58,6 +56,7 @@ ifneq ($(SNCSEQ),) # Build sncExample into _APPNAME_Support sncExample_SNCFLAGS += +r _APPNAME__DBD += sncExample.dbd + # A .stt sequence program is *not* pre-processed: _APPNAME_Support_SRCS += sncExample.stt _APPNAME_Support_LIBS += seq pv _APPNAME__LIBS += seq pv @@ -65,6 +64,7 @@ ifneq ($(SNCSEQ),) # Build sncProgram as a standalone program PROD_HOST += sncProgram sncProgram_SNCFLAGS += +m + # A .st sequence program *is* pre-processed: sncProgram_SRCS += sncProgram.st sncProgram_LIBS += seq pv sncProgram_LIBS += $(EPICS_BASE_HOST_LIBS)