Blame SPECS/dyninst.spec

7f6d9e
# For RHEL8 we need this before using any scl macro.
7f6d9e
%global __python /usr/bin/python3
7f6d9e
7f6d9e
%{?scl:%scl_package dyninst}
7f6d9e
7f6d9e
Summary: An API for Run-time Code Generation
7f6d9e
License: LGPLv2+
7f6d9e
Name: %{?scl_prefix}dyninst
7f6d9e
Group: Development/Libraries
46998e
Release: 1%{?dist}
7f6d9e
URL: http://www.dyninst.org
46998e
Version: 10.2.1
7f6d9e
Exclusiveos: linux
7f6d9e
ExclusiveArch: %{ix86} x86_64 ppc64le aarch64
7f6d9e
46998e
%define __testsuite_version 10.1.0
7f6d9e
Source0: https://github.com/dyninst/dyninst/archive/v%{version}/dyninst-%{version}.tar.gz
46998e
Source1: https://github.com/dyninst/testsuite/archive/v%{__testsuite_version}/testsuite-%{__testsuite_version}.tar.gz
7f6d9e
46998e
Patch1: dyninst-gcc11.patch
46998e
Patch2: dyninst-10.2.1-dbid.patch
46998e
Patch3: testsuite-10.1.0-gettid.patch
46998e
Patch4: testsuite-10.1.0-386.patch
46998e
Patch5: testsuite-10.1.0-throw.patch
46998e
Patch6: dyninst-10.2.1-tbb.patch
7f6d9e
7f6d9e
%global dyninst_base dyninst-%{version}
46998e
%global testsuite_base testsuite-%{__testsuite_version}
7f6d9e
7f6d9e
7f6d9e
BuildRequires: zlib-devel
7f6d9e
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
7f6d9e
BuildRequires: elfutils-devel
7f6d9e
BuildRequires: elfutils-libelf-devel
7f6d9e
BuildRequires: boost-devel
7f6d9e
BuildRequires: binutils-devel
7f6d9e
BuildRequires: cmake
7f6d9e
BuildRequires: libtirpc-devel
7f6d9e
BuildRequires: tbb tbb-devel
7f6d9e
7f6d9e
%{?scl:Requires: %scl_runtime}
7f6d9e
7f6d9e
# Extra requires just for the testsuite
7f6d9e
# NB, there's no separate libstdc++-static for <=el6
7f6d9e
%if 0%{?rhel} >= 7
7f6d9e
BuildRequires: libstdc++-static
7f6d9e
%endif
46998e
BuildRequires: gcc-gfortran glibc-static libxml2-devel
7f6d9e
%if 0%{?rhel} == 6
7f6d9e
# C++11 requires devtoolset gcc.
7f6d9e
BuildRequires: %{?scl_prefix}gcc-c++
7f6d9e
%endif
7f6d9e
7f6d9e
# Testsuite files should not provide/require anything
7f6d9e
%{?filter_setup:
7f6d9e
%filter_provides_in %{_libdir}/dyninst/testsuite/
7f6d9e
%filter_requires_in %{_libdir}/dyninst/testsuite/
7f6d9e
%filter_setup
7f6d9e
}
7f6d9e
7f6d9e
%description
7f6d9e
7f6d9e
Dyninst is an Application Program Interface (API) to permit the insertion of
7f6d9e
code into a running program. The API also permits changing or removing
7f6d9e
subroutine calls from the application program. Run-time code changes are
7f6d9e
useful to support a variety of applications including debugging, performance
7f6d9e
monitoring, and to support composing applications out of existing packages.
7f6d9e
The goal of this API is to provide a machine independent interface to permit
7f6d9e
the creation of tools and applications that use run-time code patching.
7f6d9e
7f6d9e
%package doc
7f6d9e
Summary: Documentation for using the Dyninst API
7f6d9e
Group: Documentation
7f6d9e
%description doc
7f6d9e
dyninst-doc contains API documentation for the Dyninst libraries.
7f6d9e
7f6d9e
%package devel
7f6d9e
Summary: Header files for compiling programs with Dyninst
7f6d9e
Group: Development/System
7f6d9e
Requires: %{?scl_prefix}dyninst = %{version}-%{release}
7f6d9e
Requires: boost-devel
7f6d9e
Requires: tbb-devel
7f6d9e
7f6d9e
%description devel
7f6d9e
dyninst-devel includes the C header files that specify the Dyninst user-space
7f6d9e
libraries and interfaces. This is required for rebuilding any program
7f6d9e
that uses Dyninst.
7f6d9e
7f6d9e
%package static
7f6d9e
Summary: Static libraries for the compiling programs with Dyninst
7f6d9e
Group: Development/System
7f6d9e
Requires: %{?scl_prefix}dyninst-devel = %{version}-%{release}
7f6d9e
%description static
7f6d9e
dyninst-static includes the static versions of the library files for
7f6d9e
the dyninst user-space libraries and interfaces.
7f6d9e
7f6d9e
%package testsuite
7f6d9e
Summary: Programs for testing Dyninst
7f6d9e
Group: Development/System
7f6d9e
Requires: %{?scl_prefix}dyninst = %{version}-%{release}
7f6d9e
Requires: %{?scl_prefix}dyninst-devel = %{version}-%{release}
7f6d9e
Requires: %{?scl_prefix}dyninst-static = %{version}-%{release}
7f6d9e
Requires: glibc-static
7f6d9e
%description testsuite
7f6d9e
dyninst-testsuite includes the test harness and target programs for
7f6d9e
making sure that dyninst works properly.
7f6d9e
7f6d9e
%prep
7f6d9e
%setup -q -n %{name}-%{version} -c
7f6d9e
%setup -q -T -D -a 1
7f6d9e
46998e
%patch1 -p1 -b .gcc11
46998e
%patch2 -p1 -b .dbid
46998e
%patch3 -p1 -b .gettid
46998e
%patch4 -p1 -b .386
46998e
%patch5 -p1 -b .throw
46998e
%patch6 -p1 -b .tbb
7f6d9e
7f6d9e
# cotire seems to cause non-deterministic gcc errors
7f6d9e
# https://bugzilla.redhat.com/show_bug.cgi?id=1420551
7f6d9e
sed -i.cotire -e 's/USE_COTIRE true/USE_COTIRE false/' \
7f6d9e
  %{dyninst_base}/cmake/shared.cmake
