FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Gentoo > Gentoo Development

 
 
LinkBack Thread Tools
 
Old 08-26-2012, 11:43 PM
Alexandre Rostovtsev
 
Default new vala.eclass

On Sun, 2012-08-26 at 15:45 -0700, Zac Medico wrote:
> Note that pkg_setup is called for binary packages too, which means that
> DEPEND may not necessarily be installed. In EAPI 4 you can check the
> MERGE_TYPE variable which can have a value of binary, source, orbuildonly.

The variables that vala_pkg_setup sets are needed only at build time.
 
Old 08-27-2012, 01:20 AM
Alexandre Rostovtsev
 
Default new vala.eclass

Second update, incorporating suggestions by Ulrich and Duncan.

# Copyright 1999-2012 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $

# @ECLASS: vala.eclass
# @MAINTAINER:
# gnome@gentoo.org
# @AUTHOR:
# Alexandre Rostovtsev <tetromino@gentoo.org>
# @BLURB: Sets up the environment for using a specific version of vala.
# @DESCRIPTION:
# This eclass sets up commonly used environment variables for using a specific
# version of dev-lang/vala to configure and build a package. It is needed for
# packages whose build systems assume the existence of certain unversioned vala
# executables, pkgconfig files, etc., which Gentoo does not provide.
#
# This eclass provides one phase function: pkg_setup.

inherit multilib

EXPORT_FUNCTIONS pkg_setup

# @ECLASS-VARIABLE: VALA_API_VERSION
# @DEFAULT_UNSET
# @DESCRIPTION:
# Vala API version (e.g. 0.16).

# @FUNCTION: vala_pkg_setup
# @DESCRIPTION:
# Sets up the environment variables and pkgconfig files for $VALA_API_VERSION.
vala_pkg_setup() {
local p d valafoo

[[ ${VALA_API_VERSION} ]] || die "VALA_API_VERSION not set"

valafoo=$(type -P valac-${VALA_API_VERSION})
[[ ${valafoo} ]] && export VALAC="${valafoo}"

valafoo=$(type -P vala-${VALA_API_VERSION})
[[ ${valafoo} ]] && export VALA="${valafoo}"

valafoo=$(type -P vala-gen-introspect-${VALA_API_VERSION})
[[ ${valafoo} ]] && export VALA_GEN_INTROSPECT="${valafoo}"

valafoo=$(type -P vapigen-${VALA_API_VERSION})
[[ ${valafoo} ]] && export VAPIGEN="${valafoo}"

valafoo="${EPREFIX}/usr/share/vala/Makefile.vapigen"
[[ -e ${valafoo} ]] && export VAPIGEN_MAKEFILE="${valafoo}"

export VAPIGEN_VAPIDIR="${EPREFIX}/usr/share/vala/vapi"

mkdir -p "${T}/pkgconfig" || die "mkdir failed"
for p in libvala vapigen; do
for d in "${EPREFIX}/usr/$(get_libdir)/pkgconfig" "${EPREFIX}/usr/share/pkgconfig"; do
if [[ -e ${d}/${p}-${VALA_API_VERSION}.pc ]]; then
ln -s "${d}/${p}-${VALA_API_VERSION}.pc" "${T}/pkgconfig/${p}.pc" || die "ln failed"
break
fi
done
done
: ${PKG_CONFIG_PATH:="${EPREFIX}/usr/$(get_libdir)/pkgconfig:${EPREFIX}/usr/share/pkgconfig"}
export PKG_CONFIG_PATH="${T}/pkgconfig:${PKG_CONFIG_PATH}"
}
 
Old 08-27-2012, 02:45 AM
Alexis Ballier
 
Default new vala.eclass

On Sun, 26 Aug 2012 19:43:32 -0400
Alexandre Rostovtsev <tetromino@gentoo.org> wrote:

> On Sun, 2012-08-26 at 15:45 -0700, Zac Medico wrote:
> > Note that pkg_setup is called for binary packages too, which means
> > that DEPEND may not necessarily be installed. In EAPI 4 you can
> > check the MERGE_TYPE variable which can have a value of binary,
> > source, orbuildonly.
>
> The variables that vala_pkg_setup sets are needed only at build time.

so it should be vala_src_prepare / unpack instead ?
definitely not anything pkg_* imho
 
