File epics-base.spec of Package epics-base
#
# spec file for package epics-base
#
# Copyright (c) 2024 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via https://bugs.opensuse.org/
#
%define epics_prefix %{_libdir}/epics
%define ca_sover 4.14.4
%define libca_suffix %(echo %{ca_sover} | tr . _)
%define Com_sover 3.23.1
%define libCom_suffix %(echo %{Com_sover} | tr . _)
%ifarch aarch64 %arm
%define epics_host_arch linux-arm
%endif
%ifarch x86_64
%define epics_host_arch linux-x86_64
%endif
%ifarch %ix86
%define epics_host_arch linux-x86
%endif
%ifarch %power64
%define epics_host_arch linux-ppc64
%endif
Name: epics-base
Version: 7.0.8.1
Release: 0
Summary: Experimental Physics and Industrial Control System
License: BSD-4-Clause
Group: Productivity/Scientific/Physics
URL: https://epics.anl.gov
Source0: https://epics.anl.gov/download/base/base-%{version}.tar.gz
Source1: iocLogServer.service
Source2: caRepeater.service
Source3: %{name}-user.conf
BuildRequires: fdupes
BuildRequires: gcc
BuildRequires: gcc-c++
BuildRequires: gzip
BuildRequires: make
BuildRequires: perl
BuildRequires: pkg-config
BuildRequires: readline-devel
ExclusiveArch: aarch64 %arm %ix86 x86_64 %power64
%description
EPICS (Experimental Physics and Industrial Control System) is a toolchain
allowing the user to create a professional control system infrastructure. EPICS
is developed by the Argonne National Laboratory located in Lemont, Illinois,
USA, the Berliner Elektronenspeicherring-Gesellschaft für Synchrotonstrahlung
mbH (BESSY) from Germany and others.
%package -n system-user-epics
Summary: System user and group epics
BuildArch: noarch
BuildRequires: sysuser-tools
%sysusers_requires
%description -n system-user-epics
System user for EPICS (Experimental Physics and Industrial Control System).
%package -n epics-catools
Summary: Command line utilities for EPICS
Group: Productivity/Scientific/Physics
%description -n epics-catools
EPICS utilities such as caget and caput as well as the caRepeater daemon.
%package -n epics-devel
Summary: Development libraries and header files for for EPICS
Group: Development/Libraries/C and C++
Requires: epics-caRepeater = %{version}-%{release}
Requires: epics-catools = %{version}-%{release}
Requires: epics-iocLogServer = %{version}-%{release}
Requires: libCom%{libCom_suffix} = %{version}-%{release}
Requires: libca%{libca_suffix} = %{version}-%{release}
%description -n epics-devel
This package contains the header files and libraries for building
programs using EPICS.
%package -n perl-epics
Summary: Perl bindings for EPICS
Group: Development/Languages/Perl
Requires: perl = %{perl_version}
%description -n perl-epics
This package contains the Perl bindings for EPICS.
%package -n epics-doc
Summary: Documentation for EPICS
Group: Documentation/Howto
%description -n epics-doc
This package contains documentation on using EPICS.
%package -n libca%{libca_suffix}
Summary: Experimental Physics and Industrial Control System
Group: System/Libraries
Provides: libca = %{version}-%{release}
%description -n libca%{libca_suffix}
EPICS (Experimental Physics and Industrial Control System) is a toolchain
allowing the user to create a professional control system infrastructure.
This is the EPICS library exposing channel access primitives for clients.
%package -n libCom%{libCom_suffix}
Summary: Experimental Physics and Industrial Control System
Group: System/Libraries
Provides: libCom = %{version}-%{release}
%description -n libCom%{libCom_suffix}
EPICS (Experimental Physics and Industrial Control System) is a toolchain
allowing the user to create a professional control system infrastructure.
Common library used by all other EPICS building blocks.
%package -n epics-iocLogServer
Summary: Log recorder daemon for EPICS IOCS
Group: Productivity/Scientific/Physics
Requires(pre): pwdutils
%{?systemd_requires}
%description -n epics-iocLogServer
The IOC log server listens for network log messages sent from IOC. This is used
by the caputlog support module to collect messages relating to PV value
changes.
%package -n epics-caRepeater
Summary: EPICS CA Repeater daemon
Group: Productivity/Scientific/Physics
%{?systemd_requires}
%description -n epics-caRepeater
EPICS CA Repeater daemon
%prep
%autosetup -p1 -n base-%{version}
%build
%ifarch %arm aarch64
# Upstream build system has missed soname setup for ARM architectures
cat >>configure/os/CONFIG_SITE.linux-arm.linux-arm <<EOF
STATIC_LDFLAGS_YES= -Wl,-Bstatic
STATIC_LDFLAGS_NO=
STATIC_LDLIBS_YES= -Wl,-Bdynamic
STATIC_LDLIBS_NO=
SHRLIB_LDFLAGS += -Wl,-h\$@
LOADABLE_SHRLIB_LDFLAGS += -Wl,-h\$@
EOF
%endif
LD_LIBRARY_PATH="${PWD}/lib/%{epics_host_arch}":${LD_LIBRARY_PATH} make %{?_smp_mflags} \
EPICS_HOST_ARCH=%{epics_host_arch} \
USR_CFLAGS="%optflags" \
USR_CXXFLAGS="%optflags" \
STATIC_BUILD=NO \
LINKER_USE_RPATH=NO \
FINAL_LOCATION=%{epics_prefix} \
IOCS_APPL_TOP=%{epics_prefix} \
EPICS_SITE_VERSION=%{version}
%sysusers_generate_pre %{SOURCE3} epics %{name}-user.conf
%install
LD_LIBRARY_PATH="${PWD}/lib/%{epics_host_arch}":${LD_LIBRARY_PATH} make %{?_smp_mflags} \
EPICS_HOST_ARCH=%{epics_host_arch} \
USR_CFLAGS="%optflags" \
USR_CXXFLAGS="%optflags" \
STATIC_BUILD=NO \
LINKER_USE_RPATH=NO \
INSTALL_LOCATION=%{buildroot}%{epics_prefix} \
FINAL_LOCATION=%{epics_prefix} \
IOCS_APPL_TOP=%{epics_prefix} \
EPICS_SITE_VERSION=%{version} \
install
install -D -m 0644 %{SOURCE3} %{buildroot}%{_sysusersdir}/%{name}-user.conf
mkdir -p %{buildroot}%{_bindir}
for I in caget cainfo camonitor caput caRepeater casw catime iocLogServer
do
mv %{buildroot}%{epics_prefix}/bin/%{epics_host_arch}/$I %{buildroot}%{_bindir}/$I
ln -s %{_bindir}/$I %{buildroot}%{epics_prefix}/bin/%{epics_host_arch}/$I
done
mv %{buildroot}%{epics_prefix}/lib/%{epics_host_arch}/libca.so.%{ca_sover} %{buildroot}%{_libdir}/libca.so.%{ca_sover}
ln -s %{_libdir}/libca.so.%{ca_sover} %{buildroot}%{epics_prefix}/lib/%{epics_host_arch}/libca.so.%{ca_sover}
mv %{buildroot}%{epics_prefix}/lib/%{epics_host_arch}/libCom.so.%{Com_sover} %{buildroot}%{_libdir}/libCom.so.%{Com_sover}
ln -s %{_libdir}/libCom.so.%{Com_sover} %{buildroot}%{epics_prefix}/lib/%{epics_host_arch}/libCom.so.%{Com_sover}
mkdir -p %{buildroot}%{_datadir}
mv %{buildroot}%{epics_prefix}/lib/pkgconfig %{buildroot}%{_datadir}/pkgconfig
# Drop static libraries
find %{buildroot}%{epics_prefix}/lib/%{epics_host_arch} -name *.a -delete
# Drop html (it goes to /usr/share/doc/packages)
rm -rf %{buildroot}%{epics_prefix}/html
# Perl
mkdir -p %{buildroot}%{perl_vendorlib}
mv %{buildroot}%{epics_prefix}/lib/perl/EPICS %{buildroot}%{perl_vendorlib}
mkdir -p %{buildroot}%{perl_vendorarch}
mv %{buildroot}%{epics_prefix}/lib/perl/CA.pm %{buildroot}%{perl_vendorarch}
mkdir -p %{buildroot}%{perl_vendorarch}/auto
mv %{buildroot}%{epics_prefix}/lib/perl/5.*/*/libCap5.so %{buildroot}%{perl_vendorarch}/auto/
find %{buildroot}%{epics_prefix} -name libCap5.so -delete
for I in S99caRepeater S99logServer caRepeater.service
do
find %{buildroot}%{epics_prefix} -name $I -delete
done
install -D -m 0644 %{S:1} %{buildroot}%{_unitdir}/iocLogServer.service
install -D -m 0644 %{S:2} %{buildroot}%{_unitdir}/caRepeater.service
mkdir -p %{buildroot}%{_sbindir}
ln -s /sbin/service %{buildroot}%{_sbindir}/rciocLogServer
ln -s /sbin/service %{buildroot}%{_sbindir}/rccaRepeater
mkdir -p %{buildroot}%{_var}/log/epics
%fdupes %buildroot
find %{buildroot} -type f -name "*.pl" -exec sed -i "s|#!%{_bindir}/env perl|#!%{_bindir}/perl|" {} \;
%post -n libca%{libca_suffix} -p /sbin/ldconfig
%postun -n libca%{libca_suffix} -p /sbin/ldconfig
%post -n libCom%{libCom_suffix} -p /sbin/ldconfig
%postun -n libCom%{libCom_suffix} -p /sbin/ldconfig
%pre -n epics-caRepeater
%service_add_pre caRepeater.service
%post -n epics-caRepeater
%service_add_post caRepeater.service
%preun -n epics-caRepeater
%service_del_preun caRepeater.service
%stop_on_removal caRepeater
%postun -n epics-caRepeater
%service_del_postun caRepeater.service
%restart_on_update caRepeater
%pre -n epics-iocLogServer
%service_add_pre iocLogServer.service
%post -n epics-iocLogServer
%service_add_post iocLogServer.service
%preun -n epics-iocLogServer
%service_del_preun iocLogServer.service
%stop_on_removal iocLogServer
%postun -n epics-iocLogServer
%service_del_postun iocLogServer.service
%restart_on_update iocLogServer
%pre -n system-user-epics -f epics.pre
%files -n epics-catools
%license LICENSE
%{_bindir}/caget
%{_bindir}/cainfo
%{_bindir}/camonitor
%{_bindir}/caput
%{_bindir}/casw
%{_bindir}/catime
%files -n system-user-epics
%{_sysusersdir}/%{name}-user.conf
%files -n epics-devel
%license LICENSE
%dir %{epics_prefix}
%dir %{epics_prefix}/bin
%{epics_prefix}/bin/%{epics_host_arch}
%{epics_prefix}/configure
%{epics_prefix}/cfg
%{epics_prefix}/db
%{epics_prefix}/dbd
%{epics_prefix}/include
%{epics_prefix}/templates
%dir %{epics_prefix}/lib
%{epics_prefix}/lib/%{epics_host_arch}
%{_datadir}/pkgconfig/epics-base-%{epics_host_arch}.pc
%{_datadir}/pkgconfig/epics-base.pc
%dir %{epics_prefix}/lib/perl
%attr(0755,root,root) %{epics_prefix}/lib/perl/EpicsHostArch.pl
%{epics_prefix}/lib/perl/DBD
%{epics_prefix}/lib/perl/DBD.pm
%files -n perl-epics
%license LICENSE
%{perl_vendorlib}/EPICS
%{perl_vendorarch}/CA.pm
%{perl_vendorarch}/auto/*
%files -n epics-doc
%license LICENSE
%doc html README
%files -n libca%{libca_suffix}
%license LICENSE
%{_libdir}/libca.so.%{ca_sover}
%files -n libCom%{libCom_suffix}
%license LICENSE
%{_libdir}/libCom.so.%{Com_sover}
%files -n epics-caRepeater
%license LICENSE
%{_unitdir}/caRepeater.service
%{_bindir}/caRepeater
%{_sbindir}/rccaRepeater
%files -n epics-iocLogServer
%license LICENSE
%{_unitdir}/iocLogServer.service
%{_bindir}/iocLogServer
%{_sbindir}/rciocLogServer
%dir %attr(-,epics,epics) %{_var}/log/epics
%changelog