Re: [gentoo-dev] [RFC] 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: # gn...@gentoo.org # @AUTHOR: # Alexandre Rostovtsev tetrom...@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_VERSION#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.
Re: [gentoo-dev] [RFC] 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: # gn...@gentoo.org # @AUTHOR: # Alexandre Rostovtsev tetrom...@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_VERSION#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} }
Re: [gentoo-dev] [RFC] new vala.eclass
On Mon, 27 Aug 2012 00:45:45 -0400 Alexandre Rostovtsev tetrom...@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 tetrom...@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.
Re: [gentoo-dev] [RFC] 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: # gn...@gentoo.org # @AUTHOR: # Alexandre Rostovtsev tetrom...@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} }
Re: [gentoo-dev] [RFC] new vala.eclass
On Sat, 2012-08-25 at 23:45 +0200, Ulrich Mueller wrote: On Sat, 25 Aug 2012, Alexandre Rostovtsev wrote: export VALAC=$(type -P valac-${VALA_API_VERSION}) export VALA=$(type -P vala-${VALA_API_VERSION}) export VALA_GEN_INTROSPECT=$(type -P vala-gen-introspect-${VALA_API_VERSION}) export VAPIGEN=$(type -P vapigen-${VALA_API_VERSION}) Is it guaranteed that these commands are present at pkg_setup time? I am assuming that the ebuild writer has added the correct vala dependency to DEPEND. Maybe something like this: VALA_API_VERSION=0.16 DEPEND=vala? ( =dev-lang/vala-0.16.1:${VALA_API_VERSION}[vapigen] ) In which case, the vala commands that are pulled in via DEPEND will be (unless I am completely wrong about how pkg_config works) available during pkg_config. Commands that are not pulled in via DEPEND of course might not be available, in which case VALAC or VAPIGEN etc. would be set to the empty string by vala_pkg_config. For all vala-using build systems that I have seen, this should not break anything. However, for a cleaner and safer environment, I could do the following: local path path=$(type -P valac-${VALA_API_VERSION}) [[ -n ${path} ]] VALAC=${path} path=$(type -P vala-${VALA_API_VERSION}) [[ -n ${path} ]] VALA=${path} path=$(type -P vala-gen-introspect-${VALA_API_VERSION}) [[ -n ${path} ]] VALA_GEN_INTROSPECT=${path} path=$(type -P vapigen-${VALA_API_VERSION}) [[ -n ${path} ]] VAPIGEN=${path}
Re: [gentoo-dev] [RFC] new vala.eclass
On Sun, 2012-08-26 at 02:59 -0400, Alexandre Rostovtsev wrote: path=$(type -P valac-${VALA_API_VERSION}) [[ -n ${path} ]] VALAC=${path} path=$(type -P vala-${VALA_API_VERSION}) [[ -n ${path} ]] VALA=${path} path=$(type -P vala-gen-introspect-${VALA_API_VERSION}) [[ -n ${path} ]] VALA_GEN_INTROSPECT=${path} path=$(type -P vapigen-${VALA_API_VERSION}) [[ -n ${path} ]] VAPIGEN=${path} Sorry, meant path=$(type -P valac-${VALA_API_VERSION}) [[ -n ${path} ]] export VALAC=${path} path=$(type -P vala-${VALA_API_VERSION}) [[ -n ${path} ]] export VALA=${path} path=$(type -P vala-gen-introspect-${VALA_API_VERSION}) [[ -n ${path} ]] export VALA_GEN_INTROSPECT=${path} path=$(type -P vapigen-${VALA_API_VERSION}) [[ -n ${path} ]] export VAPIGEN=${path}
Re: [gentoo-dev] [RFC] new vala.eclass
On Sun, 2012-08-26 at 02:59 -0400, Alexandre Rostovtsev wrote: In which case, the vala commands that are pulled in via DEPEND will be (unless I am completely wrong about how pkg_config works) available during pkg_config. Commands that are not pulled in via DEPEND of course might not be available, in which case VALAC or VAPIGEN etc. would be set to the empty string by vala_pkg_config. s/pkg_config/pkg_setup/g
Re: [gentoo-dev] [RFC] new vala.eclass
On 08/25/2012 11:59 PM, Alexandre Rostovtsev wrote: On Sat, 2012-08-25 at 23:45 +0200, Ulrich Mueller wrote: On Sat, 25 Aug 2012, Alexandre Rostovtsev wrote: export VALAC=$(type -P valac-${VALA_API_VERSION}) export VALA=$(type -P vala-${VALA_API_VERSION}) export VALA_GEN_INTROSPECT=$(type -P vala-gen-introspect-${VALA_API_VERSION}) export VAPIGEN=$(type -P vapigen-${VALA_API_VERSION}) Is it guaranteed that these commands are present at pkg_setup time? I am assuming that the ebuild writer has added the correct vala dependency to DEPEND. Maybe something like this: 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. -- Thanks, Zac
Re: [gentoo-dev] [RFC] 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.
Re: [gentoo-dev] [RFC] 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: # gn...@gentoo.org # @AUTHOR: # Alexandre Rostovtsev tetrom...@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} }
Re: [gentoo-dev] [RFC] new vala.eclass
On Sun, 26 Aug 2012 19:43:32 -0400 Alexandre Rostovtsev tetrom...@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
Re: [gentoo-dev] [RFC] 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 tetrom...@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().
[gentoo-dev] [RFC] new vala.eclass
Here's a proposed new eclass to make it less painful to build vala bindings in the new, vala-0.18.x, vapigen.m4-using era. See https://bugzilla.gnome.org/show_bug.cgi?id=682202 for why messing around with PKG_CONFIG_PATH is unfortunately needed for vapigen.m4-using packages from gnome-3.6 such as librsvg-2.36.2, networkmanager-0.9.6.0, libsecret-0.9.x, libgnome-keyring-3.6.x, accountsservice-0.6.24, etc. # Copyright 1999-2012 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Header: $ # @ECLASS: vala.eclass # @MAINTAINER: # gn...@gentoo.org # @AUTHOR: # Alexandre Rostovtsev tetrom...@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 case ${EAPI:-0} in 0|1|2) die EAPI=${EAPI} is not supported ;; *) EXPORT_FUNCTIONS pkg_setup ;; esac # @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() { if [[ -z ${VALA_API_VERSION} ]]; then die VALA_API_VERSION not set fi export VALAC=$(type -P valac-${VALA_API_VERSION}) export VALA=$(type -P vala-${VALA_API_VERSION}) export VALA_GEN_INTROSPECT=$(type -P vala-gen-introspect-${VALA_API_VERSION}) export VAPIGEN=$(type -P vapigen-${VALA_API_VERSION}) export VAPIGEN_MAKEFILE=${EPREFIX}/usr/share/vala-${VALA_API_VERSION}/Makefile.vapigen export VAPIGEN_VAPIDIR=${EPREFIX}/usr/share/vala/vapi if ! [[ -d ${T}/pkgconfig ]]; then mkdir ${T}/pkgconfig || die mkdir failed fi local p for p in libvala vapigen; do local d 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} }
Re: [gentoo-dev] [RFC] new vala.eclass
2012/8/25 Alexandre Rostovtsev tetrom...@gentoo.org: Hi man, *snip* case ${EAPI:-0} in 0|1|2) die EAPI=${EAPI} is not supported ;; *) EXPORT_FUNCTIONS pkg_setup ;; esac Any reson for not supporting ALL known eapis? *snip* if [[ -z ${VALA_API_VERSION} ]]; then die VALA_API_VERSION not set fi You can use the instead of conditional as you have longer lines in the file anyway *snip* if ! [[ -d ${T}/pkgconfig ]]; then mkdir ${T}/pkgconfig || die mkdir failed fi Same as above *snip* local p You should put the var defs on the top, I know this aint ansi C but i found that we tend to loose the variable declarations in long run otherwise. Cheers Tom
Re: [gentoo-dev] [RFC] new vala.eclass
On 25/08/2012 10:25, Tomáš Chvátal wrote: if ! [[ -d ${T}/pkgconfig ]]; then mkdir ${T}/pkgconfig || die mkdir failed fi Same as above Even better use mkdir -p. -- Diego Elio Pettenò — Flameeyes flamee...@flameeyes.eu — http://blog.flameeyes.eu/
Re: [gentoo-dev] [RFC] new vala.eclass
Updated version, incorporating suggestions by Tomáš and Diego, and fixing VAPIGEN_MAKEFILE to work with dev-lang/vala-common. # Copyright 1999-2012 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Header: $ # @ECLASS: vala.eclass # @MAINTAINER: # gn...@gentoo.org # @AUTHOR: # Alexandre Rostovtsev tetrom...@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 [[ -n ${VALA_API_VERSION} ]] || die VALA_API_VERSION not set export VALAC=$(type -P valac-${VALA_API_VERSION}) export VALA=$(type -P vala-${VALA_API_VERSION}) export VALA_GEN_INTROSPECT=$(type -P vala-gen-introspect-${VALA_API_VERSION}) export VAPIGEN=$(type -P vapigen-${VALA_API_VERSION}) export VAPIGEN_MAKEFILE=${EPREFIX}/usr/share/vala/Makefile.vapigen 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} }
Re: [gentoo-dev] [RFC] new vala.eclass
On Sat, 25 Aug 2012, Alexandre Rostovtsev wrote: export VALAC=$(type -P valac-${VALA_API_VERSION}) export VALA=$(type -P vala-${VALA_API_VERSION}) export VALA_GEN_INTROSPECT=$(type -P vala-gen-introspect-${VALA_API_VERSION}) export VAPIGEN=$(type -P vapigen-${VALA_API_VERSION}) Is it guaranteed that these commands are present at pkg_setup time? Ulrich