4 Summary: An optimized BLAS library based on GotoBLAS2
5 License: BSD-3-Clause and MIT and Apache-2.0
6 Group: Productivity/Scientific/Math
7 Url: http://www.openblas.net
8 Source0: %{name}-%{version}.tar.gz
9 Source1001: %{name}.manifest
10 BuildRequires: gcc-fortran
11 BuildRequires: update-alternatives
13 Requires(post): update-alternatives
14 Requires(preun): update-alternatives
17 OpenBLAS is an optimized BLAS library based on GotoBLAS2 1.13 BSD version.
19 %package -n lib%{name}_serial0
20 Summary: An optimized BLAS library based on GotoBLAS2, serial version
21 Group: System/Libraries
22 Requires(post): update-alternatives
23 Requires(preun): update-alternatives
24 Obsoletes: lib%{name}0 < %{version}
25 Provides: lib%{name}0 = %{version}
27 %description -n lib%{name}_serial0
28 OpenBLAS is an optimized BLAS library based on GotoBLAS2 1.13 BSD version.
30 %package -n lib%{name}_serial-devel
31 Summary: Development libraries for OpenBLAS, serial version
32 Group: Development/Libraries/C and C++
33 Requires: %{name}-devel-headers = %{version}
34 Requires: lib%{name}_serial0 = %{version}
36 %description -n lib%{name}_serial-devel
37 OpenBLAS is an optimized BLAS library based on GotoBLAS2 1.13 BSD version.
39 This package contains the development libraries for serial OpenBLAS version.
41 %package -n lib%{name}_openmp0
42 Summary: An optimized BLAS library based on GotoBLAS2, OpenMP version
43 Group: System/Libraries
44 Requires(post): update-alternatives
45 Requires(preun): update-alternatives
46 Obsoletes: lib%{name}0
47 Obsoletes: lib%{name}o0
49 %description -n lib%{name}_openmp0
50 OpenBLAS is an optimized BLAS library based on GotoBLAS2 1.13 BSD version.
52 This package contains the library compiled with OpenMP support.
54 %package -n lib%{name}_openmp-devel
55 Summary: Development libraries for OpenBLAS, OpenMP version
56 Group: Development/Libraries/C and C++
57 Requires: %{name}-devel-headers = %{version}
58 Requires: lib%{name}_openmp0 = %{version}
60 %description -n lib%{name}_openmp-devel
61 OpenBLAS is an optimized BLAS library based on GotoBLAS2 1.13 BSD version.
63 This package contains the development libraries for OpenMP OpenBLAS version.
65 %package -n lib%{name}_pthreads0
66 Summary: An optimized BLAS library based on GotoBLAS2, pthreads version
67 Group: System/Libraries
68 Requires(post): update-alternatives
69 Requires(preun): update-alternatives
70 Obsoletes: lib%{name}0
71 Obsoletes: lib%{name}p0
73 %description -n lib%{name}_pthreads0
74 OpenBLAS is an optimized BLAS library based on GotoBLAS2 1.13 BSD version.
76 This package contains the library compiled with threading support.
78 %package -n lib%{name}_pthreads-devel
79 Summary: Development headers and libraries for OpenBLAS, pthreads version
80 Group: Development/Libraries/C and C++
81 Requires: %{name}-devel-headers = %{version}
82 Requires: lib%{name}_pthreads0 = %{version}
84 %description -n lib%{name}_pthreads-devel
85 OpenBLAS is an optimized BLAS library based on GotoBLAS2 1.13 BSD version.
87 This package contains the development libraries for pthreads OpenBLAS version.
90 Summary: Development headers and libraries for OpenBLAS
91 Group: Development/Libraries/C and C++
92 Requires: %{name}-devel-headers = %{version}
94 Requires: lib%{name}_pthreads-devel = %{version}
96 Requires: lib%{name}_openmp-devel = %{version}
100 OpenBLAS is an optimized BLAS library based on GotoBLAS2 1.13 BSD version.
102 This package contains the development libraries and headers for OpenBLAS.
104 %package devel-headers
105 Summary: Development headers for OpenBLAS
106 Group: Development/Libraries/C and C++
107 Conflicts: %{name}-devel < %{version}
109 %description devel-headers
110 OpenBLAS is an optimized BLAS library based on GotoBLAS2 1.13 BSD version.
112 This package contains headers for OpenBLAS.
114 %package devel-static
115 Summary: Static version of OpenBLAS
116 Group: Development/Libraries/C and C++
117 Requires: %{name}-devel = %{version}
119 %description devel-static
120 OpenBLAS is an optimized BLAS library based on GotoBLAS2 1.13 BSD version.
122 This package contains the static libraries.
129 # Disable utest if armv7l; Tizen-qemu-armv7l does not support syscall 319
130 sed -i "s|ctest utest|ctest|" Makefile
131 sed -i "s|tests shared|shared|" Makefile
135 # Prepare build for serial, pthreads and OpenMP versions
136 cp -ar %{name}-%{version} openmp
137 cp -ar %{name}-%{version} pthreads
138 cp -ar %{name}-%{version} serial
139 #mv %{name}-%{version} serial
145 export EXTRALIB+="-lasan"
148 export LDFLAGS+="-Wl,-z,noexecstack"
150 # Only x86/x86-64 CPUs support DYNAMIC_ARCH
152 %define openblas_target DYNAMIC_ARCH=1 TARGET=NEHALEM
155 %define openblas_target TARGET=ARMV7 ARM_SOFTFP_ABI=1
158 %define openblas_target TARGET=ARMV7
161 %define openblas_target TARGET=ARMV8
165 # Make serial, threaded and OpenMP versions
166 make -C serial %{?_smp_mflags} %{?openblas_target} USE_THREAD=0 USE_OPENMP=0 LIBNAMESUFFIX=serial \
167 FC=gfortran CC=gcc COMMON_OPT="%{optflags}" NUM_THREADS=64 V=1
168 make -C openmp %{?_smp_mflags} %{?openblas_target} USE_THREAD=1 USE_OPENMP=1 LIBNAMESUFFIX=openmp \
169 FC=gfortran CC=gcc COMMON_OPT="%{optflags}" NUM_THREADS=64 V=1
170 make -C pthreads %{?_smp_mflags} %{?openblas_target} USE_THREAD=1 USE_OPENMP=0 LIBNAMESUFFIX=pthreads \
171 FC=gfortran CC=gcc COMMON_OPT="%{optflags}" NUM_THREADS=64 V=1
175 # Install serial library and headers
176 make -C serial USE_THREAD=0 LIBNAMESUFFIX=serial \
177 OPENBLAS_LIBRARY_DIR=%{buildroot}%{_libdir} \
178 OPENBLAS_INCLUDE_DIR=%{buildroot}%{_includedir}/%{name} \
179 OPENBLAS_CMAKE_DIR=%{buildroot}%{_libdir}/cmake/%{name} \
180 PREFIX=%{buildroot}%{_prefix} install
182 # Put libraries in correct location
183 rm -rf %{buildroot}%{_libdir}/lib%{name}*
185 # Install the serial library
186 install -D -p -m 755 serial/lib%{name}_serial.so %{buildroot}%{_libdir}/lib%{name}_serial.so.0
187 install -D -p -m 644 serial/lib%{name}_serial.a %{buildroot}%{_libdir}/lib%{name}_serial.a
189 # Install the OpenMP library
190 install -D -p -m 755 openmp/lib%{name}_openmp.so %{buildroot}%{_libdir}/lib%{name}_openmp.so.0
191 install -D -p -m 644 openmp/lib%{name}_openmp.a %{buildroot}%{_libdir}/lib%{name}_openmp.a
193 # Install the threaded library
194 install -D -p -m 755 pthreads/lib%{name}_pthreads.so %{buildroot}%{_libdir}/lib%{name}_pthreads.so.0
195 install -D -p -m 644 pthreads/lib%{name}_pthreads.a %{buildroot}%{_libdir}/lib%{name}_pthreads.a
197 # Fix source permissions (also applies to LAPACK)
198 find -name \*.f -exec chmod 644 {} +
200 # Remove pkgconfig file, it can't be configured for different library suffixes we use and, as such, is useless
201 #rm -fr %{buildroot}%{_libdir}/pkgconfig/%{name}.pc
202 sed -i "s|%{buildroot}||g" %{buildroot}%{_libdir}/pkgconfig/%{name}.pc
204 # Dummy target for update-alternatives
205 install -d %{buildroot}/%{_sysconfdir}/alternatives
206 ln -s lib%{name}.so.0 %{buildroot}/%{_libdir}/lib%{name}.so.0
207 ln -s lib%{name}.so.0 %{buildroot}/%{_sysconfdir}/alternatives/lib%{name}.so.0
208 ln -s lib%{name}.so.0 %{buildroot}/%{_libdir}/libblas.so.3
209 ln -s lib%{name}.so.0 %{buildroot}/%{_libdir}/libcblas.so.3
210 ln -s lib%{name}.so.0 %{buildroot}/%{_libdir}/liblapack.so.3
211 ln -s lib%{name}.so.0 %{buildroot}/%{_sysconfdir}/alternatives/libblas.so.3
212 ln -s lib%{name}.so.0 %{buildroot}/%{_sysconfdir}/alternatives/libcblas.so.3
213 ln -s lib%{name}.so.0 %{buildroot}/%{_sysconfdir}/alternatives/liblapack.so.3
216 pushd %{buildroot}%{_libdir}
217 ln -sf lib%{name}.so.0 lib%{name}.so
219 ln -sf lib%{name}_serial.so.0 lib%{name}_serial.so
221 ln -sf lib%{name}_openmp.so.0 lib%{name}_openmp.so
223 ln -sf lib%{name}_pthreads.so.0 lib%{name}_pthreads.so
225 rm -rf %{buildroot}%{_libdir}/cmake
227 # Fix cmake config file
228 # sed -i 's|%{buildroot}||g' %{buildroot}%{_libdir}/cmake/%{name}/*.cmake
230 # Delete info about OBS host cpu
232 sed -i '/#define OPENBLAS_NEEDBUNDERSCORE/,/#define OPENBLAS_VERSION/{//!d}' %{buildroot}%{_includedir}/%{name}/openblas_config.h
235 %post -n lib%{name}_serial0
236 %{_sbindir}/update-alternatives --install \
237 %{_libdir}/libblas.so.3 libblas.so.3 %{_libdir}/lib%{name}_serial.so.0 20
238 %{_sbindir}/update-alternatives --install \
239 %{_libdir}/libcblas.so.3 libcblas.so.3 %{_libdir}/lib%{name}_serial.so.0 20
240 %{_sbindir}/update-alternatives --install \
241 %{_libdir}/liblapack.so.3 liblapack.so.3 %{_libdir}/lib%{name}_serial.so.0 20
242 %{_sbindir}/update-alternatives --install \
243 %{_libdir}/lib%{name}.so.0 lib%{name}.so.0 %{_libdir}/lib%{name}_serial.so.0 20
246 %preun -n lib%{name}_serial0
247 if [ "$1" = 0 ] ; then
248 %{_sbindir}/update-alternatives --remove libblas.so.3 %{_libdir}/lib%{name}_serial.so.0
249 %{_sbindir}/update-alternatives --remove libcblas.so.3 %{_libdir}/lib%{name}_serial.so.0
250 %{_sbindir}/update-alternatives --remove liblapack.so.3 %{_libdir}/lib%{name}_serial.so.0
251 %{_sbindir}/update-alternatives --remove lib%{name}.so.0 %{_libdir}/lib%{name}_serial.so.0
254 %postun -n lib%{name}_serial0 -p /sbin/ldconfig
256 %posttrans -n lib%{name}_serial0
257 if [ "$1" = 0 ] ; then
258 if ! [ -f %{_libdir}/lib%{name}.so.0 ] ; then
259 %{_sbindir}/update-alternatives --auto lib%{name}.so.0
263 %post -n lib%{name}_openmp0
264 %{_sbindir}/update-alternatives --install \
265 %{_libdir}/libblas.so.3 libblas.so.3 %{_libdir}/lib%{name}_openmp.so.0 20
266 %{_sbindir}/update-alternatives --install \
267 %{_libdir}/libcblas.so.3 libcblas.so.3 %{_libdir}/lib%{name}_openmp.so.0 20
268 %{_sbindir}/update-alternatives --install \
269 %{_libdir}/liblapack.so.3 liblapack.so.3 %{_libdir}/lib%{name}_openmp.so.0 20
270 %{_sbindir}/update-alternatives --install \
272 %{_libdir}/lib%{name}.so.0 lib%{name}.so.0 %{_libdir}/lib%{name}_openmp.so.0 20
274 %{_libdir}/lib%{name}.so.0 lib%{name}.so.0 %{_libdir}/lib%{name}_openmp.so.0 50
278 %preun -n lib%{name}_openmp0
279 if [ "$1" = 0 ] ; then
280 %{_sbindir}/update-alternatives --remove libblas.so.3 %{_libdir}/lib%{name}_openmp.so.0
281 %{_sbindir}/update-alternatives --remove libcblas.so.3 %{_libdir}/lib%{name}_openmp.so.0
282 %{_sbindir}/update-alternatives --remove liblapack.so.3 %{_libdir}/lib%{name}_openmp.so.0
283 %{_sbindir}/update-alternatives --remove lib%{name}.so.0 %{_libdir}/lib%{name}_openmp.so.0
286 %postun -n lib%{name}_openmp0 -p /sbin/ldconfig
288 %posttrans -n lib%{name}_openmp0
289 if [ "$1" = 0 ] ; then
290 if ! [ -f %{_libdir}/lib%{name}.so.0 ] ; then
291 %{_sbindir}/update-alternatives --auto lib%{name}.so.0
295 %post -n lib%{name}_pthreads0
296 %{_sbindir}/update-alternatives --install \
297 %{_libdir}/libblas.so.3 libblas.so.3 %{_libdir}/lib%{name}_pthreads.so.0 20
298 %{_sbindir}/update-alternatives --install \
299 %{_libdir}/libcblas.so.3 libcblas.so.3 %{_libdir}/lib%{name}_pthreads.so.0 20
300 %{_sbindir}/update-alternatives --install \
301 %{_libdir}/liblapack.so.3 liblapack.so.3 %{_libdir}/lib%{name}_pthreads.so.0 20
302 %{_sbindir}/update-alternatives --install \
304 %{_libdir}/lib%{name}.so.0 lib%{name}.so.0 %{_libdir}/lib%{name}_pthreads.so.0 50
306 %{_libdir}/lib%{name}.so.0 lib%{name}.so.0 %{_libdir}/lib%{name}_pthreads.so.0 20
310 %preun -n lib%{name}_pthreads0
311 if [ "$1" = 0 ] ; then
312 %{_sbindir}/update-alternatives --remove libblas.so.3 %{_libdir}/lib%{name}_pthreads.so.0
313 %{_sbindir}/update-alternatives --remove libcblas.so.3 %{_libdir}/lib%{name}_pthreads.so.0
314 %{_sbindir}/update-alternatives --remove liblapack.so.3 %{_libdir}/lib%{name}_pthreads.so.0
315 %{_sbindir}/update-alternatives --remove lib%{name}.so.0 %{_libdir}/lib%{name}_pthreads.so.0
318 %postun -n lib%{name}_pthreads0 -p /sbin/ldconfig
320 %posttrans -n lib%{name}_pthreads0
321 if [ "$1" = 0 ] ; then
322 if ! [ -f %{_libdir}/lib%{name}.so.0 ] ; then
323 %{_sbindir}/update-alternatives --auto lib%{name}.so.0
327 %files -n lib%{name}_serial0
328 %manifest %{name}.manifest
329 %defattr(-,root,root,-)
330 %{_libdir}/lib%{name}_serial.so.0
331 %ghost %{_libdir}/lib%{name}.so.0
332 %ghost %{_libdir}/libblas.so.3
333 %ghost %{_libdir}/libcblas.so.3
334 %ghost %{_libdir}/liblapack.so.3
335 %ghost %{_sysconfdir}/alternatives/lib%{name}.so.0
336 %ghost %{_sysconfdir}/alternatives/libblas.so.3
337 %ghost %{_sysconfdir}/alternatives/libcblas.so.3
338 %ghost %{_sysconfdir}/alternatives/liblapack.so.3
340 %files -n lib%{name}_serial-devel
341 %defattr(-,root,root,-)
342 %{_libdir}/lib%{name}_serial.so
344 %files -n lib%{name}_openmp0
345 %manifest %{name}.manifest
346 %defattr(-,root,root,-)
347 %{_libdir}/lib%{name}_openmp.so.0
348 %ghost %{_libdir}/lib%{name}.so.0
349 %ghost %{_libdir}/libblas.so.3
350 %ghost %{_libdir}/libcblas.so.3
351 %ghost %{_libdir}/liblapack.so.3
352 %ghost %{_sysconfdir}/alternatives/lib%{name}.so.0
353 %ghost %{_sysconfdir}/alternatives/libblas.so.3
354 %ghost %{_sysconfdir}/alternatives/libcblas.so.3
355 %ghost %{_sysconfdir}/alternatives/liblapack.so.3
357 %files -n lib%{name}_openmp-devel
358 %defattr(-,root,root,-)
359 %{_libdir}/lib%{name}_openmp.so
361 %files -n lib%{name}_pthreads0
362 %manifest %{name}.manifest
363 %defattr(-,root,root,-)
364 %{_libdir}/lib%{name}_pthreads.so.0
365 %ghost %{_libdir}/lib%{name}.so.0
366 %ghost %{_libdir}/libblas.so.3
367 %ghost %{_libdir}/libcblas.so.3
368 %ghost %{_libdir}/liblapack.so.3
369 %ghost %{_sysconfdir}/alternatives/lib%{name}.so.0
370 %ghost %{_sysconfdir}/alternatives/libblas.so.3
371 %ghost %{_sysconfdir}/alternatives/libcblas.so.3
372 %ghost %{_sysconfdir}/alternatives/liblapack.so.3
374 %files -n lib%{name}_pthreads-devel
375 %defattr(-,root,root,-)
376 %{_libdir}/lib%{name}_pthreads.so
379 %defattr(-,root,root,-)
380 %doc Changelog.txt GotoBLAS* LICENSE README.md
381 %{_libdir}/documentation.list
382 %{_libdir}/lib%{name}.so
383 %{_libdir}/pkgconfig/*
386 %defattr(-,root,root,-)
387 %{_includedir}/%{name}/
390 %defattr(-,root,root,-)
391 %{_libdir}/lib%{name}_serial.a
392 %{_libdir}/lib%{name}_openmp.a
393 %{_libdir}/lib%{name}_pthreads.a