Dnia 2015-02-21, o godz. 15:46:31
"Justin Lecher (jlec)" <j...@gentoo.org> napisał(a):

> # Copyright 1999-2015 Gentoo Foundation
> # Distributed under the terms of the GNU General Public License v2
> # $Header: $
> 
> # @ECLASS: emboss-r1.eclass
> # @MAINTAINER:
> # sci-biol...@gentoo.org
> # j...@gentoo.org
> # ted.tanbe...@gmail.com
> # @AUTHOR:
> # Original author: Author Olivier Fisette <ofise...@gmail.com>
> # Next gen author: Justin Lecher <j...@gentoo.org>
> # Next gen author: Ted Tanberry <ted.tanbe...@gmail.com>
> # @BLURB: Use this to easy install EMBOSS and EMBASSY programs (EMBOSS 
> add-ons).
> # @DESCRIPTION:
> # The inheriting ebuild must set at least EAPI=5 and provide EBO_DESCRIPTION 
> before the inherit line.
> # KEYWORDS should be set. Additionally "(R|P)DEPEND"encies and other standard
> # ebuild variables can be extended (FOO+=" bar").
> #
> # Example:
> #
> # EAPI="5"
> #
> # EBO_DESCRIPTION="applications from the CBS group"
> #
> # inherit emboss-r1
> 
> # @ECLASS-VARIABLE: EBO_DESCRIPTION
> # @DESCRIPTION:
> # Should be set. Completes the generic description of the embassy module as 
> follows:
> #
> # EMBOSS integrated version of ${EBO_DESCRIPTION},
> # e.g.
> # "EMBOSS integrated version of applications from the CBS group"
> #
> # Defaults to the upstream name of the module.
> 
> # @ECLASS-VARIABLE: EBO_EXTRA_ECONF
> # @DEFAULT_UNSET
> # @DESCRIPTION:
> # Extra config options passed to econf, similar to EXTRA_ECONF.

Similar as in how? That it must not be used in ebuilds but in make.conf?

> 
> case ${EAPI:-0} in
>       5) ;;
>       *) die "this eclass doesn't support < EAPI 5" ;;
> esac
> 
> if [[ -f "${FILESDIR}"/${P}_fix-build-system.patch ]]; then

This looks terribly hacky. I'm not convinced you can rely on test like
this working properly in all cases, and I'm pretty convinced it's
a terribly unpredictable form of an API.

>       AUTOTOOLS_AUTORECONF=1
> fi
> 
> inherit autotools-utils eutils flag-o-matic
> 
> HOMEPAGE="http://emboss.sourceforge.net/";
> LICENSE="LGPL-2 GPL-2"
> 
> SLOT="0"
> IUSE="mysql pdf png postgres static-libs X"
> 
> DEPEND="
>       dev-libs/expat
>       dev-libs/libpcre:3
>       sci-libs/plplot
>       sys-libs/zlib
>       mysql? ( virtual/mysql )
>       pdf? ( media-libs/libharu )
>       png? ( media-libs/gd[png] )
>       postgres? ( dev-db/postgresql:= )
>       X? ( x11-libs/libXt )"
> RDEPEND="${DEPEND}"
> 
> if [[ ${PN} == embassy-* ]]; then
>       EMBASSY_PACKAGE=yes
>       # The EMBASSY package name, retrieved from the inheriting ebuild's name
>       EN=${PN:8}
>       # The full name and version of the EMBASSY package (excluding the Gentoo
>       # revision number)
>       EF=$(echo ${EN} | tr "[:lower:]" "[:upper:]")-${PV}

I would prefer avoid calling external tools in global scope. But I think
we scheduled the new bash version for EAPI 6...

>       : ${EBO_DESCRIPTION:=${EN}}
>       DESCRIPTION="EMBOSS integrated version of ${EBO_DESCRIPTION}"
>       SRC_URI="ftp://emboss.open-bio.org/pub/EMBOSS/${EF}.tar.gz -> 
> embassy-${EN}-${PVR}.tar.gz"

Why PVR? Why not just ${EF}? :P

>       DEPEND+=" 
> >=sci-biology/emboss-6.6.0[mysql=,pdf=,png=,postgres=,static-libs=,X=]"
> 
>       S="${WORKDIR}"/${EF}
> fi
> 
> # @FUNCTION: emboss_src_prepare
> # @DESCRIPTION:
> # Does the following things
> #
> #  1. Patches with "${FILESDIR}"/${P}_fix-build-system.patch, if present,
> #     and eventually runs eautoreconf in autotools-utils
> #  2. Patches with "${FILESDIR}"/${PF}.patch, if present

Ugly API, I dare say. Prefer explicit.

> #  3. Applies ${PATCHES[@]} via autotools-utils.eclass
> #
> 
> emboss-r1_src_prepare() {
>       if [[ -f "${FILESDIR}"/${P}_fix-build-system.patch ]]; then
>               mv configure.{in,ac} || die
>               epatch "${FILESDIR}"/${P}_fix-build-system.patch
>       fi
> 
>       [[ -f "${FILESDIR}"/${PF}.patch ]] && epatch "${FILESDIR}"/${PF}.patch
> 
>       autotools-utils_src_prepare
> }
> 
> # @FUNCTION: emboss_src_configure
> # @DESCRIPTION:
> # runs econf with following options.
> #
> #  $(use_with X x)
> #  $(use_with png pngdriver)
> #  $(use_with pdf hpdf)
> #  $(use_with mysql mysql)
> #  $(use_with postgres postgresql)
> #  $(use_enable static-libs static)
> #  --enable-large
> #  --without-java
> #  --enable-systemlibs
> #  --docdir="${EPREFIX}/usr/share/doc/${PF}"
> #  ${EBO_EXTRA_ECONF}
> 
> emboss-r1_src_configure() {
>       local myeconfargs=(
>               $(use_with X x)
>               $(use_with png pngdriver "${EPREFIX}/usr")
>               $(use_with pdf hpdf "${EPREFIX}/usr")
>               $(use_with mysql mysql "${EPREFIX}/usr/bin/mysql_config")
>               $(use_with postgres postgresql "${EPREFIX}/usr/bin/pg_config")
>               --enable-large
>               --without-java
>               --enable-systemlibs
>               --docdir="${EPREFIX}/usr/share/doc/${PF}"

The eclass does --docdir.

>               ${EBO_EXTRA_ECONF}
>       )
> 
>       [[ ${EMBASSY_PACKAGE} == yes ]] && \
>               append-cppflags "-I${EPREFIX}/usr/include/emboss"
> 
>       autotools-utils_src_configure
> }
> 
> EXPORT_FUNCTIONS src_prepare src_configure

-- 
Best regards,
Michał Górny

Attachment: pgpxu1Hv04Kbs.pgp
Description: OpenPGP digital signature

Reply via email to