From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) by finch.gentoo.org (Postfix) with ESMTP id 653671381F3 for ; Mon, 26 Nov 2012 22:04:07 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 44E9EE06C5; Mon, 26 Nov 2012 22:02:07 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 70CE2E06C2 for ; Mon, 26 Nov 2012 22:02:06 +0000 (UTC) Received: from hornbill.gentoo.org (hornbill.gentoo.org [94.100.119.163]) (using TLSv1 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 4A18133D9C3 for ; Mon, 26 Nov 2012 22:02:05 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by hornbill.gentoo.org (Postfix) with ESMTP id 98814E544D for ; Mon, 26 Nov 2012 22:02:02 +0000 (UTC) From: "Justin Lecher" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Justin Lecher" Message-ID: <1353940869.e5900921b54bbeea7c60ef7459c25f67602afc90.jlec@gentoo> Subject: [gentoo-commits] proj/sci:master commit in: eclass/ X-VCS-Repository: proj/sci X-VCS-Files: eclass/cuda.eclass X-VCS-Directories: eclass/ X-VCS-Committer: jlec X-VCS-Committer-Name: Justin Lecher X-VCS-Revision: e5900921b54bbeea7c60ef7459c25f67602afc90 X-VCS-Branch: master Date: Mon, 26 Nov 2012 22:02:02 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Archives-Salt: ec677141-96bc-4ea1-bb21-b5841cc7bc5d X-Archives-Hash: a6ce6570ebf3ad36e2d8b1ce0d577ab0 commit: e5900921b54bbeea7c60ef7459c25f67602afc90 Author: Justin Lecher gentoo org> AuthorDate: Fri Nov 23 17:20:55 2012 +0000 Commit: Justin Lecher gentoo org> CommitDate: Mon Nov 26 14:41:09 2012 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/sci.git;a=commit;h=e5900921 Add comments and streamline * Adding @.. things for eclass man page creation * Moving cuda_src_prepare functionality into cuda_sanitize and call it from there --- eclass/cuda.eclass | 58 ++++++++++++++++++++++++++++++++++++++------------- 1 files changed, 43 insertions(+), 15 deletions(-) diff --git a/eclass/cuda.eclass b/eclass/cuda.eclass index 3672d9e..bfb326e 100644 --- a/eclass/cuda.eclass +++ b/eclass/cuda.eclass @@ -1,4 +1,4 @@ -# Copyright 1999-2008 Gentoo Foundation +# Copyright 1999-20012 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Header: $ @@ -8,10 +8,20 @@ inherit toolchain-funcs versionator # @MAINTAINER: # Justin Lecher # @BLURB: Common functions for cuda packages +# @DESCRIPTION: +# This eclass contains functions to be used with cuda package. Currently its +# setting and/or sanitizing NVCCFLAGS, the compiler flags for nvcc. This is +# automatically done and exported in src_prepare() or manually by calling +# cuda_sanatize. +# +# Common usage: +# +# inherit cuda # @ECLASS-VARIABLE: NVCCFLAGS # DESCRIPTION: -# nvcc compiler flags (see nvcc --help) +# nvcc compiler flags (see nvcc --help), which should be used like +# CFLAGS for c compiler : ${NVCCFLAGS:=-O2} # @ECLASS-VARIABLE: CUDA_VERBOSE @@ -25,18 +35,22 @@ fi # @ECLASS-FUNCTION: cuda_gccdir # @DESCRIPTION: -# Helper for determination of the latest bindir supported by nvidia cuda toolkit. +# Helper for determination of the latest gcc bindir supported by +# then current nvidia cuda toolkit. # # Calling plain it returns simply the path, but you probably want to add \"-f\"" # to get the full flag to add to nvcc call. # -# cuda_gccdir-f +# Example: +# +# cuda_gccdir -f # -> --compiler-bindir="/usr/x86_64-pc-linux-gnu/gcc-bin/4.6.3" cuda_gccdir() { local _gcc_bindir _ver _args="" _flag _ret # Currently we only support the gnu compiler suite if [[ $(tc-getCXX) != *g++* ]]; then + ewarn "Currently we only support the gnu compiler suite" return 2 fi @@ -76,14 +90,18 @@ cuda_gccdir() { echo ${_ret} return 0 else - eerror "Only gcc version(s) ${_args} are supported," + eerror "Only gcc version(s) ${_args} are supported," eerror "of which none is installed" - die "Only gcc version(s) ${_args} are supported" - return 1 + die "Only gcc version(s) ${_args} are supported" + return 1 fi } -cuda_pkg_setup() { +# @ECLASS-FUNCTION: cuda_sanitize +# @DESCRIPTION: +# Correct NVCCFLAGS by adding the necessary reference to gcc bindir and +# passing CXXFLAGS to underlying compiler without disturbing nvcc. +cuda_sanitize() { # Tell nvcc where to find a compatible compiler NVCCFLAGS+=" $(cuda_gccdir -f)" @@ -93,16 +111,26 @@ cuda_pkg_setup() { export NVCCFLAGS } +# @ECLASS-FUNCTION: cuda_pkg_setup +# @DESCRIPTION: +# Sanitise NVCCFLAGS by default in pkg_setup +cuda_pkg_setup() { + cuda_sanitize +} + +# @ECLASS-FUNCTION: cuda_pkg_setup +# @DESCRIPTION: +# cuda_pkg_postinst() { local a a="$(version_sort $(cuda-config -s))"; a=($a) - if [[ $(tc-getCC) == *gcc* ]] && version_is_at_least "$(gcc-version)" ${a[1]}; then - ewarn "gcc >= 4.6 will not work with CUDA" - ewarn "Make sure you set an earlier version of gcc with gcc-config" - ewarn "or append --compiler-bindir= to the nvcc compiler flags" - ewarn "pointing to a gcc installation dir like" - ewarn "${EPREFIX}/usr/*pc-linux-gnu/gcc-bin/gcc4.6" - fi + if [[ $(tc-getCC) == *gcc* ]] && version_is_at_least "$(gcc-version)" ${a[1]}; then + ewarn "gcc >= ${a[1]} will not work with CUDA" + ewarn "Make sure you set an earlier version of gcc with gcc-config" + ewarn "or append --compiler-bindir= pointing to a gcc installation dir like" + ewarn "${EPREFIX}/usr/*pc-linux-gnu/gcc-bin/gcc${a[1]}" + ewarn "to the nvcc compiler flags" + fi } EXPORT_FUNCTIONS pkg_setup pkg_postinst