summaryrefslogtreecommitdiff
blob: 9c13f63e9e337a18e7730fde8290dc8971e26337 (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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
# Copyright 1999-2004 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/sci-mathematics/Macaulay2/Macaulay2-0.9.2.ebuild,v 1.1 2004/12/28 14:30:11 ribosome Exp $

inherit eutils flag-o-matic toolchain-funcs

IUSE=""

DESCRIPTION="research tool for commutative algebra and algebraic geometry"
SRC_URI="http://www.math.uiuc.edu/Macaulay2/ftp-site/${P}-src.tar.gz \
	ftp://www.mathematik.uni-kl.de/pub/Math/Singular/Factory/factory-1.3b.tar.gz \
	ftp://www.mathematik.uni-kl.de/pub/Math/Singular/Libfac/libfac-0.3.2.tar.gz"

HOMEPAGE="http://www.math.uiuc.edu/Macaulay2/"

SLOT="0"
LICENSE="GPL-2"
KEYWORDS="x86"

RDEPEND="sys-libs/gdbm
	dev-libs/gmp
	dev-libs/boehm-gc"

DEPEND="${RDEPEND}
	sys-apps/gawk
	dev-util/yacc"

src_compile() {
	if [ "$(gcc-version)" = "3.4" ]; then
		append-flags "-fno-unit-at-a-time" # gcc 3.4 bug #15114, phosphan
	fi
	cd ${WORKDIR}/factory
	epatch ${FILESDIR}/gentoo-factory-1.3b.diff
	./configure --disable-streamio --prefix=${WORKDIR} || die
	make || die
	make install || die

	cd ${WORKDIR}/libfac
	epatch ../Macaulay2-0.9.2/INSTALL.libfac-0.3.2-diffs
	./configure --prefix=${WORKDIR} || die
	make DEFS=-DHAVE_SINGULAR_ERROR || die
	make prefix=${WORKDIR} install || die

	cd ${WORKDIR}/include
	epatch ${FILESDIR}/gentoo-libfac-0.3.2.include.diff

	CXXFLAGS="${CXXFLAGS} -Wno-deprecated"
	filter-flags "-fomit-frame-pointer"

	cd ${WORKDIR}/Macaulay2-0.9.2
	epatch ${FILESDIR}/gentoo-Macaulay2-0.9.2.diff
	CPPFLAGS='-I/usr/include/gc -I${WORKDIR}/include' LDFLAGS=-L${WORKDIR}/lib \
	./configure --prefix=${D}/usr || die
	make || die
}

src_install () {
	cd ${WORKDIR}/Macaulay2-0.9.2
	einstall || die

	cp ${D}/usr/bin/M2-help tmp
	if has_version 'kde-base/kdebase' ; then
		einfo "Using konqueror as default help-browser!"
		sed "s:netscape:konqueror:g" < tmp > ${D}/usr/bin/M2-help
	elif has_version 'net-www/mozilla' ; then
		einfo "Using mozilla as default help-browser!"
		sed "s:netscape:mozilla:g" < tmp > ${D}/usr/bin/M2-help
	elif has_version 'net-www/mozilla-firefox' ; then
		einfo "Using mozilla-firefox as default help-browser!"
		sed "s:netscape:firefox:g" < tmp > ${D}/usr/bin/M2-help
	elif has_version 'net-www/epiphany' ; then
		einfo "Using epiphany as default help-browser!"
		sed "s:netscape:epiphany:g" < tmp > ${D}/usr/bin/M2-help
	else
		mv tmp ${D}/usr/bin/M2-help
	fi
	chmod a+x ${D}/usr/bin/M2-help

	einfo "To change the default help browser, please set the environment"
	einfo "variable WWBROWSER to the browser of your choice"

	rm ${D}/usr/libexec/*data*
}