7f6d9e
7f6d9e
%build
7f6d9e
7f6d9e
cd %{dyninst_base}
7f6d9e
7f6d9e
%if 0%{?rhel} == 6
7f6d9e
# C++11 requires devtoolset gcc.
7f6d9e
%{?scl:PATH=%{_bindir}${PATH:+:${PATH}}}
7f6d9e
%endif
7f6d9e
46998e
CFLAGS="$CFLAGS $RPM_OPT_FLAGS"
46998e
LDFLAGS="$LDFLAGS $RPM_LD_FLAGS"
46998e
%ifarch %{ix86}
46998e
    CFLAGS="$CFLAGS -fno-lto -march=i686"
46998e
    LDFLAGS="$LDFLAGS -fno-lto"
46998e
%endif    
46998e
CXXFLAGS="$CFLAGS"
46998e
export CFLAGS CXXFLAGS LDFLAGS
46998e
7f6d9e
%cmake \
7f6d9e
 -DENABLE_STATIC_LIBS=1 \
7f6d9e
 -DCMAKE_BUILD_TYPE:STRING=None \
7f6d9e
 -DINSTALL_LIB_DIR:PATH=%{_libdir}/dyninst \
7f6d9e
 -DINSTALL_INCLUDE_DIR:PATH=%{_includedir}/dyninst \
7f6d9e
 -DINSTALL_CMAKE_DIR:PATH=%{_libdir}/cmake/Dyninst \
7f6d9e
 -DBoost_NO_BOOST_CMAKE=ON \
46998e
 -DCMAKE_SKIP_RPATH:BOOL=YES \
46998e
 .
46998e
%make_build
7f6d9e
7f6d9e
# Hack to install dyninst nearby, so the testsuite can use it
7f6d9e
make DESTDIR=../install install
7f6d9e
find ../install -name '*.cmake' -execdir \
7f6d9e
  sed -i -e 's!%{_prefix}!../install&!' '{}' '+'
46998e
# cmake mistakenly looks for libtbb.so in the dyninst install dir
46998e
sed -i '/libtbb.so/ s/".*usr/"\/usr/' $PWD/../install%{_libdir}/cmake/Dyninst/commonTargets.cmake
7f6d9e
7f6d9e
cd ../%{testsuite_base}
7f6d9e
%cmake \
7f6d9e
 -DDyninst_DIR:PATH=$PWD/../install%{_libdir}/cmake/Dyninst \
