aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'sci-libs/openblas/openblas-9999.ebuild')
-rw-r--r--sci-libs/openblas/openblas-9999.ebuild148
1 files changed, 69 insertions, 79 deletions
diff --git a/sci-libs/openblas/openblas-9999.ebuild b/sci-libs/openblas/openblas-9999.ebuild
index 008e107d2..f9834f69e 100644
--- a/sci-libs/openblas/openblas-9999.ebuild
+++ b/sci-libs/openblas/openblas-9999.ebuild
@@ -4,96 +4,56 @@
EAPI=5
-if [[ ${PV} == "9999" ]] ; then
- _SCM=git-2
- EGIT_REPO_URI="https://github.com/xianyi/OpenBLAS.git"
- SRC_URI=""
- KEYWORDS=""
-else
- SRC_URI="http://github.com/xianyi/OpenBLAS/tarball/v${PV} -> ${P}.tar.gz"
- KEYWORDS="~amd64 ~x86 ~amd64-linux ~x86-linux ~x86-macos ~ppc-macos ~x64-macos"
-fi
-
-inherit eutils toolchain-funcs alternatives-2 multilib fortran-2 ${_SCM}
+EGIT_REPO_URI="https://github.com/xianyi/OpenBLAS.git"
+EGIT_MASTER="develop"
+
+inherit eutils toolchain-funcs alternatives-2 multilib fortran-2 git-2
DESCRIPTION="Optimized BLAS library based on GotoBLAS2"
HOMEPAGE="http://xianyi.github.com/OpenBLAS/"
+KEYWORDS=""
+SRC_URI="http://dev.gentoo.org/~bicatali/distfiles/${PN}-gentoo.patch"
LICENSE="BSD"
SLOT="0"
-IUSE="+incblas int64 dynamic openmp static-libs threads"
+IUSE="int64 dynamic openmp static-libs threads"
RDEPEND=""
DEPEND="${RDEPEND}"
-src_unpack() {
- unpack ${A}
- mv "${WORKDIR}"/*OpenBLAS* "${S}" || die
-}
-
src_prepare() {
- epatch "${FILESDIR}"/${PN}-{sharedlibs-0.2,aliasing}.patch
- # respect LDFLAGS
- sed -i -e '/^LDFLAGS\s*=/d' Makefile.* || die
- # respect CFLAGS only if dynamic flag not enabled
- if ! use dynamic; then
- sed -i \
- -e "/^COMMON_OPT/s/-O2/${CFLAGS}/" \
- Makefile.rule || die
- fi
- # fix executable stacks
- local i
- for i in $(find . -name \*.S); do
- cat >> ${i} <<-EOF
- #if defined(__ELF__)
- .section .note.GNU-stack,"",%progbits
- #endif
- EOF
- done
+ # openblas already does multi-jobs
+ MAKEOPTS+=" -j1"
+ cd "${S}"
+ epatch "${DISTDIR}"/${PN}-gentoo.patch
}
src_configure() {
- local use_openmp=$(use openmp && echo 1)
- use threads && use openmp && use_openmp="" && \
- einfo "openmp and threads enabled: using threads"
+ # lapack and lapacke are not modified from upstream lapack
sed -i \
- -e "s:^#\s*\(NO_LAPACK\)\s*=.*:\1=1:" \
- -e "s:^#\s*\(NO_LAPACKE\)\s*=.*:\1=1:" \
-e "s:^#\s*\(CC\)\s*=.*:\1=$(tc-getCC):" \
-e "s:^#\s*\(FC\)\s*=.*:\1=$(tc-getFC):" \
- -e "s:^#\s*\(USE_THREAD\)\s*=.*:\1=$(use threads && echo 1 || echo 0):" \
- -e "s:^#\s*\(USE_OPENMP\)\s*=.*:\1=${use_openmp}:" \
- -e "s:^#\s*\(DYNAMIC_ARCH\)\s*=.*:\1=$(use dynamic && echo 1):" \
- -e "s:^#\s*\(INTERFACE64\)\s*=.*:\1=$(use int64 && echo 1):" \
- -e "s:^#\s*\(NO_CBLAS\)\s*=.*:\1=$(use incblas || echo 1):" \
+ -e "s:^#\s*\(COMMON_OPT\)\s*=.*:\1=${CFLAGS}:" \
+ -e "s:^#\s*\(NO_LAPACK\)\s*=.*:\1=1:" \
+ -e "s:^#\s*\(NO_LAPACKE\)\s*=.*:\1=1:" \
Makefile.rule || die
}
-src_compile() {
- mkdir solibs
- emake libs shared && mv *$(get_libname) solibs/
- use static-libs && emake clean && emake libs NEED_PIC=
-}
-
-src_test() {
- emake tests
-}
-
-src_install() {
- local profname=${PN} threads
- use int64 && profname=${profname}-int64
- if use threads; then
- threads="-pthread"
- profname=${profname}-threads
- elif use openmp; then
- profname=${profname}-openmp
+openblas_compile() {
+ local profname=$1
+ einfo "Compiling profile ${profname}"
+ # cflags already defined twice
+ unset CFLAGS
+ emake clean
+ emake libs shared ${openblas_flags}
+ mkdir -p libs && mv lib* libs/
+ # avoid pic when compiling static libraries, so re-compiling
+ if use static-libs; then
+ emake clean
+ emake libs ${openblas_flags} NO_SHARED=1 NEED_PIC=
+ mv lib* libs/
fi
-
- dolib.so solibs/lib*$(get_libname)
- use static-libs && dolib.a lib*.a
-
- # create pkg-config file and associated eselect file
cat <<-EOF > ${profname}.pc
prefix=${EPREFIX}/usr
libdir=\${prefix}/$(get_libdir)
@@ -103,27 +63,57 @@ src_install() {
Version: ${PV}
URL: ${HOMEPAGE}
Libs: -L\${libdir} -lopenblas
- Libs.private: -lm ${threads}
+ Libs.private: -lm
+ Cflags: -I\${includedir}/${PN}
EOF
+}
+
+src_compile() {
+ openblas_flags=""
+ use dynamic && \
+ openblas_flags+=" DYNAMIC_ARCH=1 TARGET=GENERIC NUM_THREADS=64 NO_AFFINITY=1"
+ use int64 && \
+ openblas_flags+=" INTERFACE64=1"
+
+ # choose posix threads over openmp when the two are set
+ # yet to see the need of having the two profiles simultaneously
+ if use threads; then
+ openblas_flags+=" USE_THREAD=1 USE_OPENMP=0"
+ elif use openmp; then
+ openblas_flags+=" USE_THREAD=0 USE_OPENMP=1"
+ fi
+ openblas_compile openblas-int64
+ mv libs/lib* . || die
+}
- alternatives_for blas ${profname} 0 \
- /usr/$(get_libdir)/pkgconfig/blas.pc ${profname}.pc
+src_test() {
+ emake tests ${openblas_flags}
+}
- if use incblas; then
- echo >> ${profname}.pc "Cflags: -I\${includedir}/${PN}"
- insinto /usr/include/${PN}
- doins cblas.h common*.h config.h param.h
+src_install() {
+ local pcfile
+ for pcfile in *.pc; do
+ local profname=${pcfile%.pc}
+ emake install \
+ PREFIX="${ED}"usr ${openblas_flags} \
+ OPENBLAS_INCLUDE_DIR="${ED}"usr/include/${PN} \
+ OPENBLAS_LIBRARY_DIR="${ED}"usr/$(get_libdir)
+ use static-libs || rm "${ED}"usr/$(get_libdir)/lib*.a
+ alternatives_for blas ${profname} 0 \
+ /usr/$(get_libdir)/pkgconfig/blas.pc ${pcfile}
alternatives_for cblas ${profname} 0 \
- /usr/$(get_libdir)/pkgconfig/cblas.pc ${profname}.pc \
+ /usr/$(get_libdir)/pkgconfig/cblas.pc ${pcfile} \
/usr/include/cblas.h ${PN}/cblas.h
- fi
+ insinto /usr/$(get_libdir)/pkgconfig
+ doins ${pcfile}
+ done
- insinto /usr/$(get_libdir)/pkgconfig
- doins ${profname}.pc
dodoc GotoBLAS_{01Readme,03FAQ,04FAQ,05LargePage,06WeirdPerformance}.txt
+ dodoc *md Changelog.txt
if [[ ${CHOST} == *-darwin* ]] ; then
cd "${ED}"/usr/$(get_libdir)
+ local d
for d in *.dylib ; do
ebegin "Correcting install_name of ${d}"
install_name_tool -id "${EPREFIX}/usr/$(get_libdir)/${d}" "${d}"