# If it's a released tarball, provide the source here
%global source http://downloads.sourceforge.net/project/pocl/pocl-0.9.tar.gz
%global is_release %{?source:1}%{!?source:0}
%if !%{?is_release}
%global commit fc4565b95d5ef90f1f3b634054d8892b193344e2
%global shortcommit %(c=%{commit}; echo ${c:0:7})
%global commitdate 20140117
%global gitversion .git%{commitdate}.%{shortcommit}
%global source https://github.com/%{name}/%{name}/archive/%{commit}/%{name}-%{version}-%{shortcommit}.tar.gz
%endif
Summary: Portable Computing Language - an OpenCL implementation
Name: pocl
Version: 0.9
Release: 4%{?gitversion}%{?dist}
# The whole code is under MIT
# except include/utlist.h which is under BSD (and unbundled) and
# except lib/kernel/vecmath which is under GPLv3+ or LGPLv3+ (and unbundled in future)
License: MIT and BSD and (GPLv3+ or LGPLv3+)
URL: http://pocl.sourceforge.net
Source0: %{?source}
# Only armv7l is supported
# PPC support is currently broken, due to path problems
# s390(x) and aarch64 also not supported, so use ExclusiveArch
ExclusiveArch: %{ix86} x86_64
BuildRequires: clang clang-devel
BuildRequires: llvm llvm-devel llvm-static
BuildRequires: hwloc-devel
BuildRequires: libtool
BuildRequires: libtool-ltdl-devel
BuildRequires: mesa-libGL-devel
BuildRequires: ocl-icd-devel
BuildRequires: opencl-filesystem
BuildRequires: opencl-headers
BuildRequires: uthash-devel
#BuildRequires: vecmath-devel
Requires: clang%{_isa}
Requires: opencl-filesystem
Requires: uthash
Requires: libstdc++-devel%{_isa}
# libstdc++ from gcc is used
# https://bugzilla.redhat.com/show_bug.cgi?id=1021645
Requires: gcc-c++%{?_isa}
# Runtime dependency, because libm.so is required for kernels
Requires: glibc-devel%{?_isa}
%description
Pocl's goal is to become an efficient open source (MIT-licensed) implementation
of the OpenCL 1.2 (and soon OpenCL 2.0) standard.
In addition to producing an easily portable open-source OpenCL implementation,
another major goal of this project is improving performance portability of
OpenCL programs with compiler optimizations, reducing the need for
target-dependent manual optimizations.
At the core of pocl is the kernel compiler that consists of a set of LLVM
passes used to statically transform kernels into work-group functions with
multiple work-items, even in the presence of work-group barriers. These
functions are suitable for parallelization in multiple ways (SIMD, VLIW,
superscalar,...).
%package devel
Summary: Portable Computing Lanugage development files
Requires: %{name}%{?_isa} = %{version}-%{release}
Requires: opencl-headers
%description devel
Portable Computing Lanugage development files
%prep
%if %{?is_release}
%setup -q
%else
%setup -qn %{name}-%{?commit}
%endif
# Unbundle uthash
find . -depth -name utlist* | xargs rm -f
sed -i "s/utlist\.h//" include/Makefile.am
autoreconf -fiv
%build
# Somehow clang is not aware of common marches like pentium-m
# Setting it to (unknown) tells pocl to not add -march
# https://github.com/pocl/pocl/issues/29
%ifarch %{ix86}
export LLC_HOST_CPU="pentium-m"
%endif
%ifarch x86_64
export LLC_HOST_CPU="x86-64"
%endif
%configure --disable-static \
--enable-icd \
--enable-tests-with-icd=default
make %{?_smp_mflags}
%install
%make_install
# NOTE: We intentionally don't ship *.la files
find %{buildroot} -type f -name '*.la' | xargs rm -f -- || :
# Unbundle vecmath
#rm -vf %{buildroot}/%{_libdir}/pocl/vecmath/
#ln -vs %{_includedir}/vecmath %{buildroot}/%{_libdir}/pocl/vecmath
# <visit0r> but you need to run the .py to generate the files under the pocl dir
%check
make check
%post -p /sbin/ldconfig
%postun -p /sbin/ldconfig
%files
%doc README doc/sphinx/source/*.rst
%{_sysconfdir}/OpenCL/vendors/pocl.icd
%{_bindir}/pocl-standalone
%{_libdir}/libpocl.so.1.2.0
%{_libdir}/libpocl.so.1
%{_libdir}/libpoclu.so.1.2.0
%{_libdir}/libpoclu.so.1
%{_libdir}/pocl/
%{_datadir}/pocl/
%files devel
%{_libdir}/libpoclu.so
%{_libdir}/libpocl.so
%{_libdir}/pkgconfig/pocl.pc
%{_includedir}/poclu.h
%changelog
* Mon Apr 07 2014 Fabian Deutsch <fabiand@fedoraproject.org> - 0.9.4
- Provide isas for correct requires rhbz#1082364
* Mon Mar 31 2014 Fabian Deutsch <fabiand@fedoraproject.org> - 0.9-3
- Add glibc-devel requirement
* Fri Jan 31 2014 Rex Dieter <rdieter@fedoraproject.org> 0.9-2
- rebuild (llvm 3.4 again)
* Wed Jan 29 2014 Fabian Deutsch <fabiand@fedoraproject.org> - 0.9-1
- Update to 0.9
* Fri Jan 17 2014 Fabian Deutsch <fabiand@fedoraproject.org> - 0.9-0.9.rc2
- Update to 0.9RC2
* Wed Jan 15 2014 Dave Airlie <airlied@redhat.com> 0.9-0.8.git20131209.9374f32
- bump for rebuild against llvm 3.4
* Mon Dec 09 2013 Fabian Deutsch <fabiand@fedoraproject.org> - 0.9-0.7.git20131209.9374f32
- Enable LLVM API mode
* Mon Dec 09 2013 Fabian Deutsch <fabiand@fedoraproject.org> - 0.9-0.6.git20131209.7fc5dd0
- Update to a working snapshot
- Drop utlist.h from Makefile
- Set LLC_HOST_CPU to workaround incorrect CPU detection/missing LLVM support
* Mon Nov 11 2013 Fabian Deutsch <fabiand@fedoraproject.org> - 0.9-0.5.git20131111.8a26561
- Fix Requirement
* Mon Nov 11 2013 Fabian Deutsch <fabiand@fedoraproject.org> - 0.9-0.4.git20131111.8a26561
- Add BR on gcc-c++ temporarily
- Update to a newer snapshot
* Mon Oct 07 2013 Fabian Deutsch <fabiand@fedoraproject.org> - 0.9-0.3.git20131007.94d0cce
- Update to 94d0cce4b368bdc963e97952ccf88e55e6a8b4ba
- Includes implementations for clSetEventCallback
* Wed Oct 02 2013 Fabian Deutsch <fabiand@fedoraproject.org> - 0.9-0.2.git20130925.b190740
- Update package summary to include OpenCL
* Tue Oct 01 2013 Björn Esser <bjoern.esser@gmail.com> - 0.9-0.1.git20130925.b190740
- update to recent git-snapshot
- minor cleanup
- include some more documentation
* Sun Sep 29 2013 Dan Horák <dan[at]danny.cz> - 0.8-8
- switch to ExclusiveArch as it needs explicit porting to new arches
* Wed Aug 28 2013 Fabian Deutsch <fabiand@fedoraproject.org> - 0.8-7
- Add requirements on opencl-filesystem and uthash
- Remove uthash sources during prep
- Fix license field
* Mon Aug 19 2013 Fabian Deutsch <fabiand@fedoraproject.org> - 0.8-6
- Move includedir to base package. This is required to build
kernels at runtime.
* Thu Aug 15 2013 Fabian Deutsch <fabiand@fedoraproject.org> - 0.8-5
- Unbundle uthash
- Updated licenses
* Wed Aug 14 2013 Fabian Deutsch <fabiand@fedoraproject.org> - 0.8-4
- Drop -libs subpackage
- Fix -devel BR on base package
* Wed Aug 14 2013 Fabian Deutsch <fabiand@fedoraproject.org> - 0.8-3
- Add check
- Enforce ICD usage
- Fix duplicate file warnings
* Tue Aug 13 2013 Fabian Deutsch <fabiand@fedoraproject.org> - 0.8-2
- Own some dirs
- Fix -devel libraries
- Add hwloc, llvm, mesa-libGL BR
- Glob for bc and type files
- ExcludeArch armv7hl
* Mon Aug 12 2013 Fabian Deutsch <fabiand@fedoraproject.org> - 0.8-1
- Update to 0.8
- Better description
- Fix SourceUrl
* Sun Aug 11 2013 Fabian Deutsch <fabiand@fedoraproject.org> - 0.8pre-0.2
- Updated bzr snapshot
* Wed Feb 27 2013 Dave Airlie <airlied@redhat.com> - 0.8pre-0.1
- first import