Old 08-27-2012, 04:45 AM
Alexandre Rostovtsev
 
Default new vala.eclass

On Sun, 2012-08-26 at 22:45 -0400, Alexis Ballier wrote:
> On Sun, 26 Aug 2012 19:43:32 -0400
> Alexandre Rostovtsev <tetromino@gentoo.org> wrote:
> > The variables that vala_pkg_setup sets are needed only at build time.
>
> so it should be vala_src_prepare / unpack instead ?
> definitely not anything pkg_* imho

IMHO src_prepare or src_unpack would be misleading because the function
does not modify the package's source and has nothing to do with
unpacking. It's not an unusual idiom to set various environment
variables in pkg_setup even if those variables are relevant only at
build time; gnome-extra/zeitgeist and xfce4-vala/xfce4-vala are typical
examples that already export VALAC in their pkg_setup().
 
Old 08-27-2012, 12:19 PM
Alexis Ballier
 
Default new vala.eclass

On Mon, 27 Aug 2012 00:45:45 -0400
Alexandre Rostovtsev <tetromino@gentoo.org> wrote:

> On Sun, 2012-08-26 at 22:45 -0400, Alexis Ballier wrote:
> > On Sun, 26 Aug 2012 19:43:32 -0400
> > Alexandre Rostovtsev <tetromino@gentoo.org> wrote:
> > > The variables that vala_pkg_setup sets are needed only at build
> > > time.
> >
> > so it should be vala_src_prepare / unpack instead ?
> > definitely not anything pkg_* imho
>
> IMHO src_prepare or src_unpack would be misleading because the
> function does not modify the package's source and has nothing to do
> with unpacking.

it creates files as far as i understood the code;
the point of vala.eclass is to prepare the environment for building
the package, right ?

you can probably get a valid point for a src_setup phase in a
future eapi, but so far with current eapi, src_prepare seems the best
choice

> It's not an unusual idiom to set various environment
> variables in pkg_setup even if those variables are relevant only at
> build time; gnome-extra/zeitgeist and xfce4-vala/xfce4-vala are
> typical examples that already export VALAC in their pkg_setup().

lots of bad examples does not make it good
this is just wasted cpu cycles for binpkgs, moreover these two examples
only set a variable and call type -P; the eclass does set a couple
more of variables and writes to $T


anyway its your call, but given that the eclass is only useful for
building it seems bad practices to put its code in a pkg_ phase.
 
Old 08-27-2012, 01:21 PM
Alexandre Rostovtsev
 
Default new vala.eclass

Third update; Alexis made a convincing argument that vala_pkg_setup
should be changed to vala_src_prepare.

# Copyright 1999-2012 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $

# @ECLASS: vala.eclass
# @MAINTAINER:
# gnome@gentoo.org
# @AUTHOR:
# Alexandre Rostovtsev <tetromino@gentoo.org>
# @BLURB: Sets up the environment for using a specific version of vala.
# @DESCRIPTION:
# This eclass sets up commonly used environment variables for using a specific
# version of dev-lang/vala to configure and build a package. It is needed for
# packages whose build systems assume the existence of certain unversioned vala
# executables, pkgconfig files, etc., which Gentoo does not provide.
#
# This eclass provides one phase function: src_prepare.

inherit multilib

case "${EAPI:-0}" in
0|1)
;;
*)
EXPORT_FUNCTIONS src_prepare
;;
esac

# @ECLASS-VARIABLE: VALA_API_VERSION
# @DEFAULT_UNSET
# @DESCRIPTION:
# Vala API version (e.g. 0.16).

