File libdfp.spec of Package libdfp
#
# spec file for package libdfp
#
# Copyright (c) 2020 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 https://bugs.opensuse.org/
#
Url: https://github.com/libdfp/libdfp
Name: libdfp
Summary: Decimal floating point library
License: LGPL-2.1-only
Group: Development/Libraries/C and C++
Version: 1.0.15
Release: 0
Source: libdfp-%{version}.tar.bz2
Source99: baselibs.conf
Patch1: libdfp-fix-install-perms.diff
BuildRoot: %{_tmppath}/%{name}-%{version}-build
BuildRequires: glibc-devel
BuildRequires: python3
ExclusiveArch: s390 s390x ppc64le x86_64
%description
A library containing support routines for calculating with and printing
decimal floating point values.
%package -n libdfp1
Summary: Decimal floating point library
Group: System/Libraries
%description -n libdfp1
A library containing support routines for calculating with and printing
decimal floating point values.
%package devel
Summary: Decimal floating point library
Group: Development/Libraries/C and C++
Requires: libdfp1 = %{version}
%description devel
A library containing support routines for calculating with and printing
decimal floating point values.
%package devel-static
Summary: Decimal floating point static library
Group: Development/Libraries/C and C++
Requires: libdfp-devel = %{version}
%description devel-static
A static library containing support routines for calculating with and printing
decimal floating point values.
%prep
%setup -n %{name}
%patch1 -p1
%build
# We ship a static library, so use fat LTO
%global _lto_cflags %{?_lto_cflags} -ffat-lto-objects
export CFLAGS="$RPM_OPT_FLAGS"
mkdir build
cd build
%define _configure ../configure
%configure
make %{?_smp_mflags}
cd ..
%install
cd build
make DESTDIR=%{buildroot} install
rm -rf %{buildroot}/usr/share/doc/dfp
find %{buildroot} -name '*decnumber*' | xargs rm -rf
find $RPM_BUILD_ROOT/%{_libdir} -name '*.a' | xargs chmod 644
%clean
rm -rf $RPM_BUILD_ROOT
%post -n libdfp1 -p /sbin/ldconfig
%postun -n libdfp1 -p /sbin/ldconfig
%files -n libdfp1
%defattr(-,root,root)
%{_libdir}/lib*so.*
%{_libdir}/libdfp-*.so
%files devel
%defattr(-,root,root)
%{_includedir}/dfp
%{_libdir}/libdfp.so
%{_libdir}/pkgconfig/libdfp.pc
%files devel-static
%defattr(-,root,root)
%{_libdir}/libdfp.a
%changelog