summaryrefslogtreecommitdiff
blob: bcdd54fa5f08cdb849841104248b8e0a3f20533a (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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
# Copyright 1999-2004 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/app-sci/singular/singular-2.0.5-r4.ebuild,v 1.4 2004/06/24 22:17:49 agriffis Exp $

inherit eutils

MINPV=${PV//./-}
BPN=${PN/s/S}
NTLVERSION="5.3.1"
# attention: different versions are mixed. IntProg is older

DESCRIPTION="computer algebra system for polynomial computations"
SRC_URI="ftp://www.mathematik.uni-kl.de/pub/Math/Singular/src/${BPN}-doc-${MINPV}.tar.gz
		ftp://www.mathematik.uni-kl.de/pub/Math/Singular/src/${BPN}-emacs-${MINPV}.tar.gz
		ftp://www.mathematik.uni-kl.de/pub/Math/Singular/src/${BPN}-factory-${MINPV}.tar.gz
		ftp://www.mathematik.uni-kl.de/pub/Math/Singular/src/${BPN}-IntProg-2-0-4a.tar.gz
		ftp://www.mathematik.uni-kl.de/pub/Math/Singular/src/${BPN}-kernel-${MINPV}.tar.gz
		ftp://www.mathematik.uni-kl.de/pub/Math/Singular/src/${BPN}-libfac-${MINPV}.tar.gz
	ftp://www.mathematik.uni-kl.de/pub/Math/Singular/src/${BPN}-main-${MINPV}.tar.gz
	ftp://www.mathematik.uni-kl.de/pub/Math/Singular/src/${BPN}-MP-${MINPV}.tar.gz
	ftp://www.mathematik.uni-kl.de/pub/Math/Singular/src/${BPN}-NTL-${NTLVERSION}.tar.gz
	ftp://www.mathematik.uni-kl.de/pub/Math/Singular/src/${BPN}-NTL-generic.tar.gz
	ftp://www.mathematik.uni-kl.de/pub/Math/Singular/src/${BPN}-omalloc-${MINPV}.tar.gz
	ftp://www.mathematik.uni-kl.de/pub/Math/Singular/src/${BPN}-Tst-${MINPV}.tar.gz"
HOMEPAGE="http://www.singular.uni-kl.de/"

RDEPEND=">=dev-lang/perl-5.6
		>=dev-libs/gmp-4.1-r1"

IUSE="doc"

DEPEND="${RDEPEND}
		doc? ( sys-apps/texinfo
				virtual/tetex
				dev-lang/perl )"

SLOT="0"
LICENSE="singular"
KEYWORDS="x86 ppc"

S=${WORKDIR}

src_unpack () {
	unpack ${A}
	epatch  $FILESDIR/${P}-r3-gentoo.diff
	sed -e "s/PFSUBST/${PF}/" -i ${S}/Singular/feResource.cc || die "sed failed on feResource.cc"
}



src_compile() {
	local myconf="${myconf} --with-NTL --prefix=${D}/usr"
	econf ${myconf} || die "econf failed"
	make CFLAGS="${CFLAGS}" CXXFLAGS="${CXXFLAGS}" || die "make failed"
}

src_install () {
	local myarchprefix
	case ${ARCH} in
		x86)
			myarchprefix=ix86
			;;
		*)
			myarchprefix=${ARCH}
			;;
	esac
	cd ${WORKDIR}/omalloc
	einstall || die
	cd ${WORKDIR}/MP
	einstall || die
	cd ${WORKDIR}/ntl
	einstall || die
	cd ${WORKDIR}/factory
	einstall || die
	cd ${WORKDIR}/libfac
	einstall || die
	cd ${WORKDIR}/Singular
	einstall || die
	rm ${D}/usr/LIB
	dodir /usr/share/singular/LIB
	dodir /usr/share/singular/LIB/gftables
	insinto /usr/share/singular/LIB
	cd ${WORKDIR}/Singular/LIB
	doins *.lib*
	doins COPYING
	doins help.cnf
	insinto /usr/share/singular/LIB/gftables
	cd gftables
	doins *
	dodir /usr/bin
	dodir /usr/lib/singular

	use doc && 	( 	cd ${WORKDIR}/doc
					# fake ssh during doc creation
					cp ${FILESDIR}/fake_ssh ${T}/ssh
					chmod +x ${T}/ssh
					export PATH="${T}:${PATH}"
					export LC_ALL="C"
					make dvi
					dodoc *.dvi
					make ps
					dodoc *.ps
					local strange_error="Inappropriate ioctl for device"
					echo ${strange_error} > makeresult
					while grep -q "${strange_error}" makeresult
					do make 2>&1 info | tee makeresult
					done
					echo > singular.info "INFO-DIR-SECTION Math"
					echo >> singular.info "START-INFO-DIR-ENTRY"
					echo >> singular.info "* Singular: (singular).         A Computer Algebra System for Polynomial Computations"
					echo >> singular.info "END-INFO-DIR-ENTRY"
					cat singular.hlp >> singular.info
					doinfo singular.info
					make html
					strange_error="Bad file descriptor"
					echo ${strange_error} > makeresult
					while grep -q "${strange_error}" makeresult
					do make 2>&1 singular.idx | tee makeresult
					done
					insinto /usr/share/${PN}
					doins singular.idx singular.hlp
					dohtml -a htm,png,html,idx,css -r html/ html/*
					cd ${D}/usr
					dodir /usr/share/doc/${PF}
					mv doc/NTL share/doc/${PF}/
	)
	cd ${D}
	dosym /usr/bin/Singular-${MINPV} /usr/bin/Singular

	insinto /usr/lib/singular
	cd ${D}/usr/${myarchprefix}-Linux
	# don't do this before the docs are installed
	rm Singular
	dobin *Singular*
	doins *.so
	cd ${D}/usr
	rm -r ${myarchprefix}-Linux
}

pkg_postinst() {
	einfo "The authors ask you to register as a SINGULAR user."
	einfo "Please check the license file for details."
}