File ocl-icd.spec of Package ocl-icd
%define realname ocl-icd
%define realver 2.3.3
%define srcext tar.gz
%define so_ver 1
# turn off the generation of debuginfo rpm (RH9) ??
%global debug_package %{nil}
# Common info
Name: %{realname}
Version: %{realver}
Release: wiz%{?extraver:0.}1%{?dist}
License: BSD-2-Clause
Group: System/Libraries
URL: https://github.com/OCL-dev/ocl-icd
Summary: Open Computing Language generic Installable Client Driver Loader
# Install-time parameters
Provides: libOpenCL%{?so_ver} = %{version}-%{release}
Obsoletes: libOpenCL%{?so_ver} < %{version}-%{release}
# Build-time parameters
BuildRequires: autoconf automake libtool
BuildRequires: pkg-config
BuildRequires: gcc-c++
BuildRequires: ruby rubygems
BuildRoot: %{_tmppath}/%{name}-root
Source0: https://codeload.github.com/OCL-dev/ocl-icd/%{srcext}/refs/tags/v%{realver}#/%{realname}-%{realver}%{?extraver}.%{srcext}
#Source1: https://gist.githubusercontent.com/rmcgibbo/6314452/raw/d2d06615c81325e54ab500d76786bfcb13f74cfe/clDeviceQuery.cpp
Source1: https://gist.githubusercontent.com/tserj/ed03e874d288be2a485089feed5ac08f/raw/1958327d253cd75b6982235d1da85ba3ad5c0337/clDeviceQuery.cpp
%description
OpenCL implementations are provided as ICD (Installable Client Driver).
An OpenCL program can use several ICD thanks to the use of an ICD Loader
as provided by this project. This free ICD Loader can load any (free
or non free) ICD.
%package devel
Group: Development/Languages/C and C++
Summary: Development files for %{name}
Requires: %{name} = %{version}
Provides: libOpenCL-devel OpenCL-devel
%description devel
Development files for %{name}
# Preparation step (unpackung and patching if necessary)
%prep
%setup -q -n %{realname}-%{realver}%{?extraver}
if [ ! -x configure ]; then
test -x autogen.sh && ./autogen.sh || autoreconf --force --install
fi
%build
_CFLAGS='%{optflags} %{?gcc_lto}'
_LDFLAGS='-Wl,--as-needed -Wl,--strip-all -Wl,--no-undefined -Wl,-z,noexecstack -Wl,-z,now -Wl,-z,relro %{?gcc_lto}'
%configure \
--disable-static \
--disable-debug \
CFLAGS="$_CFLAGS" \
CXXFLAGS="$_CFLAGS" \
LDFLAGS="$_LDFLAGS"
%{__make} %{?_smp_mflags}
g++ -o clDeviceQuery $_CFLAGS -Ikhronos-headers %{S:1} $_LDFLAGS -L.libs -lOpenCL
%install
%{__make} install DESTDIR=%{buildroot}
%{__install} -D -m755 clDeviceQuery %{buildroot}%{_bindir}/clDeviceQuery
%{__install} -d -m755 %{buildroot}%{_sysconfdir}/OpenCL/vendors
%{__install} -d -m755 %{buildroot}%{_includedir}/CL/
%{__install} -m644 khronos-headers/CL/*.h %{buildroot}%{_includedir}/CL/
%{__ln_s} CL %{buildroot}%{_includedir}/OpenCL
%{__install} -d -m755 %{buildroot}%{_datadir}/%{name}
%{__install} -m644 icd_generator.rb %{buildroot}%{_datadir}/%{name}/icd_generator.rb
%{__install} -m644 ocl_interface.yaml %{buildroot}%{_datadir}/%{name}/ocl_interface.yaml
[ "%{buildroot}" != "/" ] && %{__rm} -rf %{buildroot}%{_datadir}/doc
%clean
[ "%{buildroot}" != "/" ] && %{__rm} -rf %{buildroot}
%files
%defattr(-,root,root)
%license COPYING
%doc NEWS README
%{_bindir}/clDeviceQuery
%{_bindir}/cllayerinfo
%{_libdir}/*.so.%{?so_ver}*
%dir %{_sysconfdir}/OpenCL/vendors
%dir %{_sysconfdir}/OpenCL
%dir %{_datadir}/%{name}
%{_datadir}/%{name}/*
# Development stuff
%files devel
%defattr(-,root,root)
%{_libdir}/pkgconfig/%{name}.pc
%{_libdir}/pkgconfig/OpenCL.pc
%{_includedir}/OpenCL
%dir %{_includedir}/CL/
%{_includedir}/CL/*.h
%{_includedir}/ocl_icd.h
%{_libdir}/*.so
%exclude %{_libdir}/*.la
%post -p /sbin/ldconfig
%postun -p /sbin/ldconfig
%changelog