summaryrefslogtreecommitdiff
blob: 1fd79b9213eb9e62afcb165038230ce8ae725f68 (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
61
62
63
64
65
# Copyright 1999-2007 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/sci-mathematics/yacas/yacas-1.0.63.ebuild,v 1.5 2007/12/13 11:31:32 markusle Exp $

inherit autotools eutils flag-o-matic

IUSE="glut server"

DESCRIPTION="very powerful general purpose computer algebra system"
HOMEPAGE="http://yacas.sourceforge.net/"
SRC_URI="http://${PN}.sourceforge.net/backups/${P}.tar.gz"

SLOT="0"
LICENSE="GPL-2"
KEYWORDS="amd64 ~ppc ~x86"

DEPEND="virtual/libc
	>=sys-apps/sed-4
	dev-lang/perl
	glut? ( virtual/glut )
	www-client/lynx"

src_unpack() {
	unpack ${A}
	cd "${S}"

	if ! use glut; then
		sed -e "s:opengl::g" -i plugins/Makefile.am || \
			die "sed (opengl) failed"
		sed -e "s:\(^PLUGINDOCSCHAPTERS.*\)opengl.chapt\(.*\):\1 \2:" \
			-i manmake/Makefile.am || die 'sed (manmake) failed'
		sed -e "s:\*INCLUDE opengl.chapt::" \
			-i manmake/plugin-docs.chapt.txt \
			|| die "failed to fix plugin-doc.chapt"
	fi

	epatch "${FILESDIR}"/${P}-as-needed.patch
	eautoreconf
}

src_compile() {
	# Filter -Os due to reported issues with it in bug 126779.
	replace-flags -Os -O2

	local myconf="--with-numlib=native"

	if use server; then
		myconf="${myconf} --enable-server"
	fi

	econf ${myconf} || die "./configure failed"
	emake || die
}

src_install() {
	make DESTDIR="${D}" install-strip || die

	dodoc AUTHORS INSTALL NEWS README TODO
	mv "${D}"/usr/share/${PN}/documentation "${D}"/usr/share/doc/${PF}/html
	rmdir "${D}"/usr/include/
	rm "${D}"/usr/share/${PN}/include/win32*
	sed -e "s|\":FindFile(\"documentation/ref.html\"):\"|localhost/usr/share/doc/${PF}/html/ref.html|" \
		-e "s|\":FindFile(\"documentation/books.html\"):\"|localhost/usr/share/doc/${PF}/html/books.html|" \
		-i "${D}"/usr/share/${PN}/yacasinit.ys || die
}