--- /dev/null
+# 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*
+}
--- /dev/null
+diff -U 4 -H -d -r -N -- Macaulay2-0.9.2-org/Macaulay2/c/Makefile.in Macaulay2-0.9.2/Macaulay2/c/Makefile.in
+--- Macaulay2-0.9.2-org/Macaulay2/c/Makefile.in 2001-08-16 00:52:01.000000000 +0200
++++ Macaulay2-0.9.2/Macaulay2/c/Makefile.in 2004-04-27 21:00:55.529735512 +0200
+@@ -11,9 +11,9 @@
+ rm -f y.tab.h y.output
+ ############################################################
+ .PHONY : clean all install
+ YFLAGS := -vdlt
+-LOADLIBES += -lm -lgc
++LOADLIBES += -lm -lgc -ldl
+ CNAMES := scc1.c readfile.c error.c dictionary.c list.c cprint.c type.c chk.c compat.c
+ HFILES := $(CNAMES:.c=.h) scc.h grammar.h
+ OFILES := $(CNAMES:.c=.o) grammar.o
+ SRCFILES := $(HFILES) $(CNAMES) grammar.y
+diff -U 4 -H -d -r -N -- Macaulay2-0.9.2-org/Macaulay2/d/Makefile.in Macaulay2-0.9.2/Macaulay2/d/Makefile.in
+--- Macaulay2-0.9.2-org/Macaulay2/d/Makefile.in 2002-01-10 17:46:37.000000000 +0100
++++ Macaulay2-0.9.2/Macaulay2/d/Makefile.in 2004-04-27 21:20:55.014386128 +0200
+@@ -349,9 +349,9 @@
+ endif
+
+ ../libexec/Macaulay2$(EXE) : $(ALLOBJ) $(LIBRARYFILES)
+ rm -f $@
+- time $(PURIFYCMD) $(CC) $(LDFLAGS) $(ALLOBJ) $(LOADLIBES) $(LDLIBS) $(LINK_OUTPUT_OPTION)
++ $(PURIFYCMD) $(CC) $(LDFLAGS) $(ALLOBJ) $(LOADLIBES) -ldl -lpthread $(LDLIBS) $(LINK_OUTPUT_OPTION)
+ $(STRIPCMD) $@
+
+ t_main.o : types.h
+ t : t_main.o gmp.o stdio.o strings.o system.o varstrin.o nets.o scclib.o C.o t.o
+diff -U 4 -H -d -r -N -- Macaulay2-0.9.2-org/Macaulay2/e/x_factor.cpp Macaulay2-0.9.2/Macaulay2/e/x_factor.cpp
+--- Macaulay2-0.9.2-org/Macaulay2/e/x_factor.cpp 2001-08-08 03:15:34.000000000 +0200
++++ Macaulay2-0.9.2/Macaulay2/e/x_factor.cpp 2004-04-27 21:05:20.549446392 +0200
+@@ -3,9 +3,9 @@
+ //#if !defined(__MWERKS__)
+ #if 1
+ #include <assert.h>
+ #include <iostream.h>
+-#define divides ignore_this_symbol /* bits/stl_function.h contains a generic one, sigh, gcc 3.0 */
++//#define divides ignore_this_symbol /* bits/stl_function.h contains a generic one, sigh, gcc 3.0 */
+ #include "interp.hpp"
+ #undef divides
+ #include "matrix.hpp"
+ #include "z_mod_p.hpp"
+diff -U 4 -H -d -r -N -- Macaulay2-0.9.2-org/Macaulay2/m2/Makefile.in Macaulay2-0.9.2/Macaulay2/m2/Makefile.in
+--- Macaulay2-0.9.2-org/Macaulay2/m2/Makefile.in 2001-08-15 22:46:13.000000000 +0200
++++ Macaulay2-0.9.2/Macaulay2/m2/Makefile.in 2004-04-27 21:11:14.595623192 +0200
+@@ -102,9 +102,9 @@
+ phase1 :: ../$(DUMPDATAFILE)
+ ../$(DUMPDATAFILE) : $(DUMPEDM2FILES) ../libexec/Macaulay2
+ # phase 1: read *.m2 and dump data
+ rm -f ../$(DUMPDATAFILE)
+- time env M2HOME=.. ../libexec/Macaulay2 -q -silent -tty '-ephase=1' \
++ env M2HOME=.. ../libexec/Macaulay2 -q -silent -tty '-ephase=1' \
+ @srcdir@/setup.m2 @srcdir@/dumpdata.m2 '-edump()'
+ else
+ ARGS := -silent setup.m2
+ endif
+diff -U 4 -H -d -r -N -- Macaulay2-0.9.2-org/Macaulay2/test/Makefile.in Macaulay2-0.9.2/Macaulay2/test/Makefile.in
+--- Macaulay2-0.9.2-org/Macaulay2/test/Makefile.in 2001-08-15 22:46:13.000000000 +0200
++++ Macaulay2-0.9.2/Macaulay2/test/Makefile.in 2004-04-27 21:11:44.443085688 +0200
+@@ -41,9 +41,9 @@
+ endif
+
+ %.okay : %.m2
+ @ echo testing $<
+- @ ulimit -t 600; time env M2HOME=.. ../libexec/Macaulay2 $(ARGS) $< '-eexit(0)'
++ @ ulimit -t 600; env M2HOME=.. ../libexec/Macaulay2 $(ARGS) $< '-eexit(0)'
+ @ touch $@
+
+ clean :
+ rm -f *.okay
+diff -U 3 -dHrN -- Macaulay2-0.9.2-orig/Macaulay2/Makefile.in Macaulay2-0.9.2/Macaulay2/Makefile.in
+--- Macaulay2-0.9.2-orig/Macaulay2/Makefile.in 2001-08-18 21:17:15.000000000 +0200
++++ Macaulay2-0.9.2/Macaulay2/Makefile.in 2004-05-14 13:35:33.266819848 +0200
+@@ -8,11 +8,11 @@
+
+ include ../include/config.Makefile
+ VPATH = @srcdir@
+-install :: $(packagedir)/COPYING $(packagedir)/CHANGES $(packagedir)/README
+-$(packagedir)/COPYING : COPYING $(packagedir) ; $(INSTALL_DATA) $< "$@"
+-$(packagedir)/CHANGES : CHANGES $(packagedir) ; $(INSTALL_DATA) $< "$@"
+-$(packagedir)/README : README $(packagedir) ; $(INSTALL_DATA) $< "$@"
+-$(packagedir):; $(INSTALL) -d "$@"
++install :: $(packagedocdir)/COPYING $(packagedocdir)/CHANGES $(packagedocdir)/README
++$(packagedocdir)/COPYING : COPYING $(packagedocdir) ; $(INSTALL_DATA) $< "$@"
++$(packagedocdir)/CHANGES : CHANGES $(packagedocdir) ; $(INSTALL_DATA) $< "$@"
++$(packagedocdir)/README : README $(packagedocdir) ; $(INSTALL_DATA) $< "$@"
++$(packagedocdir):; $(INSTALL) -d "$@"
+ ################################# libexec
+ libexec :; mkdir $@
+ clean ::; rm -rf libexec
+@@ -76,15 +76,15 @@
+ all ::; $(MAKE) -C emacs all
+ install distclean clean ::; $(MAKE) -C emacs $@
+ ################################# libexec
+-install :: $(packagedir)/libexec
+-$(packagedir)/libexec:; $(INSTALL) -d "$@"
+-install :: $(packagedir)/libexec/Macaulay2
+-$(packagedir)/libexec/Macaulay2 : libexec/Macaulay2
+- $(INSTALL_PROGRAM) $^ $(packagedir)/libexec
++install :: $(packageexecdir)/libexec
++$(packageexecdir)/libexec:; $(INSTALL) -d "$@"
++install :: $(packageexecdir)/libexec/Macaulay2
++$(packageexecdir)/libexec/Macaulay2 : libexec/Macaulay2
++ $(INSTALL_PROGRAM) $^ $(packageexecdir)/libexec
+ ifeq "$(DUMPDATA)" "yes"
+ ifeq "$(encap)" "no"
+-install :: $(packagedir)/$(DUMPDATAFILE)
+-$(packagedir)/$(DUMPDATAFILE) : $(DUMPDATAFILE); $(INSTALL) $< "$@"
++install :: $(packageexecdir)/$(DUMPDATAFILE)
++$(packageexecdir)/$(DUMPDATAFILE) : $(DUMPDATAFILE); $(INSTALL) $< "$@"
+ endif
+ endif
+ #################################
+diff -U 3 -dHrN -- Macaulay2-0.9.2-orig/Macaulay2/html/Makefile.in Macaulay2-0.9.2/Macaulay2/html/Makefile.in
+--- Macaulay2-0.9.2-orig/Macaulay2/html/Makefile.in 2001-08-14 05:10:18.000000000 +0200
++++ Macaulay2-0.9.2/Macaulay2/html/Makefile.in 2004-05-14 13:18:10.166395216 +0200
+@@ -54,7 +54,7 @@
+ clean::; rm -f ./*.html
+ clean::; rm -rf *.doc *.fn *.hl *.inv* *.cat *.src *.dct Macaulay2-index-cache
+ distclean: clean; rm -f Makefile
+-$(packagedir)/html:; $(INSTALL) -d "$@"
+-install:: $(packagedir)/html
+- $(INSTALL_DATA) Makefile $(IMAGES) *.html @srcdir@/html.m2 $(packagedir)/html
++$(packagehtmldir):; $(INSTALL) -d "$@"
++install:: $(packagehtmldir)
++ $(INSTALL_DATA) Makefile $(IMAGES) *.html @srcdir@/html.m2 $(packagehtmldir)
+
+diff -U 3 -dHrN -- Macaulay2-0.9.2-orig/Macaulay2/tutorial/Makefile.in Macaulay2-0.9.2/Macaulay2/tutorial/Makefile.in
+--- Macaulay2-0.9.2-orig/Macaulay2/tutorial/Makefile.in 2001-08-14 05:10:18.000000000 +0200
++++ Macaulay2-0.9.2/Macaulay2/tutorial/Makefile.in 2004-05-14 13:48:15.494943560 +0200
+@@ -35,10 +35,10 @@
+ ../../bin/M2 -e'readExamples=true' tutbook.m2 '-e exit 0'
+
+ #################################
+-install:: $(packagedir)/tutorial/final
++install:: $(packagedocdir)/tutorial/final
+ install:: $(TUTORIALS) $(OUTPUTS)
+- $(INSTALL_DATA) $^ "$(packagedir)/tutorial/final"
+-$(packagedir)/tutorial/final :; $(INSTALL) -d "$@"
++ $(INSTALL_DATA) $^ "$(packagedocdir)/tutorial/final"
++$(packagedocdir)/tutorial/final :; $(INSTALL) -d "$@"
+ #################################
+
+ clean :
+diff -U 3 -dHrN -- Macaulay2-0.9.2-orig/bin/M2-final.in Macaulay2-0.9.2/bin/M2-final.in
+--- Macaulay2-0.9.2-orig/bin/M2-final.in 2001-08-15 15:52:20.000000000 +0200
++++ Macaulay2-0.9.2/bin/M2-final.in 2004-05-14 12:45:00.298901056 +0200
+@@ -1,8 +1,8 @@
+ #! /bin/sh
+-M2HOME="`dirname $0`/../Macaulay2"
++M2HOME="/usr/share/Macaulay2-0.9.2"
+ export M2HOME
+-EXE="$M2HOME/libexec/Macaulay2"
+-DATA="$M2HOME/libexec/Macaulay2-`uname -m |sed s=/=-=g`-data"
++EXE="/usr/libexec/Macaulay2"
++DATA="/usr/libexec/Macaulay2-`uname -m |sed s=/=-=g`-data"
+ SETUP="$M2HOME/m2/setup.m2"
+ if [ -f "$DATA" ]
+ then exec "$EXE" "-e loaddata \"$DATA\"" -- "-e runStartFunctions()" "$@"
+diff -U 3 -dHrN -- Macaulay2-0.9.2-orig/bin/M2-help.in Macaulay2-0.9.2/bin/M2-help.in
+--- Macaulay2-0.9.2-orig/bin/M2-help.in 2002-01-09 17:21:35.000000000 +0100
++++ Macaulay2-0.9.2/bin/M2-help.in 2004-05-14 12:45:48.760533768 +0200
+@@ -1,3 +1,3 @@
+ #! /bin/sh
+-M2HOME="`dirname $0`/../Macaulay2"
++M2HOME="/usr/share/doc/Macaulay2-0.9.2"
+ ${WWBROWSER:-netscape} "$M2HOME/html/index.html"
+diff -U 3 -dHrN -- Macaulay2-0.9.2-orig/bin/Makefile.in Macaulay2-0.9.2/bin/Makefile.in
+--- Macaulay2-0.9.2-orig/bin/Makefile.in 2002-01-09 17:21:35.000000000 +0100
++++ Macaulay2-0.9.2/bin/Makefile.in 2004-05-14 13:16:46.060181304 +0200
+@@ -10,8 +10,8 @@
+ install :: $(bindir)/M2
+ $(bindir)/M2 : M2-final.in
+ $(INSTALL) -d $(bindir)
+- sed -e 's,^M2HOME=.*,M2HOME=$(prefix)/lib/Macaulay2-@PACKAGE_VERSION@,' $< >"$@".tmp
+- mv "$@".tmp "$@"
++ #sed -e 's,^M2HOME=.*,M2HOME=$(prefix)/lib/Macaulay2-@PACKAGE_VERSION@,' $< >"$@".tmp
++ mv M2-final.in "$@"
+ chmod 0755 "$@"
+
+ all :: M2-help
+@@ -20,8 +20,8 @@
+ install :: $(bindir)/M2-help
+ $(bindir)/M2-help : M2-help
+ $(INSTALL) -d $(bindir)
+- sed -e 's,^M2HOME=.*,M2HOME=$(prefix)/lib/Macaulay2-@PACKAGE_VERSION@,' $< >"$@".tmp
+- mv "$@".tmp "$@"
++ #sed -e 's,^M2HOME=.*,M2HOME=$(prefix)/lib/Macaulay2-@PACKAGE_VERSION@,' $< >"$@".tmp
++ mv M2-help.in "$@"
+ chmod 0755 "$@"
+
+ clean :; rm -f M2
+diff -U 3 -dHrN -- Macaulay2-0.9.2-orig/include/config.Makefile.in Macaulay2-0.9.2/include/config.Makefile.in
+--- Macaulay2-0.9.2-orig/include/config.Makefile.in 2002-01-09 17:21:35.000000000 +0100
++++ Macaulay2-0.9.2/include/config.Makefile.in 2004-05-14 13:05:36.563960200 +0200
+@@ -57,7 +57,11 @@
+ target = $(prefix)
+ endif
+
+-packagedir = $(target)/lib/$(package)
++packagedir = $(target)/share/$(package)
++packageexecdir = $(target)
++packagedocdir = $(target)/share/doc/$(package)
++packagehtmldir = $(target)/share/doc/$(package)/html
++
+ bindir = $(target)/bin
+
+ RANLIB = @RANLIB@
+--- Macaulay2-0.9.2/Macaulay2/e/EGB1.hpp 1999-09-09 23:47:12.000000000 +0200
++++ Macaulay2-0.9.2/Macaulay2/e/EGB1.hpp.new 2004-12-13 11:48:17.208554431 +0100
+@@ -104,8 +104,6 @@
+ };
+ class EGB1 : public EGroebnerComputation
+ {
+- class iterator;
+- friend class iterator;
+ private:
+ // Ring information
+ const EInterface I;
+@@ -255,6 +253,9 @@
+
+ virtual int new_calc(const EStopConditions &stop);
+
++ class iterator;
++ friend class iterator;
++
+ class iterator {
+ const EGB1 *comp;
+ int i;
+--- Macaulay2-0.9.2/include/config.Makefile.in 2004-12-13 12:29:02.776249827 +0100
++++ Macaulay2-0.9.2/include/config.Makefile.in.new 2004-12-13 12:47:35.221607868 +0100
+@@ -110,13 +110,6 @@
+ ifeq "$(GCC)" "yes"
+ CFLAGS += -Wall -Wshadow -Wcast-qual
+ CXXFLAGS += -Wall -Wshadow -Wcast-qual
+-ifeq "$(OPTIMIZE)" "yes"
+-CFLAGS += -O3 -fexpensive-optimizations
+-CXXFLAGS += -O3 -fexpensive-optimizations
+-else
+-CFLAGS += -O0
+-CXXFLAGS += -O0
+-endif
+ endif
+
+ ifeq "$(STRIP)" "no"