Gentoo Archives: gentoo-dev

From: Alexandre Rostovtsev <tetromino@g.o>
To: gentoo-dev@l.g.o
Subject: [gentoo-dev] [RFC] new vala.eclass
Date: Sat, 25 Aug 2012 16:10:40
Message-Id: 1345910966.9829.9.camel@rook
1 Here's a proposed new eclass to make it less painful to build vala
2 bindings in the new, vala-0.18.x, vapigen.m4-using era. See
3 https://bugzilla.gnome.org/show_bug.cgi?id=682202 for why messing around
4 with PKG_CONFIG_PATH is unfortunately needed for vapigen.m4-using
5 packages from gnome-3.6 such as librsvg-2.36.2, networkmanager-0.9.6.0,
6 libsecret-0.9.x, libgnome-keyring-3.6.x, accountsservice-0.6.24, etc.
7
8
9 # Copyright 1999-2012 Gentoo Foundation
10 # Distributed under the terms of the GNU General Public License v2
11 # $Header: $
12
13 # @ECLASS: vala.eclass
14 # @MAINTAINER:
15 # gnome@g.o
16 # @AUTHOR:
17 # Alexandre Rostovtsev <tetromino@g.o>
18 # @BLURB: Sets up the environment for using a specific version of vala.
19 # @DESCRIPTION:
20 # This eclass sets up commonly used environment variables for using a specific
21 # version of dev-lang/vala to configure and build a package. It is needed for
22 # packages whose build systems assume the existence of certain unversioned vala
23 # executables, pkgconfig files, etc., which Gentoo does not provide.
24 #
25 # This eclass provides one phase function: pkg_setup.
26
27 inherit multilib
28
29 case "${EAPI:-0}" in
30 0|1|2)
31 die "EAPI=${EAPI} is not supported"
32 ;;
33 *)
34 EXPORT_FUNCTIONS pkg_setup
35 ;;
36 esac
37
38 # @ECLASS-VARIABLE: VALA_API_VERSION
39 # @DEFAULT_UNSET
40 # @DESCRIPTION:
41 # Vala API version (e.g. 0.16).
42
43 # @FUNCTION: vala_pkg_setup
44 # @DESCRIPTION:
45 # Sets up the environment variables and pkgconfig files for $VALA_API_VERSION.
46 vala_pkg_setup() {
47 if [[ -z "${VALA_API_VERSION}" ]]; then
48 die "VALA_API_VERSION not set"
49 fi
50
51 export VALAC=$(type -P valac-${VALA_API_VERSION})
52 export VALA=$(type -P vala-${VALA_API_VERSION})
53 export VALA_GEN_INTROSPECT=$(type -P vala-gen-introspect-${VALA_API_VERSION})
54 export VAPIGEN="$(type -P vapigen-${VALA_API_VERSION})"
55 export VAPIGEN_MAKEFILE="${EPREFIX}/usr/share/vala-${VALA_API_VERSION}/Makefile.vapigen"
56 export VAPIGEN_VAPIDIR="${EPREFIX}/usr/share/vala/vapi"
57
58 if ! [[ -d "${T}/pkgconfig" ]]; then
59 mkdir "${T}/pkgconfig" || die "mkdir failed"
60 fi
61 local p
62 for p in libvala vapigen; do
63 local d
64 for d in "${EPREFIX}/usr/$(get_libdir)/pkgconfig" "${EPREFIX}/usr/share/pkgconfig"; do
65 if [[ -e "${d}/${p}-${VALA_API_VERSION}.pc" ]]; then
66 ln -s "${d}/${p}-${VALA_API_VERSION}.pc" "${T}/pkgconfig/${p}.pc" || die "ln failed"
67 break
68 fi
69 done
70 done
71 : ${PKG_CONFIG_PATH:="${EPREFIX}/usr/$(get_libdir)/pkgconfig:${EPREFIX}/usr/share/pkgconfig"}
72 export PKG_CONFIG_PATH="${T}/pkgconfig:${PKG_CONFIG_PATH}"
73 }

Replies

Subject Author
Re: [gentoo-dev] [RFC] new vala.eclass "Tomáš Chvátal" <tomas.chvatal@×××××.com>
Re: [gentoo-dev] [RFC] new vala.eclass Alexandre Rostovtsev <tetromino@g.o>
Re: [gentoo-dev] [RFC] new vala.eclass Alexandre Rostovtsev <tetromino@g.o>
Re: [gentoo-dev] [RFC] new vala.eclass Alexandre Rostovtsev <tetromino@g.o>
Re: [gentoo-dev] [RFC] new vala.eclass Alexandre Rostovtsev <tetromino@g.o>