Skip to content

Commit

Permalink
Improve handling of libtirpc
Browse files Browse the repository at this point in the history
My previous commits treated libtirpc as a system level dependency,
rather than a proper library. Now it is treated no different than
boost or yaml-cpp. This allos us to provide tirpc in $PACKAGE_TOP
  • Loading branch information
JJL772 authored and marciodo committed Oct 26, 2024
1 parent 63612a1 commit d4f22b4
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 22 deletions.
15 changes: 5 additions & 10 deletions config.mak
Original file line number Diff line number Diff line change
Expand Up @@ -164,16 +164,6 @@ USE_CXX11_default=NO
# This variable can be set for individual target architectures...
WITH_BOOST_default=YES

# glibc 2.26+ no longer has an RPC library built in, so RPC support must come from libtirpc instead.
# You may override this setting in your config.local.mak if this conditional doesn't cover all cases where this is needed.
ifdef TARCH
ifeq ($(TARCH),$(filter $(TARCH),rhel9-x86_64 rhel8-x86_64))
USE_TIRPC=YES
else
USE_TIRPC=NO
endif
endif

# Define an install location
INSTALL_DIR=$(TOPDIR)

Expand All @@ -184,6 +174,11 @@ INSTALL_DIR=$(TOPDIR)
# seen from the host...
POSTPROCESS_ENV_SCRIPT_default=true

# Define the location of libtirpc. This is required for builds targeting
# systems that use glibc 2.26+, as that version of glibc removed the built-in
# RPC library.
tirpcinc_DIR_default=$(PACKAGE_TOP)/tirpc/1.3.5/$(TARCH)/include/tirpc
tirpclib_DIR_default=$(PACKAGE_TOP)/tirpc/1.3.5/$(TARCH)/lib

GIT_RELEASE_TAG := "$(shell git describe --abbrev=4 --dirty --always --tags)"
USR_CPPFLAGS += -DGIT_RELEASE_TAG=\"$(GIT_RELEASE_TAG)\"
Expand Down
25 changes: 15 additions & 10 deletions src/defs.mak
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ ARCHSPECIFIC_VARS+=WITH_SHARED_LIBRARIES
ARCHSPECIFIC_VARS+=WITH_STATIC_LIBRARIES
ARCHSPECIFIC_VARS+=WITH_PYCPSW
ARCHSPECIFIC_VARS+=WITH_BOOST
ARCHSPECIFIC_VARS+=WITH_TIRPC
ARCHSPECIFIC_VARS+=BOOST_PYTHON_LIB
ARCHSPECIFIC_VARS+=USR_CPPFLAGS
ARCHSPECIFIC_VARS+=USR_CXXFLAGS
Expand All @@ -69,6 +70,7 @@ ARCHSPECIFIC_VARS+=POSTPROCESS_ENV_SCRIPT
ARCHSPECIFIC_LIBVARS+=yaml_cpp
ARCHSPECIFIC_LIBVARS+=boost
ARCHSPECIFIC_LIBVARS+=py
ARCHSPECIFIC_LIBVARS+=tirpc

$(foreach var,$(ARCHSPECIFIC_VARS),$(eval $(call arch2var,$(var))))

Expand Down Expand Up @@ -122,9 +124,9 @@ RUN_OPTS=''

# colon separated dirlist
# Note: += adds a whitespace
cpswinc_DIRS=$(CPSW_DIR)$(addprefix :,$(boostinc_DIR))$(addprefix :,$(yaml_cppinc_DIR))
cpswinc_DIRS=$(CPSW_DIR)$(addprefix :,$(boostinc_DIR))$(addprefix :,$(yaml_cppinc_DIR))$(addprefix :,$(tirpcinc_DIR))
# colon separated dirlist
cpsw_deplib_DIRS=$(addprefix :,$(boostlib_DIR))$(addprefix :,$(yaml_cpplib_DIR))
cpsw_deplib_DIRS=$(addprefix :,$(boostlib_DIR))$(addprefix :,$(yaml_cpplib_DIR))$(addprefix :,$(tirpclib_DIR))
cpswlib_DIRS=$(addsuffix /O.$(TARCH),$(CPSW_DIR))$(cpsw_deplib_DIRS)

# Libraries CPSW requires -- must be added to application's <prog>_LIBS variable
Expand All @@ -140,6 +142,11 @@ WITH_SHARED_LIBRARIES_default=YES
WITH_STATIC_LIBRARIES_default=NO
WITH_PYCPSW_default =$(or $(and $(and $(pyinc_DIR),$(wildcard $(pyinc_DIR)/*),$(pyinc_DIR)),$(WITH_SHARED_LIBRARIES),CYTHON),NO)
WITH_BOOST_default =YES
WITH_TIRPC_default =NO

# tirpc is needed at least on these systems
WITH_TIRPC_rhel9_x86_64 =YES
WITH_TIRPC_rhel8_x86_64 =YES

COMMA__:=,
SPACE__:=
Expand Down Expand Up @@ -195,6 +202,12 @@ define maybe_run_cython
fi
endef

TIRPC_LIBS_YES=tirpc
TIRPC_STATIC_LIBS_YES=tirpc.a

CPSW_LIBS+=$(TIRPC_LIBS_$(WITH_TIRPC))
CPSW_STATIC_LIBS+=$(TIRPC_STATIC_LIBS_$(WITH_TIRPC))

# definitions
include $(CPSW_DIR)/../config.mak
-include $(CPSW_DIR)/../config.local.mak
Expand All @@ -212,14 +225,6 @@ else
-include $(TOPDIR)/config.local.mak
endif

# Configure tirpc includes and linker flags
ifeq ($(USE_TIRPC),YES)
CPPFLAGS+=-I/usr/include/tirpc
CPSW_LIBS+=tirpc
CPSW_STATIC_LIBS+=tirpc
LDFLAGS+=-ltirpc
endif

# Check that we have PACKAGE_TOP, otherwise things will fail to build.
ifeq ($(PACKAGE_TOP),)
$(error PACKAGE_TOP or EPICS_PACKAGE_TOP must be provided by your environment, on the command line, or by config.local.mak)
Expand Down
4 changes: 2 additions & 2 deletions src/rssi_bridge/makefile
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,15 @@ rssi_bridge_SRCS+= mapClnt.c
rssi_bridge_SRCS+= rpcMapServer.c

rssi_bridge_LIBS_NO = cpswTstAux $(CPSW_LIBS)
rssi_bridge_LIBS_YES= cpswTstAux cpsw.a pthread rt
rssi_bridge_LIBS_YES= cpswTstAux $(CPSW_STATIC_LIBS)
rssi_bridge_LIBS=$(rssi_bridge_LIBS_$(WITH_STATIC_LIBRARIES))

rssi_bqm_SRCS += rssi_bqm.cc
rssi_bqm_SRCS += rpcMapLookup.c
rssi_bqm_SRCS += prot_xdr.c

rssi_bqm_LIBS_NO = cpswTstAux $(CPSW_LIBS)
rssi_bqm_LIBS_YES= cpswTstAux cpsw.a pthread rt
rssi_bqm_LIBS_YES= cpswTstAux $(CPSW_STATIC_LIBS)
rssi_bqm_LIBS=$(rssi_bqm_LIBS_$(WITH_STATIC_LIBRARIES))

PROGRAMS = rssi_bridge rssi_bqm
Expand Down

0 comments on commit d4f22b4

Please sign in to comment.