From 494dbe8a0f8a8a48e16e909bea2954e2c056dfc3d9718f17704faa56b76bd180 Mon Sep 17 00:00:00 2001 From: Egbert Eich Date: Sun, 11 Oct 2020 14:18:15 +0000 Subject: [PATCH] Accepting request 840488 from home:StefanBruens:branches:home:StefanBruens:branches:science - Build CBLAS from lapack package * update baselibs.conf - Clean up spec file: * remove useless make cleanlib * remove ineffective duplicated 'make ..lib' calls with deviating opts, as the object files are not removed (fortuanately) the existing PIC files are used for the static libraries * remove fortran-only -std=legacy opt from CFLAGS OBS-URL: https://build.opensuse.org/request/show/840488 OBS-URL: https://build.opensuse.org/package/show/science/lapack?expand=0&rev=19 --- baselibs.conf | 4 ++ lapack-man.changes | 12 ++++ lapack.changes | 12 ++++ lapack.spec | 155 ++++++++++++++++++++++++++++++++------------- 4 files changed, 140 insertions(+), 43 deletions(-) diff --git a/baselibs.conf b/baselibs.conf index ee59c1b..18d7048 100644 --- a/baselibs.conf +++ b/baselibs.conf @@ -1,5 +1,6 @@ liblapack3 libblas3 +libcblas3 liblapacke3 lapack-devel requires -lapack- @@ -7,6 +8,9 @@ lapack-devel blas-devel requires -blas- requires "libblas3- = " +cblas-devel + requires -cblas- + requires "libcblas3- = " lapacke-devel requires -lapacke- requires "liblapacke3- = " diff --git a/lapack-man.changes b/lapack-man.changes index 51b818f..8e27b46 100644 --- a/lapack-man.changes +++ b/lapack-man.changes @@ -1,3 +1,15 @@ +------------------------------------------------------------------- +Fri Oct 9 21:00:30 UTC 2020 - Stefan Brüns + +- Build CBLAS from lapack package + * update baselibs.conf +- Clean up spec file: + * remove useless make cleanlib + * remove ineffective duplicated 'make ..lib' calls with deviating + opts, as the object files are not removed (fortuanately) the + existing PIC files are used for the static libraries + * remove fortran-only -std=legacy opt from CFLAGS + ------------------------------------------------------------------- Fri Oct 9 17:28:03 UTC 2020 - Stefan Brüns diff --git a/lapack.changes b/lapack.changes index 51b818f..8e27b46 100644 --- a/lapack.changes +++ b/lapack.changes @@ -1,3 +1,15 @@ +------------------------------------------------------------------- +Fri Oct 9 21:00:30 UTC 2020 - Stefan Brüns + +- Build CBLAS from lapack package + * update baselibs.conf +- Clean up spec file: + * remove useless make cleanlib + * remove ineffective duplicated 'make ..lib' calls with deviating + opts, as the object files are not removed (fortuanately) the + existing PIC files are used for the static libraries + * remove fortran-only -std=legacy opt from CFLAGS + ------------------------------------------------------------------- Fri Oct 9 17:28:03 UTC 2020 - Stefan Brüns diff --git a/lapack.spec b/lapack.spec index b9cce9b..4caccce 100644 --- a/lapack.spec +++ b/lapack.spec @@ -151,106 +151,131 @@ Summary: LAPACKE development files Group: Development/Libraries/C and C++ Requires: liblapacke3 = %{version} Provides: lapacke = %{version} -Provides: lapacke-devel-static = %{version} %description -n lapacke-devel LAPACKE headers and development files. %package -n lapacke-devel-static -Summary: LAPACKE development files - static libraries +Summary: LAPACKE static libraries Group: Development/Libraries/C and C++ Requires: lapacke-devel = %{version} %description -n lapacke-devel-static -LAPACKE development files - static libraries. +LAPACKE development files - static libraries. + +%package -n libcblas3 +Summary: CBLAS Shared Library +Group: Development/Libraries/C and C++ +Requires(pre): update-alternatives +# Only version ever packaged separately +Obsoletes: libcblas3 == 20110120 + +%description -n libcblas3 +This library provides a native C interface to BLAS routines available +at www.netlib.org/blas to facilitate usage of BLAS functionality +for C programmers. + +%package -n cblas-devel +Summary: CBLAS development files +Group: Development/Libraries/C and C++ +Requires: libcblas3 = %{version} +Provides: cblas = %{version} + +%description -n cblas-devel +cblas headers and development files. + +%package -n cblas-devel-static +Summary: CBLAS - static libraries +Group: Development/Libraries/C and C++ +Requires: cblas-devel = %{version} + +%description -n cblas-devel-static +The cblas-devel-static package contains the CBLAS static libraries +for -static linking. You do not need these, unless you link +statically, which is highly discouraged. + %prep %setup -q %patch1 sed -i -e '1 s@env python@python3@' lapack_testing.py -head lapack_testing.py %build %global _lto_cflags %{_lto_cflags} -ffat-lto-objects -%global optflags %{optflags} -std=legacy +%global optflags_f %{optflags} -std=legacy case "$RPM_ARCH" in i[0-9]86) PRECFLAGS="-ffloat-store" ;; *) PRECFLAGS="" ;; esac export PRECFLAGS cp make.inc.example make.inc + make cleanlib %{?_smp_mflags} make %{?_smp_mflags} blaslib \ - OPTS="%{optflags} -fPIC" \ - NOOPT="%{optflags} -O0 -fPIC" -mv librefblas.a libblas_pic.a + OPTS="%{optflags_f} -fPIC" \ + NOOPT="%{optflags_f} -O0 -fPIC" mkdir tmp -( cd tmp; ar x ../libblas_pic.a ) +( cd tmp; ar x ../librefblas.a ) gfortran -shared -Wl,-soname=libblas.so.3 -o libblas.so.%{version} tmp/*.o ln -s libblas.so.%{version} libblas.so rm -rf tmp -make cleanlib %{?_smp_mflags} -make %{?_smp_mflags} blaslib \ - OPTS="%{optflags}" \ - NOOPT="%{optflags} -O0" + make blas_testing \ - OPTS="%{optflags} $PRECFLAGS" \ - NOOPT="%{optflags} $PRECFLAGS -O0" + OPTS="%{optflags_f} $PRECFLAGS" \ + NOOPT="%{optflags_f} $PRECFLAGS -O0" if grep -B15 -A15 FAIL BLAS/*.out; then echo echo "blas_testing FAILED" - echo false -else - true # No failures fi mv librefblas.a libblas.a -make cleanlib %{?_smp_mflags} -make %{?_smp_mflags} lapacklib \ - OPTS="%{optflags} -fPIC" \ - NOOPT="%{optflags} -O0 -fPIC" -mv liblapack.a liblapack_pic.a + +make %{?_smp_mflags} cblaslib \ + CFLAGS="%{optflags} -fPIC -DADD_ " \ + LINKER=gfortran mkdir tmp -( cd tmp; ar x ../liblapack_pic.a ) +( cd tmp; ar x ../libcblas.a ) +gfortran -shared -Wl,-soname=libcblas.so.3 -o libcblas.so.%{version} tmp/*.o -L. -lblas +ln -s libcblas.so.%{version} libcblas.so +rm -rf tmp +make %{?_smp_mflags} cblas_testing \ + CFLAGS="%{optflags} -fPIC" \ + LINKER=gfortran +grep -B15 -A15 FAIL TESTING/*.out && false + +make %{?_smp_mflags} lapacklib \ + OPTS="%{optflags_f} -fPIC" \ + NOOPT="%{optflags_f} -O0 -fPIC" +mkdir tmp +( cd tmp; ar x ../liblapack.a ) gfortran -shared -Wl,-soname=liblapack.so.3 -o liblapack.so.%{version} tmp/*.o -L. -lblas ln -s liblapack.so.%{version} liblapack.so rm -rf tmp -make cleanlib %{?_smp_mflags} -make %{?_smp_mflags} lapacklib \ - OPTS="%{optflags}" \ - NOOPT="%{optflags} -O0" -ln -s libblas.a librefblas.a + cd LAPACKE make %{?_smp_mflags} lapacke \ CFLAGS="%{optflags} -fPIC -DADD_ -DHAVE_LAPACK_CONFIG_H -DLAPACK_COMPLEX_STRUCTURE" \ LINKER=gfortran -mv ../liblapacke.a liblapacke_pic.a mkdir tmp -( cd tmp; ar x ../liblapacke_pic.a ) +( cd tmp; ar x ../../liblapacke.a ) gfortran -shared -Wl,-soname=liblapacke.so.3 -o liblapacke.so.%{version} tmp/*.o ln -s liblapacke.so.%{version} liblapacke.so rm -rf tmp -make cleanlib %{?_smp_mflags} -make %{?_smp_mflags} lapacke \ - CFLAGS="%{optflags} -DADD_ -DHAVE_LAPACK_CONFIG_H -DLAPACK_COMPLEX_STRUCTURE" -mv ../liblapacke.a liblapacke.a cd .. make lapack_testing \ - OPTS="%{optflags} $PRECFLAGS" \ - NOOPT="%{optflags} $PRECFLAGS -O0" + OPTS="%{optflags_f} $PRECFLAGS" \ + NOOPT="%{optflags_f} $PRECFLAGS -O0" if grep -B15 -A15 FAIL TESTING/*.out; then echo echo "lapack_testing FAILED" - echo false -else - true # No failures fi %install install -d %{buildroot}/%{_libdir} install -d %{buildroot}/%{_sysconfdir}/alternatives +install -d %{buildroot}/%{_includedir} ## BLAS install -d %{buildroot}/%{_libdir}/blas install -m 644 libblas.a %{buildroot}/%{_libdir} @@ -260,6 +285,15 @@ ln -s blas/libblas.so.%{version} %{buildroot}/%{_libdir}/libblas.so # dummy target for update-alternatives ln -s blas/libblas.so.%{version} %{buildroot}/%{_libdir}/libblas.so.3 ln -s libblas.so.%{version} %{buildroot}/%{_sysconfdir}/alternatives/libblas.so.3 +## CBLAS +install -m 644 CBLAS/include/*.h %{buildroot}/%{_includedir} +install -m 644 libcblas.a %{buildroot}/%{_libdir} +install -m 755 libcblas.so.%{version} %{buildroot}/%{_libdir}/blas +ln -s libcblas.so.%{version} %{buildroot}/%{_libdir}/blas/libcblas.so.3 +ln -s blas/libcblas.so.%{version} %{buildroot}/%{_libdir}/libcblas.so +# dummy target for update-alternatives +ln -s blas/libcblas.so.%{version} %{buildroot}/%{_libdir}/libcblas.so.3 +ln -s libcblas.so.%{version} %{buildroot}/%{_sysconfdir}/alternatives/libcblas.so.3 ## LAPACK install -d %{buildroot}/%{_libdir}/lapack install -m 644 liblapack.a %{buildroot}/%{_libdir} @@ -270,10 +304,9 @@ ln -s lapack/liblapack.so.%{version} %{buildroot}/%{_libdir}/liblapack.so ln -s lapack/liblapack.so.%{version} %{buildroot}/%{_libdir}/liblapack.so.3 ln -s liblapack.so.%{version} %{buildroot}/%{_sysconfdir}/alternatives/liblapack.so.3 ## LAPACKE -install -d %{buildroot}/%{_includedir} cd LAPACKE install -m 644 include/*.h %{buildroot}/%{_includedir} -install -m 644 liblapacke.a %{buildroot}/%{_libdir} +install -m 644 ../liblapacke.a %{buildroot}/%{_libdir} install -m 755 liblapacke.so.%{version} %{buildroot}/%{_libdir} ln -s liblapacke.so.%{version} %{buildroot}/%{_libdir}/liblapacke.so.3 ln -s liblapacke.so.%{version} %{buildroot}/%{_libdir}/liblapacke.so @@ -317,6 +350,25 @@ if [ "$1" = 0 ] ; then fi fi +%post -n libcblas3 +%{_sbindir}/update-alternatives --install \ + %{_libdir}/libcblas.so.3 libcblas.so.3 %{_libdir}/blas/libcblas.so.3 50 +/sbin/ldconfig + +%preun -n libcblas3 +if [ "$1" = 0 ] ; then + %{_sbindir}/update-alternatives --remove libcblas.so.3 %{_libdir}/blas/libcblas.so.3 +fi + +%postun -n libcblas3 -p /sbin/ldconfig + +%posttrans -n libcblas3 +if [ "$1" = 0 ] ; then + if ! [ -f %{_libdir}/libcblas.so.3 ] ; then + "%{_sbindir}/update-alternatives" --auto libcblas.so.3 + fi +fi + %post -n liblapacke3 -p /sbin/ldconfig %postun -n liblapacke3 -p /sbin/ldconfig @@ -359,9 +411,26 @@ fi %doc LAPACKE/README %license LAPACKE/LICENSE %{_libdir}/liblapacke.so -%{_includedir}/*.h +%{_includedir}/lapack*.h %files -n lapacke-devel-static %{_libdir}/liblapacke.a +%files -n libcblas3 +%doc README.md +%license LICENSE +%dir %{_libdir}/blas +%{_libdir}/blas/libcblas.so.%{version} +%{_libdir}/blas/libcblas.so.3 +%ghost %{_libdir}/libcblas.so.3 +%ghost %{_sysconfdir}/alternatives/libcblas.so.3 + +%files -n cblas-devel +%doc CBLAS/README +%{_libdir}/libcblas.so +%{_includedir}/cblas*.h + +%files -n cblas-devel-static +%{_libdir}/libcblas.a + %changelog