# @FUNCTION: vala_src_prepare
# @DESCRIPTION:
# Sets up the environment variables and pkgconfig files for $VALA_API_VERSION.
vala_src_prepare() {
local p d valafoo

[[ ${VALA_API_VERSION} ]] || die "VALA_API_VERSION not set"

valafoo=$(type -P valac-${VALA_API_VERSION})
[[ ${valafoo} ]] && export VALAC="${valafoo}"

valafoo=$(type -P vala-${VALA_API_VERSION})
[[ ${valafoo} ]] && export VALA="${valafoo}"

valafoo=$(type -P vala-gen-introspect-${VALA_API_VERSION})
[[ ${valafoo} ]] && export VALA_GEN_INTROSPECT="${valafoo}"

valafoo=$(type -P vapigen-${VALA_API_VERSION})
[[ ${valafoo} ]] && export VAPIGEN="${valafoo}"

valafoo="${EPREFIX}/usr/share/vala/Makefile.vapigen"
[[ -e ${valafoo} ]] && export VAPIGEN_MAKEFILE="${valafoo}"

export VAPIGEN_VAPIDIR="${EPREFIX}/usr/share/vala/vapi"

mkdir -p "${T}/pkgconfig" || die "mkdir failed"
for p in libvala vapigen; do
for d in "${EPREFIX}/usr/$(get_libdir)/pkgconfig" "${EPREFIX}/usr/share/pkgconfig"; do
if [[ -e ${d}/${p}-${VALA_API_VERSION}.pc ]]; then
ln -s "${d}/${p}-${VALA_API_VERSION}.pc" "${T}/pkgconfig/${p}.pc" || die "ln failed"
break
fi
done
done
: ${PKG_CONFIG_PATH:="${EPREFIX}/usr/$(get_libdir)/pkgconfig:${EPREFIX}/usr/share/pkgconfig"}
export PKG_CONFIG_PATH="${T}/pkgconfig:${PKG_CONFIG_PATH}"
}
 
Old 09-10-2012, 02:09 AM
Alexandre Rostovtsev
 
Default new vala.eclass

Revised proposal with suggestions from Nirbheek. VALA_API_VERSION has
been split into max and min to make it easier for packages to depend on
a range of vala slots.

# Copyright 1999-2012 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $

# @ECLASS: vala.eclass
# @MAINTAINER:
# gnome@gentoo.org
# @AUTHOR:
# Alexandre Rostovtsev <tetromino@gentoo.org>
# @BLURB: Sets up the environment for using a specific version of vala.
# @DESCRIPTION:
# This eclass sets up commonly used environment variables for using a specific
# version of dev-lang/vala to configure and build a package. It is needed for
# packages whose build systems assume the existence of certain unversioned vala
# executables, pkgconfig files, etc., which Gentoo does not provide.
#
# This eclass provides one phase function: src_prepare.

inherit multilib

case "${EAPI:-0}" in
0) die "EAPI=0 is not supported" ;;
1) ;;
*) EXPORT_FUNCTIONS src_prepare ;;
esac

# @ECLASS-VARIABLE: VALA_MIN_API_VERSION
# @DEFAULT_UNSET
# @DESCRIPTION:
# Minimum vala API version (e.g. 0.16).
VALA_MIN_API_VERSION=${VALA_MIN_API_VERSION:-0.10}

# @ECLASS-VARIABLE: VALA_MAX_API_VERSION
# @DEFAULT_UNSET
# @DESCRIPTION:
# Maximum vala API version (e.g. 0.18).
VALA_MAX_API_VERSION=${VALA_MAX_API_VERSION:-0.18}

# @ECLASS-VARIABLE: VALA_USE_DEPEND
# @DEFAULT_UNSET
# @DESCRIPTION:
# USE dependencies that vala must be built with (e.g. vapigen).

# @FUNCTION: vala_api_versions
# @DESCRIPTION:
# Outputs a list of vala API versions from VALA_MAX_API_VERSION down to
# VALA_MIN_API_VERSION.
vala_api_versions() {
eval "echo 0.{${VALA_MAX_API_VERSION#0.}..${VALA_MIN_API_VERS ION#0.}..2}"
}

# @FUNCTION: vala_depend
# @DESCRIPTION:
# Outputs a ||-dependency string on vala from VALA_MAX_API_VERSION down to
# VALA_MIN_API_VERSION
vala_depend() {
local u v versions=$(vala_api_versions)
[[ ${VALA_USE_DEPEND} ]] && u="[${VALA_USE_DEPEND}]"

echo -n "|| ("
for v in ${versions}; do
echo -n " dev-lang/vala:${v}${u}"
done
echo " )"
}

