dev-util/qbs: version bump
[gentoo.git] / eclass / embassy.eclass
1 # Copyright 1999-2012 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3 # $Id$
4
5 # Author Olivier Fisette <ribosome@gentoo.org>
6
7 # This eclass is used to install EMBASSY programs (EMBOSS add-ons).
8
9 # The inheriting ebuild should provide a "DESCRIPTION", "KEYWORDS" and, if
10 # necessary, add "(R|P)DEPEND"encies. Additionnaly, the inheriting ebuild's
11 # name must begin by "embassy-". Also, before inheriting, the ebuild should
12 # specify what version of EMBOSS is required by setting EBOV.
13
14 inherit eutils multilib
15
16 # The EMBASSY package name, retrieved from the inheriting ebuild's name
17 EN=${PN:8}
18 # The full name and version of the EMBASSY package (excluding the Gentoo
19 # revision number)
20 EF="$(echo ${EN} | tr "[:lower:]" "[:upper:]")-${PV}"
21
22 HOMEPAGE="http://emboss.sourceforge.net/"
23 LICENSE="LGPL-2 GPL-2"
24 SRC_URI="ftp://emboss.open-bio.org/pub/EMBOSS/EMBOSS-${EBOV}.tar.gz
25         ftp://emboss.open-bio.org/pub/EMBOSS/${EF}.tar.gz"
26
27 SLOT="0"
28 IUSE="X png"
29
30 DEPEND="=sci-biology/emboss-${EBOV}*
31         !<sci-biology/emboss-${EBOV}
32         X? ( x11-libs/libX11 )
33         png? ( sys-libs/zlib
34                 media-libs/libpng
35                 >=media-libs/gd-1.8
36         )"
37
38 S=${WORKDIR}/EMBOSS-${EBOV}/embassy/${EF}
39
40 embassy_src_unpack() {
41         unpack ${A}
42         mkdir EMBOSS-${EBOV}/embassy
43         mv ${EF} EMBOSS-${EBOV}/embassy/
44         cp /usr/$(get_libdir)/libplplot.la EMBOSS-${EBOV}/plplot/
45         cp /usr/$(get_libdir)/libeplplot.la EMBOSS-${EBOV}/plplot/
46         cp /usr/$(get_libdir)/libajax.la EMBOSS-${EBOV}/ajax/
47         cp /usr/$(get_libdir)/libajaxg.la EMBOSS-${EBOV}/ajax/
48         cp /usr/$(get_libdir)/libnucleus.la EMBOSS-${EBOV}/nucleus/
49         if [ -e "${FILESDIR}"/${PF}.patch ]; then
50                 cd "${S}"
51                 epatch "${FILESDIR}"/${PF}.patch
52         fi
53 }
54
55 embassy_src_compile() {
56         local PREFIX="${ROOT}/usr"
57         local EXTRA_CONF
58         ! use X && EXTRA_CONF="${EXTRA_CONF} --without-x"
59         ! use png && EXTRA_CONF="${EXTRA_CONF} --without-pngdriver"
60         ./configure \
61                         "--bindir=${PREFIX}/bin" \
62                         "--sbindir=${PREFIX}/sbin" \
63                         "--libexecdir=${PREFIX}/libexec" \
64                         "--sysconfdir=${ROOT}/etc" \
65                         "--sharedstatedir=${ROOT}/var" \
66                         "--localstatedir=${ROOT}/var" \
67                         "--libdir=${PREFIX}/$(get_libdir)" \
68                         "--includedir=${PREFIX}/include" \
69                         "--datarootdir=${PREFIX}/share" \
70                         "--datadir=${PREFIX}/share" \
71                         "--infodir=${PREFIX}/share/info" \
72                         "--localedir=${PREFIX}/share/locale" \
73                         "--mandir=${PREFIX}/share/man" \
74                         ${EXTRA_CONF} || die
75         emake || die "Before reporting this error as a bug, please make sure you compiled
76         EMBOSS and the EMBASSY packages with the same \"USE\" flags. Failure to
77         do so may prevent the compilation of some EMBASSY packages, or cause
78         runtime problems with some EMBASSY programs. For example, if you
79         compile EMBOSS with \"png\" support and then try to build DOMAINATRIX
80         without \"png\" support, compilation will fail when linking the binaries."
81 }
82
83 embassy_src_install() {
84         emake DESTDIR="${D}" install || die "Install failed"
85         dodoc AUTHORS ChangeLog NEWS README
86         dodir /usr/share
87         mv "${D}"/usr/local/share/* "${D}"/usr/share/
88         rmdir "${D}"/usr/local/share
89         rmdir "${D}"/usr/local
90 }
91
92 EXPORT_FUNCTIONS src_unpack src_compile src_install