File libfiu.spec of Package libfiu

#
# spec file for package libfiu
#
# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany.
#
# 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 http://bugs.opensuse.org/
#

%define _lver   0
Name:           libfiu
Version:        0.95
Release:        0
Summary:        Fault injection in userspace
License:        SUSE-Public-Domain
Group:          Development/Languages/C and C++
Url:            https://blitiri.com.ar/p/%{name}/
Source0:        https://blitiri.com.ar/p/%{name}/files/%{version}/%{name}-%{version}.tar.bz2
BuildRequires:  gcc
BuildRequires:  python-devel
BuildRequires:  python3-devel
BuildRoot:      %{_tmppath}/%{name}-%{version}-build

%description
libfiu is a C library for fault injection. It provides functions to mark "points of failure"
inside your code (the "core API"), and functions to enable/disable the failure of those
points (the "control API").

%package        devel
Summary:        Development files for %{name}
Group:          Development/Libraries/C and C++
Requires:       %{name}%{_lver} = %{version}

%description    devel
The %{name}-devel package contains libraries and header files for
developing applications that use %{name}.

%package     -n %{name}%{_lver}
Summary:        Fault injection in userspace
Group:          System/Libraries

%description -n %{name}%{_lver}
libfiu is a C library for fault injection. It provides functions to mark "points of failure"
inside your code (the "core API"), and functions to enable/disable the failure of those
points (the "control API").

%package     -n fiu-tools
Summary:        Fault injection in userspace
Group:          Development/Tools/Other

%description -n fiu-tools
Fault injection in userspace (tools).

%package     -n python-%{name}
Summary:        Python bindings for %{name}
Group:          Development/Languages/Python
Requires:       %{name}%{_lver} = %{version}

%description -n python-%{name}
The python-%{name} package contains bindings to use %{name}
from python.

%package     -n python3-%{name}
Summary:        Python3 bindings for %{name}
Group:          Development/Languages/Python
Requires:       %{name}%{_lver} = %{version}

%description -n python3-%{name}
The python3-%{name} package contains bindings to use %{name}
from python3.

%prep
%setup -q
sed -e 's|FIX)/lib|FIX)%{_lib}|g' -e '/$(INSTALL)/s/$(PREFIX)/$(INSTALL_DIR)\/$(PREFIX)/g' \
    -e '/ln -fs/s/$(PREFIX)/$(INSTALL_DIR)\/$(PREFIX)/g' -e 's|/usr/local|%{_prefix}/|g' \
    -i utils/Makefile libfiu/Makefile preload/posix/Makefile preload/run/Makefile
sed -e 's|fix}/lib|fix}/%{_lib}|' -i libfiu/libfiu.pc.in
sed -e 's|/lib/|/%{_lib}/|' -i bindings/python/setup.py

%build
export CFLAGS="%{optflags}"
make %{?_smp_mflags}
pushd bindings/python
python2 setup.py build
python3 setup.py build
popd

%install
make INSTALL_DIR=%{buildroot} install
pushd bindings/python
python2 setup.py install --prefix=%{_prefix} --root=%{buildroot}
python3 setup.py install --prefix=%{_prefix} --root=%{buildroot}
popd
find %{buildroot}%{_libdir} -name *.a -delete

%post -n %{name}%{_lver} -p /sbin/ldconfig
%postun -n %{name}%{_lver} -p /sbin/ldconfig

%files devel
%defattr(-,root,root)
%doc README LICENSE
%{_includedir}/fiu-control.h
%{_includedir}/fiu-local.h
%{_includedir}/fiu.h
%{_libdir}/%{name}.so
%{_libdir}/pkgconfig/%{name}.pc

%files -n %{name}%{_lver}
%defattr(-,root,root)
%doc README LICENSE
%{_libdir}/%{name}.so.%{_lver}*

%files -n fiu-tools
%defattr(-,root,root)
%doc README LICENSE
%{_bindir}/fiu-ctrl
%{_bindir}/fiu-ls
%{_bindir}/fiu-run
%{_libdir}/fiu_posix_preload.so
%{_libdir}/fiu_run_preload.so
%{_mandir}/man1/fiu-ctrl.1%{ext_man}
%{_mandir}/man1/fiu-ls.1%{ext_man}
%{_mandir}/man1/fiu-run.1%{ext_man}
%{_mandir}/man3/libfiu.3%{ext_man}

%files -n python-%{name}
%defattr(-,root,root)
%doc README LICENSE
%{python_sitearch}

%files -n python3-%{name}
%defattr(-,root,root)
%doc README LICENSE
%{python3_sitearch}

%changelog
openSUSE Build Service is sponsored by