# No Testcase run by default. To enable: rpm(or rpmbuild) -ba --define 'dotests 1' openblas*.spec %{!?dotests: %define dotests 0} Summary: An optimized BLAS library based on GotoBLAS2 Name: openblas Version: 0.3.5 Release: 1 License: BSD Group: Development/Libraries URL: https://github.com/xianyi/OpenBLAS Source0: https://github.com/xianyi/OpenBLAS/archive/v%{version}/OpenBLAS-%{version}.tar.gz Patch0: openblas-Dont_cross_compile.patch Patch1: openblas-global_sym-aix.patch BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root BuildRequires: gcc-gfortran >= 6.3.0 BuildRequires: libgomp >= 6.3.0 Requires: libgcc >= 6.3.0 Requires: gcc-gfortran >= 6.3.0 Requires: libgomp >= 6.3.0 %description OpenBLAS is an optimized BLAS library based on GotoBLAS2 1.13 BSD version. It is an open source implementation of the BLAS (Basic Linear Algebra Subprograms) API with many hand-crafted optimizations for specific processor types.OpenBLAS adds optimized implementations of linear algebra kernels for several processor architectures. This version is built with TARGET=POWER6 during make. For more info, visit the below URL. https://github.com/xianyi/OpenBLAS#installation-from-source %prep %setup -q -n OpenBLAS-%{version} %patch0 -p0 %patch1 -p0 %build PATH=/opt/freeware/bin:$PATH export CC="gcc -maix64" export CXX="g++ -maix64" export FC="gfortran -maix64" make BINARY=64 TARGET=POWER6 if [ "%{dotests}" == 1 ] then cd utest gcc -maix64 -I.. -I. utest_main2.c ../libopenblas.a -lgomp -lpthread -lm -o utest2 ./utest2 cd .. fi #This needs CreateExportList which comes from XLC fileset. #So better we use the one from GNU libtool #/usr/vac/bin/CreateExportList -X64 openblas.exp libopenblas.a `echo /usr/bin/nm -X32_64 | /usr/bin/sed -e 's/B\([^B]*\)$/P\1/'` -PCpgl libopenblas.a | \ /usr/bin/awk '{ if ((($ 2 == "T") || ($ 2 == "D") || ($ 2 == "B") || ($ 2 == "W") || ($ 2 == "V") || ($ 2 == "Z")) \ && (substr($ 1,1,1) != ".")) { if (($ 2 == "W") || ($ 2 == "V") || ($ 2 == "Z")) { print $ 1 " weak" } \ else { print $ 1 } } }' | /usr/bin/sort -u > openblas.exp export LDFLAGS="-lm -lpthread -lgfortran -lgomp -Wl,-bE:openblas.exp -Wl,-blibpath:/opt/freeware/lib:/usr/lib:/lib -Wl,-bbigtoc" gcc -maix64 -shared libopenblas_power6p-r0.3.5.a -o libopenblas.so.0 $LDFLAGS %install [ "${RPM_BUILD_ROOT}" != "/" ] && rm -rf ${RPM_BUILD_ROOT} PATH=/opt/freeware/bin:$PATH export CC="gcc -maix64" export CXX="g++ -maix64" export FC="gfortran -maix64" make install DESTDIR=${RPM_BUILD_ROOT} PREFIX=%{_prefix} /usr/bin/rm ${RPM_BUILD_ROOT}/%{_libdir}/libopenblas.* /usr/bin/ar -X64 -q ${RPM_BUILD_ROOT}/%{_libdir}/libopenblas.a libopenblas.so.0 %pre # Processor Version: PV_7_Compat # Processor Version: PV_6_Compat # Processor Version: PV_5_Compat ProcVersion=`prtconf | grep "Processor Version:" | awk -F_ '{ print $2}'` #echo $ProcVersion if [ $ProcVersion -lt 6 ] then echo "This rpm will only work with Power6 (and above) compatibility mode." echo "prtconf: " prtconf | grep "Processor Version:" exit 1 fi %clean [ "${RPM_BUILD_ROOT}" != "/" ] && rm -rf ${RPM_BUILD_ROOT} %files %defattr(-,root,system) %doc LICENSE README.md USAGE.md GotoBLAS_00License.txt %{_libdir}/libopenblas.a %{_libdir}/pkgconfig/openblas.pc %{_includedir}/* %changelog * Wed Mar 20 2019 Ayappan P - 0.3.5-1 - First port to AIX Toolbox