# Always make sure EpicsVersion.Version-Release matches the git tag! %define EpicsVersion 7.0.7 Name: epics-base-%{EpicsVersion} Summary: EPICS Base %{EpicsVersion} Version: 1 Release: 3%{?dist} License: EPICS Open License Group: Development/Languages URL: https://git.psi.ch/epics_base/base-7.0 %define module_name %{name} %define prog_folder /usr/local/epics/base-%{EpicsVersion} %define debug_package %{nil} # do not strip libraries %global __strip /bin/true %undefine __brp_strip %undefine __brp_mangle_shebangs %undefine __brp_ldconfig %define _binaries_in_noarch_packages_terminate_build 0 %if %{defined rhel} %global epics_host_arch RHEL%{rhel}-%{_host_cpu} %endif %description EPICS is a set of Open Source software tools, libraries and applications developed collaboratively and used worldwide to create distributed soft real-time control systems for scientific instruments such as a particle accelerators, telescopes and other large scientific experiments. This RPM is a binary-only package. ########################################### %package host-devel Requires: make >= 3.80 BuildRequires: make >= 3.80 Summary: Minimal stuff needed to build EPICS host apps Requires: %{name} = %{version}-%{release} # This EPICS installation uses the toolset 12 compiler %if 0%{?rhel} == 7 Requires: devtoolset-12-gcc-c++ BuildRequires: devtoolset-12-gcc-c++ %endif %if 0%{?rhel} >= 8 Requires: gcc-toolset-12-gcc-c++ BuildRequires: gcc-toolset-12-gcc-c++ %endif # The perl stuff we need Requires: perl-interpreter >= 5.10.1 BuildRequires: perl-interpreter >= 5.10.1 %if 0%{?rhel} >= 7 Requires: perl-File-Path perl-Getopt-Long perl-Pod-Usage perl-Time-HiRes perl-Data-Dumper perl-Scalar-List-Utils BuildRequires: perl-File-Path perl-Getopt-Long perl-Pod-Usage perl-Time-HiRes perl-Data-Dumper perl-Scalar-List-Utils %endif %if 0%{?rhel} >= 8 Requires: perl-Text-Tabs+Wrap BuildRequires: perl-Text-Tabs+Wrap %endif %if 0%{?rhel} >= 9 Requires: perl-File-Find perl-File-Basename perl-File-Copy perl-FindBin perl-Getopt-Std perl-POSIX BuildRequires: perl-File-Find perl-File-Basename perl-File-Copy perl-FindBin perl-Getopt-Std perl-POSIX %endif %if 0%{?rhel} == 7 # Perl auto-detection is broken # It does not find all EPICS internal packages %global __requires_exclude_from ^%{prog_folder}/bin/.*\\.pl$ %endif %description host-devel Contains headers etc to build EPICS host applications. ########################################### %package compat Summary: EPICS base %{EpicsVersion} for other RHEL versions Requires: %{name} = %{version}-%{release} AutoReqProv: no %description compat Contains EPICS binaries that run on other RHEL versions. ########################################### %package wine Summary: EPICS base %{EpicsVersion} for wine Requires: %{name} = %{version}-%{release} Requires: wine BuildRequires: wine %description wine Allows to run EPICS in wine. ########################################### %package boot Summary: EPICS base %{EpicsVersion} for boot servers BuildArch: noarch AutoReqProv: no Prefix: /usr/local/epics %description boot Contains files needed on NFS server to boot EPICS targets from. This package can be relocated. ########################################### %package devel Summary: EPICS base %{EpicsVersion} for development environments Requires: %{name} = %{version}-%{release} Requires: %{name}-host-devel = %{version}-%{release} Requires: %{name}-boot = %{version}-%{release} Requires: gfa-cross-compiler-links BuildArch: noarch AutoReqProv: no %description devel All what is needed to develop EPICS for different target architectures. ########################################### %package devel-static Summary: EPICS base %{EpicsVersion} for development environments including static libraries Requires: %{name}-devel = %{version}-%{release} BuildArch: noarch AutoReqProv: no %description devel-static Contains the static libraries (*.a) for EPICS development systems. Only needed to build statically linked applications. ########################################### %package src Summary: Sources code of EPICS base %{EpicsVersion} BuildArch: noarch AutoReqProv: no Prefix: /usr/local/epics %description src The source code of EPICS base %{EpicsVersion}. May help when debugging ########################################### %package doc Summary: EPICS base %{EpicsVersion} documentation BuildArch: noarch AutoReqProv: no Prefix: /usr/local/epics %description doc The documentation of EPICS base %{EpicsVersion}. ########################################### # Our sources are locally in this directory # and here we also build # RPMS and SRPMS will be stored here, too %define _topdir %(pwd) %define _sourcedir %{_topdir} %define _builddir %{_topdir} %prep %{__rm} -rf %{buildroot}/usr/lib %{__rm} -f modules/RELEASE.*.local git submodule update --init modules %build %if %{defined epics_host_arch} export EPICS_HOST_ARCH=%{epics_host_arch} %endif %{__make} -j $RPM_BUILD_NCPUS INSTALL_LOCATION=%{buildroot}/%{prog_folder} FINAL_LOCATION=%{prog_folder} %{__make} INSTALL_LOCATION=%{buildroot}/%{prog_folder} copysrc # remove files we do not need shopt -s extglob %{__rm} -f %{buildroot}/%{prog_folder}/bin/{V,RTEMS}*/{*Harness,softIoc,softIocPVA} %{__rm} -f %{buildroot}/%{prog_folder}/bin/RTEMS*/TEMP.* # install the profile script %{__install} epics-base.sh %{buildroot}/%{prog_folder}/bin # Do not use install section because build already installed # and install will delete our buildroot! %clean %{__make} realclean %{__rm} -f modules/RELEASE.*.local # Link caRepeater and profile script to highest installed EPICS version after install and uninstall %post shopt -s extglob if [ -e /etc/profile.d/epics-base.sh ] then %{__rm} -f /etc/profile.d/epics-base.sh fi %{__ln_s} "$(/usr/bin/ls -dvr1 /usr/local/epics/base-+([0-9]).+([0-9]).+([0-9])/bin/epics-base.sh | /usr/bin/head -n1)" /etc/profile.d/ SYSTEMD_DIR=$(pkg-config systemd --variable=systemdsystemunitdir) if [ -n "$SYSTEMD_DIR" ] then systemctl is-enabled caRepeater.service 2>/dev/null && systemctl disable --now caRepeater.service test -e $SYSTEMD_DIR/caRepeater.service && %{__rm} $SYSTEMD_DIR/caRepeater.service %{__ln_s} "$(/usr/bin/ls -dvr1 /usr/local/epics/base-+([0-9]).+([0-9]).+([0-9])/bin/%{epics_host_arch}/caRepeater.service | /usr/bin/head -n1)" $SYSTEMD_DIR/ systemctl daemon-reload killall caRepeater 2>/dev/null systemctl enable --now caRepeater.service fi %postun shopt -s extglob if [ -e /etc/profile.d/epics-base.sh ] then %{__rm} -f /etc/profile.d/epics-base.sh fi %{__ln_s} "$(/usr/bin/ls -dvr1 /usr/local/epics/base-+([0-9]).+([0-9]).+([0-9])/bin/epics-base.sh 2>/dev/null | /usr/bin/head -n1)" /etc/profile.d/ 2>/dev/null SYSTEMD_DIR=$(pkg-config systemd --variable=systemdsystemunitdir) if [ -n "$SYSTEMD_DIR" ] then systemctl disable --now caRepeater.service %{__rm} -f $SYSTEMD_DIR/caRepeater.service %{__ln_s} "$(/usr/bin/ls -dvr1 /usr/local/epics/base-+([0-9]).+([0-9]).+([0-9])/bin/%{epics_host_arch}/caRepeater.service 2>/dev/null | /usr/bin/head -n1)" $SYSTEMD_DIR/ 2>/dev/null systemctl daemon-reload if [ -e $SYSTEMD_DIR/caRepeater.service ] then killall caRepeater 2>/dev/null systemctl enable --now caRepeater.service fi fi %files %defattr(-,root,root,-) %dir %{prog_folder} %dir %{prog_folder}/configure %{prog_folder}/configure/CONFIG_BASE_VERSION %dir %{prog_folder}/dbd %{prog_folder}/dbd/softIoc*.dbd %dir %{prog_folder}/bin %dir %{prog_folder}/lib %{prog_folder}/db %{prog_folder}/bin/epics-base.sh # Install host binaries but avoid installing *.pl scripts # and other development tools %if %{defined rhel} %dir %{prog_folder}/bin/RHEL%{rhel}* %{prog_folder}/bin/RHEL%{rhel}*/[Scips]*[^.]?? %{prog_folder}/bin/RHEL%{rhel}*/p2p %{prog_folder}/bin/RHEL%{rhel}*/msi %dir %{prog_folder}/lib/RHEL%{rhel}* %{prog_folder}/lib/RHEL%{rhel}*/*.so* %endif ########################################### %files compat %if %{?rhel} > 7 %{prog_folder}/bin/RHEL7* %dir %{prog_folder}/lib/RHEL7* %{prog_folder}/lib/RHEL7*/*.so* %endif %if %{?rhel} > 8 %{prog_folder}/bin/RHEL8* %dir %{prog_folder}/lib/RHEL8* %{prog_folder}/lib/RHEL8*/*.so* %endif %if %{?rhel} > 9 %{prog_folder}/bin/RHEL9* %dir %{prog_folder}/lib/RHEL9* %{prog_folder}/lib/RHEL9*/*.so* %endif ########################################### %files wine %{prog_folder}/bin/win* ########################################### %files boot %defattr(-,root,root,-) %dir %{prog_folder}/configure %{prog_folder}/configure/CONFIG_BASE_VERSION %dir %{prog_folder}/dbd %{prog_folder}/dbd/softIoc*.dbd %{prog_folder}/db %dir %{prog_folder}/lib # avoid pulling in pkgconfig and perl %dir %{prog_folder}/lib/[a-z]*-* %{prog_folder}/lib/[a-z]*-*/*.so* %dir %{prog_folder}/bin # avoid pulling in host files again # but get all cross architectures (mostly lower case) # including all Windows dlls (hence listed twice: here and in wine) %dir %{prog_folder}/bin/[a-z]* %{prog_folder}/bin/[a-z]*/[Scips]*[^.]?? %{prog_folder}/bin/[a-z]*/msi* %{prog_folder}/bin/[a-z]*/*.dll # vxWorks and RTEMS %dir %{prog_folder}/bin/V* %{prog_folder}/bin/V*/*.munch %{prog_folder}/bin/V*/*.o %dir %{prog_folder}/bin/RTEMS* %{prog_folder}/bin/RTEMS*/*.boot ########################################### %files host-devel %defattr(-,root,root,-) %{prog_folder}/configure %{prog_folder}/cfg %{prog_folder}/include %{prog_folder}/templates %if %{defined rhel} %{prog_folder}/bin/RHEL%{rhel}*/[^Scips]*[^.]?? %{prog_folder}/bin/RHEL%{rhel}*/*.?? %endif %{prog_folder}/lib/pkgconfig %{prog_folder}/lib/perl %{prog_folder}/lib/win* %{prog_folder}/lib/RTEMS* %{prog_folder}/dbd ########################################### %files devel %defattr(-,root,root,-) %{prog_folder}/bin/[a-z]*/[^Scips]*[^.]?? # VxWorks and RTEMS need static libs %{prog_folder}/lib/V* ########################################### %files devel-static %defattr(-,root,root,-) # Install bulky static libs for Linux targets only on request %{prog_folder}/lib/RHEL*/*.a %{prog_folder}/lib/[a-z]*/*.a ########################################### %files src %defattr(-,root,root,-) %dir %{prog_folder} %{prog_folder}/modules ########################################### %files doc %defattr(-,root,root,-) %dir %{prog_folder} %docdir %{prog_folder}/html %{prog_folder}/html