summaryrefslogtreecommitdiff
blob: 3fea9b7dc76edb5d7bb52663fa63de4b4daf3cdb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
# Copyright 1999-2006 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/sci-electronics/gnucap/gnucap-20060708.ebuild,v 1.1 2006/07/17 21:50:30 calchan Exp $

MY_PV="${PV:0:4}-${PV:4:2}-${PV:6}"

DESCRIPTION="GNUCap is the GNU Circuit Analysis Package"
SRC_URI="http://geda.seul.org/dist/gnucap-${MY_PV}.tar.gz"
HOMEPAGE="http://www.geda.seul.org/tools/gnucap"

IUSE="doc examples readline"
SLOT="0"
LICENSE="GPL-2"
KEYWORDS="~amd64 ~ppc ~x86"

DEPEND="doc? ( app-text/tetex )
	readline? (
		sys-libs/readline
		sys-libs/libtermcap-compat )"
S="${WORKDIR}/${PN}-${MY_PV}"

src_unpack() {
	unpack ${A} || die "Failed to unpack!"
	cd ${S}

	# Don't let gnucap decide whether to use readline
	if ! use readline ; then
		sed -i \
			-e 's:LIBS="-lreadline $LIBS":LIBS="$LIBS":' \
			-e 's:#define HAVE_LIBREADLINE 1:#define HAVE_LIBREADLINE 0:' \
			configure || die "sed failed"
	fi

	# No need to install COPYING and INSTALL
	sed -i \
		-e 's: COPYING INSTALL::' \
		-e 's:COPYING history INSTALL:history:' \
		doc/Makefile.in || die "sed failed"

	if ! use doc ; then
		sed -i \
			-e 's:SUBDIRS = doc examples man:SUBDIRS = doc examples:' \
			Makefile.in || die "sed failed"
	fi

	if ! use examples ; then
		sed -i \
			-e 's:SUBDIRS = doc examples:SUBDIRS = doc:' \
			Makefile.in || die "sed failed"
	fi
}

src_compile() {
	econf || die "Configuration failed"
	emake || die "Compilation failed"
}

src_install () {
	make DESTDIR=${D} install || die "Installation failed"
}