commit: 2ff76f8d81a107b07bb43fd653d73bf549aae016 Author: Marius Brehler <marbre <AT> linux <DOT> sungazer <DOT> de> AuthorDate: Fri Jan 9 17:32:31 2015 +0000 Commit: Justin Lecher <jlec <AT> gentoo <DOT> org> CommitDate: Fri Jan 9 17:32:31 2015 +0000 URL: http://sources.gentoo.org/gitweb/?p=proj/sci.git;a=commit;h=2ff76f8d
New package arrayfire --- licenses/ArrayFire | 27 +++++++++ sci-libs/arrayfire/arrayfire-9999.ebuild | 96 ++++++++++++++++++++++++++++++++ sci-libs/arrayfire/files/FindCBLAS.patch | 48 ++++++++++++++++ sci-libs/arrayfire/metadata.xml | 17 ++++++ 4 files changed, 188 insertions(+) diff --git a/licenses/ArrayFire b/licenses/ArrayFire new file mode 100644 index 0000000..3aae2e6 --- /dev/null +++ b/licenses/ArrayFire @@ -0,0 +1,27 @@ +Copyright (c) 2014, ArrayFire +All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met: + +* Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + +* Redistributions in binary form must reproduce the above copyright notice, this + list of conditions and the following disclaimer in the documentation and/or + other materials provided with the distribution. + +* Neither the name of the ArrayFire nor the names of its + contributors may be used to endorse or promote products derived from + this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR +ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/sci-libs/arrayfire/arrayfire-9999.ebuild b/sci-libs/arrayfire/arrayfire-9999.ebuild new file mode 100644 index 0000000..06295ca --- /dev/null +++ b/sci-libs/arrayfire/arrayfire-9999.ebuild @@ -0,0 +1,96 @@ +# Copyright 1999-2015 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: $ + +EAPI=5 + +inherit cmake-utils eutils git-r3 toolchain-funcs + +DESCRIPTION="A general purpose GPU library." +HOMEPAGE="http://www.arrayfire.com/" +EGIT_REPO_URI="https://github.com/arrayfire/arrayfire.git" +KEYWORDS="~amd64" + +LICENSE="ArrayFire" +SLOT="0" +IUSE="+examples +cpu cuda" + +RDEPEND=" + >=sys-devel/gcc-4.7.3-r1 + virtual/blas + virtual/cblas + cuda? ( >=dev-util/nvidia-cuda-toolkit-6.0 ) + sci-libs/fftw:3.0" +DEPEND="${RDEPEND}" + +# We need write acccess /dev/nvidiactl, /dev/nvidia0 and /dev/nvidia-uvm and the portage +# user is (usually) not in the video group +if use cuda; then + RESTRICT="userpriv" +fi + +S="${WORKDIR}/${P}" + +QA_PREBUILT="/usr/share/arrayfire/examples/helloworld_cpu + /usr/share/arrayfire/examples/pi_cpu + /usr/share/arrayfire/examples/vectorize_cpu + /usr/share/arrayfire/examples/helloworld_cuda + /usr/share/arrayfire/examples/pi_cuda + /usr/share/arrayfire/examples/vectorize_cuda" + +src_unpack() { + git-r3_src_unpack +} + +src_prepare() { + if use cpu; then + epatch "${FILESDIR}/FindCBLAS.patch" + fi + cmake-utils_src_prepare +} + +src_configure() { + if use cuda; then + addwrite /dev/nvidiactl + addwrite /dev/nvidia0 + addwrite /dev/nvidia-uvm + fi + + local mycmakeargs=" + -DCMAKE_BUILD_TYPE=Release + $(cmake-utils_use_build cpu CPU) + $(cmake-utils_use_build cuda CUDA) + -DBUILD_OPENCL=OFF + $(cmake-utils_use_build examples EXAMPLES) + -DBUILD_TEST=OFF + " + + BUILD_DIR="${S}/build" cmake-utils_src_configure +} + +src_compile() { + BUILD_DIR="${S}/build" cmake-utils_src_compile +} + +src_install() { + cmake-utils_src_install + + exeinto /usr/bin + doexe "build/bin2cpp" + + if use examples; then + ebegin "Installing examples" + exeinto /usr/share/arrayfire/examples/ + if use cpu; then + doexe "build/examples/helloworld_cpu" + doexe "build/examples/pi_cpu" + doexe "build/examples/vectorize_cpu" + fi + if use cuda; then + doexe "build/examples/helloworld_cuda" + doexe "build/examples/pi_cuda" + doexe "build/examples/vectorize_cuda" + fi + eend + fi +} \ No newline at end of file diff --git a/sci-libs/arrayfire/files/FindCBLAS.patch b/sci-libs/arrayfire/files/FindCBLAS.patch new file mode 100644 index 0000000..16c6197 --- /dev/null +++ b/sci-libs/arrayfire/files/FindCBLAS.patch @@ -0,0 +1,48 @@ +--- b/CMakeModules/FindCBLAS.cmake 2015-01-09 14:00:29.328281398 +0100 ++++ a/CMakeModules/FindCBLAS.cmake 2015-01-09 14:02:52.549276153 +0100 +@@ -1,3 +1,9 @@ ++# ++# Version modified for Gentoo Linux ++# If a valid PkgConfig configuration for cblas is found, this overrides and cancels ++# all further checks. ++# ++ + # Using FindCBLAS.cmake from the following repo + # https://github.com/clementfarabet/THC/blob/master/COPYRIGHT.txt + +@@ -18,6 +24,29 @@ SET(CBLAS_LIBRARIES) + SET(CBLAS_INCLUDE_DIR) + SET(CBLAS_INCLUDE_FILE) + ++ ++# ++# first, try PkgConfig ++# ++find_package(PkgConfig REQUIRED) ++pkg_check_modules(PC_CBLAS cblas) ++if(PC_CBLAS_FOUND) ++ foreach(PC_LIB ${PC_CBLAS_LIBRARIES}) ++ find_library(${PC_LIB}_LIBRARY NAMES ${PC_LIB} HINTS ${PC_CBLAS_LIBRARY_DIRS} ) ++ if (NOT ${PC_LIB}_LIBRARY) ++ message(FATAL_ERROR "Something is wrong in your pkg-config file - lib ${PC_LIB} not found in ${PC_CBLAS_LIBRARY_DIRS}") ++ endif (NOT ${PC_LIB}_LIBRARY) ++ list(APPEND CBLAS_LIBRARIES ${${PC_LIB}_LIBRARY}) ++ endforeach(PC_LIB) ++ find_package_handle_standard_args(CBLAS DEFAULT_MSG CBLAS_LIBRARIES) ++ mark_as_advanced(CBLAS_LIBRARIES) ++else(PC_CBLAS_FOUND) ++message(STATUS "No PkgConfig configuration for CBLAS found; starting more extensive search.") ++ ++ ++ ++ ++ + # CBLAS in Intel mkl + FIND_PACKAGE(MKL) + IF (MKL_FOUND AND NOT CBLAS_LIBRARIES) +@@ -203,3 +232,5 @@ IF(NOT CBLAS_FIND_QUIETLY) + MESSAGE(STATUS "CBLAS library not found.") + ENDIF(CBLAS_FOUND) + ENDIF(NOT CBLAS_FIND_QUIETLY) ++ ++endif(PC_CBLAS_FOUND) diff --git a/sci-libs/arrayfire/metadata.xml b/sci-libs/arrayfire/metadata.xml new file mode 100644 index 0000000..cf929e4 --- /dev/null +++ b/sci-libs/arrayfire/metadata.xml @@ -0,0 +1,17 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd"> +<pkgmetadata> + <herd>sci</herd> + <maintainer> + <email>mar...@linux.sungazer.de</email> + <name>Marius Brehler</name> + </maintainer> + <use> + <flag name="cpu"> + Enable CPU Build. + </flag>flag> + <flag name="cuda"> + Enable CUDA Build. + </flag> + </use> +</pkgmetadata>