Drop $Id$ per council decision in bug #611234.
[gentoo.git] / eclass / emboss-r2.eclass
1 # Copyright 1999-2017 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3
4 # @ECLASS: emboss-r2.eclass
5 # @MAINTAINER:
6 # sci-biology@gentoo.org
7 # jlec@gentoo.org
8 # ted.tanberry@gmail.com
9 # @AUTHOR:
10 # Original author: Author Olivier Fisette <ofisette@gmail.com>
11 # Next gen author: Justin Lecher <jlec@gentoo.org>
12 # Next gen author: Ted Tanberry <ted.tanberry@gmail.com>
13 # @BLURB: Use this to easy install EMBOSS and EMBASSY programs (EMBOSS add-ons).
14 # @DESCRIPTION:
15 # The inheriting ebuild must set at least EAPI=6 and provide EBO_DESCRIPTION before the inherit line.
16 # KEYWORDS should be set. Additionally "(R|P)DEPEND"encies and other standard
17 # ebuild variables can be extended (FOO+=" bar").
18 #
19 # Example:
20 #
21 # EAPI=6
22 #
23 # EBO_DESCRIPTION="applications from the CBS group"
24 #
25 # inherit emboss-r2
26
27 # @ECLASS-VARIABLE: EBO_DESCRIPTION
28 # @DEFAULT_UNSET
29 # @DESCRIPTION:
30 # Should be set. Completes the generic description of the embassy module as follows:
31 #
32 # EMBOSS integrated version of ${EBO_DESCRIPTION}, e.g.
33 #
34 # "EMBOSS integrated version of applications from the CBS group"
35 #
36 # Defaults to the upstream name of the module.
37
38 if [[ ! ${_EMBOSS_R2} ]]; then
39
40 case ${EAPI:-0} in
41         6) ;;
42         *) die "EAPI=${EAPI} is not supported" ;;
43 esac
44
45 inherit autotools flag-o-matic
46
47 EXPORT_FUNCTIONS src_prepare src_configure src_install
48
49 HOMEPAGE="http://emboss.sourceforge.net/"
50 LICENSE="LGPL-2 GPL-2"
51
52 SLOT="0"
53 IUSE="mysql pdf png postgres static-libs X"
54
55 RDEPEND="
56         dev-libs/expat
57         dev-libs/libpcre:3
58         sci-libs/plplot:=
59         sys-libs/zlib
60         mysql? ( virtual/mysql )
61         pdf? ( media-libs/libharu:= )
62         png? ( media-libs/gd:2=[png] )
63         postgres? ( dev-db/postgresql:= )
64         X? ( x11-libs/libXt )"
65
66 if [[ ${PN} == embassy-* ]]; then
67         EMBASSY_PACKAGE=yes
68         # The EMBASSY package name, retrieved from the inheriting ebuild's name
69         EN=${PN:8}
70         # The full name and version of the EMBASSY package (excluding the Gentoo
71         # revision number)
72         EF="${EN^^}-${PV}"
73
74         [[ ${EBO_DESCRIPTION} ]] || die "EBO_DESCRIPTION was not set before inheriting emboss-r2.eclass"
75
76         DESCRIPTION="EMBOSS integrated version of ${EBO_DESCRIPTION}"
77         SRC_URI="ftp://emboss.open-bio.org/pub/EMBOSS/${EF}.tar.gz -> embassy-${EN}-${PV}.tar.gz"
78         RDEPEND+=" >=sci-biology/emboss-6.6.0-r1[mysql=,pdf=,png=,postgres=,static-libs=,X=]"
79
80         S="${WORKDIR}/${EF}"
81 fi
82
83 DEPEND="${RDEPEND}"
84
85 # @ECLASS-VARIABLE: EBO_EAUTORECONF
86 # @DEFAULT_UNSET
87 # @DESCRIPTION:
88 # If set, run eautoreconf from autotools.eclass after applying patches
89 # in emboss-r2_src_prepare.
90
91 # @FUNCTION: emboss-r2_src_prepare
92 # @DESCRIPTION:
93 # Does the following things
94 #
95 #  1. Renames configure.in to configure.ac, if possible
96 #  2. Calls default_src_prepare (i.e.
97 #     applies Gentoo and user patches in EAPI>=6)
98 #  3. If EBO_EAUTORECONF is set, run eautoreconf
99 #
100
101 emboss-r2_src_prepare() {
102         if [[ -e configure.in ]]; then
103                 mv configure.{in,ac} || die
104         fi
105
106         default
107         [[ ${EBO_EAUTORECONF} ]] && eautoreconf
108 }
109
110 # @FUNCTION: emboss-r2_src_configure
111 # @DESCRIPTION:
112 # runs econf with following options.
113 #
114 #  --enable-shared
115 #  $(use_enable static-libs static)
116 #  $(use_with X x)
117 #  $(use_with png pngdriver)
118 #  $(use_with pdf hpdf)
119 #  $(use_with mysql mysql)
120 #  $(use_with postgres postgresql)
121 #  --enable-large
122 #  --without-java
123 #  --enable-systemlibs
124 #
125 #  can be appended to like econf, e.g.
126 #    emboss-r2_src_configure --disable-shared
127
128 emboss-r2_src_configure() {
129         local myconf=(
130                 --enable-shared
131                 $(use_enable static-libs static)
132                 $(use_with X x)
133                 $(use_with png pngdriver "${EPREFIX}/usr")
134                 $(use_with pdf hpdf "${EPREFIX}/usr")
135                 $(use_with mysql mysql "${EPREFIX}/usr/bin/mysql_config")
136                 $(use_with postgres postgresql "${EPREFIX}/usr/bin/pg_config")
137                 --enable-large
138                 --without-java
139                 --enable-systemlibs
140         )
141
142         [[ ${EMBASSY_PACKAGE} == yes ]] && \
143                 append-cppflags "-I${EPREFIX}/usr/include/emboss"
144
145         econf "${myconf[@]}" "$@"
146 }
147
148 # @FUNCTION: emboss-r2_src_install
149 # @DESCRIPTION:
150 # Installs the package into the staging area and removes
151 # extraneous .la files, if USE="-static-libs"
152
153 emboss-r2_src_install() {
154         default
155
156         # delete .la files
157         if ! use static-libs; then
158                 find "${D}" -name '*.la' -delete || die
159         fi
160 }
161
162 _EMBOSS_R2=1
163 fi