# @FUNCTION: vala_best_api_version
# @DESCRIPTION:
# Returns the highest installed vala API version satisfying
# VALA_MAX_API_VERSION, VALA_MIN_API_VERSION, and VALA_USE_DEPEND.
vala_best_api_version() {
local u v
[[ ${VALA_USE_DEPEND} ]] && u="[${VALA_USE_DEPEND}]"
for v in $(vala_api_versions); do
has_version "dev-lang/vala:${v}${u}" && echo "${v}" && return
done
}

# @FUNCTION: vala_src_prepare
# @USAGE: [--vala-api-version api_version]
# @DESCRIPTION:
# Sets up the environment variables and pkgconfig files for the
# specified API version, or, if no version is specified, for the
# highest installed vala API version satisfying
# VALA_MIN_API_VERSION, VALA_MIN_API_VERSION, and VALA_USE_DEPEND.
vala_src_prepare() {
local p d valafoo version

if [[ $1 = "--vala-api-version" ]]; then
version=$2
[[ ${version} ]] || die "'--vala-api-version' option requires API version parameter."
else
version=$(vala_best_api_version)
[[ ${version} ]] || die "No installed vala in $(vala_depend)"
fi

export VALAC=$(type -P valac-${version})

valafoo=$(type -P vala-gen-introspect-${VALA_API_VERSION})
[[ ${valafoo} ]] && export VALA_GEN_INTROSPECT=$(type -P vala-gen-introspect-${version})

valafoo=$(type -P vapigen-${VALA_API_VERSION})
[[ ${valafoo} ]] && export VAPIGEN="${valafoo}"

valafoo="${EPREFIX}/usr/share/vala/Makefile.vapigen"
[[ -e ${valafoo} ]] && export VAPIGEN_MAKEFILE="${valafoo}"

export VAPIGEN_VAPIDIR="${EPREFIX}/usr/share/vala/vapi"

mkdir -p "${T}/pkgconfig" || die "mkdir failed"
for p in libvala vapigen; do
for d in "${EPREFIX}/usr/$(get_libdir)/pkgconfig" "${EPREFIX}/usr/share/pkgconfig"; do
if [[ -e ${d}/${p}-${VALA_API_VERSION}.pc ]]; then
ln -s "${d}/${p}-${VALA_API_VERSION}.pc" "${T}/pkgconfig/${p}.pc" || die "ln failed"
break
fi
done
done
: ${PKG_CONFIG_PATH:="${EPREFIX}/usr/$(get_libdir)/pkgconfig:${EPREFIX}/usr/share/pkgconfig"}
export PKG_CONFIG_PATH="${T}/pkgconfig:${PKG_CONFIG_PATH}"
}
 
Old 09-12-2012, 08:24 PM
Alexandre Rostovtsev
 
Default new vala.eclass

