Gentoo Archives: gentoo-commits

From: Benda XU <heroxbd@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: sci-libs/blis/files/, sci-libs/blis/
Date: Wed, 26 Jun 2019 06:07:24
Message-Id: 1561529170.914aebf44db94fad75de5781a770ffdc97cd38a3.heroxbd@gentoo
1 commit: 914aebf44db94fad75de5781a770ffdc97cd38a3
2 Author: Mo Zhou <cdluminate <AT> gmail <DOT> com>
3 AuthorDate: Wed Jun 26 02:41:35 2019 +0000
4 Commit: Benda XU <heroxbd <AT> gentoo <DOT> org>
5 CommitDate: Wed Jun 26 06:06:10 2019 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=914aebf4
7
8 sci-libs/blis: new BLIS package as an BLAS/CBLAS alternative.
9
10 Closes: https://github.com/gentoo/gentoo/pull/12322
11 Signed-off-by: Mo Zhou <cdluminate <AT> gmail.com>
12 Signed-off-by: Benda Xu <heroxbd <AT> gentoo.org>
13
14 sci-libs/blis/Manifest | 1 +
15 sci-libs/blis/blis-0.5.2.ebuild | 107 ++++++++++++
16 sci-libs/blis/files/blas.lds | 15 ++
17 sci-libs/blis/files/blis-0.5.2-blas-provider.patch | 13 ++
18 sci-libs/blis/files/blis-0.5.2-gh313.patch | 187 +++++++++++++++++++++
19 sci-libs/blis/files/blis-0.5.2-rpath.patch | 13 ++
20 sci-libs/blis/files/cblas.lds | 15 ++
21 sci-libs/blis/metadata.xml | 30 ++++
22 8 files changed, 381 insertions(+)
23
24 diff --git a/sci-libs/blis/Manifest b/sci-libs/blis/Manifest
25 new file mode 100644
26 index 00000000000..7d42eadf47b
27 --- /dev/null
28 +++ b/sci-libs/blis/Manifest
29 @@ -0,0 +1 @@
30 +DIST blis-0.5.2.tar.gz 3502383 BLAKE2B b09fda20711086c8bde0d4efc3f3c9b0f6072e1ddb8bd2846465877f0353cced27548abe1239b6a042fe655e85e4b7b3c960322e39b2c733866b8e17777718bd SHA512 4f91a7834ef0ed39544dd21856814467416a222240050cca323917b0fc61b9201ae4dbd109aa687cdecb27ddee5d6bf4510ef023e1c1dc73599faef0482d3d04
31
32 diff --git a/sci-libs/blis/blis-0.5.2.ebuild b/sci-libs/blis/blis-0.5.2.ebuild
33 new file mode 100644
34 index 00000000000..939d0b608d6
35 --- /dev/null
36 +++ b/sci-libs/blis/blis-0.5.2.ebuild
37 @@ -0,0 +1,107 @@
38 +# Copyright 2019 Gentoo Authors
39 +# Distributed under the terms of the GNU General Public License v2
40 +
41 +EAPI=7
42 +inherit eutils
43 +
44 +DESCRIPTION="BLAS-like Library Instantiation Software Framework"
45 +HOMEPAGE="https://github.com/flame/blis"
46 +SRC_URI="https://github.com/flame/${PN}/archive/${PV}.tar.gz -> ${P}.tar.gz"
47 +
48 +LICENSE="BSD"
49 +SLOT="0"
50 +KEYWORDS="~amd64 ~ppc64 ~x86"
51 +IUSE="openmp pthread serial static-libs eselect-ldso doc 64bit-index"
52 +REQUIRED_USE="?? ( openmp pthread serial ) ?? ( eselect-ldso 64bit-index )"
53 +
54 +RDEPEND="eselect-ldso? ( !app-eselect/eselect-cblas
55 + >=app-eselect/eselect-blas-0.2 )"
56 +
57 +DEPEND="${RDEPEND}
58 + dev-lang/python
59 +"
60 +
61 +PATCHES=(
62 + "${FILESDIR}/${P}-rpath.patch"
63 + "${FILESDIR}/${P}-blas-provider.patch"
64 + "${FILESDIR}/${P}-gh313.patch"
65 +)
66 +
67 +src_configure () {
68 + local BLIS_FLAGS=()
69 + local confname
70 + # determine flags
71 + if use openmp; then
72 + BLIS_FLAGS+=( -t openmp )
73 + elif use pthread; then
74 + BLIS_FLAGS+=( -t pthreads )
75 + else
76 + BLIS_FLAGS+=( -t no )
77 + fi
78 + use 64bit-index && BLIS_FLAGS+=( -b 64 -i 64 )
79 + # determine config name
80 + case "${ARCH}" in
81 + "x86" | "amd64")
82 + confname=auto ;;
83 + "ppc64")
84 + confname=generic ;;
85 + *)
86 + confname=generic ;;
87 + esac
88 + # This is not an autotools configure file. We don't use econf here.
89 + ./configure \
90 + --enable-verbose-make \
91 + --prefix="${BROOT}"/usr \
92 + --libdir="${BROOT}"/usr/$(get_libdir) \
93 + $(use_enable static-libs static) \
94 + --enable-blas \
95 + --enable-cblas \
96 + ${BLIS_FLAGS[@]} \
97 + --enable-shared \
98 + $confname || die
99 +}
100 +
101 +src_compile() {
102 + DEB_LIBBLAS=libblas.so.3 DEB_LIBCBLAS=libcblas.so.3 \
103 + LDS_BLAS="${FILESDIR}"/blas.lds LDS_CBLAS="${FILESDIR}"/cblas.lds \
104 + default
105 +}
106 +
107 +src_test () {
108 + emake check
109 +}
110 +
111 +src_install () {
112 + default
113 + use doc && dodoc README.md docs/*.md
114 +
115 + if use eselect-ldso; then
116 + dodir /usr/$(get_libdir)/blas/blis
117 + insinto /usr/$(get_libdir)/blas/blis
118 + doins lib/*/lib{c,}blas.so.3
119 + dosym libblas.so.3 usr/$(get_libdir)/blas/blis/libblas.so
120 + dosym libcblas.so.3 usr/$(get_libdir)/blas/blis/libcblas.so
121 + fi
122 +}
123 +
124 +pkg_postinst() {
125 + use eselect-ldso || return
126 +
127 + local libdir=$(get_libdir) me="blis"
128 +
129 + # check blas
130 + eselect blas add ${libdir} "${EROOT}"/usr/${libdir}/blas/${me} ${me}
131 + local current_blas=$(eselect blas show ${libdir})
132 + if [[ ${current_blas} == blis || -z ${current_blas} ]]; then
133 + eselect blas set ${libdir} ${me}
134 + elog "Current eselect: BLAS/CBLAS ($libdir) -> [${current_blas}]."
135 + else
136 + elog "Current eselect: BLAS/CBLAS ($libdir) -> [${current_blas}]."
137 + elog "To use blas [${me}] implementation, you have to issue (as root):"
138 + elog "\t eselect blas set ${libdir} ${me}"
139 + fi
140 +}
141 +
142 +pkg_postrm() {
143 + use eselect-ldso && eselect blas validate
144 +}
145
146 diff --git a/sci-libs/blis/files/blas.lds b/sci-libs/blis/files/blas.lds
147 new file mode 100644
148 index 00000000000..db79d3bc905
149 --- /dev/null
150 +++ b/sci-libs/blis/files/blas.lds
151 @@ -0,0 +1,15 @@
152 +{
153 + # Export BLAS symbols
154 + global:
155 + *_;
156 + RowMajorStrg;
157 +
158 + # Hide everything else.
159 + local:
160 + cblas_*;
161 + CBLAS_*;
162 + bli_thread_set_num_threads_;
163 + bli_thread_set_ways_;
164 + bli_*;
165 + *;
166 +};
167
168 diff --git a/sci-libs/blis/files/blis-0.5.2-blas-provider.patch b/sci-libs/blis/files/blis-0.5.2-blas-provider.patch
169 new file mode 100644
170 index 00000000000..5999f847929
171 --- /dev/null
172 +++ b/sci-libs/blis/files/blis-0.5.2-blas-provider.patch
173 @@ -0,0 +1,13 @@
174 +diff --git a/Makefile b/Makefile
175 +index 2d31fee..7008682 100644
176 +--- a/Makefile
177 ++++ b/Makefile
178 +@@ -659,6 +659,8 @@ else
179 + @$(LINKER) $(SOFLAGS) -o $(LIBBLIS_SO_OUTPUT_NAME) $? $(LDFLAGS)
180 + endif
181 + endif
182 ++ $(LINKER) $(SOFLAGS) -o $(BASE_LIB_PATH)/$(DEB_LIBBLAS) $? $(LDFLAGS) -Wl,--soname,$(DEB_LIBBLAS) -Wl,--version-script=$(LDS_BLAS)
183 ++ $(LINKER) $(SOFLAGS) -o $(BASE_LIB_PATH)/$(DEB_LIBCBLAS) $? $(LDFLAGS) -Wl,--soname,$(DEB_LIBCBLAS) -Wl,--version-script=$(LDS_CBLAS)
184 +
185 + # Local symlink for shared library.
186 + # NOTE: We use a '.loc' suffix to avoid filename collisions in case this
187
188 diff --git a/sci-libs/blis/files/blis-0.5.2-gh313.patch b/sci-libs/blis/files/blis-0.5.2-gh313.patch
189 new file mode 100644
190 index 00000000000..fab3a8a09ee
191 --- /dev/null
192 +++ b/sci-libs/blis/files/blis-0.5.2-gh313.patch
193 @@ -0,0 +1,187 @@
194 +diff --git a/common.mk b/common.mk
195 +index 5513098a5..999df774b 100644
196 +--- a/common.mk
197 ++++ b/common.mk
198 +@@ -118,7 +118,8 @@ get-noopt-cxxflags-for = $(strip $(CFLAGS_PRESET) \
199 + get-refinit-cflags-for = $(strip $(call load-var-for,COPTFLAGS,$(1)) \
200 + $(call get-noopt-cflags-for,$(1)) \
201 + -DBLIS_CNAME=$(1) \
202 +- $(BUILD_FLAGS) \
203 ++ $(BUILD_CPPFLAGS) \
204 ++ $(BUILD_SYMFLAGS) \
205 + )
206 +
207 + get-refkern-cflags-for = $(strip $(call load-var-for,CROPTFLAGS,$(1)) \
208 +@@ -126,23 +127,27 @@ get-refkern-cflags-for = $(strip $(call load-var-for,CROPTFLAGS,$(1)) \
209 + $(call get-noopt-cflags-for,$(1)) \
210 + $(COMPSIMDFLAGS) \
211 + -DBLIS_CNAME=$(1) \
212 +- $(BUILD_FLAGS) \
213 ++ $(BUILD_CPPFLAGS) \
214 ++ $(BUILD_SYMFLAGS) \
215 + )
216 +
217 + get-config-cflags-for = $(strip $(call load-var-for,COPTFLAGS,$(1)) \
218 + $(call get-noopt-cflags-for,$(1)) \
219 +- $(BUILD_FLAGS) \
220 ++ $(BUILD_CPPFLAGS) \
221 ++ $(BUILD_SYMFLAGS) \
222 + )
223 +
224 + get-frame-cflags-for = $(strip $(call load-var-for,COPTFLAGS,$(1)) \
225 + $(call get-noopt-cflags-for,$(1)) \
226 +- $(BUILD_FLAGS) \
227 ++ $(BUILD_CPPFLAGS) \
228 ++ $(BUILD_SYMFLAGS) \
229 + )
230 +
231 + get-kernel-cflags-for = $(strip $(call load-var-for,CKOPTFLAGS,$(1)) \
232 + $(call load-var-for,CKVECFLAGS,$(1)) \
233 + $(call get-noopt-cflags-for,$(1)) \
234 +- $(BUILD_FLAGS) \
235 ++ $(BUILD_CPPFLAGS) \
236 ++ $(BUILD_SYMFLAGS) \
237 + )
238 +
239 + # When compiling sandboxes, we use flags similar to those of general framework
240 +@@ -153,19 +158,24 @@ get-kernel-cflags-for = $(strip $(call load-var-for,CKOPTFLAGS,$(1)) \
241 + get-sandbox-c99flags-for = $(strip $(call load-var-for,COPTFLAGS,$(1)) \
242 + $(call get-noopt-cflags-for,$(1)) \
243 + $(CSBOXINCFLAGS) \
244 +- $(BUILD_FLAGS) \
245 ++ $(BUILD_CPPFLAGS) \
246 ++ $(BUILD_SYMFLAGS) \
247 + )
248 + get-sandbox-cxxflags-for = $(strip $(call load-var-for,COPTFLAGS,$(1)) \
249 + $(call get-noopt-cxxflags-for,$(1)) \
250 + $(CSBOXINCFLAGS) \
251 +- $(BUILD_FLAGS) \
252 ++ $(BUILD_CPPFLAGS) \
253 ++ $(BUILD_SYMFLAGS) \
254 + )
255 +
256 + # Define a separate function that will return appropriate flags for use by
257 + # applications that want to use the same basic flags as those used when BLIS
258 +-# was compiled. (This is the same as get-frame-cflags-for(), except that it
259 +-# omits the BUILD_FLAGS, which are exclusively for use when BLIS is being
260 +-# compiled.)
261 ++# was compiled. (NOTE: This is the same as the $(get-frame-cflags-for ...)
262 ++# function, except that it omits two variables that contain flags exclusively
263 ++# for use when BLIS is being compiled/built: BUILD_CPPFLAGS, which contains a
264 ++# cpp macro that confirms that BLIS is being built; and BUILD_SYMFLAGS, which
265 ++# contains symbol export flags that are only needed when a shared library is
266 ++# being compiled/linked.)
267 + get-user-cflags-for = $(strip $(call load-var-for,COPTFLAGS,$(1)) \
268 + $(call get-noopt-cflags-for,$(1)) \
269 + )
270 +@@ -627,22 +637,26 @@ $(foreach c, $(CONFIG_LIST_FAM), $(eval $(call append-var-for,CPICFLAGS,$(c))))
271 +
272 + # --- Symbol exporting flags (shared libraries only) ---
273 +
274 ++# NOTE: These flags are only applied when building BLIS and not used by
275 ++# applications that import BLIS compilation flags via the
276 ++# $(get-user-cflags-for ...) function.
277 ++
278 + # Determine default export behavior / visibility of symbols for gcc.
279 + ifeq ($(CC_VENDOR),gcc)
280 + ifeq ($(IS_WIN),yes)
281 + ifeq ($(EXPORT_SHARED),all)
282 +-CMISCFLAGS := -Wl,--export-all-symbols, -Wl,--enable-auto-import
283 ++BUILD_SYMFLAGS := -Wl,--export-all-symbols, -Wl,--enable-auto-import
284 + else # ifeq ($(EXPORT_SHARED),public)
285 +-CMISCFLAGS := -Wl,--exclude-all-symbols
286 ++BUILD_SYMFLAGS := -Wl,--exclude-all-symbols
287 + endif
288 + else # ifeq ($(IS_WIN),no)
289 + ifeq ($(EXPORT_SHARED),all)
290 + # Export all symbols by default.
291 +-CMISCFLAGS := -fvisibility=default
292 ++BUILD_SYMFLAGS := -fvisibility=default
293 + else # ifeq ($(EXPORT_SHARED),public)
294 + # Hide all symbols by default and export only those that have been annotated
295 + # as needing to be exported.
296 +-CMISCFLAGS := -fvisibility=hidden
297 ++BUILD_SYMFLAGS := -fvisibility=hidden
298 + endif
299 + endif
300 + endif
301 +@@ -653,11 +667,11 @@ endif
302 + ifeq ($(CC_VENDOR),icc)
303 + ifeq ($(EXPORT_SHARED),all)
304 + # Export all symbols by default.
305 +-CMISCFLAGS := -fvisibility=default
306 ++BUILD_SYMFLAGS := -fvisibility=default
307 + else # ifeq ($(EXPORT_SHARED),public)
308 + # Hide all symbols by default and export only those that have been annotated
309 + # as needing to be exported.
310 +-CMISCFLAGS := -fvisibility=hidden
311 ++BUILD_SYMFLAGS := -fvisibility=hidden
312 + endif
313 + endif
314 +
315 +@@ -667,27 +681,25 @@ ifeq ($(IS_WIN),yes)
316 + ifeq ($(EXPORT_SHARED),all)
317 + # NOTE: clang on Windows does not appear to support exporting all symbols
318 + # by default, and therefore we ignore the value of EXPORT_SHARED.
319 +-CMISCFLAGS :=
320 ++BUILD_SYMFLAGS :=
321 + else # ifeq ($(EXPORT_SHARED),public)
322 + # NOTE: The default behavior of clang on Windows is to hide all symbols
323 + # and only export functions and other declarations that have beenannotated
324 + # as needing to be exported.
325 +-CMISCFLAGS :=
326 ++BUILD_SYMFLAGS :=
327 + endif
328 + else # ifeq ($(IS_WIN),no)
329 + ifeq ($(EXPORT_SHARED),all)
330 + # Export all symbols by default.
331 +-CMISCFLAGS := -fvisibility=default
332 ++BUILD_SYMFLAGS := -fvisibility=default
333 + else # ifeq ($(EXPORT_SHARED),public)
334 + # Hide all symbols by default and export only those that have been annotated
335 + # as needing to be exported.
336 +-CMISCFLAGS := -fvisibility=hidden
337 ++BUILD_SYMFLAGS := -fvisibility=hidden
338 + endif
339 + endif
340 + endif
341 +
342 +-$(foreach c, $(CONFIG_LIST_FAM), $(eval $(call append-var-for,CMISCFLAGS,$(c))))
343 +-
344 + # --- Language flags ---
345 +
346 + # Enable C99.
347 +@@ -1026,7 +1038,7 @@ VERS_DEF := -DBLIS_VERSION_STRING=\"$(VERSION)\"
348 + # Define a C preprocessor flag that is *only* defined when BLIS is being
349 + # compiled. (In other words, an application that #includes blis.h will not
350 + # get this cpp macro.)
351 +-BUILD_FLAGS := -DBLIS_IS_BUILDING_LIBRARY
352 ++BUILD_CPPFLAGS := -DBLIS_IS_BUILDING_LIBRARY
353 +
354 +
355 +
356 +diff --git a/configure b/configure
357 +index 5b5695cd5..bb21671f0 100755
358 +--- a/configure
359 ++++ b/configure
360 +@@ -152,13 +152,13 @@ print_usage()
361 + echo " functions and variables that belong to public APIs are"
362 + echo " exported in shared libraries. However, the user may"
363 + echo " instead export all symbols in BLIS, even those that were"
364 +- echo " intended for internal use only. Note Note that the public"
365 +- echo " APIs encompass all functions that almost any user would"
366 +- echo " ever want to call, including the BLAS/CBLAS compatibility"
367 +- echo " APIs as well as the basic and expert interfaces to the"
368 +- echo " typed and object APIs that are unique to BLIS. Also note"
369 +- echo " that changing this option to 'all' will have no effect in"
370 +- echo " some environments, such as when compiling with clang on"
371 ++ echo " intended for internal use only. Note that the public APIs"
372 ++ echo " encompass all functions that almost any user would ever"
373 ++ echo " want to call, including the BLAS/CBLAS compatibility APIs"
374 ++ echo " as well as the basic and expert interfaces to the typed"
375 ++ echo " and object APIs that are unique to BLIS. Also note that"
376 ++ echo " changing this option to 'all' will have no effect in some"
377 ++ echo " environments, such as when compiling with clang on"
378 + echo " Windows."
379 + echo " "
380 + echo " -t MODEL, --enable-threading[=MODEL], --disable-threading"
381
382 diff --git a/sci-libs/blis/files/blis-0.5.2-rpath.patch b/sci-libs/blis/files/blis-0.5.2-rpath.patch
383 new file mode 100644
384 index 00000000000..a8b5a46870d
385 --- /dev/null
386 +++ b/sci-libs/blis/files/blis-0.5.2-rpath.patch
387 @@ -0,0 +1,13 @@
388 +diff --git a/common.mk b/common.mk
389 +index ef0acfb..e1ce31d 100644
390 +--- a/common.mk
391 ++++ b/common.mk
392 +@@ -527,7 +527,7 @@ LIBBLIS_L := $(LIBBLIS_SO)
393 + LIBBLIS_LINK := $(LIBBLIS_SO_PATH)
394 + ifeq ($(IS_WIN),no)
395 + # For Linux and OS X: set rpath property of shared object.
396 +-LDFLAGS += -Wl,-rpath,$(BASE_LIB_PATH)
397 ++#LDFLAGS += -Wl,-rpath,$(BASE_LIB_PATH)
398 + endif
399 + endif
400 + endif
401
402 diff --git a/sci-libs/blis/files/cblas.lds b/sci-libs/blis/files/cblas.lds
403 new file mode 100644
404 index 00000000000..18ec172028c
405 --- /dev/null
406 +++ b/sci-libs/blis/files/cblas.lds
407 @@ -0,0 +1,15 @@
408 +{
409 + # Export CBLAS symbols
410 + global:
411 + cblas_*;
412 + CBLAS_*;
413 + RowMajorStrg;
414 +
415 + # Hide everything else.
416 + local:
417 + bli_thread_set_num_threads_;
418 + bli_thread_set_ways_;
419 + bli_*;
420 + *_;
421 + *;
422 +};
423
424 diff --git a/sci-libs/blis/metadata.xml b/sci-libs/blis/metadata.xml
425 new file mode 100644
426 index 00000000000..a27c6853409
427 --- /dev/null
428 +++ b/sci-libs/blis/metadata.xml
429 @@ -0,0 +1,30 @@
430 +<?xml version="1.0" encoding="UTF-8"?>
431 +<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
432 +<pkgmetadata>
433 + <upstream>
434 + <bugs-to>https://github.com/flame/blis/issues/</bugs-to>
435 + <doc>https://github.com/flame/blis</doc>
436 + </upstream>
437 + <maintainer type="project">
438 + <name>Mo Zhou</name>
439 + <email>lumin@××××××.org</email>
440 + </maintainer>
441 + <longdescription>
442 + BLIS is a portable software framework for instantiating high-performance
443 + BLAS-like dense linear algebra libraries. The framework was designed to
444 + isolate essential kernels of computation that, when optimized, immediately
445 + enable optimized implementations of most of its commonly used and
446 + computationally intensive operations. BLIS is written in ISO C99 and
447 + available under a new/modified/3-clause BSD license. While BLIS exports a
448 + new BLAS-like API, it also includes a BLAS compatibility layer which gives
449 + application developers access to BLIS implementations via traditional BLAS
450 + routine calls. An object-based API unique to BLIS is also available.
451 + </longdescription>
452 + <use>
453 + <flag name="openmp">Use openmp threadding model</flag>
454 + <flag name="pthread">Use pthread threadding model</flag>
455 + <flag name="serial">Use no threadding model</flag>
456 + <flag name="eselect-ldso">Enable runtime library switching by eselect and ld.so.</flag>
457 + <flag name="64bit-index">Enable 64bit array indexing, incompatible with runtime switching</flag>
458 + </use>
459 +</pkgmetadata>