[openblas] 02/04: Ship the optimized LAPACK as a new alternative.

Sébastien Villemot sebastien at debian.org
Tue Aug 5 19:09:57 UTC 2014


This is an automated email from the git hooks/post-receive script.

sebastien pushed a commit to branch master
in repository openblas.

commit a3c2e68b804c9a10f54e9eace72a42bf4b3eecbc
Author: Sébastien Villemot <sebastien at debian.org>
Date:   Tue Aug 5 20:05:10 2014 +0200

    Ship the optimized LAPACK as a new alternative.
    
     + Use the binary from liblapack-pic for routines not overriden by OpenBLAS.
       As a consequence, add a Built-Using field to libopenblas-{base,dev}.
     + libblas3-soname.patch: dropped patch.
     + shared-blas-lapack.patch: new patch.
    
    Git-Dch: Full
---
 debian/control                          | 10 +++++-----
 debian/libopenblas-base.install         |  3 ++-
 debian/libopenblas-base.postinst        |  4 ++++
 debian/libopenblas-base.prerm           |  3 +++
 debian/libopenblas-base.shlibs          |  1 +
 debian/libopenblas-dev.links            |  2 ++
 debian/libopenblas-dev.postinst         |  4 ++++
 debian/libopenblas-dev.prerm            |  3 +++
 debian/patches/libblas3-soname.patch    | 32 --------------------------------
 debian/patches/no-embedded-lapack.patch | 29 ++++++++++++++++++++++++-----
 debian/patches/series                   |  2 +-
 debian/patches/shared-blas-lapack.patch | 31 +++++++++++++++++++++++++++++++
 debian/rules                            |  7 ++++++-
 13 files changed, 86 insertions(+), 45 deletions(-)

diff --git a/debian/control b/debian/control
index 79ccfdd..42a2686 100644
--- a/debian/control
+++ b/debian/control
@@ -4,7 +4,7 @@ Priority: optional
 Maintainer: Debian Science Team <debian-science-maintainers at lists.alioth.debian.org>
 Uploaders: Sébastien Villemot <sebastien at debian.org>
 Standards-Version: 3.9.5
-Build-Depends: dpkg-dev (>= 1.16.2~), debhelper (>= 9), gfortran
+Build-Depends: dpkg-dev (>= 1.16.2~), debhelper (>= 9), gfortran, liblapack-pic
 Homepage: https://github.com/xianyi/OpenBLAS
 Vcs-Git: git://anonscm.debian.org/debian-science/packages/openblas.git
 Vcs-Browser: http://anonscm.debian.org/gitweb/?p=debian-science/packages/openblas.git
@@ -13,10 +13,10 @@ Package: libopenblas-base
 Section: libs
 Architecture: amd64 armhf i386 powerpc ppc64 kfreebsd-i386 kfreebsd-amd64
 Depends: ${shlibs:Depends}, ${misc:Depends}
-Provides: libblas.so.3
-Suggests: liblapack3
+Provides: libblas.so.3, liblapack.so.3
 Replaces: libblas3gf (<< 1.2.20110419-3), libatlas3gf-base (<< 3.8.4-4)
 Breaks: libblas3gf (<< 1.2.20110419-3), libatlas3gf-base (<< 3.8.4-4)
+Built-Using: ${Built-Using}
 Description: Optimized BLAS (linear algebra) library based on GotoBLAS2
  OpenBLAS is an optimized BLAS library based on GotoBLAS2 1.13 BSD version.
  .
@@ -33,8 +33,8 @@ Section: libdevel
 Architecture: amd64 armhf i386 powerpc ppc64 kfreebsd-i386 kfreebsd-amd64
 Depends: libopenblas-base (= ${binary:Version}), libblas-dev, ${shlibs:Depends},
  ${misc:Depends}
-Provides: libblas.so
-Suggests: liblapack-dev
+Provides: libblas.so, liblapack.so
+Built-Using: ${Built-Using}
 Description: Optimized BLAS (linear algebra) library based on GotoBLAS2
  OpenBLAS is an optimized BLAS library based on GotoBLAS2 1.13 BSD version.
  .
diff --git a/debian/libopenblas-base.install b/debian/libopenblas-base.install
index 0d5ac68..97c1ffa 100644
--- a/debian/libopenblas-base.install
+++ b/debian/libopenblas-base.install
@@ -1,3 +1,4 @@
 usr/lib/libopenblas*-r0.*.so
 usr/lib/libopenblas.so.0