On Sun, 2012-09-09 at 22:09 -0400, Alexandre Rostovtsev wrote:
> Revised proposal with suggestions from Nirbheek. VALA_API_VERSION has
> been split into max and min to make it easier for packages to depend on
> a range of vala slots.
>
> # Copyright 1999-2012 Gentoo Foundation
> # Distributed under the terms of the GNU General Public License v2
> # $Header: $
>
> # @ECLASS: vala.eclass
> # @MAINTAINER:
> # gnome@gentoo.org
> # @AUTHOR:
> # Alexandre Rostovtsev <tetromino@gentoo.org>
> # @BLURB: Sets up the environment for using a specific version of vala.
> # @DESCRIPTION:
> # This eclass sets up commonly used environment variables for using a specific
> # version of dev-lang/vala to configure and build a package. It is needed for
> # packages whose build systems assume the existence of certain unversioned vala
> # executables, pkgconfig files, etc., which Gentoo does not provide.
> #
> # This eclass provides one phase function: src_prepare.
>
> inherit multilib
>
> case "${EAPI:-0}" in
> 0) die "EAPI=0 is not supported" ;;
> 1) ;;
> *) EXPORT_FUNCTIONS src_prepare ;;
> esac
>
> # @ECLASS-VARIABLE: VALA_MIN_API_VERSION
> # @DEFAULT_UNSET
> # @DESCRIPTION:
> # Minimum vala API version (e.g. 0.16).
> VALA_MIN_API_VERSION=${VALA_MIN_API_VERSION:-0.10}
>
> # @ECLASS-VARIABLE: VALA_MAX_API_VERSION
> # @DEFAULT_UNSET
> # @DESCRIPTION:
> # Maximum vala API version (e.g. 0.18).
> VALA_MAX_API_VERSION=${VALA_MAX_API_VERSION:-0.18}
>
> # @ECLASS-VARIABLE: VALA_USE_DEPEND
> # @DEFAULT_UNSET
> # @DESCRIPTION:
> # USE dependencies that vala must be built with (e.g. vapigen).
>
> # @FUNCTION: vala_api_versions
> # @DESCRIPTION:
> # Outputs a list of vala API versions from VALA_MAX_API_VERSION down to
> # VALA_MIN_API_VERSION.
> vala_api_versions() {
> eval "echo 0.{${VALA_MAX_API_VERSION#0.}..${VALA_MIN_API_VERS ION#0.}..2}"
> }
>
> # @FUNCTION: vala_depend
> # @DESCRIPTION:
> # Outputs a ||-dependency string on vala from VALA_MAX_API_VERSION down to
> # VALA_MIN_API_VERSION
> vala_depend() {
> local u v versions=$(vala_api_versions)
> [[ ${VALA_USE_DEPEND} ]] && u="[${VALA_USE_DEPEND}]"
>
> echo -n "|| ("
> for v in ${versions}; do
> echo -n " dev-lang/vala:${v}${u}"
> done
> echo " )"
> }
>
> # @FUNCTION: vala_best_api_version
> # @DESCRIPTION:
> # Returns the highest installed vala API version satisfying
> # VALA_MAX_API_VERSION, VALA_MIN_API_VERSION, and VALA_USE_DEPEND.
> vala_best_api_version() {
> local u v
> [[ ${VALA_USE_DEPEND} ]] && u="[${VALA_USE_DEPEND}]"
> for v in $(vala_api_versions); do
> has_version "dev-lang/vala:${v}${u}" && echo "${v}" && return
> done
> }
>
> # @FUNCTION: vala_src_prepare
> # @USAGE: [--vala-api-version api_version]
> # @DESCRIPTION:
> # Sets up the environment variables and pkgconfig files for the
> # specified API version, or, if no version is specified, for the
> # highest installed vala API version satisfying
> # VALA_MIN_API_VERSION, VALA_MIN_API_VERSION, and VALA_USE_DEPEND.
> vala_src_prepare() {
> local p d valafoo version
>
> if [[ $1 = "--vala-api-version" ]]; then
> version=$2
> [[ ${version} ]] || die "'--vala-api-version' option requires API version parameter."
> else
> version=$(vala_best_api_version)
> [[ ${version} ]] || die "No installed vala in $(vala_depend)"
> fi
>
> export VALAC=$(type -P valac-${version})
>
> valafoo=$(type -P vala-gen-introspect-${VALA_API_VERSION})
> [[ ${valafoo} ]] && export VALA_GEN_INTROSPECT=$(type -P vala-gen-introspect-${version})
>
> valafoo=$(type -P vapigen-${VALA_API_VERSION})
> [[ ${valafoo} ]] && export VAPIGEN="${valafoo}"
>
> valafoo="${EPREFIX}/usr/share/vala/Makefile.vapigen"
> [[ -e ${valafoo} ]] && export VAPIGEN_MAKEFILE="${valafoo}"
>
> export VAPIGEN_VAPIDIR="${EPREFIX}/usr/share/vala/vapi"
>
> mkdir -p "${T}/pkgconfig" || die "mkdir failed"
> for p in libvala vapigen; do
> for d in "${EPREFIX}/usr/$(get_libdir)/pkgconfig" "${EPREFIX}/usr/share/pkgconfig"; do
> if [[ -e ${d}/${p}-${VALA_API_VERSION}.pc ]]; then
> ln -s "${d}/${p}-${VALA_API_VERSION}.pc" "${T}/pkgconfig/${p}.pc" || die "ln failed"
> break
> fi
> done
> done
> : ${PKG_CONFIG_PATH:="${EPREFIX}/usr/$(get_libdir)/pkgconfig:${EPREFIX}/usr/share/pkgconfig"}
> export PKG_CONFIG_PATH="${T}/pkgconfig:${PKG_CONFIG_PATH}"
> }

Now in portage.
 

Thread Tools




All times are GMT. The time now is 12:48 PM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org