File libspe2.spec of Package libspe2

#
# spec file for package libspe2
#
# Copyright (c) 2016 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/
#


Name:           libspe2
Version:        2.3.0
Release:        0
Summary:        Helper for standalone SPE applications
License:        GPL-2.0+ and LGPL-2.1+
Group:          Development/Libraries/Cross
Url:            http://www.bsc.es/plantillaH.php?cat_id=253
PreReq:         %insserv_prereq grep coreutils aaa_base
Provides:       libspe
Obsoletes:      libspe
Source0:        %{name}-%{version}.tar.bz2
Source1:        elfspe
Source2:        baselibs.conf
Patch0:         libspe2.ps.patch
Patch1:         libspe2.binfmt.patch
Patch2:         libspe2.fix-suse-startup.patch
Patch3:         libspe2.fix-paths.patch
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
ExclusiveArch:  ppc ppc64
# match Cell for package installation
Supplements:    modalias(platform:cbe-mic)
# match ps3flash for package installation
Supplements:    modalias(ps3:8)

%description
The libspe is a library interface that has been established on top of
the spufs low-level programming model. The library interface does not
rely on implementation details of the file system and can also be used
on other operating systems that might have a different kernel
interface.



%prep
%setup
%patch0 -p1
%patch1 -p1
%patch2 -p1
%patch3 -p1

%build
make EXTRA_CFLAGS="$RPM_OPT_FLAGS" prefix=%{_prefix} libdir=%{_libdir}

%install
make install elfspe-install DESTDIR=$RPM_BUILD_ROOT prefix=%{_prefix} libdir=%{_libdir}
mkdir -p $RPM_BUILD_ROOT/etc/init.d/
chmod +x %{S:1}
cp %{S:1} $RPM_BUILD_ROOT/etc/init.d/elfspe
# delete static libs
rm $RPM_BUILD_ROOT%{_libdir}/libspe*.a

%post
/sbin/ldconfig
if grep -q 'Cell Broadband Engine' < /proc/cpuinfo ; then
	%{fillup_and_insserv -y elfspe }
	# check that we are not in chroot
	if [ $(stat -Lc '%%D-%%i' /) = $(stat -Lc '%%D-%%i' /proc/1/root) ] ; then
		# start elfspe if it's not running
		if [ ! -e /proc/sys/fs/binfmt_misc/spe ] ; then
			/etc/init.d/elfspe start
		fi
	fi
fi

%postun
/sbin/ldconfig
%{insserv_cleanup}

%preun
%stop_on_removal elfspe

%files
%defattr(-,root,root)
%doc COPYING
%{_libdir}/lib*.so.*
%attr(755,root,root) /usr/bin/*
%attr(755,root,root) /etc/init.d/elfspe

%package -n libspe2-devel
Requires:       %{name} = %{version}
Summary:        Helper for standalone SPE applications
License:        LGPL-2.1+
Group:          Development/Libraries/Cross

%description -n libspe2-devel
The libspe is a library interface that has been established on top of
the spufs low-level programming model. This package holds the
development files.



%files -n %{name}-devel
%defattr(-,root,root)
%{_libdir}/lib*.so
%{_libdir}/pkgconfig/*
/usr/include/*

%changelog
openSUSE Build Service is sponsored by