-libblas.so.3 usr/lib/openblas-base/
+interface/libblas.so.3 usr/lib/openblas-base/
+interface/liblapack.so.3 usr/lib/openblas-base/
diff --git a/debian/libopenblas-base.postinst b/debian/libopenblas-base.postinst
index 9718335..487b869 100644
--- a/debian/libopenblas-base.postinst
+++ b/debian/libopenblas-base.postinst
@@ -6,6 +6,10 @@ update-alternatives --install /usr/lib/libblas.so.3 libblas.so.3 \
 	/usr/lib/openblas-base/libblas.so.3 40 \
     --slave /usr/lib/libblas.so.3gf libblas.so.3gf /usr/lib/openblas-base/libblas.so.3
 
+update-alternatives --install /usr/lib/liblapack.so.3 liblapack.so.3 \
+	/usr/lib/openblas-base/liblapack.so.3 40 \
+    --slave /usr/lib/liblapack.so.3gf liblapack.so.3gf /usr/lib/openblas-base/liblapack.so.3
+
 # dh_installdeb will replace this with shell code automatically
 # generated by other debhelper scripts.
 
diff --git a/debian/libopenblas-base.prerm b/debian/libopenblas-base.prerm
index 1eaa354..5b75e79 100644
--- a/debian/libopenblas-base.prerm
+++ b/debian/libopenblas-base.prerm
@@ -6,6 +6,9 @@ if [ "$1" != "upgrade" ]
 then
     update-alternatives --remove libblas.so.3 \
     /usr/lib/openblas-base/libblas.so.3
+
+    update-alternatives --remove liblapack.so.3 \
+        /usr/lib/openblas-base/atlas/liblapack.so.3
 fi
 
 #DEBHELPER#
diff --git a/debian/libopenblas-base.shlibs b/debian/libopenblas-base.shlibs
index 9561cbf..9dd26ad 100644
--- a/debian/libopenblas-base.shlibs
+++ b/debian/libopenblas-base.shlibs
@@ -1,2 +1,3 @@
 libopenblas 0 libopenblas-base
 libblas 3 libblas3 | libblas.so.3
+liblapack 3 liblapack3 | liblapack.so.3
diff --git a/debian/libopenblas-dev.links b/debian/libopenblas-dev.links
index b7b20eb..e65523f 100644
--- a/debian/libopenblas-dev.links
+++ b/debian/libopenblas-dev.links
@@ -1,2 +1,4 @@
 usr/lib/libopenblas.a usr/lib/openblas-base/libblas.a
+usr/lib/libopenblas.a usr/lib/openblas-base/liblapack.a
 usr/lib/openblas-base/libblas.so.3 usr/lib/openblas-base/libblas.so
+usr/lib/openblas-base/liblapack.so.3 usr/lib/openblas-base/liblapack.so
diff --git a/debian/libopenblas-dev.postinst b/debian/libopenblas-dev.postinst
index 0ee610c..620976d 100644
--- a/debian/libopenblas-dev.postinst
+++ b/debian/libopenblas-dev.postinst
@@ -7,6 +7,10 @@ update-alternatives --install /usr/lib/libblas.so libblas.so \
     --slave /usr/lib/libblas.a libblas.a \
     /usr/lib/openblas-base/libblas.a
 
+update-alternatives --install /usr/lib/liblapack.so liblapack.so \
+	/usr/lib/openblas-base/liblapack.so 40 \
+    --slave /usr/lib/liblapack.a liblapack.a \
+    /usr/lib/openblas-base/liblapack.a
 
 # dh_installdeb will replace this with shell code automatically
 # generated by other debhelper scripts.
diff --git a/debian/libopenblas-dev.prerm b/debian/libopenblas-dev.prerm
index 5f7e8fb..8f8b623 100644
--- a/debian/libopenblas-dev.prerm
+++ b/debian/libopenblas-dev.prerm
@@ -6,6 +6,9 @@ if [ "$1" != "upgrade" ]
 then
     update-alternatives --remove libblas.so \
     /usr/lib/openblas-base/libblas.so
+
+    update-alternatives --remove liblapack.so \
+        /usr/lib/openblas-base/atlas/liblapack.so
 fi
 
 #DEBHELPER#