7f6d9e
 -DINSTALL_DIR:PATH=%{_libdir}/dyninst/testsuite \
7f6d9e
 -DCMAKE_BUILD_TYPE:STRING=Debug \
7f6d9e
 -DBoost_NO_BOOST_CMAKE=ON \
46998e
 -DCMAKE_SKIP_RPATH:BOOL=YES \
46998e
 .
46998e
%make_build
7f6d9e
7f6d9e
%install
7f6d9e
7f6d9e
cd %{dyninst_base}
46998e
%make_install
7f6d9e
7f6d9e
# It doesn't install docs the way we want, so remove them.
7f6d9e
# We'll just grab the pdfs later, directly from the build dir.
7f6d9e
rm -v %{buildroot}%{_docdir}/*-%{version}.pdf
7f6d9e
7f6d9e
cd ../%{testsuite_base}
46998e
%make_install
46998e
46998e
# Ugly hack to mask testsuite files from debuginfo extraction.  Running the
46998e
# testsuite requires debuginfo, so extraction is useless.  However, debuginfo
46998e
# extraction is still nice for the main libraries, so we don't want to disable
46998e
# it package-wide.  The permissions are restored by attr(755,-,-) in files.
46998e
find %{buildroot}%{_libdir}/dyninst/testsuite/ \
46998e
  -type f '!' -name '*.a' -execdir chmod 644 '{}' '+'
7f6d9e
7f6d9e
%files
7f6d9e
%defattr(-,root,root,-)
7f6d9e
7f6d9e
%dir %{_libdir}/dyninst
7f6d9e
%{_libdir}/dyninst/*.so.*
7f6d9e
# dyninst mutators dlopen the runtime library
7f6d9e
%{_libdir}/dyninst/libdyninstAPI_RT.so
7f6d9e
7f6d9e
%doc %{dyninst_base}/COPYRIGHT
7f6d9e
%doc %{dyninst_base}/LICENSE.md
7f6d9e
7f6d9e
%files doc
7f6d9e
%defattr(-,root,root,-)
7f6d9e
%doc %{dyninst_base}/dataflowAPI/doc/dataflowAPI.pdf
7f6d9e
%doc %{dyninst_base}/dynC_API/doc/dynC_API.pdf
7f6d9e
%doc %{dyninst_base}/dyninstAPI/doc/dyninstAPI.pdf
7f6d9e
%doc %{dyninst_base}/instructionAPI/doc/instructionAPI.pdf
7f6d9e
%doc %{dyninst_base}/parseAPI/doc/parseAPI.pdf
7f6d9e
%doc %{dyninst_base}/patchAPI/doc/patchAPI.pdf
7f6d9e
%doc %{dyninst_base}/proccontrol/doc/proccontrol.pdf
7f6d9e
%doc %{dyninst_base}/stackwalk/doc/stackwalk.pdf
7f6d9e
%doc %{dyninst_base}/symtabAPI/doc/symtabAPI.pdf
7f6d9e
7f6d9e
%files devel
7f6d9e
%defattr(-,root,root,-)
7f6d9e
%{_includedir}/dyninst
7f6d9e
%{_libdir}/dyninst/*.so
7f6d9e
%{_libdir}/cmake/Dyninst
7f6d9e
7f6d9e
%files static
7f6d9e
%defattr(-,root,root,-)
7f6d9e
%{_libdir}/dyninst/*.a
7f6d9e
7f6d9e
%files testsuite
7f6d9e
%defattr(-,root,root,-)
7f6d9e
%{_bindir}/parseThat
7f6d9e
%dir %{_libdir}/dyninst/testsuite/
7f6d9e
%attr(755,root,root) %{_libdir}/dyninst/testsuite/*[!a]
7f6d9e
%attr(644,root,root) %{_libdir}/dyninst/testsuite/*.a
7f6d9e
7f6d9e
%changelog
46998e
* Wed Oct 28 2020 Stan Cox <scox@redhat.com> - 10.2.1-1
46998e
- Update to 10.2.1
46998e
7f6d9e
* Mon Jun 1 2020 Martin Cermak <mcermak@redhat.com> - 10.1.0-2
7f6d9e
- NVR Bump and rebuild
7f6d9e
7f6d9e
* Sun Jun 9 2019 Stan Cox <scox@redhat.com> - 10.1.0-1
7f6d9e
- Update to 10.1.0