File libdfp.spec of Package libdfp

#
# spec file for package libdfp
#
# Copyright (c) 2014 SUSE LINUX Products 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/
#


Url:            http://www.eglibc.org/cgi-bin/viewcvs.cgi/libdfp/trunk/

Name:           libdfp
Summary:        Decimal floating point library
License:        LGPL-2.1
Group:          Development/Libraries/C and C++
Version:        1.0.9
Release:        0
Source:         libdfp-%{version}.tar.bz2
Source99:       baselibs.conf
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
BuildRequires:  glibc-devel
ExclusiveArch:  s390 s390x ppc ppc64 ppc64le

%description
A library containing support routines for calculating with and printing
decimal floating point values.



%package -n libdfp1
Summary:        Decimal floating point library
Group:          Development/Libraries/C and C++

%description -n libdfp1
A library containing support routines for calculating with and printing
decimal floating point values.



%package -n libdfp-devel
Summary:        Decimal floating point library
Group:          Development/Libraries/C and C++
Requires:       libdfp1 = %{version}

%description -n libdfp-devel
A library containing support routines for calculating with and printing
decimal floating point values.



%prep
%setup -n %{name}

%build
export CFLAGS="$RPM_OPT_FLAGS"
mkdir build
cd build
../configure --prefix=/usr --enable-decimal-float=yes
make %{?jobs:-j%jobs} -C libdecnumber DEFS="-D__STDC_DEC_FP__=200704L" CFLAGS="$CFLAGS -fPIC"
make %{?jobs:-j%jobs}
cd ..
%ifarch s390 s390x
mkdir build-ec
cd build-ec
../configure --prefix=/usr --with-cpu=z9-ec --enable-decimal-float=yes
make %{?jobs:-j%jobs} -C libdecnumber DEFS="-D__STDC_DEC_FP__=200704L" CFLAGS="$CFLAGS -fPIC"
make %{?jobs:-j%jobs}
cd ..
%else
%ifarch ppc ppc64
mkdir buildp6
cd buildp6
../configure --prefix=/usr --with-cpu=power6 --enable-decimal-float=yes
make %{?jobs:-j%jobs} -C libdecnumber DEFS="-D__STDC_DEC_FP__=200704L" CFLAGS="$CFLAGS -fPIC"
make %{?jobs:-j%jobs}
cd ..
mkdir buildp7
cd buildp7
../configure --prefix=/usr --with-cpu=power7 --enable-decimal-float=yes
make %{?jobs:-j%jobs} -C libdecnumber DEFS="-D__STDC_DEC_FP__=200704L" CFLAGS="$CFLAGS -fPIC"
make %{?jobs:-j%jobs}
cd ..
%endif
%endif

%install
cd build
install -d $RPM_BUILD_ROOT/%{_includedir}/dfp/
install -d $RPM_BUILD_ROOT/%{_includedir}/dfp/decimal/
install -m644 -t $RPM_BUILD_ROOT/%{_includedir}/dfp/ ../dfp/*.h
install -m644 -t $RPM_BUILD_ROOT/%{_includedir}/dfp/decimal/ ../dfp/decimal/*
install -d $RPM_BUILD_ROOT/%{_libdir}
install -t $RPM_BUILD_ROOT/%{_libdir}/ libdfp-%{version}.so libdfp.a
pushd $RPM_BUILD_ROOT/%{_libdir}/
ln -sf libdfp-%{version}.so libdfp.so.1
ln -sf libdfp.so.1 libdfp.so
popd
%ifarch s390 s390x
cd ../build-ec
install -d $RPM_BUILD_ROOT/%{_libdir}/dfp
install -t $RPM_BUILD_ROOT/%{_libdir}/dfp libdfp-%{version}.so libdfp.a
pushd $RPM_BUILD_ROOT/%{_libdir}/dfp
ln -sf libdfp-%{version}.so libdfp.so.1
ln -sf libdfp.so.1 libdfp.so
popd
cd ..
%endif
%ifarch ppc ppc64
cd ../buildp6
install -d $RPM_BUILD_ROOT/%{_libdir}/power6
install -t $RPM_BUILD_ROOT/%{_libdir}/power6 libdfp-%{version}.so libdfp.a
pushd $RPM_BUILD_ROOT/%{_libdir}/power6
ln -sf libdfp-%{version}.so libdfp.so.1
ln -sf libdfp.so.1 libdfp.so
popd
cd ../buildp7
install -d $RPM_BUILD_ROOT/%{_libdir}/power7
install -t $RPM_BUILD_ROOT/%{_libdir}/power7 libdfp-%{version}.so libdfp.a
pushd $RPM_BUILD_ROOT/%{_libdir}/power7
ln -sf libdfp-%{version}.so libdfp.so.1
ln -sf libdfp.so.1 libdfp.so
popd
cd ..
%endif
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
%ifarch s390 s390x
%dir %{_libdir}/dfp/
%endif
%ifarch ppc ppc64
%dir %{_libdir}/power6/
%dir %{_libdir}/power7/
%endif
%ifarch s390 s390x ppc ppc64
%{_libdir}/*/lib*so.*
%{_libdir}/*/libdfp-*.so
%endif

%files -n libdfp-devel
%defattr(-,root,root)
%{_includedir}/dfp
%{_libdir}/libdfp.so
%{_libdir}/libdfp.a
%ifarch s390 s390x ppc ppc64
%{_libdir}/*/libdfp.so
%{_libdir}/*/libdfp.a
%endif

%changelog
openSUSE Build Service is sponsored by