diff --git a/debian/patches/libblas3-soname.patch b/debian/patches/libblas3-soname.patch
deleted file mode 100644
index 9807776..0000000
--- a/debian/patches/libblas3-soname.patch
+++ /dev/null
@@ -1,32 +0,0 @@
-Description: Create a libblas.so.3 with the right SONAME
- That one is needed for the update-alternatives system.
- The code is inserted in the Linux section, which is also the kFreeBSD section
- because of kfreebsd-soname.patch.
-Author: Sébastien Villemot <sebastien at debian.org>
-Forwarded: not-needed
-Last-Update: 2014-02-20
----
-This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
---- a/exports/Makefile
-+++ b/exports/Makefile
-@@ -101,7 +101,7 @@ dllinit.$(SUFFIX) : dllinit.c
- 
- ifeq ($(OSNAME), $(filter $(OSNAME),Linux FreeBSD))
- 
--so : ../$(LIBSONAME)
-+so : ../$(LIBSONAME) ../libblas.so.3
- 
- ../$(LIBSONAME) : ../$(LIBNAME) linktest.c
- ifneq ($(C_COMPILER), LSB)
-@@ -118,6 +118,11 @@ else
- endif
- 	rm -f linktest
- 
-+../libblas.so.3 : ../$(LIBNAME) linktest.c
-+	$(CC) $(CFLAGS) $(LDFLAGS) -shared -o $@ \
-+	-Wl,--whole-archive ../$(LIBNAME) -Wl,--no-whole-archive \
-+	-Wl,-soname,libblas.so.3 $(EXTRALIB)
-+
- endif
- 
- #http://stackoverflow.com/questions/7656425/makefile-ifeq-logical-or
diff --git a/debian/patches/no-embedded-lapack.patch b/debian/patches/no-embedded-lapack.patch
index 1b9f3ca..5114bc1 100644
--- a/debian/patches/no-embedded-lapack.patch
+++ b/debian/patches/no-embedded-lapack.patch
@@ -1,17 +1,23 @@
 Description: Adapt build system for the absence of lapack-netlib/ directory.
+ Instead use the binary provided by package liblapack-pic, stripping from it the
+ symbols that are overriden by OpenBLAS.
 Author: Sébastien Villemot <sebastien at debian.org>
 Forwarded: not-needed
-Last-Update: 2014-07-29
+Last-Update: 2014-08-05
 ---
 This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
 --- a/Makefile
 +++ b/Makefile
-@@ -207,58 +207,8 @@ hpl_p :
+@@ -207,57 +207,14 @@ hpl_p :
  	fi; \
  	done
  
 -ifeq ($(NO_LAPACK), 1)
  netlib :
++	mkdir lapack-netlib
++	cd lapack-netlib && ar -x /usr/lib/lapack/liblapack_pic.a
++	make -C interface delete-duplicate-lapack-objects
++	ar -ru $(LIBNAME) lapack-netlib/*
  
 -else
 -netlib : lapack_prebuild
@@ -61,11 +67,12 @@ This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
 -endif
 -	- at cat  make.inc >> $(NETLIB_LAPACK_DIR)/make.inc
 -endif
--
++clean::
++	rm -rf lapack-netlib
+ 
  large.tgz :
  ifndef NOFORTRAN
- 	if [ ! -a $< ]; then
-@@ -312,9 +262,5 @@ ifeq ($(OSNAME), Darwin)
+@@ -312,9 +269,5 @@ ifeq ($(OSNAME), Darwin)
  	@rm -rf getarch.dSYM getarch_2nd.dSYM
  endif
  	@rm -f Makefile.conf config.h Makefile_kernel.conf config_kernel.h st* *.dylib
@@ -103,3 +110,15 @@ This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
  # Default C compiler
  # - Only set if not specified on the command line or inherited from the environment.
  # - CC is an implicit variable so neither '?=' or 'ifndef' can be used.
+--- a/interface/Makefile
++++ b/interface/Makefile
+@@ -2056,4 +2056,8 @@ cimatcopy.$(SUFFIX) cimatcopy.$(PSUFFIX)
+ zimatcopy.$(SUFFIX) zimatcopy.$(PSUFFIX) : zimatcopy.c
+ 	$(CC) -c $(CFLAGS) $< -o $(@F)
+ 
+-
++# The list of symbols to be removed can be seen in the diff between LAPACK's
++# original SRC/Makefile and the version of that same file that is included in
++# OpenBLAS (unfiltered) tarball
++delete-duplicate-lapack-objects:
++	cd ../lapack-netlib && rm $(SLAPACKOBJS) $(DLAPACKOBJS) $(CLAPACKOBJS) $(ZLAPACKOBJS) lsame.o xerbla.o
diff --git a/debian/patches/series b/debian/patches/series
index 559ad41..73806f0 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1,6 +1,6 @@
 arm-gcc-flags.patch
 kfreebsd-soname.patch
-libblas3-soname.patch
 test-custom-package.patch
 remove-openmp-warning.patch
 no-embedded-lapack.patch
+shared-blas-lapack.patch
diff --git a/debian/patches/shared-blas-lapack.patch b/debian/patches/shared-blas-lapack.patch
new file mode 100644
index 0000000..697e66e
--- /dev/null
+++ b/debian/patches/shared-blas-lapack.patch
@@ -0,0 +1,31 @@
+Description: Create shared libraries lib{blas,lapack}.so.3
+ It is done so that duplicate code with libopenblas.so.0 is kept as low as
+ possible. Only the symbols from the external BLAS/LAPACK API are incorporated
+ in the shared libraries. The rest is obtained by dynamic linking against
+ libopenblas.so.0.
+Author: Sébastien Villemot <sebastien at debian.org>
+Forwarded: not-needed
+Last-Update: 2014-05-08
+---
+This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
+--- a/interface/Makefile
++++ b/interface/Makefile
+@@ -2061,3 +2061,18 @@ zimatcopy.$(SUFFIX) zimatcopy.$(PSUFFIX)
+ # OpenBLAS (unfiltered) tarball
+ delete-duplicate-lapack-objects:
+ 	cd ../lapack-netlib && rm $(SLAPACKOBJS) $(DLAPACKOBJS) $(CLAPACKOBJS) $(ZLAPACKOBJS) lsame.o xerbla.o
++
++shared-blas-lapack: libblas.so.3 liblapack.so.3
++
++# The list of prerequisite is created by comparing with NETLIB BLAS public API.
++# The symbol cblas_xerbla is missing here, but it does not seem to be provided
++# by libopenblas.so.0 either.
++libblas.so.3: $(SBLAS1OBJS) $(SBLAS2OBJS) $(SBLAS3OBJS) $(DBLAS1OBJS) $(DBLAS2OBJS) $(DBLAS3OBJS) $(CBLAS1OBJS) $(CBLAS2OBJS) $(CBLAS3OBJS) $(ZBLAS1OBJS) $(ZBLAS2OBJS) $(ZBLAS3OBJS) ../kernel/lsame.o ../kernel/scabs1.o ../kernel/dcabs1.o ../driver/others/xerbla.o
++	$(CC) $(LDFLAGS) -shared -o $@ $^ -Wl,-soname,libblas.so.3 -L.. -lopenblas $(EXTRALIB)
++
++# The prerequisites must match the symbols deleted in target delete-duplicate-lapack-objects
++liblapack.so.3: $(SLAPACKOBJS) $(DLAPACKOBJS) $(CLAPACKOBJS) $(ZLAPACKOBJS) ../kernel/lsame.o ../driver/others/xerbla.o
++	$(CC) $(LDFLAGS) -shared -o $@ $^ ../lapack-netlib/* -Wl,-soname,liblapack.so.3 -L.. -lopenblas $(EXTRALIB)
++
++clean::
++	rm -f libblas.so.3 liblapack.so.3
diff --git a/debian/rules b/debian/rules
index bf41899..4ece377 100755
--- a/debian/rules
+++ b/debian/rules
@@ -2,7 +2,7 @@
 
 include /usr/share/dpkg/buildflags.mk
 
-COMMON_MAKE_OPTIONS = NO_LAPACK=1 NO_AFFINITY=1 NO_WARMUP=1 CFLAGS="$(CPPFLAGS) $(CFLAGS)" FFLAGS="$(FFLAGS)"
+COMMON_MAKE_OPTIONS = NO_LAPACKE=1 NO_AFFINITY=1 NO_WARMUP=1 CFLAGS="$(CPPFLAGS) $(CFLAGS)" FFLAGS="$(FFLAGS)"
 ENABLE_DYNAMIC_ARCHS := amd64 i386 kfreebsd-amd64 kfreebsd-i386
 ifneq (,$(findstring $(DEB_HOST_ARCH),$(ENABLE_DYNAMIC_ARCHS)))
 	DYNAMIC_ARCH_ARG="DYNAMIC_ARCH=1"
@@ -48,6 +48,8 @@ override_dh_auto_build:
 			$(MAKE) $(COMMON_MAKE_OPTIONS) TARGET=$(TARGET) $(DEBUG_ARG);									\
 	fi
 
+	make -C interface shared-blas-lapack
+
 override_dh_auto_install:
 	make install DESTDIR=debian/tmp/ PREFIX=/usr
 
@@ -65,5 +67,8 @@ override_dh_makeshlibs:
 	dh_makeshlibs
 	cp debian/libopenblas-base.shlibs debian/libopenblas-base/DEBIAN/shlibs
 
+override_dh_gencontrol:
+	dh_gencontrol -- -VBuilt-Using="`dpkg-query -W -f='$${source:Package} (= $${source:Version})' liblapack-pic`"
+
 get-orig-source:
 	-uscan --upstream-version 0

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/openblas.git



More information about the debian-science-commits mailing list