From 7607e49afda1b14e8fe76c224cb7606086b47401 Mon Sep 17 00:00:00 2001 From: Simon Que Date: Fri, 24 Feb 2012 11:32:55 -0800 Subject: [PATCH] eclass: add waf-utils.eclass Pulled from upstream Gentoo. BUG=chromium-os:25587 TEST=none Change-Id: I0afd6b7e2170bc6232123f971657283c918bbc50 Signed-off-by: Simon Que Reviewed-on: https://gerrit.chromium.org/gerrit/16736 Reviewed-by: Mike Frysinger --- .../portage-stable/eclass/waf-utils.eclass | 68 +++++++++++++++++++ 1 file changed, 68 insertions(+) create mode 100644 sdk_container/src/third_party/portage-stable/eclass/waf-utils.eclass diff --git a/sdk_container/src/third_party/portage-stable/eclass/waf-utils.eclass b/sdk_container/src/third_party/portage-stable/eclass/waf-utils.eclass new file mode 100644 index 0000000000..d5b77a59a1 --- /dev/null +++ b/sdk_container/src/third_party/portage-stable/eclass/waf-utils.eclass @@ -0,0 +1,68 @@ +# Copyright 1999-2011 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/eclass/waf-utils.eclass,v 1.7 2011/08/22 04:46:32 vapier Exp $ + +# @ECLASS: waf-utils.eclass +# @MAINTAINER: +# gnome@gentoo.org +# @AUTHOR: +# Original Author: Gilles Dartiguelongue +# Various improvements based on cmake-utils.eclass: Tomáš Chvátal +# Proper prefix support: Jonathan Callen +# @BLURB: common ebuild functions for waf-based packages +# @DESCRIPTION: +# The waf-utils eclass contains functions that make creating ebuild for +# waf-based packages much easier. +# Its main features are support of common portage default settings. + +inherit base eutils multilib toolchain-funcs + +case ${EAPI:-0} in + 4|3) EXPORT_FUNCTIONS src_configure src_compile src_install ;; + *) die "EAPI=${EAPI} is not supported" ;; +esac + +# @FUNCTION: waf-utils_src_configure +# @DESCRIPTION: +# General function for configuring with waf. +waf-utils_src_configure() { + debug-print-function ${FUNCNAME} "$@" + + # @ECLASS-VARIABLE: WAF_BINARY + # @DESCRIPTION: + # Eclass can use different waf executable. Usually it is located in "${S}/waf". + : ${WAF_BINARY:="${S}/waf"} + + tc-export AR CC CPP CXX RANLIB + echo "CCFLAGS=\"${CFLAGS}\" LINKFLAGS=\"${LDFLAGS}\" \"${WAF_BINARY}\" --prefix=${EPREFIX}/usr --libdir=${EPREFIX}/usr/$(get_libdir) $@ configure" + + CCFLAGS="${CFLAGS}" LINKFLAGS="${LDFLAGS}" "${WAF_BINARY}" \ + "--prefix=${EPREFIX}/usr" \ + "--libdir=${EPREFIX}/usr/$(get_libdir)" \ + "$@" \ + configure || die "configure failed" +} + +# @FUNCTION: waf-utils_src_compile +# @DESCRIPTION: +# General function for compiling with waf. +waf-utils_src_compile() { + debug-print-function ${FUNCNAME} "$@" + + local jobs=$(echo -j1 ${MAKEOPTS} | sed -r "s/.*(-j\s*|--jobs=)([0-9]+).*/--jobs=\2/" ) + echo "\"${WAF_BINARY}\" build ${jobs}" + "${WAF_BINARY}" ${jobs} || die "build failed" +} + +# @FUNCTION: waf-utils_src_install +# @DESCRIPTION: +# Function for installing the package. +waf-utils_src_install() { + debug-print-function ${FUNCNAME} "$@" + + echo "\"${WAF_BINARY}\" --destdir=\"${D}\" install" + "${WAF_BINARY}" --destdir="${D}" install || die "Make install failed" + + # Manual document installation + base_src_install_docs +}