summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobin H. Johnson <robbat2@gentoo.org>2015-08-08 13:49:04 -0700
committerRobin H. Johnson <robbat2@gentoo.org>2015-08-08 17:38:18 -0700
commit56bd759df1d0c750a065b8c845e93d5dfa6b549d (patch)
tree3f91093cdb475e565ae857f1c5a7fd339e2d781e /sci-mathematics
downloadgentoo-56bd759df1d0c750a065b8c845e93d5dfa6b549d.tar.gz
gentoo-56bd759df1d0c750a065b8c845e93d5dfa6b549d.tar.bz2
gentoo-56bd759df1d0c750a065b8c845e93d5dfa6b549d.zip
proj/gentoo: Initial commit
This commit represents a new era for Gentoo: Storing the gentoo-x86 tree in Git, as converted from CVS. This commit is the start of the NEW history. Any historical data is intended to be grafted onto this point. Creation process: 1. Take final CVS checkout snapshot 2. Remove ALL ChangeLog* files 3. Transform all Manifests to thin 4. Remove empty Manifests 5. Convert all stale $Header$/$Id$ CVS keywords to non-expanded Git $Id$ 5.1. Do not touch files with -kb/-ko keyword flags. Signed-off-by: Robin H. Johnson <robbat2@gentoo.org> X-Thanks: Alec Warner <antarus@gentoo.org> - did the GSoC 2006 migration tests X-Thanks: Robin H. Johnson <robbat2@gentoo.org> - infra guy, herding this project X-Thanks: Nguyen Thai Ngoc Duy <pclouds@gentoo.org> - Former Gentoo developer, wrote Git features for the migration X-Thanks: Brian Harring <ferringb@gentoo.org> - wrote much python to improve cvs2svn X-Thanks: Rich Freeman <rich0@gentoo.org> - validation scripts X-Thanks: Patrick Lauer <patrick@gentoo.org> - Gentoo dev, running new 2014 work in migration X-Thanks: Michał Górny <mgorny@gentoo.org> - scripts, QA, nagging X-Thanks: All of other Gentoo developers - many ideas and lots of paint on the bikeshed
Diffstat (limited to 'sci-mathematics')
-rw-r--r--sci-mathematics/4ti2/4ti2-1.6.2.ebuild38
-rw-r--r--sci-mathematics/4ti2/4ti2-1.6.5.ebuild38
-rw-r--r--sci-mathematics/4ti2/4ti2-1.6.6.ebuild38
-rw-r--r--sci-mathematics/4ti2/Manifest3
-rw-r--r--sci-mathematics/4ti2/files/4ti2-1.3.2-gold.patch17
-rw-r--r--sci-mathematics/4ti2/metadata.xml13
-rw-r--r--sci-mathematics/Macaulay2/Macaulay2-1.7_pre.ebuild154
-rw-r--r--sci-mathematics/Macaulay2/Manifest4
-rw-r--r--sci-mathematics/Macaulay2/files/1.6-lapack.patch50
-rw-r--r--sci-mathematics/Macaulay2/files/1.6-paths-of-external-programs.patch73
-rw-r--r--sci-mathematics/Macaulay2/files/70Macaulay2-gentoo.el11
-rw-r--r--sci-mathematics/Macaulay2/metadata.xml16
-rw-r--r--sci-mathematics/agda-executable/Manifest1
-rw-r--r--sci-mathematics/agda-executable/agda-executable-2.3.0.1-r1.ebuild36
-rw-r--r--sci-mathematics/agda-executable/agda-executable-2.3.0.1-r2.ebuild35
-rw-r--r--sci-mathematics/agda-executable/metadata.xml13
-rw-r--r--sci-mathematics/agda-lib-ffi/Manifest2
-rw-r--r--sci-mathematics/agda-lib-ffi/agda-lib-ffi-0.0.2-r2.ebuild31
-rw-r--r--sci-mathematics/agda-lib-ffi/agda-lib-ffi-0.0.2.ebuild34
-rw-r--r--sci-mathematics/agda-lib-ffi/metadata.xml14
-rw-r--r--sci-mathematics/agda-stdlib/Manifest3
-rw-r--r--sci-mathematics/agda-stdlib/agda-stdlib-0.8.ebuild67
-rw-r--r--sci-mathematics/agda-stdlib/agda-stdlib-0.9.ebuild67
-rw-r--r--sci-mathematics/agda-stdlib/agda-stdlib-2.4.2.3.ebuild66
-rw-r--r--sci-mathematics/agda-stdlib/files/50agda-stdlib-gentoo.el1
-rw-r--r--sci-mathematics/agda-stdlib/metadata.xml15
-rw-r--r--sci-mathematics/agda/Manifest3
-rw-r--r--sci-mathematics/agda/agda-2.4.0.1.ebuild124
-rw-r--r--sci-mathematics/agda/agda-2.4.2.2-r1.ebuild128
-rw-r--r--sci-mathematics/agda/agda-2.4.2.3-r1.ebuild116
-rw-r--r--sci-mathematics/agda/files/50agda2-gentoo.el10
-rw-r--r--sci-mathematics/agda/files/agda-make_install.patch14
-rw-r--r--sci-mathematics/agda/metadata.xml17
-rw-r--r--sci-mathematics/axiom/Manifest1
-rw-r--r--sci-mathematics/axiom/axiom-200805.ebuild97
-rw-r--r--sci-mathematics/axiom/files/axiom-200711-gcl-configure.patch11
-rw-r--r--sci-mathematics/axiom/files/noweb-2.9-insecure-tmp-file.Makefile.patch10
-rw-r--r--sci-mathematics/axiom/files/noweb-2.9-insecure-tmp-file.patch.input168
-rw-r--r--sci-mathematics/axiom/metadata.xml5
-rw-r--r--sci-mathematics/bertini/Manifest1
-rw-r--r--sci-mathematics/bertini/bertini-1.4.ebuild58
-rw-r--r--sci-mathematics/bertini/metadata.xml25
-rw-r--r--sci-mathematics/cado-nfs/Manifest4
-rw-r--r--sci-mathematics/cado-nfs/cado-nfs-1.1.ebuild31
-rw-r--r--sci-mathematics/cado-nfs/cado-nfs-2.0.ebuild38
-rw-r--r--sci-mathematics/cado-nfs/cado-nfs-2.1.1.ebuild41
-rw-r--r--sci-mathematics/cado-nfs/cado-nfs-2.1.ebuild41
-rw-r--r--sci-mathematics/cado-nfs/metadata.xml8
-rw-r--r--sci-mathematics/calc/Manifest5
-rw-r--r--sci-mathematics/calc/calc-2.12.1.5.ebuild40
-rw-r--r--sci-mathematics/calc/calc-2.12.2.2.ebuild52
-rw-r--r--sci-mathematics/calc/calc-2.12.4.13.ebuild57
-rw-r--r--sci-mathematics/calc/calc-2.12.4.3.ebuild53
-rw-r--r--sci-mathematics/calc/calc-2.12.4.4.ebuild57
-rw-r--r--sci-mathematics/calc/files/2.12.4.0-ldflags.patch101
-rw-r--r--sci-mathematics/calc/files/calc-2.12.2.2-libdir-fix.patch12
-rw-r--r--sci-mathematics/calc/files/calc-2.12.4.0-prefix.patch96
-rw-r--r--sci-mathematics/calc/files/calc-2.12.4.13-prefix.patch87
-rw-r--r--sci-mathematics/calc/metadata.xml12
-rw-r--r--sci-mathematics/cgal/Manifest4
-rw-r--r--sci-mathematics/cgal/cgal-4.3-r1.ebuild76
-rw-r--r--sci-mathematics/cgal/cgal-4.3.ebuild74
-rw-r--r--sci-mathematics/cgal/cgal-4.6.1.ebuild74
-rw-r--r--sci-mathematics/cgal/files/cgal-4.3-cmake-3.3.patch24
-rw-r--r--sci-mathematics/cgal/metadata.xml21
-rw-r--r--sci-mathematics/coq/Manifest6
-rw-r--r--sci-mathematics/coq/coq-8.3_p1.ebuild81
-rw-r--r--sci-mathematics/coq/coq-8.4_p1.ebuild81
-rw-r--r--sci-mathematics/coq/coq-8.4_p2.ebuild78
-rw-r--r--sci-mathematics/coq/coq-8.4_p3.ebuild90
-rw-r--r--sci-mathematics/coq/coq-8.4_p5.ebuild103
-rw-r--r--sci-mathematics/coq/coq-8.4_p6.ebuild103
-rw-r--r--sci-mathematics/coq/files/coq-8.4_p1-camlp4.patch17
-rw-r--r--sci-mathematics/coq/files/coq-8.4_p5-do-not-install-revision.patch19
-rw-r--r--sci-mathematics/coq/files/coq-8.4_p5-hevea.patch11
-rw-r--r--sci-mathematics/coq/files/coq-8.4_p5-no-clean-before-test.patch12
-rw-r--r--sci-mathematics/coq/files/coqide.desktop9
-rw-r--r--sci-mathematics/coq/metadata.xml22
-rw-r--r--sci-mathematics/cvc3/Manifest1
-rw-r--r--sci-mathematics/cvc3/cvc3-2.4.1.ebuild157
-rw-r--r--sci-mathematics/cvc3/files/50cvc3-gentoo.el3
-rw-r--r--sci-mathematics/cvc3/metadata.xml42
-rw-r--r--sci-mathematics/dataplot/Manifest2
-rw-r--r--sci-mathematics/dataplot/dataplot-20090821.ebuild81
-rw-r--r--sci-mathematics/dataplot/files/90dataplot3
-rw-r--r--sci-mathematics/dataplot/files/Makefile.am.2009082146
-rw-r--r--sci-mathematics/dataplot/files/configure.ac.2009082176
-rw-r--r--sci-mathematics/dataplot/files/dataplot-20090821-opengl.patch47
-rw-r--r--sci-mathematics/dataplot/metadata.xml13
-rw-r--r--sci-mathematics/diagrtb/Manifest1
-rw-r--r--sci-mathematics/diagrtb/diagrtb-2.64.ebuild30
-rw-r--r--sci-mathematics/diagrtb/files/CMakeLists.txt13
-rw-r--r--sci-mathematics/diagrtb/metadata.xml27
-rw-r--r--sci-mathematics/drgeo/Manifest2
-rw-r--r--sci-mathematics/drgeo/drgeo-1.1.0.ebuild56
-rw-r--r--sci-mathematics/drgeo/files/drgeo-1.1.0-gcc45.patch61
-rw-r--r--sci-mathematics/drgeo/metadata.xml16
-rw-r--r--sci-mathematics/e/Manifest3
-rw-r--r--sci-mathematics/e/e-1.5.ebuild128
-rw-r--r--sci-mathematics/e/e-1.6.ebuild128
-rw-r--r--sci-mathematics/e/e-1.8.ebuild119
-rw-r--r--sci-mathematics/e/metadata.xml32
-rw-r--r--sci-mathematics/ent/Manifest1
-rw-r--r--sci-mathematics/ent/ent-101202.ebuild29
-rw-r--r--sci-mathematics/ent/files/101202-gentoo.patch20
-rw-r--r--sci-mathematics/ent/metadata.xml8
-rw-r--r--sci-mathematics/euler/Manifest1
-rw-r--r--sci-mathematics/euler/euler-1.61.0.ebuild43
-rw-r--r--sci-mathematics/euler/files/command-gcc4-gentoo.patch12
-rw-r--r--sci-mathematics/euler/files/configure-gentoo.patch37
-rw-r--r--sci-mathematics/euler/files/euler-fortify.patch36
-rw-r--r--sci-mathematics/euler/files/euler-glibc-2.4-gentoo.patch13
-rw-r--r--sci-mathematics/euler/files/euler-xdg.patch23
-rw-r--r--sci-mathematics/euler/metadata.xml8
-rw-r--r--sci-mathematics/factmsieve/Manifest1
-rw-r--r--sci-mathematics/factmsieve/factmsieve-76.ebuild36
-rw-r--r--sci-mathematics/factmsieve/files/factmsieve-76.patch52
-rw-r--r--sci-mathematics/factmsieve/metadata.xml8
-rw-r--r--sci-mathematics/fann/Manifest2
-rw-r--r--sci-mathematics/fann/fann-2.1.0_beta-r1.ebuild99
-rw-r--r--sci-mathematics/fann/fann-2.2.0.ebuild41
-rw-r--r--sci-mathematics/fann/files/fann-2.0.0-benchmark.patch49
-rw-r--r--sci-mathematics/fann/files/fann-2.0.0-shared-libs-gentoo.patch23
-rw-r--r--sci-mathematics/fann/files/fann-2.1.0_beta-asneeded.patch8
-rw-r--r--sci-mathematics/fann/files/fann-2.1.0_beta-benchmark.patch80
-rw-r--r--sci-mathematics/fann/files/fann-2.1.0_beta-examples.patch23
-rw-r--r--sci-mathematics/fann/files/fann-2.1.0_beta-python.patch20
-rw-r--r--sci-mathematics/fann/files/fann-2.1.0_beta-pythonlink.patch30
-rw-r--r--sci-mathematics/fann/files/fann-2.1.0_beta-sizecheck.patch25
-rw-r--r--sci-mathematics/fann/files/fann-2.1.0_beta-valist.patch65
-rw-r--r--sci-mathematics/fann/files/fann-2.2.0-examples.patch23
-rw-r--r--sci-mathematics/fann/metadata.xml16
-rw-r--r--sci-mathematics/flint/Manifest4
-rw-r--r--sci-mathematics/flint/files/flint-2.4.3-cflags-ldflags.patch33
-rw-r--r--sci-mathematics/flint/files/flint-2.4.3-libdir.patch44
-rw-r--r--sci-mathematics/flint/files/flint-2.4.3-whitespaces.patch54
-rw-r--r--sci-mathematics/flint/files/flint-2.4.4-test.patch19
-rw-r--r--sci-mathematics/flint/files/flint-2.4.5-gmp6-compat.patch115
-rw-r--r--sci-mathematics/flint/files/flint-2.4.5-ntl62.patch13
-rw-r--r--sci-mathematics/flint/flint-2.3.ebuild33
-rw-r--r--sci-mathematics/flint/flint-2.4.3.ebuild62
-rw-r--r--sci-mathematics/flint/flint-2.4.4-r1.ebuild67
-rw-r--r--sci-mathematics/flint/flint-2.4.5.ebuild69
-rw-r--r--sci-mathematics/flint/metadata.xml16
-rw-r--r--sci-mathematics/form/Manifest1
-rw-r--r--sci-mathematics/form/form-4.1.ebuild82
-rw-r--r--sci-mathematics/form/metadata.xml12
-rw-r--r--sci-mathematics/freemat/Manifest1
-rw-r--r--sci-mathematics/freemat/files/freemat-4.0-gcc45.patch208
-rw-r--r--sci-mathematics/freemat/files/freemat-4.0-no_implicit_GLU.patch14
-rw-r--r--sci-mathematics/freemat/files/freemat-4.1-fixes.patch21
-rw-r--r--sci-mathematics/freemat/files/freemat-4.1-have_fftw.patch78
-rw-r--r--sci-mathematics/freemat/files/freemat-4.1-local_libffi.patch13
-rw-r--r--sci-mathematics/freemat/files/freemat-4.1-portaudio.patch10
-rw-r--r--sci-mathematics/freemat/files/freemat-4.1-python3.patch24
-rw-r--r--sci-mathematics/freemat/files/freemat-4.1-use_llvm.patch29
-rw-r--r--sci-mathematics/freemat/files/freemat-4.2-use_llvm.patch45
-rw-r--r--sci-mathematics/freemat/freemat-4.2.ebuild84
-rw-r--r--sci-mathematics/freemat/metadata.xml20
-rw-r--r--sci-mathematics/fricas/Manifest2
-rw-r--r--sci-mathematics/fricas/files/64fricas-gentoo.el2
-rw-r--r--sci-mathematics/fricas/fricas-1.2.5.ebuild90
-rw-r--r--sci-mathematics/fricas/fricas-1.2.6.ebuild90
-rw-r--r--sci-mathematics/fricas/metadata.xml29
-rw-r--r--sci-mathematics/frobby/Manifest1
-rw-r--r--sci-mathematics/frobby/files/frobby-cflags-no-strip-soname.patch47
-rw-r--r--sci-mathematics/frobby/files/frobby-gcc-4.7.patch32
-rw-r--r--sci-mathematics/frobby/files/frobby-gmp-5.1.patch12
-rw-r--r--sci-mathematics/frobby/frobby-0.9.0-r1.ebuild55
-rw-r--r--sci-mathematics/frobby/metadata.xml12
-rw-r--r--sci-mathematics/genius/Manifest3
-rw-r--r--sci-mathematics/genius/files/genius-1.0.17-gcc4.8.patch28
-rw-r--r--sci-mathematics/genius/files/genius-make.patch73
-rw-r--r--sci-mathematics/genius/genius-1.0.17.ebuild58
-rw-r--r--sci-mathematics/genius/genius-1.0.19.ebuild56
-rw-r--r--sci-mathematics/genius/metadata.xml19
-rw-r--r--sci-mathematics/geogebra/Manifest1
-rw-r--r--sci-mathematics/geogebra/files/geogebra-fix-install.sh.patch78
-rw-r--r--sci-mathematics/geogebra/geogebra-4.1.120.0.ebuild28
-rw-r--r--sci-mathematics/geogebra/metadata.xml13
-rw-r--r--sci-mathematics/geomview/Manifest2
-rw-r--r--sci-mathematics/geomview/files/50geomview-gentoo.el7
-rw-r--r--sci-mathematics/geomview/files/gvcl-mode.el172
-rw-r--r--sci-mathematics/geomview/geomview-1.9.5.ebuild69
-rw-r--r--sci-mathematics/geomview/metadata.xml12
-rw-r--r--sci-mathematics/gfan/Manifest1
-rw-r--r--sci-mathematics/gfan/files/gfan-0.5-double-declare-fix.patch12
-rw-r--r--sci-mathematics/gfan/gfan-0.5.ebuild34
-rw-r--r--sci-mathematics/gfan/metadata.xml12
-rw-r--r--sci-mathematics/ggnfs/Manifest4
-rw-r--r--sci-mathematics/ggnfs/files/ggnfs-0.77.1-gentoo.patch158
-rw-r--r--sci-mathematics/ggnfs/ggnfs-0.77.1-r2.ebuild67
-rw-r--r--sci-mathematics/ggnfs/metadata.xml11
-rw-r--r--sci-mathematics/gimps/Manifest6
-rw-r--r--sci-mathematics/gimps/files/gimps-25.6-conf.d12
-rw-r--r--sci-mathematics/gimps/files/gimps-26.6-r1-init.d37
-rw-r--r--sci-mathematics/gimps/files/gimps.service14
-rw-r--r--sci-mathematics/gimps/files/gimps.tmpfiles1
-rw-r--r--sci-mathematics/gimps/gimps-27.9-r2.ebuild66
-rw-r--r--sci-mathematics/gimps/gimps-28.5.ebuild66
-rw-r--r--sci-mathematics/gimps/gimps-28.6.ebuild66
-rw-r--r--sci-mathematics/gimps/metadata.xml9
-rw-r--r--sci-mathematics/ginac/Manifest3
-rw-r--r--sci-mathematics/ginac/files/ginac-1.5.1-pkgconfig.patch9
-rw-r--r--sci-mathematics/ginac/ginac-1.5.8.ebuild59
-rw-r--r--sci-mathematics/ginac/ginac-1.6.1.ebuild62
-rw-r--r--sci-mathematics/ginac/ginac-1.6.2.ebuild60
-rw-r--r--sci-mathematics/ginac/metadata.xml13
-rw-r--r--sci-mathematics/glpk/Manifest4
-rw-r--r--sci-mathematics/glpk/files/glpk-4.52.1-mariadb-5.5.patch11
-rw-r--r--sci-mathematics/glpk/files/glpk-4.53-debundle-system-libs.patch87
-rw-r--r--sci-mathematics/glpk/files/glpk-4.54-debundle-system-libs.patch86
-rw-r--r--sci-mathematics/glpk/glpk-4.45.ebuild64
-rw-r--r--sci-mathematics/glpk/glpk-4.48.ebuild53
-rw-r--r--sci-mathematics/glpk/glpk-4.54.ebuild59
-rw-r--r--sci-mathematics/glpk/glpk-4.55.ebuild59
-rw-r--r--sci-mathematics/glpk/metadata.xml14
-rw-r--r--sci-mathematics/gmm/Manifest1
-rw-r--r--sci-mathematics/gmm/gmm-4.2.ebuild16
-rw-r--r--sci-mathematics/gmm/metadata.xml17
-rw-r--r--sci-mathematics/gmp-ecm/Manifest2
-rw-r--r--sci-mathematics/gmp-ecm/gmp-ecm-6.4.3-r5.ebuild56
-rw-r--r--sci-mathematics/gmp-ecm/gmp-ecm-6.4.4-r1.ebuild65
-rw-r--r--sci-mathematics/gmp-ecm/gmp-ecm-9999.ebuild53
-rw-r--r--sci-mathematics/gmp-ecm/metadata.xml12
-rw-r--r--sci-mathematics/gretl/Manifest2
-rw-r--r--sci-mathematics/gretl/files/50gretl-gentoo.el16
-rw-r--r--sci-mathematics/gretl/files/gretl-1.9.14-readline.patch10
-rw-r--r--sci-mathematics/gretl/gretl-1.9.14.ebuild112
-rw-r--r--sci-mathematics/gretl/gretl-1.9.90.ebuild112
-rw-r--r--sci-mathematics/gretl/metadata.xml23
-rw-r--r--sci-mathematics/gsl-shell/Manifest1
-rw-r--r--sci-mathematics/gsl-shell/files/gsl-shell-2.2.0-pkg-config.patch33
-rw-r--r--sci-mathematics/gsl-shell/files/gsl-shell-font.patch10
-rw-r--r--sci-mathematics/gsl-shell/files/gsl-shell-nogui.patch25
-rw-r--r--sci-mathematics/gsl-shell/files/gsl-shell-strip.patch8
-rw-r--r--sci-mathematics/gsl-shell/files/gsl-shell-usr.patch8
-rw-r--r--sci-mathematics/gsl-shell/gsl-shell-2.2.0.ebuild64
-rw-r--r--sci-mathematics/gsl-shell/metadata.xml21
-rw-r--r--sci-mathematics/gwnum/Manifest1
-rw-r--r--sci-mathematics/gwnum/gwnum-277.ebuild34
-rw-r--r--sci-mathematics/gwnum/metadata.xml8
-rw-r--r--sci-mathematics/isabelle/Manifest11
-rw-r--r--sci-mathematics/isabelle/files/isabelle-2011.1-gentoo-settings.patch39
-rw-r--r--sci-mathematics/isabelle/files/isabelle-2011.1-graphbrowser.patch11
-rw-r--r--sci-mathematics/isabelle/files/isabelle-2011.1-libsha1.patch11
-rw-r--r--sci-mathematics/isabelle/files/isabelle-2011.1-proofgeneral-gentoo-path.patch39
-rw-r--r--sci-mathematics/isabelle/files/isabelle-2011.1-reverse-line-editor-order.patch12
-rw-r--r--sci-mathematics/isabelle/files/isabelle-2012-gentoo-settings.patch62
-rw-r--r--sci-mathematics/isabelle/files/isabelle-2012-graphbrowser.patch11
-rw-r--r--sci-mathematics/isabelle/files/isabelle-2012-libsha1.patch11
-rw-r--r--sci-mathematics/isabelle/files/isabelle-2012-redundant-equations-in-function-definitions-error.patch35
-rw-r--r--sci-mathematics/isabelle/files/isabelle-2012-reverse-line-editor-order.patch12
-rw-r--r--sci-mathematics/isabelle/files/isabelle-2012-signal-handling.patch8
-rw-r--r--sci-mathematics/isabelle/files/isabelle-2013-HOL-Predicate_Compile_Examples.patch82
-rw-r--r--sci-mathematics/isabelle/files/isabelle-2013-classpath.patch149
-rw-r--r--sci-mathematics/isabelle/files/isabelle-2013-gentoo-settings.patch19
-rw-r--r--sci-mathematics/isabelle/files/isabelle-2013.2-HOL-Predicate_Compile_Examples.patch89
-rw-r--r--sci-mathematics/isabelle/files/isabelle-2013.2-classpath.patch135
-rw-r--r--sci-mathematics/isabelle/isabelle-2011.1-r2.ebuild254
-rw-r--r--sci-mathematics/isabelle/isabelle-2011.1.ebuild142
-rw-r--r--sci-mathematics/isabelle/isabelle-2012-r1.ebuild320
-rw-r--r--sci-mathematics/isabelle/isabelle-2013-r2.ebuild353
-rw-r--r--sci-mathematics/isabelle/isabelle-2013.2-r1.ebuild375
-rw-r--r--sci-mathematics/isabelle/metadata.xml43
-rw-r--r--sci-mathematics/jags/Manifest1
-rw-r--r--sci-mathematics/jags/jags-3.4.0.ebuild47
-rw-r--r--sci-mathematics/jags/metadata.xml18
-rw-r--r--sci-mathematics/kodkod/Manifest2
-rw-r--r--sci-mathematics/kodkod/files/kodkod-1.5.2-changes-in-most-specific-varargs-method-selection.patch28
-rw-r--r--sci-mathematics/kodkod/kodkod-1.5.2.ebuild142
-rw-r--r--sci-mathematics/kodkod/metadata.xml18
-rw-r--r--sci-mathematics/kodkodi/Manifest1
-rw-r--r--sci-mathematics/kodkodi/kodkodi-1.5.2.ebuild107
-rw-r--r--sci-mathematics/kodkodi/metadata.xml16
-rw-r--r--sci-mathematics/lpsolve/Manifest1
-rw-r--r--sci-mathematics/lpsolve/lpsolve-5.5.2.0.ebuild29
-rw-r--r--sci-mathematics/lpsolve/metadata.xml6
-rw-r--r--sci-mathematics/lybniz/Manifest1
-rw-r--r--sci-mathematics/lybniz/lybniz-1.3.2.ebuild31
-rw-r--r--sci-mathematics/lybniz/metadata.xml12
-rw-r--r--sci-mathematics/mathomatic/Manifest3
-rw-r--r--sci-mathematics/mathomatic/mathomatic-15.8.5.ebuild42
-rw-r--r--sci-mathematics/mathomatic/mathomatic-16.0.1.ebuild42
-rw-r--r--sci-mathematics/mathomatic/mathomatic-16.0.5.ebuild42
-rw-r--r--sci-mathematics/mathomatic/metadata.xml11
-rw-r--r--sci-mathematics/maxima/Manifest3
-rw-r--r--sci-mathematics/maxima/files/50maxima-gentoo.el12
-rw-r--r--sci-mathematics/maxima/files/clisp-0.patch19
-rw-r--r--sci-mathematics/maxima/files/clozurecl-0.patch27
-rw-r--r--sci-mathematics/maxima/files/clozurecl-1.patch28
-rw-r--r--sci-mathematics/maxima/files/cmucl-0.patch27
-rw-r--r--sci-mathematics/maxima/files/ecls-0.patch27
-rw-r--r--sci-mathematics/maxima/files/ecls-1.patch37
-rw-r--r--sci-mathematics/maxima/files/imaxima-0.patch5
-rw-r--r--sci-mathematics/maxima/files/maxima-5.26.0-ecls-12.2.1.patch8
-rw-r--r--sci-mathematics/maxima/files/maxima-5.26.0-wish.patch28
-rw-r--r--sci-mathematics/maxima/files/maxima-5.26.0.patch37
-rw-r--r--sci-mathematics/maxima/files/maxima-5.27.0-inhibit-sys_usr-inits.patch24
-rw-r--r--sci-mathematics/maxima/files/maxima-5.27.0-wish.patch28
-rw-r--r--sci-mathematics/maxima/files/maxima-5.27.0.patch37
-rw-r--r--sci-mathematics/maxima/files/maxima-5.28.0-sbcl.patch8
-rw-r--r--sci-mathematics/maxima/files/maxima-5.28.0-wish.patch28
-rw-r--r--sci-mathematics/maxima/files/maxima-5.28.0.patch51
-rw-r--r--sci-mathematics/maxima/files/maxima-5.29.1-sbcl.patch8
-rw-r--r--sci-mathematics/maxima/files/maxima-5.29.1-wish.patch28
-rw-r--r--sci-mathematics/maxima/files/maxima-5.29.1.patch51
-rw-r--r--sci-mathematics/maxima/files/maxima-ccl.patch8
-rw-r--r--sci-mathematics/maxima/files/maxima-ecl-ldflags.patch27
-rw-r--r--sci-mathematics/maxima/files/maxima-imaxima.patch5
-rw-r--r--sci-mathematics/maxima/files/maxima-no-init-files.patch31
-rw-r--r--sci-mathematics/maxima/files/maxima-rmaxima.patch25
-rw-r--r--sci-mathematics/maxima/files/maxima-xdg-utils.patch35
-rw-r--r--sci-mathematics/maxima/files/rmaxima-0.patch25
-rw-r--r--sci-mathematics/maxima/files/sbcl-0.patch26
-rw-r--r--sci-mathematics/maxima/files/wish-0.patch28
-rw-r--r--sci-mathematics/maxima/files/wish-1.patch28
-rw-r--r--sci-mathematics/maxima/files/xdg-utils-0.patch35
-rw-r--r--sci-mathematics/maxima/maxima-5.18.1.ebuild175
-rw-r--r--sci-mathematics/maxima/maxima-5.34.1.ebuild190
-rw-r--r--sci-mathematics/maxima/maxima-5.36.1.ebuild190
-rw-r--r--sci-mathematics/maxima/metadata.xml32
-rw-r--r--sci-mathematics/metadata.xml37
-rw-r--r--sci-mathematics/minisat/Manifest3
-rw-r--r--sci-mathematics/minisat/files/minisat-2.2.0-header_fix.patch160
-rw-r--r--sci-mathematics/minisat/metadata.xml9
-rw-r--r--sci-mathematics/minisat/minisat-2.1.0.ebuild96
-rw-r--r--sci-mathematics/minisat/minisat-2.2.0-r3.ebuild93
-rw-r--r--sci-mathematics/mlpy/Manifest1
-rw-r--r--sci-mathematics/mlpy/metadata.xml18
-rw-r--r--sci-mathematics/mlpy/mlpy-3.5.0.ebuild35
-rw-r--r--sci-mathematics/msieve/Manifest1
-rw-r--r--sci-mathematics/msieve/files/fix-version.patch15
-rw-r--r--sci-mathematics/msieve/files/fix-version2.patch14
-rw-r--r--sci-mathematics/msieve/files/msieve-1.51-reduce-printf.patch44
-rw-r--r--sci-mathematics/msieve/files/reduce-printf.patch62
-rw-r--r--sci-mathematics/msieve/files/reduce-printf2.patch52
-rw-r--r--sci-mathematics/msieve/files/reduce-printf3.patch31
-rw-r--r--sci-mathematics/msieve/metadata.xml11
-rw-r--r--sci-mathematics/msieve/msieve-1.51.ebuild56
-rw-r--r--sci-mathematics/msieve/msieve-9999.ebuild55
-rw-r--r--sci-mathematics/nauty/Manifest1
-rw-r--r--sci-mathematics/nauty/metadata.xml15
-rw-r--r--sci-mathematics/nauty/nauty-2.5.9.ebuild42
-rw-r--r--sci-mathematics/nestedsums/Manifest1
-rw-r--r--sci-mathematics/nestedsums/metadata.xml12
-rw-r--r--sci-mathematics/nestedsums/nestedsums-1.4.12-r1.ebuild32
-rw-r--r--sci-mathematics/normaliz/Manifest1
-rw-r--r--sci-mathematics/normaliz/files/normaliz-2.12.1-respect-flags.patch47
-rw-r--r--sci-mathematics/normaliz/files/normaliz-2.12.2-gcc49.patch11
-rw-r--r--sci-mathematics/normaliz/metadata.xml17
-rw-r--r--sci-mathematics/normaliz/normaliz-2.12.2.ebuild64
-rw-r--r--sci-mathematics/num-utils/Manifest3
-rw-r--r--sci-mathematics/num-utils/metadata.xml5
-rw-r--r--sci-mathematics/num-utils/num-utils-0.3.ebuild26
-rw-r--r--sci-mathematics/num-utils/num-utils-0.5-r1.ebuild48
-rw-r--r--sci-mathematics/nusmv/Manifest6
-rw-r--r--sci-mathematics/nusmv/files/MiniSat_v1.14-optimizedlib.patch44
-rw-r--r--sci-mathematics/nusmv/files/MiniSat_v1.14_gcc41.patch92
-rw-r--r--sci-mathematics/nusmv/files/cudd-no-pentium4.patch11
-rw-r--r--sci-mathematics/nusmv/metadata.xml11
-rw-r--r--sci-mathematics/nusmv/nusmv-2.3.1.ebuild121
-rw-r--r--sci-mathematics/nusmv/nusmv-2.5.0.ebuild133
-rw-r--r--sci-mathematics/nusmv/nusmv-2.5.2.ebuild132
-rw-r--r--sci-mathematics/nusmv/nusmv-2.5.3.ebuild132
-rw-r--r--sci-mathematics/nusmv/nusmv-2.5.4.ebuild135
-rw-r--r--sci-mathematics/octave-epstk/Manifest4
-rw-r--r--sci-mathematics/octave-epstk/metadata.xml11
-rw-r--r--sci-mathematics/octave-epstk/octave-epstk-2.3.ebuild40
-rw-r--r--sci-mathematics/octave-epstk/octave-epstk-2.4.ebuild40
-rw-r--r--sci-mathematics/octave/Manifest4
-rw-r--r--sci-mathematics/octave/files/octave-3.4.3-pkgbuilddir.patch44
-rw-r--r--sci-mathematics/octave/files/octave-3.4.3-texi.patch11
-rw-r--r--sci-mathematics/octave/files/octave-3.6.3-legendtext.patch13
-rw-r--r--sci-mathematics/octave/files/octave-3.6.4-gcc-4.8.patch34
-rw-r--r--sci-mathematics/octave/files/octave-3.6.4-texinfo.patch378
-rw-r--r--sci-mathematics/octave/files/octave-3.8.0-disable-getcwd-path-max-test-as-it-is-too-slow.patch11
-rw-r--r--sci-mathematics/octave/files/octave-3.8.0-fix-compile.patch11
-rw-r--r--sci-mathematics/octave/files/octave-3.8.0-imagemagick-configure.patch16
-rw-r--r--sci-mathematics/octave/files/octave-3.8.0-llvm-3.4.patch63
-rw-r--r--sci-mathematics/octave/files/octave-3.8.0-llvm-configure.patch12
-rw-r--r--sci-mathematics/octave/files/octave-3.8.0-pkgbuilddir.patch40
-rw-r--r--sci-mathematics/octave/files/octave-3.8.1-imagemagick.patch138
-rw-r--r--sci-mathematics/octave/files/octave-3.8.1-pkgbuilddir.patch41
-rw-r--r--sci-mathematics/octave/files/octave-4.0.0-imagemagick-configure.patch16
-rw-r--r--sci-mathematics/octave/files/octave-4.0.0-imagemagick.patch139
-rw-r--r--sci-mathematics/octave/files/octave-4.0.0-llvm-3.5-gnulib-hg.patch19
-rw-r--r--sci-mathematics/octave/files/octave-4.0.0-llvm-3.5.patch130
-rw-r--r--sci-mathematics/octave/metadata.xml20
-rw-r--r--sci-mathematics/octave/octave-3.6.4-r1.ebuild134
-rw-r--r--sci-mathematics/octave/octave-3.6.4.ebuild132
-rw-r--r--sci-mathematics/octave/octave-3.8.1-r1.ebuild163
-rw-r--r--sci-mathematics/octave/octave-3.8.1.ebuild202
-rw-r--r--sci-mathematics/octave/octave-3.8.2.ebuild163
-rw-r--r--sci-mathematics/octave/octave-4.0.0.ebuild169
-rw-r--r--sci-mathematics/otter/Manifest1
-rw-r--r--sci-mathematics/otter/files/otter-3.3-build.patch114
-rw-r--r--sci-mathematics/otter/files/otter-3.3-gold.patch16
-rw-r--r--sci-mathematics/otter/metadata.xml5
-rw-r--r--sci-mathematics/otter/otter-3.3-r1.ebuild35
-rw-r--r--sci-mathematics/otter/otter-3.3-r2.ebuild44
-rw-r--r--sci-mathematics/p9m4/Manifest2
-rw-r--r--sci-mathematics/p9m4/files/p9m4-v05-package.patch67
-rw-r--r--sci-mathematics/p9m4/files/p9m4-v05-python2.6.patch44
-rw-r--r--sci-mathematics/p9m4/files/p9m4-v05-use-inst-paths.patch42
-rw-r--r--sci-mathematics/p9m4/metadata.xml14
-rw-r--r--sci-mathematics/p9m4/p9m4-05-r1.ebuild109
-rw-r--r--sci-mathematics/pari-data/Manifest5
-rw-r--r--sci-mathematics/pari-data/metadata.xml15
-rw-r--r--sci-mathematics/pari-data/pari-data-20120726.ebuild26
-rw-r--r--sci-mathematics/pari/Manifest12
-rw-r--r--sci-mathematics/pari/files/50pari-gentoo.el10
-rw-r--r--sci-mathematics/pari/files/pari-2.3.2-ppc-powerpc-arch-fix.patch11
-rw-r--r--sci-mathematics/pari/files/pari-2.3.2-strip.patch11
-rw-r--r--sci-mathematics/pari/files/pari-2.3.5-doc-make.patch46
-rw-r--r--sci-mathematics/pari/files/pari-2.5.0-doc-make.patch82
-rw-r--r--sci-mathematics/pari/files/pari-2.5.0-macos.patch21
-rw-r--r--sci-mathematics/pari/files/pari-2.5.0-mp.c.patch23
-rw-r--r--sci-mathematics/pari/files/pari-2.5.1-1302.patch33
-rw-r--r--sci-mathematics/pari/files/pari-2.5.1-1304.patch39
-rw-r--r--sci-mathematics/pari/files/pari-2.5.1-gcc47.patch18
-rw-r--r--sci-mathematics/pari/files/pari-2.5.1-no-automagic.patch100
-rw-r--r--sci-mathematics/pari/files/pari-2.5.4-polred.patch754
-rw-r--r--sci-mathematics/pari/files/pari-2.5.4-slow_determinant.patch100
-rw-r--r--sci-mathematics/pari/files/pari-2.7.0-doc-make.patch89
-rw-r--r--sci-mathematics/pari/files/pari-2.7.0-no-automagic.patch100
-rw-r--r--sci-mathematics/pari/files/pari-2.7.0-slow-discriminant.patch54
-rw-r--r--sci-mathematics/pari/metadata.xml25
-rw-r--r--sci-mathematics/pari/pari-2.3.5.ebuild138
-rw-r--r--sci-mathematics/pari/pari-2.5.0-r3.ebuild135
-rw-r--r--sci-mathematics/pari/pari-2.5.1-r1.ebuild137
-rw-r--r--sci-mathematics/pari/pari-2.5.1.ebuild137
-rw-r--r--sci-mathematics/pari/pari-2.5.2.ebuild133
-rw-r--r--sci-mathematics/pari/pari-2.5.3.ebuild133
-rw-r--r--sci-mathematics/pari/pari-2.5.4.ebuild141
-rw-r--r--sci-mathematics/pari/pari-2.7.0.ebuild133
-rw-r--r--sci-mathematics/pari/pari-2.7.1.ebuild133
-rw-r--r--sci-mathematics/polymake/Manifest3
-rw-r--r--sci-mathematics/polymake/files/polymake_gcc49.patch68
-rw-r--r--sci-mathematics/polymake/metadata.xml25
-rw-r--r--sci-mathematics/polymake/polymake-2.13.ebuild64
-rw-r--r--sci-mathematics/polymake/polymake-2.14-r1.ebuild90
-rw-r--r--sci-mathematics/polymake/polymake-2.14.ebuild59
-rw-r--r--sci-mathematics/prng/Manifest1
-rw-r--r--sci-mathematics/prng/files/prng-3.0.2-shared.patch52
-rw-r--r--sci-mathematics/prng/metadata.xml13
-rw-r--r--sci-mathematics/prng/prng-3.0.2.ebuild30
-rw-r--r--sci-mathematics/prover9/Manifest2
-rw-r--r--sci-mathematics/prover9/files/LADR-2009-11A-manpages.patch466
-rw-r--r--sci-mathematics/prover9/metadata.xml15
-rw-r--r--sci-mathematics/prover9/prover9-2009.11a.ebuild120
-rw-r--r--sci-mathematics/pspp/Manifest2
-rw-r--r--sci-mathematics/pspp/files/50pspp-gentoo.el6
-rw-r--r--sci-mathematics/pspp/files/pspp-0.8.0-gettext.patch10
-rw-r--r--sci-mathematics/pspp/files/pspp-0.8.1-oos.patch28
-rw-r--r--sci-mathematics/pspp/files/pspp-0.8.1-underlinking.patch29
-rw-r--r--sci-mathematics/pspp/metadata.xml13
-rw-r--r--sci-mathematics/pspp/pspp-0.8.1-r1.ebuild91
-rw-r--r--sci-mathematics/pspp/pspp-0.8.3.ebuild90
-rw-r--r--sci-mathematics/pymc/Manifest1
-rw-r--r--sci-mathematics/pymc/metadata.xml15
-rw-r--r--sci-mathematics/pymc/pymc-2.2.ebuild24
-rw-r--r--sci-mathematics/pymc/pymc-9999.ebuild24
-rw-r--r--sci-mathematics/qtoctave/Manifest1
-rw-r--r--sci-mathematics/qtoctave/files/qtoctave-0.10.1-build-out-of-source.patch20
-rw-r--r--sci-mathematics/qtoctave/files/qtoctave-0.10.1-build-widgetserver.patch98
-rw-r--r--sci-mathematics/qtoctave/files/qtoctave-0.10.1-desktop-file.patch8
-rw-r--r--sci-mathematics/qtoctave/files/qtoctave-0.10.1-doc-path.patch64
-rw-r--r--sci-mathematics/qtoctave/files/qtoctave-0.10.1-filedialog-filters.patch37
-rw-r--r--sci-mathematics/qtoctave/files/qtoctave-0.10.1-initial_position.patch61
-rw-r--r--sci-mathematics/qtoctave/files/qtoctave-0.10.1-no-native-menubars.patch35
-rw-r--r--sci-mathematics/qtoctave/files/qtoctave-0.10.1-qtinfo-octave3.4.patch15
-rw-r--r--sci-mathematics/qtoctave/files/qtoctave-0.10.1-use_octave_htmldoc.patch34
-rw-r--r--sci-mathematics/qtoctave/metadata.xml13
-rw-r--r--sci-mathematics/qtoctave/qtoctave-0.10.1-r1.ebuild48
-rw-r--r--sci-mathematics/reduce/Manifest1
-rw-r--r--sci-mathematics/reduce/files/64reduce-gentoo.el4
-rwxr-xr-xsci-mathematics/reduce/files/csl2
-rwxr-xr-xsci-mathematics/reduce/files/redcsl2
-rw-r--r--sci-mathematics/reduce/metadata.xml16
-rw-r--r--sci-mathematics/reduce/reduce-20110414-r1.ebuild95
-rw-r--r--sci-mathematics/relational/Manifest1
-rw-r--r--sci-mathematics/relational/metadata.xml8
-rw-r--r--sci-mathematics/relational/relational-0.11.ebuild51
-rw-r--r--sci-mathematics/rkward/Manifest1
-rw-r--r--sci-mathematics/rkward/metadata.xml13
-rw-r--r--sci-mathematics/rkward/rkward-0.6.1.ebuild37
-rw-r--r--sci-mathematics/rngstreams/Manifest1
-rw-r--r--sci-mathematics/rngstreams/metadata.xml12
-rw-r--r--sci-mathematics/rngstreams/rngstreams-1.0.1.ebuild25
-rw-r--r--sci-mathematics/rstudio/Manifest20
-rw-r--r--sci-mathematics/rstudio/files/rsession.conf26
-rw-r--r--sci-mathematics/rstudio/files/rstudio-0.97.318-linker_flags.patch18
-rw-r--r--sci-mathematics/rstudio/files/rstudio-0.97.318-paths.patch110
-rw-r--r--sci-mathematics/rstudio/files/rstudio-0.97.318-prefs.patch24
-rw-r--r--sci-mathematics/rstudio/files/rstudio-0.97.336-boost-1.53.patch64
-rw-r--r--sci-mathematics/rstudio/files/rstudio-0.97.336-linker_flags.patch18
-rw-r--r--sci-mathematics/rstudio/files/rstudio-0.97.336-paths.patch112
-rw-r--r--sci-mathematics/rstudio/files/rstudio-0.97.336-prefs.patch24
-rw-r--r--sci-mathematics/rstudio/files/rstudio-0.97.551-boost-1.53.patch64
-rw-r--r--sci-mathematics/rstudio/files/rstudio-0.97.551-linker_flags.patch18
-rw-r--r--sci-mathematics/rstudio/files/rstudio-0.97.551-paths.patch112
-rw-r--r--sci-mathematics/rstudio/files/rstudio-0.97.551-prefs.patch24
-rw-r--r--sci-mathematics/rstudio/files/rstudio-0.98.1091-boost-1.57.patch60
-rw-r--r--sci-mathematics/rstudio/files/rstudio-0.98.1091-pandoc.patch26
-rw-r--r--sci-mathematics/rstudio/files/rstudio-0.98.490-linker_flags.patch18
-rw-r--r--sci-mathematics/rstudio/files/rstudio-0.98.490-paths.patch120
-rw-r--r--sci-mathematics/rstudio/files/rstudio-0.98.490-prefs.patch24
-rw-r--r--sci-mathematics/rstudio/files/rstudio-0.98.932-pandoc.patch25
-rw-r--r--sci-mathematics/rstudio/files/rstudio-0.98.932-paths.patch140
-rw-r--r--sci-mathematics/rstudio/files/rstudio-server.conf35
-rw-r--r--sci-mathematics/rstudio/files/rstudio-server.initd15
-rw-r--r--sci-mathematics/rstudio/metadata.xml18
-rw-r--r--sci-mathematics/rstudio/rstudio-0.97.336.ebuild141
-rw-r--r--sci-mathematics/rstudio/rstudio-0.97.551.ebuild141
-rw-r--r--sci-mathematics/rstudio/rstudio-0.98.1028.ebuild162
-rw-r--r--sci-mathematics/rstudio/rstudio-0.98.1091.ebuild196
-rw-r--r--sci-mathematics/rstudio/rstudio-0.98.490-r1.ebuild127
-rw-r--r--sci-mathematics/rstudio/rstudio-0.98.490.ebuild140
-rw-r--r--sci-mathematics/rstudio/rstudio-0.98.932.ebuild172
-rw-r--r--sci-mathematics/rstudio/rstudio-0.98.953.ebuild173
-rw-r--r--sci-mathematics/rw/Manifest1
-rw-r--r--sci-mathematics/rw/metadata.xml28
-rw-r--r--sci-mathematics/rw/rw-0.7.ebuild41
-rw-r--r--sci-mathematics/sha1-polyml/Manifest1
-rw-r--r--sci-mathematics/sha1-polyml/metadata.xml14
-rw-r--r--sci-mathematics/sha1-polyml/sha1-polyml-5.5.0.ebuild79
-rw-r--r--sci-mathematics/singular/Manifest4
-rw-r--r--sci-mathematics/singular/files/60singular-gentoo.el10
-rw-r--r--sci-mathematics/singular/files/singular-3.0.4.4-nostrip.patch12
-rw-r--r--sci-mathematics/singular/files/singular-3.1.0-emacs-22.patch13
-rw-r--r--sci-mathematics/singular/files/singular-3.1.0-gentoo.patch81
-rw-r--r--sci-mathematics/singular/files/singular-3.1.3.2-python.patch45
-rw-r--r--sci-mathematics/singular/files/singular-3.1.3.3-Minor.h.patch10
-rw-r--r--sci-mathematics/singular/files/singular-3.1.3.3-install_name.patch23
-rw-r--r--sci-mathematics/singular/files/singular-3.1.3.3-os_x_ppc.patch14
-rw-r--r--sci-mathematics/singular/files/singular-3.1.3.3.make_parallel.2.patch45
-rw-r--r--sci-mathematics/singular/files/singular-3.1.6-factory_template_instantiation.patch26
-rw-r--r--sci-mathematics/singular/files/singular-3.1.6-ntl6compat.patch44
-rw-r--r--sci-mathematics/singular/files/singular-4.0.0-fix-omalloc-ar-detection.patch12
-rw-r--r--sci-mathematics/singular/files/singular-4.0.2-ntl8-compat.patch38
-rw-r--r--sci-mathematics/singular/metadata.xml12
-rw-r--r--sci-mathematics/singular/singular-3.1.6.ebuild176
-rw-r--r--sci-mathematics/singular/singular-4.0.2.ebuild145
-rw-r--r--sci-mathematics/snns/Manifest8
-rw-r--r--sci-mathematics/snns/files/4.2-fPIC-python.patch12
-rw-r--r--sci-mathematics/snns/files/4.2-ldflags.patch42
-rw-r--r--sci-mathematics/snns/files/4.3-bison-version.patch11
-rw-r--r--sci-mathematics/snns/files/4.3-snns-netperf.patch164
-rw-r--r--sci-mathematics/snns/files/4.3-unstrip.patch11
-rw-r--r--sci-mathematics/snns/metadata.xml9
-rw-r--r--sci-mathematics/snns/snns-4.2-r8.ebuild134
-rw-r--r--sci-mathematics/snns/snns-4.2-r9.ebuild123
-rw-r--r--sci-mathematics/snns/snns-4.3-r2.ebuild124
-rw-r--r--sci-mathematics/spass/Manifest1
-rw-r--r--sci-mathematics/spass/metadata.xml15
-rw-r--r--sci-mathematics/spass/spass-3.7.ebuild81
-rw-r--r--sci-mathematics/spin/Manifest3
-rw-r--r--sci-mathematics/spin/files/spin-6.0.1-makefile.patch21
-rw-r--r--sci-mathematics/spin/files/spin-6.2.1-makefile.patch21
-rw-r--r--sci-mathematics/spin/files/spin-6.2.5-makefile.patch21
-rw-r--r--sci-mathematics/spin/metadata.xml8
-rw-r--r--sci-mathematics/spin/spin-6.2.1.ebuild43
-rw-r--r--sci-mathematics/spin/spin-6.2.3.ebuild48
-rw-r--r--sci-mathematics/spin/spin-6.2.5.ebuild48
-rw-r--r--sci-mathematics/topcom/Manifest2
-rw-r--r--sci-mathematics/topcom/files/topcom-0.17.4-buildsystem.patch105
-rw-r--r--sci-mathematics/topcom/files/topcom-0.17.4-no-internal-libs.patch77
-rw-r--r--sci-mathematics/topcom/metadata.xml12
-rw-r--r--sci-mathematics/topcom/topcom-0.17.4-r1.ebuild60
-rw-r--r--sci-mathematics/twelf/Manifest1
-rw-r--r--sci-mathematics/twelf/files/50twelf-gentoo.el4
-rw-r--r--sci-mathematics/twelf/files/twelf-1.7.1-Makefile.patch43
-rw-r--r--sci-mathematics/twelf/files/twelf-1.7.1-doc-guide-Makefile.patch13
-rw-r--r--sci-mathematics/twelf/files/twelf-1.7.1-doc-guide-twelf-dot-texi.patch14
-rw-r--r--sci-mathematics/twelf/files/twelf-1.7.1-emacs-twelf-init.patch22
-rw-r--r--sci-mathematics/twelf/files/twelf-1.7.1-emacs-twelf.patch11
-rw-r--r--sci-mathematics/twelf/files/twelf-1.7.1-mlton-mlb.patch409
-rw-r--r--sci-mathematics/twelf/metadata.xml13
-rw-r--r--sci-mathematics/twelf/twelf-1.7.1.ebuild111
-rw-r--r--sci-mathematics/unuran/Manifest1
-rw-r--r--sci-mathematics/unuran/files/unuran-1.8.0-nogsl.patch48
-rw-r--r--sci-mathematics/unuran/metadata.xml16
-rw-r--r--sci-mathematics/unuran/unuran-1.8.1.ebuild45
-rw-r--r--sci-mathematics/wxmaxima/Manifest2
-rw-r--r--sci-mathematics/wxmaxima/metadata.xml15
-rw-r--r--sci-mathematics/wxmaxima/wxmaxima-13.04.2.ebuild80
-rw-r--r--sci-mathematics/wxmaxima/wxmaxima-15.04.0-r1.ebuild77
-rw-r--r--sci-mathematics/xmds/Manifest3
-rw-r--r--sci-mathematics/xmds/files/xmds-1.6.5-gcc43.patch108
-rw-r--r--sci-mathematics/xmds/metadata.xml18
-rw-r--r--sci-mathematics/xmds/xmds-1.6.5.ebuild58
-rw-r--r--sci-mathematics/xmds/xmds-1.6.6.ebuild51
-rw-r--r--sci-mathematics/yacas/Manifest3
-rw-r--r--sci-mathematics/yacas/files/yacas-1.3.4-java-version.patch29
-rw-r--r--sci-mathematics/yacas/metadata.xml16
-rw-r--r--sci-mathematics/yacas/yacas-1.3.2.ebuild46
-rw-r--r--sci-mathematics/yacas/yacas-1.3.3.ebuild46
-rw-r--r--sci-mathematics/yacas/yacas-1.3.4.ebuild55
-rw-r--r--sci-mathematics/yafu/Manifest1
-rw-r--r--sci-mathematics/yafu/files/fix-Makefile.patch11
-rw-r--r--sci-mathematics/yafu/metadata.xml11
-rw-r--r--sci-mathematics/yafu/yafu-1.34.3.ebuild56
-rw-r--r--sci-mathematics/yafu/yafu-9999.ebuild56
604 files changed, 28884 insertions, 0 deletions
diff --git a/sci-mathematics/4ti2/4ti2-1.6.2.ebuild b/sci-mathematics/4ti2/4ti2-1.6.2.ebuild
new file mode 100644
index 000000000000..ff139bab6de9
--- /dev/null
+++ b/sci-mathematics/4ti2/4ti2-1.6.2.ebuild
@@ -0,0 +1,38 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+AUTOTOOLS_AUTORECONF=true
+# The swig subdir is not used, so we can skip running autotools in it. #518000
+AT_NO_RECURSIVE=1
+
+inherit autotools-utils
+
+DESCRIPTION="Software package for algebraic, geometric and combinatorial problems"
+HOMEPAGE="http://www.4ti2.de/"
+SRC_URI="http://4ti2.de/version_${PV}/${P}.tar.gz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="amd64 x86 ~x86-macos"
+IUSE="static-libs"
+
+DEPEND="
+ sci-mathematics/glpk:0[gmp]
+ dev-libs/gmp[cxx]"
+RDEPEND="${DEPEND}"
+
+AUTOTOOLS_IN_SOURCE_BUILD=1
+
+PATCHES=(
+ "${FILESDIR}"/${PN}-1.3.2-gold.patch
+ )
+
+src_prepare() {
+ sed \
+ -e "s:^CXX.*$:CXX=$(tc-getCXX):g" \
+ -i m4/glpk-check.m4 || die
+ autotools-utils_src_prepare
+}
diff --git a/sci-mathematics/4ti2/4ti2-1.6.5.ebuild b/sci-mathematics/4ti2/4ti2-1.6.5.ebuild
new file mode 100644
index 000000000000..dff289ba2edc
--- /dev/null
+++ b/sci-mathematics/4ti2/4ti2-1.6.5.ebuild
@@ -0,0 +1,38 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+AUTOTOOLS_AUTORECONF=true
+# The swig subdir is not used, so we can skip running autotools in it. #518000
+AT_NO_RECURSIVE=1
+
+inherit autotools-utils
+
+DESCRIPTION="Software package for algebraic, geometric and combinatorial problems"
+HOMEPAGE="http://www.4ti2.de/"
+SRC_URI="http://4ti2.de/version_${PV}/${P}.tar.gz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~amd64 ~x86 ~x86-macos"
+IUSE="static-libs"
+
+DEPEND="
+ sci-mathematics/glpk:0[gmp]
+ dev-libs/gmp[cxx]"
+RDEPEND="${DEPEND}"
+
+AUTOTOOLS_IN_SOURCE_BUILD=1
+
+PATCHES=(
+ "${FILESDIR}"/${PN}-1.3.2-gold.patch
+ )
+
+src_prepare() {
+ sed \
+ -e "s:^CXX.*$:CXX=$(tc-getCXX):g" \
+ -i m4/glpk-check.m4 || die
+ autotools-utils_src_prepare
+}
diff --git a/sci-mathematics/4ti2/4ti2-1.6.6.ebuild b/sci-mathematics/4ti2/4ti2-1.6.6.ebuild
new file mode 100644
index 000000000000..ff6ee4ba63e5
--- /dev/null
+++ b/sci-mathematics/4ti2/4ti2-1.6.6.ebuild
@@ -0,0 +1,38 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+AUTOTOOLS_AUTORECONF=true
+# The swig subdir is not used, so we can skip running autotools in it. #518000
+AT_NO_RECURSIVE=1
+
+inherit autotools-utils
+
+DESCRIPTION="Software package for algebraic, geometric and combinatorial problems"
+HOMEPAGE="http://www.4ti2.de/"
+SRC_URI="http://4ti2.de/version_${PV}/${P}.tar.gz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="amd64 ~x86 ~x86-macos"
+IUSE="static-libs"
+
+DEPEND="
+ sci-mathematics/glpk:0[gmp]
+ dev-libs/gmp[cxx]"
+RDEPEND="${DEPEND}"
+
+AUTOTOOLS_IN_SOURCE_BUILD=1
+
+PATCHES=(
+ "${FILESDIR}"/${PN}-1.3.2-gold.patch
+ )
+
+src_prepare() {
+ sed \
+ -e "s:^CXX.*$:CXX=$(tc-getCXX):g" \
+ -i m4/glpk-check.m4 || die
+ autotools-utils_src_prepare
+}
diff --git a/sci-mathematics/4ti2/Manifest b/sci-mathematics/4ti2/Manifest
new file mode 100644
index 000000000000..eda26f1f47d0
--- /dev/null
+++ b/sci-mathematics/4ti2/Manifest
@@ -0,0 +1,3 @@
+DIST 4ti2-1.6.2.tar.gz 5531651 SHA256 e1b39c5c051904e41deefce5419b16d723b1f403c616ddd6e3610e260d4b5711 SHA512 ff68f767b8677ce0ce94cca39fa3ef87835d77a951f0ec6ae28ab171bf09ae25c551d88c2cdf5bf3115b33bd32366b063533a1c22576130a00f542f9370bcd7b WHIRLPOOL f125cee526f8d2693b01978fd39cc36c900e7611ac0b8026f33c68ec8ccb0bb29cdffdf5c11adc6a5f7041389d34e6cacff173437c4be725c9b390a25e24e397
+DIST 4ti2-1.6.5.tar.gz 5640117 SHA256 079abe725fb1cc811184eca1d079a51f701a20c02c894422be59cd923c2cd21b SHA512 90dc105d99659e3c2213b484b6d21e877d7484ca0ad0373ece066df26de7c0e0cce614faaae9f7b678d03fa54f987fe95ab6d3f958477b1294a2dc00733a3a08 WHIRLPOOL b72d84e4e9557f85cadd3d93305b19162e85321bbc8dc974febe5f01e4a218c61d5e831de0ae8fc294e0f21c2469c663e53dde41f2e943db9df6011b758c1ccf
+DIST 4ti2-1.6.6.tar.gz 5640126 SHA256 2ae9f7dd6a387fd6f0454b4bc2d02cf389f504230cc9f782c35bb5ea4a8df10a SHA512 89f36aaf3d8f41bb31b37b44a013ea966d9664880473ad0d6d1825ffb00afec1eff3139c09ac6b684f0679e2ae0d201a84396bb721aa1f63dc1deca592392c41 WHIRLPOOL c5255ffe43eb65ec7d19f8cf24de3ab69e5f2466a91009a336a367cfab768d882781a91ab82d3077600edc08c6fb3f6f3686536e8e5bcbc6a1ca16f1feaa0ef0
diff --git a/sci-mathematics/4ti2/files/4ti2-1.3.2-gold.patch b/sci-mathematics/4ti2/files/4ti2-1.3.2-gold.patch
new file mode 100644
index 000000000000..bb1e8c4aad39
--- /dev/null
+++ b/sci-mathematics/4ti2/files/4ti2-1.3.2-gold.patch
@@ -0,0 +1,17 @@
+ m4/glpk-check.m4 | 2 +-
+ src/groebner/Makefile.am | 2 +-
+ 2 files changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/src/groebner/Makefile.am b/src/groebner/Makefile.am
+index 992c4ae..ba2f463 100644
+--- a/src/groebner/Makefile.am
++++ b/src/groebner/Makefile.am
+@@ -269,7 +269,7 @@ lib4ti2int64_la_SOURCES = $(lib4ti2sources)
+ # Arbitrary precision flags.
+ # 4ti2 uses GMP (GLPL), an arbitrary precision arithmetic library.
+ if HAVE_GMP_WITH_CXX
+-4ti2gmp_LDADD = lib4ti2gmp.la
++4ti2gmp_LDADD = lib4ti2gmp.la -lgmp
+ 4ti2gmp_CPPFLAGS = -D_4ti2_GMP_ $(GMP_CFLAGS)
+ 4ti2gmp_SOURCES = $(4ti2sources)
+ lib4ti2gmp_la_CPPFLAGS = -D_4ti2_GMP_
diff --git a/sci-mathematics/4ti2/metadata.xml b/sci-mathematics/4ti2/metadata.xml
new file mode 100644
index 000000000000..2b81252f2c50
--- /dev/null
+++ b/sci-mathematics/4ti2/metadata.xml
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <maintainer>
+ <email>tomka@gentoo.org</email>
+ <name>Thomas Kahle</name>
+ </maintainer>
+ <herd>sci-mathematics</herd>
+ <longdescription lang="en">
+4ti2 is a software package for algebraic, geometric and combinatorial problems
+on linear spaces and for toric ideals too.
+</longdescription>
+</pkgmetadata>
diff --git a/sci-mathematics/Macaulay2/Macaulay2-1.7_pre.ebuild b/sci-mathematics/Macaulay2/Macaulay2-1.7_pre.ebuild
new file mode 100644
index 000000000000..b7bd82d811d8
--- /dev/null
+++ b/sci-mathematics/Macaulay2/Macaulay2-1.7_pre.ebuild
@@ -0,0 +1,154 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+PYTHON_COMPAT=( python2_7 )
+
+inherit autotools elisp-common eutils flag-o-matic python-single-r1 toolchain-funcs
+
+FACTORY="factory-4.0.0+m4"
+FACTORY_GFTABLES="factory.4.0.1-gftables"
+
+DESCRIPTION="Research tool for commutative algebra and algebraic geometry"
+HOMEPAGE="http://www.math.uiuc.edu/Macaulay2/"
+BASE_URI="http://www.math.uiuc.edu/Macaulay2/Downloads/OtherSourceCode/trunk"
+SRC_URI="
+ http://dev.gentoo.org/~tomka/files/${P}.tar.bz2
+ ${BASE_URI}/${FACTORY}.tar.gz
+ ${BASE_URI}/${FACTORY_GFTABLES}.tar.gz
+ ${BASE_URI}/gtest-1.7.0.tar.gz"
+
+SLOT="0"
+LICENSE="GPL-2"
+KEYWORDS="amd64 x86"
+IUSE="debug emacs +optimization"
+
+REQUIRED_USE="${PYTHON_REQUIRED_USE}"
+
+DEPEND="${PYTHON_DEPS}
+ sys-process/time
+ virtual/pkgconfig"
+
+RDEPEND="${PYTHON_DEPS}
+ sys-libs/gdbm
+ <dev-libs/ntl-7
+ sci-mathematics/pari[gmp]
+ >=sys-libs/readline-6.1
+ dev-libs/libxml2:2
+ sci-mathematics/flint[gc]
+ sci-mathematics/frobby
+ sci-mathematics/4ti2
+ sci-mathematics/nauty
+ >=sci-mathematics/normaliz-2.8
+ sci-mathematics/gfan
+ sci-libs/mpir[cxx]
+ dev-libs/mpfr
+ sci-libs/cdd+
+ sci-libs/cddlib
+ sci-libs/lrslib[gmp]
+ virtual/blas
+ virtual/lapack
+ dev-util/ctags
+ sys-libs/ncurses
+ >=dev-libs/boehm-gc-7.4[threads]
+ dev-libs/libatomic_ops
+ emacs? ( virtual/emacs )"
+
+SITEFILE=70Macaulay2-gentoo.el
+
+S="${WORKDIR}/M2/"
+
+pkg_setup () {
+ tc-export CC CPP CXX PKG_CONFIG
+ append-cppflags "-I/usr/include/frobby"
+ # gtest needs python:2
+ python-single-r1_pkg_setup
+}
+
+src_prepare() {
+ # Patching .m2 files to look for external programs in
+ # /usr/bin
+ epatch "${FILESDIR}"/1.6-paths-of-external-programs.patch
+
+ # Shortcircuit lapack tests
+ epatch "${FILESDIR}"/1.6-lapack.patch
+
+ # Factory is a statically linked library which (in this flavor) are not used by any
+ # other program. We build it internally and don't install it.
+ cp "${DISTDIR}/${FACTORY}.tar.gz" "${S}/BUILD/tarfiles/" \
+ || die "copy failed"
+ cp "${DISTDIR}/${FACTORY_GFTABLES}.tar.gz" "${S}/BUILD/tarfiles/" \
+ || die "copy failed"
+ # Macaulay2 developers want that gtest is built internally because
+ # the documentation says it may fail if build with options not the
+ # same as the tested program.
+ cp "${DISTDIR}/gtest-1.7.0.tar.gz" "${S}/BUILD/tarfiles/" \
+ || die "copy failed"
+
+ eautoreconf
+}
+
+src_configure (){
+ # Recommended in bug #268064 Possibly unecessary
+ # but should not hurt anybody.
+ if ! use emacs; then
+ tags="ctags"
+ fi
+
+ # configure instead of econf to enable install with --prefix
+ ./configure LIBS="$($(tc-getPKG_CONFIG) --libs lapack)" \
+ --prefix="${D}/usr" \
+ --disable-encap \
+ --disable-strip \
+ --with-issue=Gentoo \
+ $(use_enable optimization optimize) \
+ $(use_enable debug) \
+ --enable-build-libraries="factory" \
+ --with-unbuilt-programs="4ti2 gfan normaliz nauty cddplus lrslib" \
+ || die "failed to configure Macaulay"
+}
+
+src_compile() {
+ # Parallel build not supported yet
+ emake IgnoreExampleErrors=true -j1
+
+ if use emacs; then
+ cd "${S}/Macaulay2/emacs" || die
+ elisp-compile *.el
+ fi
+}
+
+src_test() {
+ # No parallel tests yet & Need to increase the time
+ # limit for long running tests in Schubert2 to pass
+ emake TLIMIT=550 -j1 check
+}
+
+src_install () {
+ # Parallel install not supported yet
+ emake IgnoreExampleErrors=true -j1 install
+
+ # Remove emacs files and install them in the
+ # correct place if use emacs
+ rm -rf "${ED}"/usr/share/emacs/site-lisp || die
+ if use emacs; then
+ cd "${S}/Macaulay2/emacs" || die
+ elisp-install ${PN} *.elc *.el
+ elisp-site-file-install "${FILESDIR}/${SITEFILE}"
+ fi
+}
+
+pkg_postinst() {
+ if use emacs; then
+ elisp-site-regen
+ elog "If you want to set a hot key for Macaulay2 in Emacs add a line similar to"
+ elog "(global-set-key [ f12 ] 'M2)"
+ elog "in order to set it to F12 (or choose a different one)."
+ fi
+}
+
+pkg_postrm() {
+ use emacs && elisp-site-regen
+}
diff --git a/sci-mathematics/Macaulay2/Manifest b/sci-mathematics/Macaulay2/Manifest
new file mode 100644
index 000000000000..1cab32948f73
--- /dev/null
+++ b/sci-mathematics/Macaulay2/Manifest
@@ -0,0 +1,4 @@
+DIST Macaulay2-1.7_pre.tar.bz2 4639477 SHA256 b14918187724f8911bc50edf87c9692209ff0c2191feb257084adc87609eb1cd SHA512 e70376d1e54b6e239ebb3bf676507a2115fdf5c4fbe05f320553029a84114b74d78f54e4d1bdc7643131f3c45c301e83c21ff99e4d4b675372e971368398d6f5 WHIRLPOOL 396311aadb8a7845deaee5aeca49c431430abc46201e935ef72c4579c9cbe6cd4da85f3e09ff0fe647031f8050fb7c62f63ecce251bf34648c1848cd00eef68e
+DIST factory-4.0.0+m4.tar.gz 4711126 SHA256 9b2498cc7fc6765f1c586e8061ebe236cdce4b32a44721a235ad2644ec3124fb SHA512 1dacb9aae52e655bccbbc960397b02351050791594dd9c39771f0da7f8c6e8130a8827c2a675c3fbaaa214606e123ac9776e1c73d143649353cefc50cadeea3e WHIRLPOOL 47c4d6261fc6cc9c172035d8774f0cde9fa669fa164fc4a0f47e84ba789d69d14f5a16d042451564412fdedddec71335714ad751508495c22cea25b69f10b925
+DIST factory.4.0.1-gftables.tar.gz 2974152 SHA256 9cd158ceb1c2b1c47bdca2c0b004bba92cb0e0aaa0ea6a43ca784ebdce10eebd SHA512 060c58fe6e4565dd5e7649bfa070f14dec3c383a55ebab52a9f02b58a6405e2183e0c7e08964cddb87b81e872c0d8a52d7bd4575d07269547be544cf6a725a76 WHIRLPOOL a721a6824681118578c7289cea77a3f47e5c7654f30dc454eaac76b19cc89e416ae54b8d21a69f897d7087d4b67990634fc960f81df2ea53f428868d608dc9c2
+DIST gtest-1.7.0.tar.gz 1001582 SHA256 c0f860eee47c86e0aeb462fd0bdfd70e3975297e0b8b178e0e03a95e1f6c9bc4 SHA512 a9f5c047b39efb2d11b55ee9913662ca402ac6837b3ad2d278ecfbd1caf32ed4546f169e3e92503d57bf3b62ccf89cd062da1c7ea3638aae98e868d2766363c3 WHIRLPOOL 36edbdf8be7c3793a89918a3c43d74e75a6281a37c394f7d2f20506130a76aab04a3beddba01bf7f0e9b6901c7e834ca014c31c913c0ea846d3f6be9c93599d2
diff --git a/sci-mathematics/Macaulay2/files/1.6-lapack.patch b/sci-mathematics/Macaulay2/files/1.6-lapack.patch
new file mode 100644
index 000000000000..e9a434eeb28e
--- /dev/null
+++ b/sci-mathematics/Macaulay2/files/1.6-lapack.patch
@@ -0,0 +1,50 @@
+--- configure.ac 2012-10-24 09:29:55.240498786 -0700
++++ configure.ac.2 2012-10-30 15:07:27.172846300 -0700
+@@ -1285,46 +1285,7 @@
+ done
+ test $BUILD_factory = yes && BUILTLIBS="$SINGULARLIBS $BUILTLIBS"
+
+-# we need to do the fortran library testing last, in case AC_SEARCH_LIBS adds
+-# one of them to $LIBS, making it impossible to check for the presence of C or
+-# C++ libraries. (I'm not sure why putting -llapack on the gcc command line
+-# needlessly causes the library to be linked against.)
+-FORTRANUSED=no
+-if test "$LAPACK" = yes
+-then AC_MSG_CHECKING([whether the vecLib framework is available])
+- SAVELIBS=$LIBS LIBS="-framework vecLib $LIBS"
+- AC_LANG(C)
+- AC_LINK_IFELSE(
+- [AC_LANG_PROGRAM(,[sgemv_();dgetrf_();])],
+- [
+- AC_MSG_RESULT(yes)
+- ],
+- [
+- AC_MSG_RESULT(no)
+- LIBS=$SAVELIBS
+- FORTRANUSED=yes
+- if test $BUILD_lapack = no
+- then AC_LANG(Fortran)
+- if test "$FC" = ""
+- then AC_MSG_ERROR(no fortran compiler found)
+- else AC_MSG_NOTICE(using fortran compiler $FC)
+- fi
+- AC_SEARCH_LIBS(sgemv,blas f77blas,,BUILD_lapack=yes)
+- AC_SEARCH_LIBS(dgetrf,lapack,,BUILD_lapack=yes)
+- fi
+- ])
+-fi
+-test $BUILD_lapack = yes && BUILTLIBS="-llapack -lblas $BUILTLIBS"
+-
+-if test $BUILD_lapack = yes
+-then # test whether the fortran compiler can handle lapack, which, starting with
+- # version 3.2, requires fortran 90, not fortran 77
+- AC_LANG(Fortran)
+- AC_MSG_CHECKING([whether the fortran compiler is modern enough for lapack])
+- AC_COMPILE_IFELSE([instrinsic maxloc],
+- AC_MSG_ERROR(the fortran compiler ($FC) does not support the Fortran 90 language required for compiling lapack),
+- AC_MSG_RESULT(yes))
+-fi
++BUILTLIBS="$(${PKG_CONFIG} --libs lapack) $BUILTLIBS"
+
+ if test $BUILD_memtailor = yes
+ then BUILTLIBS="-lmemtailor $BUILTLIBS"
diff --git a/sci-mathematics/Macaulay2/files/1.6-paths-of-external-programs.patch b/sci-mathematics/Macaulay2/files/1.6-paths-of-external-programs.patch
new file mode 100644
index 000000000000..4c090deec9d8
--- /dev/null
+++ b/sci-mathematics/Macaulay2/files/1.6-paths-of-external-programs.patch
@@ -0,0 +1,73 @@
+diff -U 3 -dHrN M2source/Macaulay2/packages/FourTiTwo.m2 M2source.patch/Macaulay2/packages/FourTiTwo.m2
+--- M2source/Macaulay2/packages/FourTiTwo.m2 2011-09-22 14:36:51.000000000 +0100
++++ M2source.patch/Macaulay2/packages/FourTiTwo.m2 2011-09-24 21:24:12.000000000 +0100
+@@ -47,7 +47,7 @@
+
+ path'4ti2 = (options FourTiTwo).Configuration#"path"
+ -- NOTE: the absolute path should be put into the .init file for 4ti2 inside the .Macaulay2 directory.
+-if path'4ti2 == "" then path'4ti2 = prefixDirectory | currentLayout#"programs"
++if path'4ti2 == "" then path'4ti2 = "/usr/bin/"
+
+ getFilename = () -> (
+ filename := temporaryFileName();
+diff -U 3 -dHrN M2source/Macaulay2/packages/gfanInterface.m2 M2source.patch/Macaulay2/packages/gfanInterface.m2
+--- M2source/Macaulay2/packages/gfanInterface.m2 2011-05-14 12:00:59.000000000 +0100
++++ M2source.patch/Macaulay2/packages/gfanInterface.m2 2011-09-24 21:24:12.000000000 +0100
+@@ -25,7 +25,7 @@
+ }
+
+ gfan'path = gfanInterface#Options#Configuration#"path"
+-if gfan'path == "" then gfan'path = prefixDirectory | currentLayout#"programs"
++if gfan'path == "" then gfan'path = "/usr/bin/"
+ if instance(gfan'path, String) then gfan'path = {gfan'path}
+ if not instance(gfan'path,List) then error "expected configuration option gfan'path to be a list of strings or a string"
+ gfan'path = join(
+diff -U 3 -dHrN M2source/Macaulay2/packages/NautyGraphs.m2 M2source.patch/Macaulay2/packages/NautyGraphs.m2
+--- M2source/Macaulay2/packages/NautyGraphs.m2 2011-08-26 11:05:30.000000000 +0100
++++ M2source.patch/Macaulay2/packages/NautyGraphs.m2 2011-09-24 21:25:53.000000000 +0100
+@@ -32,7 +32,7 @@
+ -- Check the ~/.Macaulay2/init-NautyGraphs.m2 file for the absolute path.
+ -- If it's not there, then use the M2-Programs directory.
+ nauty'path = (options NautyGraphs).Configuration#"path";
+-if nauty'path == "" then nauty'path = prefixDirectory | currentLayout#"programs";
++if nauty'path == "" then nauty'path = "/usr/bin/";
+
+ -------------------
+ -- Exports
+diff -U 3 -dHrN M2source/Macaulay2/packages/Nauty.m2 M2source.patch/Macaulay2/packages/Nauty.m2
+--- M2source/Macaulay2/packages/Nauty.m2 2011-08-26 11:05:30.000000000 +0100
++++ M2source.patch/Macaulay2/packages/Nauty.m2 2011-09-24 21:24:12.000000000 +0100
+@@ -48,7 +48,8 @@
+ -- Check the ~/.Macaulay2/init-Nauty.m2 file for the absolute path.
+ -- If it's not there, then use the M2-Programs directory.
+ nauty'path = (options Nauty).Configuration#"path";
+-if nauty'path == "" then nauty'path = prefixDirectory | currentLayout#"programs";
++if nauty'path == "" then nauty'path = "/usr/bin/";
++
+
+ -------------------
+ -- Exports
+diff -U 3 -dHrN M2source/Macaulay2/packages/Normaliz.m2 M2source.patch/Macaulay2/packages/Normaliz.m2
+--- M2source/Macaulay2/packages/Normaliz.m2 2011-05-25 16:47:50.000000000 +0100
++++ M2source.patch/Macaulay2/packages/Normaliz.m2 2011-09-24 21:24:12.000000000 +0100
+@@ -166,7 +166,7 @@
+ nmzExec="normaliz";
+ );
+ -- return nmzExec;
+- return prefixDirectory | currentLayout#"programs" | nmzExec;
++ return "/usr/bin/" | nmzExec;
+ );
+
+
+diff -U 3 -dHrN M2source/Macaulay2/packages/StatePolytope.m2 M2source.patch/Macaulay2/packages/StatePolytope.m2
+--- M2source/Macaulay2/packages/StatePolytope.m2 2010-09-10 16:47:20.000000000 +0100
++++ M2source.patch/Macaulay2/packages/StatePolytope.m2 2011-09-24 21:24:12.000000000 +0100
+@@ -31,7 +31,7 @@
+
+
+ gfanCommand = (options StatePolytope)#Configuration#"gfan command"
+-if gfanCommand === "gfan" then gfanCommand = prefixDirectory | currentLayout#"programs" | gfanCommand
++if gfanCommand === "gfan" then gfanCommand = "/usr/bin/" | gfanCommand
+ gfanCommand = "!" | gfanCommand
+
+ --The next two functions print out the ring and the ideal in the format required by gfan
diff --git a/sci-mathematics/Macaulay2/files/70Macaulay2-gentoo.el b/sci-mathematics/Macaulay2/files/70Macaulay2-gentoo.el
new file mode 100644
index 000000000000..ac86e2132ed5
--- /dev/null
+++ b/sci-mathematics/Macaulay2/files/70Macaulay2-gentoo.el
@@ -0,0 +1,11 @@
+;; sci-mathematics/Macaulay2 init file
+
+(add-to-list 'load-path "/usr/share/emacs/site-lisp/Macaulay2")
+
+(defvar M2-exe "/usr/bin/M2" "*The default Macaulay2 executable name.")
+(autoload 'M2 "M2.el" "Run Macaulay 2 in a buffer." t)
+(autoload 'Macaulay2 "M2" "Run Macaulay 2 in a buffer, non-interactive." t)
+(autoload 'M2-mode "M2" "Macaulay 2 editing mode" t)
+(autoload 'm2-mode "M2" "Macaulay 2 editing mode, name in lower case" t)
+(autoload 'm2-comint-mode "M2" "Macaulay 2 command interpreter mode, name in lower case" t)
+(setq auto-mode-alist (append auto-mode-alist '(("\\.m2$" . M2-mode)))) \ No newline at end of file
diff --git a/sci-mathematics/Macaulay2/metadata.xml b/sci-mathematics/Macaulay2/metadata.xml
new file mode 100644
index 000000000000..3513de74db1a
--- /dev/null
+++ b/sci-mathematics/Macaulay2/metadata.xml
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <maintainer>
+ <email>tomka@gentoo.org</email>
+ <name>Thomas Kahle</name>
+ </maintainer>
+ <herd>sci-mathematics</herd>
+ <use>
+ <flag name="optimization">Accept upstream's choices for -O option, i.e. -O3 almost everywhere.</flag>
+ </use>
+ <longdescription lang="en">
+ Macaulay2 is a research tool for algraic geometry and commutative
+ algebra.
+</longdescription>
+</pkgmetadata>
diff --git a/sci-mathematics/agda-executable/Manifest b/sci-mathematics/agda-executable/Manifest
new file mode 100644
index 000000000000..3f091e256599
--- /dev/null
+++ b/sci-mathematics/agda-executable/Manifest
@@ -0,0 +1 @@
+DIST Agda-executable-2.3.0.1.tar.gz 1765 SHA256 614594c414c828c87abb1913741db66447c09617d57b92e58ffe445ceffed694 SHA512 8abdd2739a36a952bb754c069717be70e9fa74b55fc048c2877f7d0c6791a5a8f7944b3b3a97be754fd00431ff94b9f7c6f35f40b8376155952c4b9b414890b2 WHIRLPOOL 84b738ef4fb75d7dcff8c9cc0002509ff2ccc9bdd5e27c04472deed6df960047da907948f7d5e585a5e3e8f6caafc05cf2e25718cd9b575e4cf18a0e1e8cd422
diff --git a/sci-mathematics/agda-executable/agda-executable-2.3.0.1-r1.ebuild b/sci-mathematics/agda-executable/agda-executable-2.3.0.1-r1.ebuild
new file mode 100644
index 000000000000..b05e06178509
--- /dev/null
+++ b/sci-mathematics/agda-executable/agda-executable-2.3.0.1-r1.ebuild
@@ -0,0 +1,36 @@
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+# ebuild generated by hackport 0.3.9999
+
+CABAL_FEATURES="bin"
+inherit haskell-cabal eutils
+
+MY_PN="Agda-executable"
+MY_P="${MY_PN}-${PV}"
+
+DESCRIPTION="Command-line program for type-checking and compiling Agda programs"
+HOMEPAGE="http://wiki.portal.chalmers.se/agda/"
+SRC_URI="mirror://hackage/packages/archive/${MY_PN}/${PV}/${MY_P}.tar.gz"
+
+LICENSE="MIT"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE=""
+
+RDEPEND=""
+DEPEND="${RDEPEND}
+ >=sci-mathematics/agda-2.3.0.1
+ >=dev-haskell/cabal-1.8
+ >=dev-lang/ghc-6.10.4"
+
+S="${WORKDIR}/${MY_P}"
+
+src_prepare() {
+ cabal-mksetup
+ sed -e 's@Agda == 2.3.0.1@Agda >= 2.3.0.1@' \
+ -i "${S}/${MY_PN}.cabal" || die "Could not loosen dependencies"
+}
diff --git a/sci-mathematics/agda-executable/agda-executable-2.3.0.1-r2.ebuild b/sci-mathematics/agda-executable/agda-executable-2.3.0.1-r2.ebuild
new file mode 100644
index 000000000000..b6bc07a1c288
--- /dev/null
+++ b/sci-mathematics/agda-executable/agda-executable-2.3.0.1-r2.ebuild
@@ -0,0 +1,35 @@
+# Copyright 1999-2013 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+# ebuild generated by hackport 0.3.9999
+
+CABAL_FEATURES="bin"
+inherit haskell-cabal eutils
+
+MY_PN="Agda-executable"
+MY_P="${MY_PN}-${PV}"
+
+DESCRIPTION="Command-line program for type-checking and compiling Agda programs"
+HOMEPAGE="http://wiki.portal.chalmers.se/agda/"
+SRC_URI="mirror://hackage/packages/archive/${MY_PN}/${PV}/${MY_P}.tar.gz"
+
+LICENSE="MIT"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE=""
+
+RDEPEND=">=sci-mathematics/agda-2.3.0.1:="
+DEPEND="${RDEPEND}
+ >=dev-haskell/cabal-1.8
+ >=dev-lang/ghc-6.10.4"
+
+S="${WORKDIR}/${MY_P}"
+
+src_prepare() {
+ cabal-mksetup
+ sed -e 's@Agda == 2.3.0.1@Agda >= 2.3.0.1@' \
+ -i "${S}/${MY_PN}.cabal" || die "Could not loosen dependencies"
+}
diff --git a/sci-mathematics/agda-executable/metadata.xml b/sci-mathematics/agda-executable/metadata.xml
new file mode 100644
index 000000000000..58fbc0e32043
--- /dev/null
+++ b/sci-mathematics/agda-executable/metadata.xml
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <herd>haskell</herd>
+ <maintainer>
+ <email>haskell@gentoo.org</email>
+ </maintainer>
+ <longdescription>
+ This package provides a command-line program for type-checking and
+ compiling Agda programs. The program can also generate hyperlinked,
+ highlighted HTML files from Agda sources.
+ </longdescription>
+</pkgmetadata>
diff --git a/sci-mathematics/agda-lib-ffi/Manifest b/sci-mathematics/agda-lib-ffi/Manifest
new file mode 100644
index 000000000000..d8103164a7ee
--- /dev/null
+++ b/sci-mathematics/agda-lib-ffi/Manifest
@@ -0,0 +1,2 @@
+DIST agda-stdlib-2.4.2.3.tar.gz 252558 SHA256 bb444fb35096be277c07aa27652c24509449fee9188325bb13eaac68b91eca7d SHA512 d503fc2abd18ab8c367a1947301e0302a6ff9fcbb6376a01f016aa2ab7a9a967e5adb96c5013db1892f4acd9fab62bead11c58c4d443784aff1e42ee4ffd4aa9 WHIRLPOOL 829e5613f2e03cda80608ef0899db413c98a505c9ba595d3aacd12171fc2e30e18e72365770a85655c7670fc5d45103c3b186d2bf8d9697aebae15bc9f40feaf
+DIST lib-0.7.tar.gz 226400 SHA256 631a33e8e27ead32c85cc92a0a85849744d3b2960ef9675736d54288267ed2fa SHA512 557aa7b9b143f2e4a2249881a98c753035962bc5d9222241e6b4fe86aab8642986aa9db7ca6fc2b2da8486f9294ff30c4c2edfa0222ba95d9216ed2d0e00c114 WHIRLPOOL f51ba5c3430e9a8a11d8eacab3b6121c730e4a437286b88f743fc2521bf1941a889d5274dd4aa7f4fe283595b5ac29a8a35735d873eedc94505455178d167536
diff --git a/sci-mathematics/agda-lib-ffi/agda-lib-ffi-0.0.2-r2.ebuild b/sci-mathematics/agda-lib-ffi/agda-lib-ffi-0.0.2-r2.ebuild
new file mode 100644
index 000000000000..2774fd4407dd
--- /dev/null
+++ b/sci-mathematics/agda-lib-ffi/agda-lib-ffi-0.0.2-r2.ebuild
@@ -0,0 +1,31 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+# ebuild generated by hackport 0.3.5
+
+CABAL_FEATURES="lib"
+inherit haskell-cabal
+
+AGDA_PN="agda-stdlib"
+AGDA_PV="2.4.2.3"
+AGDA_P="${AGDA_PN}-${AGDA_PV}"
+
+DESCRIPTION="Auxiliary Haskell code used by Agda's standard library"
+HOMEPAGE="http://wiki.portal.chalmers.se/agda/"
+SRC_URI="https://github.com/agda/${AGDA_PN}/archive/${AGDA_PV}.tar.gz -> ${AGDA_P}.tar.gz"
+
+LICENSE="MIT"
+SLOT="0/${PV}"
+KEYWORDS="~amd64 ~x86"
+IUSE=""
+
+RDEPEND=">=dev-lang/ghc-6.10.4:=
+"
+DEPEND="${RDEPEND}
+ >=dev-haskell/cabal-1.8
+"
+
+S="${WORKDIR}/${AGDA_P}/ffi"
diff --git a/sci-mathematics/agda-lib-ffi/agda-lib-ffi-0.0.2.ebuild b/sci-mathematics/agda-lib-ffi/agda-lib-ffi-0.0.2.ebuild
new file mode 100644
index 000000000000..ba329a2a9dec
--- /dev/null
+++ b/sci-mathematics/agda-lib-ffi/agda-lib-ffi-0.0.2.ebuild
@@ -0,0 +1,34 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+# ebuild generated by hackport 0.3.5
+
+CABAL_FEATURES="lib"
+inherit haskell-cabal
+
+AGDA_P="lib-0.7"
+
+DESCRIPTION="Auxiliary Haskell code used by Agda's standard library"
+HOMEPAGE="http://wiki.portal.chalmers.se/agda/"
+SRC_URI="http://www.cse.chalmers.se/~nad/software/${AGDA_P}.tar.gz"
+
+LICENSE="MIT"
+SLOT="0/${PV}"
+KEYWORDS="~amd64 ~x86"
+IUSE=""
+
+RDEPEND=">=dev-lang/ghc-6.10.4:=
+"
+DEPEND="${RDEPEND}
+ >=dev-haskell/cabal-1.8
+"
+
+S="${WORKDIR}/${AGDA_P}/ffi"
+
+src_prepare() {
+ cabal_chdeps \
+ 'base >= 3.0.3.1 && < 4.7' 'base >= 3.0.3.1'
+}
diff --git a/sci-mathematics/agda-lib-ffi/metadata.xml b/sci-mathematics/agda-lib-ffi/metadata.xml
new file mode 100644
index 000000000000..1439b435aad6
--- /dev/null
+++ b/sci-mathematics/agda-lib-ffi/metadata.xml
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <herd>haskell</herd>
+ <maintainer>
+ <email>haskell@gentoo.org</email>
+ </maintainer>
+ <longdescription>
+ Auxiliary Haskell code used by Agda's standard library.
+ </longdescription>
+ <upstream>
+ <remote-id type="github">agda/agda-stdlib</remote-id>
+ </upstream>
+</pkgmetadata>
diff --git a/sci-mathematics/agda-stdlib/Manifest b/sci-mathematics/agda-stdlib/Manifest
new file mode 100644
index 000000000000..3065d6d022f2
--- /dev/null
+++ b/sci-mathematics/agda-stdlib/Manifest
@@ -0,0 +1,3 @@
+DIST agda-stdlib-0.8.tar.gz 246158 SHA256 e8b8380bb03871ee3348aa2df32201a387ca0af02171d32ac58664f58467ed0d SHA512 5ac3bda61eb209a4db650edbbdfb96b73cb58b24e43842957696a20a93454d9846a19e4866af0b736c2c3390184223473da75277e490a6a8348531431ca27af0 WHIRLPOOL ccb5f294cb303b7d502227a6f908fa4904c56c55af1c3897753da3f39c7271cd07c292b56e030b8d80f97e6d6a8ad9f0a5fba1f22e0d169bdb4cb79e6e2db060
+DIST agda-stdlib-0.9.tar.gz 248895 SHA256 923b487876235863e4f778aa40c508984b26636d50d531f0f31ca9dc45ab3717 SHA512 aa297e250c5d98ca3f267c5ef95fc33999f9b120256c1983774d814b940a0f5952e524024908e3716af71ad544a586576c1bae6cca19e63797b1d4004ba88413 WHIRLPOOL dd200c61e91e397dfc7de8f6269edaefc20aa3daf5ead9e9fbab62468e5385481a74d5cec62df88e5c5304e06dfbd47b1870f71f70aba7fad29eceb0d836e2b1
+DIST agda-stdlib-2.4.2.3.tar.gz 252558 SHA256 bb444fb35096be277c07aa27652c24509449fee9188325bb13eaac68b91eca7d SHA512 d503fc2abd18ab8c367a1947301e0302a6ff9fcbb6376a01f016aa2ab7a9a967e5adb96c5013db1892f4acd9fab62bead11c58c4d443784aff1e42ee4ffd4aa9 WHIRLPOOL 829e5613f2e03cda80608ef0899db413c98a505c9ba595d3aacd12171fc2e30e18e72365770a85655c7670fc5d45103c3b186d2bf8d9697aebae15bc9f40feaf
diff --git a/sci-mathematics/agda-stdlib/agda-stdlib-0.8.ebuild b/sci-mathematics/agda-stdlib/agda-stdlib-0.8.ebuild
new file mode 100644
index 000000000000..6ccbc88c9a05
--- /dev/null
+++ b/sci-mathematics/agda-stdlib/agda-stdlib-0.8.ebuild
@@ -0,0 +1,67 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+CABAL_FEATURES="bin"
+inherit haskell-cabal elisp-common
+
+DESCRIPTION="Agda standard library"
+HOMEPAGE="http://wiki.portal.chalmers.se/agda/"
+SRC_URI="https://github.com/agda/${PN}/archive/v${PV}.tar.gz -> ${P}.tar.gz"
+
+LICENSE="MIT"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE="profile +ffi"
+
+# filemanip is used in lib.cabal to make the GenerateEverything and
+# AllNonAsciiChars executables, so agda-stdlib does not require a subslot
+# dependency on filemanip.
+
+RDEPEND=">=sci-mathematics/agda-2.4:=[profile?]
+ =dev-haskell/filemanip-0.3*[profile?]
+ >=sci-mathematics/agda-executable-2.3.0.1:=
+ >=dev-lang/ghc-6.12.1
+ ffi? ( =sci-mathematics/agda-lib-ffi-0.0.2 )
+"
+DEPEND="${RDEPEND}
+ >=dev-haskell/cabal-1.8.0.2
+"
+
+SITEFILE="50${PN}-gentoo.el"
+
+src_prepare() {
+ cabal-mksetup
+}
+
+src_compile() {
+ haskell-cabal_src_compile
+ "${S}"/dist/build/GenerateEverything/GenerateEverything \
+ || die "GenerateEverything failed"
+ local prof
+ use profile && prof="--ghc-flag=-prof"
+ agda +RTS -K1G -RTS ${prof} \
+ -i "${S}" -i "${S}"/src "${S}"/Everything.agda || die
+ # Although my agda-9999 build has
+ # /var/tmp/portage/sci-mathematics/agda-9999/work/agda-9999/dist/build/autogen/Paths_Agda.hs
+ # containing:
+ # datadir = "/usr/share/agda-9999/ghc-7.6.1"
+ # it fails without the --css option like:
+ # /usr/share/agda-9999/ghc-7.4.1/Agda.css: copyFile: does not exist
+ local cssdir=$(egrep 'datadir *=' "${S}/dist/build/autogen/Paths_lib.hs" | sed -e 's@datadir = \(.*\)@\1@')
+ agda --html -i "${S}" -i "${S}"/src --css="${cssdir}/Agda.css" "${S}"/README.agda || die
+}
+
+src_test() {
+ agda -i "${S}" -i "${S}"/src README.agda || die
+}
+
+src_install() {
+ insinto usr/share/agda-stdlib
+ export INSOPTIONS=--preserve-timestamps
+ doins -r src/*
+ dodoc -r html/*
+ elisp-site-file-install "${FILESDIR}/${SITEFILE}" || die
+}
diff --git a/sci-mathematics/agda-stdlib/agda-stdlib-0.9.ebuild b/sci-mathematics/agda-stdlib/agda-stdlib-0.9.ebuild
new file mode 100644
index 000000000000..6ccbc88c9a05
--- /dev/null
+++ b/sci-mathematics/agda-stdlib/agda-stdlib-0.9.ebuild
@@ -0,0 +1,67 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+CABAL_FEATURES="bin"
+inherit haskell-cabal elisp-common
+
+DESCRIPTION="Agda standard library"
+HOMEPAGE="http://wiki.portal.chalmers.se/agda/"
+SRC_URI="https://github.com/agda/${PN}/archive/v${PV}.tar.gz -> ${P}.tar.gz"
+
+LICENSE="MIT"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE="profile +ffi"
+
+# filemanip is used in lib.cabal to make the GenerateEverything and
+# AllNonAsciiChars executables, so agda-stdlib does not require a subslot
+# dependency on filemanip.
+
+RDEPEND=">=sci-mathematics/agda-2.4:=[profile?]
+ =dev-haskell/filemanip-0.3*[profile?]
+ >=sci-mathematics/agda-executable-2.3.0.1:=
+ >=dev-lang/ghc-6.12.1
+ ffi? ( =sci-mathematics/agda-lib-ffi-0.0.2 )
+"
+DEPEND="${RDEPEND}
+ >=dev-haskell/cabal-1.8.0.2
+"
+
+SITEFILE="50${PN}-gentoo.el"
+
+src_prepare() {
+ cabal-mksetup
+}
+
+src_compile() {
+ haskell-cabal_src_compile
+ "${S}"/dist/build/GenerateEverything/GenerateEverything \
+ || die "GenerateEverything failed"
+ local prof
+ use profile && prof="--ghc-flag=-prof"
+ agda +RTS -K1G -RTS ${prof} \
+ -i "${S}" -i "${S}"/src "${S}"/Everything.agda || die
+ # Although my agda-9999 build has
+ # /var/tmp/portage/sci-mathematics/agda-9999/work/agda-9999/dist/build/autogen/Paths_Agda.hs
+ # containing:
+ # datadir = "/usr/share/agda-9999/ghc-7.6.1"
+ # it fails without the --css option like:
+ # /usr/share/agda-9999/ghc-7.4.1/Agda.css: copyFile: does not exist
+ local cssdir=$(egrep 'datadir *=' "${S}/dist/build/autogen/Paths_lib.hs" | sed -e 's@datadir = \(.*\)@\1@')
+ agda --html -i "${S}" -i "${S}"/src --css="${cssdir}/Agda.css" "${S}"/README.agda || die
+}
+
+src_test() {
+ agda -i "${S}" -i "${S}"/src README.agda || die
+}
+
+src_install() {
+ insinto usr/share/agda-stdlib
+ export INSOPTIONS=--preserve-timestamps
+ doins -r src/*
+ dodoc -r html/*
+ elisp-site-file-install "${FILESDIR}/${SITEFILE}" || die
+}
diff --git a/sci-mathematics/agda-stdlib/agda-stdlib-2.4.2.3.ebuild b/sci-mathematics/agda-stdlib/agda-stdlib-2.4.2.3.ebuild
new file mode 100644
index 000000000000..867f3557dcc3
--- /dev/null
+++ b/sci-mathematics/agda-stdlib/agda-stdlib-2.4.2.3.ebuild
@@ -0,0 +1,66 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+CABAL_FEATURES="bin"
+inherit haskell-cabal elisp-common
+
+DESCRIPTION="Agda standard library"
+HOMEPAGE="http://wiki.portal.chalmers.se/agda/"
+SRC_URI="https://github.com/agda/${PN}/archive/${PV}.tar.gz -> ${P}.tar.gz"
+
+LICENSE="MIT"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE="profile +ffi"
+
+# filemanip is used in lib.cabal to make the GenerateEverything and
+# AllNonAsciiChars executables, so agda-stdlib does not require a subslot
+# dependency on filemanip.
+
+RDEPEND="=sci-mathematics/agda-${PV}*:=[profile?]
+ =dev-haskell/filemanip-0.3*[profile?]
+ >=dev-lang/ghc-6.12.1
+ ffi? ( sci-mathematics/agda-lib-ffi )
+"
+DEPEND="${RDEPEND}
+ >=dev-haskell/cabal-1.8.0.2
+"
+
+SITEFILE="50${PN}-gentoo.el"
+
+src_prepare() {
+ cabal-mksetup
+}
+
+src_compile() {
+ haskell-cabal_src_compile
+ "${S}"/dist/build/GenerateEverything/GenerateEverything \
+ || die "GenerateEverything failed"
+ local prof
+ use profile && prof="--ghc-flag=-prof"
+ agda +RTS -K1G -RTS ${prof} \
+ -i "${S}" -i "${S}"/src "${S}"/Everything.agda || die
+ # Although my agda-9999 build has
+ # /var/tmp/portage/sci-mathematics/agda-9999/work/agda-9999/dist/build/autogen/Paths_Agda.hs
+ # containing:
+ # datadir = "/usr/share/agda-9999/ghc-7.6.1"
+ # it fails without the --css option like:
+ # /usr/share/agda-9999/ghc-7.4.1/Agda.css: copyFile: does not exist
+ local cssdir=$(egrep 'datadir *=' "${S}/dist/build/autogen/Paths_lib.hs" | sed -e 's@datadir = \(.*\)@\1@')
+ agda --html -i "${S}" -i "${S}"/src --css="${cssdir}/Agda.css" "${S}"/README.agda || die
+}
+
+src_test() {
+ agda -i "${S}" -i "${S}"/src README.agda || die
+}
+
+src_install() {
+ insinto usr/share/agda-stdlib
+ export INSOPTIONS=--preserve-timestamps
+ doins -r src/*
+ dodoc -r html/*
+ elisp-site-file-install "${FILESDIR}/${SITEFILE}" || die
+}
diff --git a/sci-mathematics/agda-stdlib/files/50agda-stdlib-gentoo.el b/sci-mathematics/agda-stdlib/files/50agda-stdlib-gentoo.el
new file mode 100644
index 000000000000..62264a4451a0
--- /dev/null
+++ b/sci-mathematics/agda-stdlib/files/50agda-stdlib-gentoo.el
@@ -0,0 +1 @@
+(setq agda2-include-dirs '("." "/usr/share/agda-stdlib"))
diff --git a/sci-mathematics/agda-stdlib/metadata.xml b/sci-mathematics/agda-stdlib/metadata.xml
new file mode 100644
index 000000000000..91a8ae913e04
--- /dev/null
+++ b/sci-mathematics/agda-stdlib/metadata.xml
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <herd>sci-mathematics</herd>
+ <herd>haskell</herd>
+ <longdescription lang="en">
+ Agda standard library.
+</longdescription>
+ <use>
+ <flag name="ffi">Install agda-lib-ffi for compilation using the MAlonzo backend</flag>
+ </use>
+ <upstream>
+ <remote-id type="github">agda/agda-stdlib</remote-id>
+ </upstream>
+</pkgmetadata>
diff --git a/sci-mathematics/agda/Manifest b/sci-mathematics/agda/Manifest
new file mode 100644
index 000000000000..913d70848612
--- /dev/null
+++ b/sci-mathematics/agda/Manifest
@@ -0,0 +1,3 @@
+DIST Agda-2.4.0.1.tar.gz 906887 SHA256 58e678b9d193e19d4e69d8899129d9ae16df08a394873af850797f03cc2cbe86 SHA512 edd56ecea83241f3cb1aca4ac1e17970acf122c323a4ff38e2b5d8e46e46b1afd90fbbd460a6674a51cbb13a7cbf3a57b489e91a92ce3e709b2fc3d659013601 WHIRLPOOL 4e94c4277e8be99bd5a513c274fd5712f1d4a3e99d1e626a3b195b9cf83f9216de62220cfb5e8298cc0f11560a9c32dc0116db3bd67c2240842fa798f733065c
+DIST Agda-2.4.2.2.tar.gz 963302 SHA256 2344107654d0cb2a18dcf179ed3ea0f427839e058771ed628da64fbaed55bbc3 SHA512 62376775255099570d9eb7814de77a239d0806669ee0993283429a400c7c45ca756c6735bab85b4d3a4b82defae544364ac9107fd622f2df1ebcbded3113204d WHIRLPOOL dd220346109b7e137cca2e3b091c581b0b4ed0e23340209c7eebc48b39d807a569c984fbe1aee813d18a7f953db86e82b6a6aa7e197e6a2c5569dc311625f45f
+DIST Agda-2.4.2.3.tar.gz 990268 SHA256 bc6def45e32498f51863d67acfbe048c039d630c6a36761ed27e99a5f68d7b27 SHA512 84c24c517c830128032af8de9c8ce9ed8d5333becf65e6c96d67104caae1b66fb37ae9bcdff8f42a3e2997f4dcef2f4ea5addd7c94c45a0533c833da9af4d55a WHIRLPOOL ccef337495a5bc6d4272821700126a793ac0cac8b0ebbef44be478b725545797959c0edba910b5e2b68076e7c5c01e98580ea40016d02b268960dfba5f62a24a
diff --git a/sci-mathematics/agda/agda-2.4.0.1.ebuild b/sci-mathematics/agda/agda-2.4.0.1.ebuild
new file mode 100644
index 000000000000..a278e74af5d6
--- /dev/null
+++ b/sci-mathematics/agda/agda-2.4.0.1.ebuild
@@ -0,0 +1,124 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+# ebuild generated by hackport 0.4.2.9999
+
+CABAL_FEATURES="lib profile haddock hoogle hscolour"
+inherit haskell-cabal elisp-common
+
+MY_PN="Agda"
+MY_P="${MY_PN}-${PV}"
+
+DESCRIPTION="A dependently typed functional programming language and proof assistant"
+HOMEPAGE="http://wiki.portal.chalmers.se/agda/"
+SRC_URI="mirror://hackage/packages/archive/${MY_PN}/${PV}/${MY_P}.tar.gz"
+
+LICENSE="MIT"
+SLOT="0/${PV}"
+KEYWORDS="~amd64 ~x86"
+IUSE="epic +stdlib"
+
+RDEPEND=">=dev-haskell/binary-0.6:=[profile?] <dev-haskell/binary-0.8:=[profile?]
+ >=dev-haskell/boxes-0.1.3:=[profile?] <dev-haskell/boxes-0.2:=[profile?]
+ ~dev-haskell/data-hash-0.2.0.0:=[profile?]
+ >=dev-haskell/equivalence-0.2.3:=[profile?] <dev-haskell/equivalence-0.3:=[profile?]
+ >=dev-haskell/geniplate-0.6.0.3:=[profile?] <dev-haskell/geniplate-0.7:=[profile?]
+ >=dev-haskell/hashtables-1.0:=[profile?] <dev-haskell/hashtables-1.2:=[profile?]
+ >=dev-haskell/haskeline-0.7:=[profile?] <dev-haskell/haskeline-0.8:=[profile?]
+ >=dev-haskell/haskell-src-exts-1.9.6:=[profile?] <dev-haskell/haskell-src-exts-1.16:=[profile?]
+ >=dev-haskell/mtl-2.1.1:=[profile?] <dev-haskell/mtl-2.3:=[profile?]
+ <dev-haskell/parallel-3.3:=[profile?]
+ >=dev-haskell/quickcheck-2.7.5:2=[profile?] <dev-haskell/quickcheck-2.8:2=[profile?]
+ >=dev-haskell/stmonadtrans-0.3.2:=[profile?] <dev-haskell/stmonadtrans-0.4:=[profile?]
+ >=dev-haskell/strict-0.3.2:=[profile?] <dev-haskell/strict-0.4:=[profile?]
+ >=dev-haskell/text-0.11:=[profile?] <dev-haskell/text-1.2:=[profile?]
+ >=dev-haskell/transformers-0.3:=[profile?] <dev-haskell/transformers-0.5:=[profile?]
+ >=dev-haskell/unordered-containers-0.2:=[profile?] <dev-haskell/unordered-containers-0.3:=[profile?]
+ >=dev-haskell/xhtml-3000.2:=[profile?] <dev-haskell/xhtml-3000.3:=[profile?]
+ >=dev-haskell/zlib-0.4.0.1:=[profile?] <dev-haskell/zlib-0.6:=[profile?]
+ >=dev-lang/ghc-7.4.1:=
+ || ( ( >=dev-haskell/hashable-1.1.2.3:=[profile?] <dev-haskell/hashable-1.2:=[profile?] )
+ ( >=dev-haskell/hashable-1.2.1.0:=[profile?] <dev-haskell/hashable-1.3:=[profile?] ) )
+ epic? ( >=dev-lang/epic-0.1.13:=[profile?] <dev-lang/epic-0.10:=[profile?] )
+"
+RDEPEND+="
+ app-emacs/haskell-mode
+ virtual/emacs
+"
+PDEPEND="stdlib? ( sci-mathematics/agda-stdlib )"
+DEPEND="${RDEPEND}
+ dev-haskell/alex
+ >=dev-haskell/cabal-1.8
+ dev-haskell/happy
+"
+
+SITEFILE="50${PN}2-gentoo.el"
+S="${WORKDIR}/${MY_P}"
+
+src_prepare() {
+ cabal_chdeps \
+ 'mtl >= 2.1.1 && < 2.2' 'mtl >= 2.1.1 && < 2.3' \
+ 'transformers == 0.3.*' 'transformers >= 0.3 && < 0.5'
+
+ sed -e '/.*emacs-mode.*$/d' \
+ -i "${S}/${MY_PN}.cabal" \
+ || die "Could not remove agda-mode from ${MY_PN}.cabal"
+
+ if use epic && use stdlib; then
+ ewarn "Note that the agda-stdlib README:"
+ ewarn "http://www.cse.chalmers.se/~nad/listings/lib/README.html"
+ ewarn 'says: "Currently the library does not support the Epic or JavaScript compiler'
+ ewarn 'backends." Hence you may wish to remove the epic use flag if you wish to use'
+ ewarn "the Agda standard library."
+ fi
+ sed -e 's@-Werror@@g' \
+ -i "${S}/${MY_PN}.cabal" \
+ || die "sed to remove -Werror failed"
+ sed -e '/, "-Werror"/d' \
+ -i "${S}/src/full/Agda/Compiler/MAlonzo/Compiler.hs" \
+ || die "sed to remove -Werror from Compiler.hs failed"
+}
+
+src_configure() {
+ haskell-cabal_src_configure \
+ $(cabal_flag epic epic)
+}
+
+src_compile() {
+ BYTECOMPFLAGS="-L ./src/data/emacs-mode"
+ elisp-compile src/data/emacs-mode/*.el \
+ || die "Failed to compile emacs mode"
+ haskell-cabal_src_compile
+}
+
+src_install() {
+ local add="${ED}"/usr/share/"${P}/ghc-$(ghc-version)"
+
+ haskell-cabal_src_install
+
+ # generate Primitive.agdai, emulate Setup.hs postinst phase
+ Agda_datadir="${add}" \
+ "${ED}"/usr/bin/agda "${add}"/lib/prim/Agda/Primitive.agda
+
+ rm "${ED}"/usr/bin/agda-mode || die
+ # lives in sci-mathematics/agda-executable
+ rm "${ED}"/usr/bin/agda || die
+
+ elisp-install ${PN} src/data/emacs-mode/*.el \
+ || die "Failed to install emacs mode"
+ elisp-site-file-install "${FILESDIR}/${SITEFILE}" \
+ || die "Failed to install elisp site file"
+}
+
+pkg_postinst() {
+ ghc-package_pkg_postinst
+ elisp-site-regen
+}
+
+pkg_postrm() {
+ ghc-package_pkg_prerm
+ elisp-site-regen
+}
diff --git a/sci-mathematics/agda/agda-2.4.2.2-r1.ebuild b/sci-mathematics/agda/agda-2.4.2.2-r1.ebuild
new file mode 100644
index 000000000000..06034efa7e6a
--- /dev/null
+++ b/sci-mathematics/agda/agda-2.4.2.2-r1.ebuild
@@ -0,0 +1,128 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+# ebuild generated by hackport 0.4.4.9999
+
+CABAL_FEATURES="bin lib profile haddock hoogle hscolour"
+inherit haskell-cabal elisp-common
+
+MY_PN="Agda"
+MY_P="${MY_PN}-${PV}"
+
+DESCRIPTION="A dependently typed functional programming language and proof assistant"
+HOMEPAGE="http://wiki.portal.chalmers.se/agda/"
+SRC_URI="mirror://hackage/packages/archive/${MY_PN}/${PV}/${MY_P}.tar.gz"
+
+LICENSE="MIT"
+SLOT="0/${PV}"
+KEYWORDS="~amd64 ~x86"
+IUSE="+cpphs epic +stdlib"
+
+RDEPEND=">=dev-haskell/binary-0.6:=[profile?] <dev-haskell/binary-0.8:=[profile?]
+ >=dev-haskell/boxes-0.1.3:=[profile?] <dev-haskell/boxes-0.2:=[profile?]
+ ~dev-haskell/data-hash-0.2.0.0:=[profile?]
+ >=dev-haskell/equivalence-0.2.5:=[profile?] <dev-haskell/equivalence-0.3:=[profile?]
+ >=dev-haskell/geniplate-0.6.0.3:=[profile?] <dev-haskell/geniplate-0.7:=[profile?]
+ >=dev-haskell/hashtables-1.0:=[profile?] <dev-haskell/hashtables-1.3:=[profile?]
+ >=dev-haskell/haskeline-0.7:=[profile?] <dev-haskell/haskeline-0.8:=[profile?]
+ >=dev-haskell/haskell-src-exts-1.9.6:=[profile?] <dev-haskell/haskell-src-exts-1.17:=[profile?]
+ <dev-haskell/parallel-3.3:=[profile?]
+ >=dev-haskell/quickcheck-2.7.5:2=[profile?] <dev-haskell/quickcheck-2.8:2=[profile?]
+ >=dev-haskell/stmonadtrans-0.3.2:=[profile?] <dev-haskell/stmonadtrans-0.4:=[profile?]
+ >=dev-haskell/strict-0.3.2:=[profile?] <dev-haskell/strict-0.4:=[profile?]
+ >=dev-haskell/text-0.11:=[profile?] <dev-haskell/text-1.3:=[profile?]
+ >=dev-haskell/unordered-containers-0.2:=[profile?] <dev-haskell/unordered-containers-0.3:=[profile?]
+ >=dev-haskell/xhtml-3000.2:=[profile?] <dev-haskell/xhtml-3000.3:=[profile?]
+ >=dev-haskell/zlib-0.4.0.1:=[profile?] <dev-haskell/zlib-0.6:=[profile?]
+ >=dev-lang/ghc-7.4.1:=
+ || ( ( >=dev-haskell/hashable-1.1.2.3:=[profile?] <dev-haskell/hashable-1.2:=[profile?] )
+ ( >=dev-haskell/hashable-1.2.1.0:=[profile?] <dev-haskell/hashable-1.3:=[profile?] ) )
+ || ( ( >=dev-haskell/mtl-2.1.1:=[profile?] <=dev-haskell/mtl-2.1.3.1:=[profile?] )
+ ( >=dev-haskell/mtl-2.2.1:=[profile?] <dev-haskell/mtl-2.3:=[profile?] ) )
+ || ( ( >=dev-haskell/transformers-0.3:=[profile?] <dev-haskell/transformers-0.4:=[profile?] )
+ ( >=dev-haskell/transformers-0.4.1.0:=[profile?] <dev-haskell/transformers-0.5:=[profile?] ) )
+ epic? ( >=dev-lang/epic-0.1.13:=[profile?] <dev-lang/epic-0.10:=[profile?] )
+"
+RDEPEND+="
+ app-emacs/haskell-mode
+ virtual/emacs
+"
+PDEPEND="stdlib? ( sci-mathematics/agda-stdlib )"
+DEPEND="${RDEPEND}
+ dev-haskell/alex
+ >=dev-haskell/cabal-1.8
+ dev-haskell/happy
+ cpphs? ( dev-haskell/cpphs )
+"
+
+SITEFILE="50${PN}2-gentoo.el"
+S="${WORKDIR}/${MY_P}"
+
+src_prepare() {
+ cabal_chdeps \
+ 'hashtables >= 1.0 && < 1.2' 'hashtables >= 1.0 && < 1.3' \
+ 'cpphs >= 1.18.6 && < 1.19' 'cpphs >= 1.18.6 && < 1.20'
+
+ sed -e '/.*emacs-mode.*$/d' \
+ -i "${S}/${MY_PN}.cabal" \
+ || die "Could not remove agda-mode from ${MY_PN}.cabal"
+
+ if use epic && use stdlib; then
+ ewarn "Note that the agda-stdlib README:"
+ ewarn "http://www.cse.chalmers.se/~nad/listings/lib/README.html"
+ ewarn 'says: "Currently the library does not support the Epic or JavaScript compiler'
+ ewarn 'backends." Hence you may wish to remove the epic use flag if you wish to use'
+ ewarn "the Agda standard library."
+ fi
+ sed -e 's@-Werror@@g' \
+ -i "${S}/${MY_PN}.cabal" \
+ || die "sed to remove -Werror failed"
+ sed -e '/, "-Werror"/d' \
+ -i "${S}/src/full/Agda/Compiler/MAlonzo/Compiler.hs" \
+ || die "sed to remove -Werror from Compiler.hs failed"
+}
+
+src_configure() {
+ haskell-cabal_src_configure \
+ $(cabal_flag cpphs cpphs) \
+ $(cabal_flag epic epic)
+}
+
+src_compile() {
+ BYTECOMPFLAGS="-L ./src/data/emacs-mode"
+ elisp-compile src/data/emacs-mode/*.el \
+ || die "Failed to compile emacs mode"
+ haskell-cabal_src_compile
+}
+
+src_install() {
+ local add="${ED}"/usr/share/"${P}/ghc-$(ghc-version)"
+
+ haskell-cabal_src_install
+
+ # generate Primitive.agdai, emulate Setup.hs postinst phase
+ Agda_datadir="${add}" \
+ "${ED}"/usr/bin/agda "${add}"/lib/prim/Agda/Primitive.agda
+
+ rm "${ED}"/usr/bin/agda-mode || die
+ # lives in sci-mathematics/agda-executable
+ rm "${ED}"/usr/bin/agda || die
+
+ elisp-install ${PN} src/data/emacs-mode/*.el \
+ || die "Failed to install emacs mode"
+ elisp-site-file-install "${FILESDIR}/${SITEFILE}" \
+ || die "Failed to install elisp site file"
+}
+
+pkg_postinst() {
+ ghc-package_pkg_postinst
+ elisp-site-regen
+}
+
+pkg_postrm() {
+ ghc-package_pkg_prerm
+ elisp-site-regen
+}
diff --git a/sci-mathematics/agda/agda-2.4.2.3-r1.ebuild b/sci-mathematics/agda/agda-2.4.2.3-r1.ebuild
new file mode 100644
index 000000000000..b6457e53505a
--- /dev/null
+++ b/sci-mathematics/agda/agda-2.4.2.3-r1.ebuild
@@ -0,0 +1,116 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+# ebuild generated by hackport 0.4.5.9999
+
+CABAL_FEATURES="bin lib profile haddock hoogle hscolour"
+inherit haskell-cabal elisp-common
+
+MY_PN="Agda"
+MY_P="${MY_PN}-${PV}"
+
+DESCRIPTION="A dependently typed functional programming language and proof assistant"
+HOMEPAGE="http://wiki.portal.chalmers.se/agda/"
+SRC_URI="mirror://hackage/packages/archive/${MY_PN}/${PV}/${MY_P}.tar.gz"
+
+LICENSE="MIT"
+SLOT="0/${PV}"
+KEYWORDS="~amd64 ~x86"
+IUSE="+cpphs +stdlib"
+
+RDEPEND=">=dev-haskell/base-orphans-0.3.1:=[profile?] <dev-haskell/base-orphans-0.4:=[profile?]
+ >=dev-haskell/binary-0.6:=[profile?] <dev-haskell/binary-0.8:=[profile?]
+ >=dev-haskell/boxes-0.1.3:=[profile?] <dev-haskell/boxes-0.2:=[profile?]
+ >=dev-haskell/data-hash-0.2.0.0:=[profile?] <dev-haskell/data-hash-0.3:=[profile?]
+ >=dev-haskell/edit-distance-0.2.1.2:=[profile?] <dev-haskell/edit-distance-0.3:=[profile?]
+ >=dev-haskell/equivalence-0.2.5:=[profile?] <dev-haskell/equivalence-0.4:=[profile?]
+ >=dev-haskell/geniplate-mirror-0.6.0.6:=[profile?] <dev-haskell/geniplate-mirror-0.8:=[profile?]
+ >=dev-haskell/haskeline-0.7:=[profile?] <dev-haskell/haskeline-0.8:=[profile?]
+ >=dev-haskell/haskell-src-exts-1.16.0.1:=[profile?] <dev-haskell/haskell-src-exts-1.17:=[profile?]
+ >=dev-haskell/old-time-1.1.0.0:=[profile?] <dev-haskell/old-time-1.2:=[profile?]
+ >=dev-haskell/parallel-3.2.0.4:=[profile?] <dev-haskell/parallel-3.3:=[profile?]
+ >=dev-haskell/quickcheck-2.8:2=[profile?] <dev-haskell/quickcheck-2.9:2=[profile?]
+ >=dev-haskell/strict-0.3.2:=[profile?] <dev-haskell/strict-0.4:=[profile?]
+ >=dev-haskell/text-0.11:=[profile?] <dev-haskell/text-1.3:=[profile?]
+ >=dev-haskell/transformers-compat-0.3.3.2:=[profile?] <dev-haskell/transformers-compat-0.5:=[profile?]
+ >=dev-haskell/unordered-containers-0.2:=[profile?] <dev-haskell/unordered-containers-0.3:=[profile?]
+ >=dev-haskell/xhtml-3000.2:=[profile?] <dev-haskell/xhtml-3000.3:=[profile?]
+ >=dev-haskell/zlib-0.4.0.1:=[profile?] <dev-haskell/zlib-0.7:=[profile?]
+ >=dev-lang/ghc-7.4.1:=
+ || ( ( >=dev-haskell/hashable-1.1.2.3:=[profile?] <dev-haskell/hashable-1.2:=[profile?] )
+ ( >=dev-haskell/hashable-1.2.1.0:=[profile?] <dev-haskell/hashable-1.3:=[profile?] ) )
+ || ( ( >=dev-haskell/hashtables-1.0:=[profile?] <dev-haskell/hashtables-1.2:=[profile?] )
+ ( >=dev-haskell/hashtables-1.2.0.2:=[profile?] <dev-haskell/hashtables-1.3:=[profile?] ) )
+ || ( ( >=dev-haskell/mtl-2.1.1:=[profile?] <=dev-haskell/mtl-2.1.3.1:=[profile?] )
+ ( >=dev-haskell/mtl-2.2.1:=[profile?] <dev-haskell/mtl-2.3:=[profile?] ) )
+ || ( ( >=dev-haskell/transformers-0.3:=[profile?] <dev-haskell/transformers-0.4:=[profile?] )
+ ( >=dev-haskell/transformers-0.4.1.0:=[profile?] <dev-haskell/transformers-0.5:=[profile?] ) )
+"
+RDEPEND+="
+ app-emacs/haskell-mode
+ virtual/emacs
+"
+PDEPEND="stdlib? ( =sci-mathematics/agda-stdlib-${PV} )"
+DEPEND="${RDEPEND}
+ dev-haskell/alex
+ >=dev-haskell/cabal-1.8
+ dev-haskell/happy
+ cpphs? ( dev-haskell/cpphs )
+"
+RDEPEND+="!sci-mathematics/agda-executable"
+
+SITEFILE="50${PN}2-gentoo.el"
+S="${WORKDIR}/${MY_P}"
+
+src_prepare() {
+ cabal_chdeps \
+ 'data-hash == 0.2.0.0' 'data-hash >= 0.2.0.0 && < 0.3' \
+ 'geniplate-mirror >= 0.6.0.6 && < 0.7' 'geniplate-mirror >= 0.6.0.6 && < 0.8'
+ sed -e '/.*emacs-mode.*$/d' \
+ -i "${S}/${MY_PN}.cabal" \
+ || die "Could not remove agda-mode from ${MY_PN}.cabal"
+}
+
+src_configure() {
+ haskell-cabal_src_configure \
+ $(cabal_flag cpphs cpphs)
+}
+
+src_compile() {
+ BYTECOMPFLAGS="-L ./src/data/emacs-mode"
+ elisp-compile src/data/emacs-mode/*.el \
+ || die "Failed to compile emacs mode"
+ haskell-cabal_src_compile
+}
+
+src_test() {
+ export LD_LIBRARY_PATH="${S}/dist/build${LD_LIBRARY_PATH+:}${LD_LIBRARY_PATH}"
+
+ dist/build/agda/agda --test +RTS -M1g || die
+}
+
+src_install() {
+ local add="${ED}"/usr/share/"${P}/ghc-$(ghc-version)"
+
+ haskell-cabal_src_install
+
+ # generate Primitive.agdai, emulate Setup.hs postinst phase
+ Agda_datadir="${add}" \
+ "${ED}"/usr/bin/agda "${add}"/lib/prim/Agda/Primitive.agda
+
+ elisp-install ${PN} src/data/emacs-mode/*.el \
+ || die "Failed to install emacs mode"
+ elisp-site-file-install "${FILESDIR}/${SITEFILE}" \
+ || die "Failed to install elisp site file"
+}
+
+pkg_postinst() {
+ elisp-site-regen
+}
+
+pkg_postrm() {
+ elisp-site-regen
+}
diff --git a/sci-mathematics/agda/files/50agda2-gentoo.el b/sci-mathematics/agda/files/50agda2-gentoo.el
new file mode 100644
index 000000000000..fd1367f727e6
--- /dev/null
+++ b/sci-mathematics/agda/files/50agda2-gentoo.el
@@ -0,0 +1,10 @@
+;;; agda site-lisp configuration
+
+(add-to-list 'load-path "@SITELISP@")
+(autoload 'agda2-mode "agda2.el"
+ "Major mode for Agda files" t)
+(unless (assoc "\\.agda" auto-mode-alist)
+ (setq auto-mode-alist
+ (nconc '(("\\.agda" . agda2-mode)
+ ("\\.alfa" . agda2-mode)) auto-mode-alist)))
+
diff --git a/sci-mathematics/agda/files/agda-make_install.patch b/sci-mathematics/agda/files/agda-make_install.patch
new file mode 100644
index 000000000000..0d008acd436b
--- /dev/null
+++ b/sci-mathematics/agda/files/agda-make_install.patch
@@ -0,0 +1,14 @@
+--- Agda-1.1-cvs20050601/src/Makefile.in.old 2006-07-12 14:47:06.000000000 +0200
++++ Agda-1.1-cvs20050601/src/Makefile.in 2006-07-12 14:47:25.000000000 +0200
+@@ -74,10 +74,9 @@
+
+ install_bin: emacsagda agdachecker
+ ${INSTALL} -d ${destdir}/bin/
++ ${INSTALL} -d ${bindir}
+ cp emacsagda ${destdir}/bin/emacsagda-${VERSION}
+- -rm ${destdir}/bin/emacsagda
+ (cd ${destdir}/bin; ln -s emacsagda-${VERSION} emacsagda)
+- -(cd ${bindir}; ln -s ${destdir}/bin/emacsagda emacsagda)
+ # No more energy to create variants
+ ${INSTALL} agdachecker ${bindir}
+
diff --git a/sci-mathematics/agda/metadata.xml b/sci-mathematics/agda/metadata.xml
new file mode 100644
index 000000000000..11b2cbcae0bb
--- /dev/null
+++ b/sci-mathematics/agda/metadata.xml
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <herd>sci-mathematics</herd>
+ <herd>haskell</herd>
+<longdescription lang="en">
+ Agda is an interactive proof editor, or proof assistant. Its input language,
+ called Agda language (or simply Agda), is based on a constructive type
+ theory á la Martin-Löf, extended with dependent record types,
+ inductive definitions, module structures and a class hierarchy mechanism.
+</longdescription>
+<use>
+ <flag name='cpphs'>Use cpphs instead of cpp.</flag>
+ <flag name='epic'>Add support for the epic compiler.</flag>
+ <flag name='stdlib'>Install the standard library.</flag>
+</use>
+</pkgmetadata>
diff --git a/sci-mathematics/axiom/Manifest b/sci-mathematics/axiom/Manifest
new file mode 100644
index 000000000000..ed843094a6bc
--- /dev/null
+++ b/sci-mathematics/axiom/Manifest
@@ -0,0 +1 @@
+DIST axiom-may2008-src.tgz 207172456 RMD160 496c91f00d3b8623c13ea82ee5a95698899a5406 SHA1 51949340f754104c0fa72e269737538829cd9062 SHA256 c91cc50a9a6b9d66b398f8b96236249db72b6ce280d51c188db1805a4534380e
diff --git a/sci-mathematics/axiom/axiom-200805.ebuild b/sci-mathematics/axiom/axiom-200805.ebuild
new file mode 100644
index 000000000000..8552dea7f561
--- /dev/null
+++ b/sci-mathematics/axiom/axiom-200805.ebuild
@@ -0,0 +1,97 @@
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=4
+
+inherit eutils multilib flag-o-matic
+
+DESCRIPTION="Axiom is a general purpose Computer Algebra system"
+HOMEPAGE="http://axiom.axiom-developer.org/"
+SRC_URI="http://www.axiom-developer.org/axiom-website/downloads/${PN}-may2008-src.tgz"
+
+LICENSE="BSD-2"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE=""
+
+# NOTE: Do not strip since this seems to remove some crucial
+# runtime paths as well, thereby, breaking axiom
+RESTRICT="strip"
+
+DEPEND="virtual/latex-base
+ x11-libs/libXaw
+ sys-apps/debianutils
+ sys-process/procps"
+RDEPEND=""
+
+S="${WORKDIR}"/${PN}
+
+pkg_setup() {
+ # for 2.6.25 kernels and higher we need to have
+ # /proc/sys/kernel/randomize_va_space set to somthing other
+ # than 2, otherwise gcl fails to compile (see bug #186926).
+ local current_setting=$(/sbin/sysctl kernel.randomize_va_space 2>/dev/null | cut -d' ' -f3)
+ if [[ ${current_setting} == 2 ]]; then
+ echo
+ eerror "Your kernel has brk randomization enabled. This will"
+ eerror "cause axiom to fail to compile *and* run (see bug #186926)."
+ eerror "You can issue:"
+ eerror
+ eerror " /sbin/sysctl -w kernel.randomize_va_space=1"
+ eerror
+ eerror "as root to turn brk randomization off temporarily."
+ eerror "However, when not using axiom you may want to turn"
+ eerror "brk randomization back on via"
+ eerror
+ eerror " /sbin/sysctl -w kernel.randomize_va_space=2"
+ eerror
+ eerror "since it results in a less secure kernel."
+ die "Kernel brk randomization detected"
+ fi
+}
+
+src_prepare() {
+ cp "${FILESDIR}"/noweb-2.9-insecure-tmp-file.patch.input \
+ "${S}"/zips/noweb-2.9-insecure-tmp-file.patch \
+ || die "Failed to fix noweb"
+ cp "${FILESDIR}"/${PN}-200711-gcl-configure.patch \
+ "${S}"/zips/gcl-2.6.7.configure.in.patch \
+ || die "Failed to fix gcl-2.6.7 configure"
+ epatch "${FILESDIR}"/noweb-2.9-insecure-tmp-file.Makefile.patch
+
+ # lots of strict-aliasing badness
+ append-flags -fno-strict-aliasing
+}
+
+src_compile() {
+ # use gcl 2.6.7
+ sed -e "s:GCLVERSION=gcl-2.6.8pre$:GCLVERSION=gcl-2.6.7:" \
+ -i Makefile.pamphlet Makefile \
+ || die "Failed to select proper gcl"
+
+ # fix libXpm.a location
+ sed -e "s:X11R6/lib:$(get_libdir):g" -i Makefile.pamphlet \
+ || die "Failed to fix libXpm lib paths"
+
+ # Let the fun begin...
+ AXIOM="${S}"/mnt/linux emake -j1
+}
+
+src_install() {
+ emake DESTDIR="${D}"/opt/axiom COMMAND="${D}"/opt/axiom/mnt/linux/bin/axiom install
+
+ mv "${D}"/opt/axiom/mnt/linux/* "${D}"/opt/axiom \
+ || die "Failed to mv axiom into its final destination path."
+ rm -fr "${D}"/opt/axiom/mnt \
+ || die "Failed to remove old directory."
+
+ dodir /usr/bin
+ dosym /opt/axiom/bin/axiom /usr/bin/axiom
+
+ sed -e "2d;3i AXIOM=/opt/axiom" \
+ -i "${D}"/opt/axiom/bin/axiom \
+ || die "Failed to patch axiom runscript!"
+
+ dodoc changelog readme faq
+}
diff --git a/sci-mathematics/axiom/files/axiom-200711-gcl-configure.patch b/sci-mathematics/axiom/files/axiom-200711-gcl-configure.patch
new file mode 100644
index 000000000000..a5ecb58d7cc7
--- /dev/null
+++ b/sci-mathematics/axiom/files/axiom-200711-gcl-configure.patch
@@ -0,0 +1,11 @@
+--- configure 2008-02-01 09:06:15.000000000 -0500
++++ configure.new 2008-02-01 09:03:18.000000000 -0500
+@@ -1711,7 +1711,7 @@
+ # results, and the version is kept in special file).
+
+ if test -r /etc/.relid -a "X`uname -n`" = "X`uname -s`" ; then
+- system=MP-RAS-`${AWK} '{print $3}' /etc/.relid'`
++ system=MP-RAS-`${AWK} '{print $3}' '/etc/.relid'`
+ fi
+ if test "`uname -s`" = "AIX" ; then
+ system=AIX-`uname -v`.`uname -r`
diff --git a/sci-mathematics/axiom/files/noweb-2.9-insecure-tmp-file.Makefile.patch b/sci-mathematics/axiom/files/noweb-2.9-insecure-tmp-file.Makefile.patch
new file mode 100644
index 000000000000..b8cd40ea03bb
--- /dev/null
+++ b/sci-mathematics/axiom/files/noweb-2.9-insecure-tmp-file.Makefile.patch
@@ -0,0 +1,10 @@
+--- Makefile~ 2005-09-05 19:50:31.000000000 +0100
++++ Makefile 2006-02-17 17:08:31.000000000 +0000
+@@ -85,6 +85,7 @@
+ ${PATCH} <${ZIPS}/noweb.modules.c.patch ; \
+ cd ${OBJ}/noweb/src ; \
+ ${PATCH} <${ZIPS}/noweb.src.Makefile.patch ; \
++ ${PATCH} -p0 <${ZIPS}/noweb-2.9-insecure-tmp-file.patch ; \
+ ./awkname ${AWK} ; \
+ ${ENV} ${MAKE} BIN=${MNT}/${SYS}/bin/lib LIB=${MNT}/${SYS}/bin/lib \
+ MAN=${MNT}/${SYS}/bin/man \
diff --git a/sci-mathematics/axiom/files/noweb-2.9-insecure-tmp-file.patch.input b/sci-mathematics/axiom/files/noweb-2.9-insecure-tmp-file.patch.input
new file mode 100644
index 000000000000..00288a8a3133
--- /dev/null
+++ b/sci-mathematics/axiom/files/noweb-2.9-insecure-tmp-file.patch.input
@@ -0,0 +1,168 @@
+--- awkname
++++ awkname
+@@ -5,7 +5,7 @@
+ esac
+
+ rc=0
+-new=/tmp/$$.new; old=/tmp/$$.old
++new=$(tempfile -p new); old=$(tempfile -p old)
+
+ for file in lib/emptydefn lib/unmarkup lib/toascii \
+ awk/noidx awk/totex awk/tohtml awk/noindex \
+--- awk/totex.nw
++++ awk/totex.nw
+@@ -24,7 +24,7 @@
+ @
+ On an ugly system, we have to put it in a file.
+ <<invoke awk program using file>>=
+-awkfile=/tmp/totex$$.awk
++awkfile=$(tempfile -p totex)
+ trap 'rm -f $awkfile; exit 1' 0 1 2 15 # clean up files
+ cat > $awkfile << 'EOF'
+ <<awk program for conversion to {\TeX}>>
+--- lib/toascii
++++ lib/toascii
+@@ -7,9 +7,9 @@
+ *) echo "This can't happen -- $i passed to toascii" 1>&2 ; exit 1 ;;
+ esac
+ done
+-awkfile="tmp/awk$$.tmp"
+-textfile="/tmp/text$$.tmp"
+-tagsfile="/tmp/tags$$.tmp"
++awkfile=$(tempfile -p awk -s .tmp)
++textfile=$(tempfile -p text -s .tmp)
++tagsfile=$(tempfile -p tags -s .tmp)
+ export awkfile textfile tagsfile
+ trap 'rm -f $awkfile $textfile $tagsfile' 0 1 2 10 14 15
+ nawk 'BEGIN { textfile=ENVIRON["textfile"]
+--- shell/cpif
++++ shell/cpif
+@@ -17,7 +17,7 @@
+ 0) echo 'Usage: '`basename $0`' [ -eq -ne ] file...' 1>&2; exit 2
+ esac
+
+-new=/tmp/$$
++new=$(tempfile)
+ trap 'rm -f $new; exit 1' 1 2 15 # clean up files
+
+ cat >$new
+--- shell/nonu
++++ shell/nonu
+@@ -2,7 +2,7 @@
+ LIB=/usr/public/pkg/noweb/lib
+ # attempt to convert nuweb to noweb using sam
+
+-tmp=/tmp/nonu$$
++tmp=$(tempfile -p nonu)
+ trap '/bin/rm -f $tmp; exit 1' 1 2 15 # clean up files
+ cp $1 $tmp || exit 1
+
+--- shell/roff.nw
++++ shell/roff.nw
+@@ -80,7 +80,7 @@
+ other, and quoting each quote is ugly. The pragmatic solution is to
+ copy the awk program into a temporary file, using a shell here-document.
+ <<invoke awk program>>=
+-awkfile="/tmp/noweb$$.awk"
++awkfile=$(tempfile -p noweb -s .awk)
+ trap 'rm -f $awkfile' 0 1 2 10 14 15
+ cat > $awkfile << 'EOF'
+ <<awk program>>
+@@ -662,12 +662,13 @@
+
+ base="`basename $1 | sed '/\./s/\.[^.]*$//'`"
+ tagsfile="$base.nwt"
++tmpfile=$(tempfile -p tags)
+ (echo ".so $macrodir/tmac.w"
+ if [ -r "$tagsfile" ]; then
+- cp $tagsfile /tmp/tags.$$
++ cp $tagsfile $tmpfile
+ $AWK '<<action for [[tags]] line>>
+- <<functions>>' /tmp/tags.$$
+- rm -f /tmp/tags.$$
++ <<functions>>' $tmpfile
++ rm -f $tmpfile
+ fi
+ cat "$@") |
+ ($ROFF $opts 2>$tagsfile)
+--- shell/noroff
++++ shell/noroff
+@@ -35,9 +35,10 @@
+
+ base="`basename $1 | sed '/\./s/\.[^.]*$//'`"
+ tagsfile="$base.nwt"
++tmpfile=$(tempfile -p tags)
+ (echo ".so $macrodir/tmac.w"
+ if [ -r "$tagsfile" ]; then
+- cp $tagsfile /tmp/tags.$$
++ cp $tagsfile $tmpfile
+ $AWK '{
+ if (sub(/^###TAG### / , "")) tags[$1] = $2
+ else if (sub(/^###BEGINCHUNKS###/, "")) printf ".de CLIST\n.CLISTBEGIN\n"
+@@ -88,8 +89,8 @@
+ # print str3
+ # print convquote(str3)
+ # }
+- function tag(s) { if (s in tags) return tags[s]; else return "???" }' /tmp/tags.$$
+- rm -f /tmp/tags.$$
++ function tag(s) { if (s in tags) return tags[s]; else return "???" }' $tmpfile
++ rm -f $tmpfile
+ fi
+ cat "$@") |
+ ($ROFF $opts 2>$tagsfile)
+--- shell/toroff
++++ shell/toroff
+@@ -9,7 +9,7 @@
+ exit 1;;
+ esac
+ done
+-awkfile="/tmp/noweb$$.awk"
++awkfile=$(tempfile -p noweb -s .awk)
+ trap 'rm -f $awkfile' 0 1 2 10 14 15
+ cat > $awkfile << 'EOF'
+ /^@begin docs 0$/ { if (delay) next }
+--- lib/toascii.nw
++++ lib/toascii.nw
+@@ -28,9 +28,9 @@
+ Also arranged here is a temporary file for storage of the awk program on an
+ ugly system, as discussed below.
+ <<arrange temporary files>>=
+-awkfile="tmp/awk$$.tmp"
+-textfile="/tmp/text$$.tmp"
+-tagsfile="/tmp/tags$$.tmp"
++awkfile=$(tempfile -p awk -s .tmp) || { echo "$0: Cannot create temporary file" >&2; exit 1; }
++textfile=$(tempfile -p text -s .tmp) || { echo "$0: Cannot create temporary file" >&2; exit 1; }
++tagsfile=$(tempfile -p tags -s .tmp) || { echo "$0: Cannot create temporary file" >&2; exit 1; }
+ export awkfile textfile tagsfile
+ trap 'rm -f $awkfile $textfile $tagsfile' 0 1 2 10 14 15
+ @ %def textfile tagsfile awkfile
+--- shell/roff.mm
++++ shell/roff.mm
+@@ -214,7 +214,7 @@
+ .ADDLIST 1a
+ .PRINTLIST
+
+-awkfile="/tmp/noweb$$.awk"
++awkfile=$(tempfile -p noweb -s .awk) || { echo "$0: Cannot create temporary file" >&2; exit 1; }
+ trap 'rm -f $awkfile' 0 1 2 10 14 15
+ cat > $awkfile \&<< 'EOF'
+ \c
+@@ -1628,14 +1628,15 @@
+ tagsfile="$base.nwt"
+ (echo ".so $macrodir/tmac.w"
+ if [ -r "$tagsfile" ]; then
+- cp $tagsfile /tmp/tags.$$
++ tagstemp=$(tempfile -p tags) || { echo "$0: Cannot create temporary file" >&2; exit 1; }
++ cp $tagsfile $tagstemp
+ $AWK '\c
+ .USE "action for \*[BEGINCONVQUOTE]tags\*[ENDCONVQUOTE] line" 11c
+ \&
+ \c
+ .USE "functions" 8a
+-\&' /tmp/tags.$$
+- rm -f /tmp/tags.$$
++\&' $tagstemp
++ rm -f $tagstemp
+ fi
+ cat "$@") |
+ ($ROFF $opts 2>$tagsfile)
diff --git a/sci-mathematics/axiom/metadata.xml b/sci-mathematics/axiom/metadata.xml
new file mode 100644
index 000000000000..2b0bd5314823
--- /dev/null
+++ b/sci-mathematics/axiom/metadata.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <herd>sci-mathematics</herd>
+</pkgmetadata>
diff --git a/sci-mathematics/bertini/Manifest b/sci-mathematics/bertini/Manifest
new file mode 100644
index 000000000000..6140e74e98d1
--- /dev/null
+++ b/sci-mathematics/bertini/Manifest
@@ -0,0 +1 @@
+DIST BertiniSource_v1.4.tar.gz 1827401 SHA256 61ce11b2714d1540311c1a8e3192ff92bfbd8fd85c357b554d22ab6cbe67f6a1 SHA512 bb53f8ed24a0f21e95b4e373be36039b69ea0ddb11ad8240bcf52ce64436a56c1f2057a5d733d017fdf68cfb3598a473e1f12b4659308890e2e2575b7d8143f6 WHIRLPOOL f832076f0c2277c35df28d7ed94476e1ec086c5fcb4a80e52fd3cd2d5fce79ecbc66606ba1cb0f71ca0fa6180c0e82e79b5cc85eb5949de64b6c9d8e2e8b7e6a
diff --git a/sci-mathematics/bertini/bertini-1.4.ebuild b/sci-mathematics/bertini/bertini-1.4.ebuild
new file mode 100644
index 000000000000..b6b7c6504c07
--- /dev/null
+++ b/sci-mathematics/bertini/bertini-1.4.ebuild
@@ -0,0 +1,58 @@
+# Copyright 1999-2013 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+inherit toolchain-funcs
+
+MYP="BertiniSource_v${PV}"
+
+DESCRIPTION="Software for Numerical Algebraic Geometry"
+HOMEPAGE="http://bertini.nd.edu"
+
+SRC_URI="http://www3.nd.edu/~sommese/bertini/${MYP}.tar.gz"
+
+LICENSE="bertini"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE="doc examples +optimization"
+DEPEND="
+ sys-devel/bison
+ sys-devel/flex
+"
+RDEPEND="
+ dev-libs/gmp
+ dev-libs/mpfr
+"
+
+S="${WORKDIR}/${MYP}/src"
+
+src_prepare() {
+ if ! use optimization; then
+ sed -i -e "s/\$(OPT)/ ${CXXFLAGS} ${LDFLAGS}/" Makefile
+ else
+ sed -i -e "s/\$(OPT)/ \$(OPT) ${LDFLAGS}/" Makefile
+ fi
+ sed -i -e "s/gcc/$(tc-getCC)/" Makefile
+}
+
+src_configure() {
+ :
+}
+
+src_compile() {
+ emake
+}
+
+src_install() {
+ dobin bertini
+ if use doc; then
+ dodoc "${WORKDIR}/${MYP}/BertiniUsersManual.pdf"
+ fi
+ if use examples; then
+ insinto "/usr/share/${PN}"
+ doins -r "${WORKDIR}/${MYP}/examples"
+ elog "Examples have been installed into /usr/share/${MYP}"
+ fi
+}
diff --git a/sci-mathematics/bertini/metadata.xml b/sci-mathematics/bertini/metadata.xml
new file mode 100644
index 000000000000..e79bcd17ddc7
--- /dev/null
+++ b/sci-mathematics/bertini/metadata.xml
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <herd>sci-mathematics</herd>
+ <maintainer>
+ <email>tomka@gentoo.org</email>
+ </maintainer>
+ <longdescription>
+Bertini: Software for Numerical Algebraic Geometry
+
+Facts in brief:
+
+ Purpose: The numerical solution of systems of polynomial equations
+
+ Approach: Homotopy continuation.
+
+ Authors: Daniel J. Bates, Jonathan D. Hauenstein, Andrew J. Sommese, Charles W. Wampler
+
+ Background: Bertini is a general-purpose solver, written in C, that was
+ created for research about polynomial continuation.
+</longdescription>
+<use>
+ <flag name="optimization">Accept upstream's choices for -O option.</flag>
+</use>
+</pkgmetadata>
diff --git a/sci-mathematics/cado-nfs/Manifest b/sci-mathematics/cado-nfs/Manifest
new file mode 100644
index 000000000000..b237edbbf30b
--- /dev/null
+++ b/sci-mathematics/cado-nfs/Manifest
@@ -0,0 +1,4 @@
+DIST cado-nfs-1.1.tar.gz 1453860 SHA256 295c8662208c432a98157951ddc117820ff2e57ee36fdae53b30dca89ebfc02f SHA512 e0578c4931eaa044c46e1a11e4d44f0d716f5049b9414a73371a2f1001798e5b011887ae450ff1a4256cd683e928c88b7f4f5af8402570c5dc3f4d17c9801101 WHIRLPOOL 4162a221763cb858beab19259331a1ed2fbafede4f55af1dc962869cfd00cd37af867b021d595f902f0a111f2af5548a783be3ca1fdd4e5c3421a3d804633903
+DIST cado-nfs-2.0.tar.gz 2088866 SHA256 67f2ca3f739e07e89c9873f98d876bf771a3900288eda3d724b06f5736b4bfa2 SHA512 7f531e9ad1445c763a2fd37441e2e3bf6d4184d0d93be414d078b7024860c9d85754afe6629d9436b540361183462792248a88c0af76407d10a621385ec5b18b WHIRLPOOL 91b7a874cedb90c555625f9a0187f62c2cfccebc7236182d6bba17187fa5080b5164b121361035f3c7281881cc44f026fb66c6b242f8abcf6b6628a6eb280b90
+DIST cado-nfs-2.1.1.tar.gz 2560216 SHA256 7493b3d38c7bb7db2e3e8068f6d7da2bf0429d5cc153af668f677af99f0320fa SHA512 8463fddc49cf7ad3caef47f9b96fd8ed63de63fa3aa9791b94e58d920f2bb66d843e6e53bab81eaea62d3cbdc834c4f7b7f294d255ac7def74ff51a651905002 WHIRLPOOL cecea890bc48b80ad8907e69f8ca386a45b99f4735cdec3bdfba936bf502b6efbf76bbae3f4a8f60e8f676c27f441ae03ec8327be05c92eecbcf7751b8d34f9f
+DIST cado-nfs-2.1.tar.gz 2558577 SHA256 ff50baeb2eb5bf0ff3dd8600056e8e762fa30c94c2425fb73843329ced2a5ae1 SHA512 fcdba87ca349485e6d25c1298cc90197855a2fa354b51edb827445b10e7cb023f5d239e02aba0cdae28b4f4b38d260b4b492cdf5eb0c929afdca6aa604b29191 WHIRLPOOL c23a7b5d184efa385689493831f70cff823811d8f320ea3e91f367c580b285dcf6515027d466784d56c5f3f49d51e1d3baccd566096af561710b9267d1e0bdda
diff --git a/sci-mathematics/cado-nfs/cado-nfs-1.1.ebuild b/sci-mathematics/cado-nfs/cado-nfs-1.1.ebuild
new file mode 100644
index 000000000000..518c0079882f
--- /dev/null
+++ b/sci-mathematics/cado-nfs/cado-nfs-1.1.ebuild
@@ -0,0 +1,31 @@
+# Copyright 1999-2013 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=4
+DESCRIPTION="Number Field Sieve (NFS) implementation for factoring integers"
+HOMEPAGE="http://cado-nfs.gforge.inria.fr/"
+SRC_URI="https://gforge.inria.fr/frs/download.php/29330/${P}.tar.gz"
+
+inherit eutils cmake-utils
+
+LICENSE="LGPL-2.1"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE=""
+
+RDEPEND="dev-libs/gmp
+ dev-lang/perl
+ !sci-mathematics/ggnfs
+ !sci-biology/shrimp
+ "
+DEPEND="${RDEPEND}
+ "
+
+src_configure() {
+ DESTINATION="/usr/libexec/cado-nfs" cmake-utils_src_configure
+}
+src_compile() {
+ # autodetection goes confused for gf2x
+ ABI=default cmake-utils_src_compile
+}
diff --git a/sci-mathematics/cado-nfs/cado-nfs-2.0.ebuild b/sci-mathematics/cado-nfs/cado-nfs-2.0.ebuild
new file mode 100644
index 000000000000..74f10caa6336
--- /dev/null
+++ b/sci-mathematics/cado-nfs/cado-nfs-2.0.ebuild
@@ -0,0 +1,38 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=4
+DESCRIPTION="Number Field Sieve (NFS) implementation for factoring integers"
+HOMEPAGE="http://cado-nfs.gforge.inria.fr/"
+SRC_URI="https://gforge.inria.fr/frs/download.php/33131/${P}.tar.gz"
+
+inherit eutils cmake-utils
+
+LICENSE="LGPL-2.1"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE=""
+
+RDEPEND="dev-libs/gmp
+ dev-lang/perl
+ !sci-mathematics/ggnfs
+ !sci-biology/shrimp
+ "
+DEPEND="${RDEPEND}
+ "
+
+src_prepare() {
+ # looks like packaging mistake
+ sed -i -e 's/add_executable (convert_rels convert_rels.c)//' misc/CMakeLists.txt || die
+ sed -i -e 's/target_link_libraries (convert_rels utils)//' misc/CMakeLists.txt || die
+ sed -i -e 's~install(TARGETS convert_rels RUNTIME DESTINATION bin/misc)~~' misc/CMakeLists.txt || die
+}
+
+src_configure() {
+ DESTINATION="/usr/libexec/cado-nfs" cmake-utils_src_configure
+}
+src_compile() {
+ # autodetection goes confused for gf2x
+ ABI=default cmake-utils_src_compile
+}
diff --git a/sci-mathematics/cado-nfs/cado-nfs-2.1.1.ebuild b/sci-mathematics/cado-nfs/cado-nfs-2.1.1.ebuild
new file mode 100644
index 000000000000..8ef8f4297c73
--- /dev/null
+++ b/sci-mathematics/cado-nfs/cado-nfs-2.1.1.ebuild
@@ -0,0 +1,41 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=4
+DESCRIPTION="Number Field Sieve (NFS) implementation for factoring integers"
+HOMEPAGE="http://cado-nfs.gforge.inria.fr/"
+SRC_URI="https://gforge.inria.fr/frs/download.php/file/34110/${P}.tar.gz"
+
+inherit eutils cmake-utils
+
+# Fails F9_{k,m}bucket_test F9_tracektest
+RESTRICT="test"
+
+LICENSE="LGPL-2.1"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE=""
+
+RDEPEND="dev-libs/gmp
+ dev-lang/perl
+ !sci-mathematics/ggnfs
+ !sci-biology/shrimp
+ "
+DEPEND="${RDEPEND}
+ "
+
+src_prepare() {
+ # looks like packaging mistake
+ sed -i -e 's/add_executable (convert_rels convert_rels.c)//' misc/CMakeLists.txt || die
+ sed -i -e 's/target_link_libraries (convert_rels utils)//' misc/CMakeLists.txt || die
+ sed -i -e 's~install(TARGETS convert_rels RUNTIME DESTINATION bin/misc)~~' misc/CMakeLists.txt || die
+}
+
+src_configure() {
+ DESTINATION="/usr/libexec/cado-nfs" cmake-utils_src_configure
+}
+src_compile() {
+ # autodetection goes confused for gf2x
+ ABI=default cmake-utils_src_compile
+}
diff --git a/sci-mathematics/cado-nfs/cado-nfs-2.1.ebuild b/sci-mathematics/cado-nfs/cado-nfs-2.1.ebuild
new file mode 100644
index 000000000000..af4044b322f5
--- /dev/null
+++ b/sci-mathematics/cado-nfs/cado-nfs-2.1.ebuild
@@ -0,0 +1,41 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=4
+DESCRIPTION="Number Field Sieve (NFS) implementation for factoring integers"
+HOMEPAGE="http://cado-nfs.gforge.inria.fr/"
+SRC_URI="https://gforge.inria.fr/frs/download.php/file/33856/${P}.tar.gz"
+
+inherit eutils cmake-utils
+
+# Fails F9_{k,m}bucket_test F9_tracektest
+RESTRICT="test"
+
+LICENSE="LGPL-2.1"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE=""
+
+RDEPEND="dev-libs/gmp
+ dev-lang/perl
+ !sci-mathematics/ggnfs
+ !sci-biology/shrimp
+ "
+DEPEND="${RDEPEND}
+ "
+
+src_prepare() {
+ # looks like packaging mistake
+ sed -i -e 's/add_executable (convert_rels convert_rels.c)//' misc/CMakeLists.txt || die
+ sed -i -e 's/target_link_libraries (convert_rels utils)//' misc/CMakeLists.txt || die
+ sed -i -e 's~install(TARGETS convert_rels RUNTIME DESTINATION bin/misc)~~' misc/CMakeLists.txt || die
+}
+
+src_configure() {
+ DESTINATION="/usr/libexec/cado-nfs" cmake-utils_src_configure
+}
+src_compile() {
+ # autodetection goes confused for gf2x
+ ABI=default cmake-utils_src_compile
+}
diff --git a/sci-mathematics/cado-nfs/metadata.xml b/sci-mathematics/cado-nfs/metadata.xml
new file mode 100644
index 000000000000..24cbb90cf0c4
--- /dev/null
+++ b/sci-mathematics/cado-nfs/metadata.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <maintainer>
+ <email>patrick@gentoo.org</email>
+ <name>Patrick Lauer</name>
+ </maintainer>
+</pkgmetadata>
diff --git a/sci-mathematics/calc/Manifest b/sci-mathematics/calc/Manifest
new file mode 100644
index 000000000000..3ac4498d354d
--- /dev/null
+++ b/sci-mathematics/calc/Manifest
@@ -0,0 +1,5 @@
+DIST calc-2.12.1.5.tar.gz 1020389 SHA256 3a8b6daa60de0b5aa7c33dcfdf0aeec9d4523f51638235468de32f843ce79171
+DIST calc-2.12.2.2.tar.bz2 864687 SHA256 0a334cd331a4953a86365becce9b9f401b264a580a1f2130d5de700fa093772a
+DIST calc-2.12.4.13.tar.bz2 970778 SHA256 1e6fd3256bd7bf738fcfe6e2d6a9d8a6bb0f37393aba6020b01d96274419a92c SHA512 7b7136c793917652ce2f2b3866b2db16a69dbead729d8a72b8c1359ebb8a4e1d4e7a3a8b214f8e85b9ccf41193ba6ffcb49926cc68f494e2b6cdff58559f2534 WHIRLPOOL 365700655f53eb5efb58ee6fbdf1d123943c2cc6a799318d9a48e2c5b8e0e2e871fd36e54b185442e0a0bc5380644edca1612bbfe7e2506247015743cdb556ee
+DIST calc-2.12.4.3.tar.bz2 865956 SHA256 a4e7d8a9313e7d28653e2c372fca9b0defdc02f965b833bb43479bbdfee51a92
+DIST calc-2.12.4.4.tar.bz2 867180 SHA256 106a0e5dc4da94ec8711a8631cd5d17b3979cde1d248ba9385cdcb862cb1390b SHA512 58be9d70a2c79adeb44d86da6f5f2d04dbf09aaec10ad4e8eed870a7b8de1d4a7cd35b1738ccb5cc64ef5f945e6cfbe1944e27f064541289abe1a4e7f4703690 WHIRLPOOL 1a106ba7b10463aca673329b625721d47a14721467e7847fdbe509b8bf16b4c5829b006240faf58f915abb0f0bf9cbc033289077f20f0c74c2704fb63ccaf340
diff --git a/sci-mathematics/calc/calc-2.12.1.5.ebuild b/sci-mathematics/calc/calc-2.12.1.5.ebuild
new file mode 100644
index 000000000000..2ddaa5a451b2
--- /dev/null
+++ b/sci-mathematics/calc/calc-2.12.1.5.ebuild
@@ -0,0 +1,40 @@
+# Copyright 1999-2008 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+DESCRIPTION="An arbitrary precision C-like arithmetic system"
+HOMEPAGE="http://www.isthe.com/chongo/tech/comp/calc/"
+SRC_URI="mirror://sourceforge/${PN}/${P}.tar.gz"
+
+SLOT="0"
+LICENSE="LGPL-2"
+KEYWORDS="alpha ~amd64 ~ppc x86"
+
+IUSE=""
+
+DEPEND=">=sys-libs/ncurses-5.2
+ >=sys-libs/readline-4.2"
+
+RDEPEND="${DEPEND}
+ >=sys-apps/less-348"
+
+src_compile() {
+ make \
+ T="${D}" \
+ DEBUG="${CFLAGS}" \
+ CALCPAGER=less \
+ USE_READLINE="-DUSE_READLINE" \
+ READLINE_LIB="-lreadline -lhistory -lncurses" \
+ all \
+ || die
+ if echo "${LD_PRELOAD}" | grep -q "sandbox"; then
+ ewarn "Can't run check when running in sandbox - see bug #59676"
+ else
+ make chk || die "Check failed"
+ fi
+}
+
+src_install() {
+ make T="${D}" install || die
+ dodoc BUGS CHANGES LIBRARY README
+}
diff --git a/sci-mathematics/calc/calc-2.12.2.2.ebuild b/sci-mathematics/calc/calc-2.12.2.2.ebuild
new file mode 100644
index 000000000000..c2e889b2aa59
--- /dev/null
+++ b/sci-mathematics/calc/calc-2.12.2.2.ebuild
@@ -0,0 +1,52 @@
+# Copyright 1999-2010 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+inherit eutils multilib
+
+DESCRIPTION="An arbitrary precision C-like arithmetic system"
+HOMEPAGE="http://www.isthe.com/chongo/tech/comp/calc/"
+SRC_URI="mirror://sourceforge/${PN}/${P}.tar.bz2"
+
+SLOT="0"
+LICENSE="LGPL-2"
+KEYWORDS="~alpha amd64 ~ppc ~ppc64 ~x86"
+
+IUSE=""
+
+DEPEND=">=sys-libs/ncurses-5.2
+ >=sys-libs/readline-4.2"
+
+RDEPEND="${DEPEND}
+ >=sys-apps/less-348"
+
+src_unpack() {
+ unpack ${A}
+ cd "${S}"
+ epatch "${FILESDIR}"/${P}-libdir-fix.patch
+
+ sed -e "s:LIBDIR= /usr/lib:LIBDIR= /usr/$(get_libdir):" \
+ -i Makefile || die "Failed to fix multilib in makefile"
+}
+
+src_compile() {
+ # bug #299224
+ emake -j1 \
+ T="${D}" \
+ DEBUG="${CFLAGS}" \
+ CALCPAGER=less \
+ USE_READLINE="-DUSE_READLINE" \
+ READLINE_LIB="-lreadline -lhistory -lncurses" \
+ all \
+ || die
+ if echo "${LD_PRELOAD}" | grep -q "sandbox"; then
+ ewarn "Can't run check when running in sandbox - see bug #59676"
+ else
+ make chk || die "Check failed"
+ fi
+}
+
+src_install() {
+ make T="${D}" install || die
+ dodoc BUGS CHANGES LIBRARY README
+}
diff --git a/sci-mathematics/calc/calc-2.12.4.13.ebuild b/sci-mathematics/calc/calc-2.12.4.13.ebuild
new file mode 100644
index 000000000000..66696e9940dc
--- /dev/null
+++ b/sci-mathematics/calc/calc-2.12.4.13.ebuild
@@ -0,0 +1,57 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+inherit eutils multilib toolchain-funcs
+
+DESCRIPTION="Arbitrary precision C-like arithmetic system"
+HOMEPAGE="http://www.isthe.com/chongo/tech/comp/calc/"
+SRC_URI="http://www.isthe.com/chongo/src/calc/${P}.tar.bz2"
+
+SLOT="0"
+LICENSE="LGPL-2"
+KEYWORDS="~alpha ~amd64 ~ppc ~ppc64 ~x86 ~amd64-linux ~x86-linux"
+
+IUSE=""
+
+DEPEND="
+ sys-libs/ncurses
+ sys-libs/readline"
+RDEPEND="${DEPEND}"
+
+src_prepare() {
+ epatch "${FILESDIR}"/${PN}-2.12.4.13-prefix.patch\
+ "${FILESDIR}"/2.12.4.0-ldflags.patch
+ ln -sf libcustcalc.so.${PV} custom/libcustcalc.so || die
+ sed -i -e "/DIR/s:/usr:${EPREFIX}/usr:g" Makefile || die
+}
+
+src_compile() {
+ # parallel compilation hard to fix. better to leave upstream.
+ emake -j1 \
+ CC="$(tc-getCC)" \
+ DEBUG="${CFLAGS}" \
+ LDFLAGS="${LDFLAGS}" \
+ CALCPAGER="${PAGER}" \
+ USE_READLINE="-DUSE_READLINE" \
+ READLINE_LIB="-lreadline -lhistory -lncurses -L${S}/custom -lcustcalc" \
+ all
+}
+
+src_test() {
+ if echo "${LD_PRELOAD}" | grep -q "sandbox"; then
+ ewarn "Can't run check when running in sandbox - see bug #59676"
+ else
+ emake chk
+ fi
+}
+
+src_install() {
+ emake \
+ T="${D}" \
+ LIBDIR="${EPREFIX}/usr/$(get_libdir)" \
+ install
+ dodoc BUGS CHANGES LIBRARY README
+}
diff --git a/sci-mathematics/calc/calc-2.12.4.3.ebuild b/sci-mathematics/calc/calc-2.12.4.3.ebuild
new file mode 100644
index 000000000000..4b011af490f1
--- /dev/null
+++ b/sci-mathematics/calc/calc-2.12.4.3.ebuild
@@ -0,0 +1,53 @@
+# Copyright 1999-2011 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="3"
+
+inherit eutils multilib toolchain-funcs
+
+DESCRIPTION="An arbitrary precision C-like arithmetic system"
+HOMEPAGE="http://www.isthe.com/chongo/tech/comp/calc/"
+SRC_URI="mirror://sourceforge/${PN}/${P}.tar.bz2"
+
+SLOT="0"
+LICENSE="LGPL-2"
+KEYWORDS="~alpha ~amd64 ~ppc ~ppc64 ~x86 ~amd64-linux ~x86-linux"
+
+IUSE=""
+
+DEPEND="
+ >=sys-libs/ncurses-5.2
+ >=sys-libs/readline-4.2"
+RDEPEND="${DEPEND}"
+
+src_prepare() {
+ epatch "${FILESDIR}"/${PN}-2.12.4.0-prefix.patch
+ epatch "${FILESDIR}"/2.12.4.0-ldflags.patch
+ ln -sf libcustcalc.so.${PV} custom/libcustcalc.so
+}
+
+src_compile() {
+ # parallel compilation hard to fix. better to leave upstream.
+ emake -j1 \
+ CC=$(tc-getCC) \
+ DEBUG="${CFLAGS}" \
+ LDFLAGS="${LDFLAGS}" \
+ CALCPAGER="${PAGER}" \
+ USE_READLINE="-DUSE_READLINE" \
+ READLINE_LIB="-lreadline -lhistory -lncurses -L${S}/custom -lcustcalc" \
+ all || die "emake failed"
+}
+
+src_test() {
+ if echo "${LD_PRELOAD}" | grep -q "sandbox"; then
+ ewarn "Can't run check when running in sandbox - see bug #59676"
+ else
+ make chk || die "Check failed"
+ fi
+}
+
+src_install() {
+ emake T="${D}" LIBDIR="${EPREFIX}/usr/$(get_libdir)" install || die "emake install failed"
+ dodoc BUGS CHANGES LIBRARY README
+}
diff --git a/sci-mathematics/calc/calc-2.12.4.4.ebuild b/sci-mathematics/calc/calc-2.12.4.4.ebuild
new file mode 100644
index 000000000000..9aca67e632bc
--- /dev/null
+++ b/sci-mathematics/calc/calc-2.12.4.4.ebuild
@@ -0,0 +1,57 @@
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=4
+
+inherit eutils multilib toolchain-funcs
+
+DESCRIPTION="Arbitrary precision C-like arithmetic system"
+HOMEPAGE="http://www.isthe.com/chongo/tech/comp/calc/"
+SRC_URI="http://www.isthe.com/chongo/src/calc/${P}.tar.bz2"
+
+SLOT="0"
+LICENSE="LGPL-2"
+KEYWORDS="~alpha ~amd64 ~ppc ~ppc64 ~x86 ~amd64-linux ~x86-linux"
+
+IUSE=""
+
+DEPEND="
+ sys-libs/ncurses
+ sys-libs/readline"
+RDEPEND="${DEPEND}"
+
+src_prepare() {
+ epatch "${FILESDIR}"/${PN}-2.12.4.0-prefix.patch
+ epatch "${FILESDIR}"/2.12.4.0-ldflags.patch
+ ln -sf libcustcalc.so.${PV} custom/libcustcalc.so
+ sed -i -e "/DIR/s:/usr:${EPREFIX}/usr:g" Makefile || die
+}
+
+src_compile() {
+ # parallel compilation hard to fix. better to leave upstream.
+ emake -j1 \
+ CC="$(tc-getCC)" \
+ DEBUG="${CFLAGS}" \
+ LDFLAGS="${LDFLAGS}" \
+ CALCPAGER="${PAGER}" \
+ USE_READLINE="-DUSE_READLINE" \
+ READLINE_LIB="-lreadline -lhistory -lncurses -L${S}/custom -lcustcalc" \
+ all
+}
+
+src_test() {
+ if echo "${LD_PRELOAD}" | grep -q "sandbox"; then
+ ewarn "Can't run check when running in sandbox - see bug #59676"
+ else
+ emake chk || die "Check failed"
+ fi
+}
+
+src_install() {
+ emake \
+ T="${D}" \
+ LIBDIR="${EPREFIX}/usr/$(get_libdir)" \
+ install
+ dodoc BUGS CHANGES LIBRARY README
+}
diff --git a/sci-mathematics/calc/files/2.12.4.0-ldflags.patch b/sci-mathematics/calc/files/2.12.4.0-ldflags.patch
new file mode 100644
index 000000000000..0f2b67d2c084
--- /dev/null
+++ b/sci-mathematics/calc/files/2.12.4.0-ldflags.patch
@@ -0,0 +1,101 @@
+diff --git a/Makefile b/Makefile
+index b526442..baa8273 100644
+--- a/Makefile
++++ b/Makefile
+@@ -1144,11 +1144,13 @@ BLD_TYPE= calc-dynamic-only
+ #
+ CC_SHARE= -fPIC
+ LD_SHARE=
+-LIBCALC_SHLIB= -shared "-Wl,-soname,libcalc${LIB_EXT_VERSION}"
++LIBCUSTCALC_SHLIB= -shared ${LDFLAGS} "-Wl,-soname,libcalc${LIB_EXT_VERSION}"
+ ifdef ALLOW_CUSTOM
+-LIBCUSTCALC_SHLIB= -shared "-Wl,-soname,libcustcalc${LIB_EXT_VERSION}"
++LIBCUSTCALC_SHLIB= -shared ${LDFLAGS} "-Wl,-soname,libcustcalc${LIB_EXT_VERSION}"
++LIBCALC_SHLIB= -shared ${LDFLAGS} "-Wl,-soname,libcalc${LIB_EXT_VERSION}"
+ else
+-LIBCUSTCALC_SHLIB=
++LIBCUSTCALC_SHLIB= -shared ${LDFLAGS} "-Wl,-soname,libcustcalc${LIB_EXT_VERSION}"
++LIBCALC_SHLIB= -shared ${LDFLAGS} "-Wl,-soname,libcalc${LIB_EXT_VERSION}"
+ endif
+ #
+ CC_STATIC=
+@@ -1227,9 +1229,9 @@ BLD_TYPE= calc-dynamic-only
+ #
+ CC_SHARE= -fPIC
+ LD_SHARE=
+-LIBCALC_SHLIB= -shared "-Wl,-soname,libcalc${LIB_EXT_VERSION}"
++LIBCUSTCALC_SHLIB= -shared ${LDFLAGS} "-Wl,-soname,libcalc${LIB_EXT_VERSION}"
+ ifdef ALLOW_CUSTOM
+-LIBCUSTCALC_SHLIB= -shared "-Wl,-soname,libcustcalc${LIB_EXT_VERSION}"
++LIBCUSTCALC_SHLIB= -shared ${LDFLAGS} "-Wl,-soname,libcustcalc${LIB_EXT_VERSION}"
+ else
+ LIBCUSTCALC_SHLIB=
+ endif
+@@ -1267,9 +1269,9 @@ BLD_TYPE= calc-dynamic-only
+ #
+ CC_SHARE= -fPIC
+ LD_SHARE=
+-LIBCALC_SHLIB= -shared "-Wl,-soname,libcalc${LIB_EXT_VERSION}"
++LIBCUSTCALC_SHLIB= -shared ${LDFLAGS} "-Wl,-soname,libcalc${LIB_EXT_VERSION}"
+ ifdef ALLOW_CUSTOM
+-LIBCUSTCALC_SHLIB= -shared "-Wl,-soname,libcustcalc${LIB_EXT_VERSION}"
++LIBCUSTCALC_SHLIB= -shared ${LDFLAGS} "-Wl,-soname,libcustcalc${LIB_EXT_VERSION}"
+ else
+ LIBCUSTCALC_SHLIB=
+ endif
+@@ -1304,9 +1306,9 @@ CC_SHARE= -fPIC
+ DEFAULT_LIB_INSTALL_PATH= ${PWD}:/lib:/usr/lib:${LIBDIR}:/usr/local/lib
+ LD_SHARE= "-Wl,-rpath,${DEFAULT_LIB_INSTALL_PATH}" \
+ "-Wl,-rpath-link,${DEFAULT_LIB_INSTALL_PATH}"
+-LIBCALC_SHLIB= -shared "-Wl,-soname,libcalc${LIB_EXT_VERSION}"
++LIBCUSTCALC_SHLIB= -shared ${LDFLAGS} "-Wl,-soname,libcalc${LIB_EXT_VERSION}"
+ ifdef ALLOW_CUSTOM
+-LIBCUSTCALC_SHLIB= -shared "-Wl,-soname,libcustcalc${LIB_EXT_VERSION}"
++LIBCUSTCALC_SHLIB= -shared ${LDFLAGS} "-Wl,-soname,libcustcalc${LIB_EXT_VERSION}"
+ else
+ LIBCUSTCALC_SHLIB=
+ endif
+@@ -1340,8 +1342,8 @@ BLD_TYPE= calc-static-only
+ #
+ CC_SHARE= -fPIC
+ LD_SHARE=
+-LIBCALC_SHLIB= -shared "-Wl,-soname,libcalc${LIB_EXT_VERSION}"
+-LIBCUSTCALC_SHLIB= -shared "-Wl,-soname,libcustcalc${LIB_EXT_VERSION}"
++LIBCUSTCALC_SHLIB= -shared ${LDFLAGS} "-Wl,-soname,libcalc${LIB_EXT_VERSION}"
++LIBCUSTCALC_SHLIB= -shared ${LDFLAGS} "-Wl,-soname,libcustcalc${LIB_EXT_VERSION}"
+ #
+ CC_STATIC=
+ LD_STATIC=
+@@ -1394,9 +1396,9 @@ BLD_TYPE= calc-static-only
+ #
+ CC_SHARE= -fPIC
+ LD_SHARE=
+-LIBCALC_SHLIB= -shared "-Wl,-soname,libcalc${LIB_EXT_VERSION}"
++LIBCUSTCALC_SHLIB= -shared ${LDFLAGS} "-Wl,-soname,libcalc${LIB_EXT_VERSION}"
+ ifdef ALLOW_CUSTOM
+-LIBCUSTCALC_SHLIB= -shared "-Wl,-soname,libcustcalc${LIB_EXT_VERSION}"
++LIBCUSTCALC_SHLIB= -shared ${LDFLAGS} "-Wl,-soname,libcustcalc${LIB_EXT_VERSION}"
+ else
+ LIBCUSTCALC_SHLIB=
+ endif
+@@ -1431,9 +1433,9 @@ CC_SHARE= -fPIC
+ DEFAULT_LIB_INSTALL_PATH= ${PWD}:/lib:/usr/lib:${LIBDIR}:/usr/local/lib
+ LD_SHARE= "-Wl,-rpath,${DEFAULT_LIB_INSTALL_PATH}" \
+ "-Wl,-rpath-link,${DEFAULT_LIB_INSTALL_PATH}"
+-LIBCALC_SHLIB= -shared "-Wl,-soname,libcalc${LIB_EXT_VERSION}"
++LIBCUSTCALC_SHLIB= -shared ${LDFLAGS} "-Wl,-soname,libcalc${LIB_EXT_VERSION}"
+ ifdef ALLOW_CUSTOM
+-LIBCUSTCALC_SHLIB= -shared "-Wl,-soname,libcustcalc${LIB_EXT_VERSION}"
++LIBCUSTCALC_SHLIB= -shared ${LDFLAGS} "-Wl,-soname,libcustcalc${LIB_EXT_VERSION}"
+ else
+ LIBCUSTCALC_SHLIB=
+ endif
+@@ -2002,7 +2004,7 @@ calc-static-only: ${STATIC_FIRST_TARGETS} ${EARLY_TARGETS} \
+
+ calc${EXT}: .hsrc ${CALCOBJS} ${CALC_DYNAMIC_LIBS} ${MAKE_FILE}
+ ${RM} -f $@
+- ${CC} ${CALCOBJS} ${LDFLAGS} ${LD_SHARE} ${CALC_DYNAMIC_LIBS} \
++ ${CC} ${LDFLAGS} ${CALCOBJS} ${LD_SHARE} ${CALC_DYNAMIC_LIBS} \
+ ${READLINE_LIB} ${READLINE_EXTRAS} -o $@
+
+ libcalc${LIB_EXT_VERSION}: ${LIBOBJS} ver_calc${EXT} ${MAKE_FILE}
diff --git a/sci-mathematics/calc/files/calc-2.12.2.2-libdir-fix.patch b/sci-mathematics/calc/files/calc-2.12.2.2-libdir-fix.patch
new file mode 100644
index 000000000000..f265793ab871
--- /dev/null
+++ b/sci-mathematics/calc/files/calc-2.12.2.2-libdir-fix.patch
@@ -0,0 +1,12 @@
+diff -Naur calc-2.12.2.2.old/Makefile calc-2.12.2.2/Makefile
+--- calc-2.12.2.2.old/Makefile 2007-09-29 12:58:19.000000000 -0400
++++ calc-2.12.2.2/Makefile 2007-10-24 06:40:10.000000000 -0400
+@@ -1131,7 +1131,7 @@
+ BLD_TYPE= calc-dynamic-only
+ #
+ CC_SHARE= -fPIC
+-DEFAULT_LIB_INSTALL_PATH= ${PWD}:/lib:/usr/lib:${LIBDIR}:/usr/local/lib
++DEFAULT_LIB_INSTALL_PATH= /lib:/usr/lib:${LIBDIR}:/usr/local/lib
+ LD_SHARE= "-Wl,-rpath,${DEFAULT_LIB_INSTALL_PATH}" \
+ "-Wl,-rpath-link,${DEFAULT_LIB_INSTALL_PATH}"
+ LIBCALC_SHLIB= -shared "-Wl,-soname,libcalc${LIB_EXT_VERSION}"
diff --git a/sci-mathematics/calc/files/calc-2.12.4.0-prefix.patch b/sci-mathematics/calc/files/calc-2.12.4.0-prefix.patch
new file mode 100644
index 000000000000..68d057212c74
--- /dev/null
+++ b/sci-mathematics/calc/files/calc-2.12.4.0-prefix.patch
@@ -0,0 +1,96 @@
+diff --git a/Makefile b/Makefile
+index cc84386..b526442 100644
+--- a/Makefile
++++ b/Makefile
+@@ -959,7 +959,7 @@ LD_DEBUG=
+ #
+ # If in doubt, use CALC_ENV= CALCPATH=./cal LD_LIBRARY_PATH=.:./custom
+ #
+-CALC_ENV= CALCPATH=./cal LD_LIBRARY_PATH=.
++CALC_ENV= CALCPATH=./cal LD_LIBRARY_PATH=. DYLD_LIBRARY_PATH=.
+ #CALC_ENV= CALCPATH=./cal MALLOC_VERBOSE=1 MALLOC_TRACING=1 \
+ # MALLOC_FASTCHK=1 MALLOC_FULLWARN=1 LD_LIBRARY_PATH=.:./custom
+ #CALC_ENV= CALCPATH=./cal MALLOC_VERBOSE=1 MALLOC_TRACING=1 \
+@@ -1143,9 +1143,7 @@ ifeq ($(target),Linux)
+ BLD_TYPE= calc-dynamic-only
+ #
+ CC_SHARE= -fPIC
+-DEFAULT_LIB_INSTALL_PATH= ${PWD}:/lib:/usr/lib:${LIBDIR}:/usr/local/lib
+-LD_SHARE= "-Wl,-rpath,${DEFAULT_LIB_INSTALL_PATH}" \
+- "-Wl,-rpath-link,${DEFAULT_LIB_INSTALL_PATH}"
++LD_SHARE=
+ LIBCALC_SHLIB= -shared "-Wl,-soname,libcalc${LIB_EXT_VERSION}"
+ ifdef ALLOW_CUSTOM
+ LIBCUSTCALC_SHLIB= -shared "-Wl,-soname,libcustcalc${LIB_EXT_VERSION}"
+@@ -1177,9 +1175,8 @@ ifeq ($(target),Darwin)
+ BLD_TYPE= calc-dynamic-only
+ #
+ CC_SHARE= -fPIC
+-DEFAULT_LIB_INSTALL_PATH= ${PWD}:${LIBDIR}:/usr/local/lib
+ LD_SHARE= ${DARWIN_ARCH}
+-LIBCALC_SHLIB= -single_module -undefined dynamic_lookup -dynamiclib
++LIBCALC_SHLIB= -single_module -undefined dynamic_lookup -dynamiclib -install_name ${LIBDIR}/libcalc${LIB_EXT_VERSION}
+ ifdef ALLOW_CUSTOM
+ LIBCUSTCALC_SHLIB= -single_module -undefined dynamic_lookup -dynamiclib
+ else
+@@ -1196,7 +1193,7 @@ CCWERR=
+ CCOPT= ${DEBUG}
+ CCMISC= ${DARWIN_ARCH}
+ #
+-LCC= MACOSX_DEPLOYMENT_TARGET=${MACOSX_DEPLOYMENT_TARGET} gcc
++LCC= gcc
+ CC= ${PURIFY} ${LCC} ${CCWERR}
+ #
+ # Darmin dynamic shared lib filenames
+@@ -1211,7 +1208,6 @@ LDCONFIG:=
+ # DARWIN_ARCH= -arch i386 # Intel binary
+ # DARWIN_ARCH= -arch ppc # PPC binary
+ DARWIN_ARCH= # native binary
+-MACOSX_DEPLOYMENT_TARGET=10.4
+ #
+ endif
+
+@@ -1230,9 +1226,7 @@ ifeq ($(target),FreeBSD)
+ BLD_TYPE= calc-dynamic-only
+ #
+ CC_SHARE= -fPIC
+-DEFAULT_LIB_INSTALL_PATH= ${PWD}:/lib:/usr/lib:${LIBDIR}:/usr/local/lib
+-LD_SHARE= "-Wl,-rpath,${DEFAULT_LIB_INSTALL_PATH}" \
+- "-Wl,-rpath-link,${DEFAULT_LIB_INSTALL_PATH}"
++LD_SHARE=
+ LIBCALC_SHLIB= -shared "-Wl,-soname,libcalc${LIB_EXT_VERSION}"
+ ifdef ALLOW_CUSTOM
+ LIBCUSTCALC_SHLIB= -shared "-Wl,-soname,libcustcalc${LIB_EXT_VERSION}"
+@@ -1272,9 +1266,7 @@ ifeq ($(target),OpenBSD)
+ BLD_TYPE= calc-dynamic-only
+ #
+ CC_SHARE= -fPIC
+-DEFAULT_LIB_INSTALL_PATH= ${PWD}:/lib:/usr/lib:${LIBDIR}:/usr/local/lib
+-LD_SHARE= "-Wl,-rpath,${DEFAULT_LIB_INSTALL_PATH}" \
+- "-Wl,-rpath-link,${DEFAULT_LIB_INSTALL_PATH}"
++LD_SHARE=
+ LIBCALC_SHLIB= -shared "-Wl,-soname,libcalc${LIB_EXT_VERSION}"
+ ifdef ALLOW_CUSTOM
+ LIBCUSTCALC_SHLIB= -shared "-Wl,-soname,libcustcalc${LIB_EXT_VERSION}"
+@@ -1347,9 +1339,7 @@ ifeq ($(target),simple)
+ BLD_TYPE= calc-static-only
+ #
+ CC_SHARE= -fPIC
+-DEFAULT_LIB_INSTALL_PATH= ${PWD}:/lib:/usr/lib:${LIBDIR}:/usr/local/lib
+-LD_SHARE= "-Wl,-rpath,${DEFAULT_LIB_INSTALL_PATH}" \
+- "-Wl,-rpath-link,${DEFAULT_LIB_INSTALL_PATH}"
++LD_SHARE=
+ LIBCALC_SHLIB= -shared "-Wl,-soname,libcalc${LIB_EXT_VERSION}"
+ LIBCUSTCALC_SHLIB= -shared "-Wl,-soname,libcustcalc${LIB_EXT_VERSION}"
+ #
+@@ -1403,9 +1393,7 @@ CALCRC= ${CALC_SHAREDIR}/startup;~/.calcrc;./.calcinit
+ BLD_TYPE= calc-static-only
+ #
+ CC_SHARE= -fPIC
+-DEFAULT_LIB_INSTALL_PATH= ${PWD}:/lib:/usr/lib:${LIBDIR}:/usr/local/lib
+-LD_SHARE= "-Wl,-rpath,${DEFAULT_LIB_INSTALL_PATH}" \
+- "-Wl,-rpath-link,${DEFAULT_LIB_INSTALL_PATH}"
++LD_SHARE=
+ LIBCALC_SHLIB= -shared "-Wl,-soname,libcalc${LIB_EXT_VERSION}"
+ ifdef ALLOW_CUSTOM
+ LIBCUSTCALC_SHLIB= -shared "-Wl,-soname,libcustcalc${LIB_EXT_VERSION}"
diff --git a/sci-mathematics/calc/files/calc-2.12.4.13-prefix.patch b/sci-mathematics/calc/files/calc-2.12.4.13-prefix.patch
new file mode 100644
index 000000000000..727618c3fe71
--- /dev/null
+++ b/sci-mathematics/calc/files/calc-2.12.4.13-prefix.patch
@@ -0,0 +1,87 @@
+diff --git a/Makefile b/Makefile
+index cc84386..b526442 100644
+--- a/Makefile
++++ b/Makefile
+@@ -1143,9 +1143,7 @@ ifeq ($(target),Linux)
+ BLD_TYPE= calc-dynamic-only
+ #
+ CC_SHARE= -fPIC
+-DEFAULT_LIB_INSTALL_PATH= ${PWD}:/lib:/usr/lib:${LIBDIR}:/usr/local/lib
+-LD_SHARE= "-Wl,-rpath,${DEFAULT_LIB_INSTALL_PATH}" \
+- "-Wl,-rpath-link,${DEFAULT_LIB_INSTALL_PATH}"
++LD_SHARE=
+ LIBCALC_SHLIB= -shared "-Wl,-soname,libcalc${LIB_EXT_VERSION}"
+ ifdef ALLOW_CUSTOM
+ LIBCUSTCALC_SHLIB= -shared "-Wl,-soname,libcustcalc${LIB_EXT_VERSION}"
+@@ -1177,9 +1175,8 @@ ifeq ($(target),Darwin)
+ BLD_TYPE= calc-dynamic-only
+ #
+ CC_SHARE= -fPIC
+-DEFAULT_LIB_INSTALL_PATH= ${PWD}:${LIBDIR}:/usr/local/lib
+ LD_SHARE= ${DARWIN_ARCH}
+-LIBCALC_SHLIB= -single_module -undefined dynamic_lookup -dynamiclib
++LIBCALC_SHLIB= -single_module -undefined dynamic_lookup -dynamiclib -install_name ${LIBDIR}/libcalc${LIB_EXT_VERSION}
+ ifdef ALLOW_CUSTOM
+ LIBCUSTCALC_SHLIB= -single_module -undefined dynamic_lookup -dynamiclib
+ else
+@@ -1196,7 +1193,7 @@ CCWERR=
+ CCOPT= ${DEBUG}
+ CCMISC= ${DARWIN_ARCH}
+ #
+-LCC= MACOSX_DEPLOYMENT_TARGET=${MACOSX_DEPLOYMENT_TARGET} gcc
++LCC= gcc
+ CC= ${PURIFY} ${LCC} ${CCWERR}
+ #
+ # Darmin dynamic shared lib filenames
+@@ -1211,7 +1208,6 @@ LDCONFIG:=
+ # DARWIN_ARCH= -arch i386 # Intel binary
+ # DARWIN_ARCH= -arch ppc # PPC binary
+ DARWIN_ARCH= # native binary
+-MACOSX_DEPLOYMENT_TARGET=10.8
+ #
+ endif
+
+@@ -1230,9 +1226,7 @@ ifeq ($(target),FreeBSD)
+ BLD_TYPE= calc-dynamic-only
+ #
+ CC_SHARE= -fPIC
+-DEFAULT_LIB_INSTALL_PATH= ${PWD}:/lib:/usr/lib:${LIBDIR}:/usr/local/lib
+-LD_SHARE= "-Wl,-rpath,${DEFAULT_LIB_INSTALL_PATH}" \
+- "-Wl,-rpath-link,${DEFAULT_LIB_INSTALL_PATH}"
++LD_SHARE=
+ LIBCALC_SHLIB= -shared "-Wl,-soname,libcalc${LIB_EXT_VERSION}"
+ ifdef ALLOW_CUSTOM
+ LIBCUSTCALC_SHLIB= -shared "-Wl,-soname,libcustcalc${LIB_EXT_VERSION}"
+@@ -1272,9 +1266,7 @@ ifeq ($(target),OpenBSD)
+ BLD_TYPE= calc-dynamic-only
+ #
+ CC_SHARE= -fPIC
+-DEFAULT_LIB_INSTALL_PATH= ${PWD}:/lib:/usr/lib:${LIBDIR}:/usr/local/lib
+-LD_SHARE= "-Wl,-rpath,${DEFAULT_LIB_INSTALL_PATH}" \
+- "-Wl,-rpath-link,${DEFAULT_LIB_INSTALL_PATH}"
++LD_SHARE=
+ LIBCALC_SHLIB= -shared "-Wl,-soname,libcalc${LIB_EXT_VERSION}"
+ ifdef ALLOW_CUSTOM
+ LIBCUSTCALC_SHLIB= -shared "-Wl,-soname,libcustcalc${LIB_EXT_VERSION}"
+@@ -1347,9 +1339,7 @@ ifeq ($(target),simple)
+ BLD_TYPE= calc-static-only
+ #
+ CC_SHARE= -fPIC
+-DEFAULT_LIB_INSTALL_PATH= ${PWD}:/lib:/usr/lib:${LIBDIR}:/usr/local/lib
+-LD_SHARE= "-Wl,-rpath,${DEFAULT_LIB_INSTALL_PATH}" \
+- "-Wl,-rpath-link,${DEFAULT_LIB_INSTALL_PATH}"
++LD_SHARE=
+ LIBCALC_SHLIB= -shared "-Wl,-soname,libcalc${LIB_EXT_VERSION}"
+ LIBCUSTCALC_SHLIB= -shared "-Wl,-soname,libcustcalc${LIB_EXT_VERSION}"
+ #
+@@ -1403,9 +1393,7 @@ CALCRC= ${CALC_SHAREDIR}/startup;~/.calcrc;./.calcinit
+ BLD_TYPE= calc-static-only
+ #
+ CC_SHARE= -fPIC
+-DEFAULT_LIB_INSTALL_PATH= ${PWD}:/lib:/usr/lib:${LIBDIR}:/usr/local/lib
+-LD_SHARE= "-Wl,-rpath,${DEFAULT_LIB_INSTALL_PATH}" \
+- "-Wl,-rpath-link,${DEFAULT_LIB_INSTALL_PATH}"
++LD_SHARE=
+ LIBCALC_SHLIB= -shared "-Wl,-soname,libcalc${LIB_EXT_VERSION}"
+ ifdef ALLOW_CUSTOM
+ LIBCUSTCALC_SHLIB= -shared "-Wl,-soname,libcustcalc${LIB_EXT_VERSION}"
diff --git a/sci-mathematics/calc/metadata.xml b/sci-mathematics/calc/metadata.xml
new file mode 100644
index 000000000000..4c7eb900a0cb
--- /dev/null
+++ b/sci-mathematics/calc/metadata.xml
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+<herd>sci-mathematics</herd>
+<longdescription lang='en'>
+ Calc is an interactive calculator which provides for easy large
+ numeric calculations, but which also can be easily programmed for
+ difficult or long calculations. It can accept a command line argument,
+ in which case it executes that single command and exits. Otherwise, it
+ enters interactive mode.
+</longdescription>
+</pkgmetadata>
diff --git a/sci-mathematics/cgal/Manifest b/sci-mathematics/cgal/Manifest
new file mode 100644
index 000000000000..3d7cd2259656
--- /dev/null
+++ b/sci-mathematics/cgal/Manifest
@@ -0,0 +1,4 @@
+DIST CGAL-4.3-doc_html.tar.xz 15582924 SHA256 dd28989ee950178b3f22d8b14111510312586c1a2c0b29a73a2a14d7d7eb5059 SHA512 41125ab3b5135ae539365e6c128f79119a679292e734e1669cc43a35996363951f5a5d494f8c25c3b1eab75a69137ed51bf7b65ad6d47e56756212565ec245ec WHIRLPOOL 961c4fea224e2c94a65a7dd07b16326159e9fe95f9176abd0cc96be3cb53060c076a80d5efd2d9c640c2aa2eea0d3d06ce64839961906a588706647830849972
+DIST CGAL-4.3.tar.xz 10108992 SHA256 cc475885b4ca4b15ab5d446c0e554b7b69f6980969bc3a8c5b83f8da4ee1bb04 SHA512 dcf329232f6511be6b7eecef7afbfd505529385cb29a3717b762068a3dac52b3706b1d55c6e30b677c6cf2f99aae937de7d730d30cc33680fc39df0f0ff76e70 WHIRLPOOL 862d5bc3387afa1b6702974b7fab3b7d4c35334023eb813bb52a6c7092d6f89104db8c7b851fd7ebb7dfdd38392f9d6459e9afab34bf237b0484f7d395035873
+DIST CGAL-4.6.1-doc_html.tar.xz 33812896 SHA256 eac811009dac1cf87fac42f493e57b902e90f3d5e74201d0ea9b688835854886 SHA512 d351bae419cff4d2bc576f461b9c29335a25afbccd7d56f83f3ad503ca6f9295cda4aa27b1d74563fbb41a9d92c71600f9575302a4597623e984097484928161 WHIRLPOOL d4f0ab9b57fcf9a4317a1c3f6f6fae26396b2b95c2a24d410d231c74ac6f544f5394962702fcbf841e606078a81520c2e3b236e2f5bc9b3a25f4675d757e8c9f
+DIST CGAL-4.6.1.tar.xz 12014652 SHA256 33bd82871ccbaf16dc509f78f3f91dd35d44197cad64bffa63a1671a1812351a SHA512 4227ea03c23f3858a47e0559bc0a3df34e447e18e2b053048378c479b9b7fa2a157cf9aa546d7659a1d4d640218944fe1104a21769144cdfdc8a5144299f4b61 WHIRLPOOL 309deea6268d036b14796b411a7dcdbe75433a6d5eb2296387b05f2957e538cce6e6fe0b23be3921a500eae74db954058ed57aeef8759e44f4038d2fbab884f7
diff --git a/sci-mathematics/cgal/cgal-4.3-r1.ebuild b/sci-mathematics/cgal/cgal-4.3-r1.ebuild
new file mode 100644
index 000000000000..caf5f20129e9
--- /dev/null
+++ b/sci-mathematics/cgal/cgal-4.3-r1.ebuild
@@ -0,0 +1,76 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+CMAKE_BUILD_TYPE=Release
+
+inherit multilib cmake-utils
+
+MY_P=CGAL-${PV}
+PID=32995
+DPID=33000
+
+DESCRIPTION="C++ library for geometric algorithms and data structures"
+HOMEPAGE="http://www.cgal.org/ https://gforge.inria.fr/projects/cgal/"
+SRC_URI="
+ http://gforge.inria.fr/frs/download.php/${PID}/${MY_P}.tar.xz
+ doc? ( http://gforge.inria.fr/frs/download.php/${DPID}/${MY_P}-doc_html.tar.xz )"
+
+LICENSE="LGPL-3 GPL-3 Boost-1.0"
+SLOT="0"
+KEYWORDS="~amd64 ~x86 ~amd64-linux ~x86-linux"
+IUSE="doc examples +gmp mpfi qt4"
+
+RDEPEND="
+ dev-libs/boost
+ dev-libs/mpfr:0
+ sys-libs/zlib
+ x11-libs/libX11
+ virtual/glu
+ virtual/opengl
+ gmp? ( dev-libs/gmp[cxx] )
+ qt4? (
+ dev-qt/qtgui:4
+ dev-qt/qtopengl:4
+ )
+ mpfi? ( sci-libs/mpfi )"
+DEPEND="${RDEPEND}
+ app-arch/xz-utils
+ virtual/pkgconfig"
+
+S="${WORKDIR}/${MY_P}"
+
+DOCS="AUTHORS CHANGES* README"
+
+src_prepare() {
+ epatch "${FILESDIR}"/${P}-cmake-3.3.patch
+
+ cmake-utils_src_prepare
+ sed \
+ -e '/install(FILES AUTHORS/d' \
+ -i CMakeLists.txt || die
+}
+
+src_configure() {
+ local mycmakeargs=(
+ -DCGAL_INSTALL_LIB_DIR=$(get_libdir)
+ -DWITH_CGAL_Qt3=OFF
+ -DWITH_LEDA=OFF
+ $(cmake-utils_use_with gmp)
+ $(cmake-utils_use_with gmp GMPXX)
+ $(cmake-utils_use_with qt4 CGAL_Qt4)
+ $(cmake-utils_use_with mpfi)
+ )
+ cmake-utils_src_configure
+}
+
+src_install() {
+ use doc && HTML_DOCS=( "${WORKDIR}"/doc_html/. )
+ cmake-utils_src_install
+ if use examples; then
+ insinto /usr/share/doc/${PF}
+ doins -r examples demo
+ fi
+}
diff --git a/sci-mathematics/cgal/cgal-4.3.ebuild b/sci-mathematics/cgal/cgal-4.3.ebuild
new file mode 100644
index 000000000000..46bbca202239
--- /dev/null
+++ b/sci-mathematics/cgal/cgal-4.3.ebuild
@@ -0,0 +1,74 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+CMAKE_BUILD_TYPE=Release
+
+inherit multilib cmake-utils
+
+MY_P=CGAL-${PV}
+PID=32995
+DPID=33000
+
+DESCRIPTION="C++ library for geometric algorithms and data structures"
+HOMEPAGE="http://www.cgal.org/ https://gforge.inria.fr/projects/cgal/"
+SRC_URI="
+ http://gforge.inria.fr/frs/download.php/${PID}/${MY_P}.tar.xz
+ doc? ( http://gforge.inria.fr/frs/download.php/${DPID}/${MY_P}-doc_html.tar.xz )"
+
+LICENSE="LGPL-3 GPL-3 Boost-1.0"
+SLOT="0"
+KEYWORDS="amd64 x86 ~amd64-linux ~x86-linux"
+IUSE="doc examples +gmp mpfi qt4"
+
+RDEPEND="
+ dev-libs/boost
+ dev-libs/mpfr:0
+ sys-libs/zlib
+ x11-libs/libX11
+ virtual/glu
+ virtual/opengl
+ gmp? ( dev-libs/gmp[cxx] )
+ qt4? (
+ dev-qt/qtgui:4
+ dev-qt/qtopengl:4
+ )
+ mpfi? ( sci-libs/mpfi )"
+DEPEND="${RDEPEND}
+ app-arch/xz-utils
+ virtual/pkgconfig"
+
+S="${WORKDIR}/${MY_P}"
+
+DOCS="AUTHORS CHANGES* README"
+
+src_prepare() {
+ cmake-utils_src_prepare
+ sed \
+ -e '/install(FILES AUTHORS/d' \
+ -i CMakeLists.txt || die
+}
+
+src_configure() {
+ local mycmakeargs+=(
+ -DCGAL_INSTALL_LIB_DIR=$(get_libdir)
+ -DWITH_CGAL_Qt3=OFF
+ -DWITH_LEDA=OFF
+ $(cmake-utils_use_with gmp)
+ $(cmake-utils_use_with gmp GMPXX)
+ $(cmake-utils_use_with qt4 CGAL_Qt4)
+ $(cmake-utils_use_with mpfi)
+ )
+ cmake-utils_src_configure
+}
+
+src_install() {
+ use doc && HTML_DOCS=( "${WORKDIR}"/doc_html/. )
+ cmake-utils_src_install
+ if use examples; then
+ insinto /usr/share/doc/${PF}
+ doins -r examples demo
+ fi
+}
diff --git a/sci-mathematics/cgal/cgal-4.6.1.ebuild b/sci-mathematics/cgal/cgal-4.6.1.ebuild
new file mode 100644
index 000000000000..33382d425c70
--- /dev/null
+++ b/sci-mathematics/cgal/cgal-4.6.1.ebuild
@@ -0,0 +1,74 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+CMAKE_BUILD_TYPE=Release
+
+inherit multilib cmake-utils
+
+MY_P=CGAL-${PV}
+PID=34900
+DPID=34902
+
+DESCRIPTION="C++ library for geometric algorithms and data structures"
+HOMEPAGE="http://www.cgal.org/ https://gforge.inria.fr/projects/cgal/"
+SRC_URI="
+ http://gforge.inria.fr/frs/download.php/${PID}/${MY_P}.tar.xz
+ doc? ( http://gforge.inria.fr/frs/download.php/${DPID}/${MY_P}-doc_html.tar.xz )"
+
+LICENSE="LGPL-3 GPL-3 Boost-1.0"
+SLOT="0"
+KEYWORDS="~amd64 ~x86 ~amd64-linux ~x86-linux"
+IUSE="doc examples +gmp mpfi qt4"
+
+RDEPEND="
+ dev-libs/boost
+ dev-libs/mpfr:0
+ sys-libs/zlib
+ x11-libs/libX11
+ virtual/glu
+ virtual/opengl
+ gmp? ( dev-libs/gmp[cxx] )
+ qt4? (
+ dev-qt/qtgui:4
+ dev-qt/qtopengl:4
+ )
+ mpfi? ( sci-libs/mpfi )"
+DEPEND="${RDEPEND}
+ app-arch/xz-utils
+ virtual/pkgconfig"
+
+S="${WORKDIR}/${MY_P}"
+
+DOCS="AUTHORS CHANGES* README"
+
+src_prepare() {
+ cmake-utils_src_prepare
+ sed \
+ -e '/install(FILES AUTHORS/d' \
+ -i CMakeLists.txt || die
+}
+
+src_configure() {
+ local mycmakeargs=(
+ -DCGAL_INSTALL_LIB_DIR=$(get_libdir)
+ -DWITH_CGAL_Qt3=OFF
+ -DWITH_LEDA=OFF
+ $(cmake-utils_use_with gmp)
+ $(cmake-utils_use_with gmp GMPXX)
+ $(cmake-utils_use_with qt4 CGAL_Qt4)
+ $(cmake-utils_use_with mpfi)
+ )
+ cmake-utils_src_configure
+}
+
+src_install() {
+ use doc && HTML_DOCS=( "${WORKDIR}"/doc_html/. )
+ cmake-utils_src_install
+ if use examples; then
+ insinto /usr/share/doc/${PF}
+ doins -r examples demo
+ fi
+}
diff --git a/sci-mathematics/cgal/files/cgal-4.3-cmake-3.3.patch b/sci-mathematics/cgal/files/cgal-4.3-cmake-3.3.patch
new file mode 100644
index 000000000000..b1490454e559
--- /dev/null
+++ b/sci-mathematics/cgal/files/cgal-4.3-cmake-3.3.patch
@@ -0,0 +1,24 @@
+--- CGAL-4.3/CMakeLists.txt
++++ CGAL-4.3/CMakeLists.txt
+@@ -19,6 +19,10 @@
+ cmake_policy(VERSION 2.6)
+ endif()
+
++if(POLICY CMP0026)
++ cmake_policy(SET CMP0026 OLD)
++endif()
++
+ #--------------------------------------------------------------------------------------------------
+ #
+ # -= PACKAGE SETUP =-
+--- CGAL-4.3/src/CMakeLists.txt
++++ CGAL-4.3/src/CMakeLists.txt
+@@ -116,7 +116,7 @@
+ file(GLOB CONFIGURED_LIBS_IN_PACKAGE ${package}/src/CGAL_*/CMakeLists.txt)
+ foreach (libconfigfile ${CONFIGURED_LIBS_IN_PACKAGE})
+ string(REPLACE "${package}/src/" "" libconfigfile ${libconfigfile})
+- string(REPLACE "//CMakeLists.txt" "" CGAL_CONFIGURED_LIBRARY_NAME ${libconfigfile})
++ string(REPLACE "/CMakeLists.txt" "" CGAL_CONFIGURED_LIBRARY_NAME ${libconfigfile})
+ if (NOT ${CGAL_CONFIGURED_LIBRARY_NAME} STREQUAL "CGAL")
+
+ message(STATUS "Sources for CGAL component library '${CGAL_CONFIGURED_LIBRARY_NAME}' detected")
diff --git a/sci-mathematics/cgal/metadata.xml b/sci-mathematics/cgal/metadata.xml
new file mode 100644
index 000000000000..aa54a0b5987d
--- /dev/null
+++ b/sci-mathematics/cgal/metadata.xml
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <herd>sci-mathematics</herd>
+ <longdescription lang="en">
+ The Computational Geometry Algorithms Library is a collaborative
+ open source library containing:
+ * the Kernel with geometric primitives such as points, vectors,
+ lines, predicates for testing things such as relative positions of
+ points, and operations such as intersections and distance calculation.
+ * the Basic Library which is a collection of standard data
+ structures and geometric algorithms, such as convex hull in 2D/3D,
+ (Delaunay) triangulation in 2D/3D, planar map, polyhedron, smallest
+ enclosing circle, and multidimensional query structures.
+ * the Support Library which offers interfaces to other packages,
+ e.g., for visualisation, and I/O, and other support facilities.
+</longdescription>
+ <use>
+ <flag name="mpfi">Enable support for multiple recision interval arithmetic via <pkg>sci-mathematics/mpfi</pkg></flag>
+ </use>
+</pkgmetadata>
diff --git a/sci-mathematics/coq/Manifest b/sci-mathematics/coq/Manifest
new file mode 100644
index 000000000000..d322df030f8f
--- /dev/null
+++ b/sci-mathematics/coq/Manifest
@@ -0,0 +1,6 @@
+DIST coq-8.3pl1.tar.gz 3756961 SHA256 3a497386bd74f43a5af1d0c53f29a017ce7ed1b1e60c052217fe04b7f40be928
+DIST coq-8.4pl1.tar.gz 4139808 SHA256 5d0e4553ab50677a94b4d5ca1650a90718e9362082a649ba95be4010390a0f80 SHA512 dc0073d2cbce91ac27749d84de1b350ad71632555a682d8af6612768d2c92311eb1fd36b7370e0fb630d540639a1c7e16f26a9de25d03d82c3a6eefb99aa3420 WHIRLPOOL e912b97ba1f91d3398d569a588d7cb420389c88971847e66ddff38c3fc715e45842aab285e343c0c6339da659f324ee7b60f37fd0cdcd5a8ce27ab0e8cce915a
+DIST coq-8.4pl2.tar.gz 4145112 SHA256 fb719a38f613b01861e3b251e745a5c8ef395a26ce7029668e85ac75fcbca2d8 SHA512 151291a508c56f9fdc9efd96096852e94c247724030ad13122ad729476f3f7d4885c9202737d9109b6fa7f58029d3b9e8f472a7e587e0b60a49a0224ac399031 WHIRLPOOL ac338571da5f6efc08e9184f1e13b9783bd750627c70af2eee46116d2d949e61a0cbf31745373ccea3b3b862c1188316c2aa3b38e211a398185503c2844a33c5
+DIST coq-8.4pl3.tar.gz 4064579 SHA256 97583d637f981c5554007f4e99ce6420ebc737186b1d021bd71766fd891cfb38 SHA512 e4a385b10b30159545c283e11400f5790a6ca1b91632afe93b73c6a8b523fd408db173b25a1797f69bdfde9a16b37751944041aa9be5a1194b0fe49a9bb56240 WHIRLPOOL c44cc9f55f25dfb37d7b011c3ede3ad47f7191b02a6258bd4bda67854b9cce0e32b412ead826a5ca7a21dc2fe8841774231cb0693da335f5146172463ec57aa2
+DIST coq-8.4pl5.tar.gz 4070062 SHA256 35815ab78a58d72799eacaab155427620ab071677882ca6c98d7bfec97d25245 SHA512 0965ff409933d601a5c96963ea805ce20dd22f1fd9a9473898de1b376403b4e7a9a86b36b58eb1480cfb3a25970626e1dcd225899c089f5a301f4809e7f8f242 WHIRLPOOL 6dea97e7fe655a33757e8f031b28f91f98558e53205890d6b9d928d5641c05814f8d743cb02c39b26dcf93aa4076c5bbd9710a7dfd9f6a3456e38039b0cb8220
+DIST coq-8.4pl6.tar.gz 4099815 SHA256 a540a231a9970a49353ca039f3544616ff86a208966ab1c593779ae13c91ebd6 SHA512 238bc6e28348f40f5619aa28d2e871179d9edeb6eb3f2521af6f407e24a889c8c68fa11c8b12e026f016f0fb7d5006447c3ab7eeae0804fc082d65774aefe0ef WHIRLPOOL 2120dcddce773d90ba024e97fc00df3d563edf398eaf0bbb3dc1df1265b5e657cb4044d334f598898c30a88f0579b35b38f1d6bad4ea5e373a0a30826b245e99
diff --git a/sci-mathematics/coq/coq-8.3_p1.ebuild b/sci-mathematics/coq/coq-8.3_p1.ebuild
new file mode 100644
index 000000000000..28c3feb39ecc
--- /dev/null
+++ b/sci-mathematics/coq/coq-8.3_p1.ebuild
@@ -0,0 +1,81 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="2"
+
+inherit eutils multilib
+
+MY_PV=${PV/_p/pl}
+MY_P=${PN}-${MY_PV}
+
+DESCRIPTION="Proof assistant written in O'Caml"
+HOMEPAGE="http://coq.inria.fr/"
+SRC_URI="http://${PN}.inria.fr/V${MY_PV}/files/${MY_P}.tar.gz"
+
+LICENSE="LGPL-2.1"
+SLOT="0"
+KEYWORDS="amd64 ppc x86"
+IUSE="gtk debug +ocamlopt doc"
+
+RDEPEND=">=dev-lang/ocaml-3.10[ocamlopt?]
+ >=dev-ml/camlp5-5.09[ocamlopt?]
+ gtk? ( >=dev-ml/lablgtk-2.10.1[ocamlopt?] )"
+DEPEND="${RDEPEND}
+ doc? (
+ media-libs/netpbm[png,zlib]
+ virtual/latex-base
+ dev-tex/hevea
+ dev-tex/xcolor
+ dev-texlive/texlive-pictures
+ dev-texlive/texlive-mathextra
+ dev-texlive/texlive-latexextra
+ )"
+
+S=${WORKDIR}/${MY_P}
+
+src_prepare() {
+ # configure has an error at line 640 leading to closing a string
+ # to early in the generated coq_config.ml. Here is a wild sed :)
+ # It replaces \"$LABLGTKLIB\" by $LABLGTKLIB
+ sed -i "s/\\\\\"\\\$LABLGTKLIB\\\\\"/\\\$LABLGTKLIB/" configure
+}
+
+src_configure() {
+ ocaml_lib=`ocamlc -where`
+ local myconf="--prefix /usr
+ --bindir /usr/bin
+ --libdir /usr/$(get_libdir)/coq
+ --mandir /usr/share/man
+ --emacslib /usr/share/emacs/site-lisp
+ --coqdocdir /usr/$(get_libdir)/coq/coqdoc
+ --docdir /usr/share/doc/${PF}
+ --camlp5dir ${ocaml_lib}/camlp5
+ --lablgtkdir ${ocaml_lib}/lablgtk2"
+
+ use debug && myconf="--debug $myconf"
+ use doc || myconf="$myconf --with-doc no"
+
+ if use gtk; then
+ use ocamlopt && myconf="$myconf --coqide opt"
+ use ocamlopt || myconf="$myconf --coqide byte"
+ else
+ myconf="$myconf --coqide no"
+ fi
+ use ocamlopt || myconf="$myconf -byte-only"
+ use ocamlopt && myconf="$myconf --opt"
+
+ export CAML_LD_LIBRARY_PATH="${S}/kernel/byterun/"
+ ./configure $myconf || die "configure failed"
+}
+
+src_compile() {
+ emake STRIP="true" -j1 || die "make failed"
+}
+
+src_install() {
+ emake STRIP="true" COQINSTALLPREFIX="${D}" install || die
+ dodoc README CREDITS CHANGES
+
+ use gtk && domenu "${FILESDIR}/coqide.desktop"
+}
diff --git a/sci-mathematics/coq/coq-8.4_p1.ebuild b/sci-mathematics/coq/coq-8.4_p1.ebuild
new file mode 100644
index 000000000000..0f01228661f9
--- /dev/null
+++ b/sci-mathematics/coq/coq-8.4_p1.ebuild
@@ -0,0 +1,81 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="5"
+
+inherit eutils multilib
+
+MY_PV=${PV/_p/pl}
+MY_P=${PN}-${MY_PV}
+
+DESCRIPTION="Proof assistant written in O'Caml"
+HOMEPAGE="http://coq.inria.fr/"
+SRC_URI="http://${PN}.inria.fr/V${MY_PV}/files/${MY_P}.tar.gz"
+
+LICENSE="LGPL-2.1"
+SLOT="0"
+KEYWORDS="amd64 ~ppc x86"
+IUSE="gtk debug +ocamlopt doc camlp5"
+
+RDEPEND=">=dev-lang/ocaml-3.11.2:=[ocamlopt?]
+ camlp5? ( >=dev-ml/camlp5-6.02.3:=[ocamlopt?] )
+ gtk? ( >=dev-ml/lablgtk-2.10.1:=[ocamlopt?] )"
+DEPEND="${RDEPEND}
+ doc? (
+ media-libs/netpbm[png,zlib]
+ virtual/latex-base
+ dev-tex/hevea
+ dev-tex/xcolor
+ dev-texlive/texlive-pictures
+ dev-texlive/texlive-mathextra
+ dev-texlive/texlive-latexextra
+ )"
+
+S=${WORKDIR}/${MY_P}
+
+src_prepare() {
+ epatch "${FILESDIR}/${P}-camlp4.patch"
+}
+
+src_configure() {
+ ocaml_lib=`ocamlc -where`
+ local myconf="--prefix /usr
+ --bindir /usr/bin
+ --libdir /usr/$(get_libdir)/coq
+ --mandir /usr/share/man
+ --emacslib /usr/share/emacs/site-lisp
+ --coqdocdir /usr/$(get_libdir)/coq/coqdoc
+ --docdir /usr/share/doc/${PF}
+ --configdir /etc/xdg/${PN}
+ --lablgtkdir ${ocaml_lib}/lablgtk2"
+
+ use debug && myconf="--debug $myconf"
+ use doc || myconf="$myconf --with-doc no"
+
+ if use gtk; then
+ use ocamlopt && myconf="$myconf --coqide opt"
+ use ocamlopt || myconf="$myconf --coqide byte"
+ else
+ myconf="$myconf --coqide no"
+ fi
+ use ocamlopt || myconf="$myconf -byte-only"
+ use ocamlopt && myconf="$myconf --opt"
+
+ use camlp5 || myconf="$myconf --usecamlp4"
+ use camlp5 && myconf="$myconf --camlp5dir ${ocaml_lib}/camlp5"
+
+ export CAML_LD_LIBRARY_PATH="${S}/kernel/byterun/"
+ ./configure $myconf || die "configure failed"
+}
+
+src_compile() {
+ emake STRIP="true" -j1 || die "make failed"
+}
+
+src_install() {
+ emake STRIP="true" COQINSTALLPREFIX="${D}" install || die
+ dodoc README CREDITS CHANGES
+
+ use gtk && make_desktop_entry "/usr/bin/coqide" "Coq IDE" "/usr/share/coq/coq.png"
+}
diff --git a/sci-mathematics/coq/coq-8.4_p2.ebuild b/sci-mathematics/coq/coq-8.4_p2.ebuild
new file mode 100644
index 000000000000..15fb377f1b5f
--- /dev/null
+++ b/sci-mathematics/coq/coq-8.4_p2.ebuild
@@ -0,0 +1,78 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="5"
+
+inherit eutils multilib
+
+MY_PV=${PV/_p/pl}
+MY_P=${PN}-${MY_PV}
+
+DESCRIPTION="Proof assistant written in O'Caml"
+HOMEPAGE="http://coq.inria.fr/"
+SRC_URI="http://${PN}.inria.fr/V${MY_PV}/files/${MY_P}.tar.gz"
+
+LICENSE="LGPL-2.1"
+SLOT="0"
+KEYWORDS="~amd64 ~ppc ~x86"
+IUSE="gtk debug +ocamlopt doc camlp5"
+
+RDEPEND="
+ >=dev-lang/ocaml-3.11.2:=[ocamlopt?]
+ camlp5? ( >=dev-ml/camlp5-6.02.3:=[ocamlopt?] )
+ gtk? ( >=dev-ml/lablgtk-2.10.1:=[ocamlopt?] )"
+DEPEND="${RDEPEND}
+ doc? (
+ media-libs/netpbm[png,zlib]
+ virtual/latex-base
+ dev-tex/hevea
+ dev-tex/xcolor
+ dev-texlive/texlive-pictures
+ dev-texlive/texlive-mathextra
+ dev-texlive/texlive-latexextra
+ )"
+
+S=${WORKDIR}/${MY_P}
+
+src_configure() {
+ ocaml_lib=`ocamlc -where`
+ local myconf="--prefix /usr
+ --bindir /usr/bin
+ --libdir /usr/$(get_libdir)/coq
+ --mandir /usr/share/man
+ --emacslib /usr/share/emacs/site-lisp
+ --coqdocdir /usr/$(get_libdir)/coq/coqdoc
+ --docdir /usr/share/doc/${PF}
+ --configdir /etc/xdg/${PN}
+ --lablgtkdir ${ocaml_lib}/lablgtk2"
+
+ use debug && myconf="--debug $myconf"
+ use doc || myconf="$myconf --with-doc no"
+
+ if use gtk; then
+ use ocamlopt && myconf="$myconf --coqide opt"
+ use ocamlopt || myconf="$myconf --coqide byte"
+ else
+ myconf="$myconf --coqide no"
+ fi
+ use ocamlopt || myconf="$myconf -byte-only"
+ use ocamlopt && myconf="$myconf --opt"
+
+ use camlp5 || myconf="$myconf --usecamlp4"
+ use camlp5 && myconf="$myconf --camlp5dir ${ocaml_lib}/camlp5"
+
+ export CAML_LD_LIBRARY_PATH="${S}/kernel/byterun/"
+ ./configure $myconf || die "configure failed"
+}
+
+src_compile() {
+ emake STRIP="true" -j1
+}
+
+src_install() {
+ emake STRIP="true" COQINSTALLPREFIX="${D}" install
+ dodoc README CREDITS CHANGES
+
+ use gtk && make_desktop_entry "/usr/bin/coqide" "Coq IDE" "/usr/share/coq/coq.png"
+}
diff --git a/sci-mathematics/coq/coq-8.4_p3.ebuild b/sci-mathematics/coq/coq-8.4_p3.ebuild
new file mode 100644
index 000000000000..25516ad987ee
--- /dev/null
+++ b/sci-mathematics/coq/coq-8.4_p3.ebuild
@@ -0,0 +1,90 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="5"
+
+inherit eutils multilib
+
+MY_PV=${PV/_p/pl}
+MY_P=${PN}-${MY_PV}
+
+DESCRIPTION="Proof assistant written in O'Caml"
+HOMEPAGE="http://coq.inria.fr/"
+SRC_URI="http://${PN}.inria.fr/V${MY_PV}/files/${MY_P}.tar.gz"
+
+LICENSE="LGPL-2.1"
+SLOT="0"
+KEYWORDS="~amd64 ~ppc ~x86"
+IUSE="gtk debug +ocamlopt doc camlp5"
+
+RDEPEND="
+ >=dev-lang/ocaml-3.11.2:=[ocamlopt?]
+ camlp5? ( >=dev-ml/camlp5-6.02.3:=[ocamlopt?] )
+ gtk? ( >=dev-ml/lablgtk-2.10.1:=[ocamlopt?] )"
+DEPEND="${RDEPEND}
+ doc? (
+ media-libs/netpbm[png,zlib]
+ virtual/latex-base
+ dev-tex/hevea
+ dev-tex/xcolor
+ dev-texlive/texlive-pictures
+ dev-texlive/texlive-mathextra
+ dev-texlive/texlive-latexextra
+ )"
+
+S=${WORKDIR}/${MY_P}
+
+src_configure() {
+ ocaml_lib=$(ocamlc -where)
+ local myconf=(
+ --prefix /usr
+ --bindir /usr/bin
+ --libdir /usr/$(get_libdir)/coq
+ --mandir /usr/share/man
+ --emacslib /usr/share/emacs/site-lisp
+ --coqdocdir /usr/$(get_libdir)/coq/coqdoc
+ --docdir /usr/share/doc/${PF}
+ --configdir /etc/xdg/${PN}
+ --lablgtkdir ${ocaml_lib}/lablgtk2
+ )
+
+ use debug && myconf+=( --debug )
+ use doc || myconf+=( --with-doc no )
+
+ if use gtk; then
+ if use ocamlopt; then
+ myconf+=( --coqide opt )
+ else
+ myconf+=( --coqide byte )
+ fi
+ else
+ myconf+=( --coqide no )
+ fi
+
+ if use ocamlopt; then
+ myconf+=( --opt )
+ else
+ myconf+=( -byte-only )
+ fi
+
+ if use camlp5; then
+ myconf+=( --camlp5dir ${ocaml_lib}/camlp5 )
+ else
+ myconf+=( --usecamlp4 )
+ fi
+
+ export CAML_LD_LIBRARY_PATH="${S}/kernel/byterun/"
+ ./configure ${myconf[@]} || die "configure failed"
+}
+
+src_compile() {
+ emake STRIP="true" -j1
+}
+
+src_install() {
+ emake STRIP="true" COQINSTALLPREFIX="${D}" install
+ dodoc README CREDITS CHANGES
+
+ use gtk && make_desktop_entry "coqide" "Coq IDE" "${EPREFIX}/usr/share/coq/coq.png"
+}
diff --git a/sci-mathematics/coq/coq-8.4_p5.ebuild b/sci-mathematics/coq/coq-8.4_p5.ebuild
new file mode 100644
index 000000000000..9840c716d59b
--- /dev/null
+++ b/sci-mathematics/coq/coq-8.4_p5.ebuild
@@ -0,0 +1,103 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="5"
+
+inherit eutils multilib
+
+MY_PV=${PV/_p/pl}
+MY_P=${PN}-${MY_PV}
+
+DESCRIPTION="Proof assistant written in O'Caml"
+HOMEPAGE="http://coq.inria.fr/"
+SRC_URI="http://${PN}.inria.fr/distrib/V${MY_PV}/files/${MY_P}.tar.gz"
+
+LICENSE="LGPL-2.1"
+SLOT="0"
+KEYWORDS="amd64 ~ppc ~x86"
+IUSE="gtk debug +ocamlopt doc camlp5"
+
+RDEPEND="
+ >=dev-lang/ocaml-3.11.2:=[ocamlopt?]
+ camlp5? ( >=dev-ml/camlp5-6.02.3:=[ocamlopt?] )
+ !camlp5? ( || ( dev-ml/camlp4:= <dev-lang/ocaml-4.02.0 ) )
+ gtk? ( >=dev-ml/lablgtk-2.10.1:=[ocamlopt?] )"
+DEPEND="${RDEPEND}
+ doc? (
+ media-libs/netpbm[png,zlib]
+ virtual/latex-base
+ dev-tex/hevea
+ dev-tex/xcolor
+ dev-texlive/texlive-pictures
+ dev-texlive/texlive-mathextra
+ dev-texlive/texlive-latexextra
+ )"
+
+S=${WORKDIR}/${MY_P}
+
+src_prepare() {
+ epatch "${FILESDIR}/${PN}-8.4_p5-do-not-install-revision.patch"
+ # Fix generation of the index_urls.txt file with Gentoo dev-tex/hevea versions.
+ # http://lists.gforge.inria.fr/pipermail/coq-commits/2014-October/013582.html
+ epatch "${FILESDIR}/${P}-hevea.patch"
+ epatch "${FILESDIR}/${PN}-8.4_p5-no-clean-before-test.patch"
+}
+
+src_configure() {
+ ocaml_lib=$(ocamlc -where)
+ local myconf=(
+ --prefix /usr
+ --bindir /usr/bin
+ --libdir /usr/$(get_libdir)/coq
+ --mandir /usr/share/man
+ --emacslib /usr/share/emacs/site-lisp
+ --coqdocdir /usr/$(get_libdir)/coq/coqdoc
+ --docdir /usr/share/doc/${PF}
+ --configdir /etc/xdg/${PN}
+ --lablgtkdir ${ocaml_lib}/lablgtk2
+ )
+
+ use debug && myconf+=( --debug )
+ use doc || myconf+=( --with-doc no )
+
+ if use gtk; then
+ if use ocamlopt; then
+ myconf+=( --coqide opt )
+ else
+ myconf+=( --coqide byte )
+ fi
+ else
+ myconf+=( --coqide no )
+ fi
+
+ if use ocamlopt; then
+ myconf+=( --opt )
+ else
+ myconf+=( -byte-only )
+ fi
+
+ if use camlp5; then
+ myconf+=( --camlp5dir ${ocaml_lib}/camlp5 )
+ else
+ myconf+=( --usecamlp4 )
+ fi
+
+ export CAML_LD_LIBRARY_PATH="${S}/kernel/byterun/"
+ ./configure ${myconf[@]} || die "configure failed"
+}
+
+src_compile() {
+ emake STRIP="true" -j1 world VERBOSE=1
+}
+
+src_test() {
+ emake STRIP="true" check VERBOSE=1
+}
+
+src_install() {
+ emake STRIP="true" COQINSTALLPREFIX="${D}" install VERBOSE=1
+ dodoc README CREDITS CHANGES
+
+ use gtk && make_desktop_entry "coqide" "Coq IDE" "${EPREFIX}/usr/share/coq/coq.png"
+}
diff --git a/sci-mathematics/coq/coq-8.4_p6.ebuild b/sci-mathematics/coq/coq-8.4_p6.ebuild
new file mode 100644
index 000000000000..be183f11229d
--- /dev/null
+++ b/sci-mathematics/coq/coq-8.4_p6.ebuild
@@ -0,0 +1,103 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="5"
+
+inherit eutils multilib
+
+MY_PV=${PV/_p/pl}
+MY_P=${PN}-${MY_PV}
+
+DESCRIPTION="Proof assistant written in O'Caml"
+HOMEPAGE="http://coq.inria.fr/"
+SRC_URI="http://${PN}.inria.fr/distrib/V${MY_PV}/files/${MY_P}.tar.gz"
+
+LICENSE="LGPL-2.1"
+SLOT="0"
+KEYWORDS="~amd64 ~ppc ~x86"
+IUSE="gtk debug +ocamlopt doc camlp5"
+
+RDEPEND="
+ >=dev-lang/ocaml-3.11.2:=[ocamlopt?]
+ camlp5? ( >=dev-ml/camlp5-6.02.3:=[ocamlopt?] )
+ !camlp5? ( || ( dev-ml/camlp4:= <dev-lang/ocaml-4.02.0 ) )
+ gtk? ( >=dev-ml/lablgtk-2.10.1:=[ocamlopt?] )"
+DEPEND="${RDEPEND}
+ doc? (
+ media-libs/netpbm[png,zlib]
+ virtual/latex-base
+ dev-tex/hevea
+ dev-tex/xcolor
+ dev-texlive/texlive-pictures
+ dev-texlive/texlive-mathextra
+ dev-texlive/texlive-latexextra
+ )"
+
+S=${WORKDIR}/${MY_P}
+
+src_prepare() {
+ epatch "${FILESDIR}/${PN}-8.4_p5-do-not-install-revision.patch"
+ # Fix generation of the index_urls.txt file with Gentoo dev-tex/hevea versions.
+ # http://lists.gforge.inria.fr/pipermail/coq-commits/2014-October/013582.html
+ epatch "${FILESDIR}/${PN}-8.4_p5-hevea.patch"
+ epatch "${FILESDIR}/${PN}-8.4_p5-no-clean-before-test.patch"
+}
+
+src_configure() {
+ ocaml_lib=$(ocamlc -where)
+ local myconf=(
+ --prefix /usr
+ --bindir /usr/bin
+ --libdir /usr/$(get_libdir)/coq
+ --mandir /usr/share/man
+ --emacslib /usr/share/emacs/site-lisp
+ --coqdocdir /usr/$(get_libdir)/coq/coqdoc
+ --docdir /usr/share/doc/${PF}
+ --configdir /etc/xdg/${PN}
+ --lablgtkdir ${ocaml_lib}/lablgtk2
+ )
+
+ use debug && myconf+=( --debug )
+ use doc || myconf+=( --with-doc no )
+
+ if use gtk; then
+ if use ocamlopt; then
+ myconf+=( --coqide opt )
+ else
+ myconf+=( --coqide byte )
+ fi
+ else
+ myconf+=( --coqide no )
+ fi
+
+ if use ocamlopt; then
+ myconf+=( --opt )
+ else
+ myconf+=( -byte-only )
+ fi
+
+ if use camlp5; then
+ myconf+=( --camlp5dir ${ocaml_lib}/camlp5 )
+ else
+ myconf+=( --usecamlp4 )
+ fi
+
+ export CAML_LD_LIBRARY_PATH="${S}/kernel/byterun/"
+ ./configure ${myconf[@]} || die "configure failed"
+}
+
+src_compile() {
+ emake STRIP="true" -j1 world VERBOSE=1
+}
+
+src_test() {
+ emake STRIP="true" check VERBOSE=1
+}
+
+src_install() {
+ emake STRIP="true" COQINSTALLPREFIX="${D}" install VERBOSE=1
+ dodoc README CREDITS CHANGES
+
+ use gtk && make_desktop_entry "coqide" "Coq IDE" "${EPREFIX}/usr/share/coq/coq.png"
+}
diff --git a/sci-mathematics/coq/files/coq-8.4_p1-camlp4.patch b/sci-mathematics/coq/files/coq-8.4_p1-camlp4.patch
new file mode 100644
index 000000000000..bc60b9f56f4c
--- /dev/null
+++ b/sci-mathematics/coq/files/coq-8.4_p1-camlp4.patch
@@ -0,0 +1,17 @@
+Upstream rev 16121
+https://bugs.gentoo.org/show_bug.cgi?id=450954
+
+Index: coq-8.4pl1/scripts/coqmktop.ml
+===================================================================
+--- coq-8.4pl1.orig/scripts/coqmktop.ml
++++ coq-8.4pl1/scripts/coqmktop.ml
+@@ -45,8 +45,7 @@ let camlp4topobjs =
+ [ "Camlp4Top.cmo";
+ "Camlp4Parsers/Camlp4OCamlRevisedParser.cmo";
+ "Camlp4Parsers/Camlp4OCamlParser.cmo";
+- "Camlp4Parsers/Camlp4GrammarParser.cmo";
+- "q_util.cmo"; "q_coqast.cmo" ]
++ "Camlp4Parsers/Camlp4GrammarParser.cmo" ]
+ let topobjs = camlp4topobjs
+
+ let gramobjs = []
diff --git a/sci-mathematics/coq/files/coq-8.4_p5-do-not-install-revision.patch b/sci-mathematics/coq/files/coq-8.4_p5-do-not-install-revision.patch
new file mode 100644
index 000000000000..e97f4a165f87
--- /dev/null
+++ b/sci-mathematics/coq/files/coq-8.4_p5-do-not-install-revision.patch
@@ -0,0 +1,19 @@
+--- coq-8.4pl5-orig/Makefile.build 2014-10-22 19:30:53.000000000 +1100
++++ coq-8.4pl5/Makefile.build 2015-02-15 12:06:48.044999959 +1100
+@@ -655,16 +655,12 @@
+ # it with libraries
+ -$(MKDIR) $(FULLCOQLIB)/plugins/micromega
+ $(INSTALLBIN) $(CSDPCERT) $(FULLCOQLIB)/plugins/micromega
+- rm -f $(FULLCOQLIB)/revision
+- -$(INSTALLLIB) revision $(FULLCOQLIB)
+
+ install-library-light:
+ $(MKDIR) $(FULLCOQLIB)
+ $(INSTALLSH) $(FULLCOQLIB) $(LIBFILESLIGHT) $(INITPLUGINS)
+ $(MKDIR) $(FULLCOQLIB)/states
+ $(INSTALLLIB) states/*.coq $(FULLCOQLIB)/states
+- rm -f $(FULLCOQLIB)/revision
+- -$(INSTALLLIB) revision $(FULLCOQLIB)
+ ifeq ($(BEST),opt)
+ $(INSTALLSH) $(FULLCOQLIB) $(INITPLUGINSOPT)
+ endif
diff --git a/sci-mathematics/coq/files/coq-8.4_p5-hevea.patch b/sci-mathematics/coq/files/coq-8.4_p5-hevea.patch
new file mode 100644
index 000000000000..c76f1dea8e11
--- /dev/null
+++ b/sci-mathematics/coq/files/coq-8.4_p5-hevea.patch
@@ -0,0 +1,11 @@
+--- coq-8.4pl5-orig/Makefile.doc 2014-10-22 19:30:53.000000000 +1100
++++ coq-8.4pl5/Makefile.doc 2015-02-15 15:28:34.797911303 +1100
+@@ -148,7 +148,7 @@
+ ######################################################################
+
+ $(INDEXURLS): $(INDEXES)
+- cat $< | grep li-indexenv | grep HREF | sed -e 's@.*<TT>\(.*\)</TT>.*, <A HREF="\(.*\)">.*@\1,\2@' > $@
++ cat $< | grep li-indexenv | grep href | sed -e 's@.*>\([^<]*\)</span>.*, <a href="\([^"]*\)">.*@\1,\2@' > $@
+
+
+ ######################################################################
diff --git a/sci-mathematics/coq/files/coq-8.4_p5-no-clean-before-test.patch b/sci-mathematics/coq/files/coq-8.4_p5-no-clean-before-test.patch
new file mode 100644
index 000000000000..ef4b6cf3e824
--- /dev/null
+++ b/sci-mathematics/coq/files/coq-8.4_p5-no-clean-before-test.patch
@@ -0,0 +1,12 @@
+--- coq-8.4pl5-orig/Makefile.build 2015-02-15 12:06:48.044999959 +1100
++++ coq-8.4pl5/Makefile.build 2015-02-15 16:41:06.521892146 +1100
+@@ -395,8 +395,7 @@
+
+ check:: validate test-suite
+
+-test-suite: world $(ALLSTDLIB).v
+- $(MAKE) $(MAKE_TSOPTS) clean
++test-suite: $(ALLSTDLIB).v
+ $(MAKE) $(MAKE_TSOPTS) all
+ $(HIDE)if grep -F 'Error!' test-suite/summary.log ; then false; fi
+
diff --git a/sci-mathematics/coq/files/coqide.desktop b/sci-mathematics/coq/files/coqide.desktop
new file mode 100644
index 000000000000..cc8bb54e1ad1
--- /dev/null
+++ b/sci-mathematics/coq/files/coqide.desktop
@@ -0,0 +1,9 @@
+[Desktop Entry]
+Comment=Coq integrated developpment environment
+Icon=/usr/lib/coq/ide/coq.png
+Exec=/usr/bin/coqide
+Name=CoqIDE
+GenericName=Coq IDE
+Terminal=false
+Type=Application
+Categories=Science;Math;
diff --git a/sci-mathematics/coq/metadata.xml b/sci-mathematics/coq/metadata.xml
new file mode 100644
index 000000000000..2fbebc05a0d7
--- /dev/null
+++ b/sci-mathematics/coq/metadata.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <herd>ml</herd>
+ <herd>sci-mathematics</herd>
+ <longdescription lang="en">
+ Developed in the LogiCal project, the Coq tool is a formal proof
+ management system: a proof done with Coq is mechanically checked
+ by the machine.
+ In particular, Coq allows:
+ * the definition of functions or predicates,
+ * to state mathematical theorems and software specifications,
+ * to develop interactively formal proofs of these theorems,
+ * to check these proofs by a small certification "kernel".
+ Coq is based on a logical framework called "Calculus of Inductive
+ Constructions" extended by a modular development system for
+ theories.
+</longdescription>
+ <use>
+ <flag name="camlp5">Build using camlp5. This is required for some plugins like Ssreflect.</flag>
+ </use>
+</pkgmetadata>
diff --git a/sci-mathematics/cvc3/Manifest b/sci-mathematics/cvc3/Manifest
new file mode 100644
index 000000000000..e13e2e2bb3eb
--- /dev/null
+++ b/sci-mathematics/cvc3/Manifest
@@ -0,0 +1 @@
+DIST cvc3-2.4.1.tar.gz 1196616 SHA256 d55b1d6006cfbac3f6d4c086964558902c3ed0efa66ac499cfb2193f3ee4acf7 SHA512 48e5cd82b3eb7506d762c2abc8db0c8fbc548575a1362dda53888075ac105a5bc0f0d58dfe01b60f207bc00ff8dfc39a5b3d9317784fe551658c884bb02e1ff2 WHIRLPOOL 9d39dacff010f093685191737d41760a84ac7d12246ddaafbb9f48c78c7bff5697c5e85c62ef44b7dc76f86a55c118c041323c3a1b1953f5c725447795375d93
diff --git a/sci-mathematics/cvc3/cvc3-2.4.1.ebuild b/sci-mathematics/cvc3/cvc3-2.4.1.ebuild
new file mode 100644
index 000000000000..8ac2c53297c1
--- /dev/null
+++ b/sci-mathematics/cvc3/cvc3-2.4.1.ebuild
@@ -0,0 +1,157 @@
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="5"
+
+inherit elisp-common
+
+DESCRIPTION="CVC3 is an automatic theorem prover for Satisfiability Modulo Theories (SMT) problems"
+HOMEPAGE="http://www.cs.nyu.edu/acsys/cvc3/index.html"
+SRC_URI="http://www.cs.nyu.edu/acsys/cvc3/releases/2.4.1/${P}.tar.gz"
+
+LICENSE="BSD MIT HPND zchaff? ( zchaff )"
+RESTRICT="mirror zchaff? ( bindist )"
+SLOT="0/${PV}"
+KEYWORDS="~amd64 ~x86"
+IUSE="doc emacs isabelle test zchaff"
+
+RDEPEND="dev-libs/gmp
+ isabelle? (
+ >=sci-mathematics/isabelle-2011.1-r1:=
+ )"
+DEPEND="${RDEPEND}
+ doc? (
+ app-doc/doxygen
+ media-gfx/graphviz
+ )
+ emacs? (
+ virtual/emacs
+ )"
+
+SITEFILE=50${PN}-gentoo.el
+
+src_prepare() {
+ sed -e 's#prefix=@prefix@#prefix=$(patsubst %/,%,$(DESTDIR))@prefix@#' \
+ -e 's#libdir=@libdir@#libdir=$(patsubst %/,%,$(DESTDIR))@libdir@#' \
+ -e 's#mandir=@mandir@#mandir=$(patsubst %/,%,$(DESTDIR))@mandir@#' \
+ -i "${S}/Makefile.local.in" \
+ || die "Could not set DESTDIR in Makefile.local.in"
+}
+
+src_configure() {
+ # --enable-static disables building of shared libraries, statically
+ # links /usr/bin/cvc3 and installs static libraries.
+ # --enable-static --enable-sharedlibs behaves the same as just --enable-static
+ econf \
+ --enable-dynamic \
+ $(use_enable zchaff)
+
+ if use test; then
+ sed -e 's@LD_LIBS = @LD_LIBS = -L'"${S}"'/lib -Wl,-R'"${S}"'/lib @' \
+ -i "${S}/test/Makefile" \
+ || die "Could not set library paths in test/Makefile"
+ fi
+}
+
+src_compile() {
+ emake
+
+ if use doc; then
+ pushd doc || die "Could not cd to doc"
+ emake
+ popd
+ fi
+
+ if use emacs ; then
+ pushd "${S}/emacs" || die "Could change directory to emacs"
+ elisp-compile *.el || die "emacs elisp compile failed"
+ popd
+ fi
+
+ if use test; then
+ pushd test || die "Could not cd to test"
+ emake
+ popd
+ fi
+}
+
+src_test() {
+ pushd test || die "Could not cd to test"
+ ./bin/test || die "tests failed"
+ popd
+}
+
+src_install() {
+ emake DESTDIR="${D}" install
+
+ if use doc; then
+ pushd "${S}"/doc/html || die "Could not cd to doc/html"
+ dohtml *.html
+ insinto /usr/share/doc/${PF}/html
+ doins *.css *.gif *.png
+ popd
+ fi
+
+ if use emacs ; then
+ elisp-install ${PN} emacs/*.{el,elc}
+ cp "${FILESDIR}"/${SITEFILE} "${S}"
+ elisp-site-file-install ${SITEFILE}
+ fi
+
+ if use isabelle; then
+ ISABELLE_HOME="$(isabelle getenv ISABELLE_HOME | cut -d'=' -f 2)" \
+ || die "isabelle getenv ISABELLE_HOME failed"
+ [[ -n "${ISABELLE_HOME}" ]] || die "ISABELLE_HOME empty"
+ dodir "${ISABELLE_HOME}/contrib/${PN}-${PV}/etc"
+ cat <<- EOF >> "${S}/settings"
+ CVC3_COMPONENT="\$COMPONENT"
+ CVC3_HOME="${ROOT}usr/bin"
+ CVC3_SOLVER="\$CVC3_HOME/cvc3"
+ CVC3_REMOTE_SOLVER="cvc3"
+ CVC3_INSTALLED="yes"
+ EOF
+ insinto "${ISABELLE_HOME}/contrib/${PN}-${PV}/etc"
+ doins "${S}/settings"
+ fi
+}
+
+pkg_postinst() {
+ use emacs && elisp-site-regen
+ if use isabelle; then
+ if [ -f "${ROOT}etc/isabelle/components" ]; then
+ if egrep "contrib/${PN}-[0-9.]*" "${ROOT}etc/isabelle/components"; then
+ sed -e "/contrib\/${PN}-[0-9.]*/d" \
+ -i "${ROOT}etc/isabelle/components"
+ fi
+ cat <<- EOF >> "${ROOT}etc/isabelle/components"
+ contrib/${PN}-${PV}
+ EOF
+ fi
+ fi
+ if use zchaff; then
+ einfo "This copy of CVC3 is also configured to use the SAT solver zchaff whose"
+ einfo "copyright is owned by Princeton University and is more restrictive."
+ einfo "Specifically, it may be used for internal, noncommercial, research purposes"
+ einfo "only. See the copyright notices from the zchaff source files which are"
+ einfo "included in the LICENSE file."
+ einfo "To build CVC3 without these files, please build cvc3 without the zchaff"
+ einfo "use flag (note: zchaff is disabled by default):"
+ einfo "USE=-zchaff emerge sci-mathemathematics/cvc3"
+ fi
+}
+
+pkg_postrm() {
+ use emacs && elisp-site-regen
+ if use isabelle; then
+ if [ ! -f "${ROOT}usr/bin/cvc3" ]; then
+ if [ -f "${ROOT}etc/isabelle/components" ]; then
+ # Note: this sed should only match the version of this ebuild
+ # Which is what we want as we do not want to remove the line
+ # of a new CVC3 being installed during an upgrade.
+ sed -e "/contrib\/${PN}-${PV}/d" \
+ -i "${ROOT}etc/isabelle/components"
+ fi
+ fi
+ fi
+}
diff --git a/sci-mathematics/cvc3/files/50cvc3-gentoo.el b/sci-mathematics/cvc3/files/50cvc3-gentoo.el
new file mode 100644
index 000000000000..8e046edf7ad1
--- /dev/null
+++ b/sci-mathematics/cvc3/files/50cvc3-gentoo.el
@@ -0,0 +1,3 @@
+(add-to-list 'load-path "@SITELISP@")
+(add-to-list 'auto-mode-alist '("\\.cvc\\'" . cvc-mode))
+(autoload 'cvc-mode "cvc-mode" "CVC specifications editing mode." t)
diff --git a/sci-mathematics/cvc3/metadata.xml b/sci-mathematics/cvc3/metadata.xml
new file mode 100644
index 000000000000..fd176a8c8c63
--- /dev/null
+++ b/sci-mathematics/cvc3/metadata.xml
@@ -0,0 +1,42 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+<maintainer>
+ <email>gienah@gentoo.org</email>
+ <name>Mark Wright</name>
+</maintainer>
+<herd>sci-mathematics</herd>
+<longdescription lang='en'>
+CVC3 is an automatic theorem prover for Satisfiability Modulo Theories
+(SMT) problems. It can be used to prove the validity (or, dually, the
+satisfiability) of first-order formulas in a large number of built-in
+logical theories and their combination.
+
+CVC3 is the last offspring of a series of popular SMT provers, which
+originated at Stanford University with the SVC system. In particular,
+it builds on the code base of CVC Lite, its most recent
+predecessor. Its high level design follows that of the Sammy prover.
+
+CVC3 works with a version of first-order logic with polymorphic types
+and has a wide variety of features including:
+
+ several built-in base theories: rational and integer linear
+ arithmetic, arrays, tuples, records, inductive data types, bit
+ vectors, and equality over uninterpreted function symbols;
+ support for quantifiers;
+ an interactive text-based interface;
+ a rich C and C++ API for embedding in other systems;
+ proof and model generation abilities;
+ predicate subtyping;
+ essentially no limit on its use for research or commercial
+ purposes (see license).
+</longdescription>
+<use>
+ <flag name='isabelle'>Add integration support for the Isabelle/HOL
+ theorem prover.</flag>
+ <flag name='zchaff'>Use the SAT solver zchaff whose copyright is
+ owned by Princeton University and is more restrictive (see zchaff
+ license).
+ </flag>
+</use>
+</pkgmetadata>
diff --git a/sci-mathematics/dataplot/Manifest b/sci-mathematics/dataplot/Manifest
new file mode 100644
index 000000000000..478051082096
--- /dev/null
+++ b/sci-mathematics/dataplot/Manifest
@@ -0,0 +1,2 @@
+DIST dplib.2009_07_15.tar.gz 7507367 SHA256 bb1dce97fbcec611cabe636bbdf20efa77c191b84e9c3db621554daea831f00d SHA512 5e4e6c866a5690c3f67b322d53b6bf1bec33c488a99c95f360ce74785a57286541945fdcab5cbbacb04039046f5ba94aeaf8112b80aa34ed2c2cf04abc6f7d40 WHIRLPOOL f531fe7fa4ef3f2ffb65777dd2e5d08f68fd32f5fcf7fbae19db2e5e015e9aba88577c71e9f4dac1f638d8fccf749b0a9c13fd30f7950a7f24669caed5e7e8b1
+DIST dpsrc_2009_08_21.tar.gz 6656048 SHA256 ee47746fb28b88a5a0affa6a51a0e10c9350b1dc28977ecbee19d64a1e204cd4 SHA512 1e655c6832b724b9f69692f28f5497fb4064d208cde5462c4bd73c8d255605ba62b9b703f5ea32bbe7506b18ccd0ad5c4c2556381fbebdb6e05ce51625a4a339 WHIRLPOOL 7ed6951206cd35e449123bd8863f7b3ae26fbcf947156fb6b018aa200768c72861feca65392740303da644c33738d442aa59cab7a09ddb2bcc6dd9dcff70d003
diff --git a/sci-mathematics/dataplot/dataplot-20090821.ebuild b/sci-mathematics/dataplot/dataplot-20090821.ebuild
new file mode 100644
index 000000000000..c646b4be26e4
--- /dev/null
+++ b/sci-mathematics/dataplot/dataplot-20090821.ebuild
@@ -0,0 +1,81 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+inherit eutils fortran-2 toolchain-funcs autotools
+
+# YEAR MONTH DAY
+MY_PV=${PV:0:4}_${PV:4:2}_${PV:6:2}
+MY_P=dpsrc_${MY_PV}
+# MY_PV_AUX usually ${MY_PV}
+MY_PV_AUX=2009_07_15
+MY_P_AUX=dplib.${MY_PV_AUX}
+
+DESCRIPTION="Program for scientific visualization and statistical analyis"
+HOMEPAGE="http://www.itl.nist.gov/div898/software/dataplot/"
+SRC_URI="
+ ftp://ftp.nist.gov/pub/dataplot/unix/${MY_P}.tar.gz
+ ftp://ftp.nist.gov/pub/dataplot/unix/${MY_P_AUX}.tar.gz"
+
+SLOT="0"
+LICENSE="public-domain"
+KEYWORDS="~amd64 ~x86 ~amd64-linux ~x86-linux"
+IUSE="examples gd opengl X"
+
+COMMON_DEPEND="
+ media-libs/plotutils
+ opengl? ( virtual/opengl )
+ gd? ( media-libs/gd[png,jpeg] )"
+DEPEND="${COMMON_DEPEND}
+ virtual/pkgconfig"
+RDEPEND="${COMMON_DEPEND}
+ X? ( x11-misc/xdg-utils )"
+
+S="${WORKDIR}/${MY_P}"
+S_AUX="${WORKDIR}/${MY_P_AUX}"
+
+src_unpack() {
+ # unpacking and renaming because
+ # upstream does not use directories
+ mkdir "${S_AUX}" || die
+ pushd "${S_AUX}" > /dev/null || die
+ unpack ${MY_P_AUX}.tar.gz
+ popd > /dev/null || die
+ mkdir ${MY_P} || die
+ cd "${S}" || die
+ unpack ${MY_P}.tar.gz
+}
+
+src_prepare() {
+ epatch "${FILESDIR}"/${P}-opengl.patch
+ cp "${FILESDIR}"/Makefile.am.${PV} Makefile.am || die
+ cp "${FILESDIR}"/configure.ac.${PV} configure.ac || die
+ sed -e "s:IHOST1='SUN':IHOST1='@HOST@:" \
+ -e "s:/usr/local/lib:@datadir@:g" \
+ dp1_linux.f > dp1_linux.f.in || die
+ sed -e "s/(MAXOBV=.*)/(MAXOBV=@MAXOBV@)/" \
+ -e "s:/usr/local/lib:@datadir@:g" \
+ DPCOPA.INC > DPCOPA.INC.in || die
+ eautoreconf
+}
+
+src_configure() {
+ econf \
+ $(use_enable gd) \
+ $(use_enable opengl gl) \
+ $(use_enable X)
+}
+
+src_install() {
+ default
+
+ if use examples; then
+ insinto /usr/share/doc/${PF}/examples
+ doins -r "${S_AUX}"/data/*
+ fi
+ insinto /usr/share/dataplot
+ doins "${S_AUX}"/dp{mes,sys,log}f.tex
+ doenvd "${FILESDIR}"/90${PN}
+}
diff --git a/sci-mathematics/dataplot/files/90dataplot b/sci-mathematics/dataplot/files/90dataplot
new file mode 100644
index 000000000000..9bb5e1dc56d5
--- /dev/null
+++ b/sci-mathematics/dataplot/files/90dataplot
@@ -0,0 +1,3 @@
+DATAPLOT_FILES="/usr/share/dataplot"
+DATAPLOT_WEB="OFF"
+BROWSER="xdg-open"
diff --git a/sci-mathematics/dataplot/files/Makefile.am.20090821 b/sci-mathematics/dataplot/files/Makefile.am.20090821
new file mode 100644
index 000000000000..e10cf41ebd54
--- /dev/null
+++ b/sci-mathematics/dataplot/files/Makefile.am.20090821
@@ -0,0 +1,46 @@
+bin_PROGRAMS = dataplot
+dataplot_SOURCES = dp1_linux.f \
+ dp2.f dp3.f dp4.f dp5.f dp6.f dp7.f dp8.f dp9.f dp10.f dp11.f \
+ dp12.f dp13.f dp14.f dp15.f dp16.f dp17.f dp18.f dp19.f dp20.f dp21.f \
+ dp22.f dp23.f dp24.f dp25.f dp26.f dp27.f dp28.f dp29.f dp30.f dp31.f \
+ dp32.f dp33.f dp34.f dp35.f dp36.f dp37.f dp38.f dp39.f dp40.f dp41.f \
+ dp42.f dp43.f dp44.f dp45.f dp46.f \
+ dpcalc.f dpdds2.f dpdds3.f dpdds.f edinit.f edmai2.f edsear.f edsub.f \
+ edwrst.f fit3b.f starpac.f tcdriv_nopc.f aqua_src.f cluster.f compgeom.f \
+ optimi.f libplot_src.c rldp.c main.f
+
+if ENABLE_GD
+dataplot_SOURCES += gd_src.c
+else
+dataplot_SOURCES += gd_src.f
+endif
+
+if ENABLE_GL
+dataplot_SOURCES += gl_src.c
+else
+dataplot_SOURCES += gl_src.f
+endif
+
+if ENABLE_X11
+dataplot_SOURCES += x11_src.c
+else
+dataplot_SOURCES += x11src.f
+endif
+
+dataplot_CFLAGS = @GL_CFLAGS@
+dataplot_LDADD = @GD_LIBS@ @GL_LIBS@ @X11_LIBS@ $(FLIBS) -lreadline
+
+# this is to remove ambiguity between the similar filenames
+# of the c and f77 version (shortcoming of automake)
+# the f77 versions are forced
+# the c versions objects are called dataplot-gd_src.o etc
+gd_src.o: gd_src.f
+ $(F77COMPILE) -c -o $@ $<
+gl_src.o: gl_src.f
+ $(F77COMPILE) -c -o $@ $<
+aqua_src.o: aqua_src.f
+ $(F77COMPILE) -c -o $@ $<
+libplot_src.o: libplot_src.f
+ $(F77COMPILE) -c -o $@ $<
+rldp.o: rldp.f
+ $(F77COMPILE) -c -o $@ $<
diff --git a/sci-mathematics/dataplot/files/configure.ac.20090821 b/sci-mathematics/dataplot/files/configure.ac.20090821
new file mode 100644
index 000000000000..2343b23823dd
--- /dev/null
+++ b/sci-mathematics/dataplot/files/configure.ac.20090821
@@ -0,0 +1,76 @@
+AC_PREREQ(2.59)
+AC_INIT([dataplot], [20080225], [n.heckert@nist.gov])
+AC_CONFIG_HEADER([config.h])
+AC_CONFIG_AUX_DIR(config)
+AM_MAINTAINER_MODE
+AM_INIT_AUTOMAKE([foreign])
+
+AC_PROG_CC
+AC_PROG_F77
+AC_F77_LIBRARY_LDFLAGS
+case $F77 in
+ *gfortran*) FFLAGS="${FFLAGS} -w -fno-range-check" ;;
+ *) ;;
+esac
+
+AC_CANONICAL_HOST
+case $host in
+ i?86*linux*) MAXOBV=100000 ;;
+ *64*linux*) MAXOBV=1000000 ;;
+esac
+AC_SUBST(MAXOBV)
+
+AC_ARG_ENABLE(gd,
+ [AS_HELP_STRING([--enable-gd], [Enable the gd device driver])],
+ [enable_gd=$enableval],
+ [enable_gd=no])
+
+AC_CHECK_LIB(plot, pl_closepl_r, ,
+ [AC_MSG_ERROR([plotutils libraries not found])])
+
+AC_ARG_ENABLE(gl,
+ [AS_HELP_STRING([--enable-gl], [Enable the OpenGL device driver])],
+ [enable_gl=$enableval],
+ [enable_gl=no])
+
+AC_ARG_ENABLE(X,
+ [AS_HELP_STRING([--enable-X], [Enable the X11 device driver])],
+ [enable_x11=$enableval],
+ [enable_x11=no])
+
+if test x"$enable_gd" = x"yes"; then
+ AC_CHECK_PROG(enable_gd, [gdlib-config],,
+ [AC_MSG_ERROR([GD driver requested but gdlib-config not found])])
+ GD_LIBS="`gdlib-config --libs` -lgd"
+ GD_CFLAGS="`gdlib-config --cflags`"
+ AC_SUBST(GD_LIBS)
+ AC_SUBST(GD_CFLAGS)
+fi
+AM_CONDITIONAL(ENABLE_GD, [test x"$enable_gd" = x"yes"] )
+
+if test x"$enable_gl" = x"yes"; then
+dnl hardcoded opengl libs (should be host/implementation dependent)
+ AC_CHECK_HEADER(GL/gl.h,,
+ [AC_MSG_ERROR([OpenGL driver requested but header gl.h not found])])
+ AC_CHECK_HEADER(GL/glu.h,,
+ [AC_MSG_ERROR([OpenGL driver requested but header glu.h not found])])
+ GL_CFLAGS="-DUNIX_OS -DAPPEND_UNDERSCORE -DSUBROUTINE_CASE"
+ AC_SUBST(GL_CFLAGS)
+
+ AC_CHECK_LIB(GL, glXCreateContext, GL_LIBS="-lGL",
+ [AC_MSG_ERROR([OpenGL driver requested but libraries not found])])
+ AC_CHECK_LIB(GLU, gluPerspective, GL_LIBS="-lGL -lGLU",
+ [AC_MSG_ERROR([OpenGL driver requested but libraries not found])])
+ GL_LIBS="-lGL -lGLU"
+ AC_SUBST(GL_LIBS)
+fi
+AM_CONDITIONAL(ENABLE_GL, [ test x"$enable_gl" = x"yes" ])
+
+if test x"$enable_x11" = x"yes"; then
+ PKG_CHECK_MODULES(X11, x11,,
+ [AC_MSG_ERROR([X11 driver requested but pkgconfig module not found])])
+fi
+AM_CONDITIONAL(ENABLE_X11, [ test x"$enable_x11" = x"yes" ])
+
+AC_CONFIG_FILES([Makefile DPCOPA.INC dp1_linux.f])
+AC_OUTPUT
diff --git a/sci-mathematics/dataplot/files/dataplot-20090821-opengl.patch b/sci-mathematics/dataplot/files/dataplot-20090821-opengl.patch
new file mode 100644
index 000000000000..5810b6029b87
--- /dev/null
+++ b/sci-mathematics/dataplot/files/dataplot-20090821-opengl.patch
@@ -0,0 +1,47 @@
+--- gl_src.c.orig 2001-02-28 16:45:56.000000000 -0500
++++ gl_src.c 2008-04-10 17:03:03.000000000 -0400
+@@ -154,7 +154,7 @@
+ #include <stdio.h>
+ #include <stdlib.h>
+ #include <math.h>
+-#include <strings.h>
++#include <string.h>
+
+ #if UNIX == 0
+ #include <X11/Xlib.h>
+@@ -257,7 +257,7 @@
+ /* flags for current attribute settings */
+ static int OPEN_FLAG = 0; /* 0 - X11 closed, 1 - X11 open */
+ static int OPEN_FLAG_2 = 0; /* 0 - repeat graph window closed, 1 - open */
+-int GRAPH_FLAG = 0; /* 0 - gleras has not been called, 1 - gleras has been called */
++static int GRAPH_FLAG = 0; /* 0 - gleras has not been called, 1 - gleras has been called */
+ int WIDTH_CURRENT; /* current line width */
+ int LINE_STYLE_CURRENT; /* current line style */
+ char FONT_NAME_CURRENT[80]; /* name of current font */
+@@ -922,7 +922,7 @@
+ glNewList(list_id, GL_COMPILE_AND_EXECUTE);
+
+ glClearColor(red_temp,green_temp,blue_temp,1.0);
+- glclear(GL_COLOR_BUFFER_BIT);
++ glClear(GL_COLOR_BUFFER_BIT);
+
+ GRAPH_FLAG = 1;
+ }
+@@ -1486,7 +1486,7 @@
+ * Color only set if being changed.
+ */
+ #if APPEND_UNDERSCORE == 1 && SUBROUTINE_CASE == 1
+-void glseco(jcol, red, green, blue)
++void glseco_(jcol, red, green, blue)
+ #elif APPEND_UNDERSCORE == 1 && SUBROUTINE_CASE == 0
+ void GLSECO_(jcol, red, green, blue)
+ #elif APPEND_UNDERSCORE == 0 && SUBROUTINE_CASE == 1
+@@ -1691,7 +1691,7 @@
+ width = isize[0];
+ #endif
+ if (width < 1.0) width = 1.0;
+- glPointsize(width);
++ glPointSize(width);
+ glBegin(GL_POINTS);
+ #if PRECISION == 0
+ glVertex2f(*ix, *iy);
diff --git a/sci-mathematics/dataplot/metadata.xml b/sci-mathematics/dataplot/metadata.xml
new file mode 100644
index 000000000000..3f98dafdd5f4
--- /dev/null
+++ b/sci-mathematics/dataplot/metadata.xml
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <herd>sci-mathematics</herd>
+ <longdescription lang="en">
+ Dataplot is a software system for scientific visualization,
+ statistical analysis, and non-linear modeling. The target Dataplot
+ user is the researcher and analyst engaged in the characterization,
+ modeling, visualization, analysis, monitoring, and optimization of
+ scientific and engineering processes (original version:1978).
+ Gentoo version adds autotools to facilitate building and robustness.
+</longdescription>
+</pkgmetadata>
diff --git a/sci-mathematics/diagrtb/Manifest b/sci-mathematics/diagrtb/Manifest
new file mode 100644
index 000000000000..0c9f34449ed1
--- /dev/null
+++ b/sci-mathematics/diagrtb/Manifest
@@ -0,0 +1 @@
+DIST diagrtb-2.64.tar.gz 2429842 SHA256 bbab6ed2f9eeae1c64d0d55764908748a5e321589df81c7d87647623950b7aa0
diff --git a/sci-mathematics/diagrtb/diagrtb-2.64.ebuild b/sci-mathematics/diagrtb/diagrtb-2.64.ebuild
new file mode 100644
index 000000000000..1283039df7eb
--- /dev/null
+++ b/sci-mathematics/diagrtb/diagrtb-2.64.ebuild
@@ -0,0 +1,30 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=4
+
+inherit cmake-utils fortran-2
+
+DESCRIPTION="Calculation of some eigenvectors of a large real, symmetrical, matrix"
+HOMEPAGE="http://ecole.modelisation.free.fr/modes.html"
+SRC_URI="http://ecole.modelisation.free.fr/rtb2011.tar.gz -> ${P}.tar.gz"
+
+LICENSE="all-rights-reserved"
+SLOT="0"
+KEYWORDS="~amd64 ~x86 ~amd64-linux ~x86-linux"
+IUSE="examples"
+RESTRICT="mirror bindist"
+
+S="${WORKDIR}"/Source_RTB2011
+
+src_prepare() {
+ cp "${FILESDIR}"/CMakeLists.txt . || die
+}
+
+src_configure() {
+ mycmakeargs=(
+ $(cmake-utils_use examples EXAMPLES)
+ )
+ cmake-utils_src_configure
+}
diff --git a/sci-mathematics/diagrtb/files/CMakeLists.txt b/sci-mathematics/diagrtb/files/CMakeLists.txt
new file mode 100644
index 000000000000..d1eb6c62f09f
--- /dev/null
+++ b/sci-mathematics/diagrtb/files/CMakeLists.txt
@@ -0,0 +1,13 @@
+cmake_minimum_required (VERSION 2.6)
+project (DIAGRTB Fortran)
+
+option (EXAMPLES "Instal additional example files" OFF)
+
+add_executable(diagrtb diagrtb.f)
+
+install (TARGETS diagrtb DESTINATION bin)
+install (FILES diagrtb.README DESTINATION share/doc/diagrtb)
+
+if ( EXAMPLES )
+ install (DIRECTORY ../Try_RTB2011 DESTINATION share/diagrtb/examples)
+endif (EXAMPLES)
diff --git a/sci-mathematics/diagrtb/metadata.xml b/sci-mathematics/diagrtb/metadata.xml
new file mode 100644
index 000000000000..b2b6df7d599c
--- /dev/null
+++ b/sci-mathematics/diagrtb/metadata.xml
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <herd>sci-chemistry</herd>
+ <maintainer>
+ <email>jlec@gentoo.org</email>
+ </maintainer>
+ <longdescription>
+A fortran program for the calculation of some eigenvectors of a large real,
+symmetrical, matrix.
+If the matrix was obtained, for instance, with the PDBMAT program, these
+eigenvectors correspond to the low-frequency normal modes (i.e., mostly
+those with a collective character) of the system. Note that in the case of
+proteins, low-frequency normal modes thus obtained are found to be very close
+to those obtained with standard, much more realistic (e.g., all atoms with
+empirical force fields), models.
+
+The method used rests upon the RTB approximation (standing for
+Rotations-Translations-of-Blocks). Within the frame of this approximation,
+blocks of n (n=1,2,...) consecutive monomers (amino-acid residues) are
+assumed to behave like rigid bodies.
+
+Requirements: a matrix in the "i j non-zero-ij-matrix-element" format.
+A file with the coordinates of the system, in the PDB or "x y z mass
+block-number" format.
+</longdescription>
+</pkgmetadata>
diff --git a/sci-mathematics/drgeo/Manifest b/sci-mathematics/drgeo/Manifest
new file mode 100644
index 000000000000..612ef3a452c9
--- /dev/null
+++ b/sci-mathematics/drgeo/Manifest
@@ -0,0 +1,2 @@
+DIST drgeo-1.1.0.tar.gz 1608361 SHA256 8c93bb637c11ca1647f90e0d97ea03d5938efddc36c2d73b40f15ff8df672216
+DIST drgeo-doc-1.5.tar.gz 2730242 SHA256 a6453dc630a40dd1c84ed90a7b7ff4fa3806e4e3ce01d149b59df29318255cb2
diff --git a/sci-mathematics/drgeo/drgeo-1.1.0.ebuild b/sci-mathematics/drgeo/drgeo-1.1.0.ebuild
new file mode 100644
index 000000000000..c82df5f42dd8
--- /dev/null
+++ b/sci-mathematics/drgeo/drgeo-1.1.0.ebuild
@@ -0,0 +1,56 @@
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=4
+
+inherit eutils
+
+DOCN="${PN}-doc"
+DOCV="1.5"
+DOC="${DOCN}-${DOCV}"
+
+DESCRIPTION="Interactive geometry package"
+HOMEPAGE="http://www.ofset.org/drgeo"
+SRC_URI="
+ mirror://sourceforge/ofset/${P}.tar.gz
+ mirror://sourceforge/ofset/${DOC}.tar.gz"
+
+SLOT="0"
+LICENSE="GPL-2"
+KEYWORDS="amd64 ~ppc x86"
+IUSE="nls"
+
+RDEPEND="
+ x11-libs/gtk+:2
+ gnome-base/libglade:2.0
+ dev-libs/libxml2:2
+ || (
+ >=dev-scheme/guile-1.8[deprecated]
+ =dev-scheme/guile-1.6*
+ )"
+DEPEND="${RDEPEND}
+ virtual/pkgconfig"
+
+src_prepare() {
+ epatch "${FILESDIR}"/${P}-gcc45.patch
+}
+
+src_configure() {
+ default
+ # Can't make the documentation as it depends on Hyperlatex which isn't
+ # yet in portage. Fortunately HTML is already compiled for us in the
+ # tarball and so can be installed. Just create the make install target.
+ cd "${WORKDIR}"/${DOC}
+ econf
+}
+
+src_install() {
+ default
+ if use nls; then
+ cd "${WORKDIR}"/${DOC}
+ else
+ cd "${WORKDIR}"/${DOC}/c
+ fi
+ emake install DESTDIR="${D}"
+}
diff --git a/sci-mathematics/drgeo/files/drgeo-1.1.0-gcc45.patch b/sci-mathematics/drgeo/files/drgeo-1.1.0-gcc45.patch
new file mode 100644
index 000000000000..1d8e93e06fea
--- /dev/null
+++ b/sci-mathematics/drgeo/files/drgeo-1.1.0-gcc45.patch
@@ -0,0 +1,61 @@
+Fix build with GCC 4.5, fix random SIGSEGV
+
+http://bugs.gentoo.org/show_bug.cgi?id=322211
+https://bugzilla.redhat.com/show_bug.cgi?id=454045
+
+--- geo/drgeo_figure.h
++++ geo/drgeo_figure.h
+@@ -322,4 +322,11 @@
+ gboolean showGrid;
+ };
+
++struct
++{
++ drgeoPoint mouse;
++ drgeoFigure *figure;
++}
++drgeoDialogData;
++
+ #endif
+--- geo/drgeo_figure.cc
++++ geo/drgeo_figure.cc
+@@ -48,13 +48,6 @@
+ #include "drgeo_dialog.h"
+ #include "traite.h"
+
+-extern struct
+-{
+- drgeoPoint mouse;
+- drgeoFigure *figure;
+-}
+-drgeoDialogData;
+-
+ typedef struct drgeoSearchValue
+ {
+ gpointer value;
+@@ -1309,7 +1302,7 @@
+ gint
+ drgeoFigure::preferedUndoLevel ()
+ {
+- atoi (drgeoConfigGet (":undoLevel"));
++ return atoi (drgeoConfigGet (":undoLevel"));
+ }
+
+ void
+--- geo/drgeo_dialog.cc
++++ geo/drgeo_dialog.cc
+@@ -38,14 +38,6 @@
+ // Used in the style dialod callback, I know it's ugly, but so easy
+ static drgeoFigure *selected_figure;
+
+-struct
+-{
+- drgeoPoint mouse;
+- drgeoFigure *figure;
+-}
+-drgeoDialogData;
+-
+-
+ static void drgeo_edit_dialog_cb (GtkWidget * dialog,
+ gint button, gpointer entry);
+
diff --git a/sci-mathematics/drgeo/metadata.xml b/sci-mathematics/drgeo/metadata.xml
new file mode 100644
index 000000000000..644b7bab5c8e
--- /dev/null
+++ b/sci-mathematics/drgeo/metadata.xml
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <herd>sci-mathematics</herd>
+ <longdescription lang="en">
+ Dr. Geo is a GTK2 interactive geometry software. It allows one to
+ create geometric figure plus the interactive manipulation of
+ such figure in respect with their geometric constraints. It is
+ useable in teaching situation with students from primary or
+ secondary level. It also features an integrated Scheme
+ programming language to define scripts within a figure.
+ </longdescription>
+ <upstream>
+ <remote-id type="sourceforge">ofset</remote-id>
+ </upstream>
+</pkgmetadata>
diff --git a/sci-mathematics/e/Manifest b/sci-mathematics/e/Manifest
new file mode 100644
index 000000000000..8172c087e788
--- /dev/null
+++ b/sci-mathematics/e/Manifest
@@ -0,0 +1,3 @@
+DIST E-1.5.tgz 1689077 SHA256 37239f169a9af3bb64edd205abe5022a043a1f4ea9ec694b39a9e61b37f5e46f SHA512 a2534c9e278741fed2f0005f5fa2b4ea60d71babd4e38c207a48f496df6916bf9ff4bf0ba41ae899eaeeeec7235ff1d759629dbcb627dd8766168f9bc98a4894 WHIRLPOOL e659d8e5917c505f2976532f0a19f0e2f845230c656f4cc62c5538f760e2559b06c0d9e47bc0e1df7eb9000791d0fa09ef5bf94dcc43f233e7514cffacf6893a
+DIST E-1.6.tgz 1627003 SHA256 91afe68f37ca2005a8eead3bdba0a4452de7cf7100369c9955304c8609b70c90 SHA512 769aa4d04595181285be49c1f21d7e8a47936fab78b5d6f2975910a64d4928cd2be97d781c4092dadab48d213a6bc788b8247a2310cf71042b1339129fe0cdf2 WHIRLPOOL 96c82427132017ee3f78c644ede9a018c74d59d7029fe006435baac9502d6cf6b097c51eeb1078b98ce8a208572956db756dcccd6529bcaba32519596dabf486
+DIST E-1.8.tgz 1832975 SHA256 636a5353046680f9c960d02d942df0a55af2e3941676df76e3356a334f6e842e SHA512 1b4358c636e8ea564ca942e1221e78234a9f0f793991f637bd7ec4d92eb9aa4a408a14c707405271fc017a9d63884d70bdfb0ed1b878383a1a44cfa57a7bdd51 WHIRLPOOL a917f756ce820344500712597db52d9e3716eab7eb60fb54fc15a247ecea25eb7a6bd3ac20bced771ece6296d78aaa7c64ea87a6239d6a7e3cd43d79fbaa83b9
diff --git a/sci-mathematics/e/e-1.5.ebuild b/sci-mathematics/e/e-1.5.ebuild
new file mode 100644
index 000000000000..a9475165619c
--- /dev/null
+++ b/sci-mathematics/e/e-1.5.ebuild
@@ -0,0 +1,128 @@
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="5"
+
+MY_PN="E"
+MY_P="${MY_PN}-${PV}"
+
+DESCRIPTION="E is a theorem prover for full first-order logic with equality"
+HOMEPAGE="http://www4.informatik.tu-muenchen.de/~schulz/E/E.html"
+SRC_URI="http://www4.in.tum.de/~schulz/WORK/E_DOWNLOAD/V_${PV}/${MY_PN}.tgz -> ${MY_P}.tgz"
+
+LICENSE="GPL-2"
+SLOT="0/${PV}"
+KEYWORDS="~amd64 ~x86"
+IUSE="doc examples isabelle"
+
+RDEPEND="isabelle? (
+ >=sci-mathematics/isabelle-2011.1-r1:=
+ )"
+DEPEND="${RDEPEND}"
+
+S="${WORKDIR}"/${MY_PN}
+
+src_configure() {
+ ./configure --prefix="${ROOT}usr" \
+ --man-prefix="${ROOT}share/man" \
+ || die "E configure failed"
+
+ sed -e "s@CFLAGS = @CFLAGS = ${CFLAGS} @" \
+ -e "s@LD = \$(CC) @LD = \$(CC) ${LDFLAGS} @" \
+ -i "${S}/Makefile.vars" \
+ || die "Could not add our flags to Makefile.vars"
+}
+
+src_install() {
+ for i in "${S}/PROVER/eprover" \
+ "${S}/PROVER/epclextract" \
+ "${S}/PROVER/eproof" \
+ "${S}/PROVER/eproof_ram" \
+ "${S}/PROVER/eground" \
+ "${S}/PROVER/e_ltb_runner" \
+ "${S}/PROVER/e_axfilter" \
+ "${S}/PROVER/checkproof" \
+ "${S}/PROVER/ekb_create" \
+ "${S}/PROVER/ekb_delete" \
+ "${S}/PROVER/ekb_ginsert" \
+ "${S}/PROVER/ekb_insert"
+ do
+ dobin "${i}"
+ done
+
+ for i in "${S}/DOC/man/eprover.1" \
+ "${S}/DOC/man/epclextract.1" \
+ "${S}/DOC/man/eproof.1" \
+ "${S}/DOC/man/eproof_ram.1" \
+ "${S}/DOC/man/eground.1" \
+ "${S}/DOC/man/e_ltb_runner.1" \
+ "${S}/DOC/man/e_axfilter.1" \
+ "${S}/DOC/man/checkproof.1" \
+ "${S}/DOC/man/ekb_create.1" \
+ "${S}/DOC/man/ekb_delete.1" \
+ "${S}/DOC/man/ekb_ginsert.1" \
+ "${S}/DOC/man/ekb_insert.1"
+ do
+ doman "${i}"
+ done
+
+ if use doc; then
+ pushd "${S}"/DOC || die "Could not cd to DOC"
+ dodoc ANNOUNCE CREDITS DONE E-REMARKS E-REMARKS.english E-USERS \
+ HISTORY NEWS PORTING ReadMe THINKME TODO TPTP_SUBMISSION \
+ WISHLIST eprover.pdf
+ dohtml *.html
+ insinto /usr/share/doc/${PF}/html
+ doins estyle.sty
+ popd
+ fi
+
+ if use examples; then
+ dodir /usr/share/${MY_PN}/examples
+ insinto /usr/share/${MY_PN}/examples
+ doins -r EXAMPLE_PROBLEMS
+ doins -r SIMPLE_APPS
+ fi
+
+ if use isabelle; then
+ ISABELLE_HOME="$(isabelle getenv ISABELLE_HOME | cut -d'=' -f 2)" \
+ || die "isabelle getenv ISABELLE_HOME failed"
+ [[ -n "${ISABELLE_HOME}" ]] || die "ISABELLE_HOME empty"
+ dodir "${ISABELLE_HOME}/contrib/${PN}-${PV}/etc"
+ cat <<- EOF >> "${S}/settings"
+ E_HOME="${ROOT}usr/bin"
+ E_VERSION="${PV}"
+ EOF
+ insinto "${ISABELLE_HOME}/contrib/${PN}-${PV}/etc"
+ doins "${S}/settings"
+ fi
+}
+
+pkg_postinst() {
+ if use isabelle; then
+ if [ -f "${ROOT}etc/isabelle/components" ]; then
+ if egrep "contrib/${PN}-[0-9.]*" "${ROOT}etc/isabelle/components"; then
+ sed -e "/contrib\/${PN}-[0-9.]*/d" \
+ -i "${ROOT}etc/isabelle/components"
+ fi
+ cat <<- EOF >> "${ROOT}etc/isabelle/components"
+ contrib/${PN}-${PV}
+ EOF
+ fi
+ fi
+}
+
+pkg_postrm() {
+ if use isabelle; then
+ if [ ! -f "${ROOT}usr/bin/eproof" ]; then
+ if [ -f "${ROOT}etc/isabelle/components" ]; then
+ # Note: this sed should only match the version of this ebuild
+ # Which is what we want as we do not want to remove the line
+ # of a new E being installed during an upgrade.
+ sed -e "/contrib\/${PN}-${PV}/d" \
+ -i "${ROOT}etc/isabelle/components"
+ fi
+ fi
+ fi
+}
diff --git a/sci-mathematics/e/e-1.6.ebuild b/sci-mathematics/e/e-1.6.ebuild
new file mode 100644
index 000000000000..4f56c1638bb4
--- /dev/null
+++ b/sci-mathematics/e/e-1.6.ebuild
@@ -0,0 +1,128 @@
+# Copyright 1999-2013 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="5"
+
+MY_PN="E"
+MY_P="${MY_PN}-${PV}"
+
+DESCRIPTION="E is a theorem prover for full first-order logic with equality"
+HOMEPAGE="http://www4.informatik.tu-muenchen.de/~schulz/E/E.html"
+SRC_URI="http://www4.in.tum.de/~schulz/WORK/E_DOWNLOAD/V_${PV}/${MY_PN}.tgz -> ${MY_P}.tgz"
+
+LICENSE="GPL-2"
+SLOT="0/${PV}"
+KEYWORDS="~amd64 ~x86"
+IUSE="doc examples isabelle"
+
+RDEPEND="isabelle? (
+ >=sci-mathematics/isabelle-2011.1-r1:=
+ )"
+DEPEND="${RDEPEND}"
+
+S="${WORKDIR}"/${MY_PN}
+
+src_configure() {
+ ./configure --prefix="${ROOT}usr" \
+ --man-prefix="${ROOT}share/man" \
+ || die "E configure failed"
+
+ sed -e "s@CFLAGS = @CFLAGS = ${CFLAGS} @" \
+ -e "s@LD = \$(CC) @LD = \$(CC) ${LDFLAGS} @" \
+ -i "${S}/Makefile.vars" \
+ || die "Could not add our flags to Makefile.vars"
+}
+
+src_install() {
+ for i in "${S}/PROVER/eprover" \
+ "${S}/PROVER/epclextract" \
+ "${S}/PROVER/eproof" \
+ "${S}/PROVER/eproof_ram" \
+ "${S}/PROVER/eground" \
+ "${S}/PROVER/e_ltb_runner" \
+ "${S}/PROVER/e_axfilter" \
+ "${S}/PROVER/checkproof" \
+ "${S}/PROVER/ekb_create" \
+ "${S}/PROVER/ekb_delete" \
+ "${S}/PROVER/ekb_ginsert" \
+ "${S}/PROVER/ekb_insert"
+ do
+ dobin "${i}"
+ done
+
+ for i in "${S}/DOC/man/eprover.1" \
+ "${S}/DOC/man/epclextract.1" \
+ "${S}/DOC/man/eproof.1" \
+ "${S}/DOC/man/eproof_ram.1" \
+ "${S}/DOC/man/eground.1" \
+ "${S}/DOC/man/e_ltb_runner.1" \
+ "${S}/DOC/man/e_axfilter.1" \
+ "${S}/DOC/man/checkproof.1" \
+ "${S}/DOC/man/ekb_create.1" \
+ "${S}/DOC/man/ekb_delete.1" \
+ "${S}/DOC/man/ekb_ginsert.1" \
+ "${S}/DOC/man/ekb_insert.1"
+ do
+ doman "${i}"
+ done
+
+ if use doc; then
+ pushd "${S}"/DOC || die "Could not cd to DOC"
+ dodoc ANNOUNCE CREDITS DONE E-REMARKS E-REMARKS.english E-USERS \
+ HISTORY NEWS PORTING ReadMe THINKME TODO TPTP_SUBMISSION \
+ WISHLIST eprover.pdf
+ dohtml *.html
+ insinto /usr/share/doc/${PF}/html
+ doins estyle.sty
+ popd
+ fi
+
+ if use examples; then
+ dodir /usr/share/${MY_PN}/examples
+ insinto /usr/share/${MY_PN}/examples
+ doins -r EXAMPLE_PROBLEMS
+ doins -r SIMPLE_APPS
+ fi
+
+ if use isabelle; then
+ ISABELLE_HOME="$(isabelle getenv ISABELLE_HOME | cut -d'=' -f 2)" \
+ || die "isabelle getenv ISABELLE_HOME failed"
+ [[ -n "${ISABELLE_HOME}" ]] || die "ISABELLE_HOME empty"
+ dodir "${ISABELLE_HOME}/contrib/${PN}-${PV}/etc"
+ cat <<- EOF >> "${S}/settings"
+ E_HOME="${ROOT}usr/bin"
+ E_VERSION="${PV}"
+ EOF
+ insinto "${ISABELLE_HOME}/contrib/${PN}-${PV}/etc"
+ doins "${S}/settings"
+ fi
+}
+
+pkg_postinst() {
+ if use isabelle; then
+ if [ -f "${ROOT}etc/isabelle/components" ]; then
+ if egrep "contrib/${PN}-[0-9.]*" "${ROOT}etc/isabelle/components"; then
+ sed -e "/contrib\/${PN}-[0-9.]*/d" \
+ -i "${ROOT}etc/isabelle/components"
+ fi
+ cat <<- EOF >> "${ROOT}etc/isabelle/components"
+ contrib/${PN}-${PV}
+ EOF
+ fi
+ fi
+}
+
+pkg_postrm() {
+ if use isabelle; then
+ if [ ! -f "${ROOT}usr/bin/eproof" ]; then
+ if [ -f "${ROOT}etc/isabelle/components" ]; then
+ # Note: this sed should only match the version of this ebuild
+ # Which is what we want as we do not want to remove the line
+ # of a new E being installed during an upgrade.
+ sed -e "/contrib\/${PN}-${PV}/d" \
+ -i "${ROOT}etc/isabelle/components"
+ fi
+ fi
+ fi
+}
diff --git a/sci-mathematics/e/e-1.8.ebuild b/sci-mathematics/e/e-1.8.ebuild
new file mode 100644
index 000000000000..3c86f52819c8
--- /dev/null
+++ b/sci-mathematics/e/e-1.8.ebuild
@@ -0,0 +1,119 @@
+# Copyright 1999-2013 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="5"
+
+MY_PN="E"
+MY_P="${MY_PN}-${PV}"
+
+DESCRIPTION="E is a theorem prover for full first-order logic with equality"
+HOMEPAGE="http://www4.informatik.tu-muenchen.de/~schulz/E/E.html"
+SRC_URI="http://www4.in.tum.de/~schulz/WORK/E_DOWNLOAD/V_${PV}/${MY_PN}.tgz -> ${MY_P}.tgz"
+
+LICENSE="GPL-2"
+SLOT="0/${PV}"
+KEYWORDS="~amd64 ~x86"
+IUSE="doc examples isabelle"
+
+RDEPEND="isabelle? (
+ >=sci-mathematics/isabelle-2011.1-r1:=
+ )"
+DEPEND="${RDEPEND}"
+
+S="${WORKDIR}"/${MY_PN}
+
+src_configure() {
+ ./configure --prefix="${ROOT}usr" \
+ --man-prefix="${ROOT}share/man" \
+ || die "E configure failed"
+
+ sed -e "s@CFLAGS = @CFLAGS = ${CFLAGS} @" \
+ -e "s@LD = \$(CC) @LD = \$(CC) ${LDFLAGS} @" \
+ -i "${S}/Makefile.vars" \
+ || die "Could not add our flags to Makefile.vars"
+}
+
+src_install() {
+ dobin "${S}/PROVER/eprover" \
+ "${S}/PROVER/epclextract" \
+ "${S}/PROVER/eproof" \
+ "${S}/PROVER/eproof_ram" \
+ "${S}/PROVER/eground" \
+ "${S}/PROVER/e_ltb_runner" \
+ "${S}/PROVER/e_axfilter" \
+ "${S}/PROVER/checkproof" \
+ "${S}/PROVER/ekb_create" \
+ "${S}/PROVER/ekb_delete" \
+ "${S}/PROVER/ekb_ginsert" \
+ "${S}/PROVER/ekb_insert"
+
+ doman "${S}/DOC/man/eprover.1" \
+ "${S}/DOC/man/epclextract.1" \
+ "${S}/DOC/man/eproof.1" \
+ "${S}/DOC/man/eproof_ram.1" \
+ "${S}/DOC/man/eground.1" \
+ "${S}/DOC/man/e_ltb_runner.1" \
+ "${S}/DOC/man/e_axfilter.1" \
+ "${S}/DOC/man/checkproof.1" \
+ "${S}/DOC/man/ekb_create.1" \
+ "${S}/DOC/man/ekb_delete.1" \
+ "${S}/DOC/man/ekb_ginsert.1" \
+ "${S}/DOC/man/ekb_insert.1"
+
+ if use doc; then
+ pushd "${S}"/DOC || die "Could not cd to DOC"
+ dodoc ANNOUNCE CREDITS DONE E-REMARKS E-REMARKS.english E-USERS \
+ HISTORY NEWS PORTING ReadMe THINKME TODO TPTP_SUBMISSION \
+ WISHLIST eprover.pdf
+ dohtml *.html
+ dohtml estyle.sty
+ popd
+ fi
+
+ if use examples; then
+ insinto /usr/share/${MY_PN}/examples
+ doins -r EXAMPLE_PROBLEMS
+ doins -r SIMPLE_APPS
+ fi
+
+ if use isabelle; then
+ ISABELLE_HOME="$(isabelle getenv ISABELLE_HOME | cut -d'=' -f 2)" \
+ || die "isabelle getenv ISABELLE_HOME failed"
+ [[ -n "${ISABELLE_HOME}" ]] || die "ISABELLE_HOME empty"
+ cat <<- EOF >> "${S}/settings"
+ E_HOME="${ROOT}usr/bin"
+ E_VERSION="${PV}"
+ EOF
+ insinto "${ISABELLE_HOME}/contrib/${PN}-${PV}/etc"
+ doins "${S}/settings"
+ fi
+}
+
+pkg_postinst() {
+ if use isabelle; then
+ if [ -f "${ROOT}etc/isabelle/components" ]; then
+ if egrep "contrib/${PN}-[0-9.]*" "${ROOT}etc/isabelle/components"; then
+ sed -e "/contrib\/${PN}-[0-9.]*/d" \
+ -i "${ROOT}etc/isabelle/components"
+ fi
+ cat <<- EOF >> "${ROOT}etc/isabelle/components"
+ contrib/${PN}-${PV}
+ EOF
+ fi
+ fi
+}
+
+pkg_postrm() {
+ if use isabelle; then
+ if [ ! -f "${ROOT}usr/bin/eproof" ]; then
+ if [ -f "${ROOT}etc/isabelle/components" ]; then
+ # Note: this sed should only match the version of this ebuild
+ # Which is what we want as we do not want to remove the line
+ # of a new E being installed during an upgrade.
+ sed -e "/contrib\/${PN}-${PV}/d" \
+ -i "${ROOT}etc/isabelle/components"
+ fi
+ fi
+ fi
+}
diff --git a/sci-mathematics/e/metadata.xml b/sci-mathematics/e/metadata.xml
new file mode 100644
index 000000000000..215faaa6df45
--- /dev/null
+++ b/sci-mathematics/e/metadata.xml
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+<maintainer>
+ <email>gienah@gentoo.org</email>
+ <name>Mark Wright</name>
+</maintainer>
+<herd>sci-mathematics</herd>
+<longdescription lang='en'>
+E is a theorem prover for full first-order logic with equality. It
+accepts a problem specification, typically consisting of a number of
+first-order clauses or formulas, and a conjecture, again either in
+clausal or full first-order form. The system will then try to find a
+formal proof for the conjecture, assuming the axioms.
+
+If a proof is found, the system can provide a detailed list of proof
+steps that can be individually verified. If the conjecture is
+existential (i.e. it’s of the form “there exists an X with property
+P”), the latest versions can also provide possible answers (values for
+X).
+
+Development of E started as part of the E-SETHEO project at TUM. The
+first public release was in in 1998, and the system has been
+continuously improved ever since. I believe that E now is one of the
+most powerful and friendly reasoning systems for first-order
+logic. The prover has successfully participated in many competitions.
+</longdescription>
+<use>
+ <flag name='isabelle'>Add integration support for the Isabelle/HOL
+ theorem prover.</flag>
+</use>
+</pkgmetadata>
diff --git a/sci-mathematics/ent/Manifest b/sci-mathematics/ent/Manifest
new file mode 100644
index 000000000000..634f75007ebb
--- /dev/null
+++ b/sci-mathematics/ent/Manifest
@@ -0,0 +1 @@
+DIST random-101202.zip 76200 RMD160 b21b8401fdbd2aac189fe4a442a1164b172407f8 SHA1 0f2f12dc67d1f02f77776709cf5fc5eee1d1b2e2 SHA256 c14ed62db24511848d6b37d4bf8869185b65be9042ffad5272257f3a249569ec
diff --git a/sci-mathematics/ent/ent-101202.ebuild b/sci-mathematics/ent/ent-101202.ebuild
new file mode 100644
index 000000000000..fa8a0eb052a3
--- /dev/null
+++ b/sci-mathematics/ent/ent-101202.ebuild
@@ -0,0 +1,29 @@
+# Copyright 1999-2011 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="3"
+
+inherit eutils toolchain-funcs
+
+DESCRIPTION="Pseudorandom number sequence test"
+HOMEPAGE="http://www.fourmilab.ch/random/"
+SRC_URI="mirror://gentoo/random-${PV}.zip"
+
+SLOT="0"
+KEYWORDS="~amd64 ~x86 ~amd64-linux ~x86-linux"
+LICENSE="public-domain"
+IUSE=""
+
+RDEPEND=""
+DEPEND="app-arch/unzip"
+
+src_prepare() {
+ epatch "${FILESDIR}"/${PV}-gentoo.patch
+ tc-export CC
+}
+
+src_install() {
+ dobin ${PN} || die
+ dohtml ${PN}.html ${PN}itle.gif || die
+}
diff --git a/sci-mathematics/ent/files/101202-gentoo.patch b/sci-mathematics/ent/files/101202-gentoo.patch
new file mode 100644
index 000000000000..a71bc5050637
--- /dev/null
+++ b/sci-mathematics/ent/files/101202-gentoo.patch
@@ -0,0 +1,20 @@
+diff --git a/Makefile b/Makefile
+index 2a150cf..3f9b883 100644
+--- a/Makefile
++++ b/Makefile
+@@ -1,12 +1,12 @@
+
+ # Unix make file for random test program
+
+-CC = gcc
+-CFLAGS = -g -Wall
++CC ?= gcc
++CFLAGS ?= -g -Wall
+ #CFLAGS = -O
+
+ ent: ent.o iso8859.o randtest.o chisq.o
+- $(CC) $(CFLAGS) ent.o iso8859.o randtest.o chisq.o -o ent -lm
++ $(CC) $(LDFLAGS) $(CFLAGS) ent.o iso8859.o randtest.o chisq.o -o ent -lm
+
+ ent.c: iso8859.h randtest.h
+
diff --git a/sci-mathematics/ent/metadata.xml b/sci-mathematics/ent/metadata.xml
new file mode 100644
index 000000000000..a2070de023f7
--- /dev/null
+++ b/sci-mathematics/ent/metadata.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+<herd>sci-mathematics</herd>
+<maintainer>
+ <email>jlec@gentoo.org</email>
+</maintainer>
+</pkgmetadata>
diff --git a/sci-mathematics/euler/Manifest b/sci-mathematics/euler/Manifest
new file mode 100644
index 000000000000..b1411738a673
--- /dev/null
+++ b/sci-mathematics/euler/Manifest
@@ -0,0 +1 @@
+DIST euler-1.61.0.tgz 1202485 SHA256 1350a3ded26fa8bab2580a1dc3a689aabbb100b872df62819327282773e02d95 SHA512 f8b9b0c6aa5aea4bd42bd33fff986a52c624c268ede11b83c2c53293a5acbda45317ecc719c12f377b236460c7ff0dba1d110ee8e90b526fc70af03ed0327b27 WHIRLPOOL 46967a4d5cb82a3fcc42730c8ecdb5b529e176bd6b9dcf1055e7790f9d15cfc85eda60bae66543a6cca1fda73cf88f15bc200ac1cdc5c10347a1237fcaa06aae
diff --git a/sci-mathematics/euler/euler-1.61.0.ebuild b/sci-mathematics/euler/euler-1.61.0.ebuild
new file mode 100644
index 000000000000..1f8ab2c0f687
--- /dev/null
+++ b/sci-mathematics/euler/euler-1.61.0.ebuild
@@ -0,0 +1,43 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+AUTOTOOLS_AUTORECONF=1
+AUTOTOOLS_IN_SOURCE_BUILD=1
+
+inherit autotools-utils
+
+DESCRIPTION="Mathematical programming environment"
+HOMEPAGE="http://euler.sourceforge.net/"
+SRC_URI="mirror://sourceforge/euler/${P}.tgz"
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="amd64 ppc -sparc x86 ~amd64-linux ~x86-linux"
+IUSE=""
+
+DEPEND="x11-libs/gtk+:2
+ virtual/pkgconfig"
+
+RDEPEND="x11-libs/gtk+:2
+ x11-misc/xdg-utils"
+
+PATCHES=(
+ "${FILESDIR}"/configure-gentoo.patch
+ "${FILESDIR}"/command-gcc4-gentoo.patch
+ "${FILESDIR}"/${PN}-glibc-2.4-gentoo.patch
+ "${FILESDIR}"/${PN}-xdg.patch
+ "${FILESDIR}"/${PN}-fortify.patch
+)
+
+src_prepare() {
+ # gentoo specific stuff
+ sed -i -e '/COPYING/d' -e '/INSTALL/d' Makefile.am || die
+ sed -i \
+ -e "s:doc/euler:doc/${PF}:g" \
+ Makefile.am docs/Makefile.am \
+ docs/*/Makefile.am docs/*/images/Makefile.am src/main.c \
+ || die "sed for docs failed"
+ autotools-utils_src_prepare
+}
diff --git a/sci-mathematics/euler/files/command-gcc4-gentoo.patch b/sci-mathematics/euler/files/command-gcc4-gentoo.patch
new file mode 100644
index 000000000000..c405d65bd76e
--- /dev/null
+++ b/sci-mathematics/euler/files/command-gcc4-gentoo.patch
@@ -0,0 +1,12 @@
+diff -Naur euler-1.61.0/src/command.c euler-1.61.0-new/src/command.c
+--- euler-1.61.0/src/command.c 2005-10-24 00:38:24.000000000 +0000
++++ euler-1.61.0-new/src/command.c 2006-02-08 23:30:43.000000000 +0000
+@@ -732,7 +732,7 @@
+ }
+
+
+-static int command_count;
++int command_count;
+
+ commandtyp command_list[] = {
+ {"quit",c_quit,do_quit},
diff --git a/sci-mathematics/euler/files/configure-gentoo.patch b/sci-mathematics/euler/files/configure-gentoo.patch
new file mode 100644
index 000000000000..e1e7c6ef1e6b
--- /dev/null
+++ b/sci-mathematics/euler/files/configure-gentoo.patch
@@ -0,0 +1,37 @@
+diff -Naur euler-1.61.0/configure.in euler-1.61.0-new/configure.in
+--- euler-1.61.0/configure.in 2005-10-30 16:40:27.000000000 +0000
++++ euler-1.61.0-new/configure.in 2006-02-08 23:38:54.000000000 +0000
+@@ -8,8 +8,6 @@
+ AM_CONFIG_HEADER(config.h)
+
+ AC_ISC_POSIX
+-CFLAGS=""
+-AC_SUBST(CFLAGS)
+ AC_PROG_CC
+ AM_PROG_CC_STDC
+ AC_HEADER_STDC
+@@ -21,6 +19,10 @@
+
+
+ dnl Checks for libraries.
++dnl Check for libm for fmod()
++AC_SEARCH_LIBS([fmod], [m], [], [
++ AC_MSG_ERROR([unable to find the fmod() function])
++])
+
+
+ dnl Checks for header files.
+diff -Naur euler-1.61.0/src/Makefile.am euler-1.61.0-new/src/Makefile.am
+--- euler-1.61.0/src/Makefile.am 2005-10-30 22:48:35.000000000 +0000
++++ euler-1.61.0-new/src/Makefile.am 2006-02-08 23:41:32.000000000 +0000
+@@ -7,10 +7,6 @@
+ INCLUDES = \
+ $(GTK_CFLAGS)
+
+-AM_CFLAGS =\
+- -Wall\
+- -O3
+-
+ bin_PROGRAMS = euler
+
+ euler_SOURCES = \
diff --git a/sci-mathematics/euler/files/euler-fortify.patch b/sci-mathematics/euler/files/euler-fortify.patch
new file mode 100644
index 000000000000..efb366e2cc04
--- /dev/null
+++ b/sci-mathematics/euler/files/euler-fortify.patch
@@ -0,0 +1,36 @@
+diff -Nur euler-1.61.0.orig/src/command.c euler-1.61.0/src/command.c
+--- euler-1.61.0.orig/src/command.c 2010-11-19 17:50:54.000000000 +0000
++++ euler-1.61.0/src/command.c 2010-11-19 18:23:11.000000000 +0000
+@@ -606,7 +606,7 @@
+ void do_help (void)
+ { char name[256];
+ header *hd;
+- int count,i,defaults;
++ size_t count,i,defaults;
+ char *p,*end,*pnote;
+ builtintyp *b;
+ scan_space();
+diff -Nur euler-1.61.0.orig/src/stack.h euler-1.61.0/src/stack.h
+--- euler-1.61.0.orig/src/stack.h 2010-11-19 17:50:54.000000000 +0000
++++ euler-1.61.0/src/stack.h 2010-11-19 18:19:23.000000000 +0000
+@@ -63,7 +63,7 @@
+ #endif
+ } dims;
+
+-typedef struct { unsigned long s; } inttyp;
++typedef struct { size_t s; } inttyp;
+
+ typedef struct { header hd; double val; } realtyp;
+
+diff -Nur euler-1.61.0.orig/src/udf.c euler-1.61.0/src/udf.c
+--- euler-1.61.0.orig/src/udf.c 2010-11-19 17:50:54.000000000 +0000
++++ euler-1.61.0/src/udf.c 2010-11-19 18:21:20.000000000 +0000
+@@ -334,7 +334,7 @@
+ { char name[16];
+ header *hd;
+ char *p,*pnote;
+- int i,count,defaults;
++ size_t i,count,defaults;
+ builtintyp *b;
+ scan_space();
+ scan_name(name); hd=searchudf(name);
diff --git a/sci-mathematics/euler/files/euler-glibc-2.4-gentoo.patch b/sci-mathematics/euler/files/euler-glibc-2.4-gentoo.patch
new file mode 100644
index 000000000000..da377bd5f3ba
--- /dev/null
+++ b/sci-mathematics/euler/files/euler-glibc-2.4-gentoo.patch
@@ -0,0 +1,13 @@
+# patch to fix missing CLK_TCK in glibc 2.4
+
+--- src/main.c. 2006-04-04 15:05:34.000000000 +0200
++++ src/main.c 2006-04-04 15:09:20.000000000 +0200
+@@ -439,7 +439,7 @@
+ gettimer(TIMEOFDAY,&t);
+ return (t.tv_sec+t.tv_nsec/1000000000.0);
+ #else
+- return ((double)(times(NULL)))/CLK_TCK;
++ return ((double)(times(NULL)))/CLOCKS_PER_SEC;
+ #endif
+ }
+
diff --git a/sci-mathematics/euler/files/euler-xdg.patch b/sci-mathematics/euler/files/euler-xdg.patch
new file mode 100644
index 000000000000..cb1bf54a2bbb
--- /dev/null
+++ b/sci-mathematics/euler/files/euler-xdg.patch
@@ -0,0 +1,23 @@
+--- docs/doc.html.orig 2008-01-07 23:11:25.490634852 +0000
++++ docs/doc.html 2008-01-07 23:13:57.652980222 +0000
+@@ -184,7 +184,8 @@
+ <div align=center><img src="images/pref3.gif"></div>
+
+ <p align="justify">Finally, You can set a flag to let Euler save preferences at exit (the default).
+-You may choose another browser than the one suggested (netscape by default). And
++You may choose another browser than the one suggested (your default
++ desktop browser is selected with xdg-open by default). And
+ You can also reset the preferences to the default values.</p>
+ <div align=center><img src="images/pref4.gif"></div>
+
+--- src/rc.h.orig 2008-01-07 23:15:36.617118688 +0000
++++ src/rc.h 2008-01-07 23:15:54.097371330 +0000
+@@ -26,7 +26,7 @@
+ #define E_GSTACK_DEFAULT 4*1024l
+ #define E_GLINES_DEFAULT 40
+
+-#define E_BROWSER_DEFAULT "netscape"
++#define E_BROWSER_DEFAULT "xdg-open"
+
+ #define MAX_COLORS 16
+
diff --git a/sci-mathematics/euler/metadata.xml b/sci-mathematics/euler/metadata.xml
new file mode 100644
index 000000000000..8e1f11be3629
--- /dev/null
+++ b/sci-mathematics/euler/metadata.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <herd>sci-mathematics</herd>
+ <upstream>
+ <remote-id type="sourceforge">euler</remote-id>
+ </upstream>
+</pkgmetadata>
diff --git a/sci-mathematics/factmsieve/Manifest b/sci-mathematics/factmsieve/Manifest
new file mode 100644
index 000000000000..6d42a3469386
--- /dev/null
+++ b/sci-mathematics/factmsieve/Manifest
@@ -0,0 +1 @@
+DIST factmsieve.76.zip 19563 SHA256 961db0a36acc58ebf5ce2f5ba9f952e018a9aefbc2f9f8ab8b2a425757c2e2a2 SHA512 b07b0676a635ff746b1edfaf064d27388df8f9c5c2fe1bd1e80d4c839c6e518e3a0b39a06b76f3d59c9fa3f4cc99df0831ba6309a2a7d2eb779b952a29996431 WHIRLPOOL c5d818122f5db9b744272999bb72c42eb73a35dd20ad4ce46822b7e5be2f978a6582c9c5a2402f5fc9a1db4e8ec9f5373f7b090421000f85abecec156cf97a81
diff --git a/sci-mathematics/factmsieve/factmsieve-76.ebuild b/sci-mathematics/factmsieve/factmsieve-76.ebuild
new file mode 100644
index 000000000000..892331aacc80
--- /dev/null
+++ b/sci-mathematics/factmsieve/factmsieve-76.ebuild
@@ -0,0 +1,36 @@
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=4
+DESCRIPTION="Convenient factorization helper script using msieve and ggnfs"
+HOMEPAGE="http://gladman.plushost.co.uk/oldsite/computing/factoring.php"
+SRC_URI="http://gladman.plushost.co.uk/oldsite/computing/${PN}.${PV}.zip"
+
+inherit eutils
+
+LICENSE="BSD"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE=""
+
+# I guess no one really "needs" python 2.6, but I'm a nice person
+RDEPEND="|| ( dev-lang/python:2.7 dev-lang/python:2.6 )
+ sci-mathematics/msieve
+ sci-mathematics/ggnfs"
+DEPEND=""
+
+S=${WORKDIR}
+
+src_prepare() {
+ epatch "${FILESDIR}/${P}.patch"
+}
+
+src_compile() { :;
+}
+
+src_install() {
+ mkdir -p "${D}/usr/bin/"
+ cp "${S}/${PN}.py" "${D}/usr/bin/${PN}" || die "Failed to install"
+ chmod +x "${D}/usr/bin/${PN}" || die
+}
diff --git a/sci-mathematics/factmsieve/files/factmsieve-76.patch b/sci-mathematics/factmsieve/files/factmsieve-76.patch
new file mode 100644
index 000000000000..c22f88606588
--- /dev/null
+++ b/sci-mathematics/factmsieve/files/factmsieve-76.patch
@@ -0,0 +1,52 @@
+--- factmsieve.py 2010-12-02 13:59:20.000000000 +0800
++++ factmsieve.py.new 2012-11-30 15:06:50.566116187 +0800
+@@ -1,3 +1,4 @@
++#!/usr/bin/env python2
+ # factmsieve.py - A Python driver for GGNFS and MSIEVE
+ #
+ # Copyright (c) 2010, Brian Gladman
+@@ -56,9 +57,12 @@
+ import time, subprocess, gzip, glob, math, tempfile, datetime
+ import atexit, threading, collections, multiprocessing, platform
+
++# need to save pwd
++CUR_DIR=os.path.realpath(os.curdir)
++
+ # Set binary directory paths
+-GGNFS_PATH = '../../bin/x64/Release/'
+-MSIEVE_PATH = '../../../msieve/build.vc10/x64/Release/'
++GGNFS_PATH = '/usr/bin/'
++MSIEVE_PATH = '/usr/bin/'
+
+ # Set the number of CPU cores and threads
+ NUM_CORES = 4
+@@ -69,7 +73,7 @@
+ # number of linear algebra threads to launch
+ LA_THREADS = NUM_CORES * THREADS_PER_CORE
+
+-USE_CUDA = True
++USE_CUDA = False
+ GPU_NUM = 0
+ MSIEVE_POLY_TIME_LIMIT = 0
+
+@@ -103,8 +107,8 @@
+
+ # default parameter files
+
+-DEFAULT_PAR_FILE = GGNFS_PATH + 'def-par.txt'
+-DEFAULT_POLSEL_PAR_FILE = GGNFS_PATH + 'def-nm-params.txt'
++DEFAULT_PAR_FILE = '/usr/share/doc/ggnfs/def-par.txt'
++DEFAULT_POLSEL_PAR_FILE = '/usr/share/doc/ggnfs/def-nm-params.txt'
+
+ # temporary files
+
+@@ -258,7 +262,8 @@
+ # write string to log(s):
+
+ def write_string_to_log(s):
+- with open(LOGNAME, 'a') as out_f:
++ # XXX hax
++ with open(CUR_DIR+'/'+LOGNAME, 'a') as out_f:
+ print(date_time_string() + s, file = out_f)
+
+ def output(s, console = True, log = True):
diff --git a/sci-mathematics/factmsieve/metadata.xml b/sci-mathematics/factmsieve/metadata.xml
new file mode 100644
index 000000000000..24cbb90cf0c4
--- /dev/null
+++ b/sci-mathematics/factmsieve/metadata.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <maintainer>
+ <email>patrick@gentoo.org</email>
+ <name>Patrick Lauer</name>
+ </maintainer>
+</pkgmetadata>
diff --git a/sci-mathematics/fann/Manifest b/sci-mathematics/fann/Manifest
new file mode 100644
index 000000000000..ea4816c0e5d7
--- /dev/null
+++ b/sci-mathematics/fann/Manifest
@@ -0,0 +1,2 @@
+DIST FANN-2.2.0-Source.zip 2285087 SHA256 434b85fce60701c4e0066c442d60110d8e649f278e4edb814f0c0e7a1e0929fd
+DIST fann-2.1.0beta.zip 4033198 SHA256 c24171b5b9c87946bd2f50045cc8dbd0121629fe426615501db14e6043e4a141
diff --git a/sci-mathematics/fann/fann-2.1.0_beta-r1.ebuild b/sci-mathematics/fann/fann-2.1.0_beta-r1.ebuild
new file mode 100644
index 000000000000..dab9cb87eb9a
--- /dev/null
+++ b/sci-mathematics/fann/fann-2.1.0_beta-r1.ebuild
@@ -0,0 +1,99 @@
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=2
+
+PYTHON_DEPEND="python? 2"
+SUPPORT_PYTHON_ABIS="1"
+RESTRICT_PYTHON_ABIS="3.* *-jython"
+
+inherit eutils python autotools
+
+MY_P=${P/_/}
+
+DESCRIPTION="Fast Artificial Neural Network Library"
+HOMEPAGE="http://leenissen.dk/fann/"
+SRC_URI="mirror://sourceforge/${PN}/${MY_P}.zip"
+
+LICENSE="LGPL-2.1"
+SLOT="0"
+KEYWORDS="~amd64 ~ppc ~x86"
+IUSE="doc python static-libs"
+
+RDEPEND=""
+DEPEND="${RDEPEND}
+ python? ( dev-lang/swig )
+ app-arch/unzip"
+
+S="${WORKDIR}/${P/_beta/}"
+
+pkg_setup() {
+ use python && python_pkg_setup
+}
+
+src_prepare() {
+ epatch \
+ "${FILESDIR}"/${P}-python.patch \
+ "${FILESDIR}"/${P}-benchmark.patch \
+ "${FILESDIR}"/${P}-examples.patch \
+ "${FILESDIR}"/${P}-asneeded.patch \
+ "${FILESDIR}"/${P}-valist.patch \
+ "${FILESDIR}"/${P}-sizecheck.patch
+ eautoreconf
+ use python && python_copy_sources python
+}
+
+src_configure() {
+ econf $(use_enable static-libs static)
+}
+
+src_compile() {
+ emake || die "emake failed"
+ compilation() {
+ emake PYTHON_VERSION="$(python_get_version)" || die "emake python failed"
+ }
+ use python && python_execute_function -s --source-dir python compilation
+}
+
+src_test() {
+ cd "${S}"/examples
+ emake CFLAGS="${CFLAGS} -I../src/include -L../src/.libs" \
+ || die "emake examples failed"
+ LD_LIBRARY_PATH="../src/.libs" emake runtest || die "tests failed"
+ emake clean
+ testing() {
+ emake test || die "failed tests for python wrappers"
+ }
+ use python && python_execute_function -s --source-dir python testing
+}
+
+src_install() {
+ emake install DESTDIR="${D}" || die "emake install failed"
+ dodoc AUTHORS ChangeLog NEWS README TODO || die
+
+ if use doc; then
+ dodoc doc/*.txt
+ insinto /usr/share/doc/${PF}
+ doins doc/fann_en.pdf || die "failed to install reference manual"
+ doins -r examples || die "failed to install examples"
+ doins -r benchmarks || die "failed to install benchmarks"
+ fi
+
+ installation() {
+ emake install ROOT="${D}" || die "failed to install python wrappers"
+ if use doc; then
+ insinto /usr/share/doc/${PF}/examples/python
+ doins -r examples || die "failed to install python examples"
+ fi
+ }
+ use python && python_execute_function -s --source-dir python installation
+}
+
+pkg_postinst() {
+ use python && python_mod_optimize py${PN}
+}
+
+pkg_postrm() {
+ use python && python_mod_cleanup py${PN}
+}
diff --git a/sci-mathematics/fann/fann-2.2.0.ebuild b/sci-mathematics/fann/fann-2.2.0.ebuild
new file mode 100644
index 000000000000..4ba0a43afb76
--- /dev/null
+++ b/sci-mathematics/fann/fann-2.2.0.ebuild
@@ -0,0 +1,41 @@
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=4
+
+inherit cmake-utils
+
+MYP=FANN-${PV}-Source
+
+DESCRIPTION="Fast Artificial Neural Network Library"
+HOMEPAGE="http://leenissen.dk/fann/"
+SRC_URI="mirror://sourceforge/${PN}/${MYP}.zip"
+
+LICENSE="LGPL-2.1"
+SLOT="0"
+KEYWORDS="~amd64 ~ppc ~x86"
+IUSE="examples"
+
+RDEPEND=""
+DEPEND="${RDEPEND}
+ app-arch/unzip"
+
+S="${WORKDIR}/${MYP}"
+
+PATCHES=( "${FILESDIR}"/${P}-examples.patch )
+
+src_test() {
+ cd examples
+ emake CFLAGS="${CFLAGS} -I../src/include -L${BUILD_DIR}/src"
+ LD_LIBRARY_PATH="${BUILD_DIR}/src" emake runtest
+ emake clean
+}
+
+src_install() {
+ cmake-utils_src_install
+ if use examples; then
+ insinto /usr/share/doc/${PF}
+ doins -r examples
+ fi
+}
diff --git a/sci-mathematics/fann/files/fann-2.0.0-benchmark.patch b/sci-mathematics/fann/files/fann-2.0.0-benchmark.patch
new file mode 100644
index 000000000000..ec37e9940a63
--- /dev/null
+++ b/sci-mathematics/fann/files/fann-2.0.0-benchmark.patch
@@ -0,0 +1,49 @@
+diff -Naur fann-2.0.0/benchmarks/Makefile fann-2.0.0-new/benchmarks/Makefile
+--- fann-2.0.0/benchmarks/Makefile 2005-11-29 16:33:12.000000000 -0500
++++ fann-2.0.0-new/benchmarks/Makefile 2006-10-28 09:08:00.000000000 -0400
+@@ -16,7 +16,7 @@
+ all: $(TARGETS)
+
+ quality: quality.cc
+- $(G++) $(CFLAGS) $(LFLAGS) -I$(JNEURALDIR)include/ -L$(JNEURALDIR) -I$(LWNNDIR) -L$(LWNNDIR) $< -o $@ -lfloatfann -llwneuralnet -ljneural -lfl
++ $(G++) $(CFLAGS) $(LFLAGS) -I$(JNEURALDIR)include/ -L$(JNEURALDIR) -I$(LWNNDIR) -L$(LWNNDIR) $< -o $@ -lfloatfann -lfl
+
+ quality_fixed: quality_fixed.c
+ $(GCC) $(CFLAGS) $(LFLAGS) $< -o $@ -lfixedfann
+@@ -25,7 +25,7 @@
+ $(GCC) -ggdb -lm -DDEBUG -Wall -ansi -I../src/ -I../src/include/ ../src/fixedfann.c $< -o $@
+
+ performance: performance.cc
+- $(G++) $(CFLAGS) $(LFLAGS) -I$(JNEURALDIR)include/ -L$(JNEURALDIR) -I$(LWNNDIR) -L$(LWNNDIR) $< -o $@ -lfloatfann -llwneuralnet -ljneural -lfl
++ $(G++) $(CFLAGS) $(LFLAGS) -I$(JNEURALDIR)include/ -L$(JNEURALDIR) -I$(LWNNDIR) -L$(LWNNDIR) $< -o $@ -lfloatfann -lfl
+
+ performance_fixed: performance.cc
+ $(G++) $(CFLAGS) $(LFLAGS) -DFIXEDFANN $< -o $@ -lfixedfann
+diff -Naur fann-2.0.0/benchmarks/performance.cc fann-2.0.0-new/benchmarks/performance.cc
+--- fann-2.0.0/benchmarks/performance.cc 2005-10-24 16:48:47.000000000 -0400
++++ fann-2.0.0-new/benchmarks/performance.cc 2006-10-28 09:08:28.000000000 -0400
+@@ -19,8 +19,8 @@
+
+ //uncomment lines below to benchmark the libraries
+
+-#define JNEURAL
+-#define LWNN
++/*#define JNEURAL
++#define LWNN */
+
+ #include <stdio.h>
+ #include <stdlib.h>
+diff -Naur fann-2.0.0/benchmarks/quality.cc fann-2.0.0-new/benchmarks/quality.cc
+--- fann-2.0.0/benchmarks/quality.cc 2005-11-29 16:33:12.000000000 -0500
++++ fann-2.0.0-new/benchmarks/quality.cc 2006-10-28 09:08:19.000000000 -0400
+@@ -19,8 +19,8 @@
+
+ //uncomment lines below to benchmark the libraries
+
+-#define JNEURAL
+-#define LWNN
++/*#define JNEURAL
++#define LWNN */
+
+ #include <stdio.h>
+ #include <stdlib.h>
diff --git a/sci-mathematics/fann/files/fann-2.0.0-shared-libs-gentoo.patch b/sci-mathematics/fann/files/fann-2.0.0-shared-libs-gentoo.patch
new file mode 100644
index 000000000000..2d9782a563a2
--- /dev/null
+++ b/sci-mathematics/fann/files/fann-2.0.0-shared-libs-gentoo.patch
@@ -0,0 +1,23 @@
+diff -Naur fann-2.0.0/python/pyfann/Makefile fann-2.0.0-new/python/pyfann/Makefile
+--- fann-2.0.0/python/pyfann/Makefile 2005-12-02 20:22:43.000000000 -0500
++++ fann-2.0.0-new/python/pyfann/Makefile 2006-10-28 07:36:34.000000000 -0400
+@@ -10,7 +10,7 @@
+ all: $(TARGETS)
+
+ _%.so: pyfann_wrap.o fann_helper.o
+- gcc $(LIBS) -shared -dll $^ -o $@
++ gcc $(LIBS) -fPIC -shared -dll $^ -o $@
+
+ %.o: %.c
+ gcc -c $< -I/usr/include/$(PYTHON)/ -I$(FANN_DIR)/src/include/
+diff -Naur fann-2.0.0/python/setup.py fann-2.0.0-new/python/setup.py
+--- fann-2.0.0/python/setup.py 2006-01-06 16:45:28.000000000 -0500
++++ fann-2.0.0-new/python/setup.py 2006-10-28 07:36:07.000000000 -0400
+@@ -40,6 +40,6 @@
+ url='http://sourceforge.net/projects/fann/',
+ license='GNU LESSER GENERAL PUBLIC LICENSE (LGPL)',
+ py_modules=['pyfann.libfann','pyfann.fann'],
+- ext_modules=[Extension('pyfann._libfann',['pyfann/pyfann.i','pyfann/fann_helper.c'], include_dirs=['../src/include'], extra_objects=['../src/doublefann.o']) ]
++ ext_modules=[Extension('pyfann._libfann',['pyfann/pyfann.i','pyfann/fann_helper.c'], include_dirs=['../src/include'], extra_objects=['../src/.libs/doublefann.o']) ]
+ )
+
diff --git a/sci-mathematics/fann/files/fann-2.1.0_beta-asneeded.patch b/sci-mathematics/fann/files/fann-2.1.0_beta-asneeded.patch
new file mode 100644
index 000000000000..f68da2d4eccb
--- /dev/null
+++ b/sci-mathematics/fann/files/fann-2.1.0_beta-asneeded.patch
@@ -0,0 +1,8 @@
+--- configure.in.orig 2009-09-09 21:18:25.000000000 +0100
++++ configure.in 2009-09-09 21:18:43.000000000 +0100
+@@ -7,4 +7,5 @@
+ AC_C_CONST
+ AC_HEADER_TIME
+ AC_CHECK_FUNCS(gettimeofday)
++AC_CHECK_LIB(m, sin)
+ AC_OUTPUT(Makefile src/Makefile src/include/Makefile fann.pc fann.spec)
diff --git a/sci-mathematics/fann/files/fann-2.1.0_beta-benchmark.patch b/sci-mathematics/fann/files/fann-2.1.0_beta-benchmark.patch
new file mode 100644
index 000000000000..60933e5e361f
--- /dev/null
+++ b/sci-mathematics/fann/files/fann-2.1.0_beta-benchmark.patch
@@ -0,0 +1,80 @@
+--- benchmarks/Makefile.orig 2008-04-22 10:16:48.664395478 +0000
++++ benchmarks/Makefile 2008-04-22 10:59:59.815994915 +0000
+@@ -1,43 +1,35 @@
+-# The jneural library (http://voltar-confed.org/jneural/) and lwneuralnet library (http://sourceforge.net/projects/lwneuralnet/) needs to be installed in order to run the benchmarks
+-
+-GCC = gcc
+-G++ = g++
++# The jneural library (http://voltar-confed.org/jneural/) and lwneuralnet library (http://sourceforge.net/projects/lwneuralnet/) needs to be installed in order to run the benchmarks with EXTRA_NEURALS
+
+ TARGETS = quality quality_fixed performance performance_fixed shuffle parity two-spirals
+
+-CFLAGS = -O3 -finline-functions -funroll-loops -Werror
+-
+ LFLAGS = -lm
+-
+-JNEURALDIR = ../../libraries/jneural/
+-
+-LWNNDIR = ../../libraries/lwneuralnet-0.8/source/
++#EXTRA_NEURALS="-llwneuralnet -ljneural -DJNEURAL"
+
+ all: $(TARGETS)
+
+ quality: quality.cc
+- $(G++) $(CFLAGS) $(LFLAGS) -I$(JNEURALDIR)include/ -L$(JNEURALDIR) -I$(LWNNDIR) -L$(LWNNDIR) $< -o $@ -lfloatfann -llwneuralnet -ljneural -lfl
++ $(CXX) $(CXXFLAGS) $(LFLAGS) $< -o $@ -lfloatfann -lfl $(EXTRA_NEURALS)
+
+ quality_fixed: quality_fixed.c
+- $(GCC) $(CFLAGS) $(LFLAGS) $< -o $@ -lfixedfann
++ $(CC) $(CFLAGS) $(LFLAGS) $< -o $@ -lfixedfann
+
+ quality_fixed_debug: quality_fixed.c
+- $(GCC) -ggdb -lm -DDEBUG -Wall -ansi -I../src/ -I../src/include/ ../src/fixedfann.c $< -o $@
++ $(CC) -ggdb -lm -DDEBUG -Wall -ansi -I../src/ -I../src/include/ ../src/fixedfann.c $< -o $@
+
+ performance: performance.cc
+- $(G++) $(CFLAGS) $(LFLAGS) -I$(JNEURALDIR)include/ -L$(JNEURALDIR) -I$(LWNNDIR) -L$(LWNNDIR) $< -o $@ -lfloatfann -llwneuralnet -ljneural -lfl
++ $(CXX) $(CXXFLAGS) $(LFLAGS) $< -o $@ -lfloatfann -lfl $(EXTRA_NEURALS)
+
+ performance_fixed: performance.cc
+- $(G++) $(CFLAGS) $(LFLAGS) -DFIXEDFANN $< -o $@ -lfixedfann
++ $(CXX) $(CXXFLAGS) $(LFLAGS) -DFIXEDFANN $< -o $@ -lfixedfann
+
+ shuffle: shuffle.c
+- $(GCC) $(CFLAGS) $(LFLAGS) $< -o $@ -lfloatfann
++ $(CC) $(CFLAGS) $(LFLAGS) $< -o $@ -lfloatfann
+
+ two-spirals: two-spirals.c
+- $(GCC) $(CFLAGS) $(LFLAGS) $< -o $@
++ $(CC) $(CFLAGS) $(LFLAGS) $< -o $@
+
+ parity: parity.c
+- $(GCC) $(CFLAGS) $(LFLAGS) $< -o $@
++ $(CC) $(CFLAGS) $(LFLAGS) $< -o $@
+
+ clean:
+ rm -rf -- $(TARGETS) *~
+--- benchmarks/performance.cc.orig 2008-04-22 10:24:38.604894867 +0000
++++ benchmarks/performance.cc 2008-04-22 10:26:57.436806446 +0000
+@@ -19,9 +19,6 @@
+
+ //uncomment lines below to benchmark the libraries
+
+-#define JNEURAL
+-#define LWNN
+-
+ #include <stdio.h>
+ #include <stdlib.h>
+ #include <string.h>
+--- benchmarks/quality.cc.orig 2008-04-22 10:59:27.814171235 +0000
++++ benchmarks/quality.cc 2008-04-22 10:59:39.570841209 +0000
+@@ -19,9 +19,6 @@
+
+ //uncomment lines below to benchmark the libraries
+
+-#define JNEURAL
+-#define LWNN
+-
+ #include <stdio.h>
+ #include <stdlib.h>
+ #include <string.h>
diff --git a/sci-mathematics/fann/files/fann-2.1.0_beta-examples.patch b/sci-mathematics/fann/files/fann-2.1.0_beta-examples.patch
new file mode 100644
index 000000000000..45bfdd02b384
--- /dev/null
+++ b/sci-mathematics/fann/files/fann-2.1.0_beta-examples.patch
@@ -0,0 +1,23 @@
+--- examples/Makefile.orig 2008-04-22 10:15:42.500625020 +0000
++++ examples/Makefile 2008-04-22 10:16:40.563933859 +0000
+@@ -1,18 +1,16 @@
+ # This makefile is on purpose not made with configure, to show how to use the library
+ # The make file requires that the fann library is installed (see ../README)
+
+-GCC=gcc
+-
+ TARGETS = xor_train xor_test xor_test_fixed simple_train steepness_train simple_test robot mushroom cascade_train scaling_test scaling_train
+ DEBUG_TARGETS = xor_train_debug xor_test_debug xor_test_fixed_debug cascade_train_debug
+
+ all: $(TARGETS)
+
+ %: %.c Makefile
+- $(GCC) -O3 $< -o $@ -lm -lfann
++ $(CC) $(CFLAGS) $< -o $@ -lm -lfann
+
+ %_fixed: %.c Makefile
+- $(GCC) -O3 -DFIXEDFANN $< -o $@ -lm -lfixedfann
++ $(CC) $(CFLAGS) -DFIXEDFANN $< -o $@ -lm -lfixedfann
+
+ clean:
+ rm -f $(TARGETS) $(DEBUG_TARGETS) xor_fixed.data *.net *~ *.obj *.exe *.tds noscale.txt withscale.txt scale_test_results.txt
diff --git a/sci-mathematics/fann/files/fann-2.1.0_beta-python.patch b/sci-mathematics/fann/files/fann-2.1.0_beta-python.patch
new file mode 100644
index 000000000000..6c6a68201b59
--- /dev/null
+++ b/sci-mathematics/fann/files/fann-2.1.0_beta-python.patch
@@ -0,0 +1,20 @@
+--- python/setup.py.orig 2008-04-22 10:11:05.284827392 +0000
++++ python/setup.py 2008-04-22 10:13:21.668599460 +0000
+@@ -9,7 +9,7 @@
+ import os
+
+ NAME='pyfann'
+-VERSION='2.0.0'
++VERSION='2.1.0'
+
+ LONG_DESCRIPTION="""\
+ Fast Artificial Neural Network Library implements multilayer
+@@ -42,7 +42,7 @@
+ py_modules=['pyfann.libfann'],
+ ext_modules=[Extension('pyfann._libfann',['pyfann/pyfann_wrap.cxx'],
+ include_dirs=['../src/include'],
+- extra_objects=['../src/doublefann.o'],
++ extra_objects=['../src/.libs/doublefann.o'],
+ define_macros=[("SWIG_COMPILE",None)]
+ ),
+ ]
diff --git a/sci-mathematics/fann/files/fann-2.1.0_beta-pythonlink.patch b/sci-mathematics/fann/files/fann-2.1.0_beta-pythonlink.patch
new file mode 100644
index 000000000000..308a21e0bd4a
--- /dev/null
+++ b/sci-mathematics/fann/files/fann-2.1.0_beta-pythonlink.patch
@@ -0,0 +1,30 @@
+From: Christian Kastner <debian@kvr.at>
+Date: Fri, 4 Jun 2010 23:27:24 +0200
+Subject: [PATCH] Link python-pyfann dynamically instead of statically
+
+Upstream links the pyfann extension against libfann's static library. This
+causes all sorts of troubles on some platforms, most notably amd64, where the
+extension FTBFS because the static library isn't compiled with -fPIC. The
+Debian-specific solution presented here is to link to the shared library and
+let package python-pyfann Depend: on it.
+
+Forwarded: no
+Last-Update: 2010-06-04
+---
+ python/setup.py | 2 +-
+ 1 files changed, 1 insertions(+), 1 deletions(-)
+
+diff --git a/python/setup.py b/python/setup.py
+index 67cef7e..6b2a3dc 100755
+--- a/python/setup.py
++++ b/python/setup.py
+@@ -42,7 +42,7 @@ setup(
+ py_modules=['pyfann.libfann'],
+ ext_modules=[Extension('pyfann._libfann',['pyfann/pyfann_wrap.cxx'],
+ include_dirs=['../src/include'],
+- extra_objects=['../src/doublefann.o'],
++ extra_objects=['../src/.libs/doublefann.o'],
+ define_macros=[("SWIG_COMPILE",None)]
+ ),
+ ]
+--
diff --git a/sci-mathematics/fann/files/fann-2.1.0_beta-sizecheck.patch b/sci-mathematics/fann/files/fann-2.1.0_beta-sizecheck.patch
new file mode 100644
index 000000000000..885db95b04f6
--- /dev/null
+++ b/sci-mathematics/fann/files/fann-2.1.0_beta-sizecheck.patch
@@ -0,0 +1,25 @@
+From: Christian Kastner <debian@kvr.at>
+Date: Sun, 6 Feb 2011 17:09:05 +0100
+Subject: [PATCH] Correct a typo in a size comparison
+
+Origin: http://leenissen.dk/fann/forum/viewtopic.php?f=1&t=626
+Bug-Ubuntu: https://bugs.launchpad.net/bugs/712290
+Last-Update: 2011-02-06
+---
+ python/pyfann/pyfann.i | 2 +-
+ 1 files changed, 1 insertions(+), 1 deletions(-)
+
+diff --git a/python/pyfann/pyfann.i b/python/pyfann/pyfann.i
+index 47b17ba..ec55535 100644
+--- a/python/pyfann/pyfann.i
++++ b/python/pyfann/pyfann.i
+@@ -108,7 +108,7 @@
+ for (j = 0; j< num; j++)
+ {
+ PyObject* o1=PySequence_GetItem($input,j);
+- if ((unsigned int)PySequence_Length(o1) == dim) {
++ if ((unsigned int)PySequence_Length(o1) != dim) {
+ PyErr_SetString(PyExc_ValueError,"Size mismatch. All items must be of the same size");
+ SWIG_fail;
+ }
+--
diff --git a/sci-mathematics/fann/files/fann-2.1.0_beta-valist.patch b/sci-mathematics/fann/files/fann-2.1.0_beta-valist.patch
new file mode 100644
index 000000000000..23d130f60650
--- /dev/null
+++ b/sci-mathematics/fann/files/fann-2.1.0_beta-valist.patch
@@ -0,0 +1,65 @@
+From: Christian Kastner <debian@kvr.at>
+Date: Thu, 1 Jul 2010 01:02:47 +0200
+Subject: [PATCH] Portable handling for va_list
+
+The current code wrongly assumes va_list is always implemented as an array. va_list
+however is an opaque type, and may also be implemented as a struct, for
+example. This patch implements handling of va_list in a platform-independent
+way, fixing a FTBFS on alpha and armel.
+
+Forwarded: no
+Last-Update: 2010-07-01
+---
+ src/include/fann_cpp.h | 21 +++++++++++++++------
+ 1 files changed, 15 insertions(+), 6 deletions(-)
+
+diff --git a/src/include/fann_cpp.h b/src/include/fann_cpp.h
+index eb647af..bf6e75b 100644
+--- a/src/include/fann_cpp.h
++++ b/src/include/fann_cpp.h
+@@ -916,9 +916,12 @@ public:
+ bool create_standard(unsigned int num_layers, ...)
+ {
+ va_list layers;
++ unsigned int arr[num_layers];
++
+ va_start(layers, num_layers);
+- bool status = create_standard_array(num_layers,
+- reinterpret_cast<const unsigned int *>(layers));
++ for (unsigned int ii = 0; ii < num_layers; ii++)
++ arr[ii] = va_arg(layers, unsigned int);
++ bool status = create_standard_array(num_layers, arr);
+ va_end(layers);
+ return status;
+ }
+@@ -966,9 +969,12 @@ public:
+ bool create_sparse(float connection_rate, unsigned int num_layers, ...)
+ {
+ va_list layers;
++ unsigned int arr[num_layers];
++
+ va_start(layers, num_layers);
+- bool status = create_sparse_array(connection_rate, num_layers,
+- reinterpret_cast<const unsigned int *>(layers));
++ for (unsigned int ii = 0; ii < num_layers; ii++)
++ arr[ii] = va_arg(layers, unsigned int);
++ bool status = create_sparse_array(connection_rate, num_layers, arr);
+ va_end(layers);
+ return status;
+ }
+@@ -1013,9 +1019,12 @@ public:
+ bool create_shortcut(unsigned int num_layers, ...)
+ {
+ va_list layers;
++ unsigned int arr[num_layers];
++
+ va_start(layers, num_layers);
+- bool status = create_shortcut_array(num_layers,
+- reinterpret_cast<const unsigned int *>(layers));
++ for (unsigned int ii = 0; ii < num_layers; ii++)
++ arr[ii] = va_arg(layers, unsigned int);
++ bool status = create_shortcut_array(num_layers, arr);
+ va_end(layers);
+ return status;
+ }
+--
diff --git a/sci-mathematics/fann/files/fann-2.2.0-examples.patch b/sci-mathematics/fann/files/fann-2.2.0-examples.patch
new file mode 100644
index 000000000000..bfab17022187
--- /dev/null
+++ b/sci-mathematics/fann/files/fann-2.2.0-examples.patch
@@ -0,0 +1,23 @@
+--- examples/Makefile.orig 2012-01-24 05:31:40.000000000 +0000
++++ examples/Makefile 2012-05-08 19:00:08.000000000 +0100
+@@ -1,7 +1,6 @@
+ # This makefile is on purpose not made with configure, to show how to use the library
+ # The make file requires that the fann library is installed (see ../README)
+
+-GCC=gcc
+
+ TARGETS = xor_train xor_test xor_test_fixed simple_train steepness_train simple_test robot mushroom cascade_train scaling_test scaling_train
+ DEBUG_TARGETS = xor_train_debug xor_test_debug xor_test_fixed_debug cascade_train_debug
+@@ -9,10 +8,10 @@
+ all: $(TARGETS)
+
+ %: %.c Makefile
+- $(GCC) -O3 $< -o $@ -lfann -lm
++ $(CC) $(CFLAGS) $< -lfann -lm -o $@
+
+ %_fixed: %.c Makefile
+- $(GCC) -O3 -DFIXEDFANN $< -o $@ -lfixedfann -lm
++ $(CC) $(CFLAGS) -DFIXEDFANN $< -lfixedfann -lm -o $@
+
+ clean:
+ rm -f $(TARGETS) $(DEBUG_TARGETS) xor_fixed.data *.net *~ *.obj *.exe *.tds noscale.txt withscale.txt scale_test_results.txt
diff --git a/sci-mathematics/fann/metadata.xml b/sci-mathematics/fann/metadata.xml
new file mode 100644
index 000000000000..dd80fbec92e6
--- /dev/null
+++ b/sci-mathematics/fann/metadata.xml
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <herd>sci-mathematics</herd>
+ <longdescription lang="en">
+ Fast Artificial Neural Network Library implements multilayer artificial
+ neural networks in C with support for both fully connected and sparsely
+ connected networks. Cross-platform execution in both fixed and floating
+ point are supported. It includes a framework for easy handling of
+ training data sets. It is easy to use, versatile, well documented, and
+ fast. Delphi, PHP, Python and other bindings are available.
+ </longdescription>
+ <upstream>
+ <remote-id type="sourceforge">fann</remote-id>
+ </upstream>
+</pkgmetadata>
diff --git a/sci-mathematics/flint/Manifest b/sci-mathematics/flint/Manifest
new file mode 100644
index 000000000000..959bebfbf324
--- /dev/null
+++ b/sci-mathematics/flint/Manifest
@@ -0,0 +1,4 @@
+DIST flint-2.3.tar.gz 830837 SHA256 6bb059048f822dc9291567949f1baed8c77f337ff2601e91a8e9d20936291a75 SHA512 8b5cb41ef9616c984554f7085dcd914d8d91b0f8b3964939c740336e79cfcc6e81fc9135084845615f56429952a4fc0eb3960c6df13d5f779c997c3b53763e56 WHIRLPOOL 12ee4c4e6efadbe2913783fcfe7583f084c6c10777e04293de6748cf177423f7652e5cd8bcdd0f412be73a40f4c5fc744a84c0de89f6c1ff527c20e55e102258
+DIST flint-2.4.3.tar.gz 1636527 SHA256 93585cd321c5a2fad053c903ba7cd947f54de71d31cf1dd1af6814906c1ee763 SHA512 d7cecb7116c458f554e09524b9df25784ed32f889a4d83a3fc6fbf16f08ace68890b3a748a8b1b03e543c121994ed7e5efbdca9e7dbb694a4571c8d25e983aa9 WHIRLPOOL 4ec1ce3447218c9a45a9548284b7948714327bf264e9087d7c0687936a586cb96eb921079770d78c482af158ca78c65193ccbf489a789771ae527eed4d75d588
+DIST flint-2.4.4.tar.gz 1639262 SHA256 c4799e9394ef06d7b8625f7fd74ba2d8ca115dbb2aa506dcc6e369b49d0e5bc7 SHA512 236997cf64bdc96741740889f450fdbaf7d7e9b58252645f864d28005c9e7bdf87f7187cd17526606c605f0489f026398a1361b8f209f71158ca3b31c42d86d2 WHIRLPOOL 299820bc656e955d54dd06be3a1ba68440e8d9c72785ac54e7d9559da073b31c07b73598c9b18c98889f836dfd25ed8cd96d62a901a12a529698ae00ba30f1d1
+DIST flint-2.4.5.tar.gz 1640022 SHA256 e489354df00f0d84976ccdd0477028693977c87ccd14f3924a89f848bb0e01e3 SHA512 088ff512ea2330f9323a6ca0dc875e8c0926d755317d6007eba4b333a14d7612e82ebcfeabd26d1ec4b9204c4517dee08f914ad1ec852e37336fe378710a8bfc WHIRLPOOL cf5a22a9353cc23f1ab056cf6737d61d8de91ab0dc0c4a2ae46cf0777abee240a49f76de15bf854a8275023735101ce306789bca9a052151b09017e02d111069
diff --git a/sci-mathematics/flint/files/flint-2.4.3-cflags-ldflags.patch b/sci-mathematics/flint/files/flint-2.4.3-cflags-ldflags.patch
new file mode 100644
index 000000000000..f0a2ec8531b0
--- /dev/null
+++ b/sci-mathematics/flint/files/flint-2.4.3-cflags-ldflags.patch
@@ -0,0 +1,33 @@
+commit afadc8d05674a0e3e2fcf6dfbcf5f3c8f9133119
+Author: hasufell <hasufell@hasufell.de>
+Date: Sun May 18 19:32:59 2014 +0200
+
+ Respect CFLAGS/CXXFLAGS/LDFLAGS, fixes #66
+
+ Even in linking command CFLAGS should be respected, no matter
+ if all objects have already been compiled or not. Some flags
+ affect both linking and object compilation and users shouldn't
+ be required to figure them out. This is standard in most build
+ systems anyway.
+
+ Reorderd the linker line a bit, so it matches common practice,
+ although this doesn't matter technically (except that LDFLAGS
+ must go before libraries we link against).
+
+diff --git a/Makefile.in b/Makefile.in
+index a522ac1..6dda689 100644
+--- a/Makefile.in
++++ b/Makefile.in
+@@ -104,10 +104,10 @@ $(FLINT_LIB): $(LOBJS) $(LIB_SOURCES) $(EXT_SOURCES) $(HEADERS) $(EXT_HEADERS) |
+ $(AT)$(foreach dir, $(BUILD_DIRS), mkdir -p build/$(dir); BUILD_DIR=../build/$(dir); export BUILD_DIR; MOD_DIR=$(dir); export MOD_DIR; $(MAKE) -f ../Makefile.subdirs -C $(dir) shared || exit $$?;)
+ $(AT)if [ "$(WANT_NTL)" -eq "1" ]; then \
+ $(MAKE) build/interfaces/NTL-interface.lo; \
+- $(CXX) $(ABI_FLAG) -shared $(EXTRA_SHARED_FLAGS) build/interfaces/NTL-interface.lo $(LOBJS) $(MOD_LOBJS) $(EXT_OBJS) $(LIBS2) -o $(FLINT_LIB); \
++ $(CXX) $(CXXFLAGS) $(ABI_FLAG) -shared $(EXTRA_SHARED_FLAGS) build/interfaces/NTL-interface.lo $(LOBJS) $(MOD_LOBJS) $(EXT_OBJS) -o $(FLINT_LIB) $(LDFLAGS) $(LIBS2); \
+ fi
+ $(AT)if [ "$(WANT_NTL)" -ne "1" ]; then \
+- $(CC) $(ABI_FLAG) -shared $(EXTRA_SHARED_FLAGS) $(LOBJS) $(MOD_LOBJS) $(EXT_OBJS) $(LIBS2) -o $(FLINT_LIB); \
++ $(CC) $(CFLAGS) $(ABI_FLAG) -shared $(EXTRA_SHARED_FLAGS) $(LOBJS) $(MOD_LOBJS) $(EXT_OBJS) -o $(FLINT_LIB) $(LDFLAGS) $(LIBS2); \
+ fi
+
+ libflint.a: $(OBJS) $(LIB_SOURCES) $(EXT_SOURCES) $(HEADERS) $(EXT_HEADERS) | build build/interfaces
diff --git a/sci-mathematics/flint/files/flint-2.4.3-libdir.patch b/sci-mathematics/flint/files/flint-2.4.3-libdir.patch
new file mode 100644
index 000000000000..a569be40b8b8
--- /dev/null
+++ b/sci-mathematics/flint/files/flint-2.4.3-libdir.patch
@@ -0,0 +1,44 @@
+From 27eb23c1844029ee64907500bd8aa87097ffcd32 Mon Sep 17 00:00:00 2001
+From: hasufell <hasufell@hasufell.de>
+Date: Sun, 18 May 2014 18:46:24 +0200
+Subject: [PATCH] Allow to control LIBDIR
+
+Some distributions have lib32/lib64 and need to control
+the destination properly.
+---
+ Makefile.in | 8 +++++---
+ 1 file changed, 5 insertions(+), 3 deletions(-)
+
+diff --git a/Makefile.in b/Makefile.in
+index c16f838..b6ea4c9 100644
+--- a/Makefile.in
++++ b/Makefile.in
+@@ -4,6 +4,8 @@ else
+ $(DLPATH):=$(DLPATH_ADD)
+ endif
+
++LIBDIR=lib
++
+ QUIET_CC = @echo ' ' CC ' ' $@;
+ QUIET_CXX = @echo ' ' CXX ' ' $@;
+ QUIET_AR = @echo ' ' AR ' ' $@;
+@@ -169,13 +171,13 @@ else
+ endif
+
+ install: library
+- mkdir -p $(DESTDIR)$(PREFIX)/lib
++ mkdir -p $(DESTDIR)$(PREFIX)/$(LIBDIR)
+ mkdir -p $(DESTDIR)$(PREFIX)/include/flint
+ $(AT)if [ "$(FLINT_SHARED)" -eq "1" ]; then \
+- cp $(FLINT_LIB) $(DESTDIR)$(PREFIX)/lib; \
++ cp $(FLINT_LIB) $(DESTDIR)$(PREFIX)/$(LIBDIR); \
+ fi
+ $(AT)if [ "$(FLINT_STATIC)" -eq "1" ]; then \
+- cp libflint.a $(DESTDIR)$(PREFIX)/lib; \
++ cp libflint.a $(DESTDIR)$(PREFIX)/$(LIBDIR); \
+ fi
+ cp $(HEADERS) $(DESTDIR)$(PREFIX)/include/flint
+ $(AT)if [ ! -z $(EXT_HEADERS) ]; then \
+--
+1.9.3
+
diff --git a/sci-mathematics/flint/files/flint-2.4.3-whitespaces.patch b/sci-mathematics/flint/files/flint-2.4.3-whitespaces.patch
new file mode 100644
index 000000000000..3d63aedeab3c
--- /dev/null
+++ b/sci-mathematics/flint/files/flint-2.4.3-whitespaces.patch
@@ -0,0 +1,54 @@
+From 3506d617ef9dfc5184aa99be05a25e4f73d6c3f6 Mon Sep 17 00:00:00 2001
+From: hasufell <hasufell@hasufell.de>
+Date: Sun, 18 May 2014 18:47:27 +0200
+Subject: [PATCH] Quote variables that could contain whitespaces
+
+Make does NOT take care of this in this context. It's
+not a variable assignment and installation would fail
+if DESTDIR contains any whitespace.
+---
+ Makefile.in | 22 +++++++++++-----------
+ 1 file changed, 11 insertions(+), 11 deletions(-)
+
+diff --git a/Makefile.in b/Makefile.in
+index b6ea4c9..a522ac1 100644
+--- a/Makefile.in
++++ b/Makefile.in
+@@ -171,23 +171,23 @@ else
+ endif
+
+ install: library
+- mkdir -p $(DESTDIR)$(PREFIX)/$(LIBDIR)
+- mkdir -p $(DESTDIR)$(PREFIX)/include/flint
++ mkdir -p "$(DESTDIR)$(PREFIX)/$(LIBDIR)"
++ mkdir -p "$(DESTDIR)$(PREFIX)/include/flint"
+ $(AT)if [ "$(FLINT_SHARED)" -eq "1" ]; then \
+- cp $(FLINT_LIB) $(DESTDIR)$(PREFIX)/$(LIBDIR); \
++ cp $(FLINT_LIB) "$(DESTDIR)$(PREFIX)/$(LIBDIR)"; \
+ fi
+ $(AT)if [ "$(FLINT_STATIC)" -eq "1" ]; then \
+- cp libflint.a $(DESTDIR)$(PREFIX)/$(LIBDIR); \
++ cp libflint.a "$(DESTDIR)$(PREFIX)/$(LIBDIR)"; \
+ fi
+- cp $(HEADERS) $(DESTDIR)$(PREFIX)/include/flint
++ cp $(HEADERS) "$(DESTDIR)$(PREFIX)/include/flint"
+ $(AT)if [ ! -z $(EXT_HEADERS) ]; then \
+- cp $(EXT_HEADERS) $(DESTDIR)$(PREFIX)/include/flint; \
++ cp $(EXT_HEADERS) "$(DESTDIR)$(PREFIX)/include/flint"; \
+ fi
+- mkdir -p $(DESTDIR)$(FLINT_CPIMPORT_DIR)
+- cp qadic/CPimport.txt $(DESTDIR)$(FLINT_CPIMPORT_DIR)
+- mkdir -p $(DESTDIR)$(PREFIX)/include/flint/flintxx
+- cp flintxx/*.h $(DESTDIR)$(PREFIX)/include/flint/flintxx
+- cp *xx.h $(DESTDIR)$(PREFIX)/include/flint
++ mkdir -p "$(DESTDIR)$(FLINT_CPIMPORT_DIR)"
++ cp qadic/CPimport.txt "$(DESTDIR)$(FLINT_CPIMPORT_DIR)"
++ mkdir -p "$(DESTDIR)$(PREFIX)/include/flint/flintxx"
++ cp flintxx/*.h "$(DESTDIR)$(PREFIX)/include/flint/flintxx"
++ cp *xx.h "$(DESTDIR)$(PREFIX)/include/flint"
+
+ build:
+ mkdir -p build
+--
+1.9.3
+
diff --git a/sci-mathematics/flint/files/flint-2.4.4-test.patch b/sci-mathematics/flint/files/flint-2.4.4-test.patch
new file mode 100644
index 000000000000..11b7cfe21115
--- /dev/null
+++ b/sci-mathematics/flint/files/flint-2.4.4-test.patch
@@ -0,0 +1,19 @@
+commit 5e3d4a0504158f70d227e7cfc03985fe9a646797
+Author: hasufell <hasufell@hasufell.de>
+Date: Wed Jul 2 12:58:50 2014 +0200
+
+ Fix NTL test build
+
+diff --git a/Makefile.in b/Makefile.in
+index 6dda689..e9de7da 100644
+--- a/Makefile.in
++++ b/Makefile.in
+@@ -214,7 +214,7 @@ build/interfaces/NTL-interface.o: interfaces/NTL-interface.cpp NTL-interface.h
+ $(QUIET_CXX) $(CXX) $(CFLAGS) $(INCS) -c $< -o $@;
+
+ build/interfaces/test/t-NTL-interface$(EXEEXT): interfaces/test/t-NTL-interface.cpp
+- $(QUIET_CXX) $(CXX) $(CFLAGS) $(INCS) $< build/interfaces/NTL-interface.o -o $@ $(LIBS);
++ $(QUIET_CXX) $(CXX) $(CFLAGS) $(INCS) $< build/interfaces/NTL-interface.lo -o $@ $(LIBS);
+
+ print-%:
+ @echo '$*=$($*)'
diff --git a/sci-mathematics/flint/files/flint-2.4.5-gmp6-compat.patch b/sci-mathematics/flint/files/flint-2.4.5-gmp6-compat.patch
new file mode 100644
index 000000000000..559cbe51fb28
--- /dev/null
+++ b/sci-mathematics/flint/files/flint-2.4.5-gmp6-compat.patch
@@ -0,0 +1,115 @@
+From a7f911140e7d0a0125653a40aa2c5fe257bd78f5 Mon Sep 17 00:00:00 2001
+From: Fredrik Johansson <fredrik.johansson@gmail.com>
+Date: Thu, 18 Sep 2014 14:49:05 +0200
+Subject: [PATCH] redefine fmpz_invmod to consider any integer invertible mod 1
+ (for gmp 6.0 compatibility)
+
+---
+ fmpz/doc/fmpz.txt | 3 ++-
+ fmpz/invmod.c | 11 +++++++++--
+ fmpz/test/t-invmod.c | 21 +++++++++++++++++----
+ 3 files changed, 28 insertions(+), 7 deletions(-)
+
+diff --git a/fmpz/doc/fmpz.txt b/fmpz/doc/fmpz.txt
+index fb422d8..2ada719 100644
+--- a/fmpz/doc/fmpz.txt
++++ b/fmpz/doc/fmpz.txt
+@@ -899,7 +899,8 @@ int fmpz_invmod(fmpz_t f, const fmpz_t g, const fmpz_t h)
+ Sets $f$ to the inverse of $g$ modulo $h$. The value of $h$ may
+ not be $0$ otherwise an exception results. If the inverse exists
+ the return value will be non-zero, otherwise the return value will
+- be $0$ and the value of $f$ undefined.
++ be $0$ and the value of $f$ undefined. As a special case, we
++ consider any number invertible modulo $h = \pm 1$, with inverse 0.
+
+ void fmpz_negmod(fmpz_t f, const fmpz_t g, const fmpz_t h)
+
+diff --git a/fmpz/invmod.c b/fmpz/invmod.c
+index a0cf601..0e20f39 100644
+--- a/fmpz/invmod.c
++++ b/fmpz/invmod.c
+@@ -67,7 +67,11 @@ fmpz_invmod(fmpz_t f, const fmpz_t g, const fmpz_t h)
+ if (c2 < WORD(0))
+ c2 = -c2;
+ if (c2 == WORD(1))
+- return 0; /* special case not handled by n_invmod */
++ {
++ fmpz_zero(f);
++ return 1; /* special case not handled by n_invmod */
++ }
++
+ gcd = z_gcdinv(&inv, c1, c2);
+
+ return (gcd == UWORD(1) ? fmpz_set_si(f, inv), 1 : 0);
+@@ -106,7 +110,10 @@ fmpz_invmod(fmpz_t f, const fmpz_t g, const fmpz_t h)
+ if (c2 < WORD(0))
+ c2 = -c2;
+ if (c2 == WORD(1))
+- return 0; /* special case not handled by z_gcd_invert */
++ {
++ fmpz_zero(f);
++ return 1; /* special case not handled by z_gcd_invert */
++ }
+ /* reduce g mod h first */
+
+ r = flint_mpz_fdiv_ui(COEFF_TO_PTR(c1), c2);
+diff --git a/fmpz/test/t-invmod.c b/fmpz/test/t-invmod.c
+index aea236e..8ff1c7f 100644
+--- a/fmpz/test/t-invmod.c
++++ b/fmpz/test/t-invmod.c
+@@ -30,6 +30,19 @@
+ #include "ulong_extras.h"
+ #include "fmpz.h"
+
++/* Use the definiton of GMP versions >= 6.0 */
++int
++mpz_invert2(mpz_t a, const mpz_t b, const mpz_t c)
++{
++ if (mpz_cmpabs_ui(c, 1) == 0)
++ {
++ mpz_set_ui(a, 0);
++ return 1;
++ }
++ else
++ return mpz_invert(a, b, c);
++}
++
+ int
+ main(void)
+ {
+@@ -63,7 +76,7 @@ main(void)
+ fmpz_get_mpz(e, b);
+
+ r1 = fmpz_invmod(c, a, b);
+- r2 = mpz_invert(f, d, e);
++ r2 = mpz_invert2(f, d, e);
+
+ fmpz_get_mpz(g, c);
+
+@@ -106,7 +119,7 @@ main(void)
+ fmpz_get_mpz(d, a);
+
+ r1 = fmpz_invmod(c, a, a);
+- r2 = mpz_invert(f, d, d);
++ r2 = mpz_invert2(f, d, d);
+
+ fmpz_get_mpz(g, c);
+
+@@ -149,7 +162,7 @@ main(void)
+ fmpz_get_mpz(e, b);
+
+ r1 = fmpz_invmod(a, a, b);
+- r2 = mpz_invert(f, d, e);
++ r2 = mpz_invert2(f, d, e);
+
+ fmpz_get_mpz(g, a);
+
+@@ -192,7 +205,7 @@ main(void)
+ fmpz_get_mpz(e, b);
+
+ r1 = fmpz_invmod(b, a, b);
+- r2 = mpz_invert(f, d, e);
++ r2 = mpz_invert2(f, d, e);
+
+ fmpz_get_mpz(g, b);
+
diff --git a/sci-mathematics/flint/files/flint-2.4.5-ntl62.patch b/sci-mathematics/flint/files/flint-2.4.5-ntl62.patch
new file mode 100644
index 000000000000..e08fa774e298
--- /dev/null
+++ b/sci-mathematics/flint/files/flint-2.4.5-ntl62.patch
@@ -0,0 +1,13 @@
+diff -druN flint-2.5.orig/interfaces/NTL-interface.cpp flint-2.5/interfaces/NTL-interface.cpp
+--- flint-2.5.orig/interfaces/NTL-interface.cpp 2014-07-16 07:50:40.000000000 -0700
++++ flint-2.5/interfaces/NTL-interface.cpp 2014-08-26 07:51:55.585884615 -0700
+@@ -32,9 +32,7 @@
+ #include <NTL/ZZ.h>
+ #include <NTL/ZZX.h>
+ #include <NTL/mat_ZZ.h>
+-#include <NTL/lip.h>
+ #include <NTL/ctools.h>
+-#include <NTL/g_lip.h>
+ #include <gmp.h>
+
+ #include "flint.h"
diff --git a/sci-mathematics/flint/flint-2.3.ebuild b/sci-mathematics/flint/flint-2.3.ebuild
new file mode 100644
index 000000000000..92e95534745e
--- /dev/null
+++ b/sci-mathematics/flint/flint-2.3.ebuild
@@ -0,0 +1,33 @@
+# Copyright 1999-2013 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="5"
+
+inherit eutils multilib
+
+DESCRIPTION="Fast Library for Number Theory"
+HOMEPAGE="http://www.flintlib.org/"
+SRC_URI="http://www.flintlib.org/${P}.tar.gz"
+
+RESTRICT="mirror"
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE=""
+
+DEPEND="dev-libs/mpfr
+ dev-libs/ntl
+ sci-libs/mpir
+ "
+RDEPEND="${DEPEND}"
+
+src_prepare() {
+ # Correct lib paths to be multilib-proper #470732
+ sed -i -e 's~/lib~/'$(get_libdir)'~' Makefile.in || die
+}
+
+src_configure() {
+ # handwritten script, needs extra stabbing
+ ./configure --with-mpir=/usr --with-mpfr=/usr --with-ntl=/usr --prefix="${D}/usr" || die
+}
diff --git a/sci-mathematics/flint/flint-2.4.3.ebuild b/sci-mathematics/flint/flint-2.4.3.ebuild
new file mode 100644
index 000000000000..37a89b8a6ad8
--- /dev/null
+++ b/sci-mathematics/flint/flint-2.4.3.ebuild
@@ -0,0 +1,62 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="5"
+
+inherit eutils multilib toolchain-funcs
+
+DESCRIPTION="Fast Library for Number Theory"
+HOMEPAGE="http://www.flintlib.org/"
+SRC_URI="http://www.flintlib.org/${P}.tar.gz"
+
+RESTRICT="mirror"
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE="doc gc ntl static-libs test"
+
+RDEPEND="dev-libs/gmp
+ dev-libs/mpfr
+ gc? ( dev-libs/boehm-gc )
+ ntl? ( dev-libs/ntl )"
+DEPEND="${RDEPEND}
+ doc? ( app-text/texlive-core )"
+
+src_prepare() {
+ epatch "${FILESDIR}"/${PN}-2.4.3-libdir.patch \
+ "${FILESDIR}"/${PN}-2.4.3-whitespaces.patch \
+ "${FILESDIR}"/${PN}-2.4.3-cflags-ldflags.patch
+}
+
+src_configure() {
+ ./configure \
+ --prefix="${EPREFIX}/usr" \
+ --with-gmp="${EPREFIX}/usr" \
+ --with-mpfr="${EPREFIX}/usr" \
+ $(usex ntl "--with-ntl=${EPREFIX}/usr" "") \
+ $(use_enable static-libs static) \
+ $(usex gc "--with-gc=${EPREFIX}/usr" "") \
+ CC=$(tc-getCC) \
+ CXX=$(tc-getCXX) \
+ AR=$(tc-getAR) \
+ || die
+}
+
+src_compile() {
+ emake verbose
+
+ if use doc ; then
+ emake -C doc/latex
+ fi
+}
+
+src_test() {
+ emake AT= QUIET_CC= QUIET_CXX= QUIET_AR= check
+}
+
+src_install() {
+ emake DESTDIR="${D}" LIBDIR="$(get_libdir)" install
+ einstalldocs
+ use doc && dodoc doc/latex/flint-manual.pdf
+}
diff --git a/sci-mathematics/flint/flint-2.4.4-r1.ebuild b/sci-mathematics/flint/flint-2.4.4-r1.ebuild
new file mode 100644
index 000000000000..ebd73600599e
--- /dev/null
+++ b/sci-mathematics/flint/flint-2.4.4-r1.ebuild
@@ -0,0 +1,67 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="5"
+
+inherit eutils multilib toolchain-funcs
+
+DESCRIPTION="Fast Library for Number Theory"
+HOMEPAGE="http://www.flintlib.org/"
+SRC_URI="http://www.flintlib.org/${P}.tar.gz"
+
+RESTRICT="mirror"
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="amd64 x86"
+IUSE="doc gc ntl static-libs test"
+
+RDEPEND="dev-libs/gmp
+ dev-libs/mpfr
+ gc? ( dev-libs/boehm-gc )
+ ntl? ( dev-libs/ntl )"
+DEPEND="${RDEPEND}
+ doc? (
+ app-text/texlive-core
+ dev-texlive/texlive-latex
+ dev-texlive/texlive-latexextra
+ )"
+
+src_prepare() {
+ epatch "${FILESDIR}"/${PN}-2.4.3-libdir.patch \
+ "${FILESDIR}"/${PN}-2.4.3-whitespaces.patch \
+ "${FILESDIR}"/${PN}-2.4.3-cflags-ldflags.patch \
+ "${FILESDIR}"/${PN}-2.4.4-test.patch
+}
+
+src_configure() {
+ ./configure \
+ --prefix="${EPREFIX}/usr" \
+ --with-gmp="${EPREFIX}/usr" \
+ --with-mpfr="${EPREFIX}/usr" \
+ $(usex ntl "--with-ntl=${EPREFIX}/usr" "") \
+ $(use_enable static-libs static) \
+ $(usex gc "--with-gc=${EPREFIX}/usr" "") \
+ CC=$(tc-getCC) \
+ CXX=$(tc-getCXX) \
+ AR=$(tc-getAR) \
+ || die
+}
+
+src_compile() {
+ emake verbose
+
+ if use doc ; then
+ emake -C doc/latex
+ fi
+}
+
+src_test() {
+ emake AT= QUIET_CC= QUIET_CXX= QUIET_AR= check
+}
+
+src_install() {
+ emake DESTDIR="${D}" LIBDIR="$(get_libdir)" install
+ einstalldocs
+ use doc && dodoc doc/latex/flint-manual.pdf
+}
diff --git a/sci-mathematics/flint/flint-2.4.5.ebuild b/sci-mathematics/flint/flint-2.4.5.ebuild
new file mode 100644
index 000000000000..a1da9e67987e
--- /dev/null
+++ b/sci-mathematics/flint/flint-2.4.5.ebuild
@@ -0,0 +1,69 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="5"
+
+inherit eutils multilib toolchain-funcs
+
+DESCRIPTION="Fast Library for Number Theory"
+HOMEPAGE="http://www.flintlib.org/"
+SRC_URI="http://www.flintlib.org/${P}.tar.gz"
+
+RESTRICT="mirror"
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE="doc gc ntl static-libs test"
+
+RDEPEND="dev-libs/gmp
+ dev-libs/mpfr
+ gc? ( dev-libs/boehm-gc )
+ ntl? ( dev-libs/ntl )"
+DEPEND="${RDEPEND}
+ doc? (
+ app-text/texlive-core
+ dev-texlive/texlive-latex
+ dev-texlive/texlive-latexextra
+ )"
+
+src_prepare() {
+ epatch "${FILESDIR}"/${PN}-2.4.3-libdir.patch \
+ "${FILESDIR}"/${PN}-2.4.3-whitespaces.patch \
+ "${FILESDIR}"/${PN}-2.4.3-cflags-ldflags.patch \
+ "${FILESDIR}"/${PN}-2.4.4-test.patch \
+ "${FILESDIR}"/${PN}-2.4.5-gmp6-compat.patch \
+ "${FILESDIR}"/${PN}-2.4.5-ntl62.patch
+}
+
+src_configure() {
+ ./configure \
+ --prefix="${EPREFIX}/usr" \
+ --with-gmp="${EPREFIX}/usr" \
+ --with-mpfr="${EPREFIX}/usr" \
+ $(usex ntl "--with-ntl=${EPREFIX}/usr" "") \
+ $(use_enable static-libs static) \
+ $(usex gc "--with-gc=${EPREFIX}/usr" "") \
+ CC=$(tc-getCC) \
+ CXX=$(tc-getCXX) \
+ AR=$(tc-getAR) \
+ || die
+}
+
+src_compile() {
+ emake verbose
+
+ if use doc ; then
+ emake -C doc/latex
+ fi
+}
+
+src_test() {
+ emake AT= QUIET_CC= QUIET_CXX= QUIET_AR= check
+}
+
+src_install() {
+ emake DESTDIR="${D}" LIBDIR="$(get_libdir)" install
+ einstalldocs
+ use doc && dodoc doc/latex/flint-manual.pdf
+}
diff --git a/sci-mathematics/flint/metadata.xml b/sci-mathematics/flint/metadata.xml
new file mode 100644
index 000000000000..98dccf28e26b
--- /dev/null
+++ b/sci-mathematics/flint/metadata.xml
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <maintainer>
+ <email>patrick@gentoo.org</email>
+ <name>Patrick Lauer</name>
+ </maintainer>
+ <upstream>
+ <remote-id type='github'>wbhart/flint2</remote-id>
+ </upstream>
+ <use>
+ <flag name='gc'>Enable garbage collection
+ support via <pkg>dev-libs/boehm-gc</pkg></flag>
+ <flag name='ntl'>Build NTL interface</flag>
+ </use>
+</pkgmetadata>
diff --git a/sci-mathematics/form/Manifest b/sci-mathematics/form/Manifest
new file mode 100644
index 000000000000..93a5895b3d2a
--- /dev/null
+++ b/sci-mathematics/form/Manifest
@@ -0,0 +1 @@
+DIST form-4.1.tar.gz 1260530 SHA256 fb3470937d66ed5cb1af896b15058836d2c805d767adac1b9073ed2df731cbe9 SHA512 39ab2fa1e448d6d5e427cc2c92285cc27f84724addffc378f3b799fc2b3f6381b8dceb87cb980062b980885d8d81591c5c7ff7b0dbeae7b6d9a3cf0b03d58aae WHIRLPOOL 1950ebc2357a78bf7430dd35852ab538e14b2ec68df8e9d11d7adcc31c365c14175c91bee984458794346a3b66b0580bea8625eeeff8c9c0f2045bab2bb1b5f8
diff --git a/sci-mathematics/form/form-4.1.ebuild b/sci-mathematics/form/form-4.1.ebuild
new file mode 100644
index 000000000000..b035f003dc69
--- /dev/null
+++ b/sci-mathematics/form/form-4.1.ebuild
@@ -0,0 +1,82 @@
+# Copyright 1999-2013 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+inherit autotools
+
+DESCRIPTION="Symbolic Manipulation System"
+HOMEPAGE="http://www.nikhef.nl/~form/"
+SRC_URI="http://www.nikhef.nl/~form/maindir/binaries/${P}.tar.gz"
+
+LICENSE="GPL-3"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE="devref doc doxygen gmp mpi threads zlib"
+
+RDEPEND="
+ gmp? ( dev-libs/gmp )
+ mpi? ( virtual/mpi )
+ zlib? ( sys-libs/zlib )"
+DEPEND="${RDEPEND}
+ devref? ( dev-texlive/texlive-latex )
+ doc? ( dev-texlive/texlive-latex )
+ doxygen? ( app-doc/doxygen )"
+
+src_prepare() {
+ sed -i 's/LINKFLAGS = -s/LINKFLAGS =/' sources/Makefile.am || die
+ eautoreconf
+}
+
+src_configure() {
+ econf \
+ --enable-scalar \
+ --enable-largefile \
+ --disable-debug \
+ --disable-static-link \
+ --with-api=posix \
+ $(use_with gmp ) \
+ $(use_enable mpi parform ) \
+ $(use_enable threads threaded ) \
+ $(use_with zlib ) \
+ CC="$(tc-getCC)" \
+ CXX="$(tc-getCXX)" \
+ CFLAGS="${CFLAGS}" \
+ LDFLAGS="${LDFLAGS}" \
+ CXXFLAGS="${CXXFLAGS}"
+}
+
+src_compile() {
+ default
+ if use devref; then
+ pushd doc/devref > /dev/null || die "doc/devref does not exist"
+ LANG=C emake pdf
+ popd > /dev/null
+ fi
+ if use doc; then
+ pushd doc/manual > /dev/null || die "doc/manual does not exist"
+ LANG=C emake pdf
+ popd > /dev/null
+ fi
+ if use doxygen; then
+ pushd doc/doxygen > /dev/null || die "doc/doxygen does not exist"
+ emake html
+ popd > /dev/null
+ fi
+}
+
+src_install() {
+ default
+ if use devref; then
+ insinto /usr/share/doc/${PF}
+ doins doc/devref/devref.pdf
+ fi
+ if use doc; then
+ insinto /usr/share/doc/${PF}
+ doins doc/manual/manual.pdf
+ fi
+ if use doxygen; then
+ dohtml -r doc/doxygen/html/*
+ fi
+}
diff --git a/sci-mathematics/form/metadata.xml b/sci-mathematics/form/metadata.xml
new file mode 100644
index 000000000000..05d73a9db6bb
--- /dev/null
+++ b/sci-mathematics/form/metadata.xml
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <herd>sci-mathematics</herd>
+ <longdescription lang="en">
+A system which can efficiently manipulate huge formulas limited only by available disk space.
+</longdescription>
+ <use>
+ <flag name="devref">Build and install developers reference</flag>
+ <flag name="doxygen">Build and install API documentation</flag>
+ </use>
+</pkgmetadata>
diff --git a/sci-mathematics/freemat/Manifest b/sci-mathematics/freemat/Manifest
new file mode 100644
index 000000000000..c794a4aef3a1
--- /dev/null
+++ b/sci-mathematics/freemat/Manifest
@@ -0,0 +1 @@
+DIST FreeMat-4.2-Source.tar.gz 106222549 SHA256 5f56dc18458da72fb8143d47faeb7a66fa104f8ac9160558e032f6d2d68c9ffb SHA512 85f56ab910358bac63bb50d9ef8fac51a486c32ffc246b47aea02fc6a629c36f0cd8d55feb755c4697530a87cf08fa8cc7b69ebde0f09535561014ea280b902a WHIRLPOOL 94b72375f451afd3da6bc756b9fa3e9a782edf8827a1b90f3d30723235df99c093ea7c4455b7d5cca1633f1d8d95302b237e0b389647ed242504626dd3f2c304
diff --git a/sci-mathematics/freemat/files/freemat-4.0-gcc45.patch b/sci-mathematics/freemat/files/freemat-4.0-gcc45.patch
new file mode 100644
index 000000000000..7492e16b783e
--- /dev/null
+++ b/sci-mathematics/freemat/files/freemat-4.0-gcc45.patch
@@ -0,0 +1,208 @@
+Fix building with gcc-4.5
+
+http://bugs.gentoo.org/show_bug.cgi?id=318045
+
+--- libs/libFreeMat/Array.cpp
++++ libs/libFreeMat/Array.cpp
+@@ -465,7 +465,7 @@
+
+ void Array::set(const QString& field, ArrayVector& data) {
+ if (isEmpty() && m_type.Class != Struct)
+- *this = Array::Array(Struct);
++ *this = Array(Struct);
+ if (m_type.Class != Struct) throw Exception("Unsupported type for A.field=B");
+ StructArray &rp(structPtr());
+ if (isEmpty())
+--- libs/libFreeMat/Math.cpp
++++ libs/libFreeMat/Math.cpp
+@@ -1590,9 +1590,9 @@
+
+ Array Not(const Array& A) {
+ if (A.isScalar())
+- return Array::Array(!A.toClass(Bool).constRealScalar<bool>());
++ return Array(!A.toClass(Bool).constRealScalar<bool>());
+ const Array &Abool(A.toClass(Bool));
+- return Array::Array(Apply(Abool.constReal<bool>(),notfunc));
++ return Array(Apply(Abool.constReal<bool>(),notfunc));
+ }
+
+ Array Plus(const Array& A) {
+--- libs/libFreeMat/Operators.hpp
++++ libs/libFreeMat/Operators.hpp
+@@ -142,11 +142,11 @@
+ if (!Bcast.isScalar()) Bcast = Bcast.asDenseArray();
+ if (Acast.isScalar() && Bcast.isScalar()) {
+ if (Acast.allReal() && Bcast.allReal()) {
+- F = Array::Array(Op::func(Acast.constRealScalar<T>(),
++ F = Array(Op::func(Acast.constRealScalar<T>(),
+ Bcast.constRealScalar<T>()));
+ } else {
+ Acast.forceComplex(); Bcast.forceComplex();
+- F = Array::Array(T(0),T(0));
++ F = Array(T(0),T(0));
+ Op::func(Acast.constRealScalar<T>(),
+ Acast.constImagScalar<T>(),
+ Bcast.constRealScalar<T>(),
+@@ -155,7 +155,7 @@
+ }
+ } else if (Acast.isScalar()) {
+ if (Acast.allReal() && Bcast.allReal()) {
+- F = Array::Array(Tclass,Bcast.dimensions());
++ F = Array(Tclass,Bcast.dimensions());
+ T* ret = F.real<T>().data();
+ const T& Ap = Acast.constRealScalar<T>();
+ const T* Bp = Bcast.constReal<T>().constData();
+@@ -163,7 +163,7 @@
+ for (uint64 i=0;i<q;i++) ret[i] = Op::func(Ap,Bp[i]);
+ } else {
+ Acast.forceComplex(); Bcast.forceComplex();
+- F = Array::Array(Tclass,Bcast.dimensions());
++ F = Array(Tclass,Bcast.dimensions());
+ T* Cr = F.real<T>().data();
+ T* Ci = F.imag<T>().data();
+ const T& Ar = Acast.constRealScalar<T>();
+@@ -175,7 +175,7 @@
+ }
+ } else if (Bcast.isScalar()) {
+ if (Bcast.allReal() && Acast.allReal()) {
+- F = Array::Array(Tclass,Acast.dimensions());
++ F = Array(Tclass,Acast.dimensions());
+ T* ret = F.real<T>().data();
+ const T* Ap = Acast.constReal<T>().constData();
+ const T& Bp = Bcast.constRealScalar<T>();
+@@ -183,7 +183,7 @@
+ for (uint64 i=0;i<q;i++) ret[i] = Op::func(Ap[i],Bp);
+ } else {
+ Acast.forceComplex(); Bcast.forceComplex();
+- F = Array::Array(Tclass,Acast.dimensions());
++ F = Array(Tclass,Acast.dimensions());
+ T* Cr = F.real<T>().data();
+ T* Ci = F.imag<T>().data();
+ const T* Ar = Acast.constReal<T>().constData();
+@@ -197,7 +197,7 @@
+ if (Acast.dimensions() != Bcast.dimensions())
+ throw Exception("size mismatch in arguments to binary operator");
+ if (Bcast.allReal() && Acast.allReal()) {
+- F = Array::Array(Tclass,Acast.dimensions());
++ F = Array(Tclass,Acast.dimensions());
+ T* ret = F.real<T>().data();
+ const T* Ap = Acast.constReal<T>().constData();
+ const T* Bp = Bcast.constReal<T>().constData();
+@@ -205,7 +205,7 @@
+ for (uint64 i=0;i<q;i++) ret[i] = Op::func(Ap[i],Bp[i]);
+ } else {
+ Acast.forceComplex(); Bcast.forceComplex();
+- F = Array::Array(Tclass,Acast.dimensions());
++ F = Array(Tclass,Acast.dimensions());
+ T* Cr = F.real<T>().data();
+ T* Ci = F.imag<T>().data();
+ const T* Ar = Acast.constReal<T>().constData();
+@@ -328,17 +328,17 @@
+ if (!Acast.isScalar()) Acast = Acast.asDenseArray();
+ if (!Bcast.isScalar()) Bcast = Bcast.asDenseArray();
+ if (Acast.isScalar() && Bcast.isScalar()) {
+- F = Array::Array(Op::func(Acast.constRealScalar<T>(),
++ F = Array(Op::func(Acast.constRealScalar<T>(),
+ Bcast.constRealScalar<T>()));
+ } else if (Acast.isScalar()) {
+- F = Array::Array(Bool,Bcast.dimensions());
++ F = Array(Bool,Bcast.dimensions());
+ bool* ret = F.real<bool>().data();
+ const T& Ap = Acast.constRealScalar<T>();
+ const T* Bp = Bcast.constReal<T>().constData();
+ uint64 q = uint64(Bcast.length());
+ for (uint64 i=0;i<q;i++) ret[i] = Op::func(Ap,Bp[i]);
+ } else if (Bcast.isScalar()) {
+- F = Array::Array(Bool,Acast.dimensions());
++ F = Array(Bool,Acast.dimensions());
+ bool* ret = F.real<bool>().data();
+ const T* Ap = Acast.constReal<T>().constData();
+ const T& Bp = Bcast.constRealScalar<T>();
+@@ -347,7 +347,7 @@
+ } else {
+ if (Acast.dimensions() != Bcast.dimensions())
+ throw Exception("size mismatch in arguments to binary operator");
+- F = Array::Array(Bool,Acast.dimensions());
++ F = Array(Bool,Acast.dimensions());
+ bool* ret = F.real<bool>().data();
+ const T* Ap = Acast.constReal<T>().constData();
+ const T* Bp = Bcast.constReal<T>().constData();
+@@ -395,18 +395,18 @@
+ if (!Bcast.isScalar()) Bcast = Bcast.asDenseArray();
+ if (Acast.isScalar() && Bcast.isScalar()) {
+ if (Acast.allReal() && Bcast.allReal()) {
+- F = Array::Array(Op::func(Acast.constRealScalar<T>(),
++ F = Array(Op::func(Acast.constRealScalar<T>(),
+ Bcast.constRealScalar<T>()));
+ } else {
+ Acast.forceComplex(); Bcast.forceComplex();
+- F = Array::Array(Op::func(Acast.constRealScalar<T>(),
++ F = Array(Op::func(Acast.constRealScalar<T>(),
+ Acast.constImagScalar<T>(),
+ Bcast.constRealScalar<T>(),
+ Bcast.constImagScalar<T>()));
+ }
+ } else if (Acast.isScalar()) {
+ if (Acast.allReal() && Bcast.allReal()) {
+- F = Array::Array(Bool,Bcast.dimensions());
++ F = Array(Bool,Bcast.dimensions());
+ bool* ret = F.real<bool>().data();
+ const T& Ap = Acast.constRealScalar<T>();
+ const T* Bp = Bcast.constReal<T>().constData();
+@@ -414,7 +414,7 @@
+ for (uint64 i=0;i<q;i++) ret[i] = Op::func(Ap,Bp[i]);
+ } else {
+ Acast.forceComplex(); Bcast.forceComplex();
+- F = Array::Array(Bool,Bcast.dimensions());
++ F = Array(Bool,Bcast.dimensions());
+ bool* ret = F.real<bool>().data();
+ const T& Ar = Acast.constRealScalar<T>();
+ const T& Ai = Acast.constImagScalar<T>();
+@@ -425,7 +425,7 @@
+ }
+ } else if (Bcast.isScalar()) {
+ if (Bcast.allReal() && Acast.allReal()) {
+- F = Array::Array(Bool,Acast.dimensions());
++ F = Array(Bool,Acast.dimensions());
+ bool* ret = F.real<bool>().data();
+ const T* Ap = Acast.constReal<T>().constData();
+ const T& Bp = Bcast.constRealScalar<T>();
+@@ -433,7 +433,7 @@
+ for (uint64 i=0;i<q;i++) ret[i] = Op::func(Ap[i],Bp);
+ } else {
+ Acast.forceComplex(); Bcast.forceComplex();
+- F = Array::Array(Bool,Acast.dimensions());
++ F = Array(Bool,Acast.dimensions());
+ bool* ret = F.real<bool>().data();
+ const T* Ar = Acast.constReal<T>().constData();
+ const T* Ai = Acast.constImag<T>().constData();
+@@ -446,7 +446,7 @@
+ if (Acast.dimensions() != Bcast.dimensions())
+ throw Exception("size mismatch in arguments to binary operator");
+ if (Bcast.allReal() && Acast.allReal()) {
+- F = Array::Array(Bool,Acast.dimensions());
++ F = Array(Bool,Acast.dimensions());
+ bool* ret = F.real<bool>().data();
+ const T* Ap = Acast.constReal<T>().constData();
+ const T* Bp = Bcast.constReal<T>().constData();
+@@ -454,7 +454,7 @@
+ for (uint64 i=0;i<q;i++) ret[i] = Op::func(Ap[i],Bp[i]);
+ } else {
+ Acast.forceComplex(); Bcast.forceComplex();
+- F = Array::Array(Bool,Acast.dimensions());
++ F = Array(Bool,Acast.dimensions());
+ bool* ret = F.real<bool>().data();
+ const T* Ar = Acast.constReal<T>().constData();
+ const T* Ai = Acast.constImag<T>().constData();
+@@ -533,9 +533,9 @@
+ if (!Acast.isScalar()) Acast = Acast.asDenseArray();
+ if (Acast.isScalar()) {
+ if (Acast.allReal()) {
+- F = Array::Array(Op::func(Acast.constRealScalar<T>()));
++ F = Array(Op::func(Acast.constRealScalar<T>()));
+ } else {
+- F = Array::Array(T(0),T(0));
++ F = Array(T(0),T(0));
+ Op::func(Acast.constRealScalar<T>(),
+ Acast.constImagScalar<T>(),
+ F.realScalar<T>(),F.imagScalar<T>());
diff --git a/sci-mathematics/freemat/files/freemat-4.0-no_implicit_GLU.patch b/sci-mathematics/freemat/files/freemat-4.0-no_implicit_GLU.patch
new file mode 100644
index 000000000000..dd3798bb8f6a
--- /dev/null
+++ b/sci-mathematics/freemat/files/freemat-4.0-no_implicit_GLU.patch
@@ -0,0 +1,14 @@
+error: 'gluProject' was not declared in this scope
+
+http://bugs.gentoo.org/402361
+
+--- libs/libGraphics/GLRenderEngine.cpp
++++ libs/libGraphics/GLRenderEngine.cpp
+@@ -20,6 +20,7 @@
+ #include <qimage.h>
+ #include <qpainter.h>
+ #include <QtOpenGL>
++#include <GL/glu.h>
+ #include <math.h>
+ #include "IEEEFP.hpp"
+
diff --git a/sci-mathematics/freemat/files/freemat-4.1-fixes.patch b/sci-mathematics/freemat/files/freemat-4.1-fixes.patch
new file mode 100644
index 000000000000..8ebb1bceb06f
--- /dev/null
+++ b/sci-mathematics/freemat/files/freemat-4.1-fixes.patch
@@ -0,0 +1,21 @@
+--- libs/libGraphics/VTKWindow.cpp.orig 2012-01-27 19:54:55.000000000 +0100
++++ libs/libGraphics/VTKWindow.cpp 2012-01-27 19:54:49.000000000 +0100
+@@ -3,6 +3,7 @@
+ #include "VTKWrap.hpp"
+ #include "VTKWindow.hpp"
+
++#include <QObject>
+ #include <QtCore/QString>
+ #include <QtGui/QLabel>
+ #include <QtGui/QMenu>
+--- libs/libGraphics/GLRenderEngine.cpp.orig 2011-11-27 00:27:43.000000000 +0000
++++ libs/libGraphics/GLRenderEngine.cpp 2012-01-29 03:57:48.453433954 +0000
+@@ -16,6 +16,8 @@
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
++
++#include <GL/glu.h>
+ #include "GLRenderEngine.hpp"
+ #include <qimage.h>
+ #include <qpainter.h>
diff --git a/sci-mathematics/freemat/files/freemat-4.1-have_fftw.patch b/sci-mathematics/freemat/files/freemat-4.1-have_fftw.patch
new file mode 100644
index 000000000000..1415b3d716aa
--- /dev/null
+++ b/sci-mathematics/freemat/files/freemat-4.1-have_fftw.patch
@@ -0,0 +1,78 @@
+diff -rupN libs/libCore.orig/FFT.cpp libs/libCore/FFT.cpp
+--- libs/libCore.orig/FFT.cpp 2011-11-27 01:27:43.856779929 +0100
++++ libs/libCore/FFT.cpp 2012-01-30 00:14:18.682460150 +0100
+@@ -104,6 +104,7 @@ public:
+ #endif
+
+
++#if HAVE_FFTWF
+ class OpVecFFT {
+ WrapFFTWF fft_float;
+ WrapFFTW fft_double;
+@@ -169,7 +170,9 @@ public:
+ }
+ }
+ };
++#endif
+
++#if HAVE_FFTWF
+ class OpVecIFFT {
+ WrapFFTWF fft_float;
+ WrapFFTW fft_double;
+@@ -228,6 +231,7 @@ public:
+ }
+ }
+ };
++#endif
+
+ //!
+ //@Module FFT (Inverse) Fast Fourier Transform Function
+@@ -350,6 +354,8 @@ public:
+ //inputs x len dim
+ //outputs y
+ //!
++
++#if HAVE_FFTWF
+ ArrayVector FFTFunction(int nargout, const ArrayVector& arg) {
+ // Get the data argument
+ if (arg.size() < 1)
+@@ -384,7 +390,9 @@ ArrayVector FFTFunction(int nargout, con
+ OpVecFFT op(FFTLength);
+ return ArrayVector(VectorOpDynamic<OpVecFFT>(arg0,FFTLength,FFTDim,op));
+ }
++#endif
+
++#if HAVE_FFTWF
+ ArrayVector IFFTFunction(int nargout, const ArrayVector& arg) {
+ // Get the data argument
+ if (arg.size() < 1)
+@@ -419,3 +427,4 @@ ArrayVector IFFTFunction(int nargout, co
+ OpVecIFFT op(FFTLength);
+ return ArrayVector(VectorOpDynamic<OpVecIFFT>(arg0,FFTLength,FFTDim,op));
+ }
++#endif
+diff -rupN libs/libCore.orig/Loader.cpp libs/libCore/Loader.cpp
+--- libs/libCore.orig/Loader.cpp 2012-01-30 00:08:41.463155562 +0100
++++ libs/libCore/Loader.cpp 2012-01-30 00:12:24.422448304 +0100
+@@ -43,8 +43,10 @@ ArrayVector FeofFunction(int, const Arra
+ ArrayVector FseekFunction(int, const ArrayVector&);
+ ArrayVector FgetlineFunction(int, const ArrayVector&);
+ ArrayVector FscanfFunction(int, const ArrayVector&);
++#ifdef HAVE_FFTW
+ ArrayVector FFTFunction(int, const ArrayVector&);
+ ArrayVector IFFTFunction(int, const ArrayVector&);
++#endif
+ ArrayVector StrCmpFunction(int, const ArrayVector&);
+ ArrayVector StrCmpiFunction(int, const ArrayVector&);
+ ArrayVector StrnCmpFunction(int, const ArrayVector&);
+@@ -286,8 +288,10 @@ void LoadBuiltinFunctionsCore(Context *c
+ context->addFunction("fseek",FseekFunction,0,3,0,"handle","offset","style",NULL);
+ context->addFunction("fgetline",FgetlineFunction,0,1,1,"handle",NULL);
+ context->addFunction("fscanf",FscanfFunction,0,-1,-1,NULL);
++#ifdef HAVE_FFTW
+ context->addFunction("fft",FFTFunction,0,3,1,"x","len","dim",NULL);
+ context->addFunction("ifft",IFFTFunction,0,3,1,"x","len","dim",NULL);
++#endif
+ context->addFunction("strcmp",StrCmpFunction,0,2,1,"string1","string2",NULL);
+ context->addFunction("strcmpi",StrCmpiFunction,0,2,1,"string1","string2",NULL);
+ context->addFunction("strncmp",StrnCmpFunction,0,3,1,"string1","string2","len",NULL);
diff --git a/sci-mathematics/freemat/files/freemat-4.1-local_libffi.patch b/sci-mathematics/freemat/files/freemat-4.1-local_libffi.patch
new file mode 100644
index 000000000000..3fbfef9c9516
--- /dev/null
+++ b/sci-mathematics/freemat/files/freemat-4.1-local_libffi.patch
@@ -0,0 +1,13 @@
+--- CMakeLists.txt.orig 2011-11-27 01:27:11.116482600 +0100
++++ CMakeLists.txt 2012-01-29 17:09:54.072342306 +0100
+@@ -160,8 +160,8 @@ if(MINGW)
+ INCLUDE_DIRECTORIES(${FFI_INCLUDE_DIR})
+ INSTALL(FILES ${FFI_LIBRARY_DLL} DESTINATION bin )
+ else(MINGW)
+- FIND_LIBRARY(FFI_LIBRARY NAMES ffi DOC "Location of the FFI library" PATHS ${LOCAL_PATH})
+- FIND_PATH(FFI_INCLUDE_DIR ffi.h doc "Location of ffi.h" PATHS ${LOCAL_PATH} /usr/include/ffi /usr/lib64/libffi-3.0.9/include)
++ FIND_LIBRARY(FFI_LIBRARY NAMES ffi DOC "Location of the FFI library" PATHS ${LOCAL_PATH} ${PROJECT_SOURCE_DIR}/dependencies/libffi/build/.libs)
++ FIND_PATH(FFI_INCLUDE_DIR ffi.h doc "Location of ffi.h" PATHS ${LOCAL_PATH} /usr/include/ffi /usr/lib64/libffi-3.0.9/include ${PROJECT_SOURCE_DIR}/dependencies/libffi/build/include /mingw/include/ffi)
+ SET(OPTIONAL_LIBS ${OPTIONAL_LIBS} ${FFI_LIBRARY})
+ INCLUDE_DIRECTORIES(${FFI_INCLUDE_DIR})
+ endif(MINGW)
diff --git a/sci-mathematics/freemat/files/freemat-4.1-portaudio.patch b/sci-mathematics/freemat/files/freemat-4.1-portaudio.patch
new file mode 100644
index 000000000000..518ccfbd1334
--- /dev/null
+++ b/sci-mathematics/freemat/files/freemat-4.1-portaudio.patch
@@ -0,0 +1,10 @@
+--- libs/thirdparty/portaudio/CMakeLists.txt.orig 2012-01-29 02:08:08.422664514 +0100
++++ libs/thirdparty/portaudio/CMakeLists.txt 2012-01-29 02:04:26.826460722 +0100
+@@ -73,6 +73,7 @@ IF (NOT WIN32 AND NOT APPLE)
+ ${CMAKE_CURRENT_SOURCE_DIR}/src/common/pa_stream.c
+ ${CMAKE_CURRENT_SOURCE_DIR}/src/common/pa_trace.c
+ ${CMAKE_CURRENT_SOURCE_DIR}/src/hostapi/oss/pa_unix_oss.c
++ ${CMAKE_CURRENT_SOURCE_DIR}/src/hostapi/skeleton/pa_hostapi_skeleton.c
+ ${CMAKE_CURRENT_SOURCE_DIR}/src/os/unix/pa_unix_hostapis.c
+ ${CMAKE_CURRENT_SOURCE_DIR}/src/os/unix/pa_unix_util.c )
+ ENDIF (NOT WIN32 AND NOT APPLE)
diff --git a/sci-mathematics/freemat/files/freemat-4.1-python3.patch b/sci-mathematics/freemat/files/freemat-4.1-python3.patch
new file mode 100644
index 000000000000..a7aad97cfc7d
--- /dev/null
+++ b/sci-mathematics/freemat/files/freemat-4.1-python3.patch
@@ -0,0 +1,24 @@
+diff -Nur tools.orig/jitgen.py tools/jitgen.py
+--- tools.orig/jitgen.py 2012-04-13 00:25:18.000000000 +0100
++++ tools/jitgen.py 2012-04-13 00:25:40.000000000 +0100
+@@ -39,7 +39,7 @@
+ f.write("// \n\n// Here, each function gets prototyped.\n");
+ f.close()
+
+-os.path.walk(sys.argv[1], visit, '')
++os.walk(sys.argv[1], visit, '')
+
+ f = open(sys.argv[2],'a')
+ f.write("static const char* jit_scalar_list[] = {");
+diff -Nur tools.orig/siggen.py tools/siggen.py
+--- tools.orig/siggen.py 2012-04-13 00:25:18.000000000 +0100
++++ tools/siggen.py 2012-04-13 00:25:53.000000000 +0100
+@@ -81,7 +81,7 @@
+ function_name = fsplit[1]
+ function_internal_name = fsplit[2];
+ if (function_name == '') or (function_internal_name == ''):
+- print 'MISSING Function Name: <%s> <%s> <%s>'%(fline,function_name,function_internal_name)
++ print('MISSING Function Name: <%s> <%s> <%s>'%(fline,function_name,function_internal_name))
+ inputs = iline.split()
+ inputs = inputs[1:]
+ outputs = oline.split()
diff --git a/sci-mathematics/freemat/files/freemat-4.1-use_llvm.patch b/sci-mathematics/freemat/files/freemat-4.1-use_llvm.patch
new file mode 100644
index 000000000000..327aa30f09ab
--- /dev/null
+++ b/sci-mathematics/freemat/files/freemat-4.1-use_llvm.patch
@@ -0,0 +1,29 @@
+--- libs/libMatC/CMakeLists.txt.orig 2011-11-27 01:27:43.000000000 +0100
++++ libs/libMatC/CMakeLists.txt 2012-01-29 14:39:19.842402326 +0100
+@@ -1,10 +1,14 @@
+
+ INCLUDE_DIRECTORIES( ${CMAKE_CURRENT_BINARY_DIR} ${QT_INCLUDE_DIR} ${QT_QTCORE_INCLUDE_DIR} ${QT_QTGUI_INCLUDE_DIR} )
+
++IF( USE_LLVM )
++ set(LLVM_SOURCES "CJitFuncClang.cpp")
++endif( USE_LLVM )
++
+ ADD_LIBRARY( MatC
+ JITFactory.cpp
+ CJitFunc.cpp
+- CJitFuncClang.cpp
++ ${LLVM_SOURCES}
+ CArray.cpp
+ )
+
+--- libs/libMatC.orig/JITFactory.cpp 2011-11-27 01:27:43.000000000 +0100
++++ libs/libMatC/JITFactory.cpp 2012-01-29 14:53:17.296686846 +0100
+@@ -1,5 +1,7 @@
+ #include "JITFactory.hpp"
+-#include "CJitFuncClang.hpp"
++#ifdef HAVE_LLVM
++# include "CJitFuncClang.hpp"
++#endif
+
+ JITFuncBase* JITFactory::GetJITFunc(Interpreter *eval)
+ {
diff --git a/sci-mathematics/freemat/files/freemat-4.2-use_llvm.patch b/sci-mathematics/freemat/files/freemat-4.2-use_llvm.patch
new file mode 100644
index 000000000000..c29b8694ddb7
--- /dev/null
+++ b/sci-mathematics/freemat/files/freemat-4.2-use_llvm.patch
@@ -0,0 +1,45 @@
+--- libs/libMatC/CMakeLists.txt.orig 2011-11-27 01:27:43.000000000 +0100
++++ libs/libMatC/CMakeLists.txt 2012-01-29 14:39:19.842402326 +0100
+@@ -1,10 +1,14 @@
+
+ INCLUDE_DIRECTORIES( ${CMAKE_CURRENT_BINARY_DIR} ${QT_INCLUDE_DIR} ${QT_QTCORE_INCLUDE_DIR} ${QT_QTGUI_INCLUDE_DIR} )
+
++IF( USE_LLVM )
++ set(LLVM_SOURCES "CJitFuncClang.cpp")
++endif( USE_LLVM )
++
+ ADD_LIBRARY( MatC
+ JITFactory.cpp
+ CJitFunc.cpp
+- CJitFuncClang.cpp
++ ${LLVM_SOURCES}
+ CArray.cpp
+ )
+
+--- libs/libMatC.orig/JITFactory.cpp 2011-11-27 01:27:43.000000000 +0100
++++ libs/libMatC/JITFactory.cpp 2012-01-29 14:53:17.296686846 +0100
+@@ -1,5 +1,7 @@
+ #include "JITFactory.hpp"
+-#include "CJitFuncClang.hpp"
++#ifdef HAVE_LLVM
++# include "CJitFuncClang.hpp"
++#endif
+
+ JITFuncBase* JITFactory::GetJITFunc(Interpreter *eval)
+ {
+--- CMakeLists.txt 2014-12-06 21:47:39.685839650 +0100
++++ CMakeLists.txt 2014-12-06 21:48:01.752127927 +0100
+@@ -249,9 +249,10 @@
+ # LLVM Support
+ ######################################################################
+ OPTION(USE_LLVM "Build with LLVM support?" ON)
+-
+-FIND_PACKAGE(LLVM)
+-FIND_PACKAGE(CLANG)
++IF(USE_LLVM)
++ FIND_PACKAGE(LLVM)
++ FIND_PACKAGE(CLANG)
++ENDIF()
+
+ IF (LLVM_FOUND AND CLANG_FOUND)
+ add_definitions(-DHAVE_LLVM)
diff --git a/sci-mathematics/freemat/freemat-4.2.ebuild b/sci-mathematics/freemat/freemat-4.2.ebuild
new file mode 100644
index 000000000000..a00f52f3a7ec
--- /dev/null
+++ b/sci-mathematics/freemat/freemat-4.2.ebuild
@@ -0,0 +1,84 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+inherit eutils cmake-utils fdo-mime
+
+MY_PN=FreeMat
+MY_P=${MY_PN}-${PV}
+
+DESCRIPTION="Environment for rapid engineering and scientific processing"
+HOMEPAGE="http://freemat.sourceforge.net/"
+SRC_URI="mirror://sourceforge/freemat/${MY_P}-Source.tar.gz"
+
+IUSE="volpack vtk"
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+
+RDEPEND="dev-libs/libpcre
+ media-libs/portaudio
+ sci-libs/arpack
+ sci-libs/fftw:3.0
+ sci-libs/matio
+ sci-libs/umfpack
+ sys-libs/ncurses
+ virtual/glu
+ virtual/lapack
+ virtual/libffi
+ virtual/opengl
+ dev-qt/qtgui:4
+ dev-qt/qtopengl:4
+ dev-qt/qtsvg:4
+ dev-qt/qtwebkit:4
+ volpack? ( media-libs/volpack )
+ vtk? ( sci-libs/vtk )"
+
+DEPEND="${RDEPEND}
+ dev-lang/python
+ virtual/pkgconfig"
+
+S="${WORKDIR}/${MY_P}-Source"
+
+src_prepare(){
+ epatch \
+ "${FILESDIR}"/${PN}-4.1-fixes.patch \
+ "${FILESDIR}"/${PN}-4.1-python3.patch \
+ "${FILESDIR}"/${P}-use_llvm.patch
+ rm -f CMakeCache.txt
+ find . -type f -name '*.moc.cpp' -exec rm -f {} \;
+ find . -type f -name 'add.so' -exec rm -f {} \;
+}
+
+src_configure() {
+ mycmakeargs+=(
+ -DFORCE_SYSTEM_LIBS=ON
+ -DUSE_LLVM=OFF
+ -DUSE_ITK=OFF
+ -DFFI_INCLUDE_DIR="$(pkg-config --cflags-only-I libffi | sed -e s/-I//)"
+ $(cmake-utils_use_with volpack VOLPACK)
+ $(cmake-utils_use_with vtk VTK)
+ )
+ cmake-utils_src_configure
+}
+
+src_install() {
+ cmake-utils_src_install -j1
+ dodoc ChangeLog
+ newicon images/freemat_small_mod_64.png ${PN}.png
+ make_desktop_entry FreeMat FreeMat
+}
+
+pkg_postinst() {
+ fdo-mime_desktop_database_update
+ elog "Before using ${MY_PN}, do (as a normal user)"
+ elog "FreeMat -i ${EROOT}usr/share/${MY_P}"
+ elog "Then start ${MY_PN}, choose Tools -> Path Tool,"
+ elog "select ${EROOT}usr/share/${MY_P}/toolbox and Add With Subfolders"
+}
+
+pkg_postrm() {
+ fdo-mime_desktop_database_update
+}
diff --git a/sci-mathematics/freemat/metadata.xml b/sci-mathematics/freemat/metadata.xml
new file mode 100644
index 000000000000..380a6559bf46
--- /dev/null
+++ b/sci-mathematics/freemat/metadata.xml
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <herd>sci-mathematics</herd>
+ <longdescription lang="en">
+ FreeMat is an open sources environment for rapid engineering and
+ scientific prototyping and data processing. It is similar to
+ commercial systems such as MATLAB from Mathworks. FreeMat includes a
+ codeless interface to external C/C++/FORTRAN code,
+ parallel/distributed algorithm development (via MPI), and plotting
+ and visualization capabilities.
+</longdescription>
+ <use>
+ <flag name="volpack">Add volume rendering via <pkg>media-libs/volpack</pkg></flag>
+ <flag name="vtk">Add 3D capabilities via <pkg>sci-libs/vtk</pkg></flag>
+ </use>
+ <upstream>
+ <remote-id type="sourceforge">freemat</remote-id>
+ </upstream>
+</pkgmetadata>
diff --git a/sci-mathematics/fricas/Manifest b/sci-mathematics/fricas/Manifest
new file mode 100644
index 000000000000..524b685148d1
--- /dev/null
+++ b/sci-mathematics/fricas/Manifest
@@ -0,0 +1,2 @@
+DIST fricas-1.2.5-full.tar.bz2 10153745 SHA256 842e85d2799fd5271957c0d306c243f9f9d9db791e781e848b430f17a11d5e57 SHA512 78e99c2b791d8680e939adf8dfde96d3b305c58e9333da1ae98e214b5fc9ca2d6c365c7857cb4e30a68aa5450c992973243e058e4d4a412f57ff37137bc19ba0 WHIRLPOOL 13e91e451ffa707c220704aa5d017df264806feaa6b1b52c03ddaecff57594d06fe957ae61e0c5a0f49e4f96fb6f420a99aac49279f4f9e0efa07a11bedac1cd
+DIST fricas-1.2.6-full.tar.bz2 10196018 SHA256 725b62d9139a345a3bc0eb0d29bd0e0764de475792918165c3bcd293d3c292ae SHA512 6c98844b6815bd6bfbe50881179b746aa38af48e3992179e3746bd175ef2a0940d9855e79b66b1b5e34d9fc9fe1b8f3578483847b18d7cc2781f7f72b65fb2ac WHIRLPOOL de221add1c68da205d8689834ccb52a0ea468af253ccae70ce7c25156b0ece810dcc50a9db99549ed461a10dcaea13f503c1f0838141262dd6c6d524a217be61
diff --git a/sci-mathematics/fricas/files/64fricas-gentoo.el b/sci-mathematics/fricas/files/64fricas-gentoo.el
new file mode 100644
index 000000000000..bc610ea83925
--- /dev/null
+++ b/sci-mathematics/fricas/files/64fricas-gentoo.el
@@ -0,0 +1,2 @@
+;; site-init for sci-mathematics/fricas
+(add-to-list 'load-path "/usr/share/emacs/site-lisp/fricas")
diff --git a/sci-mathematics/fricas/fricas-1.2.5.ebuild b/sci-mathematics/fricas/fricas-1.2.5.ebuild
new file mode 100644
index 000000000000..a6701e5bcd73
--- /dev/null
+++ b/sci-mathematics/fricas/fricas-1.2.5.ebuild
@@ -0,0 +1,90 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+EAPI=5
+inherit multilib elisp-common
+
+DESCRIPTION="FriCAS is a fork of Axiom computer algebra system"
+HOMEPAGE="http://${PN}.sourceforge.net/"
+SRC_URI="mirror://sourceforge/${PN}/${P}-full.tar.bz2"
+LICENSE="BSD-2"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+
+# Supported lisps, number 0 is the default
+LISPS=( sbcl cmucl gcl ecls clisp clozurecl )
+# command name: . means just ${LISP}
+COMS=( . lisp . ecl . ccl )
+
+IUSE="${LISPS[*]} X emacs gmp"
+RDEPEND="X? ( x11-libs/libXpm x11-libs/libICE )
+ emacs? ( virtual/emacs )
+ gmp? ( dev-libs/gmp )"
+
+# Generating lisp deps
+n=${#LISPS[*]}
+for ((n--; n > 0; n--)); do
+ LISP=${LISPS[$n]}
+ RDEPEND="${RDEPEND} ${LISP}? ( dev-lisp/${LISP}:= ) !${LISP}? ("
+done
+RDEPEND="${RDEPEND} dev-lisp/${LISPS[0]}:="
+n=${#LISPS[*]}
+for ((n--; n > 0; n--)); do
+ RDEPEND="${RDEPEND} )"
+done
+
+DEPEND="${RDEPEND}"
+
+# necessary for clisp and gcl
+RESTRICT="strip"
+
+src_configure() {
+ local LISP n
+ LISP=sbcl
+ n=${#LISPS[*]}
+ for ((n--; n > 0; n--)); do
+ if use ${LISPS[$n]}; then
+ LISP=${COMS[$n]}
+ if [ "${LISP}" = "." ]; then
+ LISP=${LISPS[$n]}
+ fi
+ fi
+ done
+ einfo "Using lisp: ${LISP}"
+
+ # aldor is not yet in portage
+ econf --disable-aldor --with-lisp=${LISP} $(use_with X x) $(use_with gmp)
+}
+
+src_compile() {
+ # bug #300132
+ emake -j1
+}
+
+src_test() {
+ emake -j1 all-input
+}
+
+src_install() {
+ emake -j1 DESTDIR="${D}" install
+ dodoc README FAQ
+
+ if use emacs; then
+ sed -e "s|(setq load-path (cons (quote \"/usr/$(get_libdir)/fricas/emacs\") load-path)) ||" \
+ -i "${D}"/usr/bin/efricas \
+ || die "sed efricas failed"
+ elisp-install ${PN} "${D}"/usr/$(get_libdir)/${PN}/emacs/*.el
+ elisp-site-file-install "${FILESDIR}"/64${PN}-gentoo.el
+ else
+ rm "${D}"/usr/bin/efricas || die "rm efricas failed"
+ fi
+ rm -r "${D}"/usr/$(get_libdir)/${PN}/emacs || die "rm -r emacs failed"
+}
+
+pkg_postinst() {
+ use emacs && elisp-site-regen
+}
+
+pkg_postrm() {
+ use emacs && elisp-site-regen
+}
diff --git a/sci-mathematics/fricas/fricas-1.2.6.ebuild b/sci-mathematics/fricas/fricas-1.2.6.ebuild
new file mode 100644
index 000000000000..a6701e5bcd73
--- /dev/null
+++ b/sci-mathematics/fricas/fricas-1.2.6.ebuild
@@ -0,0 +1,90 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+EAPI=5
+inherit multilib elisp-common
+
+DESCRIPTION="FriCAS is a fork of Axiom computer algebra system"
+HOMEPAGE="http://${PN}.sourceforge.net/"
+SRC_URI="mirror://sourceforge/${PN}/${P}-full.tar.bz2"
+LICENSE="BSD-2"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+
+# Supported lisps, number 0 is the default
+LISPS=( sbcl cmucl gcl ecls clisp clozurecl )
+# command name: . means just ${LISP}
+COMS=( . lisp . ecl . ccl )
+
+IUSE="${LISPS[*]} X emacs gmp"
+RDEPEND="X? ( x11-libs/libXpm x11-libs/libICE )
+ emacs? ( virtual/emacs )
+ gmp? ( dev-libs/gmp )"
+
+# Generating lisp deps
+n=${#LISPS[*]}
+for ((n--; n > 0; n--)); do
+ LISP=${LISPS[$n]}
+ RDEPEND="${RDEPEND} ${LISP}? ( dev-lisp/${LISP}:= ) !${LISP}? ("
+done
+RDEPEND="${RDEPEND} dev-lisp/${LISPS[0]}:="
+n=${#LISPS[*]}
+for ((n--; n > 0; n--)); do
+ RDEPEND="${RDEPEND} )"
+done
+
+DEPEND="${RDEPEND}"
+
+# necessary for clisp and gcl
+RESTRICT="strip"
+
+src_configure() {
+ local LISP n
+ LISP=sbcl
+ n=${#LISPS[*]}
+ for ((n--; n > 0; n--)); do
+ if use ${LISPS[$n]}; then
+ LISP=${COMS[$n]}
+ if [ "${LISP}" = "." ]; then
+ LISP=${LISPS[$n]}
+ fi
+ fi
+ done
+ einfo "Using lisp: ${LISP}"
+
+ # aldor is not yet in portage
+ econf --disable-aldor --with-lisp=${LISP} $(use_with X x) $(use_with gmp)
+}
+
+src_compile() {
+ # bug #300132
+ emake -j1
+}
+
+src_test() {
+ emake -j1 all-input
+}
+
+src_install() {
+ emake -j1 DESTDIR="${D}" install
+ dodoc README FAQ
+
+ if use emacs; then
+ sed -e "s|(setq load-path (cons (quote \"/usr/$(get_libdir)/fricas/emacs\") load-path)) ||" \
+ -i "${D}"/usr/bin/efricas \
+ || die "sed efricas failed"
+ elisp-install ${PN} "${D}"/usr/$(get_libdir)/${PN}/emacs/*.el
+ elisp-site-file-install "${FILESDIR}"/64${PN}-gentoo.el
+ else
+ rm "${D}"/usr/bin/efricas || die "rm efricas failed"
+ fi
+ rm -r "${D}"/usr/$(get_libdir)/${PN}/emacs || die "rm -r emacs failed"
+}
+
+pkg_postinst() {
+ use emacs && elisp-site-regen
+}
+
+pkg_postrm() {
+ use emacs && elisp-site-regen
+}
diff --git a/sci-mathematics/fricas/metadata.xml b/sci-mathematics/fricas/metadata.xml
new file mode 100644
index 000000000000..f10acfb41f9b
--- /dev/null
+++ b/sci-mathematics/fricas/metadata.xml
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <herd>sci-mathematics</herd>
+ <maintainer>
+ <email>grozin@gentoo.org</email>
+ <name>Andrey Grozin</name>
+ </maintainer>
+ <longdescription lang="en">
+FriCAS is a fork of Axiom computer algebra system.
+</longdescription>
+ <use>
+ <flag name="clisp">Add support for GNU CLISP
+ (<pkg>dev-lisp/clisp</pkg>)</flag>
+ <flag name="cmucl">Add support for CMU Common Lisp
+ (<pkg>dev-lisp/cmucl</pkg>)</flag>
+ <flag name="gcl">Add support for GNU Common Lisp
+ (<pkg>dev-lisp/gcl</pkg>)</flag>
+ <flag name="sbcl">Add support for Steel Bank Common Lisp
+ (<pkg>dev-lisp/sbcl</pkg>)</flag>
+ <flag name="ecls">Add support for Embeddable Common Lisp
+ (<pkg>dev-lisp/ecls</pkg>)</flag>
+ <flag name="clozurecl">Add support for Clozure Common Lisp
+ (<pkg>dev-lisp/clozurecl</pkg>)</flag>
+ </use>
+ <upstream>
+ <remote-id type="sourceforge">fricas</remote-id>
+ </upstream>
+</pkgmetadata>
diff --git a/sci-mathematics/frobby/Manifest b/sci-mathematics/frobby/Manifest
new file mode 100644
index 000000000000..b2c0528d8edb
--- /dev/null
+++ b/sci-mathematics/frobby/Manifest
@@ -0,0 +1 @@
+DIST frobby_v0.9.0.tar.gz 852524 SHA256 af092383e6dc849c86f4e79747ae0e5cd309a690747230e10aa38d60640062df SHA512 b1f64d7a8630ba7f5464e36f66a06a7a7909bc42f2e52898b2967b8ad6288da8ce11a5d79ebfbbfe2f3933930ad26444173f721465ae9a42b6dcf3eef7ecc59e WHIRLPOOL f02c6c794c214c047ae6e1d764b0a29a87be1c080e8ac7489aedb1394a90169f8dc5bb6447c961760a35ba2af90c34ed9bb8e282590d0d05abe791aff7473025
diff --git a/sci-mathematics/frobby/files/frobby-cflags-no-strip-soname.patch b/sci-mathematics/frobby/files/frobby-cflags-no-strip-soname.patch
new file mode 100644
index 000000000000..2f5721d62a71
--- /dev/null
+++ b/sci-mathematics/frobby/files/frobby-cflags-no-strip-soname.patch
@@ -0,0 +1,47 @@
+diff -U 3 -dHrN frobby_v0.9.0.orig/Makefile frobby_v0.9.0/Makefile
+--- frobby_v0.9.0.orig/Makefile 2013-01-15 22:40:13.127937655 +0100
++++ frobby_v0.9.0/Makefile 2013-02-16 10:54:42.265322522 +0100
+@@ -70,7 +70,7 @@
+ BIN_INSTALL_DIR = "/usr/local/bin/"
+ endif
+
+-cflags = $(CFLAGS) $(CPPFLAGS) -Wall -ansi -pedantic -I $(GMP_INC_DIR) \
++cflags = $(CPPFLAGS) -Wall -ansi -pedantic -I $(GMP_INC_DIR) \
+ -Wno-uninitialized -Wno-unused-parameter
+ program = frobby
+ library = libfrobby.a
+@@ -87,7 +87,6 @@
+ MATCH=false
+ ifeq ($(MODE), release)
+ outdir = bin/release/
+- cflags += -O2
+ MATCH=true
+ endif
+ ifeq ($(MODE), debug)
+@@ -99,7 +98,7 @@
+ endif
+ ifeq ($(MODE), shared)
+ outdir = bin/shared/
+- cflags += -O2 -fPIC
++ cflags += -fPIC
+ library = libfrobby.so
+ MATCH=true
+ endif
+@@ -204,16 +203,13 @@
+ mv -f $@.exe $@; \
+ fi
+ endif
+-ifeq ($(MODE), release)
+- strip $@
+-endif
+
+ # Link object files into library
+ library: bin/$(library)
+ bin/$(library): $(objs) | bin/
+ rm -f bin/$(library)
+ ifeq ($(MODE), shared)
+- $(CXX) -shared -o bin/$(library) $(ldflags) \
++ $(CXX) -shared -Wl,-soname,libfrobby.so.0 -o bin/$(library) $(ldflags) \
+ $(patsubst $(outdir)main.o,,$(objs))
+ else
+ ar crs bin/$(library) $(patsubst $(outdir)main.o,,$(objs))
diff --git a/sci-mathematics/frobby/files/frobby-gcc-4.7.patch b/sci-mathematics/frobby/files/frobby-gcc-4.7.patch
new file mode 100644
index 000000000000..4a73161166d9
--- /dev/null
+++ b/sci-mathematics/frobby/files/frobby-gcc-4.7.patch
@@ -0,0 +1,32 @@
+ src/main.cpp | 3 +++
+ src/randomDataGenerators.cpp | 3 +++
+ 2 files changed, 6 insertions(+), 0 deletions(-)
+
+diff --git a/src/main.cpp b/src/main.cpp
+index a16754e..315ea53 100755
+--- a/src/main.cpp
++++ b/src/main.cpp
+@@ -25,6 +25,9 @@
+ #include <ctime>
+ #include <cstdlib>
+
++#include <sys/types.h>
++#include <unistd.h>
++
+ /** This function runs the Frobby console interface. the ::main
+ function calls this function after having set up DEBUG-specific
+ things, catching exceptions, setting the random seed and so on.
+diff --git a/src/randomDataGenerators.cpp b/src/randomDataGenerators.cpp
+index 432a90a..1de3559 100755
+--- a/src/randomDataGenerators.cpp
++++ b/src/randomDataGenerators.cpp
+@@ -26,6 +26,9 @@
+ #include <limits>
+ #include <ctime>
+
++#include <sys/types.h>
++#include <unistd.h>
++
+ void generateLinkedListIdeal(BigIdeal& ideal, size_t variableCount) {
+ VarNames names(variableCount);
+ ideal.clearAndSetNames(variableCount);
diff --git a/sci-mathematics/frobby/files/frobby-gmp-5.1.patch b/sci-mathematics/frobby/files/frobby-gmp-5.1.patch
new file mode 100644
index 000000000000..23cf295b8965
--- /dev/null
+++ b/sci-mathematics/frobby/files/frobby-gmp-5.1.patch
@@ -0,0 +1,12 @@
+diff -U 3 -dHrN frobby_v0.9.0.orig/src/StatisticsStrategy.cpp frobby_v0.9.0/src/StatisticsStrategy.cpp
+--- frobby_v0.9.0.orig/src/StatisticsStrategy.cpp 2013-01-15 22:40:13.186967442 +0100
++++ frobby_v0.9.0/src/StatisticsStrategy.cpp 2013-01-15 22:40:33.267100780 +0100
+@@ -140,7 +140,7 @@
+ if (_nodeCount == 0)
+ return 0.0;
+ else {
+- mpz_class q = mpq_class(_subGenSum) / _nodeCount;
++ mpq_class q = mpq_class(_subGenSum) / _nodeCount;
+ return q.get_d();
+ }
+ }
diff --git a/sci-mathematics/frobby/frobby-0.9.0-r1.ebuild b/sci-mathematics/frobby/frobby-0.9.0-r1.ebuild
new file mode 100644
index 000000000000..72bcfe713550
--- /dev/null
+++ b/sci-mathematics/frobby/frobby-0.9.0-r1.ebuild
@@ -0,0 +1,55 @@
+# Copyright 1999-2013 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=4
+
+inherit eutils
+
+DESCRIPTION="Software system and project for computations with monomial ideals"
+HOMEPAGE="http://www.broune.com/frobby/"
+SRC_URI="http://www.broune.com/frobby/frobby_v${PV}.tar.gz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="amd64 x86"
+IUSE="doc static-libs"
+
+RDEPEND="dev-libs/gmp[cxx]"
+DEPEND="${RDEPEND}
+ doc? ( virtual/latex-base )"
+
+S="${WORKDIR}/frobby_v${PV}"
+
+src_prepare() {
+ epatch \
+ "${FILESDIR}/${PN}-cflags-no-strip-soname.patch" \
+ "${FILESDIR}/${PN}-gcc-4.7.patch" \
+ "${FILESDIR}/${PN}-gmp-5.1.patch"
+ # CXXFLAGS are called CPPFLAGS
+ sed "s/CPPFLAGS/CXXFLAGS/" -i Makefile || die
+}
+
+src_compile() {
+ # Makefile uses the value of CXX which may be defined in /etc/env,
+ # breaking cross-compile.
+ CXX=$(tc-getCXX) emake
+ MODE=shared CXX=$(tc-getCXX) emake library
+ use static-libs && CXX=$(tc-getCXX) emake library
+ use doc && emake docPdf
+}
+
+src_install() {
+ dobin bin/frobby
+ dolib.so bin/libfrobby.so
+ dosym libfrobby.so "${PREFIX}/usr/$(get_libdir)/libfrobby.so.0"
+ use static-libs && dolib.a bin/libfrobby.a
+
+ insinto /usr/include
+ doins src/frobby.h
+
+ insinto /usr/include/"${PN}"
+ doins src/stdinc.h
+
+ use doc && dodoc bin/manual.pdf
+}
diff --git a/sci-mathematics/frobby/metadata.xml b/sci-mathematics/frobby/metadata.xml
new file mode 100644
index 000000000000..4e93bbb7622c
--- /dev/null
+++ b/sci-mathematics/frobby/metadata.xml
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <maintainer>
+ <email>tomka@gentoo.org</email>
+ <name>Thomas Kahle</name>
+ </maintainer>
+ <herd>sci</herd>
+ <longdescription lang="en">
+Frobby is a software system and library for computations with monomial ideals.
+</longdescription>
+</pkgmetadata>
diff --git a/sci-mathematics/genius/Manifest b/sci-mathematics/genius/Manifest
new file mode 100644
index 000000000000..c805b44097c6
--- /dev/null
+++ b/sci-mathematics/genius/Manifest
@@ -0,0 +1,3 @@
+DIST genius-1.0.17.tar.xz 2314316 SHA256 2af0cf64a3bae45e8e6c38ce8c0c0724386ae29614a83d9eff179ee09ecef44f SHA512 8047efb1b5d278186b093bca3624f96059670ce3cdf757759abf6e01a27bb4bba82a4158e6baa3b42f349a55fdf6e984388fb7f96f14b0e4faba0ada069e9b6c WHIRLPOOL bb6ba7bb5c635f331e523887e5f5995e83392f58046893ae2bebc56fcaa26f817c8ddd481663fa5818377d721911c430dbd50dd8ab24a07e9dd5c4ad6fcf77bd
+DIST genius-1.0.19.tar.xz 2447724 SHA256 e5a979d13ae39fb1ae176078dbb301222e6c7a1c2cda8d999bac3ff6a4a7e6c2 SHA512 84ec48c0e13af088f61674e170c23cbc06e081bea43babe3460b88fd2e256c9fc44b891afa3270d5117ccd91ec6d2c25b022dde3d468635df9d1c6e573c4ef05 WHIRLPOOL 772637bd2c2333a08115397781773b1aa74cb195b9731b1b07ddf689fef47790aad79d2f2a6c7e45fe5c6738eb8bda56e0cebe3802c01cd5c1a99bfb3b00b0d5
+DIST genius-reference.pdf 1024944 SHA256 79011ae33ff781507185898ba76b156699061eda78ed16e15aa02195c896ee4b SHA512 04af3870104d2320b1d4b345d74d713a0dfcdf8a228002506508f437659b3ef6037ead0b1f6b37cc335692150750b58c4007fdaaddd9540233474ccd10dac285 WHIRLPOOL 301302145d43843ddd749ab33612438d360462c9d3daa12d7050d9ca6da82bdea3ef53b917989d0c518327780b147a9f74e407f555a62dcdbe0f0c2ef864fa88
diff --git a/sci-mathematics/genius/files/genius-1.0.17-gcc4.8.patch b/sci-mathematics/genius/files/genius-1.0.17-gcc4.8.patch
new file mode 100644
index 000000000000..34427a72dda1
--- /dev/null
+++ b/sci-mathematics/genius/files/genius-1.0.17-gcc4.8.patch
@@ -0,0 +1,28 @@
+ src/genius-readline-helper.c | 2 +-
+ src/inter.c | 2 +-
+ 2 files changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/src/genius-readline-helper.c b/src/genius-readline-helper.c
+index 7e9e84b..dbf8fd2 100644
+--- a/src/genius-readline-helper.c
++++ b/src/genius-readline-helper.c
+@@ -183,7 +183,7 @@ main(int argc, char *argv[])
+ rl_terminal_name = "xterm";
+ rl_readline_name = "Genius";
+ rl_attempted_completion_function =
+- (CPPFunction *)tab_completion;
++ (rl_completion_func_t *)tab_completion;
+
+ while(fgets(buf,4096,infp)) {
+ int count;
+diff --git a/src/inter.c b/src/inter.c
+index 915f115..f0d2558 100644
+--- a/src/inter.c
++++ b/src/inter.c
+@@ -367,5 +367,5 @@ init_inter(void)
+ {
+ rl_readline_name = "Genius";
+ rl_attempted_completion_function =
+- (CPPFunction *)tab_completion;
++ (rl_completion_func_t *)tab_completion;
+ }
diff --git a/sci-mathematics/genius/files/genius-make.patch b/sci-mathematics/genius/files/genius-make.patch
new file mode 100644
index 000000000000..b9754325aea4
--- /dev/null
+++ b/sci-mathematics/genius/files/genius-make.patch
@@ -0,0 +1,73 @@
+--- gtkextra/Makefile.in-orig 2010-08-22 16:18:31.099596456 -0500
++++ gtkextra/Makefile.in 2010-08-22 16:20:46.375575923 -0500
+@@ -106,16 +106,16 @@
+ first=`echo "$$dir1" | sed -e "$$sed_first"`; \
+ if test "$$first" != "."; then \
+ if test "$$first" = ".."; then \
+- dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \
+- dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \
++ dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \
++ dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \
+ else \
+- first2=`echo "$$dir2" | sed -e "$$sed_first"`; \
+- if test "$$first2" = "$$first"; then \
+- dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \
+- else \
+- dir2="../$$dir2"; \
+- fi; \
+- dir0="$$dir0"/"$$first"; \
++ first2=`echo "$$dir2" | sed -e "$$sed_first"`; \
++ if test "$$first2" = "$$first"; then \
++ dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \
++ else \
++ dir2="../$$dir2"; \
++ fi; \
++ dir0="$$dir0"/"$$first"; \
+ fi; \
+ fi; \
+ dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \
+@@ -391,7 +391,7 @@
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
+- && { if test -f $@; then exit 0; else break; fi; }; \
++ && { if test -f $@; then exit 0; else break; fi; }; \
+ exit 1;; \
+ esac; \
+ done; \
+@@ -670,12 +670,12 @@
+ echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \
+ ($(am__cd) $$subdir && \
+ $(MAKE) $(AM_MAKEFLAGS) \
+- top_distdir="$$new_top_distdir" \
+- distdir="$$new_distdir" \
++ top_distdir="$$new_top_distdir" \
++ distdir="$$new_distdir" \
+ am__remove_distdir=: \
+ am__skip_length_check=: \
+ am__skip_mode_fix=: \
+- distdir) \
++ distdir) \
+ || exit 1; \
+ fi; \
+ done
+@@ -800,13 +800,13 @@
+
+
+ $(srcdir)/gtkextra-marshal.h: gtkextra-marshal.list
+- ( @GLIB_GENMARSHAL@ --prefix=gtkextra gtkextra-marshal.list --header > gtkextra-marshal.tmp \
+- && mv gtkextra-marshal.tmp gtkextra-marshal.h ) \
+- || ( rm -f gtkextra-marshal.tmp && exit 1 )
++ ( @GLIB_GENMARSHAL@ --prefix=gtkextra gtkextra-marshal.list --header > gtkextra-marshal.tmp \
++ && mv gtkextra-marshal.tmp gtkextra-marshal.h ) \
++ || ( rm -f gtkextra-marshal.tmp && exit 1 )
+ $(srcdir)/gtkextra-marshal.c: gtkextra-marshal.h
+- ( @GLIB_GENMARSHAL@ --prefix=gtkextra gtkextra-marshal.list --body > gtkextra-marshal.tmp \
+- && mv gtkextra-marshal.tmp gtkextra-marshal.c ) \
+- || ( rm -f gtkextra-marshal.tmp && exit 1 )
++ ( @GLIB_GENMARSHAL@ --prefix=gtkextra gtkextra-marshal.list --body > gtkextra-marshal.tmp \
++ && mv gtkextra-marshal.tmp gtkextra-marshal.c ) \
++ || ( rm -f gtkextra-marshal.tmp && exit 1 )
+
+ $(srcdir)/gtkextratypebuiltins.h: $(public_h_sources)
+ ( cd $(srcdir) && glib-mkenums \
diff --git a/sci-mathematics/genius/genius-1.0.17.ebuild b/sci-mathematics/genius/genius-1.0.17.ebuild
new file mode 100644
index 000000000000..5ad622fa3a1c
--- /dev/null
+++ b/sci-mathematics/genius/genius-1.0.17.ebuild
@@ -0,0 +1,58 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+inherit eutils gnome2
+
+DESCRIPTION="Genius Mathematics Tool and the GEL Language"
+HOMEPAGE="http://www.jirka.org/genius.html"
+SRC_URI="
+ mirror://gnome/sources/${PN}/1.0/${P}.tar.xz
+ doc? ( http://www.jirka.org/${PN}-reference.pdf )"
+
+LICENSE="GPL-3"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE="doc gnome nls"
+
+RDEPEND="
+ dev-libs/glib:2
+ dev-libs/gmp
+ dev-libs/mpfr
+ dev-libs/popt
+ sys-libs/ncurses
+ sys-libs/readline
+ gnome? (
+ x11-libs/gtk+:2
+ gnome-base/libgnome
+ gnome-base/libgnomeui
+ gnome-base/libglade:2.0
+ x11-libs/gtksourceview:2.0
+ x11-libs/vte:0 )"
+DEPEND="${RDEPEND}
+ dev-util/intltool
+ || ( sys-devel/bison dev-util/yacc )
+ sys-devel/flex
+ app-text/scrollkeeper
+ app-text/gnome-doc-utils
+ nls? ( sys-devel/gettext )"
+
+src_prepare() {
+ G2CONF="${G2CONF} $(use_enable gnome) $(use_enable nls) \
+ --disable-update-mimedb --disable-scrollkeeper \
+ --disable-extra-gcc-optimization"
+ # gnome2.eclass adds --disable-gtk-doc or --enable-gtk-doc to G2CONF
+ # if there is the USE flag doc, thus leading to QA warnings
+ GCONF_DEBUG="no"
+ DOCS="AUTHORS ChangeLog NEWS README TODO"
+ USE_DESTDIR="1"
+
+ epatch "${FILESDIR}"/${P}-gcc4.8.patch
+}
+
+src_install() {
+ use doc && DOCS+=" ${DISTDIR}/${PN}-reference.pdf"
+ gnome2_src_install
+}
diff --git a/sci-mathematics/genius/genius-1.0.19.ebuild b/sci-mathematics/genius/genius-1.0.19.ebuild
new file mode 100644
index 000000000000..32c5e25a4f1e
--- /dev/null
+++ b/sci-mathematics/genius/genius-1.0.19.ebuild
@@ -0,0 +1,56 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+inherit eutils gnome2
+
+DESCRIPTION="Genius Mathematics Tool and the GEL Language"
+HOMEPAGE="http://www.jirka.org/genius.html"
+SRC_URI="
+ mirror://gnome/sources/${PN}/1.0/${P}.tar.xz
+ doc? ( http://www.jirka.org/${PN}-reference.pdf )"
+
+LICENSE="GPL-3"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE="doc gnome nls"
+
+RDEPEND="
+ dev-libs/glib:2
+ dev-libs/gmp
+ dev-libs/mpfr
+ dev-libs/popt
+ sys-libs/ncurses
+ sys-libs/readline
+ gnome? (
+ x11-libs/gtk+:2
+ gnome-base/libgnome
+ gnome-base/libgnomeui
+ gnome-base/libglade:2.0
+ x11-libs/gtksourceview:2.0
+ x11-libs/vte:0 )"
+DEPEND="${RDEPEND}
+ dev-util/intltool
+ || ( sys-devel/bison dev-util/yacc )
+ sys-devel/flex
+ app-text/scrollkeeper
+ app-text/gnome-doc-utils
+ nls? ( sys-devel/gettext )"
+
+src_prepare() {
+ G2CONF="${G2CONF} $(use_enable gnome) $(use_enable nls) \
+ --disable-update-mimedb --disable-scrollkeeper \
+ --disable-extra-gcc-optimization"
+ # gnome2.eclass adds --disable-gtk-doc or --enable-gtk-doc to G2CONF
+ # if there is the USE flag doc, thus leading to QA warnings
+ GCONF_DEBUG="no"
+ DOCS="AUTHORS ChangeLog NEWS README TODO"
+ USE_DESTDIR="1"
+}
+
+src_install() {
+ use doc && DOCS+=" ${DISTDIR}/${PN}-reference.pdf"
+ gnome2_src_install
+}
diff --git a/sci-mathematics/genius/metadata.xml b/sci-mathematics/genius/metadata.xml
new file mode 100644
index 000000000000..6260aca8ea54
--- /dev/null
+++ b/sci-mathematics/genius/metadata.xml
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <herd>sci</herd>
+ <maintainer>
+ <email>grozin@gentoo.org</email>
+ <name>Andrey Grozin</name>
+ </maintainer>
+ <longdescription>Genius is a calculator program which can work
+ with arbitrary precision integers, multiple precision floats,
+ rational numbers, complex numbers, linear algebra, number theory,
+ numerical calculus, statistics, numerical equation solving,
+ combinatorics, elementary functions, modular arithmetic.
+ It has a programming language with automatic typing.
+ It can do various 2D and 3D plots, with possibility
+ to export to eps or png. Genius has a GUI IDE.
+ It can output matrices in LaTeX, Troff (eqn) or MathML.
+ </longdescription>
+</pkgmetadata>
diff --git a/sci-mathematics/geogebra/Manifest b/sci-mathematics/geogebra/Manifest
new file mode 100644
index 000000000000..bf75d3c8b6d2
--- /dev/null
+++ b/sci-mathematics/geogebra/Manifest
@@ -0,0 +1 @@
+DIST GeoGebra-Unixlike-Installer-4.1.120.0.tar.gz 44859986 SHA256 39f4462ad934923673f14e5c34c4bc1da167c5af5e411f58d89c8a935ae08648 SHA512 9c52c4850e8d003ff2edbc2af6607fb02779063aca10e5b76ef2f8be3992ce2eb4f148323dbee324bbbdc0f56e8d1b15fd5971cda734c813796213895003e1a4 WHIRLPOOL 6cb59b6023a1a3a8eaba105d3bb5f1df24baf78de3d35fdcce21ff370c9630087f8096b8e95f19ba8118825f9968c10eacf9dd76bcd941c5d66ccb24d5e24aec
diff --git a/sci-mathematics/geogebra/files/geogebra-fix-install.sh.patch b/sci-mathematics/geogebra/files/geogebra-fix-install.sh.patch
new file mode 100644
index 000000000000..6597a4f48dd7
--- /dev/null
+++ b/sci-mathematics/geogebra/files/geogebra-fix-install.sh.patch
@@ -0,0 +1,78 @@
+--- install.sh 2012-06-04 17:14:09.129571330 +0200
++++ install.sh 2012-06-04 17:11:58.588706799 +0200
+@@ -2,41 +2,41 @@
+ # simple ./install-sh script that copies everything to the right place
+
+ # create all needed directories
+-./install-sh -d -m 755 /usr/share/geogebra/unsigned
+-./install-sh -d -m 755 /usr/share/icons/hicolor/16x16/apps /usr/share/icons/hicolor/22x22/apps /usr/share/icons/hicolor/24x24/apps /usr/share/icons/hicolor/32x32/apps /usr/share/icons/hicolor/36x36/apps /usr/share/icons/hicolor/48x48/apps /usr/share/icons/hicolor/64x64/apps /usr/share/icons/hicolor/72x72/apps /usr/share/icons/hicolor/96x96/apps /usr/share/icons/hicolor/128x128/apps /usr/share/icons/hicolor/192x192/apps /usr/share/icons/hicolor/256x256/apps /usr/share/icons/hicolor/scalable/apps
+-./install-sh -d -m 755 /usr/share/icons/hicolor/16x16/mimetypes /usr/share/icons/hicolor/22x22/mimetypes /usr/share/icons/hicolor/24x24/mimetypes /usr/share/icons/hicolor/32x32/mimetypes /usr/share/icons/hicolor/36x36/mimetypes /usr/share/icons/hicolor/48x48/mimetypes /usr/share/icons/hicolor/64x64/mimetypes /usr/share/icons/hicolor/72x72/mimetypes /usr/share/icons/hicolor/96x96/mimetypes /usr/share/icons/hicolor/128x128/mimetypes /usr/share/icons/hicolor/192x192/mimetypes /usr/share/icons/hicolor/256x256/mimetypes /usr/share/icons/hicolor/scalable/mimetypes
++./install-sh -d -m 755 ${D}/usr/share/geogebra/unsigned
++./install-sh -d -m 755 ${D}/usr/share/icons/hicolor/16x16/apps ${D}/usr/share/icons/hicolor/22x22/apps ${D}/usr/share/icons/hicolor/24x24/apps ${D}/usr/share/icons/hicolor/32x32/apps ${D}/usr/share/icons/hicolor/36x36/apps ${D}/usr/share/icons/hicolor/48x48/apps ${D}/usr/share/icons/hicolor/64x64/apps ${D}/usr/share/icons/hicolor/72x72/apps ${D}/usr/share/icons/hicolor/96x96/apps ${D}/usr/share/icons/hicolor/128x128/apps ${D}/usr/share/icons/hicolor/192x192/apps ${D}/usr/share/icons/hicolor/256x256/apps ${D}/usr/share/icons/hicolor/scalable/apps
++./install-sh -d -m 755 ${D}/usr/share/icons/hicolor/16x16/mimetypes ${D}/usr/share/icons/hicolor/22x22/mimetypes ${D}/usr/share/icons/hicolor/24x24/mimetypes ${D}/usr/share/icons/hicolor/32x32/mimetypes ${D}/usr/share/icons/hicolor/36x36/mimetypes ${D}/usr/share/icons/hicolor/48x48/mimetypes ${D}/usr/share/icons/hicolor/64x64/mimetypes ${D}/usr/share/icons/hicolor/72x72/mimetypes ${D}/usr/share/icons/hicolor/96x96/mimetypes ${D}/usr/share/icons/hicolor/128x128/mimetypes ${D}/usr/share/icons/hicolor/192x192/mimetypes ${D}/usr/share/icons/hicolor/256x256/mimetypes ${D}/usr/share/icons/hicolor/scalable/mimetypes
+
+ # ./install-sh files
+-./install-sh -m 644 *.jar /usr/share/geogebra
+-./install-sh -m 644 unsigned/*.jar /usr/share/geogebra/unsigned
+-./install-sh -m 755 geogebra /usr/bin
+-./install-sh -m 644 geogebra.xml /usr/share/mime/packages
+-./install-sh -m 644 geogebra.desktop /usr/share/applications
++./install-sh -m 644 *.jar ${D}/usr/share/geogebra
++./install-sh -m 644 unsigned/*.jar ${D}/usr/share/geogebra/unsigned
++./install-sh -m 755 geogebra ${D}/usr/bin/geogebra
++./install-sh -m 644 geogebra.xml ${D}/usr/share/mime/packages/gegebra.xml
++./install-sh -m 644 geogebra.desktop ${D}/usr/share/applications/geogebra.desktop
+
+-./install-sh -m 644 icons/hicolor/16x16/apps/geogebra.png /usr/share/icons/hicolor/16x16/apps
+-./install-sh -m 644 icons/hicolor/22x22/apps/geogebra.png /usr/share/icons/hicolor/22x22/apps
+-./install-sh -m 644 icons/hicolor/24x24/apps/geogebra.png /usr/share/icons/hicolor/24x24/apps
+-./install-sh -m 644 icons/hicolor/32x32/apps/geogebra.png /usr/share/icons/hicolor/32x32/apps
+-./install-sh -m 644 icons/hicolor/36x36/apps/geogebra.png /usr/share/icons/hicolor/36x36/apps
+-./install-sh -m 644 icons/hicolor/48x48/apps/geogebra.png /usr/share/icons/hicolor/48x48/apps
+-./install-sh -m 644 icons/hicolor/64x64/apps/geogebra.png /usr/share/icons/hicolor/64x64/apps
+-./install-sh -m 644 icons/hicolor/72x72/apps/geogebra.png /usr/share/icons/hicolor/72x72/apps
+-./install-sh -m 644 icons/hicolor/96x96/apps/geogebra.png /usr/share/icons/hicolor/96x96/apps
+-./install-sh -m 644 icons/hicolor/128x128/apps/geogebra.png /usr/share/icons/hicolor/128x128/apps
+-./install-sh -m 644 icons/hicolor/192x192/apps/geogebra.png /usr/share/icons/hicolor/192x192/apps
+-./install-sh -m 644 icons/hicolor/256x256/apps/geogebra.png /usr/share/icons/hicolor/256x256/apps
+-./install-sh -m 644 icons/hicolor/scalable/apps/geogebra.svgz /usr/share/icons/hicolor/scalable/apps
++./install-sh -m 644 icons/hicolor/16x16/apps/geogebra.png ${D}/usr/share/icons/hicolor/16x16/apps
++./install-sh -m 644 icons/hicolor/22x22/apps/geogebra.png ${D}/usr/share/icons/hicolor/22x22/apps
++./install-sh -m 644 icons/hicolor/24x24/apps/geogebra.png ${D}/usr/share/icons/hicolor/24x24/apps
++./install-sh -m 644 icons/hicolor/32x32/apps/geogebra.png ${D}/usr/share/icons/hicolor/32x32/apps
++./install-sh -m 644 icons/hicolor/36x36/apps/geogebra.png ${D}/usr/share/icons/hicolor/36x36/apps
++./install-sh -m 644 icons/hicolor/48x48/apps/geogebra.png ${D}/usr/share/icons/hicolor/48x48/apps
++./install-sh -m 644 icons/hicolor/64x64/apps/geogebra.png ${D}/usr/share/icons/hicolor/64x64/apps
++./install-sh -m 644 icons/hicolor/72x72/apps/geogebra.png ${D}/usr/share/icons/hicolor/72x72/apps
++./install-sh -m 644 icons/hicolor/96x96/apps/geogebra.png ${D}/usr/share/icons/hicolor/96x96/apps
++./install-sh -m 644 icons/hicolor/128x128/apps/geogebra.png ${D}/usr/share/icons/hicolor/128x128/apps
++./install-sh -m 644 icons/hicolor/192x192/apps/geogebra.png ${D}/usr/share/icons/hicolor/192x192/apps
++./install-sh -m 644 icons/hicolor/256x256/apps/geogebra.png ${D}/usr/share/icons/hicolor/256x256/apps
++./install-sh -m 644 icons/hicolor/scalable/apps/geogebra.svgz ${D}/usr/share/icons/hicolor/scalable/apps
+
+-./install-sh -m 644 icons/hicolor/16x16/mimetypes/*.* /usr/share/icons/hicolor/16x16/mimetypes
+-./install-sh -m 644 icons/hicolor/22x22/mimetypes/*.* /usr/share/icons/hicolor/22x22/mimetypes
+-./install-sh -m 644 icons/hicolor/24x24/mimetypes/*.* /usr/share/icons/hicolor/24x24/mimetypes
+-./install-sh -m 644 icons/hicolor/32x32/mimetypes/*.* /usr/share/icons/hicolor/32x32/mimetypes
+-./install-sh -m 644 icons/hicolor/36x36/mimetypes/*.* /usr/share/icons/hicolor/36x36/mimetypes
+-./install-sh -m 644 icons/hicolor/48x48/mimetypes/*.* /usr/share/icons/hicolor/48x48/mimetypes
+-./install-sh -m 644 icons/hicolor/64x64/mimetypes/*.* /usr/share/icons/hicolor/64x64/mimetypes
+-./install-sh -m 644 icons/hicolor/72x72/mimetypes/*.* /usr/share/icons/hicolor/72x72/mimetypes
+-./install-sh -m 644 icons/hicolor/96x96/mimetypes/*.* /usr/share/icons/hicolor/96x96/mimetypes
+-./install-sh -m 644 icons/hicolor/128x128/mimetypes/*.* /usr/share/icons/hicolor/128x128/mimetypes
+-./install-sh -m 644 icons/hicolor/192x192/mimetypes/*.* /usr/share/icons/hicolor/192x192/mimetypes
+-./install-sh -m 644 icons/hicolor/256x256/mimetypes/*.* /usr/share/icons/hicolor/256x256/mimetypes
+-./install-sh -m 644 icons/hicolor/scalable/mimetypes/*.* /usr/share/icons/hicolor/scalable/mimetypes
++./install-sh -m 644 icons/hicolor/16x16/mimetypes/*.* ${D}/usr/share/icons/hicolor/16x16/mimetypes
++./install-sh -m 644 icons/hicolor/22x22/mimetypes/*.* ${D}/usr/share/icons/hicolor/22x22/mimetypes
++./install-sh -m 644 icons/hicolor/24x24/mimetypes/*.* ${D}/usr/share/icons/hicolor/24x24/mimetypes
++./install-sh -m 644 icons/hicolor/32x32/mimetypes/*.* ${D}/usr/share/icons/hicolor/32x32/mimetypes
++./install-sh -m 644 icons/hicolor/36x36/mimetypes/*.* ${D}/usr/share/icons/hicolor/36x36/mimetypes
++./install-sh -m 644 icons/hicolor/48x48/mimetypes/*.* ${D}/usr/share/icons/hicolor/48x48/mimetypes
++./install-sh -m 644 icons/hicolor/64x64/mimetypes/*.* ${D}/usr/share/icons/hicolor/64x64/mimetypes
++./install-sh -m 644 icons/hicolor/72x72/mimetypes/*.* ${D}/usr/share/icons/hicolor/72x72/mimetypes
++./install-sh -m 644 icons/hicolor/96x96/mimetypes/*.* ${D}/usr/share/icons/hicolor/96x96/mimetypes
++./install-sh -m 644 icons/hicolor/128x128/mimetypes/*.* ${D}/usr/share/icons/hicolor/128x128/mimetypes
++./install-sh -m 644 icons/hicolor/192x192/mimetypes/*.* ${D}/usr/share/icons/hicolor/192x192/mimetypes
++./install-sh -m 644 icons/hicolor/256x256/mimetypes/*.* ${D}/usr/share/icons/hicolor/256x256/mimetypes
++./install-sh -m 644 icons/hicolor/scalable/mimetypes/*.* ${D}/usr/share/icons/hicolor/scalable/mimetypes
diff --git a/sci-mathematics/geogebra/geogebra-4.1.120.0.ebuild b/sci-mathematics/geogebra/geogebra-4.1.120.0.ebuild
new file mode 100644
index 000000000000..5b27243f73d0
--- /dev/null
+++ b/sci-mathematics/geogebra/geogebra-4.1.120.0.ebuild
@@ -0,0 +1,28 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+inherit eutils
+
+DESCRIPTION="Mathematics software for geometry"
+HOMEPAGE="http://www.geogebra.org/cms/en"
+SRC_URI="https://geogebra.googlecode.com/files/GeoGebra-Unixlike-Installer-${PV}.tar.gz"
+
+LICENSE="GPL-3 CC-BY-SA-3.0 BSD public-domain GPL-2 MIT"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE=""
+
+DEPEND=""
+RDEPEND=">=virtual/jdk-1.6.0-r1
+ ${DEPEND}"
+
+src_prepare() {
+ epatch "${FILESDIR}/${PN}-fix-install.sh.patch"
+}
+
+src_install() {
+ ./install.sh || die
+}
diff --git a/sci-mathematics/geogebra/metadata.xml b/sci-mathematics/geogebra/metadata.xml
new file mode 100644
index 000000000000..3b9435b6b002
--- /dev/null
+++ b/sci-mathematics/geogebra/metadata.xml
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+<maintainer>
+ <email>amynka@gentoo.org</email>
+</maintainer>
+<longdescription lang="en">
+ GeoGebra is interactive mathematics software for learning and teaching mathematics
+ and science from primary school up to university level.
+ Constructions can be made with points, vectors, segments, lines, polygons,
+ conic sections, inequalities, implicit polynomials and functions.
+</longdescription>
+</pkgmetadata>
diff --git a/sci-mathematics/geomview/Manifest b/sci-mathematics/geomview/Manifest
new file mode 100644
index 000000000000..ac8133e2efa8
--- /dev/null
+++ b/sci-mathematics/geomview/Manifest
@@ -0,0 +1,2 @@
+DIST geomview-1.9.5.tar.bz2 4532535 SHA256 6b683735582ac4eab7f2618cf924c1244de58dd3ef195d06442aaea54cd9fb40 SHA512 a22bcd254e1e4c5c6797811f315d158f84fe82a3f95646bfdf3be203e9cd7fc8cacbf26f55a0a08bcb47cf2b2ad17ae4b48cdc4d78f810f48dab9fa1c7d56e7f WHIRLPOOL f89188ba357f814408fd8523ec416aab6052c1fb110110547e3e48a6c2d4bd8aa3d14f9d4995173e38714fa69156940950e2e4266d34685159d6ad35279b67f1
+DIST geomview.png.tar 10240 SHA256 cf1f5b94d868d363fa6f251343b1426cc7e9ed36ed8ee1fea4339ccabcba33cb SHA512 3abdc04f04410a50876af6b0f1aefc6891c47926ca9e5a4a31bd001310972996497f4e6c33db059fdbca09b236b7763e5476d75427e653d54861b4b3a4e54f51 WHIRLPOOL fecc6989bbef303b379673a503c322db1c8bbe61c346bc3dee984319eb29537985f2696c5a716e94398eb873fd6ed77a06e2462b615d7d4f22bad0bb033765a3
diff --git a/sci-mathematics/geomview/files/50geomview-gentoo.el b/sci-mathematics/geomview/files/50geomview-gentoo.el
new file mode 100644
index 000000000000..2e078ec06c38
--- /dev/null
+++ b/sci-mathematics/geomview/files/50geomview-gentoo.el
@@ -0,0 +1,7 @@
+
+;;; geomview site-lisp configuration
+
+(add-to-list 'load-path "@SITELISP@")
+(autoload 'gvcl-mode "gvcl-mode"
+ "Major mode for editing Geomview Command Language files." t)
+(add-to-list 'auto-mode-alist '("\\.gcl\\'" . gvcl-mode))
diff --git a/sci-mathematics/geomview/files/gvcl-mode.el b/sci-mathematics/geomview/files/gvcl-mode.el
new file mode 100644
index 000000000000..cbfadafc205f
--- /dev/null
+++ b/sci-mathematics/geomview/files/gvcl-mode.el
@@ -0,0 +1,172 @@
+;;; gvcl-mode.el --- A major mode for editing Geomview Command Language files
+
+;; Copyright (C) 2007 Claus-Justus Heine
+
+;; Author: Claus-Justus Heine
+;; Keywords: extensions
+
+;; This file is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation; either version 2, or (at your option)
+;; any later version.
+
+;; This file is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with GNU Emacs; see the file COPYING. If not, write to
+;; the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+;; Boston, MA 02111-1307, USA.
+
+;;; Commentary:
+
+;; Writing an Emacs major mode is really a non-trivial task. This file
+;; really covers only some basic things (comment-start,
+;; syntax-highlighting, crude indentation support).
+
+;;; Code:
+
+;; Setup
+
+;;First, we define some variables that all modes should
+;;define. gvlisp-mode-hook allows the user to run their own code when
+;;your mode is run
+
+(defvar gvcl-mode-hook nil)
+
+(defvar gvcl-indent-offset 2 "Incremental indentation offset.")
+
+;;Now we create a keymap. This map, here called gvcl-mode-map, allows
+;;both you and users to define their own keymaps. The keymap is
+;;immediately set to a default keymap. Then, using define-key, we
+;;insert an example keybinding into the keymap, which maps the
+;;newline-and-indent function to Control-j (which is actually the
+;;default binding for this function, but is included anyway as an
+;;example). Of course, you may define as many keybindings as you wish.
+;;
+;;If your keymap will have very few entries, then you may want to
+;;consider make-sparse-keymap rather than make-keymap
+(defvar gvcl-mode-map
+ (let ((gvcl-mode-map (make-keymap)))
+ (define-key gvcl-mode-map "\C-j" 'newline-and-indent)
+ gvcl-mode-map)
+ "Keymap for Geomview Command Language major mode.")
+
+;;Here, we append a definition to auto-mode-alist. This tells emacs
+;;that when a buffer with a name ending with .wpd is opened, then
+;;gvcl-mode should be started in that buffer. Some modes leave this
+;;step to the user.
+(add-to-list 'auto-mode-alist '("\\.gcl\\'" . gvcl-mode))
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+
+;; Syntax highlighting using keywords
+
+(defconst gvcl-font-lock-keywords-1
+ (list
+ '("(\\s-*\\(redraw\\|process-events\\|interest\\|time-interests\\|and\\|sleep-\\(for\\|until\\)\\|or\\|hdefine\\|geometry\\|quote\\|eval\\|if\\|while\\|setq\\|echo\\|let\\|exit\\|quit\\|lambda\\|defun\\|progn\\|backcolor\\|read\\|camera\\|new-geometry\\|car\\|cdr\\|cons\\|emodule\\S-*\\|ui-\\S-+\\|normalization\\)\\>" . font-lock-builtin-face)
+ '("\\(\"\\w*\"\\)" . font-lock-variable-name-face))
+ "Minimal highlighting expressions for GVCL mode.")
+
+(defconst gvcl-font-lock-keywords-2
+ (append gvcl-font-lock-keywords-1
+ (list
+ '("\\<\\(\\(location\\|origin\\)\\s-+\\(camera\\|local\\|global\\|ndc\\|screen\\)\\)\\>" . font-lock-constant-face)
+ '("\\<\\(define\\|geom\\(etry\\)?\\|camera\\|window\\|inertia\\|allgeoms\\|focus-change\\)\\>" . font-lock-keyword-face)))
+ "Additional Keywords to highlight in GVCL mode.")
+
+(defconst gvcl-font-lock-keywords-3
+ (append gvcl-font-lock-keywords-2
+ (list
+ '("\\<\\(INST\\|T?LIST\\|\\(ST\\)?Z?u?v?C?N?U?4?n?\\(OFF\\|MESH\\|SKEL\\|VECT\\|QUAD\\|BEZ\\|BBP\\|BBOX\\|SPHERE\\|GROUP\\|DISCGRP\\|COMMENT\\)\\)\\>" . font-lock-type-face)
+ ;; more OOGL keywords
+ '("\\<\\(SINUSOIDAL\\|CYLINDRICAL\\|RECTANGULAR\\|STEREOGRAPHIC\\|ONEFACE\\)\\>" . font-lock-keyword-face)
+ ;; apperance constants
+ '("\\<\\(blend\\|modulate\\|replace\\|decal\\|replacelights\\|face\\|edge\\|vect\\|transparent\\|normal\\|normscale\\|evert\\|texturing\\|mipmap\\|linear\\|mipinterp\\|backcull\\|concave\\|shadelines\\|keepcolor\\|smooth\\|flat\\|constant\\|csmooth\\|vcflat\\|replacelights\\|clamp\\s-+\\(s\\|t\\|st\\|none\\)\\)\\>" . font-lock-constant-face)
+ ;; image constants
+ '("\\<\\(RGB\\|RGBA\\|ALPHA\\|LUMINANCE\\|LUMINANCE_ALPHA\\)\\>" . font-lock-constant-face)
+ ;; image keywords
+ '("\\<\\(inertia\\|width\\|height\\|channels\\|maxval\\|data\\)\\>" . font-lock-keyword-face)
+ ;; apperance keywords
+ '("\\<\\(apply\\|shading\\|localviewer\\|attenconst\\|attenmult2?\\|normscale\\|shading\\|linewidth\\|patchdice\\|ka\\|ambient\\|kd\\|diffuse\\|ks\\|specular\\|shininess\\|backdiffuse\\|alpha\\|edgecolor\\|normalcolor\\|color\\|position\\|file\\|alphafile\\|background\\|texturing\\)\\>" . font-lock-keyword-face)
+ ;; some more types
+ '("\\<\\(texture\\|light\\|material\\|lighting\\|light\\|image\\|appearance\\|n?transforms?\\|tlist\\)\\>" . font-lock-type-face)
+ ;; some more constants
+ '("\\<\\(yes\\|no\\|on\\|off\\|toggle\\|center\\|none\\)\\>" . font-lock-constant-face)
+ ))
+ "Balls-out highlighting in GVCL mode.")
+
+;;I've now defined more GVCL constants. This completes the list of
+;;GVCL keywords.
+
+(defvar gvcl-font-lock-keywords gvcl-font-lock-keywords-3
+ "Default highlighting expressions for GVCL mode.")
+
+;;Here I've defined the default level of highlighting to be the
+;;maximum. This is just my preference\u2014 the user can change this
+;;variable (if the user knows how! This might be something to put in
+;;the documentation for your own mode).
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+
+;; Indentation
+
+(defun gvcl-indent-line ()
+ "Indent current line as GVCL code."
+ (interactive)
+;; (beginning-of-line)
+ (let ((savep (> (current-column) (current-indentation)))
+ (indent (condition-case nil (max (gvcl-calculate-indentation) 0)
+ (error 0))))
+ (if savep
+ (save-excursion (indent-line-to indent))
+ (indent-line-to indent))))
+
+(defun gvcl-calculate-indentation ()
+ "Return the column to which the current line should be indented."
+ (save-excursion
+ (beginning-of-line)
+ (if (< (point) 2)
+ 0
+ (skip-chars-forward " \t")
+ (let ((indent-above (if (eq (char-syntax (following-char)) ?\) )
+ 0
+ gvcl-indent-offset)))
+ (up-list -1)
+ (+ (current-indentation) indent-above)))))
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+
+;; The syntax table
+
+(defvar gvcl-mode-syntax-table
+ (let ((st (make-syntax-table)))
+ (modify-syntax-entry ?_ "w" st)
+ (modify-syntax-entry ?# "<" st)
+ (modify-syntax-entry ?\n ">" st)
+ (modify-syntax-entry ?{ "(}" st)
+ (modify-syntax-entry ?} "){" st)
+ (modify-syntax-entry ?( "()" st)
+ (modify-syntax-entry ?) ")(" st)
+ st)
+ "Syntax table for `gvcl-mode'.")
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+
+;; Derive the stuff from fundamental mode
+
+(define-derived-mode gvcl-mode fundamental-mode "GVCL"
+ "Major mode for editing Geomview Command Language files."
+ (set (make-local-variable 'font-lock-defaults) '(gvcl-font-lock-keywords))
+ (set (make-local-variable 'comment-start) "# ")
+ (set (make-local-variable 'comment-start-skip) "#+\\s-*")
+ (set (make-local-variable 'indent-line-function) 'gvcl-indent-line))
+
+
+(provide 'gvcl-mode)
+
+(provide 'gvcl-mode)
+
+;;; gvcl-mode.el ends here
diff --git a/sci-mathematics/geomview/geomview-1.9.5.ebuild b/sci-mathematics/geomview/geomview-1.9.5.ebuild
new file mode 100644
index 000000000000..09be63e4526c
--- /dev/null
+++ b/sci-mathematics/geomview/geomview-1.9.5.ebuild
@@ -0,0 +1,69 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+inherit elisp-common eutils flag-o-matic fdo-mime
+
+DESCRIPTION="Interactive Geometry Viewer"
+HOMEPAGE="http://geomview.sourceforge.net"
+SRC_URI="mirror://sourceforge/${PN}/${P}.tar.bz2
+ http://dev.gentoo.org/~jlec/distfiles/geomview.png.tar"
+KEYWORDS="~amd64 ~ppc ~sparc ~x86"
+LICENSE="LGPL-2.1"
+SLOT="0"
+IUSE="motionaveraging debug emacs zlib"
+
+DEPEND=">=x11-libs/motif-2.3:0
+ virtual/glu
+ virtual/opengl
+ emacs? ( virtual/emacs )
+ zlib? ( sys-libs/zlib )"
+RDEPEND="${DEPEND}
+ x11-misc/xdg-utils"
+
+S="${WORKDIR}/${P/_/-}"
+
+SITEFILE=50${PN}-gentoo.el
+
+src_configure() {
+ econf --docdir=/usr/share/doc/${PF} \
+ --with-htmlbrowser=xdg-open \
+ --with-pdfviewer=xdg-open \
+ $(use_enable debug d1debug) \
+ $(use_with zlib) \
+ $(use_enable motionaveraging motion-averaging)
+}
+
+src_compile() {
+ default
+ if use emacs; then
+ cp "${FILESDIR}/gvcl-mode.el" "${S}"
+ elisp-compile *.el
+ fi
+}
+
+src_install() {
+ emake DESTDIR="${D}" install
+ dodoc AUTHORS ChangeLog NEWS INSTALL.Geomview || die
+ doicon "${WORKDIR}"/geomview.png || die
+ make_desktop_entry ${PN} "GeomView ${PV}" \
+ /usr/share/pixmaps/${PN}.png \
+ "Science;Math;Education"
+
+ if use emacs; then
+ elisp-install ${PN} *.el *.elc
+ elisp-site-file-install "${FILESDIR}/${SITEFILE}"
+ fi
+}
+
+pkg_postinst() {
+ fdo-mime_desktop_database_update
+ use emacs && elisp-site-regen
+}
+
+pkg_postrm() {
+ fdo-mime_desktop_database_update
+ use emacs && elisp-site-regen
+}
diff --git a/sci-mathematics/geomview/metadata.xml b/sci-mathematics/geomview/metadata.xml
new file mode 100644
index 000000000000..3094fb6de487
--- /dev/null
+++ b/sci-mathematics/geomview/metadata.xml
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <herd>sci-mathematics</herd>
+ <longdescription>Geomview is an interactive geometry viewer and Object Oriented Graphics Library (OOGL).</longdescription>
+ <use>
+ <flag name="motionaveraging">Enable experimental motion averaging technique</flag>
+ </use>
+ <upstream>
+ <remote-id type="sourceforge">geomview</remote-id>
+ </upstream>
+</pkgmetadata>
diff --git a/sci-mathematics/gfan/Manifest b/sci-mathematics/gfan/Manifest
new file mode 100644
index 000000000000..eee9388d133c
--- /dev/null
+++ b/sci-mathematics/gfan/Manifest
@@ -0,0 +1 @@
+DIST gfan0.5.tar.gz 1134987 SHA256 d7307c8979220adc0a7ce5acf472178a6c280c963967df6241392ed9954cc1fb
diff --git a/sci-mathematics/gfan/files/gfan-0.5-double-declare-fix.patch b/sci-mathematics/gfan/files/gfan-0.5-double-declare-fix.patch
new file mode 100644
index 000000000000..239540884011
--- /dev/null
+++ b/sci-mathematics/gfan/files/gfan-0.5-double-declare-fix.patch
@@ -0,0 +1,12 @@
+diff -U 3 -dHrN gfan0.5/app_minkowski.cpp gfan0.5-new/app_minkowski.cpp
+--- gfan0.5/app_minkowski.cpp 2011-01-23 12:21:47.000000000 -0500
++++ gfan0.5-new/app_minkowski.cpp 2012-06-29 15:23:48.604280985 -0400
+@@ -160,7 +160,7 @@
+ //log0 fprintf(Stderr,"4");
+ f.insert(c);
+ //log0 fprintf(Stderr,"5\n");
+- static int i;
++ // static int i;
+ //log0 fprintf(Stderr,"inserted:%i\n",++i);
+ }
+ log1 fprintf(Stderr,"Resolving symmetries.\n");
diff --git a/sci-mathematics/gfan/gfan-0.5.ebuild b/sci-mathematics/gfan/gfan-0.5.ebuild
new file mode 100644
index 000000000000..e08db31f7ee7
--- /dev/null
+++ b/sci-mathematics/gfan/gfan-0.5.ebuild
@@ -0,0 +1,34 @@
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="3"
+
+inherit eutils toolchain-funcs
+
+DESCRIPTION="computes Groebner fans and tropical varities"
+HOMEPAGE="http://www.math.tu-berlin.de/~jensen/software/gfan/gfan.html"
+SRC_URI="http://www.math.tu-berlin.de/~jensen/software/gfan/${PN}${PV}.tar.gz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="amd64 x86 ~amd64-linux ~x86-linux"
+IUSE=""
+
+DEPEND="dev-libs/gmp[cxx]
+ sci-libs/cddlib"
+RDEPEND="${DEPEND}"
+
+S="${WORKDIR}/${PN}${PV}/"
+
+src_prepare () {
+ epatch "${FILESDIR}/${P}-double-declare-fix.patch"
+ sed -i -e "s/-O2/${CXXFLAGS}/" \
+ -e "/GPROFFLAG =/d" \
+ -e "s/g++/$(tc-getCXX)/" \
+ -e "s/\$(CCLINKER)/& \$(LDFLAGS)/" Makefile || die
+}
+
+src_install() {
+ emake PREFIX="${ED}/usr" install || die "emake install failed"
+}
diff --git a/sci-mathematics/gfan/metadata.xml b/sci-mathematics/gfan/metadata.xml
new file mode 100644
index 000000000000..9c8024fff3cc
--- /dev/null
+++ b/sci-mathematics/gfan/metadata.xml
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+<maintainer>
+ <email>tomka@gentoo.org</email>
+ <name>Thomas Kahle</name>
+</maintainer>
+<herd>sci-mathematics</herd>
+ <longdescription lang="en">
+ gfan is a computer algebra tool to compute Groebner fans and tropical varieties.
+</longdescription>
+</pkgmetadata>
diff --git a/sci-mathematics/ggnfs/Manifest b/sci-mathematics/ggnfs/Manifest
new file mode 100644
index 000000000000..11526490e57c
--- /dev/null
+++ b/sci-mathematics/ggnfs/Manifest
@@ -0,0 +1,4 @@
+DIST def-nm-params.txt 3495 SHA256 5febf991cdd4112265bd58379c6d0819e6bb01b6e656902256fe13e4b63ba97c SHA512 b924292bc5354f87a3f88f2c35b767b9183704ced61c0e709cdd0974a2e1f34a4c170c6d12524b10162f63306f74001ad30e82ac7997d98db823006086772460 WHIRLPOOL 9ecabb6bee118269bd4d345582d36f9f82d54585ce7092adb3b6e1d27be4d0297201a408c76bb692047192a996982113d8387aad3c4764062f6d23f2f9febc82
+DIST def-par.txt 4957 SHA256 40d0b9be2c52282f29ff8cbc50799b625fc05b1da6eb7f2070fb3eb2ac81e7fa SHA512 fc0851513b1170e0a43e7458e24da4274146272018b7fefbe35280005ebeba20458756c4d4715b2a98780354dd1c5bcf31d98dd1388f1d352fb718062141c434 WHIRLPOOL 81151ab8235b2b55a7e8ceca4453b49bab3d3109eaf1352808b7e42c3612977402856c518ba8d8a1e5b6b80e33bbc3f33bdc565da5d3ee9e4251a1d253ace496
+DIST ggnfs-0.77.1.zip 2279013 SHA256 f6509661f22c562b3616e99989d39c160e8f49664e1fe3215d2f0d1441003a7a SHA512 77f5050d1310df5de45e80a25c8421cc9240ce11776fc4af596ce19d8b064b926dcc7e6dd7b2ef12d86056f7af0b67db2f746fc261cba24bbcf1efef06287513 WHIRLPOOL 5cb0e67aebd7ed9001ea2347b2211f9ca84ec50d18982436b111c0abb1c3223c66fbb5d029fa38d43e1137e7e7c7087daca85648fba7da92bbfcfe3760ccf87e
+DIST ggnfs-doc.pdf 252344 SHA256 6319442ba7fbeffa7000eb8ded1998877f3ecafc96551fa52c396d7f5d0775f2 SHA512 60f4153dbd31d7484b37a4f805eb71c9a785af884f228039136cd92e64ef145593dc0fde9e6f1c58a11d2d5124760d08d66566134f764e65f7dce86a36a11f01 WHIRLPOOL d93477a474172feb6bcb1db8cad04084496105e990d7906eee839ec49884718c3310e413cdfc6c3a36a42da755cf430a1db337a27a72a152aec6f62b17005758
diff --git a/sci-mathematics/ggnfs/files/ggnfs-0.77.1-gentoo.patch b/sci-mathematics/ggnfs/files/ggnfs-0.77.1-gentoo.patch
new file mode 100644
index 000000000000..ac7516034147
--- /dev/null
+++ b/sci-mathematics/ggnfs/files/ggnfs-0.77.1-gentoo.patch
@@ -0,0 +1,158 @@
+ src/Makefile | 34 +++++++++++++++++-----------------
+ src/lasieve4/Makefile | 6 +++---
+ src/pol5/Makefile | 8 ++++----
+ 3 files changed, 24 insertions(+), 24 deletions(-)
+
+diff --git a/src/Makefile b/src/Makefile
+index 01f66be..59b433f 100644
+--- a/src/Makefile
++++ b/src/Makefile
+@@ -1,15 +1,15 @@
+ # Workaround for PPC
+ # Due to unknown reason -march isn't supported there
+ ifeq ($(ARCH),970)
+- ALLOPT=-mcpu=$(ARCH) -m64 -pipe
++ ALLOPT=
+ else
+- ALLOPT=-march=$(ARCH) -pipe
++ ALLOPT=
+ endif
+
+ INC=-I. -I.. -I../include $(LOCALINC)
+ LIBS=-lgmp -lm
+ BINDIR=../bin
+-LIBFLAGS=$(LOCALLIB)
++LDFLAGS+=$(LOCALLIB)
+
+ MATBUILD_TPIE=0
+ TPIE_DIR=../../tpie
+@@ -17,7 +17,7 @@ TPIE_DIR=../../tpie
+ # Turn on\off workaround for GMP 4.2 bug
+ # Consult http://swox.com/list-archives/gmp-bugs/2006-May/000475.html
+ # for more info
+-GMP_BUG=1
++GMP_BUG=0
+
+ ifeq ($(HOST),generic)
+ ALLOPT+= -DGGNFS_HOST_GENERIC
+@@ -32,10 +32,10 @@ ifeq ($(ARCH),prescott)
+ ALLOPT+= -DL2_CACHE_SIZE=1024
+ endif
+
+-DEBUGOPT=-W -Wall -g -pg
++DEBUGOPT=-W -Wall
+
+-CFLAGS=-DNDEBUG -O3 -funroll-loops -finline-functions \
+- -ftracer -fomit-frame-pointer -W -Wall $(ALLOPT)
++CFLAGS+=-DNDEBUG \
++ -W -Wall $(ALLOPT)
+ # CFLAGS=$(DEBUGOPT) $(ALLOPT)
+ # -ffast-math removed since -funsafe-math-optimizations seems to cause occasional problems, especially in sqrt
+
+@@ -71,7 +71,7 @@ endif
+ ifeq ($(MATBUILD_TPIE),1)
+ BINS+= $(BINDIR)/matbuild-tpie
+ INC+= -I$(TPIE_DIR)/include
+- LIBFLAGS+= -L$(TPIE_DIR)/lib
++ LDFLAGS+= -L$(TPIE_DIR)/lib
+ LIBS+=-ltpie
+ endif
+
+@@ -97,35 +97,35 @@ bins : $(BINS)
+ $(CC) $(CFLAGS) -o $@ -c $*.S
+
+ $(BINDIR)/sieve : sieve.c clsieve.c $(OBJS) makefb.o
+- $(CC) $(INC) $(CFLAGS) $(LIBFLAGS) -o $@ $^ $(LIBS)
++ $(CC) $(INC) $(CFLAGS) $(LDFLAGS) -o $@ $^ $(LIBS)
+
+ $(BINDIR)/makefb : makefb.c $(OBJS)
+- $(CC) $(INC) $(CFLAGS) $(LIBFLAGS) -D_MAKEFB_STANDALONE -o $@ \
++ $(CC) $(INC) $(CFLAGS) $(LDFLAGS) -D_MAKEFB_STANDALONE -o $@ \
+ makefb.c $(OBJS) $(LIBS)
+
+ $(BINDIR)/procrels : procrels.c $(OBJS)
+- $(CC) $(INC) $(CFLAGS) $(LIBFLAGS) -o $@ procrels.c $(OBJS) $(LIBS)
++ $(CC) $(INC) $(CFLAGS) $(LDFLAGS) -o $@ procrels.c $(OBJS) $(LIBS)
+
+ $(BINDIR)/matbuild : matbuild.c $(OBJS)
+- $(CC) $(INC) $(CFLAGS) $(LIBFLAGS) -o $@ matbuild.c combparts.c \
++ $(CC) $(INC) $(CFLAGS) $(LDFLAGS) -o $@ matbuild.c combparts.c \
+ $(OBJS) $(LIBS)
+
+ $(BINDIR)/matbuild-tpie : matbuild.c $(OBJS)
+- $(CPP) $(INC) $(CFLAGS) $(LIBFLAGS) -DGGNFS_TPIE -o $@ matbuild.c \
++ $(CPP) $(INC) $(CFLAGS) $(LDFLAGS) -DGGNFS_TPIE -o $@ matbuild.c \
+ experimental/combparts_tpie.cpp experimental/llist_tpie.cpp \
+ $(OBJS) $(LIBS)
+
+ $(BINDIR)/matprune : matprune.c $(OBJS)
+- $(CC) $(INC) $(CFLAGS) $(LIBFLAGS) -o $@ matprune.c $(OBJS) $(LIBS)
++ $(CC) $(INC) $(CFLAGS) $(LDFLAGS) -o $@ matprune.c $(OBJS) $(LIBS)
+
+ $(BINDIR)/matsolve : matsolve.c $(OBJS)
+- $(CC) $(INC) $(CFLAGS) $(LIBFLAGS) -o $@ matsolve.c $(OBJS) $(LIBS)
++ $(CC) $(INC) $(CFLAGS) $(LDFLAGS) -o $@ matsolve.c $(OBJS) $(LIBS)
+
+ $(BINDIR)/sqrt : sqrt.c $(OBJS)
+- $(CC) $(INC) $(CFLAGS) $(LIBFLAGS) -o $@ sqrt.c $(OBJS) $(LIBS)
++ $(CC) $(INC) $(CFLAGS) $(LDFLAGS) -o $@ sqrt.c $(OBJS) $(LIBS)
+
+ $(BINDIR)/polyselect : polyselect.c $(OBJS)
+- $(CC) $(INC) $(CFLAGS) $(LIBFLAGS) -o $@ polyselect.c $(OBJS) $(LIBS)
++ $(CC) $(INC) $(CFLAGS) $(LDFLAGS) -o $@ polyselect.c $(OBJS) $(LIBS)
+
+ latsiever :
+ $(MAKE) -C lasieve4
+diff --git a/src/lasieve4/Makefile b/src/lasieve4/Makefile
+index 31e05a9..6886b16 100644
+--- a/src/lasieve4/Makefile
++++ b/src/lasieve4/Makefile
+@@ -10,8 +10,8 @@
+ # 6/13/04: Hacked up for use in GGNFS by Chris Monico.
+
+ INC=-I.. -I../../include $(LOCALINC)
+-LIBFLAGS=-L. $(LOCALLIB)
+-CFLAGS+=-Os
++LDFLAGS+=-L. $(LOCALLIB)
++CFLAGS+=
+
+ BINDIR=../../bin
+ FACT=prho.o
+@@ -58,7 +58,7 @@ gnfs-lasieve4eI%.o: gnfs-lasieve4e.c lasieve.h asm/siever-config.h
+
+ $(BINDIR)/gnfs-lasieve4I%e: gnfs-lasieve4eI%.o $(OBJS) libgmp-aux.a \
+ asm/liblasieve.a asm/liblasieveI%.a $(FACT)
+- $(CC) $(CFLAGS) $(INC) $(LIBFLAGS) -o $@ $^ $(LIBS)
++ $(CC) $(CFLAGS) $(INC) $(LDFLAGS) -o $@ $^ $(LIBS)
+
+ asm/lib%.a:
+ $(MAKE) -C asm
+diff --git a/src/pol5/Makefile b/src/pol5/Makefile
+index 44b08be..e474ffb 100644
+--- a/src/pol5/Makefile
++++ b/src/pol5/Makefile
+@@ -1,6 +1,6 @@
+ BINDIR=../../bin
+ INC=-I.. -I../../include $(LOCALINC)
+-LIBFLAGS=$(LOCALLIB)
++LDFLAGS+=$(LOCALLIB)
+ LIBS=-lm -lgmp
+ CFLAGS2=
+
+@@ -46,13 +46,13 @@ all: $(BINS)
+ $(CC) $(INC) -c $(CFLAGS) $(CFLAGS2) $^
+
+ $(BINDIR)/pol51m0b: pol51m0b.o $(OBJS) $(OBJS2)
+- $(CC) $(INC) -o $@ $(CFLAGS) $(CFLAGS2) $^ $(LIBFLAGS) $(LIBS)
++ $(CC) $(INC) $(LDFLAGS) -o $@ $(CFLAGS) $(CFLAGS2) $^ $(LIBS)
+
+ $(BINDIR)/pol51m0n: pol51m0n.o $(OBJS) $(OBJS3)
+- $(CC) $(INC) $(CFLAGS) $(CFLAGS2) -o $@ $^ $(LIBFLAGS) $(LIBS)
++ $(CC) $(INC) $(CFLAGS) $(CFLAGS2) $(LDFLAGS) -o $@ $^ $(LIBS)
+
+ $(BINDIR)/pol51opt: pol51opt.o $(OBJS) $(OBJS4)
+- $(CC) $(INC) $(CFLAGS) $(CFLAGS2) -o $@ $^ $(LIBFLAGS) $(LIBS)
++ $(CC) $(INC) $(CFLAGS) $(CFLAGS2) $(LDFLAGS) -o $@ $^ $(LIBS)
+
+ clean : ;
+ rm -f $(BINS) *.o core
diff --git a/sci-mathematics/ggnfs/ggnfs-0.77.1-r2.ebuild b/sci-mathematics/ggnfs/ggnfs-0.77.1-r2.ebuild
new file mode 100644
index 000000000000..30cf4c9e1c79
--- /dev/null
+++ b/sci-mathematics/ggnfs/ggnfs-0.77.1-r2.ebuild
@@ -0,0 +1,67 @@
+# Copyright 1999-2013 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+inherit eutils
+
+DESCRIPTION="A suite of algorithms to help factoring large integers"
+# inactive old homepage exists, this is a fork
+HOMEPAGE="https://github.com/radii/ggnfs"
+# snapshot because github makes people stupid
+SRC_URI="
+ http://dev.gentooexperimental.org/~dreeevil/${P}.zip
+ http://stuff.mit.edu/afs/sipb/project/pari-gp/ggnfs/Linux/src/def-par.txt
+ http://stuff.mit.edu/afs/sipb/project/pari-gp/ggnfs/Linux/src/def-nm-params.txt
+ http://gentooexperimental.org/~patrick/ggnfs-doc.pdf"
+
+SLOT="0"
+LICENSE="GPL-2"
+KEYWORDS="~amd64 ~x86"
+IUSE=""
+
+DEPEND=">=dev-libs/gmp-4.3:0
+ app-arch/unzip"
+RDEPEND="${DEPEND}
+ !sci-mathematics/cado-nfs" # file collisions, fixable
+
+S=${WORKDIR}/${PN}-master
+
+src_prepare() {
+ epatch "${FILESDIR}"/${P}-gentoo.patch
+ echo "#define GGNFS_VERSION \"0.77.1-$ARCH\"" > include/version.h || die
+ # fix directory symlink, add missing targets, rewrite variable used by portage internally
+ cd src/lasieve4 && rm -f -r asm && ln -s ppc32 asm || die
+ sed -i -e 's/all: liblasieve.a/all: liblasieve.a liblasieveI11.a liblasieveI15.a liblasieveI16.a/' asm/Makefile || die
+ cd "${S}"
+ sed -i -e 's/ARCH/MARCH/g' Makefile src/Makefile || die
+ sed -i -e 's/$(LSBINS) strip/$(LSBINS)/' src/Makefile || die #No stripping!
+ sed -i -e 's/SVN \$Revision\$/0.77.1 snapshot/' src/experimental/lasieve4_64/gnfs-lasieve4e.c src/lasieve4/gnfs-lasieve4e.c || die
+ tc-export CC
+}
+
+src_configure() { :; }
+
+src_compile() {
+ # setting MARCH like this is fugly, but it uses -march=$ARCH - better fix welcome
+ # it also assumes a recent-ish compiler
+ cd src
+ HOST="generic" MARCH="${ARCH}" emake -j1
+}
+
+src_install() {
+ mkdir -p "${D}/usr/bin/"
+ for i in gnfs-lasieve4I11e gnfs-lasieve4I12e gnfs-lasieve4I13e gnfs-lasieve4I14e \
+ gnfs-lasieve4I15e gnfs-lasieve4I16e makefb matbuild matprune matsolve pol51m0b pol51m0n \
+ pol51opt polyselect procrels sieve sqrt; do
+ cp "${S}/bin/${i}" "${D}/usr/bin/" || die
+ done
+ mkdir -p "${D}/usr/share/doc/${PN}"
+ cp "${DISTDIR}/def-par.txt" "${D}/usr/share/doc/${PN}" || die
+ cp "${DISTDIR}/def-nm-params.txt" "${D}/usr/share/doc/${PN}" || die
+ docompress -x "/usr/share/doc/${PN}/def-par.txt"
+ docompress -x "/usr/share/doc/${PN}/def-nm-params.txt"
+ # TODO: docs? File collisions?
+ cp ${DISTDIR}/ggnfs-doc.pdf "${D}/usr/share/doc/${PN}" || die
+}
diff --git a/sci-mathematics/ggnfs/metadata.xml b/sci-mathematics/ggnfs/metadata.xml
new file mode 100644
index 000000000000..b5260b94eb22
--- /dev/null
+++ b/sci-mathematics/ggnfs/metadata.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <maintainer>
+ <email>patrick@gentoo.org</email>
+ <name>Patrick Lauer</name>
+ </maintainer>
+ <upstream>
+ <remote-id type="github">radii/ggnfs</remote-id>
+ </upstream>
+</pkgmetadata>
diff --git a/sci-mathematics/gimps/Manifest b/sci-mathematics/gimps/Manifest
new file mode 100644
index 000000000000..47f3c2419da0
--- /dev/null
+++ b/sci-mathematics/gimps/Manifest
@@ -0,0 +1,6 @@
+DIST p95v279.linux32.tar.gz 4539547 SHA256 500d7e0f5a6f19084bdc439f25532ca0b8609ceb4fe88f792fbc01dd844abdbe SHA512 a4391e3767492cd427390206e5e5cd1da70b062214cd2e067914c18df76d8dd4688991e3269cb22f9ea006f208b3659e0940ed555f36749189cc58dad6457254 WHIRLPOOL e6ecc301dcc558906ea523c94ea8cb61c99505de6f171f0b070c75b0999edb9155aa1c2c15aa5c3b6a579fd72aba12c1ff08ff3e0377d7a50e30f7333221cebc
+DIST p95v279.linux64.tar.gz 4873050 SHA256 7fb64f49f4825945d0ed470ecaa12f4b1ffc62c5e56edc7a181fb0751785692d SHA512 555a53f46f49131b737b44bd8a8fca018e40812beefd0fe4bc452501c65e68c892460aa3c816bc8f9d38d62f1afd0d031a51aa0936f103bb0f8b9272947bd697 WHIRLPOOL 3424ace005d9453a5ec2633d02f03cbf37bd32ec8bc8c87478ba09c4c6046016b658f2a21a320a62ab2cdb68c9ec1c492006b9a5a7a607fd57c4257caf856e97
+DIST p95v285.linux32.tar.gz 4608961 SHA256 534b7e5ab5e1574b51a2bb2928f057f91d375f49a5ba9507be1638544a6d431e SHA512 7fcf6d3f746a1af9421f00938524c86c1d72d34006505144389719aa18557318b3849f9202b122e5732b7d4a80a5d6df3b08d751617074bf6dd36002c5d1d399 WHIRLPOOL 257cf83598c0b83b11e2645541b30ef5cafa9728148b131504c81d52513610ac00194d24b6a77f162499c0fbad3ea9443d76ab3bb38fc291b998a54a0c78c7d4
+DIST p95v285.linux64.tar.gz 5658391 SHA256 185959f251f1c91591ced4436065e6837758e7d0fcce6cceaba04c4ba4161313 SHA512 1076fbec085fe18db665d538e54f1c7b6272aee5a9886f5a5c5528713435610c6c45a076cc9c40e2b7fcb72a83feb3b9051c6d78a00c623194668b0f023b0a80 WHIRLPOOL a792867121732fff818bf7be148f8da4d6386d2bc81d0b0cf0da639787a1f8cea04796e902c7df480f1f7a31f93c2e26710232a570ff3da07ecf09d25b47e259
+DIST p95v286.linux32.tar.gz 4610624 SHA256 dc4e90670c984e2e2628022b9e7347220e50e06f4d17c3bce21ffd743aeb26fb SHA512 fc78c06eea5850b84f4f8d62c042a0cac1280711a40a55c78cf31610acfeb55773098041c4bf93c2e89e7e2b32f37da4d9d714bfc69116cb3131fc3bf7137d2c WHIRLPOOL 4dab596cd6503df2370faaf111c32affe6cbdafa75b225c40f88c45856d9f33ec4b9072e115b69af3116c5679e77a8c528f13356abdd3f6b7c4c4db8a7f99391
+DIST p95v286.linux64.tar.gz 5661343 SHA256 50e86250e774ffb4120a17cf778411cac62a9ffa41e32ccf532f99eff3660f28 SHA512 b6fa3ff241feeca98dae7792d4912f491911a70a33ba243fac38ca43ba31fe1fddb6dea37670f082e6efa91abd24e0443143b031697d135cd270efa3d3998469 WHIRLPOOL 05dcd380528f1bc79303609174c65174e19f67b828245860b0516666b1b146331fb1148a007d1285be0dbd2e4ae73e53ced5dff5f59e37b524a9e3ab3176f87f
diff --git a/sci-mathematics/gimps/files/gimps-25.6-conf.d b/sci-mathematics/gimps/files/gimps-25.6-conf.d
new file mode 100644
index 000000000000..4b98e1dbc28b
--- /dev/null
+++ b/sci-mathematics/gimps/files/gimps-25.6-conf.d
@@ -0,0 +1,12 @@
+# Config file for /etc/init.d/gimps
+
+USER="nobody"
+GROUP="nobody"
+
+# set up any options you want for GIMPS
+# for more info, `mprime -h`
+# GIMPS_OPTIONS=""
+
+# this is the directory where GIMPS run-time
+# data files will be stored
+GIMPS_DIR=/var/lib/gimps
diff --git a/sci-mathematics/gimps/files/gimps-26.6-r1-init.d b/sci-mathematics/gimps/files/gimps-26.6-r1-init.d
new file mode 100644
index 000000000000..dfee0e8c0c3e
--- /dev/null
+++ b/sci-mathematics/gimps/files/gimps-26.6-r1-init.d
@@ -0,0 +1,37 @@
+#!/sbin/runscript
+# Copyright 1999-2011 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+depend() {
+ need net
+}
+
+checkconfig() {
+ if [ ! -e "${GIMPS_DIR}" ]; then
+ einfo "Creating ${GIMPS_DIR}"
+ /bin/mkdir "${GIMPS_DIR}"
+ fi
+
+ /bin/chown -R ${USER}:${GROUP} ${GIMPS_DIR}
+
+ if [ ! -e "${GIMPS_DIR}/local.txt" ]; then
+ eerror "GIMPS has not been configured. Please configure it manually before"
+ eerror "starting this initscript."
+ return 1
+ fi
+}
+
+start() {
+ checkconfig || return 1
+ ebegin "Starting GIMPS"
+ start-stop-daemon --quiet --start -b --exec /opt/gimps/mprime \
+ --chdir ${GIMPS_DIR} --user ${USER}:${GROUP} \
+ -- -w${GIMPS_DIR} ${GIMPS_OPTIONS}
+ eend $?
+}
+
+stop() {
+ ebegin "Stopping GIMPS"
+ start-stop-daemon --quiet --stop --exec /opt/gimps/mprime
+ eend $?
+}
diff --git a/sci-mathematics/gimps/files/gimps.service b/sci-mathematics/gimps/files/gimps.service
new file mode 100644
index 000000000000..d3436717b175
--- /dev/null
+++ b/sci-mathematics/gimps/files/gimps.service
@@ -0,0 +1,14 @@
+[Unit]
+Description=Great Internet Mersenne Prime Search client
+After=network.target local-fs.target
+Wants=local-fs.target
+
+[Service]
+User=nobody
+Group=nobody
+ExecStart=/opt/gimps/mprime -w/var/lib/gimps
+StandardOutput=null
+StandardError=journal
+
+[Install]
+WantedBy=multi-user.target
diff --git a/sci-mathematics/gimps/files/gimps.tmpfiles b/sci-mathematics/gimps/files/gimps.tmpfiles
new file mode 100644
index 000000000000..c965e7de5352
--- /dev/null
+++ b/sci-mathematics/gimps/files/gimps.tmpfiles
@@ -0,0 +1 @@
+d /var/lib/gimps 0755 nobody nobody -
diff --git a/sci-mathematics/gimps/gimps-27.9-r2.ebuild b/sci-mathematics/gimps/gimps-27.9-r2.ebuild
new file mode 100644
index 000000000000..0a48670de022
--- /dev/null
+++ b/sci-mathematics/gimps/gimps-27.9-r2.ebuild
@@ -0,0 +1,66 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=4
+
+inherit pax-utils systemd
+
+DESCRIPTION="The Great Internet Mersenne Prime Search"
+HOMEPAGE="http://mersenne.org/"
+SRC_URI="
+ amd64? ( ftp://mersenne.org/gimps/p95v${PV/./}.linux64.tar.gz )
+ x86? ( ftp://mersenne.org/gimps/p95v${PV/./}.linux32.tar.gz )"
+
+SLOT="0"
+LICENSE="GIMPS"
+KEYWORDS="-* amd64 x86"
+IUSE=""
+
+# Since there are no statically linked binaries for this version of mprime,
+# and no static binaries for amd64 in general, we use the dynamically linked
+# ones and try to cover the .so deps with the packages listed in RDEPEND.
+DEPEND=""
+RDEPEND="net-misc/curl"
+
+S="${WORKDIR}"
+I="/opt/gimps"
+
+QA_PREBUILT="opt/gimps/mprime"
+
+src_install() {
+ dodir ${I} /var/lib/gimps
+ pax-mark m mprime
+ cp mprime "${D}/${I}"
+ fperms a-w "${I}/mprime"
+ fowners root:0 "${I}"
+ fowners root:0 "${I}/mprime"
+
+ dodoc license.txt readme.txt stress.txt whatsnew.txt undoc.txt
+
+ newinitd "${FILESDIR}/${PN}-26.6-r1-init.d" gimps
+ newconfd "${FILESDIR}/${PN}-25.6-conf.d" gimps
+
+ systemd_dounit "${FILESDIR}/${PN}.service"
+ systemd_newtmpfilesd "${FILESDIR}/${PN}.tmpfiles" "${PN}.conf"
+}
+
+pkg_postinst() {
+ echo
+ einfo "You can use \`/etc/init.d/gimps start\` to start a GIMPS client in the"
+ einfo "background at boot. Have a look at /etc/conf.d/gimps and check some"
+ einfo "configuration options."
+ einfo
+ einfo "If you don't want to use the init script to start gimps, remember to"
+ einfo "pass it an additional command line parameter specifying where the data"
+ einfo "files are to be stored, e.g.:"
+ einfo " ${I}/mprime -w/var/lib/gimps"
+ echo
+}
+
+pkg_postrm() {
+ echo
+ einfo "GIMPS data files were not removed."
+ einfo "Remove them manually from /var/lib/gimps/"
+ echo
+}
diff --git a/sci-mathematics/gimps/gimps-28.5.ebuild b/sci-mathematics/gimps/gimps-28.5.ebuild
new file mode 100644
index 000000000000..0a48670de022
--- /dev/null
+++ b/sci-mathematics/gimps/gimps-28.5.ebuild
@@ -0,0 +1,66 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=4
+
+inherit pax-utils systemd
+
+DESCRIPTION="The Great Internet Mersenne Prime Search"
+HOMEPAGE="http://mersenne.org/"
+SRC_URI="
+ amd64? ( ftp://mersenne.org/gimps/p95v${PV/./}.linux64.tar.gz )
+ x86? ( ftp://mersenne.org/gimps/p95v${PV/./}.linux32.tar.gz )"
+
+SLOT="0"
+LICENSE="GIMPS"
+KEYWORDS="-* amd64 x86"
+IUSE=""
+
+# Since there are no statically linked binaries for this version of mprime,
+# and no static binaries for amd64 in general, we use the dynamically linked
+# ones and try to cover the .so deps with the packages listed in RDEPEND.
+DEPEND=""
+RDEPEND="net-misc/curl"
+
+S="${WORKDIR}"
+I="/opt/gimps"
+
+QA_PREBUILT="opt/gimps/mprime"
+
+src_install() {
+ dodir ${I} /var/lib/gimps
+ pax-mark m mprime
+ cp mprime "${D}/${I}"
+ fperms a-w "${I}/mprime"
+ fowners root:0 "${I}"
+ fowners root:0 "${I}/mprime"
+
+ dodoc license.txt readme.txt stress.txt whatsnew.txt undoc.txt
+
+ newinitd "${FILESDIR}/${PN}-26.6-r1-init.d" gimps
+ newconfd "${FILESDIR}/${PN}-25.6-conf.d" gimps
+
+ systemd_dounit "${FILESDIR}/${PN}.service"
+ systemd_newtmpfilesd "${FILESDIR}/${PN}.tmpfiles" "${PN}.conf"
+}
+
+pkg_postinst() {
+ echo
+ einfo "You can use \`/etc/init.d/gimps start\` to start a GIMPS client in the"
+ einfo "background at boot. Have a look at /etc/conf.d/gimps and check some"
+ einfo "configuration options."
+ einfo
+ einfo "If you don't want to use the init script to start gimps, remember to"
+ einfo "pass it an additional command line parameter specifying where the data"
+ einfo "files are to be stored, e.g.:"
+ einfo " ${I}/mprime -w/var/lib/gimps"
+ echo
+}
+
+pkg_postrm() {
+ echo
+ einfo "GIMPS data files were not removed."
+ einfo "Remove them manually from /var/lib/gimps/"
+ echo
+}
diff --git a/sci-mathematics/gimps/gimps-28.6.ebuild b/sci-mathematics/gimps/gimps-28.6.ebuild
new file mode 100644
index 000000000000..0a48670de022
--- /dev/null
+++ b/sci-mathematics/gimps/gimps-28.6.ebuild
@@ -0,0 +1,66 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=4
+
+inherit pax-utils systemd
+
+DESCRIPTION="The Great Internet Mersenne Prime Search"
+HOMEPAGE="http://mersenne.org/"
+SRC_URI="
+ amd64? ( ftp://mersenne.org/gimps/p95v${PV/./}.linux64.tar.gz )
+ x86? ( ftp://mersenne.org/gimps/p95v${PV/./}.linux32.tar.gz )"
+
+SLOT="0"
+LICENSE="GIMPS"
+KEYWORDS="-* amd64 x86"
+IUSE=""
+
+# Since there are no statically linked binaries for this version of mprime,
+# and no static binaries for amd64 in general, we use the dynamically linked
+# ones and try to cover the .so deps with the packages listed in RDEPEND.
+DEPEND=""
+RDEPEND="net-misc/curl"
+
+S="${WORKDIR}"
+I="/opt/gimps"
+
+QA_PREBUILT="opt/gimps/mprime"
+
+src_install() {
+ dodir ${I} /var/lib/gimps
+ pax-mark m mprime
+ cp mprime "${D}/${I}"
+ fperms a-w "${I}/mprime"
+ fowners root:0 "${I}"
+ fowners root:0 "${I}/mprime"
+
+ dodoc license.txt readme.txt stress.txt whatsnew.txt undoc.txt
+
+ newinitd "${FILESDIR}/${PN}-26.6-r1-init.d" gimps
+ newconfd "${FILESDIR}/${PN}-25.6-conf.d" gimps
+
+ systemd_dounit "${FILESDIR}/${PN}.service"
+ systemd_newtmpfilesd "${FILESDIR}/${PN}.tmpfiles" "${PN}.conf"
+}
+
+pkg_postinst() {
+ echo
+ einfo "You can use \`/etc/init.d/gimps start\` to start a GIMPS client in the"
+ einfo "background at boot. Have a look at /etc/conf.d/gimps and check some"
+ einfo "configuration options."
+ einfo
+ einfo "If you don't want to use the init script to start gimps, remember to"
+ einfo "pass it an additional command line parameter specifying where the data"
+ einfo "files are to be stored, e.g.:"
+ einfo " ${I}/mprime -w/var/lib/gimps"
+ echo
+}
+
+pkg_postrm() {
+ echo
+ einfo "GIMPS data files were not removed."
+ einfo "Remove them manually from /var/lib/gimps/"
+ echo
+}
diff --git a/sci-mathematics/gimps/metadata.xml b/sci-mathematics/gimps/metadata.xml
new file mode 100644
index 000000000000..81018d3a8353
--- /dev/null
+++ b/sci-mathematics/gimps/metadata.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <herd>sci-mathematics</herd>
+ <maintainer>
+ <email>tomka@gentoo.org</email>
+ <name>Thomas Kahle</name>
+ </maintainer>
+</pkgmetadata>
diff --git a/sci-mathematics/ginac/Manifest b/sci-mathematics/ginac/Manifest
new file mode 100644
index 000000000000..9fafd43dd3e4
--- /dev/null
+++ b/sci-mathematics/ginac/Manifest
@@ -0,0 +1,3 @@
+DIST ginac-1.5.8.tar.bz2 1003965 SHA256 8ce72e70f7539e9a2b32539e13eb651fd688d1423dd90bcf0b9c37b592cfc2dd
+DIST ginac-1.6.1.tar.bz2 1048724 SHA256 0658c4a528f37871c5ec24496373fede4e3e59d3223beaf880c75f07a9c2f680
+DIST ginac-1.6.2.tar.bz2 1048764 SHA256 0f34d255024b3fb258e44da84f9e82dfb3dc9bc15f0999b7a18204a730663bde SHA512 6625f9958a1a6167e49d3a3ca442855fa1eab88926565747fda70a8b770db34da0c001f175fa94102ecec1f823d921eba9c98daabd6ed63548bff2b31a3b49cb WHIRLPOOL 40442b8c5820165f4970e95107ce2ac8e22d1c39b60be615d00eefe1f94e061eb6407cf3e8c0bfab15b4b9974168c97ece6cc188c76a8e9484ad9ff065f87962
diff --git a/sci-mathematics/ginac/files/ginac-1.5.1-pkgconfig.patch b/sci-mathematics/ginac/files/ginac-1.5.1-pkgconfig.patch
new file mode 100644
index 000000000000..5a6784d6b802
--- /dev/null
+++ b/sci-mathematics/ginac/files/ginac-1.5.1-pkgconfig.patch
@@ -0,0 +1,9 @@
+--- ginac-1.4.4.org/ginac.pc.in 2009-03-16 21:17:22.000000000 +0530
++++ ginac-1.4.4/ginac.pc.in 2009-03-16 21:25:28.000000000 +0530
+@@ -7,5 +7,5 @@
+ Description: C++ library for symbolic calculations
+ Version: @VERSION@
+ Requires: cln >= 1.1.6
+-Libs: -L${libdir} -lginac @GINACLIB_RPATH@
++Libs: -L${libdir} -lginac
+ Cflags: -I${includedir}
diff --git a/sci-mathematics/ginac/ginac-1.5.8.ebuild b/sci-mathematics/ginac/ginac-1.5.8.ebuild
new file mode 100644
index 000000000000..e790ea18fb0b
--- /dev/null
+++ b/sci-mathematics/ginac/ginac-1.5.8.ebuild
@@ -0,0 +1,59 @@
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=2
+inherit eutils
+
+DESCRIPTION="C++ library and tools for symbolic calculations"
+SRC_URI="ftp://ftpthep.physik.uni-mainz.de/pub/GiNaC/${P}.tar.bz2"
+HOMEPAGE="http://www.ginac.de/"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="amd64 ppc x86"
+IUSE="doc"
+
+RDEPEND=">=sci-libs/cln-1.2.2"
+DEPEND="${RDEPEND}
+ virtual/pkgconfig
+ doc? ( app-doc/doxygen
+ media-gfx/transfig
+ virtual/texi2dvi
+ dev-texlive/texlive-fontsrecommended
+ )"
+
+src_prepare() {
+ epatch "${FILESDIR}"/${PN}-1.5.1-pkgconfig.patch
+}
+
+src_compile() {
+ emake || die "emake failed"
+ if use doc; then
+ export VARTEXFONTS="${T}"/fonts
+ cd "${S}/doc/reference"
+ #pdf generation for reference failed (1.5.1), bug #264774
+ #emake html pdf || die "emake doc reference failed"
+ emake html || die "emake ref failed"
+ cd "${S}/doc/tutorial"
+ emake ginac.pdf ginac.html || die "emake doc tutorial failed"
+ fi
+}
+
+src_install() {
+ emake DESTDIR="${D}" install || die "emake install failed"
+ dodoc README NEWS AUTHORS || die
+
+ if use doc; then
+ cd doc
+ insinto /usr/share/doc/${PF}
+ newins tutorial/ginac.pdf tutorial.pdf || die "tutorial install failed"
+ #newins reference/ginac.pdf reference.pdf || die "ref install failed"
+ insinto /usr/share/doc/${PF}/html/reference
+ doins -r reference/html_files/* || die
+ insinto /usr/share/doc/${PF}/html
+ newins tutorial/ginac.html tutorial.html
+ insinto /usr/share/doc/${PF}/examples
+ doins examples/*.cpp examples/ginac-examples.txt
+ fi
+}
diff --git a/sci-mathematics/ginac/ginac-1.6.1.ebuild b/sci-mathematics/ginac/ginac-1.6.1.ebuild
new file mode 100644
index 000000000000..a7b49f90b918
--- /dev/null
+++ b/sci-mathematics/ginac/ginac-1.6.1.ebuild
@@ -0,0 +1,62 @@
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=4
+inherit eutils
+
+DESCRIPTION="C++ library and tools for symbolic calculations"
+SRC_URI="ftp://ftpthep.physik.uni-mainz.de/pub/GiNaC/${P}.tar.bz2"
+HOMEPAGE="http://www.ginac.de/"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~amd64 ~ppc ~x86"
+IUSE="doc static-libs"
+
+RDEPEND=">=sci-libs/cln-1.2.2"
+DEPEND="${RDEPEND}
+ virtual/pkgconfig
+ doc? ( app-doc/doxygen
+ media-gfx/transfig
+ virtual/texi2dvi
+ dev-texlive/texlive-fontsrecommended
+ )"
+
+src_prepare() {
+ epatch "${FILESDIR}"/${PN}-1.5.1-pkgconfig.patch
+}
+
+src_configure() {
+ econf \
+ --disable-rpath \
+ $(use_enable static-libs static)
+}
+
+src_compile() {
+ emake
+ if use doc; then
+ export VARTEXFONTS="${T}"/fonts
+ cd "${S}/doc/reference"
+ #pdf generation for reference failed (1.5.1), bug #264774
+ #emake html pdf || die "emake doc reference failed"
+ emake html
+ cd "${S}/doc/tutorial"
+ emake ginac.pdf ginac.html
+ fi
+}
+
+src_install() {
+ default
+ if use doc; then
+ cd doc
+ insinto /usr/share/doc/${PF}
+ newins tutorial/ginac.pdf tutorial.pdf
+ insinto /usr/share/doc/${PF}/html/reference
+ doins -r reference/html_files/*
+ insinto /usr/share/doc/${PF}/html
+ newins tutorial/ginac.html tutorial.html
+ insinto /usr/share/doc/${PF}/examples
+ doins examples/*.cpp examples/ginac-examples.txt
+ fi
+}
diff --git a/sci-mathematics/ginac/ginac-1.6.2.ebuild b/sci-mathematics/ginac/ginac-1.6.2.ebuild
new file mode 100644
index 000000000000..14791558d1a7
--- /dev/null
+++ b/sci-mathematics/ginac/ginac-1.6.2.ebuild
@@ -0,0 +1,60 @@
+# Copyright 1999-2013 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+inherit autotools-utils
+
+DESCRIPTION="C++ library and tools for symbolic calculations"
+SRC_URI="ftp://ftpthep.physik.uni-mainz.de/pub/GiNaC/${P}.tar.bz2"
+HOMEPAGE="http://www.ginac.de/"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~amd64 ~ppc ~x86 ~amd64-linux ~x86-linux"
+IUSE="doc static-libs"
+
+RDEPEND=">=sci-libs/cln-1.2.2"
+DEPEND="${RDEPEND}
+ virtual/pkgconfig
+ doc? ( app-doc/doxygen
+ media-gfx/transfig
+ virtual/texi2dvi
+ dev-texlive/texlive-fontsrecommended
+ )"
+
+PATCHES=( "${FILESDIR}"/${PN}-1.5.1-pkgconfig.patch )
+
+src_configure() {
+ local myeconfargs=( --disable-rpath )
+ autotools-utils_src_configure
+}
+
+src_compile() {
+ autotools-utils_src_compile
+ if use doc; then
+ export VARTEXFONTS="${T}"/fonts
+ cd "${BUILD_DIR}/doc/reference"
+ #pdf generation for reference failed (1.6.2), bug #264774
+ #emake html pdf
+ emake html
+ cd "${BUILD_DIR}/doc/tutorial"
+ emake ginac.pdf ginac.html
+ fi
+}
+
+src_install() {
+ autotools-utils_src_install
+ if use doc; then
+ cd ${BUILD_DIR}/doc
+ insinto /usr/share/doc/${PF}
+ newins tutorial/ginac.pdf tutorial.pdf
+ insinto /usr/share/doc/${PF}/html/reference
+ doins -r reference/html_files/*
+ insinto /usr/share/doc/${PF}/html
+ newins tutorial/ginac.html tutorial.html
+ insinto /usr/share/doc/${PF}/examples
+ doins "${S}"/doc/examples/*.cpp examples/ginac-examples.*
+ fi
+}
diff --git a/sci-mathematics/ginac/metadata.xml b/sci-mathematics/ginac/metadata.xml
new file mode 100644
index 000000000000..307010c65aa3
--- /dev/null
+++ b/sci-mathematics/ginac/metadata.xml
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+<herd>sci-mathematics</herd>
+<longdescription lang="en">
+ GiNaC is an iterated and recursive acronym for GiNaC is Not a CAS,
+ where CAS stands for Computer Algebra System. It is designed to allow
+ the creation of integrated systems that embed symbolic manipulations
+ together with more established areas of computer science (like
+ computation-intense numeric applications, graphical interfaces, etc.)
+ under one roof.
+</longdescription>
+</pkgmetadata>
diff --git a/sci-mathematics/glpk/Manifest b/sci-mathematics/glpk/Manifest
new file mode 100644
index 000000000000..0a4f763600c4
--- /dev/null
+++ b/sci-mathematics/glpk/Manifest
@@ -0,0 +1,4 @@
+DIST glpk-4.45.tar.gz 3132439 SHA256 9207cb613d4436d9a66bc1b1f2018176d106cef0e92a3a85500feeec373be98c SHA512 27089b760d89ee16c5a3332d319007af4b05e8d27df0b990311508f856a01461d8b7b40b111bbf1f3dd4d754af84000112f95349d5286e6d3e42e56226f98649 WHIRLPOOL 7c050210e29f4c13b39e85dc10c9aeed846d7ee912c7dac5a83d13b87648a4e4bf4dce365d2575b6ad7994c56570d74ec87c219f101aaccbec39fd0e14353182
+DIST glpk-4.48.tar.gz 3488482 SHA256 abc2c8f895b20a91cdfcfc04367a0bc8677daf8b4ec3f3e86c5b71c79ac6adb1 SHA512 16795e6cf4db302f25e06e5c9a660e5ed8c7b24ffc5126cde0f864e83fa77d4d61838eab4f716291d568963dddf7442a36a39425a62bd58bd00ca73dac4ffa70 WHIRLPOOL c3e826d08cc6033e8553d7d1fb2a556d42622f38a184e8bbc18bf29d872103245218482b749bfb214cf707cc60eaaf54d7e6840537b483cf8e63c2d33b2c313d
+DIST glpk-4.54.tar.gz 3098202 SHA256 ab72c8078402d34d176eda18c3f9a6ef006e223d530897a4d1d73fb4ad12f9a1 SHA512 7eb815a6d8416dd9f2bb94e9a4aef493c171898404ebc6276fcc1c4f3b4244220213a2bd098707104589348080820a7cb8a717aab73ca513f05b2f9a10aea070 WHIRLPOOL 56ff0baf5e98fdc8e12e4d4db664a4a287dc358dd75839d90d463c04e3e7d97b1023ea93217dd642f6737cccddecdb8f534980e48f8893aff395dc430622de69
+DIST glpk-4.55.tar.gz 3424345 SHA256 37090d7f16796ec1034496e182a39d5cc8bb7c9fb5dc48a38b13d620bf2b1de7 SHA512 a0c8ce0c850e0075098f0526db8f7584a86d5cb44d8ddefa55abf9f1f66af89f5aec19cf1cad51fc5585d8dfa50eab6ece984a038e00c472aec2ef1473eac689 WHIRLPOOL 4b3f543c862008dd09e867947c0383eb2f482f63b8fe30d9f682ccc7d0af1693af043c8cd63362be1bc736ef39393d59cdf0196326b08c7f48495bb5b5937487
diff --git a/sci-mathematics/glpk/files/glpk-4.52.1-mariadb-5.5.patch b/sci-mathematics/glpk/files/glpk-4.52.1-mariadb-5.5.patch
new file mode 100644
index 000000000000..06aa8e5de95c
--- /dev/null
+++ b/sci-mathematics/glpk/files/glpk-4.52.1-mariadb-5.5.patch
@@ -0,0 +1,11 @@
+--- glpk-4.52.1/src/glpsql.c.orig 2014-02-05 22:14:21.487843989 +0100
++++ glpk-4.52.1/src/glpsql.c 2014-02-05 22:14:32.764510562 +0100
+@@ -1106,8 +1106,6 @@
+ #define byte_defined 1
+ #endif
+
+-#include <my_global.h>
+-#include <my_sys.h>
+ #include <mysql.h>
+
+ struct db_mysql
diff --git a/sci-mathematics/glpk/files/glpk-4.53-debundle-system-libs.patch b/sci-mathematics/glpk/files/glpk-4.53-debundle-system-libs.patch
new file mode 100644
index 000000000000..326e61301541
--- /dev/null
+++ b/sci-mathematics/glpk/files/glpk-4.53-debundle-system-libs.patch
@@ -0,0 +1,87 @@
+Remove suitesparse (camd,colamd) and zlib bundles
+
+--- configure.ac.orig 2014-03-24 10:40:24.406906149 -0700
++++ configure.ac 2014-03-24 10:41:15.637207696 -0700
+@@ -140,6 +140,13 @@
+ AC_MSG_RESULT([no])
+ fi
+
++AC_CHECK_LIB([amd], [amd_1])
++AC_CHECK_LIB([colamd], [colamd])
++
++AC_CHECK_HEADER([amd.h])
++
++AC_CHECK_LIB([z], [gzopen])
++
+ AC_CONFIG_FILES(
+ [src/Makefile examples/Makefile Makefile])
+ AC_OUTPUT
+--- src/Makefile.am.orig 2014-03-24 10:40:24.413906191 -0700
++++ src/Makefile.am 2014-03-24 10:41:15.636207690 -0700
+@@ -6,15 +6,12 @@
+
+ libglpk_la_CPPFLAGS = \
+ -I$(srcdir) \
+--I$(srcdir)/amd \
+ -I$(srcdir)/bflib \
+ -I$(srcdir)/cglib \
+--I$(srcdir)/colamd \
+ -I$(srcdir)/env \
+ -I$(srcdir)/minisat \
+ -I$(srcdir)/misc \
+--I$(srcdir)/proxy \
+--I$(srcdir)/zlib
++-I$(srcdir)/proxy
+
+ libglpk_la_LDFLAGS = \
+ -version-info 37:0:1 \
+@@ -93,18 +90,6 @@
+ glpssx02.c \
+ glptsp.c \
+ lux.c \
+-amd/amd_1.c \
+-amd/amd_2.c \
+-amd/amd_aat.c \
+-amd/amd_control.c \
+-amd/amd_defaults.c \
+-amd/amd_dump.c \
+-amd/amd_info.c \
+-amd/amd_order.c \
+-amd/amd_post_tree.c \
+-amd/amd_postorder.c \
+-amd/amd_preprocess.c \
+-amd/amd_valid.c \
+ bflib/fhv.c \
+ bflib/fhvint.c \
+ bflib/ifu.c \
+@@ -114,7 +99,6 @@
+ bflib/sva.c \
+ cglib/cfg.c \
+ cglib/cfg1.c \
+-colamd/colamd.c \
+ env/alloc.c \
+ env/dlsup.c \
+ env/env.c \
+@@ -147,21 +131,6 @@
+ misc/wclique.c \
+ misc/wclique1.c \
+ proxy/proxy.c \
+-proxy/proxy1.c \
+-zlib/adler32.c \
+-zlib/compress.c \
+-zlib/crc32.c \
+-zlib/deflate.c \
+-zlib/gzclose.c \
+-zlib/gzlib.c \
+-zlib/gzread.c \
+-zlib/gzwrite.c \
+-zlib/inffast.c \
+-zlib/inflate.c \
+-zlib/inftrees.c \
+-zlib/trees.c \
+-zlib/uncompr.c \
+-zlib/zio.c \
+-zlib/zutil.c
++proxy/proxy1.c
+
+ ## eof ##
diff --git a/sci-mathematics/glpk/files/glpk-4.54-debundle-system-libs.patch b/sci-mathematics/glpk/files/glpk-4.54-debundle-system-libs.patch
new file mode 100644
index 000000000000..a3140341a483
--- /dev/null
+++ b/sci-mathematics/glpk/files/glpk-4.54-debundle-system-libs.patch
@@ -0,0 +1,86 @@
+Remove suitesparse (camd,colamd) and zlib bundles
+bicatali - apr 2014
+
+--- configure.ac.orig 2014-04-05 14:18:56.045148287 -0700
++++ configure.ac 2014-04-05 14:23:24.878803309 -0700
+@@ -59,6 +59,11 @@
+ dnl Check for math library
+ AC_CHECK_LIB([m], [exp])
+
++AC_CHECK_LIB([amd], [amd_1])
++AC_CHECK_LIB([colamd], [colamd])
++AC_CHECK_HEADER([amd.h])
++AC_CHECK_LIB([z], [gzopen])
++
+ dnl Check for <sys/time.h> header
+ AC_CHECK_HEADER([sys/time.h],
+ AC_DEFINE([HAVE_SYS_TIME_H], [1], [N/A]))
+--- src/Makefile.am.orig 2014-04-05 14:19:16.401273769 -0700
++++ src/Makefile.am 2014-04-05 14:21:56.696259485 -0700
+@@ -6,15 +6,12 @@
+
+ libglpk_la_CPPFLAGS = \
+ -I$(srcdir) \
+--I$(srcdir)/amd \
+ -I$(srcdir)/bflib \
+ -I$(srcdir)/cglib \
+--I$(srcdir)/colamd \
+ -I$(srcdir)/env \
+ -I$(srcdir)/minisat \
+ -I$(srcdir)/misc \
+--I$(srcdir)/proxy \
+--I$(srcdir)/zlib
++-I$(srcdir)/proxy
+
+ libglpk_la_LDFLAGS = \
+ -version-info 37:1:1 \
+@@ -92,18 +89,6 @@
+ glpssx02.c \
+ glptsp.c \
+ lux.c \
+-amd/amd_1.c \
+-amd/amd_2.c \
+-amd/amd_aat.c \
+-amd/amd_control.c \
+-amd/amd_defaults.c \
+-amd/amd_dump.c \
+-amd/amd_info.c \
+-amd/amd_order.c \
+-amd/amd_post_tree.c \
+-amd/amd_postorder.c \
+-amd/amd_preprocess.c \
+-amd/amd_valid.c \
+ bflib/btf.c \
+ bflib/btfint.c \
+ bflib/fhv.c \
+@@ -117,7 +102,6 @@
+ bflib/sva.c \
+ cglib/cfg.c \
+ cglib/cfg1.c \
+-colamd/colamd.c \
+ env/alloc.c \
+ env/dlsup.c \
+ env/env.c \
+@@ -150,21 +134,6 @@
+ misc/wclique.c \
+ misc/wclique1.c \
+ proxy/proxy.c \
+-proxy/proxy1.c \
+-zlib/adler32.c \
+-zlib/compress.c \
+-zlib/crc32.c \
+-zlib/deflate.c \
+-zlib/gzclose.c \
+-zlib/gzlib.c \
+-zlib/gzread.c \
+-zlib/gzwrite.c \
+-zlib/inffast.c \
+-zlib/inflate.c \
+-zlib/inftrees.c \
+-zlib/trees.c \
+-zlib/uncompr.c \
+-zlib/zio.c \
+-zlib/zutil.c
++proxy/proxy1.c
+
+ ## eof ##
diff --git a/sci-mathematics/glpk/glpk-4.45.ebuild b/sci-mathematics/glpk/glpk-4.45.ebuild
new file mode 100644
index 000000000000..22aad3ba5f42
--- /dev/null
+++ b/sci-mathematics/glpk/glpk-4.45.ebuild
@@ -0,0 +1,64 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=2
+
+inherit eutils flag-o-matic
+
+DESCRIPTION="GNU Linear Programming Kit"
+LICENSE="GPL-3"
+HOMEPAGE="http://www.gnu.org/software/glpk/"
+SRC_URI="mirror://gnu/${PN}/${P}.tar.gz"
+
+SLOT="0"
+IUSE="doc examples gmp odbc mysql static-libs"
+KEYWORDS="alpha amd64 hppa ppc ppc64 sparc x86 ~ppc-aix ~x86-fbsd ~amd64-linux ~x86-linux"
+
+RDEPEND="sys-libs/zlib
+ odbc? ( || ( dev-db/libiodbc dev-db/unixODBC ) )
+ gmp? ( dev-libs/gmp )
+ mysql? ( virtual/mysql )"
+
+DEPEND="${RDEPEND}
+ virtual/pkgconfig"
+
+src_prepare() {
+ epatch "${FILESDIR}"/${PN}-4.52.1-mariadb-5.5.patch
+}
+
+src_configure() {
+ local myconf="--disable-dl"
+ if use mysql || use odbc; then
+ myconf="--enable-dl"
+ fi
+
+ [[ -z $(type -P odbc-config) ]] && \
+ append-cppflags $(pkg-config --cflags libiodbc)
+
+ econf \
+ --with-zlib \
+ $(use_enable static-libs static) \
+ $(use_with gmp) \
+ $(use_enable odbc) \
+ $(use_enable mysql) \
+ ${myconf}
+}
+
+src_install() {
+ emake DESTDIR="${D}" install || die "emake install failed"
+
+ dodoc AUTHORS ChangeLog NEWS README || \
+ die "failed to install docs"
+
+ insinto /usr/share/doc/${PF}
+ if use examples; then
+ emake distclean
+ doins -r examples || die "failed to install examples"
+ fi
+ if use doc; then
+ cd "${S}"/doc
+ doins *.pdf notes/*.pdf || die "failed to instal djvu and pdf"
+ dodoc *.txt || die "failed to install manual files"
+ fi
+}
diff --git a/sci-mathematics/glpk/glpk-4.48.ebuild b/sci-mathematics/glpk/glpk-4.48.ebuild
new file mode 100644
index 000000000000..f7deb9c172ab
--- /dev/null
+++ b/sci-mathematics/glpk/glpk-4.48.ebuild
@@ -0,0 +1,53 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+inherit eutils flag-o-matic toolchain-funcs autotools-utils
+
+DESCRIPTION="GNU Linear Programming Kit"
+LICENSE="GPL-3"
+HOMEPAGE="http://www.gnu.org/software/glpk/"
+SRC_URI="mirror://gnu/${PN}/${P}.tar.gz"
+
+SLOT="0"
+IUSE="doc examples gmp odbc mysql static-libs"
+KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ppc ~ppc64 ~sparc ~x86 ~ppc-aix ~amd64-fbsd ~x86-fbsd ~amd64-linux ~x86-linux ~x64-macos ~x86-macos"
+
+RDEPEND="
+ gmp? ( dev-libs/gmp:0 )
+ mysql? ( virtual/mysql )
+ odbc? ( || ( dev-db/libiodbc dev-db/unixODBC ) )"
+DEPEND="${RDEPEND}
+ virtual/pkgconfig"
+
+PATCHES=(
+ "${FILESDIR}"/${PN}-4.52.1-mariadb-5.5.patch
+)
+
+src_configure() {
+ local myeconfargs=(
+ $(use_enable mysql)
+ $(use_enable odbc)
+ $(use_with gmp)
+ )
+ if use mysql || use odbc; then
+ myeconfargs+=( --enable-dl )
+ else
+ myeconfargs+=( --disable-dl )
+ fi
+ [[ -z $(type -P odbc-config) ]] && \
+ append-cppflags $($(tc-getPKG_CONFIG) --cflags libiodbc)
+
+ autotools-utils_src_configure
+}
+
+src_install() {
+ autotools-utils_src_install
+ if use examples; then
+ insinto /usr/share/doc/${PF}
+ doins -r examples
+ fi
+ use doc && dodoc doc/*.pdf doc/notes/*.pdf doc/*.txt
+}
diff --git a/sci-mathematics/glpk/glpk-4.54.ebuild b/sci-mathematics/glpk/glpk-4.54.ebuild
new file mode 100644
index 000000000000..d31d5aa9636c
--- /dev/null
+++ b/sci-mathematics/glpk/glpk-4.54.ebuild
@@ -0,0 +1,59 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+AUTOTOOLS_AUTORECONF=1
+
+inherit eutils flag-o-matic toolchain-funcs autotools-utils
+
+DESCRIPTION="GNU Linear Programming Kit"
+LICENSE="GPL-3"
+HOMEPAGE="http://www.gnu.org/software/glpk/"
+SRC_URI="mirror://gnu/${PN}/${P}.tar.gz"
+
+SLOT="0/36"
+IUSE="doc examples gmp odbc mysql static-libs"
+KEYWORDS="~amd64 ~arm ~hppa ~ppc ~ppc64 ~sparc ~x86 ~ppc-aix ~amd64-fbsd ~x86-fbsd ~amd64-linux ~x86-linux ~x64-macos ~x86-macos"
+
+RDEPEND="
+ sci-libs/amd:0=
+ sci-libs/colamd:=
+ sys-libs/zlib:0=
+ gmp? ( dev-libs/gmp:0= )
+ mysql? ( virtual/mysql )
+ odbc? ( || ( dev-db/libiodbc:0 dev-db/unixODBC:0 ) )"
+DEPEND="${RDEPEND}
+ virtual/pkgconfig"
+
+PATCHES=(
+ "${FILESDIR}"/${PN}-4.54-debundle-system-libs.patch
+)
+
+src_configure() {
+ local myeconfargs=(
+ $(use_enable mysql)
+ $(use_enable odbc)
+ $(use_with gmp)
+ )
+ if use mysql || use odbc; then
+ myeconfargs+=( --enable-dl )
+ else
+ myeconfargs+=( --disable-dl )
+ fi
+ [[ -z $(type -P odbc-config) ]] && \
+ append-cppflags $($(tc-getPKG_CONFIG) --cflags libiodbc)
+
+ autotools-utils_src_configure
+}
+
+src_install() {
+ autotools-utils_src_install
+ if use examples; then
+ insinto /usr/share/doc/${PF}
+ doins -r examples
+ docompress -x /usr/share/doc/${PF}/examples
+ fi
+ use doc && dodoc doc/*.pdf doc/notes/*.pdf doc/*.txt
+}
diff --git a/sci-mathematics/glpk/glpk-4.55.ebuild b/sci-mathematics/glpk/glpk-4.55.ebuild
new file mode 100644
index 000000000000..d31d5aa9636c
--- /dev/null
+++ b/sci-mathematics/glpk/glpk-4.55.ebuild
@@ -0,0 +1,59 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+AUTOTOOLS_AUTORECONF=1
+
+inherit eutils flag-o-matic toolchain-funcs autotools-utils
+
+DESCRIPTION="GNU Linear Programming Kit"
+LICENSE="GPL-3"
+HOMEPAGE="http://www.gnu.org/software/glpk/"
+SRC_URI="mirror://gnu/${PN}/${P}.tar.gz"
+
+SLOT="0/36"
+IUSE="doc examples gmp odbc mysql static-libs"
+KEYWORDS="~amd64 ~arm ~hppa ~ppc ~ppc64 ~sparc ~x86 ~ppc-aix ~amd64-fbsd ~x86-fbsd ~amd64-linux ~x86-linux ~x64-macos ~x86-macos"
+
+RDEPEND="
+ sci-libs/amd:0=
+ sci-libs/colamd:=
+ sys-libs/zlib:0=
+ gmp? ( dev-libs/gmp:0= )
+ mysql? ( virtual/mysql )
+ odbc? ( || ( dev-db/libiodbc:0 dev-db/unixODBC:0 ) )"
+DEPEND="${RDEPEND}
+ virtual/pkgconfig"
+
+PATCHES=(
+ "${FILESDIR}"/${PN}-4.54-debundle-system-libs.patch
+)
+
+src_configure() {
+ local myeconfargs=(
+ $(use_enable mysql)
+ $(use_enable odbc)
+ $(use_with gmp)
+ )
+ if use mysql || use odbc; then
+ myeconfargs+=( --enable-dl )
+ else
+ myeconfargs+=( --disable-dl )
+ fi
+ [[ -z $(type -P odbc-config) ]] && \
+ append-cppflags $($(tc-getPKG_CONFIG) --cflags libiodbc)
+
+ autotools-utils_src_configure
+}
+
+src_install() {
+ autotools-utils_src_install
+ if use examples; then
+ insinto /usr/share/doc/${PF}
+ doins -r examples
+ docompress -x /usr/share/doc/${PF}/examples
+ fi
+ use doc && dodoc doc/*.pdf doc/notes/*.pdf doc/*.txt
+}
diff --git a/sci-mathematics/glpk/metadata.xml b/sci-mathematics/glpk/metadata.xml
new file mode 100644
index 000000000000..f58fdc6b640e
--- /dev/null
+++ b/sci-mathematics/glpk/metadata.xml
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <herd>sci-mathematics</herd>
+ <maintainer>
+ <email>robbat2@gentoo.org</email>
+ </maintainer>
+ <longdescription lang="en">
+ The GNU Linear Programming Kit package is intended for solving
+ large-scale linear programming (LP), mixed integer programming
+ (MIP), and other related problems. It is a set of routines written
+ in ANSI C and organized in the form of a callable library.
+</longdescription>
+</pkgmetadata>
diff --git a/sci-mathematics/gmm/Manifest b/sci-mathematics/gmm/Manifest
new file mode 100644
index 000000000000..d823de5c9d33
--- /dev/null
+++ b/sci-mathematics/gmm/Manifest
@@ -0,0 +1 @@
+DIST gmm-4.2.tar.gz 489912 SHA256 bc94080c9b2e1da2f8c886cfafa490bc1d5640912e6342ddd457c789f577fdb6 SHA512 c59941ec17870ae3a0fb4efa77a65a3ae4456d2589a13d4818f1b140f7ef3dbbafaf4597f553a98175ae592004fc000ea3435172ab5503de9b89a5cc510a9d23 WHIRLPOOL 362cfcc13e8f1c955afc1751d0e69436c821fdf3cc685c43a7ddddbd552eb88faf693d5e4207769e7274bc48605fca6f6c17d640edac5bb12e16ac29c3fa867a
diff --git a/sci-mathematics/gmm/gmm-4.2.ebuild b/sci-mathematics/gmm/gmm-4.2.ebuild
new file mode 100644
index 000000000000..9f248b2d09b8
--- /dev/null
+++ b/sci-mathematics/gmm/gmm-4.2.ebuild
@@ -0,0 +1,16 @@
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=4
+
+DESCRIPTION="Generic C++ template library for sparse, dense and skyline matrices"
+SRC_URI="http://download.gna.org/getfem/stable/${P}.tar.gz"
+HOMEPAGE="http://www-gmm.insa-toulouse.fr/getfem/"
+
+LICENSE="|| ( LGPL-3 LGPL-3-with-linking-exception )"
+SLOT="0"
+KEYWORDS="amd64 ~arm ~hppa ppc ppc64 x86 ~x86-fbsd ~amd64-linux ~x86-linux"
+IUSE=""
+
+DOCS=( AUTHORS )
diff --git a/sci-mathematics/gmm/metadata.xml b/sci-mathematics/gmm/metadata.xml
new file mode 100644
index 000000000000..282fd304492e
--- /dev/null
+++ b/sci-mathematics/gmm/metadata.xml
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+<maintainer>
+ <email>maintainer-needed@gentoo.org</email>
+</maintainer>
+<longdescription lang='en'>
+ Gmm++ is a generic C++ template library for sparse, dense and
+ skyline matrices. It is built as a set of generic algorithms (mult,
+ add, copy, sub-matrices, dense and sparse solvers ...) for any
+ interfaced vector type or matrix type. It can be view as a glue
+ library allowing cooperation between several vector and matrix
+ types. However, basic sparse, dense and skyline matrix/vector types
+ are built in Gmm++, hence it can be used as a standalone linear
+ algebra library.
+</longdescription>
+</pkgmetadata>
diff --git a/sci-mathematics/gmp-ecm/Manifest b/sci-mathematics/gmp-ecm/Manifest
new file mode 100644
index 000000000000..8efad5c299a2
--- /dev/null
+++ b/sci-mathematics/gmp-ecm/Manifest
@@ -0,0 +1,2 @@
+DIST gmp-ecm-6.4.3.tar.gz 944719 SHA256 946c9870c0b76ada2f6342515386828800c096fe32ff347c82374d5a4ec73685 SHA512 71ccdf3b48e96b0acad45302c87a7b17a20ad289efde212a34fb11491531b96848f1824606fdab7604874ca7d8165baba4bbfbc8424e27e8844444ad0d4f56a6 WHIRLPOOL b177904307fefbffc0c8aec2d20eb6de8475428f84f4e263b032fd47b671dba44211a2fcb80cacead76545429a7df5cd444137853145ee4ced62cb8356753579
+DIST gmp-ecm-6.4.4.tar.gz 941058 SHA256 c813a814592d8092745012debdba25388211e1a2579c26183adda7cfa215b06c SHA512 039009de2d1a22de7abed2e2b843fa2bc684ddcfc45892891a24b93ad4b3640a97d2e7612ebcbdbca8db032534c226ad77c67199772b21a6139e5fa205687097 WHIRLPOOL 47cb942a4e3fd3d8a978df031dbcb19ea200e43eb9cd6ac2a9b551b7d7a8caed6f2e6ec8d7f7ec84584035b24ed2b49839582f758d245df8e297038d82be2cf8
diff --git a/sci-mathematics/gmp-ecm/gmp-ecm-6.4.3-r5.ebuild b/sci-mathematics/gmp-ecm/gmp-ecm-6.4.3-r5.ebuild
new file mode 100644
index 000000000000..7185d6085d86
--- /dev/null
+++ b/sci-mathematics/gmp-ecm/gmp-ecm-6.4.3-r5.ebuild
@@ -0,0 +1,56 @@
+# Copyright 1999-2013 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=4
+DESCRIPTION="Elliptic Curve Method for Integer Factorization"
+HOMEPAGE="http://ecm.gforge.inria.fr/"
+SRC_URI="https://gforge.inria.fr/frs/download.php/30965/${P}.tar.gz"
+
+inherit eutils
+
+LICENSE="GPL-3 LGPL-3"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE="+blas +custom-tune gwnum -openmp test"
+
+# gmp 5.1 breaks a few things with this version
+DEPEND="<dev-libs/gmp-5.1.0
+ blas? ( sci-libs/gsl )
+ gwnum? ( sci-mathematics/gwnum )
+ openmp? ( sys-devel/gcc[openmp] )"
+RDEPEND="${DEPEND}"
+
+# can't be both enabled
+REQUIRED_USE="gwnum? ( !openmp )"
+
+S=${WORKDIR}/ecm-${PV}
+
+src_configure() {
+ if use gwnum; then myconf="--with-gwnum=/usr/lib"; fi
+ # --enable-shellcmd is broken
+ econf $(use_enable openmp) $myconf
+}
+
+src_compile() {
+ if use custom-tune; then
+ use amd64 && cd x86_64
+ use x86 && cd pentium4
+ emake -j1 || die # build libecm/libmulredc.la
+ cd .. && make bench_mulredc || die
+ sed -i -e 's:#define TUNE_MULREDC_TABLE://#define TUNE_MULREDC_TABLE:g' `readlink ecm-params.h` || die
+ sed -i -e 's:#define TUNE_SQRREDC_TABLE://#define TUNE_SQRREDC_TABLE:g' `readlink ecm-params.h` || die
+ ./bench_mulredc | tail -n 4 >> `readlink ecm-params.h` || die
+ fi
+ emake -j1 || die
+}
+
+src_install() {
+ emake DESTDIR="${D}" install || die
+ mkdir -p "${D}/usr/include/${PN}/"
+ cp "${S}"/*.h "${D}/usr/include/${PN}" || die "Failed to copy headers" # needed by other apps like YAFU
+}
+
+src_test() {
+ make check || die
+}
diff --git a/sci-mathematics/gmp-ecm/gmp-ecm-6.4.4-r1.ebuild b/sci-mathematics/gmp-ecm/gmp-ecm-6.4.4-r1.ebuild
new file mode 100644
index 000000000000..329a7d55ab75
--- /dev/null
+++ b/sci-mathematics/gmp-ecm/gmp-ecm-6.4.4-r1.ebuild
@@ -0,0 +1,65 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+inherit autotools eutils flag-o-matic multilib
+
+DESCRIPTION="Elliptic Curve Method for Integer Factorization"
+HOMEPAGE="http://ecm.gforge.inria.fr/"
+SRC_URI="https://gforge.inria.fr/frs/download.php/32159/${P}.tar.gz"
+
+LICENSE="GPL-3 LGPL-3"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE="+blas +custom-tune gwnum -openmp static-libs test"
+
+DEPEND="
+ dev-libs/gmp
+ blas? ( sci-libs/gsl )
+ gwnum? ( sci-mathematics/gwnum )
+ openmp? ( sys-devel/gcc[openmp] )"
+RDEPEND="${DEPEND}"
+
+# can't be both enabled
+REQUIRED_USE="gwnum? ( !openmp )"
+
+S=${WORKDIR}/ecm-${PV}
+
+MAKEOPTS+=" -j1"
+
+src_prepare() {
+ sed -e '/libecm_la_LIBADD/s:$: -lgmp:g' -i Makefile.am || die
+ eautoreconf
+}
+
+src_configure() {
+ use gwnum && local myconf="--with-gwnum="${EPREFIX}"/usr/$(get_libdir)"
+ # --enable-shellcmd is broken
+ econf \
+ --enable-shared \
+ $(use_enable static-libs static) \
+ $(use_enable openmp) \
+ ${myconf}
+}
+
+src_compile() {
+ append-ldflags "-Wl,-z,noexecstack"
+ if use custom-tune; then
+ use amd64 && cd x86_64
+ use x86 && cd pentium4
+ emake
+ cd .. && make bench_mulredc || die
+ sed -i -e 's:#define TUNE_MULREDC_TABLE://#define TUNE_MULREDC_TABLE:g' `readlink ecm-params.h` || die
+ sed -i -e 's:#define TUNE_SQRREDC_TABLE://#define TUNE_SQRREDC_TABLE:g' `readlink ecm-params.h` || die
+ ./bench_mulredc | tail -n 4 >> `readlink ecm-params.h` || die
+ fi
+ default
+}
+
+src_install() {
+ default
+ mkdir -p "${ED}/usr/include/${PN}/"
+ cp "${S}"/*.h "${ED}/usr/include/${PN}" || die "Failed to copy headers" # needed by other apps like YAFU
+}
diff --git a/sci-mathematics/gmp-ecm/gmp-ecm-9999.ebuild b/sci-mathematics/gmp-ecm/gmp-ecm-9999.ebuild
new file mode 100644
index 000000000000..0c39ab7005da
--- /dev/null
+++ b/sci-mathematics/gmp-ecm/gmp-ecm-9999.ebuild
@@ -0,0 +1,53 @@
+# Copyright 1999-2013 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+DESCRIPTION="Elliptic Curve Method for Integer Factorization"
+HOMEPAGE="http://ecm.gforge.inria.fr/"
+#SRC_URI="https://gforge.inria.fr/frs/download.php/30965/${P}.tar.gz"
+ESVN_REPO_URI="svn://scm.gforge.inria.fr/svnroot/ecm/trunk"
+
+inherit autotools eutils flag-o-matic subversion
+
+LICENSE="GPL-3 LGPL-3"
+SLOT="0"
+KEYWORDS=""
+IUSE="blas gwnum -openmp test"
+
+DEPEND="
+ dev-libs/gmp
+ blas? ( sci-libs/gsl )
+ gwnum? ( sci-mathematics/gwnum )
+ openmp? ( sys-devel/gcc[openmp] )"
+RDEPEND="${DEPEND}"
+
+# can't be both enabled
+REQUIRED_USE="gwnum? ( !openmp )"
+
+S=${WORKDIR}/ecm-${PV}
+
+MAKEOPTS+=" -j1"
+
+src_prepare() {
+ eautoreconf
+}
+
+src_configure() {
+ if use gwnum; then myconf="--with-gwnum=/usr/lib"; fi
+ # --enable-shellcmd is broken
+ econf $(use_enable openmp) $myconf
+}
+
+src_compile() {
+ append-ldflags "-Wl,-z,noexecstack"
+ # the custom-tune bits are obsoleted with sane defaults
+ default
+}
+
+src_install() {
+ default
+ mkdir -p "${D}/usr/include/${PN}/"
+ cp "${S}"/*.h "${D}/usr/include/${PN}" || die "Failed to copy headers" # needed by other apps like YAFU
+}
diff --git a/sci-mathematics/gmp-ecm/metadata.xml b/sci-mathematics/gmp-ecm/metadata.xml
new file mode 100644
index 000000000000..1723f3d6a58c
--- /dev/null
+++ b/sci-mathematics/gmp-ecm/metadata.xml
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <maintainer>
+ <email>patrick@gentoo.org</email>
+ <name>Patrick Lauer</name>
+ </maintainer>
+ <use>
+ <flag name="custom-tune">Improve performance of some operations by selecting machine-specific defaults</flag>
+ <flag name="gwnum">Use GWNum lib where possible</flag>
+ </use>
+</pkgmetadata>
diff --git a/sci-mathematics/gretl/Manifest b/sci-mathematics/gretl/Manifest
new file mode 100644
index 000000000000..e5264a78563b
--- /dev/null
+++ b/sci-mathematics/gretl/Manifest
@@ -0,0 +1,2 @@
+DIST gretl-1.9.14.tar.xz 7564192 SHA256 ceabb8cbf461ab340093f3d38d9c87d91f6d17c62906d3d8d7bfe58812ba965b SHA512 61ff44cc52f3da971d3cf2cc6e52e0401280521fd761ea098f753acc529c9d35a12fc296b46136d5d257c9a29a83f91a78a77822a00ce3f65776a17f97223ee1 WHIRLPOOL d592d50ba57cfcde2cba6e31199f2d853d300fe5fcc4e2afc6c9906f8f9f6c3ac02a2d24a98c53fb86fb92e7c133717bbdadaa6bd93406d1deb69b3b30be2756
+DIST gretl-1.9.90.tar.xz 7764820 SHA256 f14941786de985e40af8e5f31fb71ee05b17002627055f0f6341b63258c4fdcc SHA512 35ec45fb2ad2dec490567411c1a5d909dc7fc8f0c4a6ca142e6e92b2d95a9efc9581f154a7806cf3f5178b530cdca9508b7c215bca29e1bcaebfa874d476667a WHIRLPOOL c688135030057df291576b5e8e08300d59b183a013064ae9adb7a934e4fd5436b0b2b23d27f340dcd4c0aac24fd16419dd377e3c650a2c90705e5caa8cedf24f
diff --git a/sci-mathematics/gretl/files/50gretl-gentoo.el b/sci-mathematics/gretl/files/50gretl-gentoo.el
new file mode 100644
index 000000000000..c5f3159efc0b
--- /dev/null
+++ b/sci-mathematics/gretl/files/50gretl-gentoo.el
@@ -0,0 +1,16 @@
+
+;;; sci-mathematics/gretl site-lisp configuration
+
+(add-to-list 'load-path "@SITELISP@")
+
+(autoload 'gretl-mode "gretl" nil t)
+;; not adding to auto-mode-alist since .inp is too generic as extension
+;;(add-to-list 'auto-mode-alist '("\\.inp\\'" . gretl-mode))
+
+;; Automatically turn on the abbrev, auto-fill and font-lock features
+(add-hook 'gretl-mode-hook
+ (lambda ()
+ (abbrev-mode 1)
+ (auto-fill-mode 1)
+ (if (eq window-system 'x)
+ (font-lock-mode 1))))
diff --git a/sci-mathematics/gretl/files/gretl-1.9.14-readline.patch b/sci-mathematics/gretl/files/gretl-1.9.14-readline.patch
new file mode 100644
index 000000000000..9f6996b9c916
--- /dev/null
+++ b/sci-mathematics/gretl/files/gretl-1.9.14-readline.patch
@@ -0,0 +1,10 @@
+--- cli/complete.c.ORIG 2007-08-22 16:44:46.000000000 +0200
++++ cli/complete.c 2014-03-26 16:54:40.463070119 +0100
+@@ -126,6 +126,6 @@
+ rl_readline_name = "gretl";
+
+ /* Tell the completer that we want a crack first. */
+- rl_attempted_completion_function = (CPPFunction *) gretl_completion;
++ rl_attempted_completion_function = (rl_completion_func_t*) gretl_completion;
+ }
+
diff --git a/sci-mathematics/gretl/gretl-1.9.14.ebuild b/sci-mathematics/gretl/gretl-1.9.14.ebuild
new file mode 100644
index 000000000000..a6904c111536
--- /dev/null
+++ b/sci-mathematics/gretl/gretl-1.9.14.ebuild
@@ -0,0 +1,112 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+USE_EINSTALL=true
+
+inherit eutils elisp-common toolchain-funcs
+
+DESCRIPTION="Regression, econometrics and time-series library"
+HOMEPAGE="http://gretl.sourceforge.net/"
+SRC_URI="mirror://sourceforge/${PN}/${P}.tar.xz"
+
+LICENSE="GPL-3"
+SLOT="0"
+KEYWORDS="~amd64 ~x86 ~amd64-linux ~x86-linux"
+IUSE="accessibility cpu_flags_x86_avx emacs gnome gtk nls odbc openmp python
+ readline cpu_flags_x86_sse2 R static-libs"
+
+CDEPEND="
+ dev-libs/glib:2
+ dev-libs/gmp
+ dev-libs/libxml2:2
+ dev-libs/mpfr
+ sci-libs/fftw:3.0
+ sci-visualization/gnuplot
+ virtual/lapack
+ virtual/latex-base
+ accessibility? ( app-accessibility/flite )
+ emacs? ( virtual/emacs )
+ gtk? (
+ media-libs/gd[png]
+ sci-visualization/gnuplot[gd]
+ x11-libs/gtk+:3
+ x11-libs/gtksourceview:3.0 )
+ odbc? ( dev-db/unixODBC )
+ R? ( dev-lang/R )
+ readline? ( sys-libs/readline )"
+RDEPEND="${CDEPEND}
+ python? ( dev-python/numpy )"
+DEPEND="${CDEPEND}
+ virtual/pkgconfig"
+
+SITEFILE=50${PN}-gentoo.el
+
+REQUIRED_USE="emacs? ( gtk )"
+
+pkg_setup() {
+ if use openmp && [[ $(tc-getCC)$ == *gcc* ]] && ! tc-has-openmp
+ then
+ ewarn "You are using gcc and OpenMP is only available with gcc >= 4.2 "
+ die "Need an OpenMP capable compiler"
+ fi
+}
+
+src_prepare() {
+ epatch "${FILESDIR}"/${P}-readline.patch
+}
+
+src_configure() {
+ econf \
+ --disable-rpath \
+ --enable-shared \
+ --with-mpfr \
+ $(use_enable cpu_flags_x86_avx avx) \
+ $(use_enable gtk gui) \
+ $(use_enable gtk gtk3) \
+ $(use_enable gtk xdg) \
+ $(use_enable gtk xdg-utils) \
+ $(use_enable nls) \
+ $(use_enable openmp) \
+ $(use_enable cpu_flags_x86_sse2 sse2) \
+ $(use_enable static-libs static) \
+ $(use_with accessibility audio) \
+ $(use_with odbc) \
+ $(use_with readline) \
+ $(use_with R libR) \
+ ${myconf} \
+ LAPACK_LIBS="$($(tc-getPKG_CONFIG) --libs lapack)"
+}
+
+src_compile() {
+ emake
+ if use emacs; then
+ cd utils/emacs && emake
+ elisp-compile gretl.el
+ fi
+}
+
+src_install() {
+ # to fix
+ emake -j1 DESTDIR="${D}" install
+ if use emacs; then
+ elisp-install ${PN} utils/emacs/gretl.{el,elc}
+ elisp-site-file-install "${FILESDIR}/${SITEFILE}"
+ fi
+ dodoc README README.audio ChangeLog CompatLog
+}
+
+pkg_postinst() {
+ if use emacs; then
+ elisp-site-regen
+ elog "To begin using gretl-mode for all \".inp\" files that you edit,"
+ elog "add the following line to your \"~/.emacs\" file:"
+ elog " (add-to-list 'auto-mode-alist '(\"\\\\.inp\\\\'\" . gretl-mode))"
+ fi
+}
+
+pkg_postrm() {
+ use emacs && elisp-site-regen
+}
diff --git a/sci-mathematics/gretl/gretl-1.9.90.ebuild b/sci-mathematics/gretl/gretl-1.9.90.ebuild
new file mode 100644
index 000000000000..4ffc0d43fa46
--- /dev/null
+++ b/sci-mathematics/gretl/gretl-1.9.90.ebuild
@@ -0,0 +1,112 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+USE_EINSTALL=true
+
+inherit eutils elisp-common toolchain-funcs
+
+DESCRIPTION="Regression, econometrics and time-series library"
+HOMEPAGE="http://gretl.sourceforge.net/"
+SRC_URI="mirror://sourceforge/${PN}/${P}.tar.xz"
+
+LICENSE="GPL-3"
+SLOT="0/10"
+KEYWORDS="~amd64 ~x86 ~amd64-linux ~x86-linux"
+IUSE="accessibility cpu_flags_x86_avx +curl emacs gnome gtk mpi nls odbc openmp python
+ readline cpu_flags_x86_sse2 R static-libs"
+
+CDEPEND="
+ dev-libs/glib:2=
+ dev-libs/gmp:0=
+ dev-libs/libxml2:2=
+ dev-libs/mpfr:0=
+ sci-libs/fftw:3.0=
+ sci-visualization/gnuplot
+ virtual/lapack
+ virtual/latex-base
+ accessibility? ( app-accessibility/flite:= )
+ curl? ( net-misc/curl:0= )
+ emacs? ( virtual/emacs )
+ gtk? (
+ media-libs/gd:2=[png]
+ sci-visualization/gnuplot[gd]
+ x11-libs/gtk+:3=
+ x11-libs/gtksourceview:3.0= )
+ mpi? ( virtual/mpi )
+ odbc? ( dev-db/unixODBC:0= )
+ R? ( dev-lang/R:0= )
+ readline? ( sys-libs/readline:0= )"
+RDEPEND="${CDEPEND}
+ python? ( dev-python/numpy )"
+DEPEND="${CDEPEND}
+ virtual/pkgconfig"
+
+SITEFILE=50${PN}-gentoo.el
+
+REQUIRED_USE="emacs? ( gtk ) !curl? ( !gtk )"
+
+pkg_setup() {
+ if use openmp && [[ $(tc-getCC)$ == *gcc* ]] && ! tc-has-openmp ; then
+ ewarn "You are using a non capable gcc compiler ( < 4.2 ? )"
+ die "Need an OpenMP capable compiler"
+ fi
+}
+
+src_configure() {
+ econf \
+ --disable-rpath \
+ --enable-shared \
+ --with-mpfr \
+ --docdir="${EPREFIX}/usr/share/doc/${PF}" \
+ --htmldir="${EPREFIX}/usr/share/doc/${PF}/html" \
+ $(use_enable cpu_flags_x86_avx avx) \
+ $(use_enable curl www) \
+ $(use_enable gtk gui) \
+ $(use_enable gtk xdg) \
+ $(use_enable gtk xdg-utils) \
+ $(use_enable nls) \
+ $(use_enable openmp) \
+ $(use_enable cpu_flags_x86_sse2 sse2) \
+ $(use_enable static-libs static) \
+ $(use_with accessibility audio) \
+ $(use_with mpi) \
+ $(use_with odbc) \
+ $(use_with readline) \
+ $(use_with R libR) \
+ ${myconf} \
+ LAPACK_LIBS="$($(tc-getPKG_CONFIG) --libs lapack)"
+}
+
+src_compile() {
+ emake
+ if use emacs; then
+ cd utils/emacs && emake
+ elisp-compile gretl.el
+ fi
+}
+
+src_install() {
+ # to fix
+ emake -j1 DESTDIR="${D}" install
+ if use emacs; then
+ elisp-install ${PN} utils/emacs/gretl.{el,elc}
+ elisp-site-file-install "${FILESDIR}/${SITEFILE}"
+ fi
+ dodoc README README.audio ChangeLog CompatLog
+}
+
+pkg_postinst() {
+ if use emacs; then
+ elisp-site-regen
+ elog "To use gretl-mode for all \".inp\" files that you edit,"
+ elog "add the following line to your \"~/.emacs\" file:"
+ elog " (add-to-list 'auto-mode-alist '(\"\\\\.inp\\\\'\" . gretl-mode))"
+ fi
+}
+
+pkg_postrm() {
+ use emacs && elisp-site-regen
+}
diff --git a/sci-mathematics/gretl/metadata.xml b/sci-mathematics/gretl/metadata.xml
new file mode 100644
index 000000000000..98532cfda4e3
--- /dev/null
+++ b/sci-mathematics/gretl/metadata.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <herd>sci-mathematics</herd>
+ <longdescription lang="en">
+ GNU Regression, Econometrics and Time-series Library provides
+ a library which comprises various functions relating to econometric
+ estimation, a command-line client program and a GUI. The library is
+ based on the stand-alone command-line econometrics program ESL,
+ originally written by Ramu Ramanathan of the Department of Economics
+ at UC-San Diego. The interfaces offer several least-squares based
+ estimators. Besides reading data files in its own format it also
+ reads RATS 4 databases. It has a built-in spreadsheet for editing
+ data, and uses gnuplot for graphing. It can output regression results
+ in LaTeX format.
+</longdescription>
+ <use>
+ <flag name="R">Enable support for <pkg>dev-lang/R</pkg></flag>
+ </use>
+ <upstream>
+ <remote-id type="sourceforge">gretl</remote-id>
+ </upstream>
+</pkgmetadata>
diff --git a/sci-mathematics/gsl-shell/Manifest b/sci-mathematics/gsl-shell/Manifest
new file mode 100644
index 000000000000..8fe68cc84f8c
--- /dev/null
+++ b/sci-mathematics/gsl-shell/Manifest
@@ -0,0 +1 @@
+DIST gsl-shell-2.2.0.tar.gz 3138063 SHA256 e05bcc78ea3c70d209b12a3db5c86b5ed23e50617d68cb0081046382973b2d33 SHA512 1394cbafecd55ddf5c8c992273f1fa400825b21202cd53ac548a99e34a9183ba4a5dcb2ef10ef9a7930f78ed4e6343b8d2a5d34c38a8e7766300b5bf73596d89 WHIRLPOOL 9bbfa55c988611fa0c771fc6c49473e139eff936f4f22b4b419c409e8450c733a57f2d9bbbc799f754654ff5cf5b303ab263bb502ef712ad439564c6e3b28fef
diff --git a/sci-mathematics/gsl-shell/files/gsl-shell-2.2.0-pkg-config.patch b/sci-mathematics/gsl-shell/files/gsl-shell-2.2.0-pkg-config.patch
new file mode 100644
index 000000000000..8bb28635df2b
--- /dev/null
+++ b/sci-mathematics/gsl-shell/files/gsl-shell-2.2.0-pkg-config.patch
@@ -0,0 +1,33 @@
+ makepackages | 16 ++++++++--------
+ 1 file changed, 8 insertions(+), 8 deletions(-)
+
+diff --git a/makepackages b/makepackages
+index afeef79..a724e82 100644
+--- a/makepackages
++++ b/makepackages
+@@ -52,17 +52,17 @@ else
+ PTHREADS_LIBS = -lpthread
+
+ else
+- AGG_INCLUDES = -I/usr/include/agg2
+- AGG_LIBS = -lagg -lX11
++ AGG_INCLUDES = $(shell $(PKG_CONFIG) --cflags libagg)
++ AGG_LIBS = $(shell $(PKG_CONFIG) --libs libagg) -lX11
+
+- GSL_INCLUDES =
+- GSL_LIBS = -lgsl -lblas
++ GSL_INCLUDES = $(shell $(PKG_CONFIG) --cflags gsl)
++ GSL_LIBS = $(shell $(PKG_CONFIG) --libs gsl)
+
+- FOX_INCLUDES := $(shell pkg-config fox --cflags)
+- FOX_LIBS = $(shell pkg-config fox --libs)
++ FOX_INCLUDES := $(shell $(PKG_CONFIG) fox --cflags)
++ FOX_LIBS = $(shell $(PKG_CONFIG) fox --libs)
+
+- FREETYPE_INCLUDES = -I/usr/include/freetype2
+- FREETYPE_LIBS = -lfreetype
++ FREETYPE_INCLUDES = $(shell $(PKG_CONFIG) --cflags freetype2)
++ FREETYPE_LIBS = $(shell $(PKG_CONFIG) --libs freetype2)
+
+ PTHREADS_LIBS = -lpthread
+ endif
diff --git a/sci-mathematics/gsl-shell/files/gsl-shell-font.patch b/sci-mathematics/gsl-shell/files/gsl-shell-font.patch
new file mode 100644
index 000000000000..d8879497c4cd
--- /dev/null
+++ b/sci-mathematics/gsl-shell/files/gsl-shell-font.patch
@@ -0,0 +1,10 @@
+diff -r -U1 gsl-shell.orig/agg-plot/support_x11.cpp gsl-shell/agg-plot/support_x11.cpp
+--- gsl-shell.orig/agg-plot/support_x11.cpp 2012-11-27 04:55:38.000000000 +0700
++++ gsl-shell/agg-plot/support_x11.cpp 2012-11-30 23:02:31.000000000 +0700
+@@ -9,4 +9,4 @@
+ #else
+-const char *ttf_names[] = {"ubuntu-font-family/Ubuntu-R.ttf", "freefont/FreeSans.ttf", "ttf-dejavu/DejaVuSans.ttf", 0};
+-#define TTF_SYSTEM_DIR "/usr/share/fonts/truetype/"
++const char *ttf_names[] = {"ubuntu-font-family/Ubuntu-R.ttf", "freefont-ttf/FreeSans.ttf", "dejavu/DejaVuSans.ttf", 0};
++#define TTF_SYSTEM_DIR "/usr/share/fonts/"
+ #define CONSOLE_FONT_NAME "monospace"
diff --git a/sci-mathematics/gsl-shell/files/gsl-shell-nogui.patch b/sci-mathematics/gsl-shell/files/gsl-shell-nogui.patch
new file mode 100644
index 000000000000..16d3eb0f04d2
--- /dev/null
+++ b/sci-mathematics/gsl-shell/files/gsl-shell-nogui.patch
@@ -0,0 +1,25 @@
+diff -r -U1 gsl-shell.orig/Makefile gsl-shell/Makefile
+--- gsl-shell.orig/Makefile 2012-09-21 19:54:05.000000000 +0700
++++ gsl-shell/Makefile 2012-09-21 19:53:37.000000000 +0700
+@@ -29,3 +29,2 @@
+ GSL_SHELL = gsl-shell$(EXE_EXT)
+-GSL_SHELL_GUI = gsl-shell-gui$(EXE_EXT)
+ LUA_CFLAGS = -I$(LUADIR)/src
+@@ -73,4 +72,3 @@
+ INCLUDES += $(PTHREADS_CFLAGS) -Iagg-plot
+-GUI_SUBDIR = fox-gui
+-SUBDIRS += agg-plot $(GUI_SUBDIR)
++SUBDIRS += agg-plot
+ LUAGSL_LIBS += agg-plot/libaggplot.a
+@@ -105,6 +103,5 @@
+
+-install: $(GSL_SHELL) $(GUI_SUBDIR)
++install: $(GSL_SHELL)
+ mkdir -p $(INSTALL_BIN_DIR)
+ cp $(GSL_SHELL) $(INSTALL_BIN_DIR)
+- cp fox-gui/$(GSL_SHELL_GUI) $(INSTALL_BIN_DIR)
+ mkdir -p $(INSTALL_LIB_DIR)
+@@ -122,3 +119,2 @@
+ $(MAKE) -C $(LUADIR) clean
+- $(MAKE) -C fox-gui clean
+ $(HOST_RM) *.o $(TARGETS)
diff --git a/sci-mathematics/gsl-shell/files/gsl-shell-strip.patch b/sci-mathematics/gsl-shell/files/gsl-shell-strip.patch
new file mode 100644
index 000000000000..1d50a7e831af
--- /dev/null
+++ b/sci-mathematics/gsl-shell/files/gsl-shell-strip.patch
@@ -0,0 +1,8 @@
+diff -r -U1 gsl-shell.orig/Makefile gsl-shell/Makefile
+--- gsl-shell.orig/Makefile 2012-09-12 01:13:31.000000000 +0700
++++ gsl-shell/Makefile 2012-09-26 16:13:56.000000000 +0700
+@@ -109,4 +109,2 @@
+ cp fox-gui/$(GSL_SHELL_GUI) $(INSTALL_BIN_DIR)
+- strip $(INSTALL_BIN_DIR)/$(GSL_SHELL)
+- strip $(INSTALL_BIN_DIR)/$(GSL_SHELL_GUI)
+ mkdir -p $(INSTALL_LIB_DIR)
diff --git a/sci-mathematics/gsl-shell/files/gsl-shell-usr.patch b/sci-mathematics/gsl-shell/files/gsl-shell-usr.patch
new file mode 100644
index 000000000000..20ca6d317c7a
--- /dev/null
+++ b/sci-mathematics/gsl-shell/files/gsl-shell-usr.patch
@@ -0,0 +1,8 @@
+diff -r -U1 gsl-shell.orig/makeconfig gsl-shell/makeconfig
+--- gsl-shell.orig/makeconfig 2012-09-12 01:13:31.000000000 +0700
++++ gsl-shell/makeconfig 2012-09-26 16:16:43.000000000 +0700
+@@ -21,3 +21,3 @@
+
+-PREFIX= /usr/local
++PREFIX= /usr
+ DESTDIR=
diff --git a/sci-mathematics/gsl-shell/gsl-shell-2.2.0.ebuild b/sci-mathematics/gsl-shell/gsl-shell-2.2.0.ebuild
new file mode 100644
index 000000000000..a034db9f75fd
--- /dev/null
+++ b/sci-mathematics/gsl-shell/gsl-shell-2.2.0.ebuild
@@ -0,0 +1,64 @@
+# Copyright 1999-2013 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=4
+
+inherit eutils toolchain-funcs
+
+DESCRIPTION="Lua interactive shell for sci-libs/gsl"
+HOMEPAGE="http://www.nongnu.org/gsl-shell/"
+SRC_URI="http://download.savannah.gnu.org/releases/${PN}/${P}.tar.gz"
+
+SLOT="0"
+LICENSE="GPL-3"
+KEYWORDS="~amd64 ~x86"
+IUSE="doc fox"
+
+RDEPEND="
+ >=sci-libs/gsl-1.14
+ virtual/blas
+ >=x11-libs/agg-2.5
+ >=media-libs/freetype-2.4.10
+ sys-libs/readline
+ || ( media-fonts/ubuntu-font-family media-fonts/freefont media-fonts/dejavu )
+ fox? ( x11-libs/fox:1.6 )"
+DEPEND="${DEPEND}
+ virtual/pkgconfig
+ doc? ( dev-python/sphinx[latex] )"
+
+S="${WORKDIR}"/${PN}
+
+src_prepare() {
+ tc-export PKG_CONFIG
+ epatch \
+ "${FILESDIR}"/${PN}-font.patch \
+ "${FILESDIR}"/${PN}-strip.patch \
+ "${FILESDIR}"/${PN}-usr.patch \
+ "${FILESDIR}"/${P}-pkg-config.patch
+ use fox || epatch "${FILESDIR}"/${PN}-nogui.patch
+}
+
+src_compile() {
+ local BLAS=$($(tc-getPKG_CONFIG) --libs blas)
+
+ if use fox; then
+ local FOX_INCLUDES=`WANT_FOX=1.6 fox-config --cflags`
+ local FOX_LIBS=`WANT_FOX=1.6 fox-config --libs`
+ emake -j1 CFLAGS="${CFLAGS}" GSL_LIBS="$($(tc-getPKG_CONFIG) --libs gsl) ${BLAS}" \
+ FOX_INCLUDES="${FOX_INCLUDES}" FOX_LIBS="${FOX_LIBS}"
+ else
+ emake -j1 CFLAGS="${CFLAGS}" GSL_LIBS="$($(tc-getPKG_CONFIG) --libs gsl) ${BLAS}"
+ fi
+
+ if use doc; then
+ pushd doc/user-manual > /dev/null
+ emake -j1 html
+ popd > /dev/null
+ fi
+}
+
+src_install() {
+ default
+ use doc && dohtml -r doc/user-manual/_build/html/*
+}
diff --git a/sci-mathematics/gsl-shell/metadata.xml b/sci-mathematics/gsl-shell/metadata.xml
new file mode 100644
index 000000000000..d56d122c63c6
--- /dev/null
+++ b/sci-mathematics/gsl-shell/metadata.xml
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <maintainer>
+ <email>grozin@gentoo.org</email>
+ <name>Andrey Grozin</name>
+ </maintainer>
+ <herd>sci-mathematics</herd>
+ <longdescription lang="en">
+GSL shell offers an interactive command-line interface
+that gives access to GSL collection of mathematical functions.
+GSL shell is based on the powerful and elegant scripting language Lua.
+GSL shell is not just a wrapper over the C API of GSL
+but does offer much more simple and expressive way to use GSL.
+The objective of GSL shell is to give the user the power
+of easily access GSL functions without having to write a complete C application.
+</longdescription>
+ <use>
+ <flag name="fox">Build a <pkg>x11-libs/fox</pkg> GUI</flag>
+ </use>
+</pkgmetadata>
diff --git a/sci-mathematics/gwnum/Manifest b/sci-mathematics/gwnum/Manifest
new file mode 100644
index 000000000000..d448d4ae40e7
--- /dev/null
+++ b/sci-mathematics/gwnum/Manifest
@@ -0,0 +1 @@
+DIST gwnum-277.tar.bz2 24143696 SHA256 bbd7baec05d66b3cbe315e742b1b1aaa882dea838bed4901203c29a2e231397f SHA512 d88a15b01fad458640a84ffa3d5fca6fb35ecd99aff711e679cdae2a58b95c9caefdd4218015f620fd7a93bb54aabad1311205d7ec62d212ca8c6e80af696cc3 WHIRLPOOL db520213f8b324e5c4dc21800424755cd8f23cbbe26619f6393e8b5ed65653a89b73098638fd75137a05a6a323fc71b0acc5496d5ad405fe70f7d26671b301df
diff --git a/sci-mathematics/gwnum/gwnum-277.ebuild b/sci-mathematics/gwnum/gwnum-277.ebuild
new file mode 100644
index 000000000000..1842938ca888
--- /dev/null
+++ b/sci-mathematics/gwnum/gwnum-277.ebuild
@@ -0,0 +1,34 @@
+# Copyright 1999-2013 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=4
+DESCRIPTION="George Woltman's GWNUM library"
+HOMEPAGE="http://www.mersenne.org/freesoft/"
+# Sourcecode split out from prime95, we don't need the full lib
+SRC_URI="http://gentooexperimental.org/~patrick/${P}.tar.bz2"
+
+inherit eutils
+
+LICENSE="gwnum BSD GPL-2+"
+SLOT="0"
+# Need to test if it actually compiles on x86
+KEYWORDS="~amd64 ~x86"
+IUSE=""
+RESTRICT="bindist" #465566
+
+DEPEND=""
+RDEPEND="${DEPEND}"
+
+src_compile() {
+ # makefile doesn't return zero? || die fails :(
+ use amd64 && emake -f make64
+ use x86 && emake
+}
+
+src_install() {
+ mkdir "${D}/usr/lib" -p
+ cp gwnum.a gwnum.lib "${D}/usr/lib" || die
+ mkdir "${D}/usr/include" -p
+ cp *.h "${D}/usr/include" || die
+}
diff --git a/sci-mathematics/gwnum/metadata.xml b/sci-mathematics/gwnum/metadata.xml
new file mode 100644
index 000000000000..24cbb90cf0c4
--- /dev/null
+++ b/sci-mathematics/gwnum/metadata.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <maintainer>
+ <email>patrick@gentoo.org</email>
+ <name>Patrick Lauer</name>
+ </maintainer>
+</pkgmetadata>
diff --git a/sci-mathematics/isabelle/Manifest b/sci-mathematics/isabelle/Manifest
new file mode 100644
index 000000000000..f3bd2a8ec892
--- /dev/null
+++ b/sci-mathematics/isabelle/Manifest
@@ -0,0 +1,11 @@
+DIST Isabelle2011-1.tar.gz 42239059 SHA256 48d77fe31a16b44f6015aa7953a60bdad8fcec9e60847630dc7b98c053edfc08 SHA512 213207951455395659a91b0bc6c8520c084cb6c75098c8f24c0800e41474c90c92aae86ffb99415142f6cf63d569556661ba350024fe458daa54a5cc9db372fd WHIRLPOOL 7e7868c3f464f507aceb8e1f648c04394fdd69746242179e66cfad64f927cf4d6aba41970428da5e45cce90a30bcee29bdc373d8a9e4943eb61cd97480d0a366
+DIST Isabelle2012-doc-src.tar.gz 2688496 SHA256 e18965fe0f7f89b286d4707e38201f1edbea81f6b26aed59d63a633c03fec097 SHA512 5aaea56eb67e535d745d63314278b6ee8469e6d3bbf4ce4d7b3f5e04b24557783b56d50d905a5ad69187c42f44407023c95a9bfb6faab125c21edff7638ff21d WHIRLPOOL 278b63a243950b1596376ee04cbfddb7a93c747e9f6ee66c5b069ca0dae4ca8d10bef43e03069b6186a19c703f71a585633fc47c3c1a15de3a886ff468232127
+DIST Isabelle2012.tar.gz 49529865 SHA256 b86f957dee221041f92c9d4ced4758d45b4950339743d0d58b1ea6061e2b53f0 SHA512 1346f563233eba10bc14f7d140706b8bfba8e832f7ee5887316c829926136af07d700914a925272d8adc1275b0bdd682540518957910c136a15bfc60d61285a0 WHIRLPOOL 23b764a1a0044a9525d058e95da318f4425fadf7660edc8ab8f35b248f98dcff0dba2e533ff18d8bf47ea164cec12a9648642749de2a49887bbe84ed4e71a68b
+DIST Isabelle2013-2.tar.gz 52603110 SHA256 602e91377b0999c25950ae2a34c0fcb23e3aff3a196bdbc5ce61634bd90d7f22 SHA512 464a2735b2f4e28dcf44e55cd4abb4d8766a6bb7eb86f989f3592e7819e33d97922bdfb6701da85aa9d7c4cc2aee3eadebde1c7e3fc74bb3f6108a5daf5fea45 WHIRLPOOL 0dc354d60e3440ea0909dc09f25b66cb301b82f88fbe21c0b7f4bfef40ecc3631014757abd8657f0464047f0ad32827ad308e3f998fcf2477e05907ff7b19a84
+DIST Isabelle2013.tar.gz 54638791 SHA256 2f2cda9939248bd4346ad7e074cb6b2cfad70708777491c6262a5ae670c8f83a SHA512 e03f9b747f678749a562c3de6100f4f4e010ace51b2eb13bcde0a63591eec0cb4e081f7fad9147d022fe787b56eac3f037ab3a296080fd70cc7d058ea961a789 WHIRLPOOL 5cbcbc93bd2ce4723034c3d95d4678b2de90c924601b795c5da378cb76f58275e5d5f47ce9120234a9ea36e43ab759ced843dca76942378abfa1fb7aff858a65
+DIST jedit_build-20120414.tar.gz 7509120 SHA256 3c5840fd01b87013b05a92742d41f66f655df6fe9edef1525c6722f92d8f3e41 SHA512 2e2f0db4964a041ba54382a9c787246e1d433e43167019c6ea8d4cf6beb84ce438c0bc559d2588229b0166c91bac603bed39abc45d5d4267020f55eaba1aaa0c WHIRLPOOL 40b883943bde312b4c7adc43607ba4759e5ebe22cab3c922c81393375f917af21d4a8dc068e5692ffcf7bdfb1e7fe3081358dc8e346d1942582bf79e249b0cbb
+DIST jedit_build-isabelle-component-20130104.tar.gz 10734679 SHA256 22a4880deb1054a548476b22662b42bfaf5394ceb07b30eba69be433bcea1074 SHA512 bacdb3ca73d48fe9ba71dd32cd68e98333831f205dd3ced69bb9344c5b167ba084662f1108690f371b4b64f6b786955a332bcd51a2dc21c2179fb1b4727430dd WHIRLPOOL fc97923e08202e117ca3112b69f74a9f4663a70f55fa051ac55e02c85be57423f762263cac2ded33d9c2f412736e4fa0937aa07df3f36b915e806959055a796b
+DIST jedit_build-isabelle-component-20131106.tar.gz 8796625 SHA256 a13a896263804f5aee82db0e1fe6be7982abe3ca1266cd15f7fe9c8c2f6e2ba5 SHA512 7fc3313916cd408c906e453a4895f49223a8b9dc1e2c577c16468394b73a3724449b411521884d419683cd3d2eb3ef59929608483ff092b9b0e3663efd5e136e WHIRLPOOL 4e7c933df7eea5b9c312f8e0c2c46d44a442d0dd2bb76415bea1fcf307ff75d1f8fb592fe4cad647674dc387fe6fa017dbf4e0cf2ec64459bdafb093470e2abf
+DIST jfreechart-isabelle-component-1.0.14-1.tar.gz 3444825 SHA256 b0eb7365c4c5877379889100f081a4afc4117afc0d332941c3dd01bef2c4aee9 SHA512 ee1d84a45e43029d5e3acee823176196da19789322e8d3c2c81d5504930ad81d50e16e5da87655e4151034901daefb4ce6b82334839e39134b3a7ce32203aa67 WHIRLPOOL e6f9caadb802ecb5b784e86e96c008e9271aa0b1c940152fb0b0358280d9c1e274bb0dee1507f8ff0fe7f43f863db538d631c76e146d1f66ab6e8a8fb27eb42d
+DIST jfreechart-isabelle-component-1.0.14.tar.gz 3443727 SHA256 c873ad6f07edbcceb5c76aac2e848c7d7f12c78c93c05f7e97c4b1fdba7c2df0 SHA512 c55ec01b215368f064de2f288f788960a256445adca5565c00aa9c0fab5732707a9e72bcdb3838676c80e735c520b9948855d7a32b9076bf35f1a279320ee72a WHIRLPOOL ba1a75e21525c302a3b755d814502dad60c540c2004dd894f60fdd6966766f85d71bbb45728ca220a4a7cff334de81db756fbb89e1059f32e248cabf0a7b97d6
+DIST polyml-isabelle-component-5.5.1-1.tar.gz 831 SHA256 f19a4dfc3117792423270cb98a5c406f7339f4bd7715c16976a281d964792844 SHA512 35ab69d0fd2737f3c6a13ca022103428bcb0e71032304d244614d271848b9ae8986da25bd4ef02668eef169f3a3a72576a619152ce3cbf036af7aa365e857c1a WHIRLPOOL 682e25b677e1b0401a43d4cff35c69658359b4c74f86d3459c050e7c7b0d17f1de1e7b792f2a51f97acf574ad56b3e89ade688bc24d090b3e89eaf0cb99a08d5
diff --git a/sci-mathematics/isabelle/files/isabelle-2011.1-gentoo-settings.patch b/sci-mathematics/isabelle/files/isabelle-2011.1-gentoo-settings.patch
new file mode 100644
index 000000000000..67e3476f2170
--- /dev/null
+++ b/sci-mathematics/isabelle/files/isabelle-2011.1-gentoo-settings.patch
@@ -0,0 +1,39 @@
+--- Isabelle2011-1-orig/etc/settings 2011-10-10 01:47:58.000000000 +1100
++++ Isabelle2011-1/etc/settings 2012-01-01 16:33:27.922565527 +1100
+@@ -24,9 +24,16 @@
+ "/usr/share/polyml/$ML_PLATFORM" \
+ "/opt/polyml/$ML_PLATFORM" \
+ "")"
+-ML_SYSTEM=$("$ISABELLE_HOME/lib/scripts/polyml-version")
+-ML_OPTIONS="-H 200"
+-ML_SOURCES="$ML_HOME/../src"
++# ML_SYSTEM=$("$ISABELLE_HOME/lib/scripts/polyml-version")
++# ML_OPTIONS="-H 200"
++# ML_SOURCES="$ML_HOME/../src"
++
++# Poly/ML 5.4.0 (64 bit)
++ML_PLATFORM=x86_64-linux
++ML_HOME=/usr/bin
++ML_SYSTEM=polyml-5.4.0
++ML_OPTIONS="-H 1000"
++#ML_SOURCES="$ML_HOME/../src"
+
+ # Poly/ML 32 bit (manual settings)
+ #ML_SYSTEM=polyml-5.4.0
+@@ -106,7 +113,7 @@
+ ISABELLE_TMP_PREFIX="/tmp/isabelle-$USER"
+
+ # Heap input locations. ML system identifier is included in lookup.
+-ISABELLE_PATH="$ISABELLE_HOME_USER/heaps:$ISABELLE_HOME/heaps"
++ISABELLE_PATH="$ISABELLE_HOME_USER/heaps:/usr/lib64/Isabelle2011-1/heaps"
+
+ # Heap output location. ML system identifier is appended automatically later on.
+ ISABELLE_OUTPUT="$ISABELLE_HOME_USER/heaps"
+@@ -170,6 +177,7 @@
+ "/usr/local/ProofGeneral" \
+ "/usr/share/ProofGeneral" \
+ "/opt/ProofGeneral" \
++ "/usr/share/emacs/site-lisp/ProofGeneral" \
+ "")"
+
+ PROOFGENERAL_OPTIONS=""
diff --git a/sci-mathematics/isabelle/files/isabelle-2011.1-graphbrowser.patch b/sci-mathematics/isabelle/files/isabelle-2011.1-graphbrowser.patch
new file mode 100644
index 000000000000..ed8036a9b2d4
--- /dev/null
+++ b/sci-mathematics/isabelle/files/isabelle-2011.1-graphbrowser.patch
@@ -0,0 +1,11 @@
+--- Isabelle2011-1-orig/lib/browser/build 2011-10-10 01:47:58.000000000 +1100
++++ Isabelle2011-1/lib/browser/build 2012-01-08 12:58:06.041444651 +1100
+@@ -6,6 +6,8 @@
+ #
+ # Requires proper Isabelle settings environment.
+
++ISABELLE_HOME="$(cd "$(dirname "${0}")/../.."; pwd -P)"
++source "$ISABELLE_HOME/lib/scripts/getsettings" || exit 2
+
+ ## diagnostics
+
diff --git a/sci-mathematics/isabelle/files/isabelle-2011.1-libsha1.patch b/sci-mathematics/isabelle/files/isabelle-2011.1-libsha1.patch
new file mode 100644
index 000000000000..905a1eb60e5f
--- /dev/null
+++ b/sci-mathematics/isabelle/files/isabelle-2011.1-libsha1.patch
@@ -0,0 +1,11 @@
+--- Isabelle2011-1-orig/src/Pure/General/sha1_polyml.ML 2011-10-10 01:47:58.000000000 +1100
++++ Isabelle2011-1/src/Pure/General/sha1_polyml.ML 2012-12-05 23:28:15.004733643 +1100
+@@ -18,7 +18,7 @@
+ in (op ^) (pairself hex_digit (Integer.div_mod (Char.ord c) 16)) end
+
+ val lib_path =
+- ("$ML_HOME/" ^ (if ML_System.platform_is_cygwin then "sha1.dll" else "libsha1.so"))
++ ("$SHA1_HOME/" ^ (if ML_System.platform_is_cygwin then "sha1.dll" else "libsha1.so"))
+ |> Path.explode;
+
+ fun digest_external str =
diff --git a/sci-mathematics/isabelle/files/isabelle-2011.1-proofgeneral-gentoo-path.patch b/sci-mathematics/isabelle/files/isabelle-2011.1-proofgeneral-gentoo-path.patch
new file mode 100644
index 000000000000..67e3476f2170
--- /dev/null
+++ b/sci-mathematics/isabelle/files/isabelle-2011.1-proofgeneral-gentoo-path.patch
@@ -0,0 +1,39 @@
+--- Isabelle2011-1-orig/etc/settings 2011-10-10 01:47:58.000000000 +1100
++++ Isabelle2011-1/etc/settings 2012-01-01 16:33:27.922565527 +1100
+@@ -24,9 +24,16 @@
+ "/usr/share/polyml/$ML_PLATFORM" \
+ "/opt/polyml/$ML_PLATFORM" \
+ "")"
+-ML_SYSTEM=$("$ISABELLE_HOME/lib/scripts/polyml-version")
+-ML_OPTIONS="-H 200"
+-ML_SOURCES="$ML_HOME/../src"
++# ML_SYSTEM=$("$ISABELLE_HOME/lib/scripts/polyml-version")
++# ML_OPTIONS="-H 200"
++# ML_SOURCES="$ML_HOME/../src"
++
++# Poly/ML 5.4.0 (64 bit)
++ML_PLATFORM=x86_64-linux
++ML_HOME=/usr/bin
++ML_SYSTEM=polyml-5.4.0
++ML_OPTIONS="-H 1000"
++#ML_SOURCES="$ML_HOME/../src"
+
+ # Poly/ML 32 bit (manual settings)
+ #ML_SYSTEM=polyml-5.4.0
+@@ -106,7 +113,7 @@
+ ISABELLE_TMP_PREFIX="/tmp/isabelle-$USER"
+
+ # Heap input locations. ML system identifier is included in lookup.
+-ISABELLE_PATH="$ISABELLE_HOME_USER/heaps:$ISABELLE_HOME/heaps"
++ISABELLE_PATH="$ISABELLE_HOME_USER/heaps:/usr/lib64/Isabelle2011-1/heaps"
+
+ # Heap output location. ML system identifier is appended automatically later on.
+ ISABELLE_OUTPUT="$ISABELLE_HOME_USER/heaps"
+@@ -170,6 +177,7 @@
+ "/usr/local/ProofGeneral" \
+ "/usr/share/ProofGeneral" \
+ "/opt/ProofGeneral" \
++ "/usr/share/emacs/site-lisp/ProofGeneral" \
+ "")"
+
+ PROOFGENERAL_OPTIONS=""
diff --git a/sci-mathematics/isabelle/files/isabelle-2011.1-reverse-line-editor-order.patch b/sci-mathematics/isabelle/files/isabelle-2011.1-reverse-line-editor-order.patch
new file mode 100644
index 000000000000..b2f2c35ee087
--- /dev/null
+++ b/sci-mathematics/isabelle/files/isabelle-2011.1-reverse-line-editor-order.patch
@@ -0,0 +1,12 @@
+--- Isabelle2011-1-orig/etc/settings 2011-10-10 01:47:58.000000000 +1100
++++ Isabelle2011-1/etc/settings 2012-05-27 23:28:37.283028668 +1000
+@@ -66,8 +66,8 @@
+ ###
+
+ ISABELLE_LINE_EDITOR=""
+-[ -z "$ISABELLE_LINE_EDITOR" ] && ISABELLE_LINE_EDITOR="$(type -p rlwrap)"
+ [ -z "$ISABELLE_LINE_EDITOR" ] && ISABELLE_LINE_EDITOR="$(type -p ledit)"
++[ -z "$ISABELLE_LINE_EDITOR" ] && ISABELLE_LINE_EDITOR="$(type -p rlwrap)"
+
+
+ ###
diff --git a/sci-mathematics/isabelle/files/isabelle-2012-gentoo-settings.patch b/sci-mathematics/isabelle/files/isabelle-2012-gentoo-settings.patch
new file mode 100644
index 000000000000..8994491445d5
--- /dev/null
+++ b/sci-mathematics/isabelle/files/isabelle-2012-gentoo-settings.patch
@@ -0,0 +1,62 @@
+--- Isabelle2012-orig/etc/settings 2012-05-23 03:07:38.000000000 +1000
++++ Isabelle2012/etc/settings 2012-05-27 18:07:26.502878614 +1000
+@@ -16,17 +16,24 @@
+ # Only one of the sections below should be activated.
+
+ # Poly/ML default (automated settings)
+-ML_PLATFORM="$ISABELLE_PLATFORM"
+-ML_HOME="$(choosefrom \
+- "$ISABELLE_HOME/contrib/polyml/$ML_PLATFORM" \
+- "$ISABELLE_HOME/../polyml/$ML_PLATFORM" \
+- "/usr/local/polyml/$ML_PLATFORM" \
+- "/usr/share/polyml/$ML_PLATFORM" \
+- "/opt/polyml/$ML_PLATFORM" \
+- "")"
+-ML_SYSTEM=$("$ISABELLE_HOME/lib/scripts/polyml-version")
+-ML_OPTIONS="-H 200"
+-ML_SOURCES="$ML_HOME/../src"
++# ML_PLATFORM="$ISABELLE_PLATFORM"
++# ML_HOME="$(choosefrom \
++# "$ISABELLE_HOME/contrib/polyml/$ML_PLATFORM" \
++# "$ISABELLE_HOME/../polyml/$ML_PLATFORM" \
++# "/usr/local/polyml/$ML_PLATFORM" \
++# "/usr/share/polyml/$ML_PLATFORM" \
++# "/opt/polyml/$ML_PLATFORM" \
++# "")"
++# ML_SYSTEM=$("$ISABELLE_HOME/lib/scripts/polyml-version")
++# ML_OPTIONS="-H 200"
++# ML_SOURCES="$ML_HOME/../src"
++
++# Poly/ML Gentoo (x86_64)
++ML_PLATFORM=x86_64-linux
++ML_HOME="/usr/bin"
++ML_SYSTEM=polyml-5.4.0
++ML_OPTIONS="-H 1000"
++ML_SOURCES="/usr/src/debug/dev-lang/polyml-5.4.0"
+
+ # Poly/ML 32 bit (manual settings)
+ #ML_SYSTEM=polyml-5.4.1
+@@ -102,7 +109,7 @@
+ ISABELLE_TMP_PREFIX="/tmp/isabelle-$USER"
+
+ # Heap input locations. ML system identifier is included in lookup.
+-ISABELLE_PATH="$ISABELLE_HOME_USER/heaps:$ISABELLE_HOME/heaps"
++ISABELLE_PATH="$ISABELLE_HOME_USER/heaps:/usr/lib64/Isabelle2012/heaps"
+
+ # Heap output location. ML system identifier is appended automatically later on.
+ ISABELLE_OUTPUT="$ISABELLE_HOME_USER/heaps"
+@@ -161,13 +168,7 @@
+ ###
+
+ # Proof General home, look in a variety of places
+-PROOFGENERAL_HOME="$(choosefrom \
+- "$ISABELLE_HOME/contrib/ProofGeneral" \
+- "$ISABELLE_HOME/../ProofGeneral" \
+- "/usr/local/ProofGeneral" \
+- "/usr/share/ProofGeneral" \
+- "/opt/ProofGeneral" \
+- "")"
++PROOFGENERAL_HOME="/usr/share/emacs/site-lisp/ProofGeneral"
+
+ PROOFGENERAL_OPTIONS=""
+ #PROOFGENERAL_OPTIONS="-m no_brackets -m no_type_brackets"
diff --git a/sci-mathematics/isabelle/files/isabelle-2012-graphbrowser.patch b/sci-mathematics/isabelle/files/isabelle-2012-graphbrowser.patch
new file mode 100644
index 000000000000..3e63f1c62237
--- /dev/null
+++ b/sci-mathematics/isabelle/files/isabelle-2012-graphbrowser.patch
@@ -0,0 +1,11 @@
+--- Isabelle2012-orig/lib/browser/build 2012-05-20 19:34:33.000000000 +1000
++++ Isabelle2012/lib/browser/build 2012-05-26 22:18:41.952750622 +1000
+@@ -6,6 +6,8 @@
+ #
+ # Requires proper Isabelle settings environment.
+
++ISABELLE_HOME="$(cd "$(dirname "${0}")/../.."; pwd -P)"
++source "$ISABELLE_HOME/lib/scripts/getsettings" || exit 2
+
+ ## diagnostics
+
diff --git a/sci-mathematics/isabelle/files/isabelle-2012-libsha1.patch b/sci-mathematics/isabelle/files/isabelle-2012-libsha1.patch
new file mode 100644
index 000000000000..06933669de7f
--- /dev/null
+++ b/sci-mathematics/isabelle/files/isabelle-2012-libsha1.patch
@@ -0,0 +1,11 @@
+--- Isabelle2012-orig/src/Pure/General/sha1_polyml.ML 2012-05-20 19:34:33.000000000 +1000
++++ Isabelle2012/src/Pure/General/sha1_polyml.ML 2012-12-05 23:24:06.263793934 +1100
+@@ -18,7 +18,7 @@
+ in (op ^) (pairself hex_digit (Integer.div_mod (Char.ord c) 16)) end
+
+ val lib_path =
+- ("$ML_HOME/" ^ (if ML_System.platform_is_cygwin then "sha1.dll" else "libsha1.so"))
++ ("$SHA1_HOME/" ^ (if ML_System.platform_is_cygwin then "sha1.dll" else "libsha1.so"))
+ |> Path.explode;
+
+ fun digest_external str =
diff --git a/sci-mathematics/isabelle/files/isabelle-2012-redundant-equations-in-function-definitions-error.patch b/sci-mathematics/isabelle/files/isabelle-2012-redundant-equations-in-function-definitions-error.patch
new file mode 100644
index 000000000000..18ae43d00fe5
--- /dev/null
+++ b/sci-mathematics/isabelle/files/isabelle-2012-redundant-equations-in-function-definitions-error.patch
@@ -0,0 +1,35 @@
+diff -r dd611ab202a8 -r e7e647949c95 src/HOL/Tools/Function/fun.ML
+--- a/src/HOL/Tools/Function/fun.ML Wed Jun 06 10:35:05 2012 +0200
++++ b/src/HOL/Tools/Function/fun.ML Wed Jun 06 21:36:21 2012 +0200
+@@ -84,10 +84,10 @@
+ spec @ mk_catchall fixes arity_of
+ end
+
+-fun warnings ctxt origs tss =
++fun further_checks ctxt origs tss =
+ let
+- fun warn_redundant t =
+- warning ("Ignoring redundant equation: " ^ quote (Syntax.string_of_term ctxt t))
++ fun fail_redundant t =
++ error (cat_lines ["Equation is redundant (covered by preceding clauses):", Syntax.string_of_term ctxt t])
+ fun warn_missing strs =
+ warning (cat_lines ("Missing patterns in function definition:" :: strs))
+
+@@ -100,7 +100,7 @@
+ @ ["(" ^ string_of_int (length rest) ^ " more)"])
+
+ val _ = (origs ~~ tss')
+- |> map (fn (t, ts) => if null ts then warn_redundant t else ())
++ |> map (fn (t, ts) => if null ts then fail_redundant t else ())
+ in
+ ()
+ end
+@@ -119,7 +119,7 @@
+ val compleqs = add_catchall ctxt fixes feqs (* Completion *)
+
+ val spliteqs = Function_Split.split_all_equations ctxt compleqs
+- |> tap (warnings ctxt feqs)
++ |> tap (further_checks ctxt feqs)
+
+ fun restore_spec thms =
+ bnds ~~ take (length bnds) (unflat spliteqs thms)
diff --git a/sci-mathematics/isabelle/files/isabelle-2012-reverse-line-editor-order.patch b/sci-mathematics/isabelle/files/isabelle-2012-reverse-line-editor-order.patch
new file mode 100644
index 000000000000..233ea5b50fad
--- /dev/null
+++ b/sci-mathematics/isabelle/files/isabelle-2012-reverse-line-editor-order.patch
@@ -0,0 +1,12 @@
+--- Isabelle2012-orig/etc/settings 2012-05-23 03:07:38.000000000 +1000
++++ Isabelle2012/etc/settings 2012-05-27 12:43:36.209715015 +1000
+@@ -62,8 +62,8 @@
+ ###
+
+ ISABELLE_LINE_EDITOR=""
+-[ -z "$ISABELLE_LINE_EDITOR" ] && ISABELLE_LINE_EDITOR="$(type -p rlwrap)"
+ [ -z "$ISABELLE_LINE_EDITOR" ] && ISABELLE_LINE_EDITOR="$(type -p ledit)"
++[ -z "$ISABELLE_LINE_EDITOR" ] && ISABELLE_LINE_EDITOR="$(type -p rlwrap)"
+
+
+ ###
diff --git a/sci-mathematics/isabelle/files/isabelle-2012-signal-handling.patch b/sci-mathematics/isabelle/files/isabelle-2012-signal-handling.patch
new file mode 100644
index 000000000000..d238f41bd32b
--- /dev/null
+++ b/sci-mathematics/isabelle/files/isabelle-2012-signal-handling.patch
@@ -0,0 +1,8 @@
+diff -r c79adcae9869 -r 6de952f4069f lib/scripts/run-polyml
+--- a/lib/scripts/run-polyml Fri May 25 13:23:43 2012 +0200
++++ b/lib/scripts/run-polyml Fri May 25 17:14:14 2012 +0200
+@@ -76,3 +76,3 @@
+ "$ISABELLE_HOME/lib/scripts/feeder" -p -h "$MLTEXT" -t "$MLEXIT" $FEEDER_OPTS | \
+- { read FPID; "$POLY" -q $ML_OPTIONS; RC="$?"; kill -HUP "$FPID"; exit "$RC"; }
++ { read FPID; "$POLY" -q $ML_OPTIONS; RC="$?"; kill -TERM "$FPID"; exit "$RC"; }
+ RC="$?"
diff --git a/sci-mathematics/isabelle/files/isabelle-2013-HOL-Predicate_Compile_Examples.patch b/sci-mathematics/isabelle/files/isabelle-2013-HOL-Predicate_Compile_Examples.patch
new file mode 100644
index 000000000000..bce7eec4417c
--- /dev/null
+++ b/sci-mathematics/isabelle/files/isabelle-2013-HOL-Predicate_Compile_Examples.patch
@@ -0,0 +1,82 @@
+--- Isabelle2013-orig/src/HOL/Predicate_Compile_Examples/Hotel_Example_Prolog.thy 2013-02-13 00:31:10.000000000 +1100
++++ Isabelle2013/src/HOL/Predicate_Compile_Examples/Hotel_Example_Prolog.thy 2013-08-31 14:37:02.015159000 +1000
+@@ -82,7 +82,7 @@
+ setup {* Context.theory_map (Quickcheck.add_tester ("prolog", (Code_Prolog.active, Code_Prolog.test_goals))) *}
+
+ lemma "\<lbrakk> hotel s; isinp s r g \<rbrakk> \<Longrightarrow> owns s r = Some g"
+-quickcheck[tester = prolog, iterations = 1, expect = counterexample]
++quickcheck[tester = prolog, iterations = 1]
+ oops
+
+ section {* Manual setup to find the counterexample *}
+@@ -110,7 +110,7 @@
+
+ lemma
+ "hotel s ==> feels_safe s r ==> isinp s r g ==> owns s r = Some g"
+-quickcheck[tester = prolog, iterations = 1, expect = counterexample]
++quickcheck[tester = prolog, iterations = 1]
+ oops
+
+ section {* Using a global limit for limiting the execution *}
+@@ -146,7 +146,7 @@
+
+ lemma
+ "hotel s ==> feels_safe s r ==> isinp s r g ==> owns s r = Some g"
+-quickcheck[tester = prolog, iterations = 1, expect = counterexample]
++quickcheck[tester = prolog, iterations = 1]
+ oops
+
+ end
+\ No newline at end of file
+--- Isabelle2013-orig/src/HOL/Predicate_Compile_Examples/Context_Free_Grammar_Example.thy 2013-02-13 00:31:10.000000000 +1100
++++ Isabelle2013/src/HOL/Predicate_Compile_Examples/Context_Free_Grammar_Example.thy 2013-08-31 14:36:47.049851000 +1000
+@@ -33,7 +33,7 @@
+
+ lemma
+ "S\<^isub>1p w \<Longrightarrow> w = []"
+-quickcheck[tester = prolog, iterations=1, expect = counterexample]
++quickcheck[tester = prolog, iterations=1]
+ oops
+
+ definition "filter_a = filter (\<lambda>x. x = a)"
+@@ -67,7 +67,7 @@
+
+ theorem S\<^isub>1_sound:
+ "S\<^isub>1p w \<Longrightarrow> length [x \<leftarrow> w. x = a] = length [x \<leftarrow> w. x = b]"
+-quickcheck[tester = prolog, iterations=1, expect = counterexample]
++quickcheck[tester = prolog, iterations=1]
+ oops
+
+
+@@ -91,7 +91,7 @@
+
+ theorem S\<^isub>2_sound:
+ "S\<^isub>2p w \<longrightarrow> length [x \<leftarrow> w. x = a] = length [x \<leftarrow> w. x = b]"
+-quickcheck[tester = prolog, iterations=1, expect = counterexample]
++quickcheck[tester = prolog, iterations=1]
+ oops
+
+ inductive_set S\<^isub>3 and A\<^isub>3 and B\<^isub>3 where
+--- Isabelle2013-orig/src/HOL/Predicate_Compile_Examples/Lambda_Example.thy 2013-02-13 00:31:10.000000000 +1100
++++ Isabelle2013/src/HOL/Predicate_Compile_Examples/Lambda_Example.thy 2013-08-31 14:28:11.784390000 +1000
+@@ -92,7 +92,7 @@
+
+ lemma
+ "\<Gamma> \<turnstile> t : U \<Longrightarrow> t \<rightarrow>\<^sub>\<beta> t' \<Longrightarrow> \<Gamma> \<turnstile> t' : U"
+-quickcheck[tester = prolog, iterations = 1, expect = counterexample]
++quickcheck[tester = prolog, iterations = 1]
+ oops
+
+ text {* Verifying that the found counterexample really is one by means of a proof *}
+--- Isabelle2013-orig/src/HOL/Predicate_Compile_Examples/List_Examples.thy 2013-02-13 00:31:10.000000000 +1100
++++ Isabelle2013/src/HOL/Predicate_Compile_Examples/List_Examples.thy 2013-08-31 14:27:52.013962000 +1000
+@@ -21,7 +21,7 @@
+ lemma "(xs :: nat list) = ys @ ys --> rev xs = xs"
+ quickcheck[tester = random, iterations = 10000]
+ quickcheck[tester = smart_exhaustive, iterations = 1, expect = counterexample]
+-quickcheck[tester = prolog, expect = counterexample]
++quickcheck[tester = prolog]
+ oops
+
+ end
+\ No newline at end of file
diff --git a/sci-mathematics/isabelle/files/isabelle-2013-classpath.patch b/sci-mathematics/isabelle/files/isabelle-2013-classpath.patch
new file mode 100644
index 000000000000..e3b2271a30c5
--- /dev/null
+++ b/sci-mathematics/isabelle/files/isabelle-2013-classpath.patch
@@ -0,0 +1,149 @@
+--- Isabelle2013-orig/lib/Tools/java 2013-02-13 00:31:02.000000000 +1100
++++ Isabelle2013/lib/Tools/java 2015-04-17 12:16:04.734716358 +1000
+@@ -6,5 +6,5 @@
+
+ CLASSPATH="$(jvmpath "$CLASSPATH")"
+ isabelle_jdk java -Dfile.encoding=UTF-8 -server \
+- "-Djava.ext.dirs=$(jvmpath "$ISABELLE_JAVA_EXT:$ISABELLE_HOME/lib/classes/ext")" "$@"
++ "-Djava.ext.dirs=$(jvmpath "$ISABELLE_JAVA_EXT:$ISABELLE_HOME/lib/classes/ext:$(java-config -p scala-2.10 | sed 's@\([^:]*\)/[^:]*:.*@\1@')")" "$@"
+
+--- Isabelle2013-orig/lib/Tools/scala 2013-02-13 00:31:02.000000000 +1100
++++ Isabelle2013/lib/Tools/scala 2015-04-17 12:12:21.606890256 +1000
+@@ -8,4 +8,4 @@
+
+ CLASSPATH="$(jvmpath "$CLASSPATH")"
+ isabelle_scala scala -Dfile.encoding=UTF-8 \
+- "-Djava.ext.dirs=$(jvmpath "$ISABELLE_JAVA_EXT:$ISABELLE_HOME/lib/classes/ext")" "$@"
++ "-Djava.ext.dirs=$(jvmpath "$ISABELLE_JAVA_EXT:$ISABELLE_HOME/lib/classes/ext:$(java-config -p scala-2.10 | sed 's@\([^:]*\)/[^:]*:.*@\1@')")" "$@"
+--- Isabelle2013-orig/lib/Tools/scalac 2013-02-13 00:31:02.000000000 +1100
++++ Isabelle2013/lib/Tools/scalac 2015-04-17 12:12:36.895871214 +1000
+@@ -8,5 +8,5 @@
+
+ CLASSPATH="$(jvmpath "$CLASSPATH")"
+ isabelle_scala scalac -Dfile.encoding=UTF-8 \
+- "-Djava.ext.dirs=$(jvmpath "$ISABELLE_JAVA_EXT:$ISABELLE_HOME/lib/classes/ext")" "$@"
++ "-Djava.ext.dirs=$(jvmpath "$ISABELLE_JAVA_EXT:$ISABELLE_HOME/lib/classes/ext:$(java-config -p scala-2.10 | sed 's@\([^:]*\)/[^:]*:.*@\1@')")" "$@"
+
+--- Isabelle2013-orig/src/Pure/build-jars 2013-02-13 00:31:15.000000000 +1100
++++ Isabelle2013/src/Pure/build-jars 2013-08-18 12:55:51.400924000 +1000
+@@ -133,7 +133,7 @@
+ declare -a JFREECHART_JARS=()
+ for NAME in $JFREECHART_JAR_NAMES
+ do
+- JFREECHART_JARS["${#JFREECHART_JARS[@]}"]="$JFREECHART_HOME/lib/$NAME"
++ JFREECHART_JARS["${#JFREECHART_JARS[@]}"]="$NAME"
+ done
+
+
+--- Isabelle2013-orig/src/Tools/jEdit/lib/Tools/jedit 2013-02-13 00:31:16.000000000 +1100
++++ Isabelle2013/src/Tools/jEdit/lib/Tools/jedit 2013-08-18 16:39:15.495244000 +1000
+@@ -214,97 +214,11 @@
+ declare -a JFREECHART_JARS=()
+ for NAME in $JFREECHART_JAR_NAMES
+ do
+- JFREECHART_JARS["${#JFREECHART_JARS[@]}"]="$JFREECHART_HOME/lib/$NAME"
++ JFREECHART_JARS["${#JFREECHART_JARS[@]}"]="$NAME"
+ done
+
+-
+-# target
+-
+-TARGET="dist/jars/Isabelle-jEdit.jar"
+-
+-declare -a UPDATED=()
+-
+-if [ "$BUILD_JARS" = jars_fresh ]; then
+- OUTDATED=true
+-else
+- OUTDATED=false
+- if [ ! -e "$TARGET" ]; then
+- OUTDATED=true
+- else
+- if [ -n "$ISABELLE_JEDIT_BUILD_HOME" ]; then
+- declare -a DEPS=(
+- "$JEDIT_JAR" "${JEDIT_JARS[@]}" "${JFREECHART_JARS[@]}"
+- "$PURE_JAR" "$GRAPHVIEW_JAR" "${SOURCES[@]}" "${RESOURCES[@]}"
+- )
+- elif [ -e "$ISABELLE_HOME/Admin/build" ]; then
+- declare -a DEPS=("$PURE_JAR" "$GRAPHVIEW_JAR" "${SOURCES[@]}" "${RESOURCES[@]}")
+- else
+- declare -a DEPS=()
+- fi
+- for DEP in "${DEPS[@]}"
+- do
+- [ ! -e "$DEP" ] && fail "Missing file: $DEP"
+- [ "$DEP" -nt "$TARGET" ] && {
+- OUTDATED=true
+- UPDATED["${#UPDATED[@]}"]="$DEP"
+- }
+- done
+- fi
+-fi
+-
+-
+-# build
+-
+-if [ "$OUTDATED" = true ]
+-then
+- echo "### Building Isabelle/jEdit ..."
+-
+- [ "${#UPDATED[@]}" -gt 0 ] && {
+- echo "Changed files:"
+- for FILE in "${UPDATED[@]}"
+- do
+- echo " $FILE"
+- done
+- }
+-
+- [ -z "$ISABELLE_JEDIT_BUILD_HOME" ] && \
+- fail "Unknown ISABELLE_JEDIT_BUILD_HOME -- missing auxiliary component"
+-
+- rm -rf dist || failed
+- mkdir -p dist dist/classes || failed
+-
+- cp -p -R -f "$ISABELLE_JEDIT_BUILD_HOME/contrib/$ISABELLE_JEDIT_BUILD_VERSION/." dist/.
+- cp -p -R -f "${RESOURCES[@]}" dist/classes/.
+- cp src/jEdit.props dist/properties/.
+- cp -p -R -f src/modes/. dist/modes/.
+-
+- perl -i -e 'while (<>) {
+- if (m/NAME="javacc"/) {
+- print qq,<MODE NAME="isabelle" FILE="isabelle.xml" FILE_NAME_GLOB="*.thy"/>\n\n,;
+- print qq,<MODE NAME="isabelle-options" FILE="isabelle-options.xml"/>\n\n,;
+- print qq,<MODE NAME="isabelle-root" FILE="isabelle-root.xml" FILE_NAME_GLOB="ROOT"/>\n\n,; }
+- print; }' dist/modes/catalog
+-
+- cp -p -R -f "${JEDIT_JARS[@]}" dist/jars/. || failed
+- (
+- for JAR in "$JEDIT_JAR" "${JEDIT_JARS[@]}" "${JFREECHART_JARS[@]}" "$PURE_JAR" \
+- "$GRAPHVIEW_JAR" "$SCALA_HOME/lib/scala-compiler.jar"
+- do
+- CLASSPATH="$CLASSPATH:$JAR"
+- done
+- CLASSPATH="$(jvmpath "$CLASSPATH")"
+- exec "$SCALA_HOME/bin/scalac" $ISABELLE_SCALA_BUILD_OPTIONS -d dist/classes "${SOURCES[@]}"
+- ) || fail "Failed to compile sources"
+-
+- cd dist/classes
+- isabelle_jdk jar cf "../jars/Isabelle-jEdit.jar" * || failed
+- cd ../..
+- rm -rf dist/classes
+-fi
+-
+ popd >/dev/null
+
+-
+ ## main
+
+ if [ "$BUILD_ONLY" = false ]; then
+--- Isabelle2013-orig/contrib/jfreechart-1.0.14/etc/settings 2012-12-09 07:23:53.000000000 +1100
++++ Isabelle2013/contrib/jfreechart-1.0.14/etc/settings 2013-08-18 16:18:10.244698000 +1000
+@@ -1,7 +1,5 @@
+ # -*- shell-script -*- :mode=shellscript:
+
+ JFREECHART_HOME="$COMPONENT"
+-JFREECHART_JAR_NAMES="iText-2.1.5.jar jcommon-1.0.18.jar jfreechart-1.0.14.jar"
+-
+-ISABELLE_JAVA_EXT="$ISABELLE_JAVA_EXT:$JFREECHART_HOME/lib"
++JFREECHART_JAR_NAMES="$(java-config -p itext | sed -e 's@:@ @g') $(java-config -p jcommon-1.0 | sed -e 's@:@ @g') $(java-config -p jfreechart-1.0 | sed -e 's@:@ @g')"
+
diff --git a/sci-mathematics/isabelle/files/isabelle-2013-gentoo-settings.patch b/sci-mathematics/isabelle/files/isabelle-2013-gentoo-settings.patch
new file mode 100644
index 000000000000..7066c6b875a2
--- /dev/null
+++ b/sci-mathematics/isabelle/files/isabelle-2013-gentoo-settings.patch
@@ -0,0 +1,19 @@
+--- Isabelle2013-orig/etc/settings 2013-02-13 00:31:02.000000000 +1100
++++ Isabelle2013/etc/settings 2013-08-17 14:47:46.045988000 +1000
+@@ -176,3 +176,16 @@
+ #ISABELLE_GHC="/usr/bin/ghc"
+ #ISABELLE_OCAML="/usr/bin/ocaml"
+ #ISABELLE_SWIPL="/usr/bin/swipl"
++
++# Poly/ML Gentoo (x86_64)
++ML_PLATFORM=x86_64-linux
++ML_HOME="/usr/bin"
++ML_SYSTEM=polyml-5.5.0
++ML_OPTIONS="-H 1000"
++ML_SOURCES="/usr/src/debug/dev-lang/polyml-5.5.0"
++
++# Proof General home
++PROOFGENERAL_HOME="/usr/share/emacs/site-lisp/ProofGeneral"
++PROOFGENERAL_OPTIONS=""
++#PROOFGENERAL_OPTIONS="-m no_brackets -m no_type_brackets"
++
diff --git a/sci-mathematics/isabelle/files/isabelle-2013.2-HOL-Predicate_Compile_Examples.patch b/sci-mathematics/isabelle/files/isabelle-2013.2-HOL-Predicate_Compile_Examples.patch
new file mode 100644
index 000000000000..e1253016837b
--- /dev/null
+++ b/sci-mathematics/isabelle/files/isabelle-2013.2-HOL-Predicate_Compile_Examples.patch
@@ -0,0 +1,89 @@
+--- Isabelle2013-2-orig/src/HOL/Predicate_Compile_Examples/Hotel_Example_Prolog.thy 2013-12-06 02:18:50.000000000 +1100
++++ Isabelle2013-2/src/HOL/Predicate_Compile_Examples/Hotel_Example_Prolog.thy 2014-02-09 22:21:20.676081140 +1100
+@@ -87,7 +87,7 @@
+ *}
+
+ lemma "\<lbrakk> hotel s; isinp s r g \<rbrakk> \<Longrightarrow> owns s r = Some g"
+-quickcheck[tester = prolog, iterations = 1, expect = counterexample]
++quickcheck[tester = prolog, iterations = 1]
+ oops
+
+ section {* Manual setup to find the counterexample *}
+@@ -115,7 +115,7 @@
+
+ lemma
+ "hotel s ==> feels_safe s r ==> isinp s r g ==> owns s r = Some g"
+-quickcheck[tester = prolog, iterations = 1, expect = counterexample]
++quickcheck[tester = prolog, iterations = 1]
+ oops
+
+ section {* Using a global limit for limiting the execution *}
+@@ -151,7 +151,7 @@
+
+ lemma
+ "hotel s ==> feels_safe s r ==> isinp s r g ==> owns s r = Some g"
+-quickcheck[tester = prolog, iterations = 1, expect = counterexample]
++quickcheck[tester = prolog, iterations = 1]
+ oops
+
+ end
+\ No newline at end of file
+--- Isabelle2013-2-orig/src/HOL/Predicate_Compile_Examples/Context_Free_Grammar_Example.thy 2013-12-06 02:18:50.000000000 +1100
++++ Isabelle2013-2/src/HOL/Predicate_Compile_Examples/Context_Free_Grammar_Example.thy 2014-02-09 22:27:26.826238011 +1100
+@@ -36,7 +36,7 @@
+
+ lemma
+ "S\<^sub>1p w \<Longrightarrow> w = []"
+-quickcheck[tester = prolog, iterations=1, expect = counterexample]
++quickcheck[tester = prolog, iterations=1]
+ oops
+
+ definition "filter_a = filter (\<lambda>x. x = a)"
+@@ -70,7 +70,7 @@
+
+ theorem S\<^sub>1_sound:
+ "S\<^sub>1p w \<Longrightarrow> length [x \<leftarrow> w. x = a] = length [x \<leftarrow> w. x = b]"
+-quickcheck[tester = prolog, iterations=1, expect = counterexample]
++quickcheck[tester = prolog, iterations=1]
+ oops
+
+
+@@ -94,7 +94,7 @@
+
+ theorem S\<^sub>2_sound:
+ "S\<^sub>2p w \<longrightarrow> length [x \<leftarrow> w. x = a] = length [x \<leftarrow> w. x = b]"
+-quickcheck[tester = prolog, iterations=1, expect = counterexample]
++quickcheck[tester = prolog, iterations=1]
+ oops
+
+ inductive_set S\<^sub>3 and A\<^sub>3 and B\<^sub>3 where
+@@ -171,4 +171,4 @@
+ hide_const a b
+
+
+-end
+\ No newline at end of file
++end
+--- Isabelle2013-2-orig/src/HOL/Predicate_Compile_Examples/Lambda_Example.thy 2013-12-06 02:18:50.000000000 +1100
++++ Isabelle2013-2/src/HOL/Predicate_Compile_Examples/Lambda_Example.thy 2014-02-09 22:21:20.677081168 +1100
+@@ -95,7 +95,7 @@
+
+ lemma
+ "\<Gamma> \<turnstile> t : U \<Longrightarrow> t \<rightarrow>\<^sub>\<beta> t' \<Longrightarrow> \<Gamma> \<turnstile> t' : U"
+-quickcheck[tester = prolog, iterations = 1, expect = counterexample]
++quickcheck[tester = prolog, iterations = 1]
+ oops
+
+ text {* Verifying that the found counterexample really is one by means of a proof *}
+--- Isabelle2013-2-orig/src/HOL/Predicate_Compile_Examples/List_Examples.thy 2013-12-06 02:18:50.000000000 +1100
++++ Isabelle2013-2/src/HOL/Predicate_Compile_Examples/List_Examples.thy 2014-02-09 22:21:20.678081196 +1100
+@@ -24,7 +24,7 @@
+ lemma "(xs :: nat list) = ys @ ys --> rev xs = xs"
+ quickcheck[tester = random, iterations = 10000]
+ quickcheck[tester = smart_exhaustive, iterations = 1, expect = counterexample]
+-quickcheck[tester = prolog, expect = counterexample]
++quickcheck[tester = prolog]
+ oops
+
+ end
+\ No newline at end of file
diff --git a/sci-mathematics/isabelle/files/isabelle-2013.2-classpath.patch b/sci-mathematics/isabelle/files/isabelle-2013.2-classpath.patch
new file mode 100644
index 000000000000..b3ad4ae95cd9
--- /dev/null
+++ b/sci-mathematics/isabelle/files/isabelle-2013.2-classpath.patch
@@ -0,0 +1,135 @@
+--- Isabelle2013-2-orig/lib/Tools/java 2013-12-06 02:18:34.000000000 +1100
++++ Isabelle2013-2/lib/Tools/java 2015-04-17 12:23:11.535463796 +1000
+@@ -10,5 +10,5 @@
+ unset CLASSPATH
+
+ isabelle_jdk java "${JAVA_ARGS[@]}" \
+- -classpath "$(jvmpath "$ISABELLE_CLASSPATH")" "$@"
++ -classpath "$(jvmpath "$ISABELLE_CLASSPATH:$(java-config -p scala-2.11 | sed 's@\([^:]*\)/[^:]*:.*@\1@')")" "$@"
+
+--- Isabelle2013-2-orig/lib/Tools/scala 2013-12-06 02:18:34.000000000 +1100
++++ Isabelle2013-2/lib/Tools/scala 2015-04-17 12:23:24.836455672 +1000
+@@ -7,5 +7,5 @@
+ isabelle_admin_build jars || exit $?
+
+ isabelle_scala scala -Dfile.encoding=UTF-8 \
+- -classpath "$(jvmpath "$ISABELLE_CLASSPATH")" "$@"
++ -classpath "$(jvmpath "$ISABELLE_CLASSPATH:$(java-config -p scala-2.11 | sed 's@\([^:]*\)/[^:]*:.*@\1@')")" "$@"
+
+--- Isabelle2013-2-orig/lib/Tools/scalac 2013-12-06 02:18:34.000000000 +1100
++++ Isabelle2013-2/lib/Tools/scalac 2015-04-17 12:23:33.084450628 +1000
+@@ -7,5 +7,5 @@
+ isabelle_admin_build jars || exit $?
+
+ isabelle_scala scalac -Dfile.encoding=UTF-8 \
+- -classpath "$(jvmpath "$ISABELLE_CLASSPATH")" "$@"
++ -classpath "$(jvmpath "$ISABELLE_CLASSPATH:$(java-config -p scala-2.11 | sed 's@\([^:]*\)/[^:]*:.*@\1@')")" "$@"
+
+--- Isabelle2013-2-orig/src/Tools/jEdit/lib/Tools/jedit 2013-12-06 02:19:04.000000000 +1100
++++ Isabelle2013-2/src/Tools/jEdit/lib/Tools/jedit 2014-02-09 20:59:14.026841490 +1100
+@@ -211,105 +211,6 @@
+ "$ISABELLE_JEDIT_BUILD_HOME/contrib/jsr305-2.0.0.jar"
+ )
+
+-
+-# target
+-
+-TARGET="dist/jars/Isabelle-jEdit.jar"
+-
+-declare -a UPDATED=()
+-
+-if [ "$BUILD_JARS" = jars_fresh ]; then
+- OUTDATED=true
+-else
+- OUTDATED=false
+- if [ ! -e "$TARGET" ]; then
+- OUTDATED=true
+- else
+- if [ -n "$ISABELLE_JEDIT_BUILD_HOME" ]; then
+- declare -a DEPS=(
+- "$JEDIT_JAR" "${JEDIT_JARS[@]}" "$PURE_JAR" "$GRAPHVIEW_JAR"
+- "${SOURCES[@]}" "${RESOURCES[@]}"
+- )
+- elif [ -e "$ISABELLE_HOME/Admin/build" ]; then
+- declare -a DEPS=("$PURE_JAR" "$GRAPHVIEW_JAR" "${SOURCES[@]}" "${RESOURCES[@]}")
+- else
+- declare -a DEPS=()
+- fi
+- for DEP in "${DEPS[@]}"
+- do
+- [ ! -e "$DEP" ] && fail "Missing file: $DEP"
+- [ "$DEP" -nt "$TARGET" ] && {
+- OUTDATED=true
+- UPDATED["${#UPDATED[@]}"]="$DEP"
+- }
+- done
+- fi
+-fi
+-
+-
+-# build
+-
+-if [ "$OUTDATED" = true ]
+-then
+- echo "### Building Isabelle/jEdit ..."
+-
+- [ "${#UPDATED[@]}" -gt 0 ] && {
+- echo "Changed files:"
+- for FILE in "${UPDATED[@]}"
+- do
+- echo " $FILE"
+- done
+- }
+-
+- [ -z "$ISABELLE_JEDIT_BUILD_HOME" ] && \
+- fail "Unknown ISABELLE_JEDIT_BUILD_HOME -- missing auxiliary component"
+-
+- rm -rf dist || failed
+- mkdir -p dist dist/classes || failed
+-
+- cp -p -R -f "$ISABELLE_JEDIT_BUILD_HOME/contrib/$ISABELLE_JEDIT_BUILD_VERSION/." dist/.
+- cp -p -R -f "${RESOURCES[@]}" dist/classes/.
+- cp src/jEdit.props dist/properties/.
+- cp -p -R -f src/modes/. dist/modes/.
+-
+- perl -i -e 'while (<>) {
+- if (m/NAME="javacc"/) {
+- print qq,<MODE NAME="isabelle" FILE="isabelle.xml" FILE_NAME_GLOB="*.thy"/>\n\n,;
+- print qq,<MODE NAME="isabelle-news" FILE="isabelle-news.xml"/>\n\n,;
+- print qq,<MODE NAME="isabelle-options" FILE="isabelle-options.xml"/>\n\n,;
+- print qq,<MODE NAME="isabelle-root" FILE="isabelle-root.xml" FILE_NAME_GLOB="ROOT"/>\n\n,; }
+- print; }' dist/modes/catalog
+-
+- cd dist
+- isabelle_jdk jar xf jedit.jar
+- cp "$ISABELLE_HOME/lib/logo/isabelle-32.gif" \
+- "org/gjt/sp/jedit/icons/themes/classic/32x32/apps/isabelle.gif" || failed
+- cp "$ISABELLE_HOME/lib/logo/isabelle-32.gif" \
+- "org/gjt/sp/jedit/icons/themes/tango/32x32/apps/isabelle.gif" || failed
+- isabelle_jdk jar cfe jedit.jar org.gjt.sp.jedit.jEdit org || failed
+- rm -rf META-INF org
+- cd ..
+-
+- cp -p -R -f "${JEDIT_JARS[@]}" dist/jars/. || failed
+- (
+- #workaround for scalac 2.10.2
+- function stty() { :; }
+- export -f stty
+-
+- for JAR in "$JEDIT_JAR" "${JEDIT_JARS[@]}" "$PURE_JAR" "$GRAPHVIEW_JAR"
+- do
+- classpath "$JAR"
+- done
+- export CLASSPATH="$(jvmpath "$ISABELLE_CLASSPATH")"
+- exec "$SCALA_HOME/bin/scalac" $ISABELLE_SCALA_BUILD_OPTIONS -d dist/classes "${SOURCES[@]}"
+- ) || fail "Failed to compile sources"
+-
+- cd dist/classes
+- isabelle_jdk jar cf "../jars/Isabelle-jEdit.jar" * || failed
+- cd ../..
+- rm -rf dist/classes
+-fi
+-
+ popd >/dev/null
+
+
diff --git a/sci-mathematics/isabelle/isabelle-2011.1-r2.ebuild b/sci-mathematics/isabelle/isabelle-2011.1-r2.ebuild
new file mode 100644
index 000000000000..6b96bcb57260
--- /dev/null
+++ b/sci-mathematics/isabelle/isabelle-2011.1-r2.ebuild
@@ -0,0 +1,254 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="5"
+
+inherit eutils java-pkg-2 multilib versionator
+
+MY_PN="Isabelle"
+MY_PV=$(replace_all_version_separators '-')
+MY_P="${MY_PN}${MY_PV}"
+
+DESCRIPTION="Isabelle is a generic proof assistant"
+HOMEPAGE="http://www.cl.cam.ac.uk/research/hvg/isabelle/index.html"
+SRC_URI="http://www.cl.cam.ac.uk/research/hvg/isabelle/dist/${MY_P}.tar.gz"
+
+LICENSE="BSD"
+SLOT="0/${PV}"
+KEYWORDS="~amd64 ~x86"
+ALL_LOGICS="Pure FOL +HOL ZF CCL CTT Cube FOLP LCF Sequents"
+IUSE="${ALL_LOGICS} doc graphbrowsing ledit readline +proofgeneral test"
+
+#upstream says
+#bash 2.x/3.x, Poly/ML 5.x, Perl 5.x,
+#for document preparation: complete LaTeX
+DEPEND=">=app-shells/bash-3.0:*
+ >=dev-lang/polyml-5.4.1:=[-portable]
+ >=dev-lang/perl-5.8.8-r2"
+
+RDEPEND="dev-perl/libwww-perl
+ sci-mathematics/sha1-polyml
+ doc? (
+ virtual/latex-base
+ dev-tex/rail
+ )
+ proofgeneral? (
+ app-emacs/proofgeneral
+ )
+ ledit? (
+ app-misc/ledit
+ )
+ readline? (
+ app-misc/rlwrap
+ )
+ ${DEPEND}"
+
+S="${WORKDIR}"/Isabelle${MY_PV}
+TARGETDIR="/usr/share/Isabelle"${MY_PV}
+LIBDIR="/usr/"$(get_libdir)"/Isabelle"${MY_PV}
+
+pkg_setup() {
+ java-pkg-2_pkg_setup
+ if ! use proofgeneral
+ then
+ ewarn "You have deselected the Proof General interface."
+ ewarn "Only a text terminal will be installed."
+ ewarn "Emerge Isabelle with the proofgeneral USE flag enabled"
+ ewarn "to get the common interface, that most people want."
+ fi
+}
+
+src_prepare() {
+ java-pkg-2_src_prepare
+ epatch "${FILESDIR}/${PN}-2011.1-gentoo-settings.patch"
+ polymlver=$(poly -v | cut -d' ' -f2)
+ polymlarch=$(poly -v | cut -d' ' -f9 | cut -d'-' -f1)
+ sed -e "s@5.4.0@${polymlver}@g" \
+ -i "${S}/etc/settings" \
+ || die "Could not configure polyml version in etc/settings"
+ sed -e "s@ML_HOME=\"/@ML_HOME=\"${ROOT}@" \
+ -i "${S}/etc/settings" \
+ || die "Could not configure polyml ML_HOME in etc/settings"
+ sed -e "s@x86_64@${polymlarch}@g" \
+ -i "${S}/etc/settings" \
+ || die "Could not configure polyml arch in etc/settings"
+ sed -e "s@PROOFGENERAL_HOME=\"/@PROOFGENERAL_HOME=\"${ROOT}@" \
+ -i "${S}/etc/settings" \
+ || die "Could not configure PROOFGENERAL_HOME in etc/settings"
+ sed -e "s@/usr/lib64/Isabelle${MY_PV}@${LIBDIR}@g" \
+ -i "${S}/etc/settings" \
+ || die "Could not configure Isabelle lib directory in etc/settings"
+ epatch "${FILESDIR}/${PN}-2011.1-graphbrowser.patch"
+ epatch "${FILESDIR}/${PN}-2011.1-libsha1.patch"
+ cat <<- EOF >> "${S}/etc/settings"
+
+ ISABELLE_GHC="${ROOT}usr/bin/ghc"
+ ISABELLE_OCAML="${ROOT}usr/bin/ocaml"
+ ISABELLE_SWIPL="${ROOT}usr/bin/swipl"
+ ISABELLE_JDK_HOME="\$(java-config --jdk-home)"
+ SCALA_HOME="${ROOT}usr/share/scala"
+ SHA1_HOME="/usr/$(get_libdir)/sha1-polyml"
+ EOF
+ if use ledit && ! use readline; then
+ epatch "${FILESDIR}/${PN}-2011.1-reverse-line-editor-order.patch"
+ fi
+}
+
+src_compile() {
+ LOGICS=""
+ for l in "${ALL_LOGICS}"; do
+ if has "${l/+/}"; then
+ LOGICS="${LOGICS} ${l/+/}"
+ fi
+ done
+ einfo "Building Isabelle logics ${LOGICS}. This may take some time."
+ ./build -b -i "${LOGICS}" || die "building logics failed"
+ ./bin/isabelle makeall || die "isabelle makeall failed"
+ if use graphbrowsing
+ then
+ rm -f "${S}/lib/browser/GraphBrowser.jar" \
+ || die "failed cleaning graph browser directory"
+ pushd "${S}/lib/browser" \
+ || die "Could not change directory to lib/browser"
+ ./build || die "failed building the graph browser"
+ popd
+ fi
+}
+
+src_test() {
+ einfo "Running tests. A test run can take up to several hours!"
+ ./build -b -t || die "tests failed"
+}
+
+src_install() {
+ exeinto ${TARGETDIR}/bin
+ doexe bin/isabelle-process bin/isabelle
+
+ insinto ${TARGETDIR}
+ doins -r src
+ doins -r lib
+
+ for i in "./build" \
+ "src/Pure/mk" \
+ "src/Pure/build-jars" \
+ "src/Tools/jEdit/dist/build-support/ci/copy_properties.groovy" \
+ "src/Tools/jEdit/dist/build-support/ci/ci_release.groovy" \
+ "src/Tools/jEdit/lib/Tools/jedit" \
+ "src/Tools/Metis/fix_metis_license" \
+ "src/Tools/Metis/make_metis" \
+ "src/Tools/Metis/scripts/mlpp" \
+ "src/Tools/WWW_Find/lib/Tools/wwwfind" \
+ "src/Tools/Code/lib/Tools/codegen" \
+ "src/HOL/Mirabelle/lib/Tools/mirabelle" \
+ "src/HOL/Tools/Predicate_Compile/lib/scripts/swipl_version" \
+ "src/HOL/Tools/SMT/lib/scripts/remote_smt" \
+ "src/HOL/Tools/ATP/scripts/remote_atp" \
+ "src/HOL/Tools/ATP/scripts/spass" \
+ "src/HOL/Tools/Nitpick/lib/Tools/nitrox" \
+ "src/HOL/Mutabelle/lib/Tools/mutabelle" \
+ "src/HOL/Library/Sum_of_Squares/neos_csdp_client" \
+ "lib/browser/build" \
+ "lib/Tools/tty" \
+ "lib/Tools/mkproject" \
+ "lib/Tools/keywords" \
+ "lib/Tools/browser" \
+ "lib/Tools/install" \
+ "lib/Tools/mkdir" \
+ "lib/Tools/unsymbolize" \
+ "lib/Tools/getenv" \
+ "lib/Tools/java" \
+ "lib/Tools/make" \
+ "lib/Tools/emacs" \
+ "lib/Tools/scala" \
+ "lib/Tools/print" \
+ "lib/Tools/latex" \
+ "lib/Tools/findlogics" \
+ "lib/Tools/doc" \
+ "lib/Tools/logo" \
+ "lib/Tools/usedir" \
+ "lib/Tools/yxml" \
+ "lib/Tools/version" \
+ "lib/Tools/makeall" \
+ "lib/Tools/scalac" \
+ "lib/Tools/document" \
+ "lib/Tools/env" \
+ "lib/Tools/display" \
+ "lib/Tools/dimacs2hol" \
+ "lib/scripts/keywords" \
+ "lib/scripts/unsymbolize" \
+ "lib/scripts/run-polyml" \
+ "lib/scripts/run-smlnj" \
+ "lib/scripts/feeder" \
+ "lib/scripts/java_ext_dirs" \
+ "lib/scripts/yxml" \
+ "lib/scripts/raw_dump" \
+ "lib/scripts/polyml-version" \
+ "lib/scripts/process"
+ do
+ exeinto $(dirname "${TARGETDIR}/${i}")
+ doexe ${i}
+ done
+
+ docompress -x /usr/share/doc/${PF}
+ dodoc -r doc
+ if use doc; then
+ dosym /usr/share/doc/${PF}/doc "${TARGETDIR}/doc"
+ fi
+
+ dodir /etc/isabelle
+ insinto /etc/isabelle
+ doins -r etc/*
+
+ dosym /etc/isabelle "${TARGETDIR}/etc"
+ dosym "${LIBDIR}/heaps" "${TARGETDIR}/heaps"
+
+ insinto ${LIBDIR}
+ doins -r heaps
+
+ bin/isabelle install -d ${TARGETDIR} -p "${ED}usr/bin" \
+ || die "isabelle install failed"
+ newicon lib/icons/isabelle.xpm "${PN}.xpm"
+ dodoc ANNOUNCE CONTRIBUTORS COPYRIGHT NEWS README
+
+ java-pkg_regjar \
+ "${ED}${TARGETDIR}/lib/browser/GraphBrowser.jar" \
+ "${ED}${TARGETDIR}/lib/classes/ext/Pure.jar" \
+ "${ED}${TARGETDIR}/lib/classes/ext/scala-library.jar" \
+ "${ED}${TARGETDIR}/lib/classes/ext/scala-swing.jar" \
+ "${ED}${TARGETDIR}/lib/classes/java_ext_dirs.jar"
+}
+
+pkg_postinst() {
+ # If any of the directories in /etc/isabelle/components do not exist, then
+ # even isabelle getenv ISABELLE_HOME fails. Hence it is necessary to
+ # to delete any non-existing directories. If an old Isabelle version was
+ # installed with component ebuilds like sci-mathematics/e, then the
+ # Isabelle version is upgraded, then the contrib directories will not
+ # exist initially, it is necessary to delete them from /etc/isabelle/components.
+ # Then these components are rebuilt (creating these directories) using the
+ # EAPI=5 subslot depends.
+ for i in $(egrep '^[^#].*$' "${ROOT}etc/isabelle/components")
+ do
+ if [ ! -d /usr/share/Isabelle2012/${i} ]; then
+ sed -e "\@${i}@d" -i "${ROOT}etc/isabelle/components"
+ fi
+ done
+ if use ledit && use readline; then
+ elog "Both readline and ledit use flags specified. The default setting"
+ elog "if both are installed is to use readline (rlwrap), this can be"
+ elog "modfied by editing the ISABELLE_LINE_EDITOR setting in"
+ elog "${ROOT}/etc/isabelle/settings"
+ fi
+ elog "Please ensure you have a pdf viewer installed, for example:"
+ elog "As root: emerge app-text/zathura-pdf-poppler"
+ elog "Please configure your preferred pdf viewer, something like:"
+ elog "As normal user: xdg-mime default zathura.desktop application/pdf"
+ elog "Or alternatively by editing the PDF_VIEWER variable in the system"
+ elog "settings file ${ROOT}etc/isabelle/settings and/or the user"
+ elog "settings file \$HOME/.isabelle/${MY_P}/etc/settings"
+ elog "To improve sledgehammer performance, consider installing:"
+ elog "USE=isabelle emerge sci-mathematics/e sci-mathematics/spass"
+ elog "For nitpick it is necessary to install:"
+ elog "emerge sci-mathematics/kodkodi"
+}
diff --git a/sci-mathematics/isabelle/isabelle-2011.1.ebuild b/sci-mathematics/isabelle/isabelle-2011.1.ebuild
new file mode 100644
index 000000000000..f0e0c82faab2
--- /dev/null
+++ b/sci-mathematics/isabelle/isabelle-2011.1.ebuild
@@ -0,0 +1,142 @@
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="4"
+
+JAVA_PKG_OPT_USE="graphbrowsing"
+inherit eutils java-pkg-opt-2 multilib versionator
+
+MY_PN="Isabelle"
+MY_PV=$(replace_all_version_separators '-')
+MY_P="${MY_PN}${MY_PV}"
+
+DESCRIPTION="Isabelle is a generic proof assistant"
+HOMEPAGE="http://www.cl.cam.ac.uk/research/hvg/isabelle/index.html"
+SRC_URI="http://www.cl.cam.ac.uk/research/hvg/isabelle/dist/${MY_P}.tar.gz"
+
+LICENSE="BSD"
+SLOT="0"
+KEYWORDS="~x86 ~amd64"
+ALL_LOGICS="Pure FOL +HOL ZF CCL CTT Cube FOLP LCF Sequents"
+IUSE="${ALL_LOGICS} doc graphbrowsing +proofgeneral test"
+
+#upstream says
+#bash 2.x/3.x, Poly/ML 5.x, Perl 5.x,
+#for document preparation: complete LaTeX
+DEPEND=">=app-shells/bash-3.0
+ >=dev-lang/polyml-5.4.1[-portable]
+ >=dev-lang/perl-5.8.8-r2"
+
+RDEPEND="doc? (
+ virtual/latex-base
+ dev-tex/rail
+ )
+ proofgeneral? (
+ app-emacs/proofgeneral
+ )
+ ${DEPEND}"
+
+S="${WORKDIR}"/Isabelle${MY_PV}
+TARGETDIR="/usr/share/Isabelle"${MY_PV}
+LIBDIR="/usr/"$(get_libdir)"/Isabelle"${MY_PV}
+
+pkg_setup() {
+ java-pkg-opt-2_pkg_setup
+ if ! use proofgeneral
+ then
+ ewarn "You have deselected the Proof General interface."
+ ewarn "Only a text terminal will be installed."
+ ewarn "Emerge Isabelle with the proofgeneral USE flag enabled"
+ ewarn "to get the common interface, that most people want."
+ fi
+}
+
+src_prepare() {
+ java-pkg-opt-2_src_prepare
+ if use proofgeneral; then
+ epatch "${FILESDIR}/${PN}-2011.1-proofgeneral-gentoo-path.patch"
+ polymlver=$(poly -v | cut -d' ' -f2)
+ polymlarch=$(poly -v | cut -d' ' -f9 | cut -d'-' -f1)
+ sed -e "s@5.4.0@${polymlver}@g" \
+ -i "${S}/etc/settings" \
+ || die "Could not configure polyml version in etc/settings"
+ sed -e "s@x86_64@${polymlarch}@g" \
+ -i "${S}/etc/settings" \
+ || die "Could not configure polyml arch in etc/settings"
+ fi
+ if use graphbrowsing; then
+ epatch "${FILESDIR}/${PN}-2011.1-graphbrowser.patch"
+ fi
+}
+
+src_compile() {
+ LOGICS=""
+ for l in "${ALL_LOGICS}"; do
+ if has "${l/+/}"; then
+ LOGICS="${LOGICS} ${l/+/}"
+ fi
+ done
+ einfo "Building Isabelle logics ${LOGICS}. This may take some time."
+ ./build -b -i "${LOGICS}" || die "building logics failed"
+ ./bin/isabelle makeall || die "isabelle makeall failed"
+ if use graphbrowsing
+ then
+ rm -f "${S}/lib/browser/GraphBrowser.jar" \
+ || die "failed cleaning graph browser directory"
+ pushd "${S}/lib/browser" \
+ || die "Could not change directory to lib/browser"
+ ./build || die "failed building the graph browser"
+ popd
+ fi
+}
+
+src_test() {
+ einfo "Running tests. A test run can take up to several hours!"
+ ./build -b -t || die "tests failed"
+}
+
+src_install() {
+ exeinto ${TARGETDIR}/bin
+ doexe bin/isabelle-process bin/isabelle
+
+ exeinto ${TARGETDIR}
+ doexe build
+
+ insinto ${TARGETDIR}
+ doins -r src
+ dodoc -r doc
+
+ dodir /etc/isabelle
+ insinto /etc/isabelle
+ doins -r etc/*
+
+ dosym /etc/isabelle "${TARGETDIR}/etc"
+ dosym "${LIBDIR}/heaps" "${TARGETDIR}/heaps"
+
+ insinto ${LIBDIR}
+ doins -r heaps
+
+ # use cp to keep file attributes
+ cp -R lib "${ED}${TARGETDIR}" || die "install lib failed"
+
+ bin/isabelle install -d ${TARGETDIR} -p "${ED}usr/bin" \
+ || die "isabelle install failed"
+ newicon lib/icons/isabelle.xpm "${PN}.xpm"
+ dodoc ANNOUNCE CONTRIBUTORS COPYRIGHT NEWS README
+
+ java-pkg_regjar \
+ "${ED}${TARGETDIR}/lib/browser/GraphBrowser.jar" \
+ "${ED}${TARGETDIR}/lib/classes/ext/Pure.jar" \
+ "${ED}${TARGETDIR}/lib/classes/ext/scala-library.jar" \
+ "${ED}${TARGETDIR}/lib/classes/ext/scala-swing.jar" \
+ "${ED}${TARGETDIR}/lib/classes/java_ext_dirs.jar"
+}
+
+pkg_postinst() {
+ elog "You will need to re-emerge Isabelle after emerging polyml."
+ elog "Please configure your preferred pdf viewer by editing"
+ elog "the PDF_VIEWER variable in the system settings file"
+ elog "/etc/isabelle/settings and/or the user settings file"
+ elog "\$HOME/.isabelle/${MY_P}/etc/settings"
+}
diff --git a/sci-mathematics/isabelle/isabelle-2012-r1.ebuild b/sci-mathematics/isabelle/isabelle-2012-r1.ebuild
new file mode 100644
index 000000000000..e6afded3e5a1
--- /dev/null
+++ b/sci-mathematics/isabelle/isabelle-2012-r1.ebuild
@@ -0,0 +1,320 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="5"
+
+inherit eutils java-pkg-2 multilib versionator
+
+MY_PN="Isabelle"
+MY_PV=$(replace_all_version_separators '-')
+MY_P="${MY_PN}${MY_PV}"
+
+JEDIT_PV="20120414"
+JEDIT_PN="jedit_build"
+JEDIT_P="${JEDIT_PN}-${JEDIT_PV}"
+
+DESCRIPTION="Isabelle is a generic proof assistant"
+HOMEPAGE="http://www.cl.cam.ac.uk/research/hvg/isabelle/index.html"
+SRC_URI="http://www.cl.cam.ac.uk/research/hvg/isabelle/dist/${MY_P}.tar.gz
+ doc? ( http://dev.gentoo.org/~gienah/snapshots/${MY_P}-doc-src.tar.gz )
+ pide? ( http://www4.in.tum.de/~wenzelm/test/${JEDIT_P}.tar.gz )"
+
+LICENSE="BSD"
+SLOT="0/${PV}"
+KEYWORDS="~amd64 ~x86"
+ALL_LOGICS="Pure FOL +HOL ZF CCL CTT Cube FOLP LCF Sequents"
+IUSE="${ALL_LOGICS} doc graphbrowsing ledit readline pide +proofgeneral test"
+
+#upstream says
+#bash 2.x/3.x, Poly/ML 5.x, Perl 5.x,
+#for document preparation: complete LaTeX
+DEPEND=">=app-shells/bash-3.0:*
+ >=dev-lang/polyml-5.4.1:=[-portable]
+ >=dev-lang/perl-5.8.8-r2"
+
+RDEPEND="dev-perl/libwww-perl
+ sci-mathematics/sha1-polyml
+ doc? (
+ virtual/latex-base
+ dev-tex/rail
+ )
+ proofgeneral? (
+ app-emacs/proofgeneral
+ )
+ pide? (
+ >=dev-lang/scala-2.8.2
+ )
+ ledit? (
+ app-misc/ledit
+ )
+ readline? (
+ app-misc/rlwrap
+ )
+ ${DEPEND}"
+
+S="${WORKDIR}"/Isabelle${MY_PV}
+JEDIT_S="${WORKDIR}/${JEDIT_P}"
+TARGETDIR="/usr/share/Isabelle"${MY_PV}
+LIBDIR="/usr/"$(get_libdir)"/Isabelle"${MY_PV}
+
+pkg_setup() {
+ java-pkg-2_pkg_setup
+ if ! use proofgeneral
+ then
+ ewarn "You have deselected the Proof General interface."
+ ewarn "Only a text terminal will be installed."
+ ewarn "Emerge Isabelle with the proofgeneral USE flag enabled"
+ ewarn "to get the common interface, that most people want."
+ fi
+}
+
+src_prepare() {
+ java-pkg-2_src_prepare
+ epatch "${FILESDIR}/${PN}-2012-gentoo-settings.patch"
+ # http://article.gmane.org/gmane.science.mathematics.logic.isabelle.devel/2732
+ epatch "${FILESDIR}/${PN}-2012-signal-handling.patch"
+ # http://article.gmane.org/gmane.science.mathematics.logic.isabelle.devel/2780
+ epatch "${FILESDIR}/${PN}-2012-redundant-equations-in-function-definitions-error.patch"
+ polymlver=$(poly -v | cut -d' ' -f2)
+ polymlarch=$(poly -v | cut -d' ' -f9 | cut -d'-' -f1)
+ sed -e "s@5.4.0@${polymlver}@g" \
+ -i "${S}/etc/settings" \
+ || die "Could not configure polyml version in etc/settings"
+ sed -e "s@ML_HOME=\"/@ML_HOME=\"${ROOT}@" \
+ -i "${S}/etc/settings" \
+ || die "Could not configure polyml ML_HOME in etc/settings"
+ sed -e "s@x86_64@${polymlarch}@g" \
+ -i "${S}/etc/settings" \
+ || die "Could not configure polyml arch in etc/settings"
+ sed -e "s@PROOFGENERAL_HOME=\"/@PROOFGENERAL_HOME=\"${ROOT}@" \
+ -i "${S}/etc/settings" \
+ || die "Could not configure PROOFGENERAL_HOME in etc/settings"
+ sed -e "s@/usr/lib64/Isabelle${MY_PV}@${LIBDIR}@g" \
+ -i "${S}/etc/settings" \
+ || die "Could not configure Isabelle lib directory in etc/settings"
+ epatch "${FILESDIR}/${PN}-2012-graphbrowser.patch"
+ epatch "${FILESDIR}/${PN}-2012-libsha1.patch"
+ cat <<- EOF >> "${S}/etc/settings"
+
+ ISABELLE_GHC="${ROOT}usr/bin/ghc"
+ ISABELLE_OCAML="${ROOT}usr/bin/ocaml"
+ ISABELLE_SWIPL="${ROOT}usr/bin/swipl"
+ ISABELLE_JDK_HOME="\$(java-config --jdk-home)"
+ SCALA_HOME="${ROOT}usr/share/scala"
+ SHA1_HOME="/usr/$(get_libdir)/sha1-polyml"
+ EOF
+ if use pide; then
+ cat <<- EOF >> "${S}/etc/settings"
+ ISABELLE_JEDIT_BUILD_HOME="\$ISABELLE_HOME/${JEDIT_P}"
+ init_component ${JEDIT_S}
+ EOF
+ fi
+ if use ledit && ! use readline; then
+ epatch "${FILESDIR}/${PN}-2012-reverse-line-editor-order.patch"
+ fi
+}
+
+src_compile() {
+ LOGICS=""
+ for l in "${ALL_LOGICS}"; do
+ if has "${l/+/}"; then
+ LOGICS="${LOGICS} ${l/+/}"
+ fi
+ done
+ einfo "Building Isabelle logics ${LOGICS}. This may take some time."
+ ./build -b -i "${LOGICS}" || die "building logics failed"
+ ./bin/isabelle makeall || die "isabelle makeall failed"
+ if use graphbrowsing
+ then
+ rm -f "${S}/lib/browser/GraphBrowser.jar" \
+ || die "failed cleaning graph browser directory"
+ pushd "${S}/lib/browser" \
+ || die "Could not change directory to lib/browser"
+ ./build || die "failed building the graph browser"
+ popd
+ fi
+ if use pide; then
+ pushd "${S}/src/Tools/jEdit" \
+ || die "Could not change directory to src/Tools/jEdit"
+ "${S}"/bin/isabelle jedit -b -f \
+ || die "pide build failed"
+ popd
+ # The jedit_build stuff is only required to build
+ # Isabelle/jEdit Prover IDE (PIDE). These 2 lines need to be deleted
+ # from etc/settings as the jedit_build source code is not installed
+ sed -e '/ISABELLE_JEDIT_BUILD_HOME/d' \
+ -e '/init_component/d' \
+ -i "${S}/etc/settings" \
+ || die "Could not delete jedit_build lines from etc/settings"
+ fi
+}
+
+src_test() {
+ einfo "Running tests. A test run can take up to several hours!"
+ ./build -b -t || die "tests failed"
+}
+
+src_install() {
+ exeinto ${TARGETDIR}/bin
+ doexe bin/isabelle-process bin/isabelle
+
+ insinto ${TARGETDIR}
+ doins -r src
+ doins -r lib
+
+ docompress -x /usr/share/doc/${PF}
+ dodoc -r doc
+ if use doc; then
+ dosym /usr/share/doc/${PF}/doc "${TARGETDIR}/doc"
+ # The build of sci-mathematics/haskabelle with use doc requires
+ # sci-mathematics/isabelle[doc?]. The haskabelle doc build requires
+ # the doc-src directory stuff in the isabelle package. Which is not
+ # provided in the Isabelle 2012 src tarball. So extract it from a
+ # snapshot of the isabelle repo taken soon after the Isabelle 2012
+ # release.
+ doins -r doc-src
+ for i in "./doc-src/IsarRef/showsymbols" \
+ "./doc-src/TutorialI/Overview/LNCS/makeDemo" \
+ "./doc-src/TutorialI/isa-index" \
+ "./doc-src/sedindex"
+ do
+ exeinto $(dirname "${TARGETDIR}/${i}")
+ doexe ${i}
+ done
+ fi
+
+ for i in "./build" \
+ "./src/Pure/mk" \
+ "./src/Pure/build-jars" \
+ "./src/Tools/JVM/build" \
+ "./src/Tools/JVM/java_ext_dirs" \
+ "./src/Tools/jEdit/lib/Tools/jedit" \
+ "./src/Tools/Metis/fix_metis_license" \
+ "./src/Tools/Metis/make_metis" \
+ "./src/Tools/Metis/scripts/mlpp" \
+ "./src/Tools/WWW_Find/lib/Tools/wwwfind" \
+ "./src/Tools/Code/lib/Tools/codegen" \
+ "./src/HOL/Mirabelle/lib/Tools/mirabelle" \
+ "./src/HOL/Tools/Predicate_Compile/lib/scripts/swipl_version" \
+ "./src/HOL/Tools/SMT/lib/scripts/remote_smt" \
+ "./src/HOL/Tools/ATP/scripts/remote_atp" \
+ "./src/HOL/Tools/ATP/scripts/spass" \
+ "./src/HOL/Mutabelle/lib/Tools/mutabelle" \
+ "./src/HOL/TPTP/TPTP_Parser/make_mlyacclib" \
+ "./src/HOL/TPTP/TPTP_Parser/make_tptp_parser" \
+ "./src/HOL/TPTP/lib/Tools/tptp_isabelle_demo" \
+ "./src/HOL/TPTP/lib/Tools/tptp_graph" \
+ "./src/HOL/TPTP/lib/Tools/tptp_isabelle_comp" \
+ "./src/HOL/TPTP/lib/Tools/tptp_refute" \
+ "./src/HOL/TPTP/lib/Tools/tptp_translate" \
+ "./src/HOL/TPTP/lib/Tools/tptp_sledgehammer" \
+ "./src/HOL/TPTP/lib/Tools/tptp_nitpick" \
+ "./src/HOL/Library/Sum_of_Squares/neos_csdp_client" \
+ "./src/HOL/IMP/export.sh" \
+ "./lib/browser/build" \
+ "./lib/Tools/tty" \
+ "./lib/Tools/mkproject" \
+ "./lib/Tools/keywords" \
+ "./lib/Tools/browser" \
+ "./lib/Tools/install" \
+ "./lib/Tools/mkdir" \
+ "./lib/Tools/unsymbolize" \
+ "./lib/Tools/getenv" \
+ "./lib/Tools/java" \
+ "./lib/Tools/make" \
+ "./lib/Tools/emacs" \
+ "./lib/Tools/scala" \
+ "./lib/Tools/print" \
+ "./lib/Tools/latex" \
+ "./lib/Tools/findlogics" \
+ "./lib/Tools/doc" \
+ "./lib/Tools/logo" \
+ "./lib/Tools/usedir" \
+ "./lib/Tools/yxml" \
+ "./lib/Tools/version" \
+ "./lib/Tools/makeall" \
+ "./lib/Tools/scalac" \
+ "./lib/Tools/document" \
+ "./lib/Tools/env" \
+ "./lib/Tools/display" \
+ "./lib/Tools/dimacs2hol" \
+ "./lib/scripts/keywords" \
+ "./lib/scripts/unsymbolize" \
+ "./lib/scripts/run-polyml" \
+ "./lib/scripts/run-smlnj" \
+ "./lib/scripts/feeder" \
+ "./lib/scripts/yxml" \
+ "./lib/scripts/polyml-version" \
+ "./lib/scripts/process"
+ do
+ exeinto $(dirname "${TARGETDIR}/${i}")
+ doexe ${i}
+ done
+
+ dodir /etc/isabelle
+ insinto /etc/isabelle
+ doins -r etc/*
+
+ dosym /etc/isabelle "${TARGETDIR}/etc"
+ dosym "${LIBDIR}/heaps" "${TARGETDIR}/heaps"
+
+ insinto ${LIBDIR}
+ doins -r heaps
+
+ bin/isabelle install -d ${TARGETDIR} -p "${ED}usr/bin" \
+ || die "isabelle install failed"
+ newicon lib/icons/isabelle.xpm "${PN}.xpm"
+ dodoc ANNOUNCE CONTRIBUTORS COPYRIGHT NEWS README
+
+ java-pkg_regjar \
+ "${ED}${TARGETDIR}/src/Tools/JVM/java_ext_dirs.jar" \
+ "${ED}${TARGETDIR}/src/Tools/jEdit/dist/jars/QuickNotepad.jar" \
+ "${ED}${TARGETDIR}/src/Tools/jEdit/dist/jars/Console.jar" \
+ "${ED}${TARGETDIR}/src/Tools/jEdit/dist/jars/ErrorList.jar" \
+ "${ED}${TARGETDIR}/src/Tools/jEdit/dist/jars/Hyperlinks.jar" \
+ "${ED}${TARGETDIR}/src/Tools/jEdit/dist/jars/SideKick.jar" \
+ "${ED}${TARGETDIR}/src/Tools/jEdit/dist/jars/cobra.jar" \
+ "${ED}${TARGETDIR}/src/Tools/jEdit/dist/jars/js.jar" \
+ "${ED}${TARGETDIR}/src/Tools/jEdit/dist/jars/scala-compiler.jar" \
+ "${ED}${TARGETDIR}/src/Tools/jEdit/dist/jars/Isabelle-jEdit.jar" \
+ "${ED}${TARGETDIR}/src/Tools/jEdit/dist/jedit.jar" \
+ "${ED}${TARGETDIR}/lib/classes/ext/scala-swing.jar" \
+ "${ED}${TARGETDIR}/lib/classes/ext/scala-library.jar" \
+ "${ED}${TARGETDIR}/lib/classes/ext/Pure.jar" \
+ "${ED}${TARGETDIR}/lib/browser/GraphBrowser.jar"
+}
+
+pkg_postinst() {
+ # If any of the directories in /etc/isabelle/components do not exist, then
+ # even isabelle getenv ISABELLE_HOME fails. Hence it is necessary to
+ # to delete any non-existing directories. If an old Isabelle version was
+ # installed with component ebuilds like sci-mathematics/e, then the
+ # Isabelle version is upgraded, then the contrib directories will not
+ # exist initially, it is necessary to delete them from /etc/isabelle/components.
+ # Then these components are rebuilt (creating these directories) using the
+ # EAPI=5 subslot depends.
+ for i in $(egrep '^[^#].*$' "${ROOT}etc/isabelle/components")
+ do
+ if [ ! -d /usr/share/Isabelle2012/${i} ]; then
+ sed -e "\@${i}@d" -i "${ROOT}etc/isabelle/components"
+ fi
+ done
+ if use ledit && use readline; then
+ elog "Both readline and ledit use flags specified. The default setting"
+ elog "if both are installed is to use readline (rlwrap), this can be"
+ elog "modfied by editing the ISABELLE_LINE_EDITOR setting in"
+ elog "${ROOT}/etc/isabelle/settings"
+ fi
+ elog "Please ensure you have a pdf viewer installed, for example:"
+ elog "As root: emerge app-text/zathura-pdf-poppler"
+ elog "Please configure your preferred pdf viewer, something like:"
+ elog "As normal user: xdg-mime default zathura.desktop application/pdf"
+ elog "Or alternatively by editing the PDF_VIEWER variable in the system"
+ elog "settings file ${ROOT}etc/isabelle/settings and/or the user"
+ elog "settings file \$HOME/.isabelle/${MY_P}/etc/settings"
+ elog "To improve sledgehammer performance, consider installing:"
+ elog "USE=isabelle emerge sci-mathematics/e sci-mathematics/spass"
+ elog "For nitpick it is necessary to install:"
+ elog "emerge sci-mathematics/kodkodi"
+}
diff --git a/sci-mathematics/isabelle/isabelle-2013-r2.ebuild b/sci-mathematics/isabelle/isabelle-2013-r2.ebuild
new file mode 100644
index 000000000000..6b5c7f622f8c
--- /dev/null
+++ b/sci-mathematics/isabelle/isabelle-2013-r2.ebuild
@@ -0,0 +1,353 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="5"
+
+inherit eutils java-pkg-2 multilib versionator
+
+MY_PN="Isabelle"
+MY_PV=$(replace_all_version_separators '-')
+MY_P="${MY_PN}${MY_PV}"
+
+JEDIT_PV="20130104"
+JEDIT_PN="jedit_build"
+JEDIT_P="${JEDIT_PN}-${JEDIT_PV}"
+JEDIT_IC_PN="${JEDIT_PN}-isabelle-component"
+JEDIT_IC_P="${JEDIT_IC_PN}-${JEDIT_PV}"
+
+JFREECHART_PV="1.0.14"
+JFREECHART_PN="jfreechart"
+JFREECHART_P="${JFREECHART_PN}-${JFREECHART_PV}"
+JFREECHART_IC_PN="${JFREECHART_PN}-isabelle-component"
+JFREECHART_IC_P="${JFREECHART_IC_PN}-${JFREECHART_PV}"
+
+SS="2.10"
+
+DESCRIPTION="Isabelle is a generic proof assistant"
+HOMEPAGE="http://www.cl.cam.ac.uk/research/hvg/Isabelle/index.html"
+SRC_URI="http://www.cl.cam.ac.uk/research/hvg/Isabelle/dist/${MY_P}.tar.gz
+ http://isabelle.in.tum.de/components/${JEDIT_P}.tar.gz -> ${JEDIT_IC_P}.tar.gz
+ http://isabelle.in.tum.de/components/${JFREECHART_P}.tar.gz -> ${JFREECHART_IC_P}.tar.gz"
+
+LICENSE="BSD"
+SLOT="0/${PV}"
+KEYWORDS="~amd64 ~x86"
+IUSE="doc graphbrowsing ledit readline proofgeneral"
+
+#upstream says
+#bash 2.x/3.x, Poly/ML 5.x, Perl 5.x,
+#for document preparation: complete LaTeX
+DEPEND=">=app-shells/bash-3.0:*
+ dev-java/ant-core:0
+ >=dev-java/jcommon-1.0.18:1.0
+ >=dev-java/jfreechart-1.0.14:1.0
+ >=dev-java/itext-2.1.5:0
+ dev-java/xml-xmlbeans:1
+ >=dev-lang/ghc-7.6.3
+ >=dev-lang/polyml-5.5.0:=[-portable]
+ >=dev-lang/perl-5.8.8-r2
+ dev-lang/swi-prolog
+ virtual/jdk:1.7
+ doc? (
+ virtual/latex-base
+ dev-tex/rail
+ )
+ >=dev-lang/scala-2.10.2:${SS}
+ ledit? (
+ app-misc/ledit
+ )
+ readline? (
+ app-misc/rlwrap
+ )"
+
+RDEPEND="dev-perl/libwww-perl
+ sci-mathematics/sha1-polyml
+ >=virtual/jre-1.7
+ proofgeneral? (
+ >=app-emacs/proofgeneral-4.1
+ )
+ ${DEPEND}"
+
+S="${WORKDIR}"/Isabelle${MY_PV}
+JEDIT_S="${WORKDIR}/${JEDIT_P}"
+JFREECHART_S="${WORKDIR}/${JFREECHART_P}"
+TARGETDIR="/usr/share/Isabelle"${MY_PV}
+LIBDIR="/usr/"$(get_libdir)"/Isabelle"${MY_PV}
+
+LIBRARY_PKGS="scala-${SS},itext,jcommon-1.0,jfreechart-1.0,xml-xmlbeans-1"
+
+src_unpack() {
+ unpack "${MY_P}.tar.gz"
+ pushd "${S}/contrib" || die
+ unpack ${JEDIT_IC_P}.tar.gz
+ unpack ${JFREECHART_IC_P}.tar.gz
+}
+
+pkg_setup() {
+ java-pkg-2_pkg_setup
+}
+
+src_prepare() {
+ java-pkg-2_src_prepare
+ java-pkg_getjars ${LIBRARY_PKGS}
+ epatch "${FILESDIR}/${PN}-2013-gentoo-settings.patch"
+ epatch "${FILESDIR}/${PN}-2013-classpath.patch"
+ polymlver=$(poly -v | cut -d' ' -f2)
+ polymlarch=$(poly -v | cut -d' ' -f9 | cut -d'-' -f1)
+ sed -e "s@5.5.0@${polymlver}@g" \
+ -i "${S}/etc/settings" \
+ || die "Could not configure polyml version in etc/settings"
+ sed -e "s@ML_HOME=\"/@ML_HOME=\"${ROOT}@" \
+ -i "${S}/etc/settings" \
+ || die "Could not configure polyml ML_HOME in etc/settings"
+ sed -e "s@x86_64@${polymlarch}@g" \
+ -i "${S}/etc/settings" \
+ || die "Could not configure polyml arch in etc/settings"
+ sed -e "s@PROOFGENERAL_HOME=\"/@PROOFGENERAL_HOME=\"${ROOT}@" \
+ -i "${S}/etc/settings" \
+ || die "Could not configure PROOFGENERAL_HOME in etc/settings"
+ sed -e "s@/usr/lib64/Isabelle${MY_PV}@${LIBDIR}@g" \
+ -i "${S}/etc/settings" \
+ || die "Could not configure Isabelle lib directory in etc/settings"
+ epatch "${FILESDIR}/${PN}-2012-graphbrowser.patch"
+ epatch "${FILESDIR}/${PN}-2012-libsha1.patch"
+ # this example fails to compile with swi-prolog 6.5.2, so patch it so that
+ # Isabelle will build, then reverse the patch so that the user can see the
+ # original code.
+ epatch "${FILESDIR}/${PN}-2013-HOL-Predicate_Compile_Examples.patch"
+ cat <<- EOF >> "${S}/etc/settings"
+
+ ISABELLE_GHC="${ROOT}usr/bin/ghc"
+ ISABELLE_OCAML="${ROOT}usr/bin/ocaml"
+ ISABELLE_SWIPL="${ROOT}usr/bin/swipl"
+ ISABELLE_JDK_HOME="\$(java-config --jdk-home)"
+ SCALA_HOME="${ROOT}usr/share/scala-${SS}"
+ SHA1_HOME="/usr/$(get_libdir)/sha1-polyml"
+ EOF
+ cat <<- EOF >> "${S}/etc/components"
+ #bundled components
+ contrib/${JEDIT_P}
+ contrib/${JFREECHART_P}
+ EOF
+ if use ledit && ! use readline; then
+ epatch "${FILESDIR}/${PN}-2012-reverse-line-editor-order.patch"
+ fi
+ rm -f "${S}/contrib/jfreechart-1.0.14/lib/iText-2.1.5.jar" \
+ "${S}/contrib/jfreechart-1.0.14/lib/jfreechart-1.0.14.jar" \
+ "${S}/contrib/jfreechart-1.0.14/lib/jcommon-1.0.18.jar" \
+ "${S}/lib/classes/ext/scala-actors.jar" \
+ "${S}/lib/classes/ext/scala-compiler.jar" \
+ "${S}/lib/classes/ext/scala-library.jar" \
+ "${S}/lib/classes/ext/scala-reflect.jar" \
+ "${S}/lib/classes/ext/scala-swing.jar" \
+ || die "Could not rm bundled jar files supplied by Gentoo"
+}
+
+src_compile() {
+ einfo "Building Isabelle. This may take some time."
+ ./bin/isabelle build -a -b -s -v || die "isabelle build failed"
+ epatch --reverse "${FILESDIR}/${PN}-2013-HOL-Predicate_Compile_Examples.patch"
+ if use graphbrowsing
+ then
+ rm -f "${S}/lib/browser/GraphBrowser.jar" \
+ || die "failed cleaning graph browser directory"
+ pushd "${S}/lib/browser" \
+ || die "Could not change directory to lib/browser"
+ ./build || die "failed building the graph browser"
+ popd
+ fi
+ ./bin/isabelle jedit -b -f || die "pide build failed"
+}
+
+src_install() {
+ exeinto ${TARGETDIR}/bin
+ doexe bin/isabelle-process bin/isabelle
+
+ insinto ${TARGETDIR}
+ doins -r src
+ doins -r lib
+ doins -r contrib
+ doins ROOTS
+
+ docompress -x /usr/share/doc/${PF}
+ dodoc -r doc
+ if use doc; then
+ dosym /usr/share/doc/${PF}/doc "${TARGETDIR}/doc"
+ # The build of sci-mathematics/haskabelle with use doc requires
+ # sci-mathematics/isabelle[doc?]. The haskabelle doc build requires
+ # the src/Doc directory stuff in the isabelle package.
+ doins -r src/Doc
+ for i in "./src/Doc/Classes/document/build" \
+ "./src/Doc/Codegen/document/build" \
+ "./src/Doc/Functions/document/build" \
+ "./src/Doc/HOL/document/build" \
+ "./src/Doc/Intro/document/build" \
+ "./src/Doc/IsarImplementation/document/build" \
+ "./src/Doc/IsarRef/document/build" \
+ "./src/Doc/IsarRef/document/showsymbols" \
+ "./src/Doc/LaTeXsugar/document/build" \
+ "./src/Doc/Locales/document/build" \
+ "./src/Doc/Logics/document/build" \
+ "./src/Doc/Main/document/build" \
+ "./src/Doc/Nitpick/document/build" \
+ "./src/Doc/ProgProve/document/build" \
+ "./src/Doc/Ref/document/build" \
+ "./src/Doc/Sledgehammer/document/build" \
+ "./src/Doc/System/document/build" \
+ "./src/Doc/Tutorial/document/build" \
+ "./src/Doc/Tutorial/document/isa-index" \
+ "./src/Doc/ZF/document/build" \
+ "./src/Doc/fixbookmarks" \
+ "./src/Doc/prepare_document" \
+ "./src/Doc/sedindex"
+ do
+ exeinto $(dirname "${TARGETDIR}/${i}")
+ doexe ${i}
+ done
+ fi
+
+ for i in "./Isabelle " \
+ "./bin/isabelle" \
+ "./bin/isabelle-process" \
+ "./lib/Tools/browser" \
+ "./lib/Tools/build" \
+ "./lib/Tools/build_dialog" \
+ "./lib/Tools/components" \
+ "./lib/Tools/dimacs2hol" \
+ "./lib/Tools/display" \
+ "./lib/Tools/doc" \
+ "./lib/Tools/document" \
+ "./lib/Tools/emacs" \
+ "./lib/Tools/env" \
+ "./lib/Tools/findlogics" \
+ "./lib/Tools/getenv" \
+ "./lib/Tools/install" \
+ "./lib/Tools/java" \
+ "./lib/Tools/keywords" \
+ "./lib/Tools/latex" \
+ "./lib/Tools/logo" \
+ "./lib/Tools/make" \
+ "./lib/Tools/mkdir" \
+ "./lib/Tools/mkproject" \
+ "./lib/Tools/mkroot" \
+ "./lib/Tools/options" \
+ "./lib/Tools/print" \
+ "./lib/Tools/scala" \
+ "./lib/Tools/scalac" \
+ "./lib/Tools/tty" \
+ "./lib/Tools/unsymbolize" \
+ "./lib/Tools/usedir" \
+ "./lib/Tools/version" \
+ "./lib/Tools/yxml" \
+ "./lib/browser/build" \
+ "./lib/scripts/feeder" \
+ "./lib/scripts/getsettings" \
+ "./lib/scripts/keywords" \
+ "./lib/scripts/polyml-version" \
+ "./lib/scripts/process" \
+ "./lib/scripts/run-polyml" \
+ "./lib/scripts/run-smlnj" \
+ "./lib/scripts/unsymbolize" \
+ "./lib/scripts/yxml" \
+ "./src/HOL/IMP/export.sh" \
+ "./src/HOL/Library/Sum_of_Squares/neos_csdp_client" \
+ "./src/HOL/Mirabelle/lib/Tools/mirabelle" \
+ "./src/HOL/Mutabelle/lib/Tools/mutabelle" \
+ "./src/HOL/SPARK/Examples/README" \
+ "./src/HOL/TPTP/TPTP_Parser/make_mlyacclib" \
+ "./src/HOL/TPTP/TPTP_Parser/make_tptp_parser" \
+ "./src/HOL/TPTP/lib/Tools/tptp_graph" \
+ "./src/HOL/TPTP/lib/Tools/tptp_isabelle" \
+ "./src/HOL/TPTP/lib/Tools/tptp_isabelle_hot" \
+ "./src/HOL/TPTP/lib/Tools/tptp_nitpick" \
+ "./src/HOL/TPTP/lib/Tools/tptp_refute" \
+ "./src/HOL/TPTP/lib/Tools/tptp_sledgehammer" \
+ "./src/HOL/Tools/ATP/scripts/dummy_atp" \
+ "./src/HOL/Tools/ATP/scripts/remote_atp" \
+ "./src/HOL/Tools/Predicate_Compile/lib/scripts/swipl_version" \
+ "./src/HOL/Tools/SMT/lib/scripts/remote_smt" \
+ "./src/HOL/Tools/Sledgehammer/MaSh/src/compareStats.py" \
+ "./src/HOL/Tools/Sledgehammer/MaSh/src/mash.py" \
+ "./src/Pure/build" \
+ "./src/Pure/build-jars" \
+ "./src/Tools/Code/lib/Tools/codegen" \
+ "./src/Tools/Graphview/lib/Tools/graphview" \
+ "./src/Tools/Metis/fix_metis_license" \
+ "./src/Tools/Metis/make_metis" \
+ "./src/Tools/Metis/scripts/mlpp" \
+ "./src/Tools/WWW_Find/lib/Tools/wwwfind" \
+ "./src/Tools/jEdit/lib/Tools/jedit"
+ do
+ exeinto $(dirname "${TARGETDIR}/${i}")
+ doexe ${i}
+ done
+
+ insinto /etc/isabelle
+ doins -r etc/*
+ dosym /etc/isabelle "${TARGETDIR}/etc"
+
+ dosym "${LIBDIR}/heaps" "${TARGETDIR}/heaps"
+ insinto ${LIBDIR}
+ doins -r heaps
+
+ bin/isabelle install -d ${TARGETDIR} "${ED}usr/bin" \
+ || die "isabelle install failed"
+ newicon lib/icons/isabelle.xpm "${PN}.xpm"
+ dodoc ANNOUNCE CONTRIBUTORS COPYRIGHT NEWS README
+
+ java-pkg_regjar \
+ "${ED}${TARGETDIR}/contrib/jedit_build-20130104/contrib/Highlight.jar" \
+ "${ED}${TARGETDIR}/contrib/jedit_build-20130104/contrib/ErrorList.jar" \
+ "${ED}${TARGETDIR}/contrib/jedit_build-20130104/contrib/Console.jar" \
+ "${ED}${TARGETDIR}/contrib/jedit_build-20130104/contrib/cobra.jar" \
+ "${ED}${TARGETDIR}/contrib/jedit_build-20130104/contrib/js.jar" \
+ "${ED}${TARGETDIR}/contrib/jedit_build-20130104/contrib/jedit-5.0.0-patched/jedit.jar" \
+ "${ED}${TARGETDIR}/contrib/jedit_build-20130104/contrib/jedit-5.0.0-patched/jars/QuickNotepad.jar" \
+ "${ED}${TARGETDIR}/contrib/jfreechart-1.0.14/jfreechart-1.0.14-demo.jar" \
+ "${ED}${TARGETDIR}/lib/classes/ext/Graphview.jar" \
+ "${ED}${TARGETDIR}/lib/classes/ext/Pure.jar" \
+ "${ED}${TARGETDIR}/src/Tools/jEdit/dist/jars/Console.jar" \
+ "${ED}${TARGETDIR}/src/Tools/jEdit/dist/jars/ErrorList.jar" \
+ "${ED}${TARGETDIR}/src/Tools/jEdit/dist/jars/Highlight.jar" \
+ "${ED}${TARGETDIR}/src/Tools/jEdit/dist/jars/Isabelle-jEdit.jar" \
+ "${ED}${TARGETDIR}/src/Tools/jEdit/dist/jars/QuickNotepad.jar" \
+ "${ED}${TARGETDIR}/src/Tools/jEdit/dist/jars/SideKick.jar" \
+ "${ED}${TARGETDIR}/src/Tools/jEdit/dist/jars/cobra.jar" \
+ "${ED}${TARGETDIR}/src/Tools/jEdit/dist/jars/js.jar" \
+ "${ED}${TARGETDIR}/src/Tools/jEdit/dist/jedit.jar"
+}
+
+pkg_postinst() {
+ # If any of the directories in /etc/isabelle/components do not exist, then
+ # even isabelle getenv ISABELLE_HOME fails. Hence it is necessary to
+ # to delete any non-existing directories. If an old Isabelle version was
+ # installed with component ebuilds like sci-mathematics/e, then the
+ # Isabelle version is upgraded, then the contrib directories will not
+ # exist initially, it is necessary to delete them from /etc/isabelle/components.
+ # Then these components are rebuilt (creating these directories) using the
+ # EAPI=5 subslot depends.
+ for i in $(egrep '^[^#].*$' "${ROOT}etc/isabelle/components")
+ do
+ if [ ! -d /usr/share/${MY_P}/${i} ]; then
+ sed -e "\@${i}@d" -i "${ROOT}etc/isabelle/components"
+ fi
+ done
+ if use ledit && use readline; then
+ elog "Both readline and ledit use flags specified. The default setting"
+ elog "if both are installed is to use readline (rlwrap), this can be"
+ elog "modfied by editing the ISABELLE_LINE_EDITOR setting in"
+ elog "${ROOT}/etc/isabelle/settings"
+ fi
+ elog "Please ensure you have a pdf viewer installed, for example:"
+ elog "As root: emerge app-text/zathura-pdf-poppler"
+ elog "Please configure your preferred pdf viewer, something like:"
+ elog "As normal user: xdg-mime default zathura.desktop application/pdf"
+ elog "Or alternatively by editing the PDF_VIEWER variable in the system"
+ elog "settings file ${ROOT}etc/isabelle/settings and/or the user"
+ elog "settings file \$HOME/.isabelle/${MY_P}/etc/settings"
+ elog "To improve sledgehammer performance, consider installing:"
+ elog "USE=isabelle emerge sci-mathematics/e sci-mathematics/spass"
+ elog "For nitpick it is necessary to install:"
+ elog "emerge sci-mathematics/kodkodi"
+}
diff --git a/sci-mathematics/isabelle/isabelle-2013.2-r1.ebuild b/sci-mathematics/isabelle/isabelle-2013.2-r1.ebuild
new file mode 100644
index 000000000000..99fabbc9d239
--- /dev/null
+++ b/sci-mathematics/isabelle/isabelle-2013.2-r1.ebuild
@@ -0,0 +1,375 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="5"
+
+inherit eutils java-pkg-2 multilib versionator
+
+MY_PN="Isabelle"
+MY_PV=$(replace_all_version_separators '-')
+MY_P="${MY_PN}${MY_PV}"
+
+JEDIT_PV="20131106"
+JEDIT_PN="jedit_build"
+JEDIT_P="${JEDIT_PN}-${JEDIT_PV}"
+JEDIT_IC_PN="${JEDIT_PN}-isabelle-component"
+JEDIT_IC_P="${JEDIT_IC_PN}-${JEDIT_PV}"
+
+JFREECHART_PV="1.0.14-1"
+JFREECHART_PN="jfreechart"
+JFREECHART_P="${JFREECHART_PN}-${JFREECHART_PV}"
+JFREECHART_IC_PN="${JFREECHART_PN}-isabelle-component"
+JFREECHART_IC_P="${JFREECHART_IC_PN}-${JFREECHART_PV}"
+
+POLYML_PV="5.5.1-1"
+POLYML_PN="polyml"
+POLYML_P="${POLYML_PN}-${POLYML_PV}"
+POLYML_IC_PN="${POLYML_PN}-isabelle-component"
+POLYML_IC_P="${POLYML_IC_PN}-${POLYML_PV}"
+
+SS="2.11"
+
+DESCRIPTION="Isabelle is a generic proof assistant"
+HOMEPAGE="http://www.cl.cam.ac.uk/research/hvg/Isabelle/index.html"
+SRC_URI="http://www.cl.cam.ac.uk/users/lcp/archive/${MY_P}.tar.gz
+ http://isabelle.in.tum.de/components/${JEDIT_P}.tar.gz -> ${JEDIT_IC_P}.tar.gz
+ http://isabelle.in.tum.de/dist/contrib/${JFREECHART_P}.tar.gz -> ${JFREECHART_IC_P}.tar.gz
+ http://dev.gentoo.org/~gienah/snapshots/${POLYML_IC_P}.tar.gz"
+
+LICENSE="BSD"
+SLOT="0/${PV}"
+KEYWORDS="~amd64 ~x86"
+IUSE="doc graphbrowsing ledit readline proofgeneral"
+
+#upstream says
+#bash 2.x/3.x, Poly/ML 5.x, Perl 5.x,
+#for document preparation: complete LaTeX
+DEPEND=">=app-shells/bash-3.0:*
+ dev-java/ant-core:0
+ >=dev-java/jcommon-1.0.18:1.0
+ >=dev-java/jfreechart-1.0.14:1.0
+ >=dev-java/itext-2.1.5:0
+ dev-java/xml-xmlbeans:1
+ dev-java/xz-java:0
+ >=dev-lang/ghc-7.6.3
+ >=dev-lang/polyml-5.5.1:=[-portable]
+ >=dev-lang/perl-5.8.8-r2
+ dev-lang/swi-prolog
+ virtual/jdk:1.7
+ doc? (
+ virtual/latex-base
+ dev-tex/rail
+ )
+ >=dev-lang/scala-2.11.1:${SS}
+ ledit? (
+ app-misc/ledit
+ )
+ readline? (
+ app-misc/rlwrap
+ )"
+
+RDEPEND="dev-perl/libwww-perl
+ sci-mathematics/sha1-polyml
+ >=virtual/jre-1.7
+ proofgeneral? (
+ >=app-emacs/proofgeneral-4.1
+ )
+ ${DEPEND}"
+
+S="${WORKDIR}"/Isabelle${MY_PV}
+JEDIT_S="${WORKDIR}/${JEDIT_P}"
+JFREECHART_S="${WORKDIR}/${JFREECHART_P}"
+TARGETDIR="/usr/share/Isabelle"${MY_PV}
+LIBDIR="/usr/"$(get_libdir)"/Isabelle"${MY_PV}
+
+# Notes on QA warnings: * Class files not found via DEPEND in package.env
+# Stuff with $ in the name appear to be spurious:
+# isabelle/Markup_Tree$$anonfun$results$1$1.class
+# scala/tools/nsc/backend/jvm/GenJVM$BytecodeGenerator$$anonfun$computeLocalVarsIndex$1.class
+# It wants javafx, I am unsure how to fix this. I test isabelle with the Sun JDK:
+# javafx/application/Platform.class javafx
+# Presumably the user can provide the jEdit plugins if they are necessary:
+# marker/MarkerSetsPlugin.class http://plugins.jedit.org/plugins/?MarkerSets
+# projectviewer/gui/OptionPaneBase.class http://plugins.jedit.org/plugins/?ProjectViewer
+
+LIBRARY_PKGS="ant-core,itext,jcommon-1.0,jfreechart-1.0,scala-${SS},xml-xmlbeans-1,xz-java"
+
+src_unpack() {
+ unpack "${MY_P}.tar.gz"
+ pushd "${S}/contrib" || die
+ unpack ${JEDIT_IC_P}.tar.gz
+ unpack ${JFREECHART_IC_P}.tar.gz
+ unpack ${POLYML_IC_P}.tar.gz
+}
+
+pkg_setup() {
+ java-pkg-2_pkg_setup
+}
+
+src_prepare() {
+ java-pkg-2_src_prepare
+ java-pkg_getjars ${LIBRARY_PKGS}
+ epatch "${FILESDIR}/${PN}-2013-gentoo-settings.patch"
+ epatch "${FILESDIR}/${PN}-2013.2-classpath.patch"
+ polymlver=$(poly -v | cut -d' ' -f2)
+ polymlarch=$(poly -v | cut -d' ' -f9 | cut -d'-' -f1)
+ sed -e "s@5.5.0@${polymlver}@g" \
+ -i "${S}/etc/settings" \
+ || die "Could not configure polyml version in etc/settings"
+ sed -e "s@ML_HOME=\"/@ML_HOME=\"${ROOT}@" \
+ -i "${S}/etc/settings" \
+ || die "Could not configure polyml ML_HOME in etc/settings"
+ sed -e "s@x86_64@${polymlarch}@g" \
+ -i "${S}/etc/settings" \
+ || die "Could not configure polyml arch in etc/settings"
+ sed -e "s@PROOFGENERAL_HOME=\"/@PROOFGENERAL_HOME=\"${ROOT}@" \
+ -i "${S}/etc/settings" \
+ || die "Could not configure PROOFGENERAL_HOME in etc/settings"
+ sed -e "s@/usr/lib64/Isabelle${MY_PV}@${LIBDIR}@g" \
+ -i "${S}/etc/settings" \
+ || die "Could not configure Isabelle lib directory in etc/settings"
+ epatch "${FILESDIR}/${PN}-2012-graphbrowser.patch"
+ epatch "${FILESDIR}/${PN}-2012-libsha1.patch"
+ # this example fails to compile with swi-prolog 6.5.2, so patch it so that
+ # Isabelle will build, then reverse the patch so that the user can see the
+ # original code.
+ epatch "${FILESDIR}/${PN}-2013.2-HOL-Predicate_Compile_Examples.patch"
+ cat <<- EOF >> "${S}/etc/settings"
+
+ ISABELLE_GHC="${ROOT}usr/bin/ghc"
+ ISABELLE_OCAML="${ROOT}usr/bin/ocaml"
+ ISABELLE_SWIPL="${ROOT}usr/bin/swipl"
+ ISABELLE_JDK_HOME="\$(java-config --jdk-home)"
+ SCALA_HOME="${ROOT}usr/share/scala-${SS}"
+ SHA1_HOME="/usr/$(get_libdir)/sha1-polyml"
+ EOF
+ cat <<- EOF >> "${S}/etc/components"
+ #bundled components
+ contrib/${JEDIT_P}
+ contrib/${JFREECHART_P}
+ contrib/${POLYML_P}
+ EOF
+ if use ledit && ! use readline; then
+ epatch "${FILESDIR}/${PN}-2012-reverse-line-editor-order.patch"
+ fi
+ rm -f "${S}/contrib/jfreechart-1.0.14-1/lib/iText-2.1.5.jar" \
+ "${S}/contrib/jfreechart-1.0.14-1/lib/jfreechart-1.0.14.jar" \
+ "${S}/contrib/jfreechart-1.0.14-1/lib/jcommon-1.0.18.jar" \
+ "${S}/lib/classes/ext/scala-actors.jar" \
+ "${S}/lib/classes/ext/scala-compiler.jar" \
+ "${S}/lib/classes/ext/scala-library.jar" \
+ "${S}/lib/classes/ext/scala-reflect.jar" \
+ "${S}/lib/classes/ext/scala-swing.jar" \
+ || die "Could not rm bundled jar files supplied by Gentoo"
+}
+
+src_compile() {
+ einfo "Building Isabelle. This may take some time."
+ ./bin/isabelle build -a -b -s -v || die "isabelle build failed"
+ epatch --reverse "${FILESDIR}/${PN}-2013.2-HOL-Predicate_Compile_Examples.patch"
+ if use graphbrowsing
+ then
+ rm -f "${S}/lib/browser/GraphBrowser.jar" \
+ || die "failed cleaning graph browser directory"
+ pushd "${S}/lib/browser" \
+ || die "Could not change directory to lib/browser"
+ ./build || die "failed building the graph browser"
+ popd
+ fi
+ ./bin/isabelle jedit -b -f || die "pide build failed"
+}
+
+src_install() {
+ insinto ${TARGETDIR}
+ doins -r src
+ doins -r lib
+ doins -r contrib
+ doins ROOTS
+
+ docompress -x /usr/share/doc/${PF}
+ dodoc -r doc
+ if use doc; then
+ dosym /usr/share/doc/${PF}/doc "${TARGETDIR}/doc"
+ # The build of sci-mathematics/haskabelle with use doc requires
+ # sci-mathematics/isabelle[doc?]. The haskabelle doc build requires
+ # the src/Doc directory stuff in the isabelle package.
+ doins -r src/Doc
+ for i in "./src/Doc/Classes/document/build" \
+ "./src/Doc/Codegen/document/build" \
+ "./src/Doc/Datatypes/document/build" \
+ "./src/Doc/fixbookmarks" \
+ "./src/Doc/Functions/document/build" \
+ "./src/Doc/Intro/document/build" \
+ "./src/Doc/IsarImplementation/document/build" \
+ "./src/Doc/IsarRef/document/build" \
+ "./src/Doc/IsarRef/document/showsymbols" \
+ "./src/Doc/JEdit/document/build" \
+ "./src/Doc/LaTeXsugar/document/build" \
+ "./src/Doc/Locales/document/build" \
+ "./src/Doc/Logics/document/build" \
+ "./src/Doc/Main/document/build" \
+ "./src/Doc/Nitpick/document/build" \
+ "./src/Doc/prepare_document" \
+ "./src/Doc/ProgProve/document/build" \
+ "./src/Doc/sedindex" \
+ "./src/Doc/Sledgehammer/document/build" \
+ "./src/Doc/System/document/build" \
+ "./src/Doc/Tutorial/document/build" \
+ "./src/Doc/Tutorial/document/isa-index" \
+ "./src/Doc/ZF/document/build"
+ do
+ exeinto $(dirname "${TARGETDIR}/${i}")
+ doexe ${i}
+ done
+ fi
+
+ for i in "./bin/isabelle" \
+ "./bin/isabelle-process" \
+ "./bin/isabelle_scala_script" \
+ "./lib/browser/build" \
+ "./lib/scripts/feeder" \
+ "./lib/scripts/getsettings" \
+ "./lib/scripts/polyml-version" \
+ "./lib/scripts/process" \
+ "./lib/scripts/run-polyml" \
+ "./lib/scripts/run-polyml-5.5.1" \
+ "./lib/scripts/run-smlnj" \
+ "./lib/scripts/unsymbolize" \
+ "./lib/scripts/update_sub_sup" \
+ "./lib/scripts/yxml" \
+ "./lib/Tools/browser" \
+ "./lib/Tools/build" \
+ "./lib/Tools/components" \
+ "./lib/Tools/display" \
+ "./lib/Tools/doc" \
+ "./lib/Tools/document" \
+ "./lib/Tools/emacs" \
+ "./lib/Tools/env" \
+ "./lib/Tools/findlogics" \
+ "./lib/Tools/getenv" \
+ "./lib/Tools/install" \
+ "./lib/Tools/java" \
+ "./lib/Tools/keywords" \
+ "./lib/Tools/latex" \
+ "./lib/Tools/logo" \
+ "./lib/Tools/mkroot" \
+ "./lib/Tools/options" \
+ "./lib/Tools/scala" \
+ "./lib/Tools/scalac" \
+ "./lib/Tools/tty" \
+ "./lib/Tools/unsymbolize" \
+ "./lib/Tools/update_sub_sup" \
+ "./lib/Tools/version" \
+ "./lib/Tools/yxml" \
+ "./src/HOL/IMP/export.sh" \
+ "./src/HOL/Library/Sum_of_Squares/neos_csdp_client" \
+ "./src/HOL/Mirabelle/lib/Tools/mirabelle" \
+ "./src/HOL/Mutabelle/lib/Tools/mutabelle" \
+ "./src/HOL/SPARK/Examples/README" \
+ "./src/HOL/Tools/ATP/scripts/dummy_atp" \
+ "./src/HOL/Tools/ATP/scripts/remote_atp" \
+ "./src/HOL/Tools/Sledgehammer/MaSh/src/compareStats.py" \
+ "./src/HOL/Tools/Sledgehammer/MaSh/src/mash.py" \
+ "./src/HOL/Tools/Sledgehammer/MaSh/src/server.py" \
+ "./src/HOL/Tools/SMT/lib/scripts/remote_smt" \
+ "./src/HOL/TPTP/lib/Tools/tptp_graph" \
+ "./src/HOL/TPTP/lib/Tools/tptp_isabelle" \
+ "./src/HOL/TPTP/lib/Tools/tptp_isabelle_hot" \
+ "./src/HOL/TPTP/lib/Tools/tptp_nitpick" \
+ "./src/HOL/TPTP/lib/Tools/tptp_refute" \
+ "./src/HOL/TPTP/lib/Tools/tptp_sledgehammer" \
+ "./src/HOL/TPTP/TPTP_Parser/make_mlyacclib" \
+ "./src/HOL/TPTP/TPTP_Parser/make_tptp_parser" \
+ "./src/Pure/build" \
+ "./src/Pure/build-jars" \
+ "./src/Tools/Code/lib/Tools/codegen" \
+ "./src/Tools/Graphview/lib/Tools/graphview" \
+ "./src/Tools/jEdit/lib/Tools/jedit" \
+ "./src/Tools/Metis/fix_metis_license" \
+ "./src/Tools/Metis/make_metis" \
+ "./src/Tools/Metis/scripts/mlpp" \
+ "./src/Tools/WWW_Find/lib/Tools/wwwfind"
+ do
+ exeinto $(dirname "${TARGETDIR}/${i}")
+ doexe ${i}
+ done
+
+ insinto /etc/isabelle
+ doins -r etc/*
+ dosym /etc/isabelle "${TARGETDIR}/etc"
+
+ dosym "${LIBDIR}/heaps" "${TARGETDIR}/heaps"
+ insinto ${LIBDIR}
+ doins -r heaps
+
+ bin/isabelle install -d ${TARGETDIR} "${ED}usr/bin" \
+ || die "isabelle install failed"
+ newicon lib/icons/"${PN}.xpm" "${PN}.xpm"
+ newicon lib/icons/"${PN}-mini.xpm" "${PN}-mini.xpm"
+ dodoc ANNOUNCE CONTRIBUTORS COPYRIGHT NEWS README
+
+ java-pkg_regjar \
+ "${ED}${TARGETDIR}/contrib/${JEDIT_P}/contrib/Console.jar" \
+ "${ED}${TARGETDIR}/contrib/${JEDIT_P}/contrib/ErrorList.jar" \
+ "${ED}${TARGETDIR}/contrib/${JEDIT_P}/contrib/Highlight.jar" \
+ "${ED}${TARGETDIR}/contrib/${JEDIT_P}/contrib/idea-icons.jar" \
+ "${ED}${TARGETDIR}/contrib/${JEDIT_P}/contrib/jedit-5.1.0-patched/jars/QuickNotepad.jar" \
+ "${ED}${TARGETDIR}/contrib/${JEDIT_P}/contrib/jedit-5.1.0-patched/jedit.jar" \
+ "${ED}${TARGETDIR}/contrib/${JEDIT_P}/contrib/jsr305-2.0.0.jar" \
+ "${ED}${TARGETDIR}/contrib/${JEDIT_P}/contrib/MacOSX.jar" \
+ "${ED}${TARGETDIR}/contrib/${JEDIT_P}/contrib/SideKick.jar" \
+ "${ED}${TARGETDIR}/contrib/${JFREECHART_P}/jfreechart-1.0.14-demo.jar" \
+ "${ED}${TARGETDIR}/lib/browser/GraphBrowser.jar" \
+ "${ED}${TARGETDIR}/lib/classes/Graphview.jar" \
+ "${ED}${TARGETDIR}/lib/classes/Pure.jar" \
+ "${ED}${TARGETDIR}/lib/classes/scala-actors.jar" \
+ "${ED}${TARGETDIR}/lib/classes/scala-compiler.jar" \
+ "${ED}${TARGETDIR}/lib/classes/scala-library.jar" \
+ "${ED}${TARGETDIR}/lib/classes/scala-reflect.jar" \
+ "${ED}${TARGETDIR}/lib/classes/scala-swing.jar" \
+ "${ED}${TARGETDIR}/src/Tools/jEdit/dist/jars/Console.jar" \
+ "${ED}${TARGETDIR}/src/Tools/jEdit/dist/jars/ErrorList.jar" \
+ "${ED}${TARGETDIR}/src/Tools/jEdit/dist/jars/Highlight.jar" \
+ "${ED}${TARGETDIR}/src/Tools/jEdit/dist/jars/idea-icons.jar" \
+ "${ED}${TARGETDIR}/src/Tools/jEdit/dist/jars/Isabelle-jEdit.jar" \
+ "${ED}${TARGETDIR}/src/Tools/jEdit/dist/jars/jsr305-2.0.0.jar" \
+ "${ED}${TARGETDIR}/src/Tools/jEdit/dist/jars/MacOSX.jar" \
+ "${ED}${TARGETDIR}/src/Tools/jEdit/dist/jars/QuickNotepad.jar" \
+ "${ED}${TARGETDIR}/src/Tools/jEdit/dist/jars/SideKick.jar" \
+ "${ED}${TARGETDIR}/src/Tools/jEdit/dist/jedit.jar"
+}
+
+pkg_postinst() {
+ # If any of the directories in /etc/isabelle/components do not exist, then
+ # even isabelle getenv ISABELLE_HOME fails. Hence it is necessary to
+ # to delete any non-existing directories. If an old Isabelle version was
+ # installed with component ebuilds like sci-mathematics/e, then the
+ # Isabelle version is upgraded, then the contrib directories will not
+ # exist initially, it is necessary to delete them from /etc/isabelle/components.
+ # Then these components are rebuilt (creating these directories) using the
+ # EAPI=5 subslot depends.
+ for i in $(egrep '^[^#].*$' "${ROOT}etc/isabelle/components")
+ do
+ if [ ! -d /usr/share/${MY_P}/${i} ]; then
+ sed -e "\@${i}@d" -i "${ROOT}etc/isabelle/components"
+ fi
+ done
+ if use ledit && use readline; then
+ elog "Both readline and ledit use flags specified. The default setting"
+ elog "if both are installed is to use readline (rlwrap), this can be"
+ elog "modfied by editing the ISABELLE_LINE_EDITOR setting in"
+ elog "${ROOT}/etc/isabelle/settings"
+ fi
+ elog "Please ensure you have a pdf viewer installed, for example:"
+ elog "As root: emerge app-text/zathura-pdf-poppler"
+ elog "Please configure your preferred pdf viewer, something like:"
+ elog "As normal user: xdg-mime default zathura.desktop application/pdf"
+ elog "Or alternatively by editing the PDF_VIEWER variable in the system"
+ elog "settings file ${ROOT}etc/isabelle/settings and/or the user"
+ elog "settings file \$HOME/.isabelle/${MY_P}/etc/settings"
+ elog "To improve sledgehammer performance, consider installing:"
+ elog "USE=isabelle emerge sci-mathematics/e sci-mathematics/spass"
+ elog "For nitpick it is necessary to install:"
+ elog "emerge sci-mathematics/kodkodi"
+}
diff --git a/sci-mathematics/isabelle/metadata.xml b/sci-mathematics/isabelle/metadata.xml
new file mode 100644
index 000000000000..41285400dc40
--- /dev/null
+++ b/sci-mathematics/isabelle/metadata.xml
@@ -0,0 +1,43 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+<maintainer>
+ <email>gienah@gentoo.org</email>
+</maintainer>
+<herd>sci-mathematics</herd>
+<longdescription lang='en'>
+Isabelle is a generic proof assistant. It allows mathematical
+formulas to be expressed in a formal language and provides tools
+for proving those formulas in a logical calculus. The main
+application is the formalization of mathematical proofs and in
+particular formal verification, which includes proving the
+correctness of computer hardware or software and proving
+properties of computer languages and protocols.
+</longdescription>
+<use>
+ <flag name='Pure'>Pure is the basis for all object-logics.</flag>
+ <flag name='FOL'>FOL (Many-sorted First-Order Logic) provides basic
+ classical and intuitionistic first-order logic. It is polymorphic.</flag>
+ <flag name='HOL'>(Higher-Order Logic) is a version of classical higher-order
+ logic resembling that of the HOL System.</flag>
+ <flag name='ZF'>ZF (Set Theory) offers a formulation of Zermelo-Fraenkel
+ set theory on top of FOL.</flag>
+ <flag name='CCL'>CCL (Classical Computational Logic)</flag>
+ <flag name='CTT'>CTT (Constructive Type Theory) is an extensional version
+ of Martin-Löf's Type Theory.</flag>
+ <flag name='Cube'>Cube (The Lambda Cube)</flag>
+ <flag name='FOLP'>FOLP (FOL with Proof Terms)</flag>
+ <flag name='LCF'>LCF (Logic of Computable Functions)</flag>
+ <flag name='Sequents'>Sequents (first-order, modal and linear logics)</flag>
+ <flag name='graphbrowsing'>Generate theory browsing information,
+ including HTML documents that show a theory's definition, the
+ theorems proved in its ML file and the relationship with its
+ ancestors and descendants.</flag>
+ <flag name='ledit'>Use ledit for the isabelle tty line editor</flag>
+ <flag name='readline'>Use readline (rlwrap) for the isabelle tty line
+ editor</flag>
+ <flag name='proofgeneral'>Add support for the
+ <pkg>app-emacs/proofgeneral</pkg> proof assistant front end.</flag>
+ <flag name='pide'>Build Isabelle/jEdit Prover IDE (PIDE).</flag>
+</use>
+</pkgmetadata>
diff --git a/sci-mathematics/jags/Manifest b/sci-mathematics/jags/Manifest
new file mode 100644
index 000000000000..345adf71ae05
--- /dev/null
+++ b/sci-mathematics/jags/Manifest
@@ -0,0 +1 @@
+DIST JAGS-3.4.0.tar.gz 1677450 SHA256 2beaa9a2672c2c95efc55ffa4c8b597a872f20232373daebd17ad539d3d7d82b SHA512 7a330ea41eab63b23d8ae3622c6920f0dc3dba653a18256957b9b862bb86b746ff706e9e9bf3f806524250b439161a6df4ad05af682354073f9b0074f9825896 WHIRLPOOL 48f2bf92f80ea0558697701320e142a61b3eb5cfefe234973a6a189096b7887ec5ea829f8f6183bf9ad4a0f6fb07d769c710b721ec1e211772cbeaea0187c8e2
diff --git a/sci-mathematics/jags/jags-3.4.0.ebuild b/sci-mathematics/jags/jags-3.4.0.ebuild
new file mode 100644
index 000000000000..f004eb90acc3
--- /dev/null
+++ b/sci-mathematics/jags/jags-3.4.0.ebuild
@@ -0,0 +1,47 @@
+# Copyright 1999-2013 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+inherit autotools-utils toolchain-funcs
+
+MYP="JAGS-${PV}"
+
+DESCRIPTION="Just Another Gibbs Sampler for Bayesian MCMC simulation"
+HOMEPAGE="http://mcmc-jags.sourceforge.net/"
+SRC_URI="mirror://sourceforge/project/mcmc-jags/JAGS/3.x/Source/${MYP}.tar.gz"
+LICENSE="GPL-2"
+IUSE="doc"
+
+SLOT="0"
+KEYWORDS="amd64 x86 ~amd64-linux ~x86-linux"
+
+RDEPEND="
+ virtual/blas
+ virtual/lapack"
+DEPEND="${RDEPEND}
+ virtual/pkgconfig
+ doc? (
+ virtual/latex-base
+ dev-texlive/texlive-latexextra
+ )"
+
+S="${WORKDIR}/${MYP}"
+
+src_configure() {
+ local myeconfargs=(
+ --with-blas="$($(tc-getPKG_CONFIG) --libs blas)"
+ --with-lapack="$($(tc-getPKG_CONFIG) --libs lapack)"
+ )
+ autotools-utils_src_configure
+}
+
+src_compile() {
+ autotools-utils_src_compile all $(use doc && echo docs)
+}
+
+src_install() {
+ autotools-utils_src_install
+ use doc && dodoc "${BUILD_DIR}"/doc/manual/*.pdf
+}
diff --git a/sci-mathematics/jags/metadata.xml b/sci-mathematics/jags/metadata.xml
new file mode 100644
index 000000000000..9a890cc0f1cc
--- /dev/null
+++ b/sci-mathematics/jags/metadata.xml
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <herd>sci-mathematics</herd>
+ <longdescription lang="en">
+ JAGS is Just Another Gibbs Sampler. It is a program for analysis of
+ Bayesian hierarchical models using Markov Chain Monte Carlo (MCMC)
+ simulation not wholly unlike BUGS.
+ JAGS was written with three aims in mind:
+ * To have an engine for the BUGS language that runs on Unix
+ * To be extensible, allowing users to write their own functions,
+ distributions and samplers.
+ * To be a plaftorm for experimentation with ideas in Bayesian modelling
+</longdescription>
+ <upstream>
+ <remote-id type="sourceforge">mcmc-jags</remote-id>
+ </upstream>
+</pkgmetadata>
diff --git a/sci-mathematics/kodkod/Manifest b/sci-mathematics/kodkod/Manifest
new file mode 100644
index 000000000000..6a7aa2023070
--- /dev/null
+++ b/sci-mathematics/kodkod/Manifest
@@ -0,0 +1,2 @@
+DIST kodkod-1.5.2.zip 2092639 SHA256 c54e2181f1e094bf34d52d3ab47b313c4d4464dc25c2cbb3ffd80929d1004a41 SHA512 d55d84e1daabe37c6994fd434c157d5eaecd1d0b2bbe4ab5a2d5e0e529a378d0cb8dc1eac5b89336706f899b23b9682dfd1033f4a2caec76485b12966e091df0 WHIRLPOOL 9919b7bb4de3cf8d53804cfb4a8c5874575acadc6fc7f0afcabd31847947e2f1f77ffb5565fe283088bafb9421fdc8d1245243a58e7f5d97004ecf66d7f1ac12
+DIST waf-1.7.16 91846 SHA256 b64dc26c882572415fd450b745006107965f3fe17b357e3eb43d6676c9635a61 SHA512 ccdf27cac76f525e11bde20d01c3f81b738b4c990934ee290a390fcf1b278da05047bcee76973c80be4557689344f6df33c13e232b278258745e2f19eeed5ebf WHIRLPOOL 79b59876606a93c7a13548799c8797f40515cbf8bc2944018de758df3e8cd9698e4304d5d26a03ae883195ec02d6e0b12e6fc7160e4ef31446d7c3d05f98983a
diff --git a/sci-mathematics/kodkod/files/kodkod-1.5.2-changes-in-most-specific-varargs-method-selection.patch b/sci-mathematics/kodkod/files/kodkod-1.5.2-changes-in-most-specific-varargs-method-selection.patch
new file mode 100644
index 000000000000..613d713f0070
--- /dev/null
+++ b/sci-mathematics/kodkod/files/kodkod-1.5.2-changes-in-most-specific-varargs-method-selection.patch
@@ -0,0 +1,28 @@
+--- kodkod-1.5-orig/src/kodkod/util/ints/Ints.java 2011-09-22 19:00:22.000000000 +1000
++++ kodkod-1.5/src/kodkod/util/ints/Ints.java 2013-02-02 22:30:12.825378928 +1100
+@@ -316,25 +316,6 @@
+ }
+
+ /**
+- * An implementation of Paul Hsieh's hashing function,
+- * described at http://www.azillionmonkeys.com/qed/hash.html.
+- * The method returns a 32 bit hash of the given objects' hash codes,
+- * or zero if the array is empty. Any null references in the array
+- * are taken to have 0 as their hash code value.
+- * @return a 32 bit hash of the given objects' hashCodes
+- */
+- public static int superFastHash(Object... key) {
+- if (key.length==0) return 0;
+- int hash = key.length;
+-
+- for(Object o : key) {
+- hash = superFastHashIncremental(o == null ? 0 : o.hashCode(), hash);
+- }
+- // no end cases since the hashcodes of key parts are ints
+- return superFastHashAvalanche(hash);
+- }
+-
+- /**
+ * An implementation of an IntSet wrapper for an IntRange.
+ */
+ private static final class RangeIntSet extends AbstractIntSet {
diff --git a/sci-mathematics/kodkod/kodkod-1.5.2.ebuild b/sci-mathematics/kodkod/kodkod-1.5.2.ebuild
new file mode 100644
index 000000000000..3462c6d180ae
--- /dev/null
+++ b/sci-mathematics/kodkod/kodkod-1.5.2.ebuild
@@ -0,0 +1,142 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="5"
+
+JAVA_PKG_IUSE="doc source"
+PYTHON_COMPAT=( python2_7 )
+PYTHON_REQ_USE='threads(+)'
+
+inherit eutils java-pkg-2 python-any-r1 waf-utils
+
+DESCRIPTION="a constraint solver for relational logic"
+HOMEPAGE="http://alloy.mit.edu/kodkod/index.html"
+SRC_URI="http://alloy.mit.edu/kodkod/${PV}/${P}.zip
+ http://waf.googlecode.com/files/waf-1.7.16"
+LICENSE="MIT"
+SLOT="0/${PV}"
+KEYWORDS="~amd64 ~x86"
+IUSE=""
+
+COMMON_DEP=""
+RDEPEND="${COMMON_DEP}
+ >=virtual/jre-1.6"
+DEPEND="${COMMON_DEP}
+ >=virtual/jdk-1.6
+ app-arch/unzip"
+
+S="${WORKDIR}/kodkod-1.5"
+
+JAVA_SRC_DIR="src"
+LIBDIR="/usr/"$(get_libdir)"/${PN}"
+
+pkg_setup() {
+ python-any-r1_pkg_setup
+ java-pkg-2_pkg_setup
+}
+
+src_unpack() {
+ unpack "${A% *}"
+ cp "${DISTDIR}/${A#* }" "${S}/waf" || die "Could not copy waf"
+}
+
+src_prepare() {
+ java-pkg-2_src_prepare
+ chmod u+x waf \
+ || die "Could not set execute permisions on waf file"
+ sed -e 's@private N parent, left, right@protected N parent, left, right@' \
+ -e 's@private boolean color@protected boolean color@' \
+ -i "${S}/src/kodkod/util/ints/IntTree.java" \
+ || die "Could not change private to protected in IntTree.java"
+ sed -e 's@conf.env.LINKFLAGS =@conf.env.LINKFLAGS +=@' \
+ -i "${S}/lib/cryptominisat-2.9.1/wscript" \
+ -i "${S}/lib/lingeling-276/wscript" \
+ || die "Could not fix wscripts to respect LDFLAGS"
+ # Fix bug 453162 - sci-mathematics/kodkod-1.5.2: fails to build
+ epatch "${FILESDIR}/${PN}-1.5.2-changes-in-most-specific-varargs-method-selection.patch"
+
+ # Fix Bug 458462 sci-mathematics/kodkod-1.5.2: fails to build with JAVA_PKG_STRICT
+ local x=""
+ for i in $JAVACFLAGS
+ do
+ if [ "${x}" == "" ]; then
+ x="'${i}'"
+ else
+ x="${x}, '${i}'"
+ fi
+ done
+ for j in $(find . -name wscript -print)
+ do
+ sed -e "s@def configure(conf):@def configure(conf):\n conf.env.JAVACFLAGS = [${x}]@" \
+ -i "${j}" \
+ || die "Could not set JAVACFLAGS in ${j}"
+ done
+}
+
+# note: kodkod waf fails when passed --libdir:
+# waf: error: no such option: --libdir
+src_configure() {
+ ${WAF_BINARY:="${S}/waf"}
+
+ tc-export AR CC CPP CXX RANLIB
+ echo "CCFLAGS=\"${CFLAGS}\" LINKFLAGS=\"${LDFLAGS}\" \"${WAF_BINARY}\" --prefix=${EPREFIX}/usr $@ configure"
+
+ CCFLAGS="${CFLAGS}" LINKFLAGS="${LDFLAGS}" "${WAF_BINARY}" \
+ "--prefix=${EPREFIX}/usr" \
+ "$@" \
+ configure || die "configure failed"
+}
+
+src_compile() {
+ waf-utils_src_compile
+ if has doc ${JAVA_PKG_IUSE} && use doc; then
+ pushd src/kodkod || die "Could not cd to src/kodkod"
+ local doclint="-Xdoclint:none"
+ local jv="$(javac -version 2>&1 | cut -d' ' -f 2)"
+ if [[ "${jv}" == 1.6* ]] || [[ "${jv}" == 1.7* ]]; then
+ doclint=""
+ fi
+ javadoc ${doclint} -sourcepath "${S}"/src/kodkod:"${S}"/build/src/kodkod \
+ -classpath $(find "${PWD}" -name \*.jar -print | xargs | sed -e 's@ @:@g') \
+ $(find . -name \*.java -print) \
+ || die "javadoc failed"
+ popd
+ fi
+}
+
+src_install() {
+ insinto "/usr/"$(get_libdir)
+ dodir ${LIBDIR}
+ exeinto ${LIBDIR}
+ for i in $(find . \( -name \*.so -o -name plingeling \) -print | xargs); do
+ doexe $i
+ done
+
+ for i in $(find . \( -name kodkod.jar -o -name org.sat4j.core.jar \) -print | xargs); do
+ einfo "java-pkg_dojar $i"
+ java-pkg_dojar $i
+ done
+
+ # javadoc
+ if has doc ${JAVA_PKG_IUSE} && use doc; then
+ java-pkg_dojavadoc src/kodkod
+ fi
+
+ # dosrc
+ if has source ${JAVA_PKG_IUSE} && use source; then
+ local srcdirs=""
+ if [[ ${JAVA_SRC_DIR} ]]; then
+ local parent child
+ for parent in ${JAVA_SRC_DIR}; do
+ for child in ${parent}/*; do
+ srcdirs="${srcdirs} ${child}"
+ done
+ done
+ else
+ # take all directories actually containing any sources
+ srcdirs="$(cut -d/ -f1 ${sources} | sort -u)"
+ fi
+ java-pkg_dosrc ${srcdirs}
+ fi
+}
diff --git a/sci-mathematics/kodkod/metadata.xml b/sci-mathematics/kodkod/metadata.xml
new file mode 100644
index 000000000000..ff1b15318b9c
--- /dev/null
+++ b/sci-mathematics/kodkod/metadata.xml
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <maintainer>
+ <email>gienah@gentoo.org</email>
+ </maintainer>
+ <herd>sci-mathematics</herd>
+ <longdescription lang="en">
+Kodkod is an efficient SAT-based constraint solver for first order
+logic with relations, transitive closure, bit-vector arithmetic, and
+partial models. It provides analyses for both satisfiable and
+unsatisfiable problems: a finite model finder for the former and a
+minimal unsatisfiable core extractor for the latter. Kodkod is used in
+a wide range of applications, including code checking, test-case
+generation, declarative execution, declarative configuration, and
+lightweight analysis of Alloy, UML, and Isabelle/HOL.
+</longdescription>
+</pkgmetadata>
diff --git a/sci-mathematics/kodkodi/Manifest b/sci-mathematics/kodkodi/Manifest
new file mode 100644
index 000000000000..3d4329f7d2e4
--- /dev/null
+++ b/sci-mathematics/kodkodi/Manifest
@@ -0,0 +1 @@
+DIST kodkodi-1.5.2.tgz 2826648 SHA256 1518d75f3748aa7c791623ff1508b4202f14d744e13b9bd41abf575429caa2b7 SHA512 117e0f1b3e3ee88efb9a9e2f02e8a7ce82a3487528ad0476acf20fafd885d3d48c051bd4a8cb6aa5cda61f24dfa74159448b83398be4119e726e757f6ff3aad4 WHIRLPOOL f331b423b2ad430b59f425d799c3991dccf0e5e9018015f12c30be851f8254cf3b0e39da12fcfd07083813671316ecdcbfc70429742e89cf7b2b4093b773bb0b
diff --git a/sci-mathematics/kodkodi/kodkodi-1.5.2.ebuild b/sci-mathematics/kodkodi/kodkodi-1.5.2.ebuild
new file mode 100644
index 000000000000..a36c2daf0458
--- /dev/null
+++ b/sci-mathematics/kodkodi/kodkodi-1.5.2.ebuild
@@ -0,0 +1,107 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="5"
+
+JAVA_PKG_IUSE="doc source"
+
+inherit java-pkg-2 java-pkg-simple multilib
+
+DESCRIPTION="A text front-end for the Kodkod Java library"
+HOMEPAGE="http://www21.in.tum.de/~blanchet/#software"
+SRC_URI="http://www21.in.tum.de/~blanchet/${P}.tgz"
+
+LICENSE="BSD"
+SLOT="0/${PV}"
+KEYWORDS="~amd64 ~x86"
+IUSE="isabelle examples"
+
+COMMON_DEP="dev-java/antlr:3
+ =sci-mathematics/kodkod-1.5*:="
+RDEPEND="${COMMON_DEP}
+ isabelle? (
+ >=sci-mathematics/isabelle-2011-r1:=
+ )
+ >=virtual/jre-1.6"
+DEPEND="${COMMON_DEP}
+ >=virtual/jdk-1.6
+ app-arch/unzip"
+
+S="${WORKDIR}/${P}"
+
+JAVA_GENTOO_CLASSPATH="kodkod,antlr-3"
+
+java_prepare() {
+ sed -e 's@exec "$ISABELLE_TOOL" java $KODKODI_JAVA_OPT@java@' \
+ -i "${S}/bin/kodkodi" || die "Could not patch bin/kodkodi"
+ rm -f jar/*.jar || die "Could not rm jar files"
+}
+
+src_compile() {
+ JAVA_SRC_DIR="src"
+ TARGETDIR="/usr/share/${P}"
+ KODKOD_LIBDIR="/usr/"$(get_libdir)"/kodkod"
+
+ java-pkg-simple_src_compile
+
+ pushd "${S}/target/classes" > /dev/null || die
+ jar -uf "${S}"/${PN}.jar $(find -name '*.class') || die
+ popd > /dev/null
+}
+
+src_install() {
+ java-pkg-simple_src_install
+ dodoc README HISTORY manual/${PN}.pdf LICENSES/Kodkodi
+ insinto ${TARGETDIR}
+ if use examples; then
+ doins -r examples
+ fi
+
+ if use isabelle; then
+ ISABELLE_HOME="$(isabelle getenv ISABELLE_HOME | cut -d'=' -f 2)" \
+ || die "isabelle getenv ISABELLE_HOME failed"
+ [[ -n "${ISABELLE_HOME}" ]] || die "ISABELLE_HOME empty"
+ dodir "${ISABELLE_HOME}/contrib/${PN}-${PV}/etc"
+ cat <<- EOF >> "${S}/settings"
+ KODKODI="\$COMPONENT"
+ KODKODI_VERSION="${PV}"
+ KODKODI_PLATFORM=\$ISABELLE_PLATFORM
+ KODKODI_CLASSPATH="$(java-config --classpath=antlr:3):${ROOT}usr/share/${PN}-${SLOT}/lib/kodkodi.jar:$(java-config --classpath=kodkod)"
+ KODKODI_JAVA_LIBRARY_PATH="${KODKOD_LIBDIR}"
+ EOF
+ insinto "${ISABELLE_HOME}/contrib/${PN}-${PV}/etc"
+ doins "${S}/settings"
+ dodir "${ISABELLE_HOME}/contrib/${PN}-${PV}/bin"
+ exeinto "${ISABELLE_HOME}/contrib/${PN}-${PV}/bin"
+ doexe bin/kodkodi
+ fi
+}
+
+pkg_postinst() {
+ if use isabelle; then
+ if [ -f "${ROOT}etc/isabelle/components" ]; then
+ if egrep "contrib/${PN}-[0-9.]*" "${ROOT}etc/isabelle/components"; then
+ sed -e "/contrib\/${PN}-[0-9.]*/d" \
+ -i "${ROOT}etc/isabelle/components"
+ fi
+ cat <<- EOF >> "${ROOT}etc/isabelle/components"
+ contrib/${PN}-${PV}
+ EOF
+ fi
+ fi
+}
+
+pkg_postrm() {
+ if use isabelle; then
+ if [ ! -f "${ROOT}usr/bin/kodkodi" ]; then
+ if [ -f "${ROOT}etc/isabelle/components" ]; then
+ # Note: this sed should only match the version of this ebuild
+ # Which is what we want as we do not want to remove the line
+ # of a new kodkodi being installed during an upgrade.
+ sed -e "/contrib\/${PN}-${PV}/d" \
+ -i "${ROOT}etc/isabelle/components"
+ fi
+ fi
+ fi
+}
diff --git a/sci-mathematics/kodkodi/metadata.xml b/sci-mathematics/kodkodi/metadata.xml
new file mode 100644
index 000000000000..bcd7cbb8bab8
--- /dev/null
+++ b/sci-mathematics/kodkodi/metadata.xml
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+<maintainer>
+ <email>gienah@gentoo.org</email>
+ <name>Mark Wright</name>
+</maintainer>
+<herd>sci-mathematics</herd>
+<longdescription lang='en'>
+A text front-end for the Kodkod Java library.
+</longdescription>
+<use>
+ <flag name='isabelle'>Add integration support for the Isabelle/HOL
+ theorem prover.</flag>
+</use>
+</pkgmetadata>
diff --git a/sci-mathematics/lpsolve/Manifest b/sci-mathematics/lpsolve/Manifest
new file mode 100644
index 000000000000..66ad68b59e55
--- /dev/null
+++ b/sci-mathematics/lpsolve/Manifest
@@ -0,0 +1 @@
+DIST lpsolve-5.5.2.0.tar.xz 737000 SHA256 09d914b43db327fa32c94914917c0db9e4f128c407f41df1dae18df6d2c7573d SHA512 341bff74dccf805cfd3aa4ee844a51f3c46ce875e88b1bf079a6ff0074f7cbd27420ec9c6a66a2530098a85c967457214543895651f4c570b956324a51bb9fe6 WHIRLPOOL a8c2a26f2401c5a230043c7e285d6f24d69645aae70a4a0d9eaf973f2afc35e084d2fd32a70e274d19df51d09372052f79f05ba0251694fd6e10b4f18167b921
diff --git a/sci-mathematics/lpsolve/lpsolve-5.5.2.0.ebuild b/sci-mathematics/lpsolve/lpsolve-5.5.2.0.ebuild
new file mode 100644
index 000000000000..3e779e45be57
--- /dev/null
+++ b/sci-mathematics/lpsolve/lpsolve-5.5.2.0.ebuild
@@ -0,0 +1,29 @@
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=4
+
+DESCRIPTION="Mixed Integer Linear Programming (MILP) solver"
+HOMEPAGE="http://sourceforge.net/projects/lpsolve/"
+SRC_URI="http://dev.gentooexperimental.org/~scarabeus/${P}.tar.xz"
+
+LICENSE="LGPL-2.1"
+SLOT="0"
+KEYWORDS="amd64 ~arm ppc ~ppc64 x86 ~amd64-linux ~x86-linux"
+IUSE="static-libs"
+
+DEPEND="sci-libs/colamd"
+RDEPEND="${DEPEND}"
+
+src_configure() {
+ econf \
+ $(use_enable static-libs static) \
+ --docdir="${EPREFIX}/usr/share/doc/${PF}"
+}
+
+src_install() {
+ default
+ # required because it does not provide .pc file
+ use static-libs || find "${ED}" -name '*.la' -exec rm -f {} +
+}
diff --git a/sci-mathematics/lpsolve/metadata.xml b/sci-mathematics/lpsolve/metadata.xml
new file mode 100644
index 000000000000..c8ff3b01d7b1
--- /dev/null
+++ b/sci-mathematics/lpsolve/metadata.xml
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <herd>openoffice</herd>
+ <herd>sci-mathematics</herd>
+</pkgmetadata>
diff --git a/sci-mathematics/lybniz/Manifest b/sci-mathematics/lybniz/Manifest
new file mode 100644
index 000000000000..f34f4c63ab66
--- /dev/null
+++ b/sci-mathematics/lybniz/Manifest
@@ -0,0 +1 @@
+DIST lybniz-1.3.2.tar.gz 70328 SHA256 07cdd1aee3ea0af700f0e7b2364bfc35136356f0a845c784bb117e600be4636b
diff --git a/sci-mathematics/lybniz/lybniz-1.3.2.ebuild b/sci-mathematics/lybniz/lybniz-1.3.2.ebuild
new file mode 100644
index 000000000000..092755bd3a56
--- /dev/null
+++ b/sci-mathematics/lybniz/lybniz-1.3.2.ebuild
@@ -0,0 +1,31 @@
+# Copyright 1999-2011 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="3"
+PYTHON_DEPEND="2"
+
+inherit distutils
+
+DESCRIPTION="A function plotter program written in PyGTK"
+HOMEPAGE="http://lybniz2.sourceforge.net/"
+SRC_URI="mirror://sourceforge/lybniz2/${P}.tar.gz"
+
+LICENSE="BSD"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE=""
+
+DEPEND="dev-python/pygtk:2"
+RDEPEND="${DEPEND}"
+
+pkg_setup() {
+ python_set_active_version 2
+ python_pkg_setup
+}
+
+src_prepare() {
+ sed -i \
+ -e 's/Education;/Education;Math;/' \
+ ${PN}.desktop || die
+}
diff --git a/sci-mathematics/lybniz/metadata.xml b/sci-mathematics/lybniz/metadata.xml
new file mode 100644
index 000000000000..449ff735d563
--- /dev/null
+++ b/sci-mathematics/lybniz/metadata.xml
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <herd>sci-mathematics</herd>
+ <longdescription lang="en">
+ Lybniz is an easy to use mathematical function graph plotter using
+ PyGTK.
+</longdescription>
+ <upstream>
+ <remote-id type="sourceforge">lybniz2</remote-id>
+ </upstream>
+</pkgmetadata>
diff --git a/sci-mathematics/mathomatic/Manifest b/sci-mathematics/mathomatic/Manifest
new file mode 100644
index 000000000000..51564395f8dc
--- /dev/null
+++ b/sci-mathematics/mathomatic/Manifest
@@ -0,0 +1,3 @@
+DIST mathomatic-15.8.5.tar.bz2 270607 SHA256 570065e77196dfca5ad85db4cd9704accf3423fa9552d48a0d847eb67fb7ef98 SHA512 9d8b5fcc369d99b890fde06729daa6c86f1a400d5e42d5fd5d74525b9f4a7c28dea5a05882e753b44590e4624ec7399367a637019867ea85fe68e9e0ed3a3e6e WHIRLPOOL 34c94679cd95cab4bc5b595944d5a82d8cc243dd1203349ca0998ed41e0304d898cbc43fee3155391a2870846dd6d58a404b3cfeedeed05428c4b193135cf94c
+DIST mathomatic-16.0.1.tar.bz2 286365 SHA256 806f64c13f99d17f24681b3e1e5c469f31f7e95776110d7181228ee67e016737 SHA512 d967170b9e02df94fb06019b17e1728e9ec27b9d53abc8a51f333aa0d5d32f2fbcbaba0f1dd3cfbd9905754d38d7057cd639d77f6ecf65eb0177f175b2c500f6 WHIRLPOOL 3eb10303be391d8f889c2159d88e53f302791cfef6632d93f79da481a53fdd4e21d187e1e4f41f941d2ddae3cb0f7b719e3659a0f431360658485b6103ae78e9
+DIST mathomatic-16.0.5.tar.bz2 292220 SHA256 976e6fed1014586bcd584e417c074fa86e4ca6a0fcc2950254da2efde99084ca SHA512 c44c60183442226562df9eefb1d77e5bafd96b7a5d3ad34a76963c586d398647366e782c75ffcf27c2b7d9d4be56678bbbc4d37ac71687a39f04b3fef450cc73 WHIRLPOOL 5d0e01bc829f560e8a84ba8d623f446948a03cd3799361225dcdeb20e96d24031262fef507146330e3d3becde9c1a6b49a5e732f64b7f1283bdc603c68cc1dc9
diff --git a/sci-mathematics/mathomatic/mathomatic-15.8.5.ebuild b/sci-mathematics/mathomatic/mathomatic-15.8.5.ebuild
new file mode 100644
index 000000000000..1ed134b4c31a
--- /dev/null
+++ b/sci-mathematics/mathomatic/mathomatic-15.8.5.ebuild
@@ -0,0 +1,42 @@
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=4
+inherit toolchain-funcs flag-o-matic
+
+DESCRIPTION="Automatic algebraic manipulator"
+HOMEPAGE="http://www.mathomatic.org/"
+SRC_URI="${HOMEPAGE}/archive/${P}.tar.bz2"
+
+LICENSE="LGPL-2.1"
+SLOT="0"
+KEYWORDS="amd64 ppc x86"
+IUSE="doc gnuplot"
+
+DEPEND="sys-libs/readline
+ sys-libs/ncurses"
+RDEPEND="${DEPEND}
+ gnuplot? ( sci-visualization/gnuplot )"
+
+src_compile() {
+ append-cflags -DBOLD_COLOR=1
+ emake READLINE=1 CC=$(tc-getCC)
+ emake CC=$(tc-getCC) -C primes
+}
+
+src_test() {
+ default
+ emake -C primes check
+}
+
+src_install() {
+ emake prefix="${EPREFIX}usr" DESTDIR="${D}" bininstall
+ emake prefix="${EPREFIX}usr" DESTDIR="${D}" -C primes install
+ dodoc changes.txt README.txt AUTHORS
+ newdoc primes/README.txt README-primes.txt
+ use doc && emake \
+ prefix="${EPREFIX}usr" \
+ mathdocdir="${EPREFIX}usr/share/doc/${PF}" \
+ DESTDIR="${D}" docinstall
+}
diff --git a/sci-mathematics/mathomatic/mathomatic-16.0.1.ebuild b/sci-mathematics/mathomatic/mathomatic-16.0.1.ebuild
new file mode 100644
index 000000000000..bf517163d080
--- /dev/null
+++ b/sci-mathematics/mathomatic/mathomatic-16.0.1.ebuild
@@ -0,0 +1,42 @@
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=4
+inherit toolchain-funcs flag-o-matic
+
+DESCRIPTION="Automatic algebraic manipulator"
+HOMEPAGE="http://www.mathomatic.org/"
+SRC_URI="${HOMEPAGE}/archive/${P}.tar.bz2"
+
+LICENSE="LGPL-2.1"
+SLOT="0"
+KEYWORDS="~amd64 ~ppc ~x86 ~amd64-linux ~x86-linux"
+IUSE="doc gnuplot"
+
+DEPEND="sys-libs/readline
+ sys-libs/ncurses"
+RDEPEND="${DEPEND}
+ gnuplot? ( sci-visualization/gnuplot )"
+
+src_compile() {
+ append-cflags -DBOLD_COLOR=1
+ emake READLINE=1 CC=$(tc-getCC)
+ emake CC=$(tc-getCC) -C primes
+}
+
+src_test() {
+ default
+ emake -C primes check
+}
+
+src_install() {
+ emake prefix="${EPREFIX}/usr" DESTDIR="${D}" bininstall
+ emake prefix="${EPREFIX}/usr" DESTDIR="${D}" -C primes install
+ dodoc changes.txt README.txt AUTHORS
+ newdoc primes/README.txt README-primes.txt
+ use doc && emake \
+ prefix="${EPREFIX}/usr" \
+ mathdocdir="${EPREFIX}/usr/share/doc/${PF}" \
+ DESTDIR="${D}" docinstall
+}
diff --git a/sci-mathematics/mathomatic/mathomatic-16.0.5.ebuild b/sci-mathematics/mathomatic/mathomatic-16.0.5.ebuild
new file mode 100644
index 000000000000..e8e3c4530ade
--- /dev/null
+++ b/sci-mathematics/mathomatic/mathomatic-16.0.5.ebuild
@@ -0,0 +1,42 @@
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=4
+inherit toolchain-funcs flag-o-matic
+
+DESCRIPTION="Automatic algebraic manipulator"
+HOMEPAGE="http://www.mathomatic.org/"
+SRC_URI="${HOMEPAGE}/archive/${P}.tar.bz2"
+
+LICENSE="LGPL-2.1"
+SLOT="0"
+KEYWORDS="~amd64 ~ppc ~x86 ~amd64-linux ~x86-linux"
+IUSE="doc gnuplot"
+
+DEPEND="sys-libs/readline
+ sys-libs/ncurses"
+RDEPEND="${DEPEND}
+ gnuplot? ( sci-visualization/gnuplot )"
+
+src_compile() {
+ append-cflags -DBOLD_COLOR=1
+ emake READLINE=1 CC=$(tc-getCC)
+ emake CC=$(tc-getCC) -C primes
+}
+
+src_test() {
+ default
+ emake -C primes check
+}
+
+src_install() {
+ emake prefix="${EPREFIX}/usr" DESTDIR="${D}" bininstall m4install
+ emake prefix="${EPREFIX}/usr" DESTDIR="${D}" -C primes install
+ dodoc changes.txt README.txt AUTHORS
+ newdoc primes/README.txt README-primes.txt
+ use doc && emake \
+ prefix="${EPREFIX}/usr" \
+ mathdocdir="${EPREFIX}/usr/share/doc/${PF}" \
+ DESTDIR="${D}" docinstall
+}
diff --git a/sci-mathematics/mathomatic/metadata.xml b/sci-mathematics/mathomatic/metadata.xml
new file mode 100644
index 000000000000..40d859436f67
--- /dev/null
+++ b/sci-mathematics/mathomatic/metadata.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <herd>sci-mathematics</herd>
+ <longdescription>
+ Mathomatic is a small, portable symbolic math program that can
+ automatically solve, simplify, differentiate, combine, and compare
+ algebraic equations, perform polynomial and complex arithmetic,
+ etc.
+ </longdescription>
+</pkgmetadata>
diff --git a/sci-mathematics/maxima/Manifest b/sci-mathematics/maxima/Manifest
new file mode 100644
index 000000000000..d9727d8761af
--- /dev/null
+++ b/sci-mathematics/maxima/Manifest
@@ -0,0 +1,3 @@
+DIST maxima-5.18.1.tar.gz 20440947 SHA256 eef1f70503755ec8fb311a13731044e6fff17e6fd9534eb6bea68a12964d94bf
+DIST maxima-5.34.1.tar.gz 29469851 SHA256 20ca416ca912c8d3d99299f2ef45342a1beb2f077cf501c6a647de46bfdb89b7 SHA512 24a9ce0d2bfb0fa107460bbeec561869f9d3f2ce2623e39ab16b810dbf2712981bbf98ceee9c30f4e70fdec7f918a7743b5fb8cf26b67313e1d367dd8f2a1823 WHIRLPOOL 0f59cfe14391686a543027bb5cab8669439d0e36b016924872662f61e36cf05663480f8a3f942d7deccbe39ec7f45ed77deeb8a3c84241189ac0f1993537c47a
+DIST maxima-5.36.1.tar.gz 29615673 SHA256 400bf83000b84d280d75e200e078582fe44f23220824562cc06c589d8a993974 SHA512 10e090230ab408777a1145ad90daef6bf237ba38ae31a654ba4d464e7a27e1f48baac5202ce8fb39e4c04ec9a6c9916ac83a58bd071b676ea5a989ea7db87d4c WHIRLPOOL ee7738085ae9e5b156b89afbf724b3ae5ef70b74550bee43cf3ab763f569d5ac51ea9c0e5aad67070f4b71f480b079aad8e4fd44ded34525a1f84cbeeb2d28b0
diff --git a/sci-mathematics/maxima/files/50maxima-gentoo.el b/sci-mathematics/maxima/files/50maxima-gentoo.el
new file mode 100644
index 000000000000..20c7399164f7
--- /dev/null
+++ b/sci-mathematics/maxima/files/50maxima-gentoo.el
@@ -0,0 +1,12 @@
+
+;;; maxima site-lisp configuration
+
+(add-to-list 'load-path "@SITELISP@")
+(autoload 'maxima-mode "maxima" "Maxima mode" t)
+(autoload 'maxima "maxima" "Maxima interactive" t)
+(autoload 'dbl "dbl" "Make a debugger to run lisp, maxima and or gdb in" t)
+(add-to-list 'auto-mode-alist '("\\.ma?[cx]\\'" . maxima-mode))
+
+;; emaxima mode
+(autoload 'emaxima-mode "emaxima" "EMaxima" t)
+(add-hook 'emaxima-mode-hook 'emaxima-mark-file-as-emaxima)
diff --git a/sci-mathematics/maxima/files/clisp-0.patch b/sci-mathematics/maxima/files/clisp-0.patch
new file mode 100644
index 000000000000..7e65c40b58f7
--- /dev/null
+++ b/sci-mathematics/maxima/files/clisp-0.patch
@@ -0,0 +1,19 @@
+diff -r -U1 maxima-5.30.0.orig/src/maxima.in maxima-5.30.0/src/maxima.in
+--- maxima-5.30.0.orig/src/maxima.in 2012-12-04 12:54:50.000000000 +0700
++++ maxima-5.30.0/src/maxima.in 2013-04-13 13:07:03.094128196 +0700
+@@ -138,5 +138,5 @@
+ if [ -x "$MAXIMA_IMAGESDIR/binary-$MAXIMA_LISP/maxima" ]; then
+- exec "$MAXIMA_IMAGESDIR/binary-$MAXIMA_LISP/maxima" $MAXIMA_LISP_OPTIONS -q "" -- "$arg1" "$arg2" "$arg3" "$arg4" "$arg5" "$arg6" "$arg7" "$arg8" "$arg9"
++ exec "$MAXIMA_IMAGESDIR/binary-$MAXIMA_LISP/maxima" $MAXIMA_LISP_OPTIONS -q -norc "" -- "$arg1" "$arg2" "$arg3" "$arg4" "$arg5" "$arg6" "$arg7" "$arg8" "$arg9"
+ else
+- exec "$MAXIMA_IMAGESDIR/binary-$MAXIMA_LISP/@CLISP_RUNTIME@" $MAXIMA_LISP_OPTIONS -q -M "$maxima_image_base.mem" "" -- "$arg1" "$arg2" "$arg3" "$arg4" "$arg5" "$arg6" "$arg7" "$arg8" "$arg9"
++ exec "$MAXIMA_IMAGESDIR/binary-$MAXIMA_LISP/@CLISP_RUNTIME@" $MAXIMA_LISP_OPTIONS -q -norc -M "$maxima_image_base.mem" "" -- "$arg1" "$arg2" "$arg3" "$arg4" "$arg5" "$arg6" "$arg7" "$arg8" "$arg9"
+ fi
+@@ -144,5 +144,5 @@
+ if [ -x "$maxima_image_base" ]; then
+- exec "$maxima_image_base" $MAXIMA_LISP_OPTIONS -q "" -- "$arg1" "$arg2" "$arg3" "$arg4" "$arg5" "$arg6" "$arg7" "$arg8" "$arg9"
++ exec "$maxima_image_base" $MAXIMA_LISP_OPTIONS -q -norc "" -- "$arg1" "$arg2" "$arg3" "$arg4" "$arg5" "$arg6" "$arg7" "$arg8" "$arg9"
+ else
+- exec "@CLISP_NAME@" $MAXIMA_LISP_OPTIONS -q -M "$maxima_image_base.mem" "" -- "$arg1" "$arg2" "$arg3" "$arg4" "$arg5" "$arg6" "$arg7" "$arg8" "$arg9"
++ exec "@CLISP_NAME@" $MAXIMA_LISP_OPTIONS -q -norc -M "$maxima_image_base.mem" "" -- "$arg1" "$arg2" "$arg3" "$arg4" "$arg5" "$arg6" "$arg7" "$arg8" "$arg9"
+ fi
diff --git a/sci-mathematics/maxima/files/clozurecl-0.patch b/sci-mathematics/maxima/files/clozurecl-0.patch
new file mode 100644
index 000000000000..d5afe951eb53
--- /dev/null
+++ b/sci-mathematics/maxima/files/clozurecl-0.patch
@@ -0,0 +1,27 @@
+diff -r -U1 maxima-5.30.0.orig/configure.in maxima-5.30.0/configure.in
+--- maxima-5.30.0.orig/configure.in 2013-04-03 02:13:30.000000000 +0700
++++ maxima-5.30.0/configure.in 2013-04-13 12:42:16.645751903 +0700
+@@ -351,3 +351,3 @@
+ dnl n.b. openmcl_default_name is hardcoded in "with" message
+-openmcl_default_name=openmcl
++openmcl_default_name=ccl
+ AC_ARG_ENABLE(openmcl,
+diff -r -U1 maxima-5.30.0.orig/src/Makefile.am maxima-5.30.0/src/Makefile.am
+--- maxima-5.30.0.orig/src/Makefile.am 2013-03-23 08:32:07.000000000 +0700
++++ maxima-5.30.0/src/Makefile.am 2013-04-13 12:49:34.911159093 +0700
+@@ -304,3 +304,3 @@
+ if OPENMCL
+-EXECUTEOPENMCL = $(OPENMCL_NAME) -e
++EXECUTEOPENMCL = $(OPENMCL_NAME) --no-init -e
+ all-local: sharefiles.mk $(OPENMCL_MAXIMA)
+diff -r -U1 maxima-5.30.0.orig/src/maxima.in maxima-5.30.0/src/maxima.in
+--- maxima-5.30.0.orig/src/maxima.in 2012-12-04 12:54:50.000000000 +0700
++++ maxima-5.30.0/src/maxima.in 2013-04-13 12:46:59.247013957 +0700
+@@ -185,5 +185,5 @@
+ if [ -x "$MAXIMA_IMAGESDIR/binary-$MAXIMA_LISP/maxima" ]; then
+- exec "$MAXIMA_IMAGESDIR/binary-$MAXIMA_LISP/maxima" $MAXIMA_LISP_OPTIONS -e '(cl-user::run)' -- "$arg1" "$arg2" "$arg3" "$arg4" "$arg5" "$arg6" "$arg7" "$arg8" "$arg9"
++ exec "$MAXIMA_IMAGESDIR/binary-$MAXIMA_LISP/maxima" $MAXIMA_LISP_OPTIONS --no-init -e '(cl-user::run)' -- "$arg1" "$arg2" "$arg3" "$arg4" "$arg5" "$arg6" "$arg7" "$arg8" "$arg9"
+ else
+- exec "@OPENMCL_NAME@" -I "$maxima_image_base.image" $MAXIMA_LISP_OPTIONS -e '(cl-user::run)' -- "$arg1" "$arg2" "$arg3" "$arg4" "$arg5" "$arg6" "$arg7" "$arg8" "$arg9"
++ exec "@OPENMCL_NAME@" -I "$maxima_image_base.image" $MAXIMA_LISP_OPTIONS --no-init -e '(cl-user::run)' -- "$arg1" "$arg2" "$arg3" "$arg4" "$arg5" "$arg6" "$arg7" "$arg8" "$arg9"
+ fi
diff --git a/sci-mathematics/maxima/files/clozurecl-1.patch b/sci-mathematics/maxima/files/clozurecl-1.patch
new file mode 100644
index 000000000000..07203a2f828d
--- /dev/null
+++ b/sci-mathematics/maxima/files/clozurecl-1.patch
@@ -0,0 +1,28 @@
+diff -r -U1 maxima-5.35.1.orig/configure.ac maxima-5.35.1/configure.ac
+--- maxima-5.35.1.orig/configure.ac 2014-12-13 06:44:51.000000000 +0600
++++ maxima-5.35.1/configure.ac 2014-12-20 20:43:04.713305777 +0600
+@@ -379,3 +379,3 @@
+ dnl n.b. openmcl_default_name is hardcoded in "with" message
+-openmcl_default_name=openmcl
++openmcl_default_name=ccl
+ AC_ARG_ENABLE(openmcl,
+diff -r -U1 maxima-5.35.1.orig/src/Makefile.am maxima-5.35.1/src/Makefile.am
+--- maxima-5.35.1.orig/src/Makefile.am 2014-09-24 00:02:16.000000000 +0700
++++ maxima-5.35.1/src/Makefile.am 2014-12-20 20:43:04.713305777 +0600
+@@ -359,3 +359,3 @@
+
+-EXECUTEOPENMCL = $(OPENMCL_NAME) -e
++EXECUTEOPENMCL = $(OPENMCL_NAME) --no-init -e
+ BUILT_FILES += $(OPENMCL_MAXIMA)
+Только в maxima-5.35.1/src: Makefile.am.orig
+diff -r -U1 maxima-5.35.1.orig/src/maxima.in maxima-5.35.1/src/maxima.in
+--- maxima-5.35.1.orig/src/maxima.in 2014-12-03 04:17:05.000000000 +0600
++++ maxima-5.35.1/src/maxima.in 2014-12-20 20:43:04.713305777 +0600
+@@ -185,5 +185,5 @@
+ if [ -x "$MAXIMA_IMAGESDIR/binary-$MAXIMA_LISP/maxima" ]; then
+- exec "$MAXIMA_IMAGESDIR/binary-$MAXIMA_LISP/maxima" $MAXIMA_LISP_OPTIONS -e '(cl-user::run)' -- "$arg1" "$arg2" "$arg3" "$arg4" "$arg5" "$arg6" "$arg7" "$arg8" "$arg9"
++ exec "$MAXIMA_IMAGESDIR/binary-$MAXIMA_LISP/maxima" $MAXIMA_LISP_OPTIONS --no-init -e '(cl-user::run)' -- "$arg1" "$arg2" "$arg3" "$arg4" "$arg5" "$arg6" "$arg7" "$arg8" "$arg9"
+ else
+- exec "@OPENMCL_NAME@" -I "$maxima_image_base.image" $MAXIMA_LISP_OPTIONS -e '(cl-user::run)' -- "$arg1" "$arg2" "$arg3" "$arg4" "$arg5" "$arg6" "$arg7" "$arg8" "$arg9"
++ exec "@OPENMCL_NAME@" -I "$maxima_image_base.image" $MAXIMA_LISP_OPTIONS --no-init -e '(cl-user::run)' -- "$arg1" "$arg2" "$arg3" "$arg4" "$arg5" "$arg6" "$arg7" "$arg8" "$arg9"
+ fi
diff --git a/sci-mathematics/maxima/files/cmucl-0.patch b/sci-mathematics/maxima/files/cmucl-0.patch
new file mode 100644
index 000000000000..73ebd3445b48
--- /dev/null
+++ b/sci-mathematics/maxima/files/cmucl-0.patch
@@ -0,0 +1,27 @@
+diff -r -U1 maxima-5.30.0.orig/src/Makefile.am maxima-5.30.0/src/Makefile.am
+--- maxima-5.30.0.orig/src/Makefile.am 2013-03-23 08:32:07.000000000 +0700
++++ maxima-5.30.0/src/Makefile.am 2013-04-13 13:12:37.521437190 +0700
+@@ -77,3 +77,3 @@
+ if CMUCL
+-EXECUTECMUCL = $(CMUCL_NAME) -noinit -batch
++EXECUTECMUCL = $(CMUCL_NAME) -nositeinit -noinit -batch
+ # Newer versions of CMUCL have an INTL package that is compatible with
+diff -r -U1 maxima-5.30.0.orig/src/maxima.in maxima-5.30.0/src/maxima.in
+--- maxima-5.30.0.orig/src/maxima.in 2012-12-04 12:54:50.000000000 +0700
++++ maxima-5.30.0/src/maxima.in 2013-04-13 13:11:26.647371277 +0700
+@@ -155,5 +155,5 @@
+ if [ -x "$MAXIMA_IMAGESDIR/binary-$MAXIMA_LISP/maxima" ]; then
+- exec "$MAXIMA_IMAGESDIR/binary-$MAXIMA_LISP/maxima" $MAXIMA_LISP_OPTIONS -quiet -- "$arg1" "$arg2" "$arg3" "$arg4" "$arg5" "$arg6" "$arg7" "$arg8" "$arg9"
++ exec "$MAXIMA_IMAGESDIR/binary-$MAXIMA_LISP/maxima" $MAXIMA_LISP_OPTIONS -quiet -nositeinit -noinit -- "$arg1" "$arg2" "$arg3" "$arg4" "$arg5" "$arg6" "$arg7" "$arg8" "$arg9"
+ else
+- exec "$MAXIMA_IMAGESDIR/binary-$MAXIMA_LISP/@CMUCL_RUNTIME@" $MAXIMA_LISP_OPTIONS -quiet -core "$maxima_image_base.core" -eval '(cl-user::run)' -- "$arg1" "$arg2" "$arg3" "$arg4" "$arg5" "$arg6" "$arg7" "$arg8" "$arg9"
++ exec "$MAXIMA_IMAGESDIR/binary-$MAXIMA_LISP/@CMUCL_RUNTIME@" $MAXIMA_LISP_OPTIONS -quiet -nositeinit -noinit -core "$maxima_image_base.core" -eval '(cl-user::run)' -- "$arg1" "$arg2" "$arg3" "$arg4" "$arg5" "$arg6" "$arg7" "$arg8" "$arg9"
+ fi
+@@ -161,5 +161,5 @@
+ if [ -x "$maxima_image_base" ]; then
+- exec "$maxima_image_base" $MAXIMA_LISP_OPTIONS -quiet -- "$arg1" "$arg2" "$arg3" "$arg4" "$arg5" "$arg6" "$arg7" "$arg8" "$arg9"
++ exec "$maxima_image_base" $MAXIMA_LISP_OPTIONS -quiet -nositeinit -noinit -- "$arg1" "$arg2" "$arg3" "$arg4" "$arg5" "$arg6" "$arg7" "$arg8" "$arg9"
+ else
+- exec "@CMUCL_NAME@" $MAXIMA_LISP_OPTIONS -quiet -core "$maxima_image_base.core" -eval '(cl-user::run)' -- "$arg1" "$arg2" "$arg3" "$arg4" "$arg5" "$arg6" "$arg7" "$arg8" "$arg9"
++ exec "@CMUCL_NAME@" $MAXIMA_LISP_OPTIONS -quiet -nositeinit -noinit -core "$maxima_image_base.core" -eval '(cl-user::run)' -- "$arg1" "$arg2" "$arg3" "$arg4" "$arg5" "$arg6" "$arg7" "$arg8" "$arg9"
+ fi
diff --git a/sci-mathematics/maxima/files/ecls-0.patch b/sci-mathematics/maxima/files/ecls-0.patch
new file mode 100644
index 000000000000..df45dee0eb4a
--- /dev/null
+++ b/sci-mathematics/maxima/files/ecls-0.patch
@@ -0,0 +1,27 @@
+diff -r -U1 maxima-5.30.0.orig/src/maxima.in maxima-5.30.0/src/maxima.in
+--- maxima-5.30.0.orig/src/maxima.in 2012-12-04 12:54:50.000000000 +0700
++++ maxima-5.30.0/src/maxima.in 2013-04-13 12:57:12.037579805 +0700
+@@ -191,3 +191,3 @@
+ elif [ "$MAXIMA_LISP" = "ecl" ]; then
+- exec "$maxima_image_base" $MAXIMA_LISP_OPTIONS -- "$arg1" "$arg2" "$arg3" "$arg4" "$arg5" "$arg6" "$arg7" "$arg8" "$arg9"
++ exec "$maxima_image_base" $MAXIMA_LISP_OPTIONS -norc -- "$arg1" "$arg2" "$arg3" "$arg4" "$arg5" "$arg6" "$arg7" "$arg8" "$arg9"
+
+diff -r -U1 maxima-5.30.0.orig/src/maxima.system maxima-5.30.0/src/maxima.system
+--- maxima-5.30.0.orig/src/maxima.system 2013-03-23 08:32:08.000000000 +0700
++++ maxima-5.30.0/src/maxima.system 2013-04-13 12:59:54.086730845 +0700
+@@ -61,2 +61,10 @@
+ #+ecl
++(defun split-ld-flags-for-ecl (string &aux space)
++ (setf string (string-trim '(#\Space) string))
++ (if (setf space (position #\Space string))
++ (cons (subseq string 0 space)
++ (split-ld-flags-for-ecl (subseq string (1+ space))))
++ (cons string nil)))
++
++#+ecl
+ (defun build-maxima-lib ()
+@@ -81,3 +89,3 @@
+ (find-package "MAXIMA")))))
+- (if (and x (not (string= x ""))) (list x)))
++ (if (and x (not (string= x ""))) (split-ld-flags-for-ecl x)))
+ :epilogue-code '(progn (require :defsystem)
diff --git a/sci-mathematics/maxima/files/ecls-1.patch b/sci-mathematics/maxima/files/ecls-1.patch
new file mode 100644
index 000000000000..36e9af17bb6f
--- /dev/null
+++ b/sci-mathematics/maxima/files/ecls-1.patch
@@ -0,0 +1,37 @@
+diff -r -U1 maxima-5.30.0.orig/src/maxima.in maxima-5.30.0/src/maxima.in
+--- maxima-5.30.0.orig/src/maxima.in 2012-12-04 12:54:50.000000000 +0700
++++ maxima-5.30.0/src/maxima.in 2013-04-13 12:57:12.037579805 +0700
+@@ -191,3 +191,3 @@
+ elif [ "$MAXIMA_LISP" = "ecl" ]; then
+- exec "$maxima_image_base" $MAXIMA_LISP_OPTIONS -- "$arg1" "$arg2" "$arg3" "$arg4" "$arg5" "$arg6" "$arg7" "$arg8" "$arg9"
++ exec "$maxima_image_base" $MAXIMA_LISP_OPTIONS -norc -- "$arg1" "$arg2" "$arg3" "$arg4" "$arg5" "$arg6" "$arg7" "$arg8" "$arg9"
+
+diff -r -U1 maxima-5.30.0.orig/src/maxima.system maxima-5.30.0/src/maxima.system
+--- maxima-5.30.0.orig/src/maxima.system 2013-03-23 08:32:08.000000000 +0700
++++ maxima-5.30.0/src/maxima.system 2013-04-13 12:59:54.086730845 +0700
+@@ -61,2 +61,10 @@
+ #+ecl
++(defun split-ld-flags-for-ecl (string &aux space)
++ (setf string (string-trim '(#\Space) string))
++ (if (setf space (position #\Space string))
++ (cons (subseq string 0 space)
++ (split-ld-flags-for-ecl (subseq string (1+ space))))
++ (cons string nil)))
++
++#+ecl
+ (defun build-maxima-lib ()
+@@ -77,7 +85,12 @@
+ files)))
++ (c::build-fasl "binary-ecl/maxima" :lisp-files obj
++ :ld-flags
++ (let ((x (symbol-value (find-symbol "*AUTOCONF-LD-FLAGS*"
++ (find-package "MAXIMA")))))
++ (if (and x (not (string= x ""))) (split-ld-flags-for-ecl x))))
+ (c::build-program "binary-ecl/maxima" :lisp-files obj
+ :ld-flags
+ (let ((x (symbol-value (find-symbol "*AUTOCONF-LD-FLAGS*"
+ (find-package "MAXIMA")))))
+- (if (and x (not (string= x ""))) (list x)))
++ (if (and x (not (string= x ""))) (split-ld-flags-for-ecl x)))
+ :epilogue-code '(progn (require :defsystem)
+
diff --git a/sci-mathematics/maxima/files/imaxima-0.patch b/sci-mathematics/maxima/files/imaxima-0.patch
new file mode 100644
index 000000000000..fe607b240d13
--- /dev/null
+++ b/sci-mathematics/maxima/files/imaxima-0.patch
@@ -0,0 +1,5 @@
+--- interfaces/emacs/Makefile.am.orig 2010-02-01 22:11:44.809941160 +1300
++++ interfaces/emacs/Makefile.am 2010-02-01 22:12:06.608062346 +1300
+@@ -1 +1 @@
+-SUBDIRS = emaxima misc imaxima
++SUBDIRS = emaxima misc
diff --git a/sci-mathematics/maxima/files/maxima-5.26.0-ecls-12.2.1.patch b/sci-mathematics/maxima/files/maxima-5.26.0-ecls-12.2.1.patch
new file mode 100644
index 000000000000..4fde880acf03
--- /dev/null
+++ b/sci-mathematics/maxima/files/maxima-5.26.0-ecls-12.2.1.patch
@@ -0,0 +1,8 @@
+diff -r -U1 maxima-5.26.0.orig/src/numerical/slatec/xerprn.lisp maxima-5.26.0/src/numerical/slatec/xerprn.lisp
+--- maxima-5.26.0.orig/src/numerical/slatec/xerprn.lisp 2011-08-01 11:39:52.000000000 +0700
++++ maxima-5.26.0/src/numerical/slatec/xerprn.lisp 2012-02-13 18:49:21.000000000 +0700
+@@ -20,3 +20,3 @@
+ (let* ((newlin "$$"))
+- (declare (type (simple-array character (2)) newlin) (ignorable newlin))
++ (declare (ignorable newlin))
+ (defun xerprn (prefix npref messg nwrap)
diff --git a/sci-mathematics/maxima/files/maxima-5.26.0-wish.patch b/sci-mathematics/maxima/files/maxima-5.26.0-wish.patch
new file mode 100644
index 000000000000..6fcb0d9ec8e9
--- /dev/null
+++ b/sci-mathematics/maxima/files/maxima-5.26.0-wish.patch
@@ -0,0 +1,28 @@
+diff -r -U1 maxima-5.23.1.orig//configure.in maxima-5.23.1//configure.in
+--- maxima-5.23.1.orig//configure.in 2011-01-15 21:54:46.000000000 +0600
++++ maxima-5.23.1//configure.in 2011-01-16 21:00:16.000000000 +0600
+@@ -777,6 +777,11 @@
+ [ --with-wish=<prog> Use <prog> for Tk wish shell (default wish)],
+- [WISH="${withval}"],
+- [WISH="wish"])
++ [],
++ [with_wish="wish"])
++case "${with_wish}" in
++ no) WISH="none" ;;
++ yes) WISH="wish" ;;
++ *) WISH="${with_wish}" ;;
++esac
+ AC_SUBST(WISH)
+-
++AM_CONDITIONAL(WANT_TK, test x"${with_wish}" != xno)
+
+diff -r -U1 maxima-5.23.1.orig//interfaces/Makefile.am maxima-5.23.1//interfaces/Makefile.am
+--- maxima-5.23.1.orig//interfaces/Makefile.am 2004-04-28 23:34:59.000000000 +0700
++++ maxima-5.23.1//interfaces/Makefile.am 2011-01-16 20:41:38.000000000 +0600
+@@ -1,2 +1,6 @@
++if WANT_TK
+ SUBDIRS = emacs xmaxima
++else
++SUBDIRS = emacs
++endif
+ EXTRA_DIST = bin/xmaxima.iss
diff --git a/sci-mathematics/maxima/files/maxima-5.26.0.patch b/sci-mathematics/maxima/files/maxima-5.26.0.patch
new file mode 100644
index 000000000000..6309653d6e87
--- /dev/null
+++ b/sci-mathematics/maxima/files/maxima-5.26.0.patch
@@ -0,0 +1,37 @@
+diff -r -U1 maxima-5.23.1.orig//configure.in maxima-5.23.1//configure.in
+--- maxima-5.23.1.orig//configure.in 2011-01-15 21:54:46.000000000 +0600
++++ maxima-5.23.1//configure.in 2011-01-16 19:50:55.000000000 +0600
+@@ -294,3 +294,3 @@
+ dnl n.b. openmcl_default_name is hardcoded in "with" message
+-openmcl_default_name=openmcl
++openmcl_default_name=ccl
+ AC_ARG_ENABLE(openmcl,
+diff -r -U1 maxima-5.23.1.orig//src/maxima.in maxima-5.23.1//src/maxima.in
+--- maxima-5.23.1.orig//src/maxima.in 2010-12-05 08:06:03.000000000 +0600
++++ maxima-5.23.1//src/maxima.in 2011-01-16 20:07:27.000000000 +0600
+@@ -137,5 +137,5 @@
+ if [ "$layout_autotools" = "true" ]; then
+- exec "$MAXIMA_IMAGESDIR/binary-$MAXIMA_LISP/@CLISP_RUNTIME@" $MAXIMA_LISP_OPTIONS -q -M "$maxima_image_base.mem" "" -- "$arg1" "$arg2" "$arg3" "$arg4" "$arg5" "$arg6" "$arg7" "$arg8" "$arg9"
++ exec "$MAXIMA_IMAGESDIR/binary-$MAXIMA_LISP/@CLISP_RUNTIME@" $MAXIMA_LISP_OPTIONS -q -norc -M "$maxima_image_base.mem" "" -- "$arg1" "$arg2" "$arg3" "$arg4" "$arg5" "$arg6" "$arg7" "$arg8" "$arg9"
+ else
+- exec "@CLISP_NAME@" $MAXIMA_LISP_OPTIONS -q -M "$maxima_image_base.mem" "" -- "$arg1" "$arg2" "$arg3" "$arg4" "$arg5" "$arg6" "$arg7" "$arg8" "$arg9"
++ exec "@CLISP_NAME@" $MAXIMA_LISP_OPTIONS -q -norc -M "$maxima_image_base.mem" "" -- "$arg1" "$arg2" "$arg3" "$arg4" "$arg5" "$arg6" "$arg7" "$arg8" "$arg9"
+ fi
+@@ -147,5 +147,5 @@
+ if [ -x "$MAXIMA_IMAGESDIR/binary-$MAXIMA_LISP/maxima" ]; then
+- exec "$MAXIMA_IMAGESDIR/binary-$MAXIMA_LISP/maxima" $MAXIMA_LISP_OPTIONS -quiet -- "$arg1" "$arg2" "$arg3" "$arg4" "$arg5" "$arg6" "$arg7" "$arg8" "$arg9"
++ exec "$MAXIMA_IMAGESDIR/binary-$MAXIMA_LISP/maxima" $MAXIMA_LISP_OPTIONS -quiet -nositeinit -noinit -- "$arg1" "$arg2" "$arg3" "$arg4" "$arg5" "$arg6" "$arg7" "$arg8" "$arg9"
+ else
+- exec "$MAXIMA_IMAGESDIR/binary-$MAXIMA_LISP/@CMUCL_RUNTIME@" $MAXIMA_LISP_OPTIONS -quiet -core "$maxima_image_base.core" -eval '(cl-user::run)' -- "$arg1" "$arg2" "$arg3" "$arg4" "$arg5" "$arg6" "$arg7" "$arg8" "$arg9"
++ exec "$MAXIMA_IMAGESDIR/binary-$MAXIMA_LISP/@CMUCL_RUNTIME@" $MAXIMA_LISP_OPTIONS -quiet -nositeinit -noinit -core "$maxima_image_base.core" -eval '(cl-user::run)' -- "$arg1" "$arg2" "$arg3" "$arg4" "$arg5" "$arg6" "$arg7" "$arg8" "$arg9"
+ fi
+@@ -155,3 +155,3 @@
+ else
+- exec "@CMUCL_NAME@" $MAXIMA_LISP_OPTIONS -quiet -core "$maxima_image_base.core" -eval '(cl-user::run)' -- "$arg1" "$arg2" "$arg3" "$arg4" "$arg5" "$arg6" "$arg7" "$arg8" "$arg9"
++ exec "@CMUCL_NAME@" $MAXIMA_LISP_OPTIONS -quiet -nositeinit -noinit -core "$maxima_image_base.core" -eval '(cl-user::run)' -- "$arg1" "$arg2" "$arg3" "$arg4" "$arg5" "$arg6" "$arg7" "$arg8" "$arg9"
+ fi
+@@ -177,3 +177,3 @@
+ elif [ "$MAXIMA_LISP" = "sbcl" ]; then
+- exec "@SBCL_NAME@" --core "$maxima_image_base.core" --noinform $MAXIMA_LISP_OPTIONS --end-runtime-options --eval '(cl-user::run)' --end-toplevel-options "$arg1" "$arg2" "$arg3" "$arg4" "$arg5" "$arg6" "$arg7" "$arg8" "$arg9"
++ exec "@SBCL_NAME@" --core "$maxima_image_base.core" --noinform $MAXIMA_LISP_OPTIONS --end-runtime-options --no-sysinit --no-userinit --eval '(cl-user::run)' --end-toplevel-options "$arg1" "$arg2" "$arg3" "$arg4" "$arg5" "$arg6" "$arg7" "$arg8" "$arg9"
+ else
diff --git a/sci-mathematics/maxima/files/maxima-5.27.0-inhibit-sys_usr-inits.patch b/sci-mathematics/maxima/files/maxima-5.27.0-inhibit-sys_usr-inits.patch
new file mode 100644
index 000000000000..a86a4ed06a69
--- /dev/null
+++ b/sci-mathematics/maxima/files/maxima-5.27.0-inhibit-sys_usr-inits.patch
@@ -0,0 +1,24 @@
+diff -uNr maxima-5.27.0.org/src/Makefile.am maxima-5.27.0/src/Makefile.am
+--- maxima-5.27.0.org/src/Makefile.am 2012-05-07 08:04:23.000000000 -0400
++++ maxima-5.27.0/src/Makefile.am 2012-05-07 08:04:56.000000000 -0400
+@@ -176,7 +176,7 @@
+
+
+ if SBCL
+-EXECUTESBCL = $(SBCL_NAME) --noinform --noprint --eval
++EXECUTESBCL = $(SBCL_NAME) --sysinit /dev/null --userinit /dev/null --eval
+ all-local: sharefiles.mk binary-sbcl/maxima.core
+ install-exec-local: install-sbcl
+ uninstall-hook: uninstall-sbcl
+diff -uNr maxima-5.27.0.org/src/Makefile.in maxima-5.27.0/src/Makefile.in
+--- maxima-5.27.0.org/src/Makefile.in 2012-05-07 08:04:23.000000000 -0400
++++ maxima-5.27.0/src/Makefile.in 2012-05-07 08:05:14.000000000 -0400
+@@ -240,7 +240,7 @@
+ @CMUCL_TRUE@INITINTL = (when (find-package "INTL") (set (find-symbol "*DEFAULT-DOMAIN*" "INTL") "maxima"))
+ @SCL_TRUE@EXECUTESCL = $(SCL_NAME) -noinit -batch
+ @ACL_TRUE@EXECUTEACL = $(ACL_NAME) -batch
+-@SBCL_TRUE@EXECUTESBCL = $(SBCL_NAME) --noinform --noprint --eval
++@SBCL_TRUE@EXECUTESBCL = $(SBCL_NAME) --sysinit /dev/null --userinit /dev/null --eval
+ @GCL_TRUE@EXECUTEGCL = $(GCL_NAME) -batch -eval
+ @OPENMCL_TRUE@EXECUTEOPENMCL = $(OPENMCL_NAME) -e
+ @ECL_TRUE@EXECUTEECL = $(ECL_NAME) -norc
diff --git a/sci-mathematics/maxima/files/maxima-5.27.0-wish.patch b/sci-mathematics/maxima/files/maxima-5.27.0-wish.patch
new file mode 100644
index 000000000000..6fcb0d9ec8e9
--- /dev/null
+++ b/sci-mathematics/maxima/files/maxima-5.27.0-wish.patch
@@ -0,0 +1,28 @@
+diff -r -U1 maxima-5.23.1.orig//configure.in maxima-5.23.1//configure.in
+--- maxima-5.23.1.orig//configure.in 2011-01-15 21:54:46.000000000 +0600
++++ maxima-5.23.1//configure.in 2011-01-16 21:00:16.000000000 +0600
+@@ -777,6 +777,11 @@
+ [ --with-wish=<prog> Use <prog> for Tk wish shell (default wish)],
+- [WISH="${withval}"],
+- [WISH="wish"])
++ [],
++ [with_wish="wish"])
++case "${with_wish}" in
++ no) WISH="none" ;;
++ yes) WISH="wish" ;;
++ *) WISH="${with_wish}" ;;
++esac
+ AC_SUBST(WISH)
+-
++AM_CONDITIONAL(WANT_TK, test x"${with_wish}" != xno)
+
+diff -r -U1 maxima-5.23.1.orig//interfaces/Makefile.am maxima-5.23.1//interfaces/Makefile.am
+--- maxima-5.23.1.orig//interfaces/Makefile.am 2004-04-28 23:34:59.000000000 +0700
++++ maxima-5.23.1//interfaces/Makefile.am 2011-01-16 20:41:38.000000000 +0600
+@@ -1,2 +1,6 @@
++if WANT_TK
+ SUBDIRS = emacs xmaxima
++else
++SUBDIRS = emacs
++endif
+ EXTRA_DIST = bin/xmaxima.iss
diff --git a/sci-mathematics/maxima/files/maxima-5.27.0.patch b/sci-mathematics/maxima/files/maxima-5.27.0.patch
new file mode 100644
index 000000000000..6309653d6e87
--- /dev/null
+++ b/sci-mathematics/maxima/files/maxima-5.27.0.patch
@@ -0,0 +1,37 @@
+diff -r -U1 maxima-5.23.1.orig//configure.in maxima-5.23.1//configure.in
+--- maxima-5.23.1.orig//configure.in 2011-01-15 21:54:46.000000000 +0600
++++ maxima-5.23.1//configure.in 2011-01-16 19:50:55.000000000 +0600
+@@ -294,3 +294,3 @@
+ dnl n.b. openmcl_default_name is hardcoded in "with" message
+-openmcl_default_name=openmcl
++openmcl_default_name=ccl
+ AC_ARG_ENABLE(openmcl,
+diff -r -U1 maxima-5.23.1.orig//src/maxima.in maxima-5.23.1//src/maxima.in
+--- maxima-5.23.1.orig//src/maxima.in 2010-12-05 08:06:03.000000000 +0600
++++ maxima-5.23.1//src/maxima.in 2011-01-16 20:07:27.000000000 +0600
+@@ -137,5 +137,5 @@
+ if [ "$layout_autotools" = "true" ]; then
+- exec "$MAXIMA_IMAGESDIR/binary-$MAXIMA_LISP/@CLISP_RUNTIME@" $MAXIMA_LISP_OPTIONS -q -M "$maxima_image_base.mem" "" -- "$arg1" "$arg2" "$arg3" "$arg4" "$arg5" "$arg6" "$arg7" "$arg8" "$arg9"
++ exec "$MAXIMA_IMAGESDIR/binary-$MAXIMA_LISP/@CLISP_RUNTIME@" $MAXIMA_LISP_OPTIONS -q -norc -M "$maxima_image_base.mem" "" -- "$arg1" "$arg2" "$arg3" "$arg4" "$arg5" "$arg6" "$arg7" "$arg8" "$arg9"
+ else
+- exec "@CLISP_NAME@" $MAXIMA_LISP_OPTIONS -q -M "$maxima_image_base.mem" "" -- "$arg1" "$arg2" "$arg3" "$arg4" "$arg5" "$arg6" "$arg7" "$arg8" "$arg9"
++ exec "@CLISP_NAME@" $MAXIMA_LISP_OPTIONS -q -norc -M "$maxima_image_base.mem" "" -- "$arg1" "$arg2" "$arg3" "$arg4" "$arg5" "$arg6" "$arg7" "$arg8" "$arg9"
+ fi
+@@ -147,5 +147,5 @@
+ if [ -x "$MAXIMA_IMAGESDIR/binary-$MAXIMA_LISP/maxima" ]; then
+- exec "$MAXIMA_IMAGESDIR/binary-$MAXIMA_LISP/maxima" $MAXIMA_LISP_OPTIONS -quiet -- "$arg1" "$arg2" "$arg3" "$arg4" "$arg5" "$arg6" "$arg7" "$arg8" "$arg9"
++ exec "$MAXIMA_IMAGESDIR/binary-$MAXIMA_LISP/maxima" $MAXIMA_LISP_OPTIONS -quiet -nositeinit -noinit -- "$arg1" "$arg2" "$arg3" "$arg4" "$arg5" "$arg6" "$arg7" "$arg8" "$arg9"
+ else
+- exec "$MAXIMA_IMAGESDIR/binary-$MAXIMA_LISP/@CMUCL_RUNTIME@" $MAXIMA_LISP_OPTIONS -quiet -core "$maxima_image_base.core" -eval '(cl-user::run)' -- "$arg1" "$arg2" "$arg3" "$arg4" "$arg5" "$arg6" "$arg7" "$arg8" "$arg9"
++ exec "$MAXIMA_IMAGESDIR/binary-$MAXIMA_LISP/@CMUCL_RUNTIME@" $MAXIMA_LISP_OPTIONS -quiet -nositeinit -noinit -core "$maxima_image_base.core" -eval '(cl-user::run)' -- "$arg1" "$arg2" "$arg3" "$arg4" "$arg5" "$arg6" "$arg7" "$arg8" "$arg9"
+ fi
+@@ -155,3 +155,3 @@
+ else
+- exec "@CMUCL_NAME@" $MAXIMA_LISP_OPTIONS -quiet -core "$maxima_image_base.core" -eval '(cl-user::run)' -- "$arg1" "$arg2" "$arg3" "$arg4" "$arg5" "$arg6" "$arg7" "$arg8" "$arg9"
++ exec "@CMUCL_NAME@" $MAXIMA_LISP_OPTIONS -quiet -nositeinit -noinit -core "$maxima_image_base.core" -eval '(cl-user::run)' -- "$arg1" "$arg2" "$arg3" "$arg4" "$arg5" "$arg6" "$arg7" "$arg8" "$arg9"
+ fi
+@@ -177,3 +177,3 @@
+ elif [ "$MAXIMA_LISP" = "sbcl" ]; then
+- exec "@SBCL_NAME@" --core "$maxima_image_base.core" --noinform $MAXIMA_LISP_OPTIONS --end-runtime-options --eval '(cl-user::run)' --end-toplevel-options "$arg1" "$arg2" "$arg3" "$arg4" "$arg5" "$arg6" "$arg7" "$arg8" "$arg9"
++ exec "@SBCL_NAME@" --core "$maxima_image_base.core" --noinform $MAXIMA_LISP_OPTIONS --end-runtime-options --no-sysinit --no-userinit --eval '(cl-user::run)' --end-toplevel-options "$arg1" "$arg2" "$arg3" "$arg4" "$arg5" "$arg6" "$arg7" "$arg8" "$arg9"
+ else
diff --git a/sci-mathematics/maxima/files/maxima-5.28.0-sbcl.patch b/sci-mathematics/maxima/files/maxima-5.28.0-sbcl.patch
new file mode 100644
index 000000000000..66a583e0adba
--- /dev/null
+++ b/sci-mathematics/maxima/files/maxima-5.28.0-sbcl.patch
@@ -0,0 +1,8 @@
+diff -r -U1 maxima-5.28.0.orig/src/Makefile.am maxima-5.28.0/src/Makefile.am
+--- maxima-5.28.0.orig/src/Makefile.am 2012-06-15 12:21:34.000000000 +0700
++++ maxima-5.28.0/src/Makefile.am 2012-08-25 09:32:26.000000000 +0700
+@@ -199,3 +199,3 @@
+ if SBCL
+-EXECUTESBCL = "$(SBCL_NAME)" --noinform --noprint --eval
++EXECUTESBCL = "$(SBCL_NAME)" --noinform --noprint --no-sysinit --no-userinit --eval
+ all-local: sharefiles.mk $(SBCL_MAXIMA)
diff --git a/sci-mathematics/maxima/files/maxima-5.28.0-wish.patch b/sci-mathematics/maxima/files/maxima-5.28.0-wish.patch
new file mode 100644
index 000000000000..6fcb0d9ec8e9
--- /dev/null
+++ b/sci-mathematics/maxima/files/maxima-5.28.0-wish.patch
@@ -0,0 +1,28 @@
+diff -r -U1 maxima-5.23.1.orig//configure.in maxima-5.23.1//configure.in
+--- maxima-5.23.1.orig//configure.in 2011-01-15 21:54:46.000000000 +0600
++++ maxima-5.23.1//configure.in 2011-01-16 21:00:16.000000000 +0600
+@@ -777,6 +777,11 @@
+ [ --with-wish=<prog> Use <prog> for Tk wish shell (default wish)],
+- [WISH="${withval}"],
+- [WISH="wish"])
++ [],
++ [with_wish="wish"])
++case "${with_wish}" in
++ no) WISH="none" ;;
++ yes) WISH="wish" ;;
++ *) WISH="${with_wish}" ;;
++esac
+ AC_SUBST(WISH)
+-
++AM_CONDITIONAL(WANT_TK, test x"${with_wish}" != xno)
+
+diff -r -U1 maxima-5.23.1.orig//interfaces/Makefile.am maxima-5.23.1//interfaces/Makefile.am
+--- maxima-5.23.1.orig//interfaces/Makefile.am 2004-04-28 23:34:59.000000000 +0700
++++ maxima-5.23.1//interfaces/Makefile.am 2011-01-16 20:41:38.000000000 +0600
+@@ -1,2 +1,6 @@
++if WANT_TK
+ SUBDIRS = emacs xmaxima
++else
++SUBDIRS = emacs
++endif
+ EXTRA_DIST = bin/xmaxima.iss
diff --git a/sci-mathematics/maxima/files/maxima-5.28.0.patch b/sci-mathematics/maxima/files/maxima-5.28.0.patch
new file mode 100644
index 000000000000..c8bd4191dda8
--- /dev/null
+++ b/sci-mathematics/maxima/files/maxima-5.28.0.patch
@@ -0,0 +1,51 @@
+diff -r -U1 maxima-5.28.0.orig/src/maxima.in maxima-5.28.0/src/maxima.in
+--- maxima-5.28.0.orig/src/maxima.in 2012-06-15 12:21:34.000000000 +0700
++++ maxima-5.28.0/src/maxima.in 2012-08-15 21:46:37.000000000 +0700
+@@ -138,5 +138,5 @@
+ if [ -x "$MAXIMA_IMAGESDIR/binary-$MAXIMA_LISP/maxima" ]; then
+- exec "$MAXIMA_IMAGESDIR/binary-$MAXIMA_LISP/maxima" $MAXIMA_LISP_OPTIONS -q "" -- "$arg1" "$arg2" "$arg3" "$arg4" "$arg5" "$arg6" "$arg7" "$arg8" "$arg9"
++ exec "$MAXIMA_IMAGESDIR/binary-$MAXIMA_LISP/maxima" $MAXIMA_LISP_OPTIONS -q -norc "" -- "$arg1" "$arg2" "$arg3" "$arg4" "$arg5" "$arg6" "$arg7" "$arg8" "$arg9"
+ else
+- exec "$MAXIMA_IMAGESDIR/binary-$MAXIMA_LISP/@CLISP_RUNTIME@" $MAXIMA_LISP_OPTIONS -q -M "$maxima_image_base.mem" "" -- "$arg1" "$arg2" "$arg3" "$arg4" "$arg5" "$arg6" "$arg7" "$arg8" "$arg9"
++ exec "$MAXIMA_IMAGESDIR/binary-$MAXIMA_LISP/@CLISP_RUNTIME@" $MAXIMA_LISP_OPTIONS -q -norc -M "$maxima_image_base.mem" "" -- "$arg1" "$arg2" "$arg3" "$arg4" "$arg5" "$arg6" "$arg7" "$arg8" "$arg9"
+ fi
+@@ -144,5 +144,5 @@
+ if [ -x "$maxima_image_base" ]; then
+- exec "$maxima_image_base" $MAXIMA_LISP_OPTIONS -q "" -- "$arg1" "$arg2" "$arg3" "$arg4" "$arg5" "$arg6" "$arg7" "$arg8" "$arg9"
++ exec "$maxima_image_base" $MAXIMA_LISP_OPTIONS -q -norc "" -- "$arg1" "$arg2" "$arg3" "$arg4" "$arg5" "$arg6" "$arg7" "$arg8" "$arg9"
+ else
+- exec "@CLISP_NAME@" $MAXIMA_LISP_OPTIONS -q -M "$maxima_image_base.mem" "" -- "$arg1" "$arg2" "$arg3" "$arg4" "$arg5" "$arg6" "$arg7" "$arg8" "$arg9"
++ exec "@CLISP_NAME@" $MAXIMA_LISP_OPTIONS -q -norc -M "$maxima_image_base.mem" "" -- "$arg1" "$arg2" "$arg3" "$arg4" "$arg5" "$arg6" "$arg7" "$arg8" "$arg9"
+ fi
+@@ -155,5 +155,5 @@
+ if [ -x "$MAXIMA_IMAGESDIR/binary-$MAXIMA_LISP/maxima" ]; then
+- exec "$MAXIMA_IMAGESDIR/binary-$MAXIMA_LISP/maxima" $MAXIMA_LISP_OPTIONS -quiet -- "$arg1" "$arg2" "$arg3" "$arg4" "$arg5" "$arg6" "$arg7" "$arg8" "$arg9"
++ exec "$MAXIMA_IMAGESDIR/binary-$MAXIMA_LISP/maxima" $MAXIMA_LISP_OPTIONS -quiet -nositeinit -noinit -- "$arg1" "$arg2" "$arg3" "$arg4" "$arg5" "$arg6" "$arg7" "$arg8" "$arg9"
+ else
+- exec "$MAXIMA_IMAGESDIR/binary-$MAXIMA_LISP/@CMUCL_RUNTIME@" $MAXIMA_LISP_OPTIONS -quiet -core "$maxima_image_base.core" -eval '(cl-user::run)' -- "$arg1" "$arg2" "$arg3" "$arg4" "$arg5" "$arg6" "$arg7" "$arg8" "$arg9"
++ exec "$MAXIMA_IMAGESDIR/binary-$MAXIMA_LISP/@CMUCL_RUNTIME@" $MAXIMA_LISP_OPTIONS -quiet -nositeinit -noinit -core "$maxima_image_base.core" -eval '(cl-user::run)' -- "$arg1" "$arg2" "$arg3" "$arg4" "$arg5" "$arg6" "$arg7" "$arg8" "$arg9"
+ fi
+@@ -161,5 +161,5 @@
+ if [ -x "$maxima_image_base" ]; then
+- exec "$maxima_image_base" $MAXIMA_LISP_OPTIONS -quiet -- "$arg1" "$arg2" "$arg3" "$arg4" "$arg5" "$arg6" "$arg7" "$arg8" "$arg9"
++ exec "$maxima_image_base" $MAXIMA_LISP_OPTIONS -quiet -nositeinit -noinit -- "$arg1" "$arg2" "$arg3" "$arg4" "$arg5" "$arg6" "$arg7" "$arg8" "$arg9"
+ else
+- exec "@CMUCL_NAME@" $MAXIMA_LISP_OPTIONS -quiet -core "$maxima_image_base.core" -eval '(cl-user::run)' -- "$arg1" "$arg2" "$arg3" "$arg4" "$arg5" "$arg6" "$arg7" "$arg8" "$arg9"
++ exec "@CMUCL_NAME@" $MAXIMA_LISP_OPTIONS -quiet -nositeinit -noinit -core "$maxima_image_base.core" -eval '(cl-user::run)' -- "$arg1" "$arg2" "$arg3" "$arg4" "$arg5" "$arg6" "$arg7" "$arg8" "$arg9"
+ fi
+@@ -183,5 +183,5 @@
+ if [ -x "$MAXIMA_IMAGESDIR/binary-$MAXIMA_LISP/maxima" ]; then
+- exec "$MAXIMA_IMAGESDIR/binary-$MAXIMA_LISP/maxima" $MAXIMA_LISP_OPTIONS -e '(cl-user::run)' -- "$arg1" "$arg2" "$arg3" "$arg4" "$arg5" "$arg6" "$arg7" "$arg8" "$arg9"
++ exec "$MAXIMA_IMAGESDIR/binary-$MAXIMA_LISP/maxima" $MAXIMA_LISP_OPTIONS --no-init -e '(cl-user::run)' -- "$arg1" "$arg2" "$arg3" "$arg4" "$arg5" "$arg6" "$arg7" "$arg8" "$arg9"
+ else
+- exec "@OPENMCL_NAME@" -I "$maxima_image_base.image" $MAXIMA_LISP_OPTIONS -e '(cl-user::run)' -- "$arg1" "$arg2" "$arg3" "$arg4" "$arg5" "$arg6" "$arg7" "$arg8" "$arg9"
++ exec "@OPENMCL_NAME@" -I "$maxima_image_base.image" $MAXIMA_LISP_OPTIONS --no-init -e '(cl-user::run)' -- "$arg1" "$arg2" "$arg3" "$arg4" "$arg5" "$arg6" "$arg7" "$arg8" "$arg9"
+ fi
+@@ -196,5 +196,5 @@
+ if [ -x "$MAXIMA_IMAGESDIR/binary-$MAXIMA_LISP/maxima" ]; then
+- exec "$MAXIMA_IMAGESDIR/binary-$MAXIMA_LISP/maxima" --noinform $MAXIMA_LISP_OPTIONS --end-runtime-options --eval '(cl-user::run)' --end-toplevel-options "$arg1" "$arg2" "$arg3" "$arg4" "$arg5" "$arg6" "$arg7" "$arg8" "$arg9"
++ exec "$MAXIMA_IMAGESDIR/binary-$MAXIMA_LISP/maxima" --noinform $MAXIMA_LISP_OPTIONS --end-runtime-options --no-sysinit --no-userinit --eval '(cl-user::run)' --end-toplevel-options "$arg1" "$arg2" "$arg3" "$arg4" "$arg5" "$arg6" "$arg7" "$arg8" "$arg9"
+ else
+- exec "@SBCL_NAME@" --core "$maxima_image_base.core" --noinform $MAXIMA_LISP_OPTIONS --end-runtime-options --eval '(cl-user::run)' --end-toplevel-options "$arg1" "$arg2" "$arg3" "$arg4" "$arg5" "$arg6" "$arg7" "$arg8" "$arg9"
++ exec "@SBCL_NAME@" --core "$maxima_image_base.core" --noinform $MAXIMA_LISP_OPTIONS --end-runtime-options --no-sysinit --no-userinit --eval '(cl-user::run)' --end-toplevel-options "$arg1" "$arg2" "$arg3" "$arg4" "$arg5" "$arg6" "$arg7" "$arg8" "$arg9"
+ fi
diff --git a/sci-mathematics/maxima/files/maxima-5.29.1-sbcl.patch b/sci-mathematics/maxima/files/maxima-5.29.1-sbcl.patch
new file mode 100644
index 000000000000..66a583e0adba
--- /dev/null
+++ b/sci-mathematics/maxima/files/maxima-5.29.1-sbcl.patch
@@ -0,0 +1,8 @@
+diff -r -U1 maxima-5.28.0.orig/src/Makefile.am maxima-5.28.0/src/Makefile.am
+--- maxima-5.28.0.orig/src/Makefile.am 2012-06-15 12:21:34.000000000 +0700
++++ maxima-5.28.0/src/Makefile.am 2012-08-25 09:32:26.000000000 +0700
+@@ -199,3 +199,3 @@
+ if SBCL
+-EXECUTESBCL = "$(SBCL_NAME)" --noinform --noprint --eval
++EXECUTESBCL = "$(SBCL_NAME)" --noinform --noprint --no-sysinit --no-userinit --eval
+ all-local: sharefiles.mk $(SBCL_MAXIMA)
diff --git a/sci-mathematics/maxima/files/maxima-5.29.1-wish.patch b/sci-mathematics/maxima/files/maxima-5.29.1-wish.patch
new file mode 100644
index 000000000000..6fcb0d9ec8e9
--- /dev/null
+++ b/sci-mathematics/maxima/files/maxima-5.29.1-wish.patch
@@ -0,0 +1,28 @@
+diff -r -U1 maxima-5.23.1.orig//configure.in maxima-5.23.1//configure.in
+--- maxima-5.23.1.orig//configure.in 2011-01-15 21:54:46.000000000 +0600
++++ maxima-5.23.1//configure.in 2011-01-16 21:00:16.000000000 +0600
+@@ -777,6 +777,11 @@
+ [ --with-wish=<prog> Use <prog> for Tk wish shell (default wish)],
+- [WISH="${withval}"],
+- [WISH="wish"])
++ [],
++ [with_wish="wish"])
++case "${with_wish}" in
++ no) WISH="none" ;;
++ yes) WISH="wish" ;;
++ *) WISH="${with_wish}" ;;
++esac
+ AC_SUBST(WISH)
+-
++AM_CONDITIONAL(WANT_TK, test x"${with_wish}" != xno)
+
+diff -r -U1 maxima-5.23.1.orig//interfaces/Makefile.am maxima-5.23.1//interfaces/Makefile.am
+--- maxima-5.23.1.orig//interfaces/Makefile.am 2004-04-28 23:34:59.000000000 +0700
++++ maxima-5.23.1//interfaces/Makefile.am 2011-01-16 20:41:38.000000000 +0600
+@@ -1,2 +1,6 @@
++if WANT_TK
+ SUBDIRS = emacs xmaxima
++else
++SUBDIRS = emacs
++endif
+ EXTRA_DIST = bin/xmaxima.iss
diff --git a/sci-mathematics/maxima/files/maxima-5.29.1.patch b/sci-mathematics/maxima/files/maxima-5.29.1.patch
new file mode 100644
index 000000000000..c8bd4191dda8
--- /dev/null
+++ b/sci-mathematics/maxima/files/maxima-5.29.1.patch
@@ -0,0 +1,51 @@
+diff -r -U1 maxima-5.28.0.orig/src/maxima.in maxima-5.28.0/src/maxima.in
+--- maxima-5.28.0.orig/src/maxima.in 2012-06-15 12:21:34.000000000 +0700
++++ maxima-5.28.0/src/maxima.in 2012-08-15 21:46:37.000000000 +0700
+@@ -138,5 +138,5 @@
+ if [ -x "$MAXIMA_IMAGESDIR/binary-$MAXIMA_LISP/maxima" ]; then
+- exec "$MAXIMA_IMAGESDIR/binary-$MAXIMA_LISP/maxima" $MAXIMA_LISP_OPTIONS -q "" -- "$arg1" "$arg2" "$arg3" "$arg4" "$arg5" "$arg6" "$arg7" "$arg8" "$arg9"
++ exec "$MAXIMA_IMAGESDIR/binary-$MAXIMA_LISP/maxima" $MAXIMA_LISP_OPTIONS -q -norc "" -- "$arg1" "$arg2" "$arg3" "$arg4" "$arg5" "$arg6" "$arg7" "$arg8" "$arg9"
+ else
+- exec "$MAXIMA_IMAGESDIR/binary-$MAXIMA_LISP/@CLISP_RUNTIME@" $MAXIMA_LISP_OPTIONS -q -M "$maxima_image_base.mem" "" -- "$arg1" "$arg2" "$arg3" "$arg4" "$arg5" "$arg6" "$arg7" "$arg8" "$arg9"
++ exec "$MAXIMA_IMAGESDIR/binary-$MAXIMA_LISP/@CLISP_RUNTIME@" $MAXIMA_LISP_OPTIONS -q -norc -M "$maxima_image_base.mem" "" -- "$arg1" "$arg2" "$arg3" "$arg4" "$arg5" "$arg6" "$arg7" "$arg8" "$arg9"
+ fi
+@@ -144,5 +144,5 @@
+ if [ -x "$maxima_image_base" ]; then
+- exec "$maxima_image_base" $MAXIMA_LISP_OPTIONS -q "" -- "$arg1" "$arg2" "$arg3" "$arg4" "$arg5" "$arg6" "$arg7" "$arg8" "$arg9"
++ exec "$maxima_image_base" $MAXIMA_LISP_OPTIONS -q -norc "" -- "$arg1" "$arg2" "$arg3" "$arg4" "$arg5" "$arg6" "$arg7" "$arg8" "$arg9"
+ else
+- exec "@CLISP_NAME@" $MAXIMA_LISP_OPTIONS -q -M "$maxima_image_base.mem" "" -- "$arg1" "$arg2" "$arg3" "$arg4" "$arg5" "$arg6" "$arg7" "$arg8" "$arg9"
++ exec "@CLISP_NAME@" $MAXIMA_LISP_OPTIONS -q -norc -M "$maxima_image_base.mem" "" -- "$arg1" "$arg2" "$arg3" "$arg4" "$arg5" "$arg6" "$arg7" "$arg8" "$arg9"
+ fi
+@@ -155,5 +155,5 @@
+ if [ -x "$MAXIMA_IMAGESDIR/binary-$MAXIMA_LISP/maxima" ]; then
+- exec "$MAXIMA_IMAGESDIR/binary-$MAXIMA_LISP/maxima" $MAXIMA_LISP_OPTIONS -quiet -- "$arg1" "$arg2" "$arg3" "$arg4" "$arg5" "$arg6" "$arg7" "$arg8" "$arg9"
++ exec "$MAXIMA_IMAGESDIR/binary-$MAXIMA_LISP/maxima" $MAXIMA_LISP_OPTIONS -quiet -nositeinit -noinit -- "$arg1" "$arg2" "$arg3" "$arg4" "$arg5" "$arg6" "$arg7" "$arg8" "$arg9"
+ else
+- exec "$MAXIMA_IMAGESDIR/binary-$MAXIMA_LISP/@CMUCL_RUNTIME@" $MAXIMA_LISP_OPTIONS -quiet -core "$maxima_image_base.core" -eval '(cl-user::run)' -- "$arg1" "$arg2" "$arg3" "$arg4" "$arg5" "$arg6" "$arg7" "$arg8" "$arg9"
++ exec "$MAXIMA_IMAGESDIR/binary-$MAXIMA_LISP/@CMUCL_RUNTIME@" $MAXIMA_LISP_OPTIONS -quiet -nositeinit -noinit -core "$maxima_image_base.core" -eval '(cl-user::run)' -- "$arg1" "$arg2" "$arg3" "$arg4" "$arg5" "$arg6" "$arg7" "$arg8" "$arg9"
+ fi
+@@ -161,5 +161,5 @@
+ if [ -x "$maxima_image_base" ]; then
+- exec "$maxima_image_base" $MAXIMA_LISP_OPTIONS -quiet -- "$arg1" "$arg2" "$arg3" "$arg4" "$arg5" "$arg6" "$arg7" "$arg8" "$arg9"
++ exec "$maxima_image_base" $MAXIMA_LISP_OPTIONS -quiet -nositeinit -noinit -- "$arg1" "$arg2" "$arg3" "$arg4" "$arg5" "$arg6" "$arg7" "$arg8" "$arg9"
+ else
+- exec "@CMUCL_NAME@" $MAXIMA_LISP_OPTIONS -quiet -core "$maxima_image_base.core" -eval '(cl-user::run)' -- "$arg1" "$arg2" "$arg3" "$arg4" "$arg5" "$arg6" "$arg7" "$arg8" "$arg9"
++ exec "@CMUCL_NAME@" $MAXIMA_LISP_OPTIONS -quiet -nositeinit -noinit -core "$maxima_image_base.core" -eval '(cl-user::run)' -- "$arg1" "$arg2" "$arg3" "$arg4" "$arg5" "$arg6" "$arg7" "$arg8" "$arg9"
+ fi
+@@ -183,5 +183,5 @@
+ if [ -x "$MAXIMA_IMAGESDIR/binary-$MAXIMA_LISP/maxima" ]; then
+- exec "$MAXIMA_IMAGESDIR/binary-$MAXIMA_LISP/maxima" $MAXIMA_LISP_OPTIONS -e '(cl-user::run)' -- "$arg1" "$arg2" "$arg3" "$arg4" "$arg5" "$arg6" "$arg7" "$arg8" "$arg9"
++ exec "$MAXIMA_IMAGESDIR/binary-$MAXIMA_LISP/maxima" $MAXIMA_LISP_OPTIONS --no-init -e '(cl-user::run)' -- "$arg1" "$arg2" "$arg3" "$arg4" "$arg5" "$arg6" "$arg7" "$arg8" "$arg9"
+ else
+- exec "@OPENMCL_NAME@" -I "$maxima_image_base.image" $MAXIMA_LISP_OPTIONS -e '(cl-user::run)' -- "$arg1" "$arg2" "$arg3" "$arg4" "$arg5" "$arg6" "$arg7" "$arg8" "$arg9"
++ exec "@OPENMCL_NAME@" -I "$maxima_image_base.image" $MAXIMA_LISP_OPTIONS --no-init -e '(cl-user::run)' -- "$arg1" "$arg2" "$arg3" "$arg4" "$arg5" "$arg6" "$arg7" "$arg8" "$arg9"
+ fi
+@@ -196,5 +196,5 @@
+ if [ -x "$MAXIMA_IMAGESDIR/binary-$MAXIMA_LISP/maxima" ]; then
+- exec "$MAXIMA_IMAGESDIR/binary-$MAXIMA_LISP/maxima" --noinform $MAXIMA_LISP_OPTIONS --end-runtime-options --eval '(cl-user::run)' --end-toplevel-options "$arg1" "$arg2" "$arg3" "$arg4" "$arg5" "$arg6" "$arg7" "$arg8" "$arg9"
++ exec "$MAXIMA_IMAGESDIR/binary-$MAXIMA_LISP/maxima" --noinform $MAXIMA_LISP_OPTIONS --end-runtime-options --no-sysinit --no-userinit --eval '(cl-user::run)' --end-toplevel-options "$arg1" "$arg2" "$arg3" "$arg4" "$arg5" "$arg6" "$arg7" "$arg8" "$arg9"
+ else
+- exec "@SBCL_NAME@" --core "$maxima_image_base.core" --noinform $MAXIMA_LISP_OPTIONS --end-runtime-options --eval '(cl-user::run)' --end-toplevel-options "$arg1" "$arg2" "$arg3" "$arg4" "$arg5" "$arg6" "$arg7" "$arg8" "$arg9"
++ exec "@SBCL_NAME@" --core "$maxima_image_base.core" --noinform $MAXIMA_LISP_OPTIONS --end-runtime-options --no-sysinit --no-userinit --eval '(cl-user::run)' --end-toplevel-options "$arg1" "$arg2" "$arg3" "$arg4" "$arg5" "$arg6" "$arg7" "$arg8" "$arg9"
+ fi
diff --git a/sci-mathematics/maxima/files/maxima-ccl.patch b/sci-mathematics/maxima/files/maxima-ccl.patch
new file mode 100644
index 000000000000..6e746740b0af
--- /dev/null
+++ b/sci-mathematics/maxima/files/maxima-ccl.patch
@@ -0,0 +1,8 @@
+diff -r -U1 maxima-5.28.0.orig/configure.in maxima-5.28.0/configure.in
+--- maxima-5.28.0.orig/configure.in 2012-08-12 23:17:53.000000000 +0700
++++ maxima-5.28.0/configure.in 2012-08-15 21:47:42.000000000 +0700
+@@ -350,3 +350,3 @@
+ dnl n.b. openmcl_default_name is hardcoded in "with" message
+-openmcl_default_name=openmcl
++openmcl_default_name=ccl
+ AC_ARG_ENABLE(openmcl,
diff --git a/sci-mathematics/maxima/files/maxima-ecl-ldflags.patch b/sci-mathematics/maxima/files/maxima-ecl-ldflags.patch
new file mode 100644
index 000000000000..e71486fcf736
--- /dev/null
+++ b/sci-mathematics/maxima/files/maxima-ecl-ldflags.patch
@@ -0,0 +1,27 @@
+diff -p -up maxima-5.20.1/src/maxima.system.orig maxima-5.20.1/src/maxima.system
+--- maxima-5.20.1/src/maxima.system.orig 2010-03-04 17:25:38.708483072 -0300
++++ maxima-5.20.1/src/maxima.system 2010-03-04 17:27:27.150481620 -0300
+@@ -44,6 +44,14 @@
+ (c:build-fasl output :lisp-files (list object-output)))))
+
+ #+ecl
++(defun split-ld-flags-for-ecl (string &aux space)
++ (setf string (string-trim '(#\Space) string))
++ (if (setf space (position #\Space string))
++ (cons (subseq string 0 space)
++ (split-ld-flags-for-ecl (subseq string (1+ space))))
++ (cons string nil)))
++
++#+ecl
+ (defun build-maxima-lib ()
+ (labels ((list-all-objects (module)
+ (if (eql (mk::component-type module) :file)
+@@ -66,7 +74,7 @@
+ :ld-flags
+ (let ((x (symbol-value (find-symbol "*AUTOCONF-LD-FLAGS*"
+ (find-package "MAXIMA")))))
+- (if (and x (not (string= x ""))) (list x)))
++ (if (and x (not (string= x ""))) (split-ld-flags-for-ecl x)))
+ :epilogue-code '(progn (require :defsystem)
+ (cl-user::run)))))))
+
diff --git a/sci-mathematics/maxima/files/maxima-imaxima.patch b/sci-mathematics/maxima/files/maxima-imaxima.patch
new file mode 100644
index 000000000000..fe607b240d13
--- /dev/null
+++ b/sci-mathematics/maxima/files/maxima-imaxima.patch
@@ -0,0 +1,5 @@
+--- interfaces/emacs/Makefile.am.orig 2010-02-01 22:11:44.809941160 +1300
++++ interfaces/emacs/Makefile.am 2010-02-01 22:12:06.608062346 +1300
+@@ -1 +1 @@
+-SUBDIRS = emaxima misc imaxima
++SUBDIRS = emaxima misc
diff --git a/sci-mathematics/maxima/files/maxima-no-init-files.patch b/sci-mathematics/maxima/files/maxima-no-init-files.patch
new file mode 100644
index 000000000000..2e49a2bad895
--- /dev/null
+++ b/sci-mathematics/maxima/files/maxima-no-init-files.patch
@@ -0,0 +1,31 @@
+--- src/maxima.in.orig 2008-02-07 11:53:43.006379528 +0000
++++ src/maxima.in 2008-02-07 11:55:02.278897011 +0000
+@@ -111,15 +111,15 @@
+ fi
+ if [ "$MAXIMA_LISP" = "clisp" ]; then
+ if [ "$layout_autotools" = "true" ]; then
+- exec "$MAXIMA_IMAGESDIR/binary-$MAXIMA_LISP/@CLISP_RUNTIME@" -q -M "$maxima_image_base.mem" "" -- "$arg1" "$arg2" "$arg3" "$arg4" "$arg5" "$arg6" "$arg7" "$arg8" "$arg9"
++ exec "$MAXIMA_IMAGESDIR/binary-$MAXIMA_LISP/@CLISP_RUNTIME@" -q -norc -M "$maxima_image_base.mem" "" -- "$arg1" "$arg2" "$arg3" "$arg4" "$arg5" "$arg6" "$arg7" "$arg8" "$arg9"
+ else
+- exec "@CLISP_NAME@" -q -M "$maxima_image_base.mem" "" -- "$arg1" "$arg2" "$arg3" "$arg4" "$arg5" "$arg6" "$arg7" "$arg8" "$arg9"
++ exec "@CLISP_NAME@" -q -norc -M "$maxima_image_base.mem" "" -- "$arg1" "$arg2" "$arg3" "$arg4" "$arg5" "$arg6" "$arg7" "$arg8" "$arg9"
+ fi
+ elif [ "$MAXIMA_LISP" = "cmucl" ]; then
+ if [ "$layout_autotools" = "true" ]; then
+- exec "$MAXIMA_IMAGESDIR/binary-$MAXIMA_LISP/@CMUCL_RUNTIME@" -quiet -core "$maxima_image_base.core" -eval '(cl-user::run)' -- "$arg1" "$arg2" "$arg3" "$arg4" "$arg5" "$arg6" "$arg7" "$arg8" "$arg9"
++ exec "$MAXIMA_IMAGESDIR/binary-$MAXIMA_LISP/@CMUCL_RUNTIME@" -quiet -nositeinit -noinit -core "$maxima_image_base.core" -eval '(cl-user::run)' -- "$arg1" "$arg2" "$arg3" "$arg4" "$arg5" "$arg6" "$arg7" "$arg8" "$arg9"
+ else
+- exec "@CMUCL_NAME@" -quiet -core "$maxima_image_base.core" -eval '(cl-user::run)' -- "$arg1" "$arg2" "$arg3" "$arg4" "$arg5" "$arg6" "$arg7" "$arg8" "$arg9"
++ exec "@CMUCL_NAME@" -quiet -nositeinit -noinit -core "$maxima_image_base.core" -eval '(cl-user::run)' -- "$arg1" "$arg2" "$arg3" "$arg4" "$arg5" "$arg6" "$arg7" "$arg8" "$arg9"
+ fi
+ elif [ "$MAXIMA_LISP" = "scl" ]; then
+ if [ "$layout_autotools" = "true" ]; then
+@@ -138,7 +138,7 @@
+ # in the function get-application-args in command-line.lisp
+ exec "@OPENMCL_NAME@" -I "$maxima_image_base.image" "$arg1" "$arg2" "$arg3" "$arg4" "$arg5" "$arg6" "$arg7" "$arg8" "$arg9"
+ elif [ "$MAXIMA_LISP" = "sbcl" ]; then
+- exec "@SBCL_NAME@" --core "$maxima_image_base.core" --noinform --end-runtime-options --eval '(cl-user::run)' --end-toplevel-options "$arg1" "$arg2" "$arg3" "$arg4" "$arg5" "$arg6" "$arg7" "$arg8" "$arg9"
++ exec "@SBCL_NAME@" --core "$maxima_image_base.core" --noinform --end-runtime-options --no-sysinit --no-userinit --eval '(cl-user::run)' --end-toplevel-options "$arg1" "$arg2" "$arg3" "$arg4" "$arg5" "$arg6" "$arg7" "$arg8" "$arg9"
+ else
+ echo "$0: lisp=\"$MAXIMA_LISP\" not known. Use --list-avail to see possible options." >&2
+ exit 1
diff --git a/sci-mathematics/maxima/files/maxima-rmaxima.patch b/sci-mathematics/maxima/files/maxima-rmaxima.patch
new file mode 100644
index 000000000000..712cbda19d45
--- /dev/null
+++ b/sci-mathematics/maxima/files/maxima-rmaxima.patch
@@ -0,0 +1,25 @@
+diff -r -U2 maxima-5.28.0.orig/src/Makefile.am maxima-5.28.0/src/Makefile.am
+--- maxima-5.28.0.orig/src/Makefile.am 2012-06-15 12:21:34.000000000 +0700
++++ maxima-5.28.0/src/Makefile.am 2012-10-30 22:22:29.000000000 +0700
+@@ -4,5 +4,21 @@
+ bin_SCRIPTS = maxima maxima-command.ico maxima.bat set_lang.vbs
+ else
++if SBCL
+ bin_SCRIPTS = maxima rmaxima
++else
++if CMUCL
++bin_SCRIPTS = maxima rmaxima
++else
++if ECL
++bin_SCRIPTS = maxima rmaxima
++else
++if OPENMCL
++bin_SCRIPTS = maxima rmaxima
++else
++bin_SCRIPTS = maxima
++endif
++endif
++endif
++endif
+ endif
+
diff --git a/sci-mathematics/maxima/files/maxima-xdg-utils.patch b/sci-mathematics/maxima/files/maxima-xdg-utils.patch
new file mode 100644
index 000000000000..876fe6fcd469
--- /dev/null
+++ b/sci-mathematics/maxima/files/maxima-xdg-utils.patch
@@ -0,0 +1,35 @@
+--- interfaces/emacs/misc/bookmode.el.orig 2008-02-07 12:42:18.008472937 +0000
++++ interfaces/emacs/misc/bookmode.el 2008-02-07 12:43:02.531010132 +0000
+@@ -680,7 +680,7 @@
+
+ (and tem
+ (list (concat "View "(nth 1 tem))
+- 'call-process "ghostview" nil nil nil
++ 'call-process "xdg-open" nil nil nil
+ (expand-file-name(nth 1 tem))
+ ))
+ (list "Cancel")
+@@ -705,7 +705,7 @@
+ (concat
+ (cond ((looking-at "%PS") "")
+ (t "gzip -dc | "))
+- "ghostview -")
++ "xdg-open -")
+
+ )))
+
+--- interfaces/xmaxima/Tkmaxima/Constants.tcl.orig 2008-02-07 12:42:47.294141832 +0000
++++ interfaces/xmaxima/Tkmaxima/Constants.tcl 2008-02-07 12:43:02.539010587 +0000
+@@ -143,9 +143,9 @@
+ image/gif netmath
+ image/png netmath
+ image/jpeg netmath
+- application/postscript "ghostview -safer %s"
+- application/pdf "acroread %s"
+- application/x-dvi "xdvi %s"
++ application/postscript "xdg-open -safer %s"
++ application/pdf "xdg-open %s"
++ application/x-dvi "xdg-open %s"
+ }
+ set maxima_priv(imagecounter) 0
+
diff --git a/sci-mathematics/maxima/files/rmaxima-0.patch b/sci-mathematics/maxima/files/rmaxima-0.patch
new file mode 100644
index 000000000000..712cbda19d45
--- /dev/null
+++ b/sci-mathematics/maxima/files/rmaxima-0.patch
@@ -0,0 +1,25 @@
+diff -r -U2 maxima-5.28.0.orig/src/Makefile.am maxima-5.28.0/src/Makefile.am
+--- maxima-5.28.0.orig/src/Makefile.am 2012-06-15 12:21:34.000000000 +0700
++++ maxima-5.28.0/src/Makefile.am 2012-10-30 22:22:29.000000000 +0700
+@@ -4,5 +4,21 @@
+ bin_SCRIPTS = maxima maxima-command.ico maxima.bat set_lang.vbs
+ else
++if SBCL
+ bin_SCRIPTS = maxima rmaxima
++else
++if CMUCL
++bin_SCRIPTS = maxima rmaxima
++else
++if ECL
++bin_SCRIPTS = maxima rmaxima
++else
++if OPENMCL
++bin_SCRIPTS = maxima rmaxima
++else
++bin_SCRIPTS = maxima
++endif
++endif
++endif
++endif
+ endif
+
diff --git a/sci-mathematics/maxima/files/sbcl-0.patch b/sci-mathematics/maxima/files/sbcl-0.patch
new file mode 100644
index 000000000000..5c2bdf7b509e
--- /dev/null
+++ b/sci-mathematics/maxima/files/sbcl-0.patch
@@ -0,0 +1,26 @@
+diff -r -U1 maxima-5.30.0.orig/src/Makefile.am maxima-5.30.0/src/Makefile.am
+--- maxima-5.30.0.orig/src/Makefile.am 2013-03-23 08:32:07.000000000 +0700
++++ maxima-5.30.0/src/Makefile.am 2013-04-13 14:36:39.977014432 +0700
+@@ -199,3 +199,3 @@
+ if SBCL
+-EXECUTESBCL = "$(SBCL_NAME)" --noinform --noprint --eval
++EXECUTESBCL = "$(SBCL_NAME)" --noinform --noprint --no-sysinit --no-userinit --eval
+ all-local: sharefiles.mk $(SBCL_MAXIMA)
+diff -r -U1 maxima-5.30.0.orig/src/maxima.in maxima-5.30.0/src/maxima.in
+--- maxima-5.30.0.orig/src/maxima.in 2012-12-04 12:54:50.000000000 +0700
++++ maxima-5.30.0/src/maxima.in 2013-04-13 14:36:39.977014432 +0700
+@@ -196,5 +196,5 @@
+ if [ -x "$MAXIMA_IMAGESDIR/binary-$MAXIMA_LISP/maxima" ]; then
+- exec "$MAXIMA_IMAGESDIR/binary-$MAXIMA_LISP/maxima" --noinform $MAXIMA_LISP_OPTIONS --end-runtime-options --eval '(cl-user::run)' --end-toplevel-options "$arg1" "$arg2" "$arg3" "$arg4" "$arg5" "$arg6" "$arg7" "$arg8" "$arg9"
++ exec "$MAXIMA_IMAGESDIR/binary-$MAXIMA_LISP/maxima" --noinform $MAXIMA_LISP_OPTIONS --end-runtime-options --no-sysinit --no-userinit --eval '(cl-user::run)' --end-toplevel-options "$arg1" "$arg2" "$arg3" "$arg4" "$arg5" "$arg6" "$arg7" "$arg8" "$arg9"
+ else
+- exec "@SBCL_NAME@" --core "$maxima_image_base.core" --noinform $MAXIMA_LISP_OPTIONS --end-runtime-options --eval '(cl-user::run)' --end-toplevel-options "$arg1" "$arg2" "$arg3" "$arg4" "$arg5" "$arg6" "$arg7" "$arg8" "$arg9"
++ exec "@SBCL_NAME@" --core "$maxima_image_base.core" --noinform $MAXIMA_LISP_OPTIONS --end-runtime-options --no-sysinit --no-userinit --eval '(cl-user::run)' --end-toplevel-options "$arg1" "$arg2" "$arg3" "$arg4" "$arg5" "$arg6" "$arg7" "$arg8" "$arg9"
+ fi
+diff -r -U1 maxima-5.30.0.orig/src/server.lisp maxima-5.30.0/src/server.lisp
+--- maxima-5.30.0.orig/src/server.lisp 2012-11-19 04:40:51.000000000 +0700
++++ maxima-5.30.0/src/server.lisp 2013-04-13 14:37:19.937051659 +0700
+@@ -10,3 +10,2 @@
+ (eval-when (:compile-toplevel :load-toplevel :execute)
+- #+sbcl (require 'asdf) ;not needed here for a recent SBCL
+ #+sbcl (require 'sb-posix)
diff --git a/sci-mathematics/maxima/files/wish-0.patch b/sci-mathematics/maxima/files/wish-0.patch
new file mode 100644
index 000000000000..6fcb0d9ec8e9
--- /dev/null
+++ b/sci-mathematics/maxima/files/wish-0.patch
@@ -0,0 +1,28 @@
+diff -r -U1 maxima-5.23.1.orig//configure.in maxima-5.23.1//configure.in
+--- maxima-5.23.1.orig//configure.in 2011-01-15 21:54:46.000000000 +0600
++++ maxima-5.23.1//configure.in 2011-01-16 21:00:16.000000000 +0600
+@@ -777,6 +777,11 @@
+ [ --with-wish=<prog> Use <prog> for Tk wish shell (default wish)],
+- [WISH="${withval}"],
+- [WISH="wish"])
++ [],
++ [with_wish="wish"])
++case "${with_wish}" in
++ no) WISH="none" ;;
++ yes) WISH="wish" ;;
++ *) WISH="${with_wish}" ;;
++esac
+ AC_SUBST(WISH)
+-
++AM_CONDITIONAL(WANT_TK, test x"${with_wish}" != xno)
+
+diff -r -U1 maxima-5.23.1.orig//interfaces/Makefile.am maxima-5.23.1//interfaces/Makefile.am
+--- maxima-5.23.1.orig//interfaces/Makefile.am 2004-04-28 23:34:59.000000000 +0700
++++ maxima-5.23.1//interfaces/Makefile.am 2011-01-16 20:41:38.000000000 +0600
+@@ -1,2 +1,6 @@
++if WANT_TK
+ SUBDIRS = emacs xmaxima
++else
++SUBDIRS = emacs
++endif
+ EXTRA_DIST = bin/xmaxima.iss
diff --git a/sci-mathematics/maxima/files/wish-1.patch b/sci-mathematics/maxima/files/wish-1.patch
new file mode 100644
index 000000000000..6e002d99267d
--- /dev/null
+++ b/sci-mathematics/maxima/files/wish-1.patch
@@ -0,0 +1,28 @@
+diff -r -U1 maxima-5.35.1.orig/configure.ac maxima-5.35.1/configure.ac
+--- maxima-5.35.1.orig/configure.ac 2014-12-13 06:44:51.000000000 +0600
++++ maxima-5.35.1/configure.ac 2014-12-15 16:30:07.574773386 +0600
+@@ -989,6 +989,11 @@
+ [ --with-wish=<prog> Use <prog> for Tk wish shell (default wish)],
+- [WISH="${withval}"],
+- [WISH="wish"])
++ [],
++ [with_wish="wish"])
++case "${with_wish}" in
++ no) WISH="none" ;;
++ yes) WISH="wish" ;;
++ *) WISH="${with_wish}" ;;
++esac
+ AC_SUBST(WISH)
+-
++AM_CONDITIONAL(WANT_TK, test x"${with_wish}" != xno)
+
+diff -r -U1 maxima-5.35.1.orig/interfaces/Makefile.am maxima-5.35.1/interfaces/Makefile.am
+--- maxima-5.35.1.orig/interfaces/Makefile.am 2013-10-07 10:37:11.000000000 +0700
++++ maxima-5.35.1/interfaces/Makefile.am 2014-12-15 16:31:18.056770422 +0600
+@@ -1,2 +1,6 @@
++if WANT_TK
+ SUBDIRS = emacs xmaxima
++else
++SUBDIRS = emacs
++endif
+ EXTRA_DIST = bin/xmaxima.iss
diff --git a/sci-mathematics/maxima/files/xdg-utils-0.patch b/sci-mathematics/maxima/files/xdg-utils-0.patch
new file mode 100644
index 000000000000..876fe6fcd469
--- /dev/null
+++ b/sci-mathematics/maxima/files/xdg-utils-0.patch
@@ -0,0 +1,35 @@
+--- interfaces/emacs/misc/bookmode.el.orig 2008-02-07 12:42:18.008472937 +0000
++++ interfaces/emacs/misc/bookmode.el 2008-02-07 12:43:02.531010132 +0000
+@@ -680,7 +680,7 @@
+
+ (and tem
+ (list (concat "View "(nth 1 tem))
+- 'call-process "ghostview" nil nil nil
++ 'call-process "xdg-open" nil nil nil
+ (expand-file-name(nth 1 tem))
+ ))
+ (list "Cancel")
+@@ -705,7 +705,7 @@
+ (concat
+ (cond ((looking-at "%PS") "")
+ (t "gzip -dc | "))
+- "ghostview -")
++ "xdg-open -")
+
+ )))
+
+--- interfaces/xmaxima/Tkmaxima/Constants.tcl.orig 2008-02-07 12:42:47.294141832 +0000
++++ interfaces/xmaxima/Tkmaxima/Constants.tcl 2008-02-07 12:43:02.539010587 +0000
+@@ -143,9 +143,9 @@
+ image/gif netmath
+ image/png netmath
+ image/jpeg netmath
+- application/postscript "ghostview -safer %s"
+- application/pdf "acroread %s"
+- application/x-dvi "xdvi %s"
++ application/postscript "xdg-open -safer %s"
++ application/pdf "xdg-open %s"
++ application/x-dvi "xdg-open %s"
+ }
+ set maxima_priv(imagecounter) 0
+
diff --git a/sci-mathematics/maxima/maxima-5.18.1.ebuild b/sci-mathematics/maxima/maxima-5.18.1.ebuild
new file mode 100644
index 000000000000..367765c8096c
--- /dev/null
+++ b/sci-mathematics/maxima/maxima-5.18.1.ebuild
@@ -0,0 +1,175 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+EAPI=2
+inherit eutils elisp-common
+
+DESCRIPTION="Free computer algebra environment based on Macsyma"
+HOMEPAGE="http://maxima.sourceforge.net/"
+SRC_URI="mirror://sourceforge/${PN}/${P}.tar.gz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="amd64 ppc x86"
+
+# Supported lisps with readline
+SUPP_RL="gcl clisp"
+# Supported lisps without readline
+SUPP_NORL="cmucl sbcl"
+SUPP_LISPS="${SUPP_RL} ${SUPP_NORL}"
+# Default lisp if none selected
+DEF_LISP="sbcl"
+
+IUSE="latex emacs tk nls unicode xemacs X ${SUPP_LISPS} ${IUSE}"
+
+# Languages
+LANGS="es pt pt_BR"
+for lang in ${LANGS}; do
+ IUSE="${IUSE} linguas_${lang}"
+done
+
+RDEPEND="X? ( x11-misc/xdg-utils
+ sci-visualization/gnuplot[gd]
+ tk? ( dev-lang/tk:0 ) )
+ latex? ( virtual/latex-base )
+ emacs? ( virtual/emacs
+ latex? ( app-emacs/auctex ) )
+ xemacs? ( app-editors/xemacs
+ latex? ( app-emacs/auctex ) )"
+
+PDEPEND="emacs? ( app-emacs/imaxima )"
+
+# create lisp dependencies
+for LISP in ${SUPP_LISPS}; do
+ if [ "${LISP}" = "gcl" ]
+ then
+ RDEPEND="${RDEPEND} gcl? ( >=dev-lisp/gcl-2.6.8_pre[ansi] )"
+ else
+ RDEPEND="${RDEPEND} ${LISP}? ( dev-lisp/${LISP} )"
+ fi
+ DEF_DEP="${DEF_DEP} !${LISP}? ( "
+done
+DEF_DEP="${DEF_DEP} dev-lisp/${DEF_LISP}"
+for LISP in ${SUPP_NORL}; do
+ RDEPEND="${RDEPEND} ${LISP}? ( app-misc/rlwrap )"
+ [[ ${LISP} = ${DEF_LISP} ]] && \
+ DEF_DEP="${DEF_DEP} app-misc/rlwrap"
+done
+for LISP in ${SUPP_LISPS}; do
+ DEF_DEP="${DEF_DEP} )"
+done
+
+RDEPEND="${RDEPEND}
+ ${DEF_DEP}"
+
+DEPEND="${RDEPEND}
+ sys-apps/texinfo"
+
+TEXMF=/usr/share/texmf-site
+
+pkg_setup() {
+ LISPS=""
+
+ for LISP in ${SUPP_LISPS}; do
+ use ${LISP} && LISPS="${LISPS} ${LISP}"
+ done
+
+ RL=""
+
+ for LISP in ${SUPP_NORL}; do
+ use ${LISP} && RL="yes"
+ done
+
+ if [ -z "${LISPS}" ]; then
+ ewarn "No lisp specified in USE flags, choosing ${DEF_LISP} as default"
+ LISPS="${DEF_LISP}"
+ RL="yes"
+ fi
+}
+
+src_prepare() {
+ # use xdg-open to view ps, pdf
+ epatch "${FILESDIR}"/${PN}-xdg-utils.patch
+ epatch "${FILESDIR}"/${PN}-no-init-files.patch
+ # remove rmaxima if neither cmucl nor sbcl
+ if [ -z "${RL}" ]; then
+ sed -e '/^@WIN32_FALSE@bin_SCRIPTS/s/rmaxima//' \
+ -i "${S}"/src/Makefile.in \
+ || die "sed for rmaxima failed"
+ fi
+ # don't install imaxima, since we have a separate package for it
+ sed -i -e '/^SUBDIRS/s/imaxima//' interfaces/emacs/Makefile.in \
+ || die "sed for imaxima failed"
+}
+
+src_configure() {
+ local myconf=""
+ for LISP in ${LISPS}; do
+ myconf="${myconf} --enable-${LISP}"
+ done
+
+ # remove xmaxima if no tk
+ if use tk; then
+ myconf="${myconf} --with-wish=wish"
+ else
+ myconf="${myconf} --with-wish=none"
+ sed -i \
+ -e '/^SUBDIRS/s/xmaxima//' \
+ interfaces/Makefile.in || die "sed for tk failed"
+ fi
+
+ # enable existing translated doc
+ if use nls; then
+ for lang in ${LANGS}; do
+ if use "linguas_${lang}"; then
+ myconf="${myconf} --enable-lang-${lang}"
+ use unicode && myconf="${myconf} --enable-lang-${lang}-utf8"
+ fi
+ done
+ fi
+
+ econf ${myconf}
+}
+
+src_install() {
+ einstall emacsdir="${D}${SITELISP}/${PN}" || die "einstall failed"
+
+ use tk && make_desktop_entry xmaxima xmaxima \
+ /usr/share/${PN}/${PV}/xmaxima/maxima-new.png \
+ "Science;Math;Education"
+
+ if use latex; then
+ insinto ${TEXMF}/tex/latex/emaxima
+ doins interfaces/emacs/emaxima/emaxima.sty
+ fi
+
+ # do not use dodoc because interfaces can't read compressed files
+ # read COPYING before attempt to remove it from dodoc
+ insinto /usr/share/${PN}/${PV}/doc
+ doins AUTHORS COPYING README README.lisps || die
+ dodir /usr/share/doc
+ dosym ../${PN}/${PV}/doc /usr/share/doc/${PF} || die
+
+ if use emacs; then
+ elisp-site-file-install "${FILESDIR}"/50maxima-gentoo.el || die
+ fi
+}
+
+pkg_preinst() {
+ # some lisps do not read compress info files (bug #176411)
+ for infofile in "${D}"/usr/share/info/*.bz2 ; do
+ bunzip2 "${infofile}"
+ done
+ for infofile in "${D}"/usr/share/info/*.gz ; do
+ gunzip "${infofile}"
+ done
+}
+
+pkg_postinst() {
+ use emacs && elisp-site-regen
+ use latex && mktexlsr
+}
+
+pkg_postrm() {
+ use emacs && elisp-site-regen
+}
diff --git a/sci-mathematics/maxima/maxima-5.34.1.ebuild b/sci-mathematics/maxima/maxima-5.34.1.ebuild
new file mode 100644
index 000000000000..d683128e5d62
--- /dev/null
+++ b/sci-mathematics/maxima/maxima-5.34.1.ebuild
@@ -0,0 +1,190 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+inherit autotools elisp-common eutils
+
+DESCRIPTION="Free computer algebra environment based on Macsyma"
+HOMEPAGE="http://maxima.sourceforge.net/"
+SRC_URI="mirror://sourceforge/${PN}/${P}.tar.gz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="amd64 ppc x86 ~amd64-linux ~x86-linux ~ppc-macos ~x86-macos"
+
+# Supported lisps
+LISPS=( sbcl cmucl gcl ecls clozurecl clisp )
+# <lisp> supports readline: . - no, y - yes
+SUPP_RL=( . . y . . y )
+# . - just --enable-<lisp>, <flag> - --enable-<flag>
+CONF_FLAG=( . . . ecl ccl . )
+# patch file version; . - no patch
+PATCH_V=( 0 0 . 1 0 0 )
+
+IUSE="latex emacs tk nls unicode xemacs X ${LISPS[*]}"
+
+# Languages
+LANGS="es pt pt_BR"
+for lang in ${LANGS}; do
+ IUSE="${IUSE} linguas_${lang}"
+done
+
+RDEPEND="X? ( x11-misc/xdg-utils
+ sci-visualization/gnuplot[gd]
+ tk? ( dev-lang/tk:0 ) )
+ latex? ( virtual/latex-base )
+ emacs? ( virtual/emacs
+ latex? ( app-emacs/auctex ) )
+ xemacs? ( app-editors/xemacs
+ latex? ( app-emacs/auctex ) )"
+
+PDEPEND="emacs? ( app-emacs/imaxima )"
+
+# generating lisp dependencies
+depends() {
+ local LISP DEP
+ LISP=${LISPS[$1]}
+ DEP="dev-lisp/${LISP}:="
+ if [ "${SUPP_RL[$1]}" = "." ]; then
+ DEP="${DEP} app-misc/rlwrap"
+ fi
+ echo ${DEP}
+}
+
+n=${#LISPS[*]}
+for ((n--; n >= 0; n--)); do
+ LISP=${LISPS[${n}]}
+ RDEPEND="${RDEPEND} ${LISP}? ( $(depends ${n}) )"
+ if (( ${n} > 0 )); then
+ DEF_DEP="${DEF_DEP} !${LISP}? ( "
+ fi
+done
+
+# default lisp
+if use arm; then
+ DEF_LISP=2 # gcl
+else
+ DEF_LISP=0 # sbcl
+fi
+
+DEF_DEP="${DEF_DEP} `depends ${DEF_LISP}`"
+
+n=${#LISPS[*]}
+for ((n--; n > 0; n--)); do
+ DEF_DEP="${DEF_DEP} )"
+done
+
+unset LISP
+
+RDEPEND="${RDEPEND}
+ ${DEF_DEP}"
+
+DEPEND="${RDEPEND}
+ sys-apps/texinfo"
+
+TEXMF="${EPREFIX}"/usr/share/texmf-site
+
+pkg_setup() {
+ local n=${#LISPS[*]}
+
+ for ((n--; n >= 0; n--)); do
+ use ${LISPS[${n}]} && NLISPS="${NLISPS} ${n}"
+ done
+
+ if [ -z "${NLISPS}" ]; then
+ ewarn "No lisp specified in USE flags, choosing ${LISPS[${DEF_LISP}]} as default"
+ NLISPS=${DEF_LISP}
+ fi
+}
+
+src_prepare() {
+ local n PATCHES v
+ PATCHES=( imaxima-0 rmaxima-0 wish-0 xdg-utils-0 )
+
+ n=${#PATCHES[*]}
+ for ((n--; n >= 0; n--)); do
+ epatch "${FILESDIR}"/${PATCHES[${n}]}.patch
+ done
+
+ n=${#LISPS[*]}
+ for ((n--; n >= 0; n--)); do
+ v=${PATCH_V[${n}]}
+ if [ "${v}" != "." ]; then
+ epatch "${FILESDIR}"/${LISPS[${n}]}-${v}.patch
+ fi
+ done
+
+ # bug #343331
+ rm share/Makefile.in || die
+ rm src/Makefile.in || die
+ touch src/*.mk
+ touch src/Makefile.am
+ eautoreconf
+}
+
+src_configure() {
+ local CONFS CONF n lang
+ for n in ${NLISPS}; do
+ CONF=${CONF_FLAG[${n}]}
+ if [ ${CONF} = . ]; then
+ CONF=${LISPS[${n}]}
+ fi
+ CONFS="${CONFS} --enable-${CONF}"
+ done
+
+ # enable existing translated doc
+ if use nls; then
+ for lang in ${LANGS}; do
+ if use "linguas_${lang}"; then
+ CONFS="${CONFS} --enable-lang-${lang}"
+ use unicode && CONFS="${CONFS} --enable-lang-${lang}-utf8"
+ fi
+ done
+ fi
+
+ econf ${CONFS} $(use_with tk wish) --with-lispdir="${SITELISP}"/${PN}
+}
+
+src_install() {
+ docompress -x /usr/share/info
+ emake DESTDIR="${D}" emacsdir="${SITELISP}/${PN}" install
+
+ use tk && make_desktop_entry xmaxima xmaxima \
+ /usr/share/${PN}/${PV}/xmaxima/maxima-new.png \
+ "Science;Math;Education"
+
+ if use latex; then
+ insinto ${TEXMF}/tex/latex/emaxima
+ doins interfaces/emacs/emaxima/emaxima.sty
+ fi
+
+ # do not use dodoc because interfaces can't read compressed files
+ # read COPYING before attempt to remove it from dodoc
+ insinto /usr/share/${PN}/${PV}/doc
+ doins AUTHORS COPYING README README.lisps || die
+ dodir /usr/share/doc
+ dosym ../${PN}/${PV}/doc /usr/share/doc/${PF} || die
+
+ if use emacs; then
+ elisp-site-file-install "${FILESDIR}"/50maxima-gentoo.el || die
+ fi
+
+ # if we use ecls, build an ecls library for maxima
+ if use ecls; then
+ ECLLIB=`ecl -eval "(princ (SI:GET-LIBRARY-PATHNAME))" -eval "(quit)"`
+ insinto "${ECLLIB#${EPREFIX}}"
+ doins src/binary-ecl/maxima.fas
+ fi
+}
+
+pkg_postinst() {
+ use emacs && elisp-site-regen
+ use latex && mktexlsr
+}
+
+pkg_postrm() {
+ use emacs && elisp-site-regen
+ use latex && mktexlsr
+}
diff --git a/sci-mathematics/maxima/maxima-5.36.1.ebuild b/sci-mathematics/maxima/maxima-5.36.1.ebuild
new file mode 100644
index 000000000000..fc3eb937a245
--- /dev/null
+++ b/sci-mathematics/maxima/maxima-5.36.1.ebuild
@@ -0,0 +1,190 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+inherit autotools elisp-common eutils
+
+DESCRIPTION="Free computer algebra environment based on Macsyma"
+HOMEPAGE="http://maxima.sourceforge.net/"
+SRC_URI="mirror://sourceforge/${PN}/${P}.tar.gz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~amd64 ~ppc ~x86 ~amd64-linux ~x86-linux ~ppc-macos ~x86-macos"
+
+# Supported lisps
+LISPS=( sbcl cmucl gcl ecls clozurecl clisp )
+# <lisp> supports readline: . - no, y - yes
+SUPP_RL=( . . y . . y )
+# . - just --enable-<lisp>, <flag> - --enable-<flag>
+CONF_FLAG=( . . . ecl ccl . )
+# patch file version; . - no patch
+PATCH_V=( 0 0 . 1 1 0 )
+
+IUSE="latex emacs tk nls unicode xemacs X ${LISPS[*]}"
+
+# Languages
+LANGS="es pt pt_BR"
+for lang in ${LANGS}; do
+ IUSE="${IUSE} linguas_${lang}"
+done
+
+RDEPEND="X? ( x11-misc/xdg-utils
+ sci-visualization/gnuplot[gd]
+ tk? ( dev-lang/tk:0 ) )
+ latex? ( virtual/latex-base )
+ emacs? ( virtual/emacs
+ latex? ( app-emacs/auctex ) )
+ xemacs? ( app-editors/xemacs
+ latex? ( app-emacs/auctex ) )"
+
+PDEPEND="emacs? ( app-emacs/imaxima )"
+
+# generating lisp dependencies
+depends() {
+ local LISP DEP
+ LISP=${LISPS[$1]}
+ DEP="dev-lisp/${LISP}:="
+ if [ "${SUPP_RL[$1]}" = "." ]; then
+ DEP="${DEP} app-misc/rlwrap"
+ fi
+ echo ${DEP}
+}
+
+n=${#LISPS[*]}
+for ((n--; n >= 0; n--)); do
+ LISP=${LISPS[${n}]}
+ RDEPEND="${RDEPEND} ${LISP}? ( $(depends ${n}) )"
+ if (( ${n} > 0 )); then
+ DEF_DEP="${DEF_DEP} !${LISP}? ( "
+ fi
+done
+
+# default lisp
+if use arm; then
+ DEF_LISP=2 # gcl
+else
+ DEF_LISP=0 # sbcl
+fi
+
+DEF_DEP="${DEF_DEP} `depends ${DEF_LISP}`"
+
+n=${#LISPS[*]}
+for ((n--; n > 0; n--)); do
+ DEF_DEP="${DEF_DEP} )"
+done
+
+unset LISP
+
+RDEPEND="${RDEPEND}
+ ${DEF_DEP}"
+
+DEPEND="${RDEPEND}
+ sys-apps/texinfo"
+
+TEXMF="${EPREFIX}"/usr/share/texmf-site
+
+pkg_setup() {
+ local n=${#LISPS[*]}
+
+ for ((n--; n >= 0; n--)); do
+ use ${LISPS[${n}]} && NLISPS="${NLISPS} ${n}"
+ done
+
+ if [ -z "${NLISPS}" ]; then
+ ewarn "No lisp specified in USE flags, choosing ${LISPS[${DEF_LISP}]} as default"
+ NLISPS=${DEF_LISP}
+ fi
+}
+
+src_prepare() {
+ local n PATCHES v
+ PATCHES=( imaxima-0 rmaxima-0 wish-1 xdg-utils-0 )
+
+ n=${#PATCHES[*]}
+ for ((n--; n >= 0; n--)); do
+ epatch "${FILESDIR}"/${PATCHES[${n}]}.patch
+ done
+
+ n=${#LISPS[*]}
+ for ((n--; n >= 0; n--)); do
+ v=${PATCH_V[${n}]}
+ if [ "${v}" != "." ]; then
+ epatch "${FILESDIR}"/${LISPS[${n}]}-${v}.patch
+ fi
+ done
+
+ # bug #343331
+ rm share/Makefile.in || die
+ rm src/Makefile.in || die
+ touch src/*.mk
+ touch src/Makefile.am
+ eautoreconf
+}
+
+src_configure() {
+ local CONFS CONF n lang
+ for n in ${NLISPS}; do
+ CONF=${CONF_FLAG[${n}]}
+ if [ ${CONF} = . ]; then
+ CONF=${LISPS[${n}]}
+ fi
+ CONFS="${CONFS} --enable-${CONF}"
+ done
+
+ # enable existing translated doc
+ if use nls; then
+ for lang in ${LANGS}; do
+ if use "linguas_${lang}"; then
+ CONFS="${CONFS} --enable-lang-${lang}"
+ use unicode && CONFS="${CONFS} --enable-lang-${lang}-utf8"
+ fi
+ done
+ fi
+
+ econf ${CONFS} $(use_with tk wish) --with-lispdir="${SITELISP}"/${PN}
+}
+
+src_install() {
+ docompress -x /usr/share/info
+ emake DESTDIR="${D}" emacsdir="${SITELISP}/${PN}" install
+
+ use tk && make_desktop_entry xmaxima xmaxima \
+ /usr/share/${PN}/${PV}/xmaxima/maxima-new.png \
+ "Science;Math;Education"
+
+ if use latex; then
+ insinto ${TEXMF}/tex/latex/emaxima
+ doins interfaces/emacs/emaxima/emaxima.sty
+ fi
+
+ # do not use dodoc because interfaces can't read compressed files
+ # read COPYING before attempt to remove it from dodoc
+ insinto /usr/share/${PN}/${PV}/doc
+ doins AUTHORS COPYING README README.lisps || die
+ dodir /usr/share/doc
+ dosym ../${PN}/${PV}/doc /usr/share/doc/${PF} || die
+
+ if use emacs; then
+ elisp-site-file-install "${FILESDIR}"/50maxima-gentoo.el || die
+ fi
+
+ # if we use ecls, build an ecls library for maxima
+ if use ecls; then
+ ECLLIB=`ecl -eval "(princ (SI:GET-LIBRARY-PATHNAME))" -eval "(quit)"`
+ insinto "${ECLLIB#${EPREFIX}}"
+ doins src/binary-ecl/maxima.fas
+ fi
+}
+
+pkg_postinst() {
+ use emacs && elisp-site-regen
+ use latex && mktexlsr
+}
+
+pkg_postrm() {
+ use emacs && elisp-site-regen
+ use latex && mktexlsr
+}
diff --git a/sci-mathematics/maxima/metadata.xml b/sci-mathematics/maxima/metadata.xml
new file mode 100644
index 000000000000..bf57b7ffa334
--- /dev/null
+++ b/sci-mathematics/maxima/metadata.xml
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <herd>sci-mathematics</herd>
+ <longdescription lang="en">
+ Computer Algebra system, descendent of Macsyma.
+ Maxima is a system for the manipulation of symbolic and
+ numerical expressions, including differentiation, integration,
+ Taylor series, Laplace transforms, ordinary differential
+ equations, systems of linear equations, and vectors, matrices,
+ and tensors. Maxima produces high precision results by using
+ exact fractions and arbitrarily long floating point representations,
+ and can plot functions and data in two and three dimensions.
+</longdescription>
+ <use>
+ <flag name="clisp">Compile maxima with GNU CLISP
+ (<pkg>dev-lisp/clisp</pkg>)</flag>
+ <flag name="clozurecl">Compile maxima with Clozure Common Lisp
+ (<pkg>dev-lisp/clozurecl</pkg>)</flag>
+ <flag name="cmucl">Compile maxima with CMU Common Lisp
+ (<pkg>dev-lisp/cmucl</pkg>)</flag>
+ <flag name="ecls">Compile maxima with Embeddable Common Lisp
+ (<pkg>dev-lisp/ecls</pkg>)</flag>
+ <flag name="gcl">Compile maxima with GNU Common Lisp
+ (<pkg>dev-lisp/gcl</pkg>)</flag>
+ <flag name="sbcl">Compile maxima with Steel Bank Common Lisp
+ (<pkg>dev-lisp/sbcl</pkg>)</flag>
+ </use>
+ <upstream>
+ <remote-id type="sourceforge">maxima</remote-id>
+ </upstream>
+</pkgmetadata>
diff --git a/sci-mathematics/metadata.xml b/sci-mathematics/metadata.xml
new file mode 100644
index 000000000000..1eb658e8e1cc
--- /dev/null
+++ b/sci-mathematics/metadata.xml
@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE catmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<catmetadata>
+ <longdescription lang="en">
+ The sci-mathematics category contains mathematical software.
+ </longdescription>
+ <longdescription lang="de">
+ Die Kategorie sci-mathematics enthält mathematische Software.
+ </longdescription>
+ <longdescription lang="es">
+ La categoría sci-mathemathics contiene programas relacionados con las
+ matemáticas.
+ </longdescription>
+ <longdescription lang="ja">
+ sci-mathematicsカテゴリーには数学のソフトウェアが含まれています。
+ </longdescription>
+ <longdescription lang="nl">
+ De sci-mathematics categorie bevat wiskundige software.
+ </longdescription>
+ <longdescription lang="vi">
+ Nhóm sci-mathematics chứa các phần mềm toán học.
+ </longdescription>
+ <longdescription lang="sk">
+ Kategória sci-mathematics obsahuje matematické programy.
+ </longdescription>
+ <longdescription lang="it">
+ La categoria sci-mathemathics contiene programmi matematici.
+ </longdescription>
+ <longdescription lang="pt">
+ A categoria sci-mathematics contém programas matemáticos.
+ </longdescription>
+ <longdescription lang="pl">
+ Kategoria sci-mathematics zawiera programy naukowe związane z
+ matematyką.
+ </longdescription>
+</catmetadata>
+
diff --git a/sci-mathematics/minisat/Manifest b/sci-mathematics/minisat/Manifest
new file mode 100644
index 000000000000..a43325b8e3b4
--- /dev/null
+++ b/sci-mathematics/minisat/Manifest
@@ -0,0 +1,3 @@
+DIST MiniSat.pdf 327416 SHA256 53197dbd783c924a2627d75e305706297988494265bd5e5ec873840e5d797ac4
+DIST minisat-2.2.0.tar.gz 43879 SHA256 92957d851cdc3baddfe07b5fc80ed5a0237c489d0c52ae72f62844b3b46d7808
+DIST minisat2-070721.zip 48776 SHA256 ddc2ed421a538a349ddab58d3958076d73813925ff08361e6292583d3b87248e
diff --git a/sci-mathematics/minisat/files/minisat-2.2.0-header_fix.patch b/sci-mathematics/minisat/files/minisat-2.2.0-header_fix.patch
new file mode 100644
index 000000000000..486c012fe2a4
--- /dev/null
+++ b/sci-mathematics/minisat/files/minisat-2.2.0-header_fix.patch
@@ -0,0 +1,160 @@
+--- ./utils/System.h.orig 2010-07-10 09:07:36.000000000 -0700
++++ ./utils/System.h 2011-04-12 18:33:41.000000000 -0700
+@@ -25,7 +25,7 @@
+ #include <fpu_control.h>
+ #endif
+
+-#include "mtl/IntTypes.h"
++#include <mtl/IntTypes.h>
+
+ //-------------------------------------------------------------------------------------------------
+
+--- ./utils/Options.h.orig 2010-07-10 09:07:36.000000000 -0700
++++ ./utils/Options.h 2011-04-12 18:34:38.000000000 -0700
+@@ -25,9 +25,9 @@
+ #include <math.h>
+ #include <string.h>
+
+-#include "mtl/IntTypes.h"
+-#include "mtl/Vec.h"
+-#include "utils/ParseUtils.h"
++#include <mtl/IntTypes.h>
++#include <mtl/Vec.h>
++#include "ParseUtils.h"
+
+ namespace Minisat {
+
+--- ./core/SolverTypes.h.orig 2010-07-10 09:07:36.000000000 -0700
++++ ./core/SolverTypes.h 2011-04-12 18:27:58.000000000 -0700
+@@ -24,11 +24,11 @@
+
+ #include <assert.h>
+
+-#include "mtl/IntTypes.h"
+-#include "mtl/Alg.h"
+-#include "mtl/Vec.h"
+-#include "mtl/Map.h"
+-#include "mtl/Alloc.h"
++#include <mtl/IntTypes.h>
++#include <mtl/Alg.h>
++#include <mtl/Vec.h>
++#include <mtl/Map.h>
++#include <mtl/Alloc.h>
+
+ namespace Minisat {
+
+--- ./core/Solver.h.orig 2010-07-10 09:07:36.000000000 -0700
++++ ./core/Solver.h 2011-04-12 18:26:56.000000000 -0700
+@@ -21,11 +21,11 @@
+ #ifndef Minisat_Solver_h
+ #define Minisat_Solver_h
+
+-#include "mtl/Vec.h"
+-#include "mtl/Heap.h"
+-#include "mtl/Alg.h"
+-#include "utils/Options.h"
+-#include "core/SolverTypes.h"
++#include <mtl/Vec.h>
++#include <mtl/Heap.h>
++#include <mtl/Alg.h>
++#include <utils/Options.h>
++#include "SolverTypes.h"
+
+
+ namespace Minisat {
+--- ./mtl/Vec.h.orig 2010-07-10 09:07:36.000000000 -0700
++++ ./mtl/Vec.h 2011-04-12 18:30:50.000000000 -0700
+@@ -24,8 +24,8 @@
+ #include <assert.h>
+ #include <new>
+
+-#include "mtl/IntTypes.h"
+-#include "mtl/XAlloc.h"
++#include "IntTypes.h"
++#include "XAlloc.h"
+
+ namespace Minisat {
+
+--- ./mtl/Sort.h.orig 2010-07-10 09:07:36.000000000 -0700
++++ ./mtl/Sort.h 2011-04-12 18:31:05.000000000 -0700
+@@ -21,7 +21,7 @@
+ #ifndef Minisat_Sort_h
+ #define Minisat_Sort_h
+
+-#include "mtl/Vec.h"
++#include "Vec.h"
+
+ //=================================================================================================
+ // Some sorting algorithms for vec's
+--- ./mtl/Alg.h.orig 2010-07-10 09:07:36.000000000 -0700
++++ ./mtl/Alg.h 2011-04-12 18:32:26.000000000 -0700
+@@ -21,7 +21,7 @@
+ #ifndef Minisat_Alg_h
+ #define Minisat_Alg_h
+
+-#include "mtl/Vec.h"
++#include "Vec.h"
+
+ namespace Minisat {
+
+--- ./mtl/Alloc.h.orig 2010-07-10 09:07:36.000000000 -0700
++++ ./mtl/Alloc.h 2011-04-12 18:32:18.000000000 -0700
+@@ -21,8 +21,8 @@
+ #ifndef Minisat_Alloc_h
+ #define Minisat_Alloc_h
+
+-#include "mtl/XAlloc.h"
+-#include "mtl/Vec.h"
++#include "XAlloc.h"
++#include "Vec.h"
+
+ namespace Minisat {
+
+--- ./mtl/Heap.h.orig 2010-07-10 09:07:36.000000000 -0700
++++ ./mtl/Heap.h 2011-04-12 18:32:05.000000000 -0700
+@@ -21,7 +21,7 @@
+ #ifndef Minisat_Heap_h
+ #define Minisat_Heap_h
+
+-#include "mtl/Vec.h"
++#include "Vec.h"
+
+ namespace Minisat {
+
+--- ./mtl/Map.h.orig 2010-07-10 09:07:36.000000000 -0700
++++ ./mtl/Map.h 2011-04-12 18:31:36.000000000 -0700
+@@ -20,8 +20,8 @@
+ #ifndef Minisat_Map_h
+ #define Minisat_Map_h
+
+-#include "mtl/IntTypes.h"
+-#include "mtl/Vec.h"
++#include "IntTypes.h"
++#include "Vec.h"
+
+ namespace Minisat {
+
+--- ./mtl/Queue.h.orig 2010-07-10 09:07:36.000000000 -0700
++++ ./mtl/Queue.h 2011-04-12 18:31:18.000000000 -0700
+@@ -21,7 +21,7 @@
+ #ifndef Minisat_Queue_h
+ #define Minisat_Queue_h
+
+-#include "mtl/Vec.h"
++#include "Vec.h"
+
+ namespace Minisat {
+
+--- ./simp/SimpSolver.h.orig 2010-07-10 09:07:36.000000000 -0700
++++ ./simp/SimpSolver.h 2011-04-12 18:35:20.000000000 -0700
+@@ -21,8 +21,8 @@
+ #ifndef Minisat_SimpSolver_h
+ #define Minisat_SimpSolver_h
+
+-#include "mtl/Queue.h"
+-#include "core/Solver.h"
++#include <mtl/Queue.h>
++#include <core/Solver.h>
+
+
+ namespace Minisat {
diff --git a/sci-mathematics/minisat/metadata.xml b/sci-mathematics/minisat/metadata.xml
new file mode 100644
index 000000000000..92faa4ea37c6
--- /dev/null
+++ b/sci-mathematics/minisat/metadata.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+<herd>sci</herd>
+<use>
+<flag name="extended-solver">Build extended version of SAT solver with
+ additional features.</flag>
+</use>
+</pkgmetadata>
diff --git a/sci-mathematics/minisat/minisat-2.1.0.ebuild b/sci-mathematics/minisat/minisat-2.1.0.ebuild
new file mode 100644
index 000000000000..46b0736f5374
--- /dev/null
+++ b/sci-mathematics/minisat/minisat-2.1.0.ebuild
@@ -0,0 +1,96 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="2"
+
+inherit eutils toolchain-funcs
+
+MY_P="${PN}2-070721"
+
+DESCRIPTION="Small yet efficient SAT solver with reference paper"
+HOMEPAGE="http://minisat.se/Main.html"
+SRC_URI="http://minisat.se/downloads/${MY_P}.zip
+ doc? ( http://minisat.se/downloads/MiniSat.pdf )"
+
+SLOT="0"
+KEYWORDS="~amd64 ~x86 ~amd64-linux ~x86-linux"
+LICENSE="MIT"
+
+IUSE="debug doc extended-solver"
+
+DEPEND="sys-libs/zlib"
+RDEPEND="${DEPEND}"
+
+S=${WORKDIR}/${PN}
+
+pkg_setup() {
+ if use debug; then
+ myconf="d"
+ myext="debug"
+ else
+ myconf="r"
+ myext="release"
+ fi
+
+ if use extended-solver; then
+ mydir="simp"
+ else
+ mydir="core"
+ fi
+
+ tc-export CXX
+
+ if has_version ">=sci-mathematics/minisat-2.2.0" ; then
+ elog ""
+ elog "The minisat2 2.1 and 2.2 ABIs are not compatible and there"
+ elog "is currently no slotting. Please mask it yourself (eg, in"
+ elog "packages.mask) if you need to use the 2.1x version."
+ elog ""
+ epause 5
+ fi
+}
+
+src_prepare() {
+ sed -i \
+ -e "s|-O3|${CFLAGS} ${LDFLAGS}|" \
+ -e "s|@\$(CXX)|\$(CXX)|" \
+ mtl/template.mk || die
+}
+
+src_compile() {
+ export MROOT="${S}"
+ emake -C ${mydir} "$myconf" || die
+
+ if ! use debug; then
+ LIB="${PN}" emake -C ${mydir} lib || die
+ else
+ LIB="${PN}" emake -C ${mydir} libd || die
+ fi
+}
+
+src_install() {
+ # somewhat brute-force, but so is the build setup...
+
+ insinto /usr/include/${PN}2/mtl
+ doins mtl/*.h || die
+
+ insinto /usr/include/${PN}2/core
+ doins core/Solver*.h || die
+
+ insinto /usr/include/${PN}2/simp
+ doins simp/Simp*.h || die
+
+ if ! use debug; then
+ newbin ${mydir}/${PN}_${myext} ${PN} || die
+ dolib.a ${mydir}/lib${PN}.a || die
+ else
+ newbin ${mydir}/${PN}_${myext} ${PN} || die
+ newlib.a ${mydir}/lib${PN}_${myext}.a lib${PN}.a || die
+ fi
+
+ dodoc README || die
+ if use doc; then
+ dodoc "${DISTDIR}"/MiniSat.pdf || die
+ fi
+}
diff --git a/sci-mathematics/minisat/minisat-2.2.0-r3.ebuild b/sci-mathematics/minisat/minisat-2.2.0-r3.ebuild
new file mode 100644
index 000000000000..029a36faab2c
--- /dev/null
+++ b/sci-mathematics/minisat/minisat-2.2.0-r3.ebuild
@@ -0,0 +1,93 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="2"
+
+inherit eutils toolchain-funcs
+
+DESCRIPTION="Small yet efficient SAT solver with reference paper"
+HOMEPAGE="http://minisat.se/Main.html"
+SRC_URI="http://minisat.se/downloads/${P}.tar.gz
+ doc? ( http://minisat.se/downloads/MiniSat.pdf )"
+
+SLOT="0"
+KEYWORDS="~amd64 ~x86 ~amd64-linux ~x86-linux"
+LICENSE="MIT"
+
+IUSE="debug doc extended-solver"
+
+DEPEND="sys-libs/zlib"
+RDEPEND="${DEPEND}"
+
+S=${WORKDIR}/${PN}
+
+pkg_setup() {
+ if use debug; then
+ myconf="d"
+ myext="debug"
+ else
+ myconf="r"
+ myext="release"
+ fi
+
+ if use extended-solver; then
+ mydir="simp"
+ else
+ mydir="core"
+ fi
+ tc-export CXX
+
+ if has_version "=sci-mathematics/minisat-2.1*" ; then
+ elog ""
+ elog "The minisat2 2.1 and 2.2 ABIs are not compatible and there"
+ elog "is currently no slotting. Please mask it yourself (eg, in"
+ elog "packages.mask) if you still need the older version."
+ elog ""
+ epause 5
+ fi
+}
+
+src_prepare() {
+ sed -e "s/\$(CXX) \$^/\$(CXX) \$(LDFLAGS) \$^/" \
+ -i -e "s|-O3|${CFLAGS}|" mtl/template.mk || die
+}
+
+src_compile() {
+ export MROOT="${S}"
+ emake -C ${mydir} "$myconf" || die
+ LIB="${PN}" emake -C ${mydir} lib"$myconf" || die
+}
+
+src_install() {
+ # somewhat brute-force, but so is the build setup...
+ fix_headers
+
+ insinto /usr/include/${PN}2/mtl
+ doins mtl/*.h || die
+
+ insinto /usr/include/${PN}2/core
+ doins core/Solver*.h || die
+
+ insinto /usr/include/${PN}2/simp
+ doins simp/Simp*.h || die
+
+ insinto /usr/include/${PN}2/utils
+ doins utils/*.h || die
+
+ newbin ${mydir}/${PN}_${myext} ${PN} || die
+ newlib.a ${mydir}/lib${PN}_${myext}.a lib${PN}.a || die
+
+ dodoc README doc/ReleaseNotes-2.2.0.txt || die
+ if use doc; then
+ dodoc "${DISTDIR}"/MiniSat.pdf || die
+ fi
+}
+
+fix_headers() {
+ # need to fix the circular internal includes a bit for standard usage
+ elog "Fixing header files..."
+
+ patch -p0 < "${FILESDIR}"/${P}-header_fix.patch \
+ || die "header patch failed..."
+}
diff --git a/sci-mathematics/mlpy/Manifest b/sci-mathematics/mlpy/Manifest
new file mode 100644
index 000000000000..cf81140d04d9
--- /dev/null
+++ b/sci-mathematics/mlpy/Manifest
@@ -0,0 +1 @@
+DIST mlpy-3.5.0.tar.gz 1961206 SHA256 344fa75fbf9f76af72f6a346d5309613defc4d244bac13c218e509a51d68bf6a SHA512 b6b3cf6e1d47fe58d68da81752ce9324e78a97c9fc341c93db7b2ea0c5d1730fae9535b69671fda13cb012ab0173951768c1601f2b4ad678a6065c018b34eb0f WHIRLPOOL 531cf00f31e8abb72d4d882aa41379d1214f17f04c028922f084756059d471c3e0ddead82d089262e2855d843e8e8e96233bc06937870e6f1f589906889a756f
diff --git a/sci-mathematics/mlpy/metadata.xml b/sci-mathematics/mlpy/metadata.xml
new file mode 100644
index 000000000000..253b13795de2
--- /dev/null
+++ b/sci-mathematics/mlpy/metadata.xml
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <herd>sci</herd>
+ <maintainer>
+ <email>dberkholz@gentoo.org</email>
+ <name>Donnie Berkholz</name>
+ </maintainer>
+ <longdescription lang="en">
+ mlpy provides a wide range of state-of-the-art machine learning
+ methods for supervised and unsupervised problems and it is aimed at
+ finding a reasonable compromise among modularity, maintainability,
+ reproducibility, usability and efficiency.
+</longdescription>
+ <upstream>
+ <remote-id type="sourceforge">mlpy</remote-id>
+ </upstream>
+</pkgmetadata>
diff --git a/sci-mathematics/mlpy/mlpy-3.5.0.ebuild b/sci-mathematics/mlpy/mlpy-3.5.0.ebuild
new file mode 100644
index 000000000000..462a9048ac05
--- /dev/null
+++ b/sci-mathematics/mlpy/mlpy-3.5.0.ebuild
@@ -0,0 +1,35 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+PYTHON_COMPAT=( python2_7 )
+
+inherit distutils-r1
+
+DESCRIPTION="High-performance Python library for predictive modeling"
+HOMEPAGE="https://mlpy.fbk.eu/"
+SRC_URI="mirror://sourceforge/${PN}/${P}.tar.gz"
+
+LICENSE="GPL-3"
+SLOT="0"
+KEYWORDS="~amd64 ~x86 ~amd64-linux ~x86-linux"
+IUSE="doc"
+
+RDEPEND="
+ >=sci-libs/gsl-1.11
+ >=dev-python/numpy-1.3[${PYTHON_USEDEP}]
+ >=sci-libs/scipy-0.7[${PYTHON_USEDEP}]"
+DEPEND="${RDEPEND}
+ doc? ( dev-python/sphinx[${PYTHON_USEDEP}] )"
+
+pyhton_install_all() {
+ distutils-r1_python_install_all
+ if use doc; then
+ pushd docs 2>/dev/null || die
+ emake html
+ dohtml -r build/html/*
+ popd 2>/dev/null || die
+ fi
+}
diff --git a/sci-mathematics/msieve/Manifest b/sci-mathematics/msieve/Manifest
new file mode 100644
index 000000000000..7516dd9c86e2
--- /dev/null
+++ b/sci-mathematics/msieve/Manifest
@@ -0,0 +1 @@
+DIST msieve151.tar.gz 623885 SHA256 26bc1d0d89325986aacfbafb687451f3de5da1bd388e087ec3ac24813e9dc948 SHA512 79c03b5d669de7f05e27fc59fa999f416f513e41cba822376b862c31439fc66cf8749034c1f8f967f745955a5271a484b23e950ffede23d3fa2737ae26dbb0d4 WHIRLPOOL 237f3f1e872b05890e008f8261e0ba5c7621ef7bfa3e78305c17076496ad87d281497e4cf9ee79d2b275a65e86f7c84fa3897697ef823c2e1ffe9725d3b08b9b
diff --git a/sci-mathematics/msieve/files/fix-version.patch b/sci-mathematics/msieve/files/fix-version.patch
new file mode 100644
index 000000000000..748a7ae8c68c
--- /dev/null
+++ b/sci-mathematics/msieve/files/fix-version.patch
@@ -0,0 +1,15 @@
+--- common/driver.c 2011-05-02 09:10:50.000000000 +0800
++++ common/driver.c.new 2012-11-30 16:43:59.067925006 +0800
+@@ -191,10 +191,9 @@
+
+ logprintf(obj, "\n");
+ logprintf(obj, "\n");
+- logprintf(obj, "Msieve v. %d.%02d (SVN %s)\n",
++ logprintf(obj, "Msieve v. %d.%02d\n",
+ MSIEVE_MAJOR_VERSION,
+- MSIEVE_MINOR_VERSION,
+- MSIEVE_SVN_VERSION);
++ MSIEVE_MINOR_VERSION);
+ start_time = time(NULL);
+ if (obj->flags & MSIEVE_FLAG_LOG_TO_STDOUT) {
+ printf("%s", ctime(&start_time));
diff --git a/sci-mathematics/msieve/files/fix-version2.patch b/sci-mathematics/msieve/files/fix-version2.patch
new file mode 100644
index 000000000000..6e956897bdf0
--- /dev/null
+++ b/sci-mathematics/msieve/files/fix-version2.patch
@@ -0,0 +1,14 @@
+--- demo.c 2011-11-25 00:25:28.000000000 +0800
++++ demo.c.new 2012-11-30 16:46:50.417333847 +0800
+@@ -81,9 +81,8 @@
+ /*--------------------------------------------------------------------*/
+ void print_usage(char *progname) {
+
+- printf("\nMsieve v. %d.%02d (SVN %s)\n", MSIEVE_MAJOR_VERSION,
+- MSIEVE_MINOR_VERSION,
+- MSIEVE_SVN_VERSION);
++ printf("\nMsieve v. %d.%02d\n", MSIEVE_MAJOR_VERSION,
++ MSIEVE_MINOR_VERSION);
+
+ printf("\nusage: %s [options] [one_number]\n", progname);
+ printf("\nnumbers starting with '0' are treated as octal,\n"
diff --git a/sci-mathematics/msieve/files/msieve-1.51-reduce-printf.patch b/sci-mathematics/msieve/files/msieve-1.51-reduce-printf.patch
new file mode 100644
index 000000000000..39892716716a
--- /dev/null
+++ b/sci-mathematics/msieve/files/msieve-1.51-reduce-printf.patch
@@ -0,0 +1,44 @@
+diff -Naur msieve-1.50/common/minimize.c msieve-copy/common/minimize.c
+--- msieve-1.50/common/minimize.c 2011-07-04 23:32:33.000000000 +0800
++++ msieve-copy/common/minimize.c 2012-11-26 23:09:22.889240528 +0800
+@@ -210,7 +210,7 @@
+ }
+ }
+
+- printf(":"); // "too many line iterations\n");
++ //printf(":"); // "too many line iterations\n");
+ *min_out = x;
+ *status = 1;
+ return fx;
+diff -Naur msieve-1.50/gnfs/poly/stage2/optimize.c msieve-copy/gnfs/poly/stage2/optimize.c
+--- msieve-1.50/gnfs/poly/stage2/optimize.c 2011-10-15 23:03:39.000000000 +0800
++++ msieve-copy/gnfs/poly/stage2/optimize.c 2012-11-26 23:14:36.243232414 +0800
+@@ -430,9 +430,9 @@
+ #if 0
+ printf("norm %.7e skew %lf\n", *pol_norm, best[SKEWNESS]);
+ for (i = 0; i < 2; i++)
+- gmp_printf("%+Zd\n", c->gmp_lina[i]);
++ //gmp_printf("%+Zd\n", c->gmp_lina[i]);
+ for (i = 0; i <= deg; i++)
+- gmp_printf("%+Zd\n", c->gmp_a[i]);
++ //gmp_printf("%+Zd\n", c->gmp_a[i]);
+ #endif
+ }
+
+diff -Naur msieve-1.50/gnfs/poly/stage2/stage2.c msieve-copy/gnfs/poly/stage2/stage2.c
+--- msieve-1.50/gnfs/poly/stage2/stage2.c 2011-10-09 09:32:49.000000000 +0800
++++ msieve-copy/gnfs/poly/stage2/stage2.c 2012-11-26 23:14:30.894232552 +0800
+@@ -122,10 +122,10 @@
+ }
+
+ #if 0
+- gmp_printf("%+Zd\n", c->gmp_lina[0]);
+- gmp_printf("%+Zd\n", c->gmp_lina[1]);
++ //gmp_printf("%+Zd\n", c->gmp_lina[0]);
++ //gmp_printf("%+Zd\n", c->gmp_lina[1]);
+ for (i = 0; i <= degree; i++)
+- gmp_printf("%+Zd\n", c->gmp_a[i]);
++ //gmp_printf("%+Zd\n", c->gmp_a[i]);
+
+ printf("coeff ratio = %.5lf\n",
+ fabs(mpz_get_d(c->gmp_a[degree-2])) / coeff_bound);
diff --git a/sci-mathematics/msieve/files/reduce-printf.patch b/sci-mathematics/msieve/files/reduce-printf.patch
new file mode 100644
index 000000000000..dad1dc7db8f3
--- /dev/null
+++ b/sci-mathematics/msieve/files/reduce-printf.patch
@@ -0,0 +1,62 @@
+diff -Naur msieve-1.50/common/minimize.c msieve-copy/common/minimize.c
+--- msieve-1.50/common/minimize.c 2011-07-04 23:32:33.000000000 +0800
++++ msieve-copy/common/minimize.c 2012-11-26 23:09:22.889240528 +0800
+@@ -210,7 +210,7 @@
+ }
+ }
+
+- printf("too many line iterations\n");
++ //printf("too many line iterations\n");
+ *min_out = x;
+ *status = 1;
+ return fx;
+diff -Naur msieve-1.50/gnfs/poly/stage2/optimize.c msieve-copy/gnfs/poly/stage2/optimize.c
+--- msieve-1.50/gnfs/poly/stage2/optimize.c 2011-10-15 23:03:39.000000000 +0800
++++ msieve-copy/gnfs/poly/stage2/optimize.c 2012-11-26 23:14:36.243232414 +0800
+@@ -390,7 +390,7 @@
+ score = minimize(best, num_vars, tol, 40,
+ objective, &opt_data);
+
+- printf("i %u score %le\n", i, score);
++ //printf("i %u score %le\n", i, score);
+ for (j = 0; j <= rotate_dim; j++) {
+ double cj = floor(best[ROTATE0 + j] + 0.5);
+ mpz_set_d(c->gmp_help1, cj);
+@@ -422,7 +422,7 @@
+ tol = 1e-5;
+ score = ifs_rectangular(apoly.coeff, apoly.degree,
+ best[SKEWNESS]);
+- printf("transition score %le\n", score);
++ //printf("transition score %le\n", score);
+ }
+ }
+
+@@ -430,9 +430,9 @@
+ #if 0
+ printf("norm %.7e skew %lf\n", *pol_norm, best[SKEWNESS]);
+ for (i = 0; i < 2; i++)
+- gmp_printf("%+Zd\n", c->gmp_lina[i]);
++ //gmp_printf("%+Zd\n", c->gmp_lina[i]);
+ for (i = 0; i <= deg; i++)
+- gmp_printf("%+Zd\n", c->gmp_a[i]);
++ //gmp_printf("%+Zd\n", c->gmp_a[i]);
+ #endif
+ }
+
+diff -Naur msieve-1.50/gnfs/poly/stage2/stage2.c msieve-copy/gnfs/poly/stage2/stage2.c
+--- msieve-1.50/gnfs/poly/stage2/stage2.c 2011-10-09 09:32:49.000000000 +0800
++++ msieve-copy/gnfs/poly/stage2/stage2.c 2012-11-26 23:14:30.894232552 +0800
+@@ -122,10 +122,10 @@
+ }
+
+ #if 0
+- gmp_printf("%+Zd\n", c->gmp_lina[0]);
+- gmp_printf("%+Zd\n", c->gmp_lina[1]);
++ //gmp_printf("%+Zd\n", c->gmp_lina[0]);
++ //gmp_printf("%+Zd\n", c->gmp_lina[1]);
+ for (i = 0; i <= degree; i++)
+- gmp_printf("%+Zd\n", c->gmp_a[i]);
++ //gmp_printf("%+Zd\n", c->gmp_a[i]);
+
+ printf("coeff ratio = %.5lf\n",
+ fabs(mpz_get_d(c->gmp_a[degree-2])) / coeff_bound);
diff --git a/sci-mathematics/msieve/files/reduce-printf2.patch b/sci-mathematics/msieve/files/reduce-printf2.patch
new file mode 100644
index 000000000000..fdaa344a3a07
--- /dev/null
+++ b/sci-mathematics/msieve/files/reduce-printf2.patch
@@ -0,0 +1,52 @@
+--- gnfs/poly/stage2/root_sieve_deg45_x.c 2011-08-23 20:59:59.000000000 +0800
++++ gnfs/poly/stage2/root_sieve_deg45_x.c.new 2012-11-30 17:09:22.553116526 +0800
+ return;
+ }
+
+@@ -585,7 +585,7 @@
+ if (obj->flags & MSIEVE_FLAG_STOP_SIEVING)
+ break;
+ }
+- printf("\n");
++ printf(",");
+ }
+
+ /*-------------------------------------------------------------------------*/
+@@ -604,7 +604,7 @@
+ xline_heap_t xline_heap;
+ uint32 cutoff_score;
+
+- printf("L %u\n", (uint32)lattice_size);
++ /* printf("L %u\n", (uint32)lattice_size); */
+
+ mpz_set_ui(xy->y_base, (unsigned long)0);
+ xy->y_blocks = 0;
+@@ -621,7 +621,7 @@
+ x->x_blocks = line_max - line_min;
+ x->curr_score = 0;
+ root_sieve_line(rs);
+- printf("\n");
++ printf("_");
+ return;
+ }
+
+@@ -664,5 +664,5 @@
+ break;
+ }
+
+- printf("\n");
++ printf("*");
+ }
+--- gnfs/poly/stage2/root_sieve_deg5_xy.c 2011-07-15 09:49:00.000000000 +0800
++++ gnfs/poly/stage2/root_sieve_deg5_xy.c.new 2012-11-30 17:09:51.462454813 +0800
+@@ -290,8 +290,8 @@
+ }
+ xy->y_blocks = y_blocks;
+
+- printf("\n%.0lf %u %u\n", (double)lattice_size,
+- y_blocks, num_lattices);
++ /* printf("\n%.0lf %u %u\n", (double)lattice_size,
++ y_blocks, num_lattices); */
+
+ sieve_x_run_deg5(rs);
+ }
diff --git a/sci-mathematics/msieve/files/reduce-printf3.patch b/sci-mathematics/msieve/files/reduce-printf3.patch
new file mode 100644
index 000000000000..dedadde51d42
--- /dev/null
+++ b/sci-mathematics/msieve/files/reduce-printf3.patch
@@ -0,0 +1,31 @@
+--- gnfs/poly/poly_skew.c 2011-12-23 03:48:49.000000000 +0800
++++ gnfs/poly/poly_skew.c.new 2012-11-30 17:14:29.802747785 +0800
+@@ -221,7 +221,7 @@
+ static void stage1_callback(mpz_t high_coeff, mpz_t p, mpz_t m,
+ double coeff_bound, void *extra) {
+
+- gmp_printf("%Zd %Zd %Zd\n", high_coeff, p, m);
++ /* gmp_printf("%Zd %Zd %Zd\n", high_coeff, p, m); */
+ poly_stage2_run((poly_stage2_t *)extra, high_coeff, p, m,
+ coeff_bound, NULL);
+ }
+@@ -231,7 +231,7 @@
+ double coeff_bound, void *extra) {
+
+ FILE *mfile = (FILE *)extra;
+- gmp_printf("%Zd %Zd %Zd\n", high_coeff, p, m);
++ /* gmp_printf("%Zd %Zd %Zd\n", high_coeff, p, m); */
+ gmp_fprintf(mfile, "%Zd %Zd %Zd\n",
+ high_coeff, p, m);
+ fflush(mfile);
+--- gnfs/poly/stage2/root_sieve_line.c 2011-11-25 00:25:28.000000000 +0800
++++ gnfs/poly/stage2/root_sieve_line.c.new 2012-11-30 17:18:19.887475567 +0800
+@@ -402,7 +402,7 @@
+ uint32 num_primes = rs->num_primes;
+ uint16 *block = rs->sieve_block;
+
+- printf("%u ", num_blocks); fflush(stdout);
++ /* printf("%u ", num_blocks); fflush(stdout); */
+
+ if (mpz_cmp_ui(x->mp_lattice_size, 1) == 0)
+ prepare_sieve_line(rs);
diff --git a/sci-mathematics/msieve/metadata.xml b/sci-mathematics/msieve/metadata.xml
new file mode 100644
index 000000000000..d77356350e30
--- /dev/null
+++ b/sci-mathematics/msieve/metadata.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <maintainer>
+ <email>patrick@gentoo.org</email>
+ <name>Patrick Lauer</name>
+ </maintainer>
+ <use>
+ <flag name="ecm">Enable support for the GMP-ECM library</flag>
+ </use>
+</pkgmetadata>
diff --git a/sci-mathematics/msieve/msieve-1.51.ebuild b/sci-mathematics/msieve/msieve-1.51.ebuild
new file mode 100644
index 000000000000..09e724f0b866
--- /dev/null
+++ b/sci-mathematics/msieve/msieve-1.51.ebuild
@@ -0,0 +1,56 @@
+# Copyright 1999-2013 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+inherit eutils toolchain-funcs
+
+DESCRIPTION="A C library implementing a suite of algorithms to factor large integers"
+HOMEPAGE="http://sourceforge.net/projects/msieve/"
+SRC_URI="mirror://sourceforge/${PN}/${PN}/Msieve%20v${PV}/${PN}${PV/./}.tar.gz"
+
+LICENSE="public-domain"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE="zlib +ecm mpi"
+
+# some linking troubles with gwnum
+DEPEND="
+ ecm? ( sci-mathematics/gmp-ecm[-gwnum] )
+ mpi? ( virtual/mpi )
+ zlib? ( sys-libs/zlib )"
+RDEPEND="${DEPEND}"
+
+src_prepare() {
+ # TODO: Integrate ggnfs properly
+ epatch \
+ "${FILESDIR}"/${P}-reduce-printf.patch \
+ "${FILESDIR}"/fix-version.patch \
+ "${FILESDIR}"/fix-version2.patch
+ sed -i -e 's/-march=k8//' Makefile || die
+ sed -i -e 's/CC =/#CC =/' Makefile || die
+ sed -i -e 's/CFLAGS =/CFLAGS +=/' Makefile || die
+ sed -i -e 's/LIBS += -lecm/LIBS += -lecm -lgomp/' Makefile || die
+}
+
+src_compile() {
+ use ecm && export "ECM=1"
+ use mpi && export "MPI=1"
+ use zlib && export "ZLIB=1"
+ emake \
+ CC=$(tc-getCC) \
+ AR=$(tc-getAR) \
+ OPT_FLAGS="${CFLAGS}" \
+ all
+}
+
+src_install() {
+ mkdir -p "${D}/usr/include/msieve"
+ mkdir -p "${D}/usr/lib/"
+ mkdir -p "${D}/usr/share/doc/${P}/"
+ cp include/* "${D}/usr/include/msieve" || die "Failed to install"
+ cp libmsieve.a "${D}/usr/lib/" || die "Failed to install"
+ dobin msieve || die "Failed to install"
+ cp Readme* "${D}/usr/share/doc/${P}/" || die "Failed to install"
+}
diff --git a/sci-mathematics/msieve/msieve-9999.ebuild b/sci-mathematics/msieve/msieve-9999.ebuild
new file mode 100644
index 000000000000..8f9b32b35195
--- /dev/null
+++ b/sci-mathematics/msieve/msieve-9999.ebuild
@@ -0,0 +1,55 @@
+# Copyright 1999-2013 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+inherit eutils subversion toolchain-funcs
+
+DESCRIPTION="A C library implementing a suite of algorithms to factor large integers"
+HOMEPAGE="http://sourceforge.net/projects/msieve/"
+#SRC_URI="mirror://sourceforge/${PN}/${PN}/Msieve%20v${PV}/${PN}${PV/./}src.tar.gz"
+ESVN_REPO_URI="https://msieve.svn.sourceforge.net/svnroot/msieve"
+
+LICENSE="public-domain"
+SLOT="0"
+KEYWORDS=""
+IUSE="zlib +ecm mpi"
+
+# some linking troubles with gwnum
+DEPEND="
+ ecm? ( sci-mathematics/gmp-ecm[-gwnum] )
+ mpi? ( virtual/mpi )
+ zlib? ( sys-libs/zlib )"
+RDEPEND="${DEPEND}"
+
+src_prepare() {
+ cd trunk
+ # TODO: Integrate ggnfs properly
+ sed -i -e 's/-march=k8//' Makefile || die
+ sed -i -e 's/CC =/#CC =/' Makefile || die
+ sed -i -e 's/CFLAGS =/CFLAGS +=/' Makefile || die
+}
+
+src_compile() {
+ cd trunk
+ use ecm && export "ECM=1"
+ use mpi && export "MPI=1"
+ use zlib && export "ZLIB=1"
+ emake \
+ CC=$(tc-getCC) \
+ AR=$(tc-getAR) \
+ OPT_FLAGS="${CFLAGS}" \
+ all
+}
+
+src_install() {
+ cd trunk
+ mkdir -p "${D}/usr/include/msieve"
+ mkdir -p "${D}/usr/lib/"
+ mkdir -p "${D}/usr/share/doc/${P}/"
+ cp include/* "${D}/usr/include/msieve" || die "Failed to install"
+ cp libmsieve.a "${D}/usr/lib/" || die "Failed to install"
+ dobin msieve || die "Failed to install"
+ cp Readme* "${D}/usr/share/doc/${P}/" || die "Failed to install"
+}
diff --git a/sci-mathematics/nauty/Manifest b/sci-mathematics/nauty/Manifest
new file mode 100644
index 000000000000..1f5fc45f695f
--- /dev/null
+++ b/sci-mathematics/nauty/Manifest
@@ -0,0 +1 @@
+DIST nauty25r9.tar.gz 1007323 SHA256 602d0e2e5ab1bdc84ab69f75ebc065833501bd2875cb07b1bb4274e3dd632825 SHA512 79f9054f1d39406063f4cbab61002b27f260b93fd37d6346efdfcd113c59ebab54320e6e7b6cdf26c7eddc376e4ad558e2cd4e6071d418dce2a6918f3c8f7ca2 WHIRLPOOL 0dcce5a74ac5874c5a510cd0d302b5d73897ee3cfaa208945de464e057a4b0af2ba4e717e8d331c51d5065d45363a339e0cd746a0a8fda179ec616b1443e2f63
diff --git a/sci-mathematics/nauty/metadata.xml b/sci-mathematics/nauty/metadata.xml
new file mode 100644
index 000000000000..186d7a91db3c
--- /dev/null
+++ b/sci-mathematics/nauty/metadata.xml
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <maintainer>
+ <email>tomka@gentoo.org</email>
+ <name>Thomas Kahle</name>
+ </maintainer>
+ <herd>sci-mathematics</herd>
+ <longdescription lang="en">
+nauty is a program for computing automorphism groups of graphs and digraphs. It can also produce a
+canonical labelling.
+
+nauty is written in a portable subset of C, and runs on a considerable number of different systems.
+</longdescription>
+</pkgmetadata>
diff --git a/sci-mathematics/nauty/nauty-2.5.9.ebuild b/sci-mathematics/nauty/nauty-2.5.9.ebuild
new file mode 100644
index 000000000000..a3341dac3a66
--- /dev/null
+++ b/sci-mathematics/nauty/nauty-2.5.9.ebuild
@@ -0,0 +1,42 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+inherit versionator
+
+MY_PV=$(replace_version_separator 2 'r')
+MY_PV=$(delete_version_separator 1 ${MY_PV})
+
+DESCRIPTION="Computing automorphism groups of graphs and digraphs"
+HOMEPAGE="http://pallini.di.uniroma1.it/"
+SRC_URI="http://cs.anu.edu.au/~bdm/${PN}/${PN}${MY_PV}.tar.gz"
+
+LICENSE="nauty"
+SLOT="0"
+KEYWORDS="amd64 x86"
+IUSE=""
+
+S="${WORKDIR}/${PN}${MY_PV}"
+
+src_prepare () {
+ sed \
+ -e "s/^LDFLAGS=.*/LDFLAGS=${LDFLAGS}/" \
+ -e 's:${CC} -o:${CC} ${LDFLAGS} -o:g' \
+ -e 's:${LDFLAGS}$::g' \
+ -i makefile.in || die
+}
+
+src_test () {
+ emake checks
+ ./runalltests
+}
+
+src_install () {
+ dobin addedgeg amtog biplabg catg complg copyg countg \
+ deledgeg directg dreadnaut dretog genbg geng genrang \
+ gentourng labelg listg multig newedgeg NRswitchg pickg \
+ planarg shortg showg
+ dodoc README formats.txt nug*.pdf
+}
diff --git a/sci-mathematics/nestedsums/Manifest b/sci-mathematics/nestedsums/Manifest
new file mode 100644
index 000000000000..aa0d361702b9
--- /dev/null
+++ b/sci-mathematics/nestedsums/Manifest
@@ -0,0 +1 @@
+DIST nestedsums-1.4.12.tar.gz 415265 RMD160 381256ed0aa4c55d1f3ea87f493b83e6a5befae1 SHA1 07c19f2bf6a2cd43555deb9f5d16ec7ea7a97f65 SHA256 4d290529373e83d205d9fe2d1ff1d9f2f95b3dd1dba1585d298ba52593ce831c
diff --git a/sci-mathematics/nestedsums/metadata.xml b/sci-mathematics/nestedsums/metadata.xml
new file mode 100644
index 000000000000..9f85bfb1b277
--- /dev/null
+++ b/sci-mathematics/nestedsums/metadata.xml
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+<herd>sci-mathematics</herd>
+<maintainer>
+ <email>grozin@gentoo.org</email>
+ <name>Andrey Grozin</name>
+</maintainer>
+<longdescription lang="en">
+A GiNaC-based library for symbolic expansion of certain transcendental functions.
+</longdescription>
+</pkgmetadata>
diff --git a/sci-mathematics/nestedsums/nestedsums-1.4.12-r1.ebuild b/sci-mathematics/nestedsums/nestedsums-1.4.12-r1.ebuild
new file mode 100644
index 000000000000..b106f0a002dd
--- /dev/null
+++ b/sci-mathematics/nestedsums/nestedsums-1.4.12-r1.ebuild
@@ -0,0 +1,32 @@
+# Copyright 1999-2011 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+EAPI="3"
+DESCRIPTION="A GiNaC-based library for symbolic expansion of certain transcendental functions"
+HOMEPAGE="http://wwwthep.physik.uni-mainz.de/~stefanw/nestedsums/"
+IUSE="doc"
+SRC_URI="http://wwwthep.physik.uni-mainz.de/~stefanw/download/${P}.tar.gz"
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~x86"
+RDEPEND=">=sci-mathematics/ginac-1.5"
+DEPEND="${RDEPEND}
+ doc? ( app-doc/doxygen )"
+
+src_compile() {
+ emake || die "emake failed"
+
+ if use doc; then
+ doxygen Doxyfile || die "generating documentation failed"
+ fi
+}
+
+src_install() {
+ emake DESTDIR="${D}" install
+ rm -f "${D}"usr/lib/*.la
+ dodoc AUTHORS ChangeLog
+
+ if use doc; then
+ dohtml reference/html/* || die "installing documentation failed"
+ fi
+}
diff --git a/sci-mathematics/normaliz/Manifest b/sci-mathematics/normaliz/Manifest
new file mode 100644
index 000000000000..34b83e0618e5
--- /dev/null
+++ b/sci-mathematics/normaliz/Manifest
@@ -0,0 +1 @@
+DIST Normaliz2.12.2.zip 6432949 SHA256 230772425b3c9964b9e144c0919c75fac0ec95260a1943c10a8a94eea9d7273e SHA512 fd42071cb87b8efbaf9af0885c173a0583e0b38dedb8821a83225eeebb44060a7b5748c44adfc4faeac20c3a1706071bcb9883cb4447e4a1ff3aeb770bd22038 WHIRLPOOL cb2974e02eac6e6d51c234214a719a24ad2e12d1400f0a6f8aee3e7a4ba3aa2ba053beec65c9032f42726e4dd4f1866820bb5b7b96f7c3d34cd132fcdbdb91af
diff --git a/sci-mathematics/normaliz/files/normaliz-2.12.1-respect-flags.patch b/sci-mathematics/normaliz/files/normaliz-2.12.1-respect-flags.patch
new file mode 100644
index 000000000000..d7d83ee79d91
--- /dev/null
+++ b/sci-mathematics/normaliz/files/normaliz-2.12.1-respect-flags.patch
@@ -0,0 +1,47 @@
+diff -U 3 -dHrN Normaliz2.12/source/Makefile Normaliz2.12.patched/source/Makefile
+--- Normaliz2.12/source/Makefile 2014-10-23 15:01:56.000000000 +0200
++++ Normaliz2.12.patched/source/Makefile 2014-10-25 14:56:39.426295174 +0200
+@@ -17,16 +17,16 @@
+ @$(MAKE) normaliz
+
+ normaliz.o: $(SOURCES) $(HEADERS) $(LIBHEADERS)
+- $(CXX) $(CXXFLAGS) $(NORMFLAGS) -c Normaliz.cpp -o normaliz.o
++ $(CXX) $(CXXFLAGS) $(LDFLAGS) -c Normaliz.cpp -o normaliz.o
+
+ normaliz: $(SOURCES) $(HEADERS) normaliz.o libnormaliz/libnormaliz.a
+- $(CXX) $(CXXFLAGS) $(NORMFLAGS) normaliz.o libnormaliz/libnormaliz.a $(GMPFLAGS) -o normaliz
++ $(CXX) $(CXXFLAGS) $(LDFLAGS) normaliz.o libnormaliz/libnormaliz.a $(GMPFLAGS) -o normaliz
+
+ normaliz1: $(SOURCES) $(HEADERS) $(LIBHEADERS) $(LIBSOURCES)
+- $(CXX) $(CXXFLAGS) $(NORMFLAGS) Normaliz-impl.cpp $(GMPFLAGS) -o normaliz1
++ $(CXX) $(CXXFLAGS) $(LDFLAGS) Normaliz-impl.cpp $(GMPFLAGS) -o normaliz1
+
+ normaliz-pg: $(SOURCES) $(HEADERS) $(LIBHEADERS) $(LIBSOURCES)
+- $(CXX) $(CXXFLAGS) $(NORMFLAGS) -pg Normaliz-impl.cpp $(GMPFLAGS) -o normaliz-pg
++ $(CXX) $(CXXFLAGS) $(LDFLAGS) -pg Normaliz-impl.cpp $(GMPFLAGS) -o normaliz-pg
+
+
+ #always go down the directory and let the make there check what has to be done
+diff -U 3 -dHrN Normaliz2.12/source/Makefile.configuration Normaliz2.12.patched/source/Makefile.configuration
+--- Normaliz2.12/source/Makefile.configuration 2014-10-23 15:01:56.000000000 +0200
++++ Normaliz2.12.patched/source/Makefile.configuration 2014-10-25 15:18:39.876313342 +0200
+@@ -1,11 +1,9 @@
+ ##
+ ## Makefile configuration for normaliz
+ ##
+-CXX = g++
+ #CXX = linux32 g++ -m32 -march=i686 #compile it for linux32
+ CXXFLAGS += -std=c++0x
+ CXXFLAGS += -Wall -pedantic
+-CXXFLAGS += -O3 -funroll-loops
+ #CXXFLAGS += -I /usr/local/boost_1_45_0
+ CXXFLAGS += -g ## debugging
+ #CXXFLAGS += -pg ## profiling
+@@ -19,7 +17,6 @@
+ endif
+
+ ## for distributing the executables link static (does not work for mac)
+-CXXFLAGS += -static
+ ## for almost static compilation on Mac use
+ #CXXFLAGS += -static-libgcc
+ ## make it compatible with older Mac versions
diff --git a/sci-mathematics/normaliz/files/normaliz-2.12.2-gcc49.patch b/sci-mathematics/normaliz/files/normaliz-2.12.2-gcc49.patch
new file mode 100644
index 000000000000..35a28c8cf2a3
--- /dev/null
+++ b/sci-mathematics/normaliz/files/normaliz-2.12.2-gcc49.patch
@@ -0,0 +1,11 @@
+diff -U 3 -dHrN Normaliz2.12/source/libnormaliz/general.h Normaliz2.12.patched/source/libnormaliz/general.h
+--- Normaliz2.12/source/libnormaliz/general.h 2014-10-23 15:01:56.000000000 +0200
++++ Normaliz2.12.patched/source/libnormaliz/general.h 2015-03-01 13:20:01.057017555 +0100
+@@ -27,6 +27,7 @@
+
+ #include <iostream>
+ #include <assert.h>
++#include <cstddef>
+
+ #ifdef _WIN32 //for 32 and 64 bit windows
+ #define NMZ_MPIR //always use MPIR
diff --git a/sci-mathematics/normaliz/metadata.xml b/sci-mathematics/normaliz/metadata.xml
new file mode 100644
index 000000000000..6b793e001efd
--- /dev/null
+++ b/sci-mathematics/normaliz/metadata.xml
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <maintainer>
+ <email>tomka@gentoo.org</email>
+ <name>Thomas Kahle</name>
+ </maintainer>
+ <herd>sci-mathematics</herd>
+ <use>
+ <flag name="extras"> Install <pkg>sci-mathematics/Macaulay2</pkg> and <pkg>sci-mathematics/singular</pkg>
+ packages as shipped by upstream</flag>
+ </use>
+ <longdescription lang="en">
+Normaliz is a (command line) tool for computations in affine monoids, vector configurations, lattice polytopes, and
+rational cones.
+</longdescription>
+</pkgmetadata>
diff --git a/sci-mathematics/normaliz/normaliz-2.12.2.ebuild b/sci-mathematics/normaliz/normaliz-2.12.2.ebuild
new file mode 100644
index 000000000000..5a9cf0a3bf02
--- /dev/null
+++ b/sci-mathematics/normaliz/normaliz-2.12.2.ebuild
@@ -0,0 +1,64 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+inherit eutils toolchain-funcs versionator
+
+MYPV=$(get_version_component_range 1-2)
+MYP="Normaliz${MYPV}"
+
+DESCRIPTION="Tool for computations in affine monoids and more"
+HOMEPAGE="http://www.mathematik.uni-osnabrueck.de/normaliz/"
+SRC_URI="http://www.mathematik.uni-osnabrueck.de/${PN}/Normaliz${PV}/Normaliz${PV}.zip"
+
+LICENSE="GPL-3"
+SLOT="0"
+KEYWORDS="amd64 x86"
+IUSE="doc extras openmp"
+
+RDEPEND="dev-libs/gmp[cxx]"
+DEPEND="${RDEPEND}
+ app-arch/unzip
+ dev-libs/boost"
+# Only a boost header is needed -> not RDEPEND
+
+S=${WORKDIR}/${MYP}
+
+src_prepare () {
+ epatch "${FILESDIR}/${PN}-2.12.1-respect-flags.patch"
+ epatch "${FILESDIR}/${PN}-2.12.2-gcc49.patch"
+
+ # Respect users AR tool (Bug 474532)
+ sed -e "s:ar -cr:$(tc-getAR) -cr:" -i source/libnormaliz/Makefile || die
+
+ if use openmp && tc-has-openmp; then
+ export OPENMP=yes
+ else
+ export OPENMP=no
+ fi
+}
+
+src_compile(){
+ emake CXX="$(tc-getCXX)" OPENMP="${OPENMP}" -C source
+}
+
+src_install() {
+ dobin source/normaliz
+ if use doc ; then
+ dodoc doc/"Normaliz.pdf"
+ dodoc doc/"NmzIntegrate.pdf"
+ fi
+ if use extras; then
+ elog "You have selected to install extras which consist of Macaulay2"
+ elog "and Singular packages. These have been installed into "
+ elog "/usr/share/${PN}, and cannot be used without additional setup. Please refer"
+ elog "to the homepages of the respective projects for additional information."
+ elog "Note however, Gentoo's versions of Singular and Macaulay2 bring their own"
+ elog "copies of these interface packages. Usually you don't need normaliz's versions."
+ insinto "/usr/share/${PN}"
+ doins Singular/normaliz.lib
+ doins Macaulay2/Normaliz.m2
+ fi
+}
diff --git a/sci-mathematics/num-utils/Manifest b/sci-mathematics/num-utils/Manifest
new file mode 100644
index 000000000000..8ce9c6aa5632
--- /dev/null
+++ b/sci-mathematics/num-utils/Manifest
@@ -0,0 +1,3 @@
+DIST num-utils-0.3.tar.gz 28208 RMD160 b6ac19c51fa9241dcaa32a9e4ae5ef03b7e469d4 SHA1 8c49d3e54a50220e278244ad1f744877e87209ae SHA256 2369fbd7ef094129d6bc60c54a22e98d2329e9ce7b1b958614991398ec1bff72
+DIST num-utils-0.5.tar.gz 31845 RMD160 54ed62109fdbeaf4fe2006a072e1e4e778ab146c SHA1 3fc6130874129fe1e98db6db8b3dc43f0e1a89ac SHA256 03592760fc7844492163b14ddc9bb4e4d6526e17b468b5317b4a702ea7f6c64e
+DIST num-utils_0.5-11.diff.gz 11702 RMD160 861df640cbf10713d0ac1df5186c29d1b27365e5 SHA1 25e662aab5eaf108598239716ab922b320056ff2 SHA256 6b4294671eff9378579f20904b27ef42ba4bfb2ac0af74007a81b08e6cc917ad
diff --git a/sci-mathematics/num-utils/metadata.xml b/sci-mathematics/num-utils/metadata.xml
new file mode 100644
index 000000000000..2b0bd5314823
--- /dev/null
+++ b/sci-mathematics/num-utils/metadata.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <herd>sci-mathematics</herd>
+</pkgmetadata>
diff --git a/sci-mathematics/num-utils/num-utils-0.3.ebuild b/sci-mathematics/num-utils/num-utils-0.3.ebuild
new file mode 100644
index 000000000000..29bc18cc2482
--- /dev/null
+++ b/sci-mathematics/num-utils/num-utils-0.3.ebuild
@@ -0,0 +1,26 @@
+# Copyright 1999-2010 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+DESCRIPTION="A set of programs for dealing with numbers from the command line"
+SRC_URI="http://suso.suso.org/programs/num-utils/downloads/${P}.tar.gz"
+HOMEPAGE="http://suso.suso.org/programs/num-utils/"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="x86"
+IUSE=""
+
+DEPEND=""
+RDEPEND="
+ dev-lang/perl
+ !<sci-chemistry/gromacs-4"
+
+src_compile() {
+ emake || die
+}
+
+src_install () {
+ make ROOT="${D}" install || die
+ dodoc CHANGELOG GOALS MANIFEST README VERSION WARNING
+}
diff --git a/sci-mathematics/num-utils/num-utils-0.5-r1.ebuild b/sci-mathematics/num-utils/num-utils-0.5-r1.ebuild
new file mode 100644
index 000000000000..5b20afa310d2
--- /dev/null
+++ b/sci-mathematics/num-utils/num-utils-0.5-r1.ebuild
@@ -0,0 +1,48 @@
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=4
+
+inherit eutils
+
+DEB_PR=11
+
+DESCRIPTION="A set of programs for dealing with numbers from the command line"
+HOMEPAGE="http://suso.suso.org/programs/num-utils/"
+SRC_URI="
+ http://suso.suso.org/programs/num-utils/downloads/${P}.tar.gz
+ mirror://debian/pool/main/${PN:0:1}/${PN}/${PN}_${PV}-${DEB_PR}.diff.gz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~amd64 ~ppc ~x86"
+IUSE=""
+
+src_prepare() {
+ epatch "${WORKDIR}"/${PN}_${PV}-${DEB_PR}.diff
+ sed \
+ -e 's:../orig/num-utils-0.5/::g' \
+ -i "${S}"/debian/patches/*.diff || die
+ epatch "${S}"/debian/patches/*.diff
+
+ local x
+ for x in average bound interval normalize random range round; do
+ mv $x num$x || die "renaming $x failed"
+ done
+
+ sed \
+ -e 's/^RPMDIR/#RPMDIR/' \
+ -e 's/COPYING//' \
+ -e 's/LICENSE//' \
+ -e '/^DOCS/s/MANIFEST//' \
+ -i Makefile || die "sed Makefile failed"
+}
+
+src_install () {
+ emake ROOT="${ED}" install
+}
+
+pkg_postinst() {
+ elog "All ${PN} programs have been renamed with prefix 'num' to avoid collisions"
+}
diff --git a/sci-mathematics/nusmv/Manifest b/sci-mathematics/nusmv/Manifest
new file mode 100644
index 000000000000..eeeef6335c5a
--- /dev/null
+++ b/sci-mathematics/nusmv/Manifest
@@ -0,0 +1,6 @@
+DIST MiniSat_v1.14_src.zip 29428 SHA256 8e5e0ee84a770dcb3abd6fc65ed4aef938f9ffabca5ddc8a739029f7fb58a8f5 SHA512 451839f3b0508ccfc78a65bbdf3d6820d335aea43b32aa2e39168ff515f3eb6f74ab1297186f1a89dc69e4d8663a1479043fd10135faf2dbaf33269ff7b831e1 WHIRLPOOL dea39fd30ad7c4195c5fe07356890c6525744d59644aff89ce865269daa4ffbebbbba94fe929d0bf6df441e169e2fd974b5373a443d5c3fb410ec8d7dffd9cb2
+DIST NuSMV-2.3.1.tar.gz 2590944 SHA256 b8ba0f29afafdfdef8c30f722eead3ef6cbb17e4bfe5563240a01d8a99dbbf68 SHA512 24d258197ecfd314378f132c28722c6f91ee0ee10f5d67e51e924a682c03646b8700e28899eb8ab3ee67b231c26c2094c075b000d391adddfb82bb93a8dfc12b WHIRLPOOL c015aeeabff6fe0770a1d216ab783db0ea4d1915e09e2fa9ac2f470ffbcc6a89881f0e917c544598f7f6484a50b1216ca0e631084887c56bfc2efe29b8f82dbd
+DIST NuSMV-2.5.0.tar.gz 3792968 SHA256 59310f5f23f72cb1ad16419e40f245db7c5aa41c0f59ba5c75732bb6c4b56ff1
+DIST NuSMV-2.5.2.tar.gz 3631420 SHA256 bc41c53c266d41d7bcb92851fbdb07d894c246d1189bfe420301c7b4fca46de0
+DIST NuSMV-2.5.3.tar.gz 3951637 SHA256 d5d6b2873dfa6f82ff9bef1a7eefa36dc5070557aa2b0e0d53cc8c54b2fe437d SHA512 8233a621d3cfad17d0b8f77a33460089b5c0a9fa694e6d91cbd6eb334213cd8d9e37fce8755e9ebc066279f25e86dfa7ded0197f679e42b8f2e7c048cc93356a WHIRLPOOL ea8075f405324179a822b9abd78f2c5d2a0c62ac31d2682f2145db7b033e2cf30f3a466689d75814cc3bfc551471425097d17515b19742f298899a432daec249
+DIST NuSMV-2.5.4.tar.gz 3968258 SHA256 3c250624cba801b1f62f50733f9507b0f3b3ca557ce1cd65956178eb273f1bdf SHA512 fc3cc641bbdbfc9464947c9991c8d363adeed9ed34af215c092a14b32d5ce536cb2dbc4eee1645d5aa85caa85e6e95b695620fa247f3a22652cdc4cd252c4c79 WHIRLPOOL 5822d1e7d853cf78cbdee07b0dafa1216fd226ecad803533310351573c7e9a864e6bba699a16c1b357da458311bf65b7362b6207b63e0c8008123e63950121e1
diff --git a/sci-mathematics/nusmv/files/MiniSat_v1.14-optimizedlib.patch b/sci-mathematics/nusmv/files/MiniSat_v1.14-optimizedlib.patch
new file mode 100644
index 000000000000..a291339491bf
--- /dev/null
+++ b/sci-mathematics/nusmv/files/MiniSat_v1.14-optimizedlib.patch
@@ -0,0 +1,44 @@
+diff -Nuar MiniSat_v1.14/Makefile MiniSat_v1.14.new/Makefile
+--- MiniSat_v1.14/Makefile 2006-04-02 01:33:46.000000000 -0800
++++ MiniSat_v1.14.new/Makefile 2006-04-02 01:31:39.000000000 -0800
+@@ -26,10 +26,11 @@
+ RANLIB = ranlib
+ AR = ar
+
+-.PHONY : ls s p d r build clean depend
++.PHONY : lr ls s p d r build clean depend
+
+ s: WAY=standard
+ ls: WAY=standard
++lr: WAY=release
+ p: WAY=profile
+ d: WAY=debug
+ r: WAY=release
+@@ -38,8 +39,7 @@
+ s: CFLAGS+=$(COPTIMIZE) -ggdb -D DEBUG
+ p: CFLAGS+=$(COPTIMIZE) -pg -ggdb -D DEBUG
+ d: CFLAGS+=-O0 -ggdb -D DEBUG
+-r: CFLAGS+=$(COPTIMIZE) -D NDEBUG
+-rs: CFLAGS+=$(COPTIMIZE) -D NDEBUG
++r rs ls lr: CFLAGS+=$(COPTIMIZE) -D NDEBUG
+
+ s: build $(EXEC)
+ p: build $(EXEC)_profile
+@@ -48,7 +48,7 @@
+ rs: build $(EXEC)_static
+
+ s: CFLAGS+=$(COPTIMIZE) -ggdb -D DEBUG
+-ls: lbuild $(LIB)_s
++ls lr: lbuild $(LIB)_s
+
+ build:
+ @echo Building $(EXEC) "("$(WAY)")"
+@@ -63,7 +63,7 @@
+ ## Build rule
+ %.o %.op %.od %.or: %.C
+ @echo Compiling: $<
+- @$(CXX) $(CFLAGS) -c -o $@ $<
++ $(CXX) $(CFLAGS) -c -o $@ $<
+
+ ## Linking rules (standard/profile/debug/release)
+ $(EXEC): $(COBJS)
diff --git a/sci-mathematics/nusmv/files/MiniSat_v1.14_gcc41.patch b/sci-mathematics/nusmv/files/MiniSat_v1.14_gcc41.patch
new file mode 100644
index 000000000000..dd5856ae57e5
--- /dev/null
+++ b/sci-mathematics/nusmv/files/MiniSat_v1.14_gcc41.patch
@@ -0,0 +1,92 @@
+Index: MiniSat/MiniSat_v1.14/SolverTypes.h
+===================================================================
+--- MiniSat/MiniSat_v1.14/SolverTypes.h (revision 1040)
++++ MiniSat/MiniSat_v1.14/SolverTypes.h (working copy)
+@@ -42,19 +42,32 @@
+ public:
+ Lit() : x(2*var_Undef) {} // (lit_Undef)
+ explicit Lit(Var var, bool sign = false) : x((var+var) + (int)sign) { }
+- friend Lit operator ~ (Lit p) { Lit q; q.x = p.x ^ 1; return q; }
++ friend Lit operator ~ (Lit p);
+
+- friend bool sign (Lit p) { return p.x & 1; }
+- friend int var (Lit p) { return p.x >> 1; }
+- friend int index (Lit p) { return p.x; } // A "toInt" method that guarantees small, positive integers suitable for array indexing.
+- friend Lit toLit (int i) { Lit p; p.x = i; return p; } // Inverse of 'index()'.
+- friend Lit unsign(Lit p) { Lit q; q.x = p.x & ~1; return q; }
+- friend Lit id (Lit p, bool sgn) { Lit q; q.x = p.x ^ (int)sgn; return q; }
++ friend bool sign (Lit p);
++ friend int var (Lit p);
++ friend int index (Lit p); // A "toInt" method that guarantees small, positive integers suitable for array indexing.
++ friend Lit toLit (int i); // Inverse of 'index()'.
++ friend Lit unsign(Lit p);
++ friend Lit id (Lit p, bool sgn);
+
+- friend bool operator == (Lit p, Lit q) { return index(p) == index(q); }
+- friend bool operator < (Lit p, Lit q) { return index(p) < index(q); } // '<' guarantees that p, ~p are adjacent in the ordering.
++ friend bool operator == (Lit p, Lit q);
++ friend bool operator < (Lit p, Lit q); // '<' guarantees that p, ~p are adjacent in the ordering.
+ };
+
++inline Lit operator ~ (Lit p) { Lit q; q.x = p.x ^ 1; return q; }
++
++inline bool sign (Lit p) { return p.x & 1; }
++inline int var (Lit p) { return p.x >> 1; }
++inline int index (Lit p) { return p.x; } // A "toInt" method that guarantees small, positive integers suitable for array indexing.
++inline Lit toLit (int i) { Lit p; p.x = i; return p; } // Inverse of 'index()'.
++inline Lit unsign(Lit p) { Lit q; q.x = p.x & ~1; return q; }
++inline Lit id (Lit p, bool sgn) { Lit q; q.x = p.x ^ (int)sgn; return q; }
++
++inline bool operator == (Lit p, Lit q) { return index(p) == index(q); }
++inline bool operator < (Lit p, Lit q) { return index(p) < index(q); } // '<' guarantees that p, ~p are adjacent in the ordering.
++
++
+ const Lit lit_Undef(var_Undef, false); // }- Useful special constants.
+ const Lit lit_Error(var_Undef, true ); // }
+
+@@ -79,11 +92,7 @@
+ if (learnt) activity() = 0; }
+
+ // -- use this function instead:
+- friend Clause* Clause_new(bool learnt, const vec<Lit>& ps) {
+- assert(sizeof(Lit) == sizeof(uint));
+- assert(sizeof(float) == sizeof(uint));
+- void* mem = xmalloc<char>(sizeof(Clause) + sizeof(uint)*(ps.size() + (int)learnt));
+- return new (mem) Clause(learnt, ps); }
++ friend Clause* Clause_new(bool learnt, const vec<Lit>& ps);
+
+ int size () const { return size_learnt >> 1; }
+ bool learnt () const { return size_learnt & 1; }
+@@ -92,6 +101,12 @@
+ float& activity () const { return *((float*)&data[size()]); }
+ };
+
++inline Clause* Clause_new(bool learnt, const vec<Lit>& ps) {
++ assert(sizeof(Lit) == sizeof(uint));
++ assert(sizeof(float) == sizeof(uint));
++ void* mem = xmalloc<char>(sizeof(Clause) + sizeof(uint)*(ps.size() + (int)learnt));
++ return new (mem) Clause(learnt, ps);
++}
+
+ //=================================================================================================
+ // GClause -- Generalize clause:
+@@ -102,8 +117,8 @@
+ void* data;
+ GClause(void* d) : data(d) {}
+ public:
+- friend GClause GClause_new(Lit p) { return GClause((void*)((index(p) << 1) + 1)); }
+- friend GClause GClause_new(Clause* c) { assert(((uintp)c & 1) == 0); return GClause((void*)c); }
++ friend GClause GClause_new(Lit p);
++ friend GClause GClause_new(Clause* c);
+
+ bool isLit () const { return ((uintp)data & 1) == 1; }
+ bool isNull () const { return data == NULL; }
+@@ -114,6 +129,8 @@
+ };
+ #define GClause_NULL GClause_new((Clause*)NULL)
+
++inline GClause GClause_new(Lit p) { return GClause((void*)((index(p) << 1) + 1)); }
++inline GClause GClause_new(Clause* c) { assert(((uintp)c & 1) == 0); return GClause((void*)c); }
+
+ //=================================================================================================
+ #endif
diff --git a/sci-mathematics/nusmv/files/cudd-no-pentium4.patch b/sci-mathematics/nusmv/files/cudd-no-pentium4.patch
new file mode 100644
index 000000000000..844f7c00d638
--- /dev/null
+++ b/sci-mathematics/nusmv/files/cudd-no-pentium4.patch
@@ -0,0 +1,11 @@
+--- Makefile.orig 2010-07-12 02:54:26.000000000 +0200
++++ Makefile 2010-07-12 02:54:49.000000000 +0200
+@@ -69,7 +69,7 @@
+ # Gcc 2.8.1 or higher on i686.
+ #XCFLAGS = -mcpu=pentiumpro -malign-double -DHAVE_IEEE_754 -DBSD
+ # Gcc 3.2.2 or higher on i686.
+-XCFLAGS = -mcpu=pentium4 -malign-double -DHAVE_IEEE_754 -DBSD -DSIZEOF_VOID_P=4 -DSIZEOF_LONG=4 -DSIZEOF_INT=4
++XCFLAGS = -malign-double -DHAVE_IEEE_754 -DBSD -DSIZEOF_VOID_P=4 -DSIZEOF_LONG=4 -DSIZEOF_INT=4
+ # Icc on i686.
+ #XCFLAGS = -ansi -align -ip -DHAVE_IEEE_754 -DBSD
+ # Gcc on ia64.
diff --git a/sci-mathematics/nusmv/metadata.xml b/sci-mathematics/nusmv/metadata.xml
new file mode 100644
index 000000000000..da589122a2f5
--- /dev/null
+++ b/sci-mathematics/nusmv/metadata.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <herd>sci-mathematics</herd>
+ <maintainer>
+ <email>robbat2@gentoo.org</email>
+ </maintainer>
+ <use>
+ <flag name="minisat">Enable support for MiniSat</flag>
+ </use>
+</pkgmetadata>
diff --git a/sci-mathematics/nusmv/nusmv-2.3.1.ebuild b/sci-mathematics/nusmv/nusmv-2.3.1.ebuild
new file mode 100644
index 000000000000..49764e298196
--- /dev/null
+++ b/sci-mathematics/nusmv/nusmv-2.3.1.ebuild
@@ -0,0 +1,121 @@
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+inherit eutils toolchain-funcs
+
+NUSMV_PN="NuSMV"
+NUSMV_PV="${PV}"
+NUSMV_P="${NUSMV_PN}-${NUSMV_PV}"
+NUSMV_A="${NUSMV_P}.tar.gz"
+NUSMV_S="${WORKDIR}/${NUSMV_P}/nusmv"
+
+MINISAT_PN="MiniSat"
+MINISAT_PV="1.14"
+MINISAT_P="${MINISAT_PN}_v${MINISAT_PV}"
+MINISAT_A="${MINISAT_P}_src.zip"
+MINISAT_S="${WORKDIR}/${NUSMV_P}/MiniSat/${MINISAT_P}"
+
+CUDD_PN="cudd"
+CUDD_PV="2.3.0.1"
+CUDD_P="${CUDD_PN}-${CUDD_PV}"
+#CUDD_A is none
+CUDD_S="${WORKDIR}/${NUSMV_P}/${CUDD_P}"
+
+DESCRIPTION="NuSMV: new symbolic model checker"
+HOMEPAGE="http://nusmv.irst.itc.it/"
+# The Homepage is _very_ slow, 2Kb/sec or worse.
+# So we use our own mirror.
+# Additionally, MiniSat is distributed with a slightly different filename
+# So we mirror it ourselves
+SRC_URI="mirror://gentoo/${NUSMV_A}
+ http://nusmv.irst.itc.it/distrib/${NUSMV_A}
+ minisat? ( mirror://gentoo/${MINISAT_A} )"
+LICENSE="LGPL-2.1"
+SLOT="0"
+KEYWORDS="~x86 ~amd64"
+IUSE="minisat examples"
+RDEPEND="dev-libs/expat"
+DEPEND="${RDEPEND}
+ virtual/latex-base
+ dev-texlive/texlive-latexextra
+ app-text/ghostscript-gpl
+ www-client/lynx
+ dev-lang/perl"
+# the above 4 are for docs, which aren't optional yet patches welcome to
+# avoid building the docs but I suspect anybody using this package will
+# actually need them
+S="${NUSMV_S}"
+
+src_unpack() {
+ unpack ${NUSMV_A}
+ if use minisat; then
+ cd "${WORKDIR}"/${NUSMV_P}/MiniSat
+ unpack ${MINISAT_A}
+ epatch ${MINISAT_P}_nusmv.patch
+ epatch "${FILESDIR}"/${MINISAT_P}-optimizedlib.patch
+ fi
+ for i in ${NUSMV_S}/doc/{user-man,tutorial}/Makefile.in ; do
+ sed -i.orig \
+ '/install_sh_DATA/s!$(datadir)!$(DESTDIR)$(datadir)!g' \
+ ${i} || die "sed $i failed"
+ done
+}
+
+src_compile() {
+ rm -f ${NUSMV_S}/${MINISAT_P}
+ if use minisat; then
+ cd ${MINISAT_S}
+ # do NOT merge these targets
+ emake COPTIMIZE="${CFLAGS}" r || die "Failed to build minisat bin"
+ emake COPTIMIZE="${CFLAGS}" lr || die "Failed to build minisat lib"
+ ln -sf ${MINISAT_S} "${WORKDIR}"/${NUSMV_P}/${MINISAT_P}
+ fi
+
+ cd ${CUDD_S}
+ emake clean || die "Failed to clean cudd out."
+ emake \
+ CPP="$(tc-getCPP)" CC="$(tc-getCC)" \
+ RANLIB="$(tc-getRANLIB)" ICFLAGS="${CFLAGS}" \
+ || die "Failed to build cudd."
+
+ cd ${NUSMV_S}
+ econf `use_enable minisat` \
+ --enable-sa \
+ --enable-sa-cpp \
+ --enable-psl
+ emake || die "emake failed"
+
+ VARTEXFONTS="${T}"/fonts emake docs
+}
+
+src_install() {
+ into /usr
+ if use minisat; then
+ newbin ${MINISAT_S}/minisat_release minisat
+ fi
+
+ dodir /usr/share/nusmv/doc
+ cd ${NUSMV_S}
+ emake DESTDIR="${D}" install || die "emake install failed"
+ # duplicate items
+ rm -f "${D}"/usr/share/nusmv/{LGPL-2.1,README*,NEWS}
+ # real docs
+ dodoc README* NEWS AUTHORS
+ dodoc doc/tutorial/tutorial.pdf
+ dodoc doc/user-man/nusmv.pdf
+
+ # move package-installed docs
+ mv "${D}"/usr/share/nusmv/doc/* "${D}"/usr/share/doc/${PF}/
+ rmdir "${D}"/usr/share/nusmv/doc
+
+ # clean out examples if not needed
+ if use !examples ; then
+ rm -rf "${D}"/usr/share/nusmv/examples || die "Failed to remove examples"
+ fi
+}
+
+src_test() {
+ cd ${NUSMV_S}
+ emake check || die "emake check failed"
+}
diff --git a/sci-mathematics/nusmv/nusmv-2.5.0.ebuild b/sci-mathematics/nusmv/nusmv-2.5.0.ebuild
new file mode 100644
index 000000000000..58220e1e95b6
--- /dev/null
+++ b/sci-mathematics/nusmv/nusmv-2.5.0.ebuild
@@ -0,0 +1,133 @@
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+inherit eutils toolchain-funcs
+
+NUSMV_PN="NuSMV"
+NUSMV_PV="${PV}"
+NUSMV_P="${NUSMV_PN}-${NUSMV_PV}"
+NUSMV_A="${NUSMV_P}.tar.gz"
+NUSMV_S="${WORKDIR}/${NUSMV_P}/nusmv"
+
+MINISAT_PN="MiniSat"
+MINISAT_PV="1.14"
+MINISAT_P="${MINISAT_PN}_v${MINISAT_PV}"
+MINISAT_A="${MINISAT_P}_src.zip"
+MINISAT_S="${WORKDIR}/${NUSMV_P}/MiniSat/${MINISAT_P}"
+
+CUDD_PN="cudd"
+CUDD_PV="2.4.1.1"
+CUDD_P="${CUDD_PN}-${CUDD_PV}"
+#CUDD_A is none
+CUDD_S="${WORKDIR}/${NUSMV_P}/${CUDD_P}"
+
+DESCRIPTION="NuSMV: new symbolic model checker"
+HOMEPAGE="http://nusmv.irst.itc.it/"
+# The Homepage is _very_ slow, 2Kb/sec or worse.
+# So we use our own mirror.
+# Additionally, MiniSat is distributed with a slightly different filename
+# So we mirror it ourselves
+SRC_URI="mirror://gentoo/${NUSMV_A}
+ http://nusmv.irst.itc.it/distrib/${NUSMV_A}
+ minisat? ( mirror://gentoo/${MINISAT_A} )"
+LICENSE="LGPL-2.1"
+SLOT="0"
+KEYWORDS="~x86 ~amd64"
+IUSE="minisat examples"
+RDEPEND="dev-libs/expat"
+DEPEND="${RDEPEND}
+ virtual/latex-base
+ dev-texlive/texlive-latexextra
+ app-text/ghostscript-gpl
+ www-client/lynx
+ dev-lang/perl"
+# the above 4 are for docs, which aren't optional yet patches welcome to
+# avoid building the docs but I suspect anybody using this package will
+# actually need them
+S="${NUSMV_S}"
+
+src_unpack() {
+ unpack ${NUSMV_A}
+ if use minisat; then
+ cd "${WORKDIR}"/${NUSMV_P}/MiniSat
+ unpack ${MINISAT_A}
+ epatch ${MINISAT_P}_nusmv.patch
+ epatch "${FILESDIR}"/${MINISAT_P}-optimizedlib.patch
+ epatch "${FILESDIR}"/${MINISAT_P}_gcc41.patch
+ fi
+
+ cd "${CUDD_S}"
+ epatch "${FILESDIR}"/${CUDD_PN}-no-pentium4.patch
+ if [[ "$(tc-arch)" = amd64 ]] ; then
+ mv Makefile_64bit Makefile || die
+ fi
+
+ for i in ${NUSMV_S}/doc/{user-man,tutorial}/Makefile.in ; do
+ sed -i.orig \
+ '/install_sh_DATA/s!$(datadir)!$(DESTDIR)$(datadir)!g' \
+ ${i} || die "sed $i failed"
+ done
+}
+
+src_compile() {
+ rm -f ${NUSMV_S}/${MINISAT_P}
+ if use minisat; then
+ cd ${MINISAT_S}
+ # do NOT merge these targets
+ emake COPTIMIZE="${CFLAGS}" r || die "Failed to build minisat bin"
+ emake COPTIMIZE="${CFLAGS}" lr || die "Failed to build minisat lib"
+ ln -sf ${MINISAT_S} "${WORKDIR}"/${NUSMV_P}/${MINISAT_P}
+ fi
+
+ cd ${CUDD_S}
+ emake clean || die "Failed to clean cudd out."
+ emake \
+ CPP="$(tc-getCPP)" CC="$(tc-getCC)" \
+ RANLIB="$(tc-getRANLIB)" ICFLAGS="${CFLAGS}" \
+ || die "Failed to build cudd."
+
+ local myconf="$(use_enable minisat) --enable-pslparser"
+ if use minisat; then
+ myconf="${myconf}
+ --with-minisat-incdir=../${MINISAT_P}
+ --with-minisat-libdir=../${MINISAT_P}"
+ fi
+
+ cd ${NUSMV_S}
+ econf ${myconf}
+ emake || die "emake failed"
+
+ VARTEXFONTS="${T}"/fonts emake docs
+}
+
+src_install() {
+ into /usr
+ if use minisat; then
+ newbin ${MINISAT_S}/minisat_release minisat
+ fi
+
+ dodir /usr/share/nusmv/doc
+ cd ${NUSMV_S}
+ emake DESTDIR="${D}" install || die "emake install failed"
+ # duplicate items
+ rm -f "${D}"/usr/share/nusmv/{LGPL-2.1,README*,NEWS}
+ # real docs
+ dodoc README* NEWS AUTHORS
+ dodoc doc/tutorial/tutorial.pdf
+ dodoc doc/user-man/nusmv.pdf
+
+ # move package-installed docs
+ mv "${D}"/usr/share/nusmv/doc/* "${D}"/usr/share/doc/${PF}/
+ rmdir "${D}"/usr/share/nusmv/doc
+
+ # clean out examples if not needed
+ if use !examples ; then
+ rm -rf "${D}"/usr/share/nusmv/examples || die "Failed to remove examples"
+ fi
+}
+
+src_test() {
+ cd ${NUSMV_S}
+ emake check || die "emake check failed"
+}
diff --git a/sci-mathematics/nusmv/nusmv-2.5.2.ebuild b/sci-mathematics/nusmv/nusmv-2.5.2.ebuild
new file mode 100644
index 000000000000..38ce8b01c809
--- /dev/null
+++ b/sci-mathematics/nusmv/nusmv-2.5.2.ebuild
@@ -0,0 +1,132 @@
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+inherit eutils flag-o-matic toolchain-funcs
+
+NUSMV_PN="NuSMV"
+NUSMV_PV="${PV}"
+NUSMV_P="${NUSMV_PN}-${NUSMV_PV}"
+NUSMV_A="${NUSMV_P}.tar.gz"
+NUSMV_S="${WORKDIR}/${NUSMV_P}/nusmv"
+
+MINISAT_PN="MiniSat"
+MINISAT_PV="1.14"
+MINISAT_P="${MINISAT_PN}_v${MINISAT_PV}"
+MINISAT_A="${MINISAT_P}_src.zip"
+MINISAT_S="${WORKDIR}/${NUSMV_P}/MiniSat/${MINISAT_P}"
+
+CUDD_PN="cudd"
+CUDD_PV="2.4.1.1"
+CUDD_P="${CUDD_PN}-${CUDD_PV}"
+#CUDD_A is none
+CUDD_S="${WORKDIR}/${NUSMV_P}/${CUDD_P}"
+
+DESCRIPTION="NuSMV: new symbolic model checker"
+HOMEPAGE="http://nusmv.irst.itc.it/"
+SRC_URI="http://nusmv.fbk.eu/distrib/${NUSMV_A}
+ minisat? ( mirror://gentoo/${MINISAT_A} )"
+LICENSE="LGPL-2.1"
+SLOT="0"
+KEYWORDS="~x86 ~amd64"
+IUSE="minisat examples"
+RDEPEND="dev-libs/expat"
+DEPEND="${RDEPEND}
+ virtual/latex-base
+ dev-texlive/texlive-latexextra
+ app-text/ghostscript-gpl
+ www-client/lynx
+ dev-lang/perl"
+# the above 4 are for docs, which aren't optional yet patches welcome to
+# avoid building the docs but I suspect anybody using this package will
+# actually need them
+S="${NUSMV_S}"
+
+src_unpack() {
+ unpack ${NUSMV_A}
+ if use minisat; then
+ cd "${WORKDIR}"/${NUSMV_P}/MiniSat
+ unpack ${MINISAT_A}
+ epatch ${MINISAT_P}_nusmv.patch
+ epatch "${FILESDIR}"/${MINISAT_P}-optimizedlib.patch
+ epatch "${FILESDIR}"/${MINISAT_P}_gcc41.patch
+ fi
+
+ cd "${CUDD_S}"
+ if [[ "$(tc-arch)" = amd64 ]] ; then
+ mv Makefile_64bit Makefile || die
+ fi
+ sed -i Makefile -e 's/-mcpu=[^\s]*//' || die
+
+ for i in ${NUSMV_S}/doc/{user-man,tutorial}/Makefile.in ; do
+ sed -i.orig \
+ '/install_sh_DATA/s!$(datadir)!$(DESTDIR)$(datadir)!g' \
+ ${i} || die "sed $i failed"
+ done
+}
+
+src_compile() {
+ if [[ "$(tc-arch)" = x86 ]] ; then
+ append-flags -DNUSMV_SIZEOF_VOID_P=4 -DNUSMV_SIZEOF_LONG=4 -DNUSMV_SIZEOF_INT=4
+ fi
+
+ rm -f ${NUSMV_S}/${MINISAT_P}
+ if use minisat; then
+ cd ${MINISAT_S}
+ # do NOT merge these targets
+ emake COPTIMIZE="${CFLAGS}" r || die "Failed to build minisat bin"
+ emake COPTIMIZE="${CFLAGS}" lr || die "Failed to build minisat lib"
+ ln -sf ${MINISAT_S} "${WORKDIR}"/${NUSMV_P}/${MINISAT_P}
+ fi
+
+ cd ${CUDD_S}
+ emake clean || die "Failed to clean cudd out."
+ emake \
+ CPP="$(tc-getCPP)" CC="$(tc-getCC)" \
+ RANLIB="$(tc-getRANLIB)" ICFLAGS="${CFLAGS}" \
+ || die "Failed to build cudd."
+
+ local myconf="$(use_enable minisat) --enable-pslparser"
+ if use minisat; then
+ myconf="${myconf}
+ --with-minisat-incdir=../${MINISAT_P}
+ --with-minisat-libdir=../${MINISAT_P}"
+ fi
+
+ cd ${NUSMV_S}
+ econf ${myconf}
+ emake || die "emake failed"
+
+ VARTEXFONTS="${T}"/fonts emake docs
+}
+
+src_install() {
+ into /usr
+ if use minisat; then
+ newbin ${MINISAT_S}/minisat_release minisat
+ fi
+
+ dodir /usr/share/nusmv/doc
+ cd ${NUSMV_S}
+ emake DESTDIR="${D}" install || die "emake install failed"
+ # duplicate items
+ rm -f "${D}"/usr/share/nusmv/{LGPL-2.1,README*,NEWS}
+ # real docs
+ dodoc README* NEWS AUTHORS
+ dodoc doc/tutorial/tutorial.pdf
+ dodoc doc/user-man/nusmv.pdf
+
+ # move package-installed docs
+ mv "${D}"/usr/share/nusmv/doc/* "${D}"/usr/share/doc/${PF}/
+ rmdir "${D}"/usr/share/nusmv/doc
+
+ # clean out examples if not needed
+ if use !examples ; then
+ rm -rf "${D}"/usr/share/nusmv/examples || die "Failed to remove examples"
+ fi
+}
+
+src_test() {
+ cd ${NUSMV_S}
+ emake check || die "emake check failed"
+}
diff --git a/sci-mathematics/nusmv/nusmv-2.5.3.ebuild b/sci-mathematics/nusmv/nusmv-2.5.3.ebuild
new file mode 100644
index 000000000000..9fa6a28a8923
--- /dev/null
+++ b/sci-mathematics/nusmv/nusmv-2.5.3.ebuild
@@ -0,0 +1,132 @@
+# Copyright 1999-2013 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+inherit eutils flag-o-matic toolchain-funcs
+
+NUSMV_PN="NuSMV"
+NUSMV_PV="${PV}"
+NUSMV_P="${NUSMV_PN}-${NUSMV_PV}"
+NUSMV_A="${NUSMV_P}.tar.gz"
+NUSMV_S="${WORKDIR}/${NUSMV_P}/nusmv"
+
+MINISAT_PN="MiniSat"
+MINISAT_PV="1.14"
+MINISAT_P="${MINISAT_PN}_v${MINISAT_PV}"
+MINISAT_A="${MINISAT_P}_src.zip"
+MINISAT_S="${WORKDIR}/${NUSMV_P}/MiniSat/${MINISAT_P}"
+
+CUDD_PN="cudd"
+CUDD_PV="2.4.1.1"
+CUDD_P="${CUDD_PN}-${CUDD_PV}"
+#CUDD_A is none
+CUDD_S="${WORKDIR}/${NUSMV_P}/${CUDD_P}"
+
+DESCRIPTION="NuSMV: new symbolic model checker"
+HOMEPAGE="http://nusmv.irst.itc.it/"
+SRC_URI="http://nusmv.fbk.eu/distrib/${NUSMV_A}
+ minisat? ( mirror://gentoo/${MINISAT_A} )"
+LICENSE="LGPL-2.1"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE="minisat examples"
+RDEPEND="dev-libs/expat"
+DEPEND="${RDEPEND}
+ virtual/latex-base
+ dev-texlive/texlive-latexextra
+ app-text/ghostscript-gpl
+ www-client/lynx
+ dev-lang/perl"
+# the above 4 are for docs, which aren't optional yet patches welcome to
+# avoid building the docs but I suspect anybody using this package will
+# actually need them
+S="${NUSMV_S}"
+
+src_unpack() {
+ unpack ${NUSMV_A}
+ if use minisat; then
+ cd "${WORKDIR}"/${NUSMV_P}/MiniSat
+ unpack ${MINISAT_A}
+ epatch ${MINISAT_P}_nusmv.patch
+ epatch "${FILESDIR}"/${MINISAT_P}-optimizedlib.patch
+ epatch "${FILESDIR}"/${MINISAT_P}_gcc41.patch
+ fi
+
+ cd "${CUDD_S}"
+ if [[ "$(tc-arch)" = amd64 ]] ; then
+ mv Makefile_64bit Makefile || die
+ fi
+ sed -i Makefile -e 's/-mcpu=[^\s]*//' || die
+
+ for i in ${NUSMV_S}/doc/{user-man,tutorial}/Makefile.in ; do
+ sed -i.orig \
+ '/install_sh_DATA/s!$(datadir)!$(DESTDIR)$(datadir)!g' \
+ ${i} || die "sed $i failed"
+ done
+}
+
+src_compile() {
+ if [[ "$(tc-arch)" = x86 ]] ; then
+ append-flags -DNUSMV_SIZEOF_VOID_P=4 -DNUSMV_SIZEOF_LONG=4 -DNUSMV_SIZEOF_INT=4
+ fi
+
+ rm -f ${NUSMV_S}/${MINISAT_P}
+ if use minisat; then
+ cd ${MINISAT_S}
+ # do NOT merge these targets
+ emake COPTIMIZE="${CFLAGS}" r || die "Failed to build minisat bin"
+ emake COPTIMIZE="${CFLAGS}" lr || die "Failed to build minisat lib"
+ ln -sf ${MINISAT_S} "${WORKDIR}"/${NUSMV_P}/${MINISAT_P}
+ fi
+
+ cd ${CUDD_S}
+ emake clean || die "Failed to clean cudd out."
+ emake \
+ CPP="$(tc-getCPP)" CC="$(tc-getCC)" \
+ RANLIB="$(tc-getRANLIB)" ICFLAGS="${CFLAGS}" \
+ || die "Failed to build cudd."
+
+ local myconf="$(use_enable minisat) --enable-pslparser"
+ if use minisat; then
+ myconf="${myconf}
+ --with-minisat-incdir=../${MINISAT_P}
+ --with-minisat-libdir=../${MINISAT_P}"
+ fi
+
+ cd ${NUSMV_S}
+ econf ${myconf}
+ emake || die "emake failed"
+
+ VARTEXFONTS="${T}"/fonts emake docs
+}
+
+src_install() {
+ into /usr
+ if use minisat; then
+ newbin ${MINISAT_S}/minisat_release minisat
+ fi
+
+ dodir /usr/share/nusmv/doc
+ cd ${NUSMV_S}
+ emake DESTDIR="${D}" install || die "emake install failed"
+ # duplicate items
+ rm -f "${D}"/usr/share/nusmv/{LGPL-2.1,README*,NEWS}
+ # real docs
+ dodoc README* NEWS AUTHORS
+ dodoc doc/tutorial/tutorial.pdf
+ dodoc doc/user-man/nusmv.pdf
+
+ # move package-installed docs
+ mv "${D}"/usr/share/nusmv/doc/* "${D}"/usr/share/doc/${PF}/
+ rmdir "${D}"/usr/share/nusmv/doc
+
+ # clean out examples if not needed
+ if use !examples ; then
+ rm -rf "${D}"/usr/share/nusmv/examples || die "Failed to remove examples"
+ fi
+}
+
+src_test() {
+ cd ${NUSMV_S}
+ emake check || die "emake check failed"
+}
diff --git a/sci-mathematics/nusmv/nusmv-2.5.4.ebuild b/sci-mathematics/nusmv/nusmv-2.5.4.ebuild
new file mode 100644
index 000000000000..1f08cca70b7f
--- /dev/null
+++ b/sci-mathematics/nusmv/nusmv-2.5.4.ebuild
@@ -0,0 +1,135 @@
+# Copyright 1999-2013 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+inherit eutils flag-o-matic toolchain-funcs
+
+NUSMV_PN="NuSMV"
+NUSMV_PV="${PV}"
+NUSMV_P="${NUSMV_PN}-${NUSMV_PV}"
+NUSMV_A="${NUSMV_P}.tar.gz"
+NUSMV_S="${WORKDIR}/${NUSMV_P}/nusmv"
+
+MINISAT_PN="MiniSat"
+MINISAT_PV="1.14"
+MINISAT_P="${MINISAT_PN}_v${MINISAT_PV}"
+MINISAT_A="${MINISAT_P}_src.zip"
+MINISAT_S="${WORKDIR}/${NUSMV_P}/MiniSat/${MINISAT_P}"
+
+CUDD_PN="cudd"
+CUDD_PV="2.4.1.1"
+CUDD_P="${CUDD_PN}-${CUDD_PV}"
+#CUDD_A is none
+CUDD_S="${WORKDIR}/${NUSMV_P}/${CUDD_P}"
+
+DESCRIPTION="NuSMV: new symbolic model checker"
+HOMEPAGE="http://nusmv.irst.itc.it/"
+SRC_URI="http://nusmv.fbk.eu/distrib/${NUSMV_A}
+ minisat? ( mirror://gentoo/${MINISAT_A} )"
+LICENSE="LGPL-2.1"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE="minisat examples"
+RDEPEND="dev-libs/expat"
+DEPEND="${RDEPEND}
+ virtual/latex-base
+ dev-texlive/texlive-latexextra
+ app-text/ghostscript-gpl
+ www-client/lynx
+ dev-lang/perl"
+# the above 4 are for docs, which aren't optional yet patches welcome to
+# avoid building the docs but I suspect anybody using this package will
+# actually need them
+S="${NUSMV_S}"
+
+src_unpack() {
+ unpack ${NUSMV_A}
+ if use minisat; then
+ cd "${WORKDIR}"/${NUSMV_P}/MiniSat
+ unpack ${MINISAT_A}
+ epatch ${MINISAT_P}_nusmv.patch
+ epatch "${FILESDIR}"/${MINISAT_P}-optimizedlib.patch
+ epatch "${FILESDIR}"/${MINISAT_P}_gcc41.patch
+ fi
+
+ cd "${CUDD_S}"
+ if [[ "$(tc-arch)" = amd64 ]] ; then
+ mv Makefile_64bit Makefile || die
+ fi
+ sed -i Makefile -e 's/-mcpu=[^\s]*//' || die
+
+ for i in ${NUSMV_S}/doc/{user-man,tutorial}/Makefile.in ; do
+ sed -i.orig \
+ '/install_sh_DATA/s!$(datadir)!$(DESTDIR)$(datadir)!g' \
+ ${i} || die "sed $i failed"
+ done
+}
+
+src_compile() {
+ if [[ "$(tc-arch)" = x86 ]] ; then
+ append-flags -DNUSMV_SIZEOF_VOID_P=4 -DNUSMV_SIZEOF_LONG=4 -DNUSMV_SIZEOF_INT=4
+ fi
+ # With LTO, it tried to link for 6 hours on an i7 system before failing.
+ filter-flags -flto -Wl,-flto
+
+ rm -f ${NUSMV_S}/${MINISAT_P}
+ if use minisat; then
+ cd ${MINISAT_S}
+ # do NOT merge these targets
+ emake COPTIMIZE="${CFLAGS}" r || die "Failed to build minisat bin"
+ emake COPTIMIZE="${CFLAGS}" lr || die "Failed to build minisat lib"
+ ln -sf ${MINISAT_S} "${WORKDIR}"/${NUSMV_P}/${MINISAT_P}
+ fi
+
+ cd ${CUDD_S}
+ emake clean || die "Failed to clean cudd out."
+ emake \
+ CPP="$(tc-getCPP)" CC="$(tc-getCC)" \
+ RANLIB="$(tc-getRANLIB)" ICFLAGS="${CFLAGS}" \
+ || die "Failed to build cudd."
+
+ local myconf="$(use_enable minisat) --enable-pslparser"
+ if use minisat; then
+ myconf="${myconf}
+ --with-minisat-incdir=../${MINISAT_P}
+ --with-minisat-libdir=../${MINISAT_P}"
+ fi
+
+ cd ${NUSMV_S}
+ econf ${myconf}
+ einfo "Don't be alarmed if compileWriteUdg.o takes a very long time to compile, ~90 minutes on an i7"
+ emake || die "emake failed"
+
+ VARTEXFONTS="${T}"/fonts emake docs
+}
+
+src_install() {
+ into /usr
+ if use minisat; then
+ newbin ${MINISAT_S}/minisat_release minisat
+ fi
+
+ dodir /usr/share/nusmv/doc
+ cd ${NUSMV_S}
+ emake DESTDIR="${D}" install || die "emake install failed"
+ # duplicate items
+ rm -f "${D}"/usr/share/nusmv/{LGPL-2.1,README*,NEWS}
+ # real docs
+ dodoc README* NEWS AUTHORS
+ dodoc doc/tutorial/tutorial.pdf
+ dodoc doc/user-man/nusmv.pdf
+
+ # move package-installed docs
+ mv "${D}"/usr/share/nusmv/doc/* "${D}"/usr/share/doc/${PF}/
+ rmdir "${D}"/usr/share/nusmv/doc
+
+ # clean out examples if not needed
+ if use !examples ; then
+ rm -rf "${D}"/usr/share/nusmv/examples || die "Failed to remove examples"
+ fi
+}
+
+src_test() {
+ cd ${NUSMV_S}
+ emake check || die "emake check failed"
+}
diff --git a/sci-mathematics/octave-epstk/Manifest b/sci-mathematics/octave-epstk/Manifest
new file mode 100644
index 000000000000..d12ebe6b416d
--- /dev/null
+++ b/sci-mathematics/octave-epstk/Manifest
@@ -0,0 +1,4 @@
+DIST octave-epstk_2.3-2.debian.tar.gz 10079 RMD160 31473407f9748448dde539530f5bc91a53a5d8c6 SHA1 e01a2db83b89addfa1b68b99a966966bdaad14b8 SHA256 fbfdfb15a1df78395553c8c014c20743312ae84e404697336c8df16ecec6d20d
+DIST octave-epstk_2.3.orig.tar.bz2 1401307 RMD160 0c7c2b9e23210e98c487d1087aea665d58f622b2 SHA1 8b31619b5455e2a8080f2016a556b0a7a7f40397 SHA256 c496e1eb1fc97cd01cbe2004664c5ffae271f542cecc63d7f596b062400aae61
+DIST octave-epstk_2.4-1.debian.tar.gz 10905 RMD160 c44a544b9006dd6ef169e6bd686c85581be88aaa SHA1 fd388638db491818e7fe7a08cf872048e58cef27 SHA256 20d961434b58ad3ace9af2ecd199fe458903146126ceaea905ea0173246b1973
+DIST octave-epstk_2.4.orig.tar.bz2 1072111 RMD160 b6862ad9047ea77d1c052b399333c76a7550d02d SHA1 d2d60b903eed3a348ad79014da5e6fba6d52e830 SHA256 8de20e9529a0f3503d50bb31867c00c2564d5e6e570daf5786c51592ec673551
diff --git a/sci-mathematics/octave-epstk/metadata.xml b/sci-mathematics/octave-epstk/metadata.xml
new file mode 100644
index 000000000000..1e986b205ff0
--- /dev/null
+++ b/sci-mathematics/octave-epstk/metadata.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+<herd>sci-mathematics</herd>
+<longdescription lang='en'>
+ The epsTk package provides, via a set of functions for octave, a
+ toolkit to create powerful encapsulated postscript (.eps) graphs. Most 2D
+ scientific graphics functions are written. The generated .eps-files are very
+ small and can be imported into other documents without loss of quality.
+</longdescription>
+</pkgmetadata>
diff --git a/sci-mathematics/octave-epstk/octave-epstk-2.3.ebuild b/sci-mathematics/octave-epstk/octave-epstk-2.3.ebuild
new file mode 100644
index 000000000000..835585e9cb0a
--- /dev/null
+++ b/sci-mathematics/octave-epstk/octave-epstk-2.3.ebuild
@@ -0,0 +1,40 @@
+# Copyright 1999-2011 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=2
+inherit eutils
+
+DEB_PR=2
+DESCRIPTION="Graphical output functions for Matlab and Octave"
+HOMEPAGE="http://www.epstk.de/"
+SRC_URI="mirror://debian/pool/main/${PN:0:1}/${PN}/${PN}_${PV}.orig.tar.bz2
+ mirror://debian/pool/main/${PN:0:1}/${PN}/${PN}_${PV}-${DEB_PR}.debian.tar.gz"
+
+LICENSE="GPL-2"
+KEYWORDS="~x86 ~amd64"
+SLOT="0"
+IUSE="doc"
+
+RDEPEND="sci-mathematics/octave
+ app-text/ghostscript-gpl"
+DEPEND=""
+
+S="${WORKDIR}"
+
+src_prepare() {
+ local p
+ cd eps*
+ for p in $(cat "${WORKDIR}"/debian/patches/series); do
+ epatch "${WORKDIR}"/debian/patches/${p}
+ done
+}
+
+src_install () {
+ insinto /usr/share/octave/site/m/${PN}
+ doins eps*/m/* || die
+ use doc && dohtml -r eps*/doc/*
+ insinto /etc
+ doins debian/epstk.conf || die
+ dodoc debian/README.Debian debian/changelog
+}
diff --git a/sci-mathematics/octave-epstk/octave-epstk-2.4.ebuild b/sci-mathematics/octave-epstk/octave-epstk-2.4.ebuild
new file mode 100644
index 000000000000..fe34729072ae
--- /dev/null
+++ b/sci-mathematics/octave-epstk/octave-epstk-2.4.ebuild
@@ -0,0 +1,40 @@
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=4
+inherit eutils
+
+DEB_PR=1
+DESCRIPTION="Graphical output functions for Matlab and Octave"
+HOMEPAGE="http://www.epstk.de/"
+SRC_URI="mirror://debian/pool/main/${PN:0:1}/${PN}/${PN}_${PV}.orig.tar.bz2
+ mirror://debian/pool/main/${PN:0:1}/${PN}/${PN}_${PV}-${DEB_PR}.debian.tar.gz"
+
+LICENSE="GPL-2"
+KEYWORDS="~x86 ~amd64"
+SLOT="0"
+IUSE="doc"
+
+RDEPEND="sci-mathematics/octave
+ app-text/ghostscript-gpl"
+DEPEND=""
+
+S="${WORKDIR}"
+
+src_prepare() {
+ local p
+ cd eps*
+ for p in $(cat "${WORKDIR}"/debian/patches/series); do
+ epatch "${WORKDIR}"/debian/patches/${p}
+ done
+}
+
+src_install () {
+ insinto /usr/share/octave/site/m/${PN}
+ doins eps*/m/*
+ use doc && dohtml -r eps*/doc/*
+ insinto /etc
+ doins debian/epstk.conf
+ dodoc debian/README.Debian debian/changelog
+}
diff --git a/sci-mathematics/octave/Manifest b/sci-mathematics/octave/Manifest
new file mode 100644
index 000000000000..ec9e36b2543b
--- /dev/null
+++ b/sci-mathematics/octave/Manifest
@@ -0,0 +1,4 @@
+DIST octave-3.6.4.tar.bz2 15627315 SHA256 fa185df9591f5d740f4d37ff6eaf06db576fdd3e0ddd9d0737365799e5d1c962 SHA512 a49ef50161272618c9543057be5903e1e50b7f4ecb929777f6715d4b3a07a92c36a5b13958c52d8b942b6c7e7e3f7844409d0062eb02bdb3972d7194312b7a81 WHIRLPOOL f51c764ce1ed911661bb3dd1d31a2321f09c0d887ead7bbe8c1f4ad1ebe05137223afb5ff18fc57b83d631936975964a85e4fed9a087760935acb5a35050cda0
+DIST octave-3.8.1.tar.bz2 17664241 SHA256 d6762ed2ad4a042243a095fb44c7a1d3a91c635b6dca37fcef15a5efdffa9bbd SHA512 673ff37692d2ef1116a10afb36448494e69cb01de609017af1a72c3258a1fe71012e9986aafc29127509f7e6664127b4e9b7f269322820b3464eb30ab4b4ef7f WHIRLPOOL 85729283a65051159245f31ab53951c756ea55d1cc93518dbb55b740329a89cffbdf3679ae8d2b957e1a4b47dbf5f2dd9d60f51acf32e159d821979661a5fa54
+DIST octave-3.8.2.tar.bz2 17834980 SHA256 83bbd701aab04e7e57d0d5b8373dd54719bebb64ce0a850e69bf3d7454f33bae SHA512 c2bf4cc844a5b8dbabf2b54d2458ee7573f87dc92ca8cd7829e8c057591387b3a0995b5b48c6e50ff2944411f2b28521de26e438ed431f68ab5b49b8ce1d94cc WHIRLPOOL c117b935a060572577b3506a508d558a2af85b2785af02647e9edc47c5df97e357d954449edc90cc40a6af3230f99faccf6c7cf1b9b2bc6044f35749d3ae1af0
+DIST octave-4.0.0.tar.xz 15759196 SHA256 cf6be2fac6796fda68971e249c96d026ce4a1b0ed074ce49a5791365a958c474 SHA512 54559686d017b7fe731a89a24e74d08781365028d2799a86f25ebf4c433013eab03e5b4381a992b79e40bce1827a6eee2aefd0798b739128dd8dd7b41d936b89 WHIRLPOOL 0e0154dac5ac76268d99533186a88f54bc811817cdf2222c3c0bc22ff456fd23829f7015eebcb9d441665c1d2782ed57c06ab00880f64d63b22ef4aad43f132a
diff --git a/sci-mathematics/octave/files/octave-3.4.3-pkgbuilddir.patch b/sci-mathematics/octave/files/octave-3.4.3-pkgbuilddir.patch
new file mode 100644
index 000000000000..5340c9a19b92
--- /dev/null
+++ b/sci-mathematics/octave/files/octave-3.4.3-pkgbuilddir.patch
@@ -0,0 +1,44 @@
+Description: Allow installation of already extracted packages with pkg.m
+Forwarded: not-needed
+Author: Thomas Weber <tweber@debian.org>
+--- scripts/pkg/pkg.m.orig 2011-02-08 03:00:51.000000000 -0700
++++ scripts/pkg/pkg.m 2011-03-18 09:31:24.670165643 -0600
+@@ -644,7 +644,14 @@
+ for i = 1:length (files)
+ tgz = files{i};
+
+- if (exist (tgz, "file"))
++ ## The filename pointed to an uncompressed package to begin with.
++ if (exist (tgz, "dir"))
++ if (tgz(1) == '/')
++ packdir = tgz;
++ else
++ packdir = fullfile (pwd(), tgz);
++ endif
++ elseif (exist (tgz, "file"))
+ ## Create a temporary directory.
+ tmpdir = tmpnam ();
+ tmpdirs{end+1} = tmpdir;
+@@ -671,20 +678,12 @@
+ if (length (dirlist) > 3)
+ error ("bundles of packages are not allowed");
+ endif
+- endif
+
+- ## The filename pointed to an uncompressed package to begin with.
+- if (exist (tgz, "dir"))
+- dirlist = {".", "..", tgz};
++ ## The two first entries of dirlist are "." and "..".
++ packdir = fullfile (tmpdir, dirlist{3});
+ endif
+
+ if (exist (tgz, "file") || exist (tgz, "dir"))
+- ## The two first entries of dirlist are "." and "..".
+- if (exist (tgz, "file"))
+- packdir = fullfile (tmpdir, dirlist{3});
+- else
+- packdir = fullfile (pwd(), dirlist{3});
+- endif
+ packdirs{end+1} = packdir;
+
+ ## Make sure the package contains necessary files.
diff --git a/sci-mathematics/octave/files/octave-3.4.3-texi.patch b/sci-mathematics/octave/files/octave-3.4.3-texi.patch
new file mode 100644
index 000000000000..661ddae4198a
--- /dev/null
+++ b/sci-mathematics/octave/files/octave-3.4.3-texi.patch
@@ -0,0 +1,11 @@
+--- doc/interpreter/Makefile.am.orig 2012-01-31 17:47:52.000000000 +0000
++++ doc/interpreter/Makefile.am 2012-01-31 17:49:37.000000000 +0000
+@@ -202,6 +202,8 @@
+ $(AWK) -f $(srcdir)/mkcontrib.awk $(srcdir)/contributors.in > $@-t
+ mv $@-t $@
+
++preface.texi: contributors.texi
++
+ ../../AUTHORS: preface.texi contributors.texi
+ rm -f AUTHORS
+ -$(MAKEINFO) -D AUTHORSONLY \
diff --git a/sci-mathematics/octave/files/octave-3.6.3-legendtext.patch b/sci-mathematics/octave/files/octave-3.6.3-legendtext.patch
new file mode 100644
index 000000000000..046c721fdb22
--- /dev/null
+++ b/sci-mathematics/octave/files/octave-3.6.3-legendtext.patch
@@ -0,0 +1,13 @@
+should be fixed in octave-3.8 and above
+
+--- src/gl2ps-renderer.cc.orig 2012-05-31 03:43:29.000000000 +0200
++++ src/gl2ps-renderer.cc 2012-10-10 18:41:10.526639551 +0200
+@@ -223,7 +223,7 @@
+
+ // FIXME: handle margin and surrounding box
+
+- glRasterPos3d (pos(0), pos(1), pos(2));
++ glRasterPos3d (pos(0), pos(1), pos.numel() > 2 ? pos(2) : 0.0);
+
+ octave_value string_prop = props.get_string ();
+
diff --git a/sci-mathematics/octave/files/octave-3.6.4-gcc-4.8.patch b/sci-mathematics/octave/files/octave-3.6.4-gcc-4.8.patch
new file mode 100644
index 000000000000..1e13ebce38e2
--- /dev/null
+++ b/sci-mathematics/octave/files/octave-3.6.4-gcc-4.8.patch
@@ -0,0 +1,34 @@
+Description: Fix compilation of C++ MEX files with GCC 4.8
+ The header mex.h was including mexproto.h within an extern "C" block. In turn,
+ mexproto.h includes cstdlib.
+ .
+ Apparently, including cstdlib within an extern "C" block was working with GCC
+ 4.7, but this is no longer the case with GCC 4.8.
+ .
+ The fix consists in including mexproto.h outside of the extern "C" block.
+Author: Sébastien Villemot <sebastien@debian.org>
+Bug: https://savannah.gnu.org/bugs/index.php?38746
+Bug-Debian: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=705485
+Last-Update: 2013-05-29
+---
+This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
+--- a/src/mex.h
++++ b/src/mex.h
+@@ -64,6 +64,8 @@
+
+ #define mxMAXNAME 64
+
++#include "mexproto.h"
++
+ #if defined (__cplusplus)
+ extern "C" {
+ #endif
+@@ -74,8 +76,6 @@
+ void mexFunction (int nlhs, mxArray* plhs[], int nrhs, const mxArray *prhs[]);
+ #endif
+
+-#include "mexproto.h"
+-
+ /* V4 floating point routines renamed in V5. */
+ #define mexIsNaN mxIsNaN
+ #define mexIsFinite mxIsFinite
diff --git a/sci-mathematics/octave/files/octave-3.6.4-texinfo.patch b/sci-mathematics/octave/files/octave-3.6.4-texinfo.patch
new file mode 100644
index 000000000000..67f876f7bc42
--- /dev/null
+++ b/sci-mathematics/octave/files/octave-3.6.4-texinfo.patch
@@ -0,0 +1,378 @@
+diff -Nur octave-3.6.4.orig/doc/interpreter/audio.texi octave-3.6.4/doc/interpreter/audio.texi
+--- octave-3.6.4.orig/doc/interpreter/audio.texi 2013-02-21 12:37:50.000000000 -0800
++++ octave-3.6.4/doc/interpreter/audio.texi 2013-06-19 08:52:43.259790240 -0700
+@@ -146,18 +146,18 @@
+ Load the RIFF/WAVE sound file @var{filename}, and return the samples
+ in vector @var{y}. If the file contains multichannel data, then
+ @var{y} is a matrix with the channels represented as columns.
+-
+-@deftypefnx {Function File} {[@var{y}, @var{Fs}, @var{bps}] =} wavread (@var{filename})
++@end deftypefn
++@deftypefn {Function File} {[@var{y}, @var{Fs}, @var{bps}] =} wavread (@var{filename})
+ Additionally return the sample rate (@var{fs}) in Hz and the number of bits
+ per sample (@var{bps}).
+-
+-@deftypefnx {Function File} {[@dots{}] =} wavread (@var{filename}, @var{n})
++@end deftypefn
++@deftypefn {Function File} {[@dots{}] =} wavread (@var{filename}, @var{n})
+ Read only the first @var{n} samples from each channel.
+-
+-@deftypefnx {Function File} {[@dots{}] =} wavread (@var{filename}, @var{n1} @var{n2})
++@end deftypefn
++@deftypefn {Function File} {[@dots{}] =} wavread (@var{filename}, @var{n1} @var{n2})
+ Read only samples @var{n1} through @var{n2} from each channel.
+-
+-@deftypefnx {Function File} {[@var{samples}, @var{channels}] =} wavread (@var{filename}, "size")
++@end deftypefn
++@deftypefn {Function File} {[@var{samples}, @var{channels}] =} wavread (@var{filename}, "size")
+ Return the number of samples (@var{n}) and channels (@var{ch})
+ instead of the audio data.
+ @seealso{@ref{doc-wavwrite,,wavwrite}}
+diff -Nur octave-3.6.4.orig/doc/interpreter/io.texi octave-3.6.4/doc/interpreter/io.texi
+--- octave-3.6.4.orig/doc/interpreter/io.texi 2013-02-21 12:37:51.000000000 -0800
++++ octave-3.6.4/doc/interpreter/io.texi 2013-06-19 08:52:43.259790240 -0700
+@@ -1391,22 +1391,22 @@
+ for the file. Valid values for @var{arch} are:
+
+ @table @asis
+-@samp{native}
++@item @samp{native}
+ The format of the current machine (this is the default).
+
+-@samp{ieee-be}
++@item @samp{ieee-be}
+ IEEE big endian format.
+
+-@samp{ieee-le}
++@item @samp{ieee-le}
+ IEEE little endian format.
+
+-@samp{vaxd}
++@item @samp{vaxd}
+ VAX D floating format.
+
+-@samp{vaxg}
++@item @samp{vaxg}
+ VAX G floating format.
+
+-@samp{cray}
++@item @samp{cray}
+ Cray floating format.
+ @end table
+
+diff -Nur octave-3.6.4.orig/doc/interpreter/octave.texi octave-3.6.4/doc/interpreter/octave.texi
+--- octave-3.6.4.orig/doc/interpreter/octave.texi 2013-02-21 12:19:23.000000000 -0800
++++ octave-3.6.4/doc/interpreter/octave.texi 2013-06-19 08:52:43.259790240 -0700
+@@ -129,7 +129,9 @@
+ @sp 2
+ @multitable @columnfractions 0.4 0.025 0.65
+ @item
+-@flushright @image{octave_logo,2.1in} @end flushright
++@flushright
++@image{octave_logo,2.1in}
++@end flushright
+ @tab
+ @c this is a spacer column
+ @tab
+diff -Nur octave-3.6.4.orig/doc/interpreter/plot.texi octave-3.6.4/doc/interpreter/plot.texi
+--- octave-3.6.4.orig/doc/interpreter/plot.texi 2013-02-21 12:37:52.000000000 -0800
++++ octave-3.6.4/doc/interpreter/plot.texi 2013-06-19 08:52:43.260790204 -0700
+@@ -2707,21 +2707,20 @@
+ Set the data aspect ratio of the current axes. The aspect ratio is
+ a normalized 3-element vector representing the span of the x, y, and
+ z-axes limits.
+-
+-@deftypefnx {Function File} {@var{data_aspect_ratio} =} daspect ( )
++@end deftypefn
++@deftypefn {Function File} {@var{data_aspect_ratio} =} daspect ( )
+ Return the data aspect ratio of the current axes.
+-
+-@deftypefnx {Function File} {} daspect (@var{mode})
++@end deftypefn
++@deftypefn {Function File} {} daspect (@var{mode})
+ Set the data aspect ratio mode of the current axes.
+-
+-@deftypefnx {Function File} {@var{data_aspect_ratio_mode} =} daspect ("mode")
++@end deftypefn
++@deftypefn {Function File} {@var{data_aspect_ratio_mode} =} daspect ("mode")
+ Return the data aspect ratio mode of the current axes.
+-
+-@deftypefnx {Function File} {} daspect (@var{hax}, @dots{})
++@end deftypefn
++@deftypefn {Function File} {} daspect (@var{hax}, @dots{})
+ Use the axes, with handle @var{hax}, instead of the current axes.
+-
+-@seealso{@ref{doc-axis,,axis}, @ref{doc-pbaspect,,pbaspect}, @ref{doc-xlim,,xlim}, @ref{doc-ylim,,ylim}, @ref{doc-zlim,,zlim}}
+ @end deftypefn
++@seealso{@ref{doc-axis,,axis}, @ref{doc-pbaspect,,pbaspect}, @ref{doc-xlim,,xlim}, @ref{doc-ylim,,ylim}, @ref{doc-zlim,,zlim}}
+
+
+ @c pbaspect scripts/plot/pbaspect.m
+@@ -2730,21 +2729,20 @@
+ Set the plot box aspect ratio of the current axes. The aspect ratio
+ is a normalized 3-element vector representing the rendered lengths of
+ the x, y, and z-axes.
+-
+-@deftypefnx {Function File} {@var{plot_box_aspect_ratio} =} pbaspect ( )
++@end deftypefn
++@deftypefn {Function File} {@var{plot_box_aspect_ratio} =} pbaspect ( )
+ Return the plot box aspect ratio of the current axes.
+-
+-@deftypefnx {Function File} {} pbaspect (@var{mode})
++@end deftypefn
++@deftypefn {Function File} {} pbaspect (@var{mode})
+ Set the plot box aspect ratio mode of the current axes.
+-
+-@deftypefnx {Function File} {@var{plot_box_aspect_ratio_mode} =} pbaspect ("mode")
++@end deftypefn
++@deftypefn {Function File} {@var{plot_box_aspect_ratio_mode} =} pbaspect ("mode")
+ Return the plot box aspect ratio mode of the current axes.
+-
+-@deftypefnx {Function File} {} pbaspect (@var{hax}, @dots{})
++@end deftypefn
++@deftypefn {Function File} {} pbaspect (@var{hax}, @dots{})
+ Use the axes, with handle @var{hax}, instead of the current axes.
+-
+-@seealso{@ref{doc-axis,,axis}, @ref{doc-daspect,,daspect}, @ref{doc-xlim,,xlim}, @ref{doc-ylim,,ylim}, @ref{doc-zlim,,zlim}}
+ @end deftypefn
++@seealso{@ref{doc-axis,,axis}, @ref{doc-daspect,,daspect}, @ref{doc-xlim,,xlim}, @ref{doc-ylim,,ylim}, @ref{doc-zlim,,zlim}}
+
+
+ @node Three-dimensional Function Plotting
+@@ -3147,7 +3145,7 @@
+ @item "hide"
+ Hide legend on the plot
+
+-@itemx "toggle"
++@item "toggle"
+ Toggles between "hide" and "show"
+
+ @item "boxon"
+@@ -3162,7 +3160,7 @@
+ @item "right"
+ Place text to the right of the keys
+
+-@itemx "off"
++@item "off"
+ Delete the legend object
+ @end table
+ @end deftypefn
+@@ -4139,11 +4137,11 @@
+ is sent to a file the size is determined by the plot box defined by
+ the figure's "paperposition" property.
+
+-@itemx -append
++@item -append
+ Appends the PS, or PDF output to a pre-existing file of the
+ same type.
+
+-@itemx -r@var{NUM}
++@item -r@var{NUM}
+ Resolution of bitmaps in pixels per inch. For both metafiles and
+ SVG the default is the screen resolution, for other it is 150 dpi.
+ To specify screen resolution, use "-r0".
+@@ -6296,15 +6294,15 @@
+ A character indicating a plot marker to be place at each data point, or
+ @code{"none"}, meaning no markers should be displayed.
+
+-@itemx markeredgecolor
++@item markeredgecolor
+ The color of the edge around the marker, or @code{"auto"}, meaning that
+ the edge color is the same as the face color. @xref{Colors}.
+
+-@itemx markerfacecolor
++@item markerfacecolor
+ The color of the marker, or @code{"none"} to indicate that the marker
+ should not be filled. @xref{Colors}.
+
+-@itemx markersize
++@item markersize
+ A number specifying the size of the marker. The default is 1. A value
+ of 2 is twice as large as the default, etc.
+ @end table
+@@ -6442,7 +6440,8 @@
+ @deftypefn {Function File} {@var{value} =} getappdata (@var{h}, @var{name})
+ Return the @var{value} for named application data for the object(s) with
+ handle(s) @var{h}.
+-@deftypefnx {Function File} {@var{appdata} =} getappdata (@var{h})
++@end deftypefn
++@deftypefn {Function File} {@var{appdata} =} getappdata (@var{h})
+ Return a structure, @var{appdata}, whose fields correspond to the appdata
+ properties.
+ @end deftypefn
+diff -Nur octave-3.6.4.orig/doc/interpreter/poly.texi octave-3.6.4/doc/interpreter/poly.texi
+--- octave-3.6.4.orig/doc/interpreter/poly.texi 2013-02-21 12:37:52.000000000 -0800
++++ octave-3.6.4/doc/interpreter/poly.texi 2013-06-19 08:52:43.260790204 -0700
+@@ -82,8 +82,8 @@
+ (@var{x}-@var{mu}(1))/@var{mu}(2).
+ If @var{x} is a vector or matrix, the polynomial is evaluated for each of
+ the elements of @var{x}.
+-
+-@deftypefnx {Function File} {[@var{y}, @var{dy}] =} polyval (@var{p}, @var{x}, @var{s})
++@end deftypefn
++@deftypefn {Function File} {[@var{y}, @var{dy}] =} polyval (@var{p}, @var{x}, @var{s})
+ @deftypefnx {Function File} {[@var{y}, @var{dy}] =} polyval (@var{p}, @var{x}, @var{s}, @var{mu})
+ In addition to evaluating the polynomial, the second output
+ represents the prediction interval, @var{y} +/- @var{dy}, which
+diff -Nur octave-3.6.4.orig/doc/interpreter/set.texi octave-3.6.4/doc/interpreter/set.texi
+--- octave-3.6.4.orig/doc/interpreter/set.texi 2013-02-21 12:37:52.000000000 -0800
++++ octave-3.6.4/doc/interpreter/set.texi 2013-06-19 08:52:43.260790204 -0700
+@@ -150,8 +150,9 @@
+ 3 4
+ @end group
+ @end example
++@end deftypefn
+
+-@deftypefnx {Function File} {[@var{c}, @var{ia}, @var{ib}] =} union (@var{a}, @var{b})
++@deftypefn {Function File} {[@var{c}, @var{ia}, @var{ib}] =} union (@var{a}, @var{b})
+
+ Return index vectors @var{ia} and @var{ib} such that @code{a(ia)} and
+ @code{b(ib)} are disjoint sets whose union is @var{c}.
+diff -Nur octave-3.6.4.orig/doc/interpreter/signal.texi octave-3.6.4/doc/interpreter/signal.texi
+--- octave-3.6.4.orig/doc/interpreter/signal.texi 2013-02-21 12:37:52.000000000 -0800
++++ octave-3.6.4/doc/interpreter/signal.texi 2013-06-19 08:52:43.261790169 -0700
+@@ -454,17 +454,17 @@
+
+ For fastest computation, @var{n} should factor into a small number of
+ small primes.
+-
+-@deftypefnx {Function File} {@var{h} =} freqz (@var{b}, @var{a}, @var{w})
++@end deftypefn
++@deftypefn {Function File} {@var{h} =} freqz (@var{b}, @var{a}, @var{w})
+ Evaluate the response at the specific frequencies in the vector @var{w}.
+ The values for @var{w} are measured in radians.
+-
+-@deftypefnx {Function File} {[@dots{}] =} freqz (@dots{}, @var{Fs})
++@end deftypefn
++@deftypefn {Function File} {[@dots{}] =} freqz (@dots{}, @var{Fs})
+ Return frequencies in Hz instead of radians assuming a sampling rate
+ @var{Fs}. If you are evaluating the response at specific frequencies
+ @var{w}, those frequencies should be requested in Hz rather than radians.
+-
+-@deftypefnx {Function File} {} freqz (@dots{})
++@end deftypefn
++@deftypefn {Function File} {} freqz (@dots{})
+ Plot the pass band, stop band and phase response of @var{h} rather
+ than returning them.
+ @end deftypefn
+diff -Nur octave-3.6.4.orig/doc/interpreter/strings.texi octave-3.6.4/doc/interpreter/strings.texi
+--- octave-3.6.4.orig/doc/interpreter/strings.texi 2013-02-21 12:37:52.000000000 -0800
++++ octave-3.6.4/doc/interpreter/strings.texi 2013-06-19 08:52:43.261790169 -0700
+@@ -1136,7 +1136,7 @@
+ @item %s
+ The word is parsed as a string.
+
+-@itemx %f
++@item %f
+ @itemx %n
+ The word is parsed as a number and converted to double.
+
+diff -Nur octave-3.6.4.orig/doc/interpreter/system.texi octave-3.6.4/doc/interpreter/system.texi
+--- octave-3.6.4.orig/doc/interpreter/system.texi 2013-02-21 12:37:52.000000000 -0800
++++ octave-3.6.4/doc/interpreter/system.texi 2013-06-19 08:52:43.261790169 -0700
+@@ -839,7 +839,7 @@
+ @deftypefnx {Function File} {} datetick (@var{axis}, @var{form})
+ @deftypefnx {Function File} {} datetick (@dots{}, "keeplimits")
+ @deftypefnx {Function File} {} datetick (@dots{}, "keepticks")
+-@deftypefnx {Function File} {} datetick (@dots{ax}, @dots{})
++@comment @deftypefnx {Function File} {} datetick (@dots{ax}, @dots{})
+ Add date formatted tick labels to an axis. The axis the apply the
+ ticks to is determined by @var{axis} that can take the values "x",
+ "y" or "z". The default value is "x". The formatting of the labels is
+@@ -1261,9 +1261,10 @@
+ interpreted as filename globbing patterns (as they are used by Unix shells).
+ Within a pattern
+ @table @code
+-@itemx *
++
++@item *
+ matches any string, including the null string,
+-@itemx ?
++@item ?
+ matches any single character, and
+
+ @item [@dots{}]
+@@ -2789,8 +2790,8 @@
+ Display a header containing the current Octave version number, license
+ string and operating system, followed by the installed package names,
+ versions, and installation directories.
+-
+-@deftypefnx {Function File} {v =} ver ()
++@end deftypefn
++@deftypefn {Function File} {v =} ver ()
+ Return a vector of structures, respecting Octave and each installed package.
+ The structure includes the following fields.
+
+@@ -2807,11 +2808,11 @@
+ @item Date
+ Date respecting the version/revision.
+ @end table
+-
+-@deftypefnx {Function File} {v =} ver ("Octave")
++@end deftypefn
++@deftypefn {Function File} {v =} ver ("Octave")
+ Return version information for Octave only.
+-
+-@deftypefnx {Function File} {v =} ver (@var{package})
++@end deftypefn
++@deftypefn {Function File} {v =} ver (@var{package})
+ Return version information for @var{package}.
+
+ @seealso{@ref{doc-version,,version}, @ref{doc-octave_config_info,,octave_config_info}}
+@@ -2878,19 +2879,19 @@
+ @anchor{doc-license}
+ @deftypefn {Function File} {} license
+ Display the license of Octave.
+-
+-@deftypefnx {Function File} {} license ("inuse")
++@end deftypefn
++@deftypefn {Function File} {} license ("inuse")
+ Display a list of packages currently being used.
+-
+-@deftypefnx {Function File} {@var{retval} =} license ("inuse")
++@end deftypefn
++@deftypefn {Function File} {@var{retval} =} license ("inuse")
+ Return a structure containing the fields @code{feature} and @code{user}.
+-
+-@deftypefnx {Function File} {@var{retval} =} license ("test", @var{feature})
++@end deftypefn
++@deftypefn {Function File} {@var{retval} =} license ("test", @var{feature})
+ Return 1 if a license exists for the product identified by the string
+ @var{feature} and 0 otherwise. The argument @var{feature} is case
+ insensitive and only the first 27 characters are checked.
+-
+-@deftypefnx {Function File} {} license ("test", @var{feature}, @var{toggle})
++@end deftypefn
++@deftypefn {Function File} {} license ("test", @var{feature}, @var{toggle})
+ Enable or disable license testing for @var{feature}, depending on
+ @var{toggle}, which may be one of:
+
+@@ -2902,8 +2903,8 @@
+ @item "disable"
+ Future tests for the specified license of @var{feature} return 0.
+ @end table
+-
+-@deftypefnx {Function File} {@var{retval} =} license ("checkout", @var{feature})
++@end deftypefn
++@deftypefn {Function File} {@var{retval} =} license ("checkout", @var{feature})
+ Check out a license for @var{feature}, returning 1 on success and 0
+ on failure.
+
+diff -Nur octave-3.6.4.orig/doc/liboctave/liboctave.texi octave-3.6.4/doc/liboctave/liboctave.texi
+--- octave-3.6.4.orig/doc/liboctave/liboctave.texi 2013-02-21 12:19:23.000000000 -0800
++++ octave-3.6.4/doc/liboctave/liboctave.texi 2013-06-19 08:54:27.914379692 -0700
+@@ -80,10 +80,10 @@
+ @end ifnottex
+
+ @titlepage
+-@title{Octave C++ Classes}
+-@subtitle{Edition 1.0 for Octave version @value{VERSION}}
+-@subtitle{September 1993}
+-@author{John W. Eaton}
++@title@{Octave C++ Classes@}
++@subtitle@{Edition 1.0 for Octave version @value{VERSION}@}
++@subtitle@{September 1993@}
++@author@{John W. Eaton@}
+ @page
+ @vskip 0pt plus 1filll
+ Copyright @copyright{} 1996, 1997 John W. Eaton.
diff --git a/sci-mathematics/octave/files/octave-3.8.0-disable-getcwd-path-max-test-as-it-is-too-slow.patch b/sci-mathematics/octave/files/octave-3.8.0-disable-getcwd-path-max-test-as-it-is-too-slow.patch
new file mode 100644
index 000000000000..135330d2f45a
--- /dev/null
+++ b/sci-mathematics/octave/files/octave-3.8.0-disable-getcwd-path-max-test-as-it-is-too-slow.patch
@@ -0,0 +1,11 @@
+--- octave-3.8.0-orig/m4/getcwd.m4 2013-12-28 09:00:39.000000000 +1100
++++ octave-3.8.0/m4/getcwd.m4 2014-02-15 13:11:06.783512435 +1100
+@@ -108,7 +108,7 @@
+
+ gl_abort_bug=no
+ case "$host_os" in
+- mingw*)
++ *-gnu* | gnu* | mingw*)
+ gl_cv_func_getcwd_path_max=yes
+ ;;
+ *)
diff --git a/sci-mathematics/octave/files/octave-3.8.0-fix-compile.patch b/sci-mathematics/octave/files/octave-3.8.0-fix-compile.patch
new file mode 100644
index 000000000000..72931ee66283
--- /dev/null
+++ b/sci-mathematics/octave/files/octave-3.8.0-fix-compile.patch
@@ -0,0 +1,11 @@
+--- octave-3.8.0-orig/libinterp/corefcn/jit-typeinfo.cc 2013-12-28 08:57:41.000000000 +1100
++++ octave-3.8.0/libinterp/corefcn/jit-typeinfo.cc 2014-02-14 15:45:47.388031654 +1100
+@@ -872,7 +872,7 @@
+ jit_operation::to_idx (const std::vector<jit_type*>& types) const
+ {
+ octave_idx_type numel = types.size ();
+- numel = std::max (2, numel);
++ numel = std::max (static_cast<octave_idx_type>(2), numel);
+
+ Array<octave_idx_type> idx (dim_vector (1, numel));
+ for (octave_idx_type i = 0; i < static_cast<octave_idx_type> (types.size ());
diff --git a/sci-mathematics/octave/files/octave-3.8.0-imagemagick-configure.patch b/sci-mathematics/octave/files/octave-3.8.0-imagemagick-configure.patch
new file mode 100644
index 000000000000..1406237fea44
--- /dev/null
+++ b/sci-mathematics/octave/files/octave-3.8.0-imagemagick-configure.patch
@@ -0,0 +1,16 @@
+--- octave-3.8.0-orig/configure.ac 2013-12-28 08:58:28.000000000 +1100
++++ octave-3.8.0/configure.ac 2014-02-15 20:11:53.821172574 +1100
+@@ -995,11 +995,11 @@
+ MAGICK_LIBS=
+
+ PKG_CHECK_EXISTS([$magick++], [
+- ## Make sure we only get -I, -L, and -l flags. Some Graphics/ImageMagick++
++ ## Make sure we only get -I, -D, -L, and -l flags. Some Graphics/ImageMagick++
+ ## packages add extra flags that are useful when building
+ ## Graphics/ImageMagick++ extentions. These extra flags break the
+ ## Octave build.
+- MAGICK_CPPFLAGS=`$PKG_CONFIG --cflags-only-I $magick++`
++ MAGICK_CPPFLAGS=`$PKG_CONFIG --cflags $magick++ | sed -e 's/\(-@<:@DI@:>@@<:@^ \t@:>@*\)\|\(-@<:@^ \t@:>@*\)/\1/g'`
+ MAGICK_LDFLAGS=`$PKG_CONFIG --libs-only-L $magick++`
+ MAGICK_LIBS=`$PKG_CONFIG --libs-only-l $magick++`
+
diff --git a/sci-mathematics/octave/files/octave-3.8.0-llvm-3.4.patch b/sci-mathematics/octave/files/octave-3.8.0-llvm-3.4.patch
new file mode 100644
index 000000000000..63c5303d13c7
--- /dev/null
+++ b/sci-mathematics/octave/files/octave-3.8.0-llvm-3.4.patch
@@ -0,0 +1,63 @@
+diff -aur octave-3.8.0/libinterp/corefcn/jit-util.h octave-3.8.0.fix/libinterp/corefcn/jit-util.h
+--- octave-3.8.0/libinterp/corefcn/jit-util.h 2013-12-27 15:57:41.000000000 -0600
++++ octave-3.8.0.fix/libinterp/corefcn/jit-util.h 2014-01-16 17:06:47.512782643 -0600
+@@ -42,8 +42,10 @@
+ {
+ class Value;
+ class Module;
+- class FunctionPassManager;
+- class PassManager;
++ namespace legacy {
++ class FunctionPassManager;
++ class PassManager;
++ }
+ class ExecutionEngine;
+ class Function;
+ class BasicBlock;
+diff -aur octave-3.8.0/libinterp/corefcn/pt-jit.cc octave-3.8.0.fix/libinterp/corefcn/pt-jit.cc
+--- octave-3.8.0/libinterp/corefcn/pt-jit.cc 2013-12-27 15:58:17.000000000 -0600
++++ octave-3.8.0.fix/libinterp/corefcn/pt-jit.cc 2014-01-16 17:08:28.030924785 -0600
+@@ -52,7 +52,7 @@
+ #include <llvm/Bitcode/ReaderWriter.h>
+ #include <llvm/ExecutionEngine/ExecutionEngine.h>
+ #include <llvm/ExecutionEngine/JIT.h>
+-#include <llvm/PassManager.h>
++#include <llvm/IR/LegacyPassManager.h>
+
+ #ifdef HAVE_LLVM_IR_FUNCTION_H
+ #include <llvm/IR/LLVMContext.h>
+@@ -1888,10 +1888,10 @@
+ if (! engine)
+ return false;
+
+- module_pass_manager = new llvm::PassManager ();
++ module_pass_manager = new llvm::legacy::PassManager ();
+ module_pass_manager->add (llvm::createAlwaysInlinerPass ());
+
+- pass_manager = new llvm::FunctionPassManager (module);
++ pass_manager = new llvm::legacy::FunctionPassManager (module);
+ #ifdef HAVE_LLVM_DATALAYOUT
+ pass_manager->add (new llvm::DataLayout (*engine->getDataLayout ()));
+ #else
+@@ -2007,7 +2007,7 @@
+ {
+ std::string error;
+ llvm::raw_fd_ostream fout ("test.bc", error,
+- llvm::raw_fd_ostream::F_Binary);
++ llvm::sys::fs::F_Binary);
+ llvm::WriteBitcodeToFile (module, fout);
+ }
+ }
+diff -aur octave-3.8.0/libinterp/corefcn/pt-jit.h octave-3.8.0.fix/libinterp/corefcn/pt-jit.h
+--- octave-3.8.0/libinterp/corefcn/pt-jit.h 2013-12-27 15:58:17.000000000 -0600
++++ octave-3.8.0.fix/libinterp/corefcn/pt-jit.h 2014-01-16 17:05:08.224619116 -0600
+@@ -384,8 +384,8 @@
+ size_t trip_count (const octave_value& bounds) const;
+
+ llvm::Module *module;
+- llvm::PassManager *module_pass_manager;
+- llvm::FunctionPassManager *pass_manager;
++ llvm::legacy::PassManager *module_pass_manager;
++ llvm::legacy::FunctionPassManager *pass_manager;
+ llvm::ExecutionEngine *engine;
+ };
diff --git a/sci-mathematics/octave/files/octave-3.8.0-llvm-configure.patch b/sci-mathematics/octave/files/octave-3.8.0-llvm-configure.patch
new file mode 100644
index 000000000000..82c6c1458093
--- /dev/null
+++ b/sci-mathematics/octave/files/octave-3.8.0-llvm-configure.patch
@@ -0,0 +1,12 @@
+--- octave-3.8.0-orig/configure.ac 2013-12-28 08:58:28.000000000 +1100
++++ octave-3.8.0/configure.ac 2014-02-15 20:51:21.431570121 +1100
+@@ -805,7 +805,8 @@
+ dnl Use -isystem so we don't get warnings from llvm headers
+ LLVM_CPPFLAGS="$LLVM_INCLUDE_FLAG `$LLVM_CONFIG --includedir`"
+ LLVM_CXXFLAGS=
+- LLVM_LDFLAGS="-L`$LLVM_CONFIG --libdir`"
++ dnl If llvm-config --ldflags has -L ending with /llvm then specify this directory with -R
++ LLVM_LDFLAGS="`$LLVM_CONFIG --ldflags | sed -e 's/-L\(@<:@^ \t@:>@*\/llvm\)/-L\1 -R\1/' -e 's/-@<:@^LR@:>@.*@<:@ \t@:>@//g'`"
+
+
+ LDFLAGS="$LDFLAGS $LLVM_LDFLAGS"
diff --git a/sci-mathematics/octave/files/octave-3.8.0-pkgbuilddir.patch b/sci-mathematics/octave/files/octave-3.8.0-pkgbuilddir.patch
new file mode 100644
index 000000000000..983f6b54ac57
--- /dev/null
+++ b/sci-mathematics/octave/files/octave-3.8.0-pkgbuilddir.patch
@@ -0,0 +1,40 @@
+--- octave-3.8.0-orig/scripts/pkg/private/install.m 2013-12-28 08:57:42.000000000 +1100
++++ octave-3.8.0/scripts/pkg/private/install.m 2014-02-10 00:59:40.747194765 +1100
+@@ -63,6 +63,14 @@
+ tgz = files{i};
+
+ if (exist (tgz, "file"))
++ ## The filename pointed to an uncompressed package to begin with.
++ if (exist (tgz, "dir"))
++ if (tgz(1) == '/')
++ packdir = tgz;
++ else
++ packdir = fullfile (pwd(), tgz);
++ endif
++ elseif (exist (tgz, "file"))
+ ## Create a temporary directory.
+ tmpdir = tmpnam ();
+ tmpdirs{end+1} = tmpdir;
+@@ -89,20 +97,12 @@
+ if (length (dirlist) > 3)
+ error ("bundles of packages are not allowed");
+ endif
+- endif
+
+- ## The filename pointed to an uncompressed package to begin with.
+- if (exist (tgz, "dir"))
+- dirlist = {".", "..", tgz};
++ ## The two first entries of dirlist are "." and "..".
++ packdir = fullfile (tmpdir, dirlist{3});
+ endif
+
+ if (exist (tgz, "file") || exist (tgz, "dir"))
+- ## The two first entries of dirlist are "." and "..".
+- if (exist (tgz, "file"))
+- packdir = fullfile (tmpdir, dirlist{3});
+- else
+- packdir = fullfile (pwd (), dirlist{3});
+- endif
+ packdirs{end+1} = packdir;
+
+ ## Make sure the package contains necessary files.
diff --git a/sci-mathematics/octave/files/octave-3.8.1-imagemagick.patch b/sci-mathematics/octave/files/octave-3.8.1-imagemagick.patch
new file mode 100644
index 000000000000..f3415505dffb
--- /dev/null
+++ b/sci-mathematics/octave/files/octave-3.8.1-imagemagick.patch
@@ -0,0 +1,138 @@
+--- octave-3.8.1-orig/libinterp/dldfcn/__magick_read__.cc 2014-03-07 06:37:51.000000000 +1100
++++ octave-3.8.1/libinterp/dldfcn/__magick_read__.cc 2014-03-09 00:18:04.593088077 +1100
+@@ -38,8 +38,15 @@
+ #include "gripes.h"
+
+ #ifdef HAVE_MAGICK
+-
++#define MAGICKCORE_EXCLUDE_DEPRECATED 1
+ #include <Magick++.h>
++#if !defined(QuantumRange) && defined(MaxRGB)
++#define QuantumRange MaxRGB
++#endif
++#if !defined(MAGICKCORE_QUANTUM_DEPTH) && defined(QuantumDepth)
++#define MAGICKCORE_QUANTUM_DEPTH QuantumDepth
++#endif
++
+ #include <clocale>
+
+ // In theory, it should be enough to check the class:
+@@ -104,12 +111,18 @@
+ get_depth (Magick::Image& img)
+ {
+ octave_idx_type depth = img.depth ();
++#if defined(MagickLibVersion) && (MagickLibVersion <= 0x686)
++#define Magick MagickCore
++#endif
+ if (depth == 8
+ && img.channelDepth (Magick::RedChannel) == 1
+ && img.channelDepth (Magick::CyanChannel) == 1
+ && img.channelDepth (Magick::OpacityChannel) == 1
+ && img.channelDepth (Magick::GrayChannel) == 1)
+ depth = 1;
++#if defined(MagickLibVersion) && (MagickLibVersion <= 0x686)
++#undef Magick
++#endif
+
+ return depth;
+ }
+@@ -332,7 +345,10 @@
+ if (imvec[def_elem].depth () == 32)
+ divisor = std::numeric_limits<uint32_t>::max ();
+ else
+- divisor = MaxRGB / ((uint64_t (1) << imvec[def_elem].depth ()) - 1);
++ {
++ using namespace Magick;
++ divisor = QuantumRange / ((uint64_t (1) << imvec[def_elem].depth ()) - 1);
++ }
+
+ // FIXME: this workaround should probably be fixed in GM by creating a
+ // new ImageType BilevelMatteType
+@@ -464,7 +480,8 @@
+ for (octave_idx_type row = 0; row < nRows; row++)
+ {
+ img_fvec[idx] = pix->red / divisor;
+- a_fvec[idx] = (MaxRGB - pix->opacity) / divisor;
++ using namespace Magick;
++ a_fvec[idx] = (QuantumRange - pix->opacity) / divisor;
+ pix += row_shift;
+ idx++;
+ }
+@@ -541,7 +558,8 @@
+ rbuf[idx] = pix->red / divisor;
+ gbuf[idx] = pix->green / divisor;
+ bbuf[idx] = pix->blue / divisor;
+- a_fvec[a_idx++] = (MaxRGB - pix->opacity) / divisor;
++ using namespace Magick;
++ a_fvec[a_idx++] = (QuantumRange - pix->opacity) / divisor;
+ pix += row_shift;
+ idx++;
+ }
+@@ -626,7 +644,8 @@
+ mbuf[idx] = pix->green / divisor;
+ ybuf[idx] = pix->blue / divisor;
+ kbuf[idx] = pix->opacity / divisor;
+- a_fvec[a_idx++] = (MaxRGB - *apix) / divisor;
++ using namespace Magick;
++ a_fvec[a_idx++] = (QuantumRange - *apix) / divisor;
+ pix += row_shift;
+ idx++;
+ }
+@@ -685,9 +704,10 @@
+ // Restore locale from before GraphicsMagick initialisation
+ setlocale (LC_ALL, locale.c_str ());
+
+- if (QuantumDepth < 32)
++ using namespace Magick;
++ if (MAGICKCORE_QUANTUM_DEPTH < 32)
+ warning ("your version of %s limits images to %d bits per pixel",
+- MagickPackageName, QuantumDepth);
++ MagickPackageName, MAGICKCORE_QUANTUM_DEPTH);
+
+ initialized = true;
+ }
+@@ -1060,8 +1080,9 @@
+ // From GM documentation:
+ // Color arguments are must be scaled to fit the Quantum size according to
+ // the range of MaxRGB
++ using namespace Magick;
+ const double divisor = static_cast<double>((uint64_t (1) << bitdepth) - 1)
+- / MaxRGB;
++ / QuantumRange;
+
+ const P *img_fvec = img.fortran_vec ();
+ const P *a_fvec = alpha.fortran_vec ();
+@@ -1111,8 +1132,9 @@
+ for (octave_idx_type row = 0; row < nRows; row++)
+ {
+ double grey = double (*img_fvec) / divisor;
++ using namespace Magick;
+ Magick::Color c (grey, grey, grey,
+- MaxRGB - (double (*a_fvec) / divisor));
++ QuantumRange - (double (*a_fvec) / divisor));
+ pix[GM_idx] = c;
+ img_fvec++;
+ a_fvec++;
+@@ -1178,10 +1200,11 @@
+ {
+ for (octave_idx_type row = 0; row < nRows; row++)
+ {
++ using namespace Magick;
+ Magick::Color c (double (*img_fvec) / divisor,
+ double (img_fvec[G_offset]) / divisor,
+ double (img_fvec[B_offset]) / divisor,
+- MaxRGB - (double (*a_fvec) / divisor));
++ QuantumRange - (double (*a_fvec) / divisor));
+ pix[GM_idx] = c;
+ img_fvec++;
+ a_fvec++;
+@@ -1257,7 +1280,8 @@
+ double (img_fvec[Y_offset]) / divisor,
+ double (img_fvec[K_offset]) / divisor);
+ pix[GM_idx] = c;
+- ind[GM_idx] = MaxRGB - (double (*a_fvec) / divisor);
++ using namespace Magick;
++ ind[GM_idx] = QuantumRange - (double (*a_fvec) / divisor);
+ img_fvec++;
+ a_fvec++;
+ GM_idx += nCols;
diff --git a/sci-mathematics/octave/files/octave-3.8.1-pkgbuilddir.patch b/sci-mathematics/octave/files/octave-3.8.1-pkgbuilddir.patch
new file mode 100644
index 000000000000..98fe3d5e8eed
--- /dev/null
+++ b/sci-mathematics/octave/files/octave-3.8.1-pkgbuilddir.patch
@@ -0,0 +1,41 @@
+--- scripts/pkg/private/install.m.orig 2014-04-15 08:45:55.487258887 -0700
++++ scripts/pkg/private/install.m 2014-04-15 12:12:40.985606248 -0700
+@@ -62,7 +62,14 @@
+ for i = 1:length (files)
+ tgz = files{i};
+
+- if (exist (tgz, "file"))
++ ## The filename pointed to an uncompressed package to begin with.
++ if (exist (tgz, "dir"))
++ if (tgz(1) == '/')
++ packdir = tgz;
++ else
++ packdir = fullfile (pwd(), tgz);
++ endif
++ elseif (exist (tgz, "file"))
+ ## Create a temporary directory.
+ tmpdir = tmpnam ();
+ tmpdirs{end+1} = tmpdir;
+@@ -89,20 +96,12 @@
+ if (length (dirlist) > 3)
+ error ("bundles of packages are not allowed");
+ endif
+- endif
+
+- ## The filename pointed to an uncompressed package to begin with.
+- if (exist (tgz, "dir"))
+- dirlist = {".", "..", tgz};
++ ## The two first entries of dirlist are "." and "..".
++ packdir = fullfile (tmpdir, dirlist{3});
+ endif
+
+ if (exist (tgz, "file") || exist (tgz, "dir"))
+- ## The two first entries of dirlist are "." and "..".
+- if (exist (tgz, "file"))
+- packdir = fullfile (tmpdir, dirlist{3});
+- else
+- packdir = fullfile (pwd (), dirlist{3});
+- endif
+ packdirs{end+1} = packdir;
+
+ ## Make sure the package contains necessary files.
diff --git a/sci-mathematics/octave/files/octave-4.0.0-imagemagick-configure.patch b/sci-mathematics/octave/files/octave-4.0.0-imagemagick-configure.patch
new file mode 100644
index 000000000000..4e88ac07b13a
--- /dev/null
+++ b/sci-mathematics/octave/files/octave-4.0.0-imagemagick-configure.patch
@@ -0,0 +1,16 @@
+--- octave-4.0.0-orig/configure.ac 2015-05-27 02:16:39.000000000 +1000
++++ octave-4.0.0/configure.ac 2015-07-06 18:11:43.461136517 +1000
+@@ -1086,11 +1086,11 @@
+ MAGICK_LIBS=
+
+ PKG_CHECK_EXISTS([$magick++], [
+- ## Make sure we only get -I, -L, and -l flags. Some Graphics/ImageMagick++
++ ## Make sure we only get -I, -D, -L, and -l flags. Some Graphics/ImageMagick++
+ ## packages add extra flags that are useful when building
+ ## Graphics/ImageMagick++ extentions. These extra flags break the
+ ## Octave build.
+- MAGICK_CPPFLAGS=`$PKG_CONFIG --cflags-only-I $magick++`
++ MAGICK_CPPFLAGS=`$PKG_CONFIG --cflags $magick++ | sed -e 's/\(-@<:@DI@:>@@<:@^ \t@:>@*\)\|\(-@<:@^ \t@:>@*\)/\1/g'`
+ MAGICK_LDFLAGS=`$PKG_CONFIG --libs-only-L $magick++`
+ MAGICK_LIBS=`$PKG_CONFIG --libs-only-l $magick++`
+
diff --git a/sci-mathematics/octave/files/octave-4.0.0-imagemagick.patch b/sci-mathematics/octave/files/octave-4.0.0-imagemagick.patch
new file mode 100644
index 000000000000..9e3689176cbd
--- /dev/null
+++ b/sci-mathematics/octave/files/octave-4.0.0-imagemagick.patch
@@ -0,0 +1,139 @@
+--- octave-4.0.0-orig/libinterp/dldfcn/__magick_read__.cc 2015-05-24 00:21:53.000000000 +1000
++++ octave-4.0.0/libinterp/dldfcn/__magick_read__.cc 2015-07-06 18:17:52.263146804 +1000
+@@ -38,8 +38,15 @@
+ #include "gripes.h"
+
+ #ifdef HAVE_MAGICK
+-
++#define MAGICKCORE_EXCLUDE_DEPRECATED 1
+ #include <Magick++.h>
++#if !defined(QuantumRange) && defined(MaxRGB)
++#define QuantumRange MaxRGB
++#endif
++#if !defined(MAGICKCORE_QUANTUM_DEPTH) && defined(QuantumDepth)
++#define MAGICKCORE_QUANTUM_DEPTH QuantumDepth
++#endif
++
+ #include <clocale>
+
+ // In theory, it should be enough to check the class:
+@@ -121,12 +128,18 @@
+ get_depth (Magick::Image& img)
+ {
+ octave_idx_type depth = img.depth ();
++#if defined(MagickLibVersion) && (MagickLibVersion <= 0x686)
++#define Magick MagickCore
++#endif
+ if (depth == 8
+ && img.channelDepth (Magick::RedChannel) == 1
+ && img.channelDepth (Magick::CyanChannel) == 1
+ && img.channelDepth (Magick::OpacityChannel) == 1
+ && img.channelDepth (Magick::GrayChannel) == 1)
+ depth = 1;
++#if defined(MagickLibVersion) && (MagickLibVersion <= 0x686)
++#undef Magick
++#endif
+
+ return depth;
+ }
+@@ -350,7 +363,10 @@
+ if (imvec[def_elem].depth () == 32)
+ divisor = std::numeric_limits<uint32_t>::max ();
+ else
+- divisor = MaxRGB / ((uint64_t (1) << imvec[def_elem].depth ()) - 1);
++ {
++ using namespace Magick;
++ divisor = QuantumRange / ((uint64_t (1) << imvec[def_elem].depth ()) - 1);
++ }
+
+ // FIXME: this workaround should probably be fixed in GM by creating a
+ // new ImageType BilevelMatteType
+@@ -484,7 +500,8 @@
+ for (octave_idx_type row = 0; row < nRows; row++)
+ {
+ img_fvec[idx] = pix->red / divisor;
+- a_fvec[idx] = (MaxRGB - pix->opacity) / divisor;
++ using namespace Magick;
++ a_fvec[idx] = (QuantumRange - pix->opacity) / divisor;
+ pix += row_shift;
+ idx++;
+ }
+@@ -563,7 +580,8 @@
+ rbuf[idx] = pix->red / divisor;
+ gbuf[idx] = pix->green / divisor;
+ bbuf[idx] = pix->blue / divisor;
+- a_fvec[a_idx++] = (MaxRGB - pix->opacity) / divisor;
++ using namespace Magick;
++ a_fvec[a_idx++] = (QuantumRange - pix->opacity) / divisor;
+ pix += row_shift;
+ idx++;
+ }
+@@ -650,7 +668,8 @@
+ mbuf[idx] = pix->green / divisor;
+ ybuf[idx] = pix->blue / divisor;
+ kbuf[idx] = pix->opacity / divisor;
+- a_fvec[a_idx++] = (MaxRGB - *apix) / divisor;
++ using namespace Magick;
++ a_fvec[a_idx++] = (QuantumRange - *apix) / divisor;
+ pix += row_shift;
+ idx++;
+ }
+@@ -709,10 +728,11 @@
+ // Restore locale from before GraphicsMagick initialisation
+ setlocale (LC_ALL, locale.c_str ());
+
+- if (QuantumDepth < 32)
++ using namespace Magick;
++ if (MAGICKCORE_QUANTUM_DEPTH < 32)
+ warning_with_id ("Octave:GraphicsMagic-Quantum-Depth",
+ "your version of %s limits images to %d bits per pixel",
+- MagickPackageName, QuantumDepth);
++ MagickPackageName, MAGICKCORE_QUANTUM_DEPTH);
+
+ initialized = true;
+ }
+@@ -1087,8 +1107,9 @@
+ // From GM documentation:
+ // Color arguments are must be scaled to fit the Quantum size according to
+ // the range of MaxRGB
++ using namespace Magick;
+ const double divisor = static_cast<double>((uint64_t (1) << bitdepth) - 1)
+- / MaxRGB;
++ / QuantumRange;
+
+ const P *img_fvec = img.fortran_vec ();
+ const P *a_fvec = alpha.fortran_vec ();
+@@ -1140,8 +1161,9 @@
+ for (octave_idx_type row = 0; row < nRows; row++)
+ {
+ double grey = double (*img_fvec) / divisor;
++ using namespace Magick;
+ Magick::Color c (grey, grey, grey,
+- MaxRGB - (double (*a_fvec) / divisor));
++ QuantumRange - (double (*a_fvec) / divisor));
+ pix[GM_idx] = c;
+ img_fvec++;
+ a_fvec++;
+@@ -1209,10 +1231,11 @@
+ {
+ for (octave_idx_type row = 0; row < nRows; row++)
+ {
++ using namespace Magick;
+ Magick::Color c (double (*img_fvec) / divisor,
+ double (img_fvec[G_offset]) / divisor,
+ double (img_fvec[B_offset]) / divisor,
+- MaxRGB - (double (*a_fvec) / divisor));
++ QuantumRange - (double (*a_fvec) / divisor));
+ pix[GM_idx] = c;
+ img_fvec++;
+ a_fvec++;
+@@ -1290,7 +1313,8 @@
+ double (img_fvec[Y_offset]) / divisor,
+ double (img_fvec[K_offset]) / divisor);
+ pix[GM_idx] = c;
+- ind[GM_idx] = MaxRGB - (double (*a_fvec) / divisor);
++ using namespace Magick;
++ ind[GM_idx] = QuantumRange - (double (*a_fvec) / divisor);
+ img_fvec++;
+ a_fvec++;
+ GM_idx += nCols;
diff --git a/sci-mathematics/octave/files/octave-4.0.0-llvm-3.5-gnulib-hg.patch b/sci-mathematics/octave/files/octave-4.0.0-llvm-3.5-gnulib-hg.patch
new file mode 100644
index 000000000000..e74d123b6418
--- /dev/null
+++ b/sci-mathematics/octave/files/octave-4.0.0-llvm-3.5-gnulib-hg.patch
@@ -0,0 +1,19 @@
+diff -r 7f19e7f2afa2 lib/stddef.in.h
+--- a/libgnu/stddef.in.h Sat Feb 21 06:19:32 2015 -0800
++++ b/libgnu/stddef.in.h Fri May 01 06:01:06 2015 +0200
+@@ -82,6 +82,7 @@
+ #endif
+
+ /* Some platforms lack max_align_t. */
++#ifndef _GCC_MAX_ALIGN_T
+ #if !@HAVE_MAX_ALIGN_T@
+ typedef union
+ {
+@@ -91,6 +92,7 @@
+ long int __i;
+ } max_align_t;
+ #endif
++#endif
+
+ # endif /* _@GUARD_PREFIX@_STDDEF_H */
+ # endif /* _@GUARD_PREFIX@_STDDEF_H */
diff --git a/sci-mathematics/octave/files/octave-4.0.0-llvm-3.5.patch b/sci-mathematics/octave/files/octave-4.0.0-llvm-3.5.patch
new file mode 100644
index 000000000000..31b1bed74e2d
--- /dev/null
+++ b/sci-mathematics/octave/files/octave-4.0.0-llvm-3.5.patch
@@ -0,0 +1,130 @@
+diff -r 3797df921988 configure.ac
+--- a/configure.ac Wed Apr 29 17:09:24 2015 -0700
++++ b/configure.ac Sun May 03 22:48:56 2015 +0200
+@@ -815,8 +815,13 @@
+ AC_MSG_NOTICE([using -isystem for LLVM headers])])
+
+ dnl Use -isystem so we don't get warnings from llvm headers
+- LLVM_CPPFLAGS="$LLVM_INCLUDE_FLAG `$LLVM_CONFIG --includedir`"
+- LLVM_CXXFLAGS=
++ AX_CHECK_COMPILE_FLAG([-std=c++11],[
++ LLVM_CPPFLAGS="-std=c++11 $LLVM_INCLUDE_FLAG `$LLVM_CONFIG --includedir`"
++ LLVM_CXXFLAGS="-std=c++11"
++ ],[
++ LLVM_CPPFLAGS="$LLVM_INCLUDE_FLAG `$LLVM_CONFIG --includedir`"
++ LLVM_CXXFLAGS=
++ ])
+ LLVM_LDFLAGS="-L`$LLVM_CONFIG --libdir`"
+
+
+@@ -860,6 +865,8 @@
+ OCTAVE_LLVM_CALLINST_ADDATTRIBUTE_API
+ OCTAVE_LLVM_RAW_FD_OSTREAM_API
+ OCTAVE_LLVM_LEGACY_PASSMANAGER_API
++ OCTAVE_LLVM_DATALAYOUTPASS_API
++
+ AC_LANG_POP(C++)
+ CPPFLAGS="$save_CPPFLAGS"
+ CXXFLAGS="$save_CXXFLAGS"
+diff -r 3797df921988 libinterp/corefcn/jit-typeinfo.cc
+--- a/libinterp/corefcn/jit-typeinfo.cc Wed Apr 29 17:09:24 2015 -0700
++++ b/libinterp/corefcn/jit-typeinfo.cc Sun May 03 22:48:56 2015 +0200
+@@ -1208,7 +1208,7 @@
+ for (int op = 0; op < octave_value::num_binary_ops; ++op)
+ {
+ llvm::Twine fn_name ("octave_jit_binary_any_any_");
+- fn_name = fn_name + llvm::Twine (op);
++ fn_name.concat( llvm::Twine (op) );
+
+ fn = create_internal (fn_name, any, any, any);
+ fn.mark_can_error ();
+diff -r 3797df921988 libinterp/corefcn/pt-jit.cc
+--- a/libinterp/corefcn/pt-jit.cc Wed Apr 29 17:09:24 2015 -0700
++++ b/libinterp/corefcn/pt-jit.cc Sun May 03 22:48:56 2015 +0200
+@@ -59,6 +59,7 @@
+
+ #include <llvm/Bitcode/ReaderWriter.h>
+ #include <llvm/ExecutionEngine/ExecutionEngine.h>
++#include <llvm/ExecutionEngine/MCJIT.h>
+ #include <llvm/ExecutionEngine/JIT.h>
+
+ #ifdef LEGACY_PASSMANAGER
+@@ -83,6 +84,7 @@
+ #include <llvm/IRBuilder.h>
+ #endif
+
++#include <llvm/Support/FileSystem.h>
+ #include <llvm/Support/raw_os_ostream.h>
+ #include <llvm/Support/TargetSelect.h>
+
+@@ -2077,7 +2079,11 @@
+ module_pass_manager->add (llvm::createAlwaysInlinerPass ());
+
+ #ifdef HAVE_LLVM_DATALAYOUT
++#ifdef HAVE_LLVM_DATALAYOUTPASS
++ pass_manager->add (new llvm::DataLayoutPass (*engine->getDataLayout ()));
++#else
+ pass_manager->add (new llvm::DataLayout (*engine->getDataLayout ()));
++#endif
+ #else
+ pass_manager->add (new llvm::TargetData (*engine->getTargetData ()));
+ #endif
+@@ -2192,7 +2198,7 @@
+ std::string error;
+ #ifdef RAW_FD_OSTREAM_ARG_IS_LLVM_SYS_FS
+ llvm::raw_fd_ostream fout ("test.bc", error,
+- llvm::sys::fs::F_Binary);
++ llvm::sys::fs::F_Text);
+ #else
+ llvm::raw_fd_ostream fout ("test.bc", error,
+ llvm::raw_fd_ostream::F_Binary);
+diff -r 3797df921988 m4/acinclude.m4
+--- a/m4/acinclude.m4 Wed Apr 29 17:09:24 2015 -0700
++++ b/m4/acinclude.m4 Sun May 03 22:48:56 2015 +0200
+@@ -1784,10 +1784,11 @@
+ [AC_LANG_PUSH(C++)
+ AC_COMPILE_IFELSE(
+ [AC_LANG_PROGRAM([[
++ #include <llvm/Support/FileSystem.h>
+ #include <llvm/Support/raw_os_ostream.h>
+ ]], [[
+ std::string str;
+- llvm::raw_fd_ostream fout ("", str, llvm::sys::fs::F_Binary);
++ llvm::raw_fd_ostream fout ("", str, llvm::sys::fs::F_Text);
+ ]])],
+ octave_cv_raw_fd_ostream_arg_is_llvm_sys_fs=yes,
+ octave_cv_raw_fd_ostream_arg_is_llvm_sys_fs=no)
+@@ -1828,6 +1829,33 @@
+ fi
+ ])
+ dnl
++dnl Check for llvm::DataLayoutPass API
++dnl
++AC_DEFUN([OCTAVE_LLVM_DATALAYOUTPASS_API], [
++ AC_CACHE_CHECK([check for LLVM::DataLayoutPass],
++ [octave_cv_datalayoutpass],
++ [AC_LANG_PUSH(C++)
++ save_LIBS="$LIBS"
++ LIBS="$LLVM_LIBS $LIBS"
++ AC_LINK_IFELSE(
++ [AC_LANG_PROGRAM([[
++ #include <llvm/IR/DataLayout.h>
++ ]], [[
++ llvm::Module *module;
++ llvm::DataLayoutPass *datalayoutpass;
++ datalayoutpass = new llvm::DataLayoutPass (module)
++ ]])],
++ octave_cv_datalayoutpass=yes,
++ octave_cv_datalayoutpass=no)
++ LIBS="$save_LIBS"
++ AC_LANG_POP(C++)
++ ])
++ if test $octave_cv_datalayoutpass = yes; then
++ AC_DEFINE(HAVE_LLVM_DATALAYOUTPASS, 1,
++ [Define to 1 if LLVM::DataLayoutPass exists.])
++ fi
++])
++dnl
+ dnl Check for ar.
+ dnl
+ AC_DEFUN([OCTAVE_PROG_AR], [
diff --git a/sci-mathematics/octave/metadata.xml b/sci-mathematics/octave/metadata.xml
new file mode 100644
index 000000000000..b135f553475f
--- /dev/null
+++ b/sci-mathematics/octave/metadata.xml
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+<herd>sci-mathematics</herd>
+<longdescription lang="en">
+ Octave is a high-level language, primarily intended for numerical
+ computations. It provides a convenient command line interface for
+ solving linear and nonlinear problems numerically, and for performing
+ other numerical experiments. It may also be used as a batch-oriented
+ language.
+</longdescription>
+<use>
+ <flag name="glpk">Add support for <pkg>sci-libs/glpk</pkg> for linear programming</flag>
+ <flag name="gui">Enable the graphical user interface</flag>
+ <flag name="jit">(EXPERIMENTAL) enable JIT compiler</flag>
+ <flag name="qhull">Add support for <pkg>sci-libs/qhull</pkg>, to allow `delaunay', `convhull', and related functions</flag>
+ <flag name="qrupdate">Add support for <pkg>sci-libs/qrupdate</pkg>for QR and Cholesky update functions</flag>
+ <flag name="sparse">Add enhanced support for sparse matrix algebra with SuiteSparse</flag>
+</use>
+</pkgmetadata>
diff --git a/sci-mathematics/octave/octave-3.6.4-r1.ebuild b/sci-mathematics/octave/octave-3.6.4-r1.ebuild
new file mode 100644
index 000000000000..9e8f5ab6a281
--- /dev/null
+++ b/sci-mathematics/octave/octave-3.6.4-r1.ebuild
@@ -0,0 +1,134 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+AUTOTOOLS_AUTORECONF=1
+AUTOTOOLS_IN_SOURCE_BUILD=1
+
+inherit autotools-utils multilib toolchain-funcs fortran-2
+
+DESCRIPTION="High-level interactive language for numerical computations"
+LICENSE="GPL-3"
+HOMEPAGE="http://www.octave.org/"
+SRC_URI="mirror://gnu/${PN}/${P}.tar.bz2"
+
+SLOT="0/${PV}"
+IUSE="curl doc fftw +glpk gnuplot hdf5 +imagemagick opengl postscript
+ +qhull +qrupdate readline +sparse static-libs X zlib"
+KEYWORDS="~amd64 ~arm ~hppa ~ppc ~ppc64 ~x86 ~x86-fbsd ~amd64-linux ~x86-linux"
+
+RDEPEND="
+ app-text/ghostscript-gpl
+ dev-libs/libpcre
+ sys-libs/ncurses
+ virtual/lapack
+ curl? ( net-misc/curl )
+ fftw? ( sci-libs/fftw:3.0 )
+ glpk? ( sci-mathematics/glpk )
+ gnuplot? ( sci-visualization/gnuplot )
+ hdf5? ( sci-libs/hdf5 )
+ imagemagick? ( || (
+ media-gfx/graphicsmagick[cxx]
+ media-gfx/imagemagick[cxx] ) )
+ opengl? (
+ media-libs/freetype:2
+ media-libs/fontconfig
+ >=x11-libs/fltk-1.3:1[opengl]
+ virtual/glu )
+ postscript? (
+ app-text/epstool
+ media-gfx/pstoedit
+ media-gfx/transfig )
+ qhull? ( media-libs/qhull )
+ qrupdate? ( sci-libs/qrupdate )
+ readline? ( sys-libs/readline:0 )
+ sparse? (
+ sci-libs/arpack
+ sci-libs/camd
+ sci-libs/ccolamd
+ sci-libs/cholmod
+ sci-libs/colamd
+ sci-libs/cxsparse
+ sci-libs/umfpack )
+ X? ( x11-libs/libX11 )
+ zlib? ( sys-libs/zlib )"
+
+DEPEND="${RDEPEND}
+ doc? (
+ virtual/latex-base
+ dev-texlive/texlive-genericrecommended
+ dev-texlive/texlive-metapost
+ sys-apps/texinfo )
+ dev-util/gperf
+ virtual/pkgconfig"
+
+PATCHES=(
+ "${FILESDIR}"/${PN}-3.4.3-{pkgbuilddir,texi}.patch
+ "${FILESDIR}"/${PN}-3.6.3-legendtext.patch
+ "${FILESDIR}"/${P}-texinfo.patch
+ "${FILESDIR}"/${P}-gcc-4.8.patch
+)
+
+src_prepare() {
+ # nasty prefix hack for fltk:1 linking
+ if use prefix && use opengl; then
+ sed -i \
+ -e "s:ldflags\`:ldflags\` -Wl,-rpath,${EPREFIX}/usr/$(get_libdir)/fltk-1:" \
+ configure.ac
+ fi
+ autotools-utils_src_prepare
+}
+
+src_configure() {
+ # occasional fail on install, force regeneration (bug #401189)
+ rm doc/interpreter/contributors.texi || die
+
+ # unfortunate dependency on mpi from hdf5 (bug #302621)
+ use hdf5 && has_version sci-libs/hdf5[mpi] && \
+ export CXX=mpicxx CC=mpicc FC=mpif77 F77=mpif77
+
+ local myeconfargs=(
+ --localstatedir="${EPREFIX}/var/state/octave"
+ --with-blas="$($(tc-getPKG_CONFIG) --libs blas)"
+ --with-lapack="$($(tc-getPKG_CONFIG) --libs lapack)"
+ $(use_enable prefix rpath)
+ $(use_enable doc docs)
+ $(use_enable readline)
+ $(use_with curl)
+ $(use_with fftw fftw3)
+ $(use_with fftw fftw3f)
+ $(use_with glpk)
+ $(use_with hdf5)
+ $(use_with opengl)
+ $(use_with qhull)
+ $(use_with qrupdate)
+ $(use_with sparse arpack)
+ $(use_with sparse umfpack)
+ $(use_with sparse colamd)
+ $(use_with sparse ccolamd)
+ $(use_with sparse cholmod)
+ $(use_with sparse cxsparse)
+ $(use_with X x)
+ $(use_with zlib z)
+ )
+ if use imagemagick; then
+ if has_version media-gfx/graphicsmagick[cxx]; then
+ myeconfargs+=( "--with-magick=GraphicsMagick" )
+ else
+ myeconfargs+=( "--with-magick=ImageMagick" )
+ fi
+ else
+ myeconfargs+=( "--without-magick" )
+ fi
+ autotools-utils_src_configure
+}
+
+src_install() {
+ autotools-utils_src_install
+ use doc && dodoc $(find doc -name \*.pdf)
+ [[ -e test/fntests.log ]] && dodoc test/fntests.log
+ echo "LDPATH=${EROOT}usr/$(get_libdir)/${PN}/${PV}" > 99octave
+ doenvd 99octave
+}
diff --git a/sci-mathematics/octave/octave-3.6.4.ebuild b/sci-mathematics/octave/octave-3.6.4.ebuild
new file mode 100644
index 000000000000..378b11642a89
--- /dev/null
+++ b/sci-mathematics/octave/octave-3.6.4.ebuild
@@ -0,0 +1,132 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+AUTOTOOLS_AUTORECONF=1
+AUTOTOOLS_IN_SOURCE_BUILD=1
+
+inherit autotools-utils multilib toolchain-funcs fortran-2
+
+DESCRIPTION="High-level interactive language for numerical computations"
+LICENSE="GPL-3"
+HOMEPAGE="http://www.octave.org/"
+SRC_URI="mirror://gnu/${PN}/${P}.tar.bz2"
+
+SLOT="0/${PV}"
+IUSE="curl doc fftw +glpk gnuplot hdf5 +imagemagick opengl postscript
+ +qhull +qrupdate readline +sparse static-libs X zlib"
+KEYWORDS="amd64 ~arm hppa ppc ppc64 x86 ~x86-fbsd ~amd64-linux ~x86-linux"
+
+RDEPEND="
+ app-text/ghostscript-gpl
+ dev-libs/libpcre
+ sys-libs/ncurses
+ virtual/lapack
+ curl? ( net-misc/curl )
+ fftw? ( sci-libs/fftw:3.0 )
+ glpk? ( sci-mathematics/glpk )
+ gnuplot? ( sci-visualization/gnuplot )
+ hdf5? ( sci-libs/hdf5 )
+ imagemagick? ( || (
+ media-gfx/graphicsmagick[cxx]
+ media-gfx/imagemagick[cxx] ) )
+ opengl? (
+ media-libs/freetype:2
+ media-libs/fontconfig
+ >=x11-libs/fltk-1.3:1[opengl]
+ virtual/glu )
+ postscript? (
+ app-text/epstool
+ media-gfx/pstoedit
+ media-gfx/transfig )
+ qhull? ( media-libs/qhull )
+ qrupdate? ( sci-libs/qrupdate )
+ readline? ( sys-libs/readline:0 )
+ sparse? (
+ sci-libs/arpack
+ sci-libs/camd
+ sci-libs/ccolamd
+ sci-libs/cholmod
+ sci-libs/colamd
+ sci-libs/cxsparse
+ sci-libs/umfpack )
+ X? ( x11-libs/libX11 )
+ zlib? ( sys-libs/zlib )"
+
+DEPEND="${RDEPEND}
+ doc? (
+ virtual/latex-base
+ dev-texlive/texlive-genericrecommended
+ sys-apps/texinfo )
+ dev-util/gperf
+ virtual/pkgconfig"
+
+PATCHES=(
+ "${FILESDIR}"/${PN}-3.4.3-{pkgbuilddir,texi}.patch
+ "${FILESDIR}"/${PN}-3.6.3-legendtext.patch
+ "${FILESDIR}"/${PN}-3.6.4-texinfo.patch
+)
+
+src_prepare() {
+ # nasty prefix hack for fltk:1 linking
+ if use prefix && use opengl; then
+ sed -i \
+ -e "s:ldflags\`:ldflags\` -Wl,-rpath,${EPREFIX}/usr/$(get_libdir)/fltk-1:" \
+ configure.ac
+ fi
+ autotools-utils_src_prepare
+}
+
+src_configure() {
+ # occasional fail on install, force regeneration (bug #401189)
+ rm doc/interpreter/contributors.texi || die
+
+ # unfortunate dependency on mpi from hdf5 (bug #302621)
+ use hdf5 && has_version sci-libs/hdf5[mpi] && \
+ export CXX=mpicxx CC=mpicc FC=mpif77 F77=mpif77
+
+ local myeconfargs=(
+ --localstatedir="${EPREFIX}/var/state/octave"
+ --with-blas="$($(tc-getPKG_CONFIG) --libs blas)"
+ --with-lapack="$($(tc-getPKG_CONFIG) --libs lapack)"
+ $(use_enable prefix rpath)
+ $(use_enable doc docs)
+ $(use_enable readline)
+ $(use_with curl)
+ $(use_with fftw fftw3)
+ $(use_with fftw fftw3f)
+ $(use_with glpk)
+ $(use_with hdf5)
+ $(use_with opengl)
+ $(use_with qhull)
+ $(use_with qrupdate)
+ $(use_with sparse arpack)
+ $(use_with sparse umfpack)
+ $(use_with sparse colamd)
+ $(use_with sparse ccolamd)
+ $(use_with sparse cholmod)
+ $(use_with sparse cxsparse)
+ $(use_with X x)
+ $(use_with zlib z)
+ )
+ if use imagemagick; then
+ if has_version media-gfx/graphicsmagick[cxx]; then
+ myeconfargs+=( "--with-magick=GraphicsMagick" )
+ else
+ myeconfargs+=( "--with-magick=ImageMagick" )
+ fi
+ else
+ myeconfargs+=( "--without-magick" )
+ fi
+ autotools-utils_src_configure
+}
+
+src_install() {
+ autotools-utils_src_install
+ use doc && dodoc $(find doc -name \*.pdf)
+ [[ -e test/fntests.log ]] && dodoc test/fntests.log
+ echo "LDPATH=${EROOT}usr/$(get_libdir)/${PN}/${PV}" > 99octave
+ doenvd 99octave
+}
diff --git a/sci-mathematics/octave/octave-3.8.1-r1.ebuild b/sci-mathematics/octave/octave-3.8.1-r1.ebuild
new file mode 100644
index 000000000000..67e3cb0ffdb8
--- /dev/null
+++ b/sci-mathematics/octave/octave-3.8.1-r1.ebuild
@@ -0,0 +1,163 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+AUTOTOOLS_AUTORECONF=1
+AUTOTOOLS_IN_SOURCE_BUILD=1
+
+inherit autotools-utils multilib toolchain-funcs fortran-2 flag-o-matic java-pkg-opt-2 pax-utils
+
+DESCRIPTION="High-level interactive language for numerical computations"
+LICENSE="GPL-3"
+HOMEPAGE="http://www.octave.org/"
+SRC_URI="mirror://gnu/${PN}/${P}.tar.bz2"
+
+SLOT="0/${PV}"
+IUSE="curl doc fftw +glpk gnuplot gui hdf5 +imagemagick java jit opengl
+ postscript +qhull +qrupdate readline +sparse static-libs X zlib"
+KEYWORDS="~amd64 ~arm ~hppa ~ppc ~ppc64 ~x86 ~x86-fbsd ~amd64-linux ~x86-linux"
+
+RDEPEND="
+ app-text/ghostscript-gpl
+ dev-libs/libpcre:3=
+ sys-libs/ncurses:5=
+ virtual/lapack
+ curl? ( net-misc/curl:0= )
+ fftw? ( sci-libs/fftw:3.0= )
+ glpk? ( sci-mathematics/glpk:0= )
+ gnuplot? ( sci-visualization/gnuplot )
+ gui? ( x11-libs/qscintilla:0= )
+ hdf5? ( sci-libs/hdf5:0= )
+ imagemagick? ( || (
+ media-gfx/graphicsmagick[cxx]
+ media-gfx/imagemagick[cxx] ) )
+ java? ( >=virtual/jre-1.6.0:* )
+ jit? ( <sys-devel/llvm-3.5 )
+ opengl? (
+ media-libs/freetype:2=
+ media-libs/fontconfig:1.0=
+ >=x11-libs/fltk-1.3:1=[opengl]
+ x11-libs/gl2ps:0=
+ virtual/glu )
+ postscript? (
+ app-text/epstool
+ media-gfx/pstoedit
+ media-gfx/transfig )
+ qhull? ( media-libs/qhull:0= )
+ qrupdate? ( sci-libs/qrupdate:0= )
+ readline? ( sys-libs/readline:0= )
+ sparse? (
+ sci-libs/arpack:0=
+ sci-libs/camd:0=
+ sci-libs/ccolamd:0=
+ sci-libs/cholmod:0=
+ sci-libs/colamd:0=
+ sci-libs/cxsparse:0=
+ sci-libs/umfpack:0= )
+ X? ( x11-libs/libX11:0= )
+ zlib? ( sys-libs/zlib:0= )"
+
+DEPEND="${RDEPEND}
+ qrupdate? ( app-misc/pax-utils )
+ sparse? ( app-misc/pax-utils )
+ java? ( >=virtual/jdk-1.6.0 )
+ doc? (
+ virtual/latex-base
+ dev-texlive/texlive-genericrecommended
+ dev-texlive/texlive-metapost
+ sys-apps/texinfo )
+ dev-util/gperf
+ virtual/pkgconfig"
+
+PATCHES=(
+ "${FILESDIR}"/${PN}-3.4.3-texi.patch
+ "${FILESDIR}"/${PN}-3.8.0-disable-getcwd-path-max-test-as-it-is-too-slow.patch
+ "${FILESDIR}"/${PN}-3.8.0-imagemagick-configure.patch
+ "${FILESDIR}"/${PN}-3.8.0-llvm-configure.patch
+ "${FILESDIR}"/${PN}-3.8.1-imagemagick.patch
+ "${FILESDIR}"/${PN}-3.8.1-pkgbuilddir.patch
+)
+
+src_prepare() {
+ # nasty prefix hacks for fltk:1 and qt4 linking
+ if use prefix; then
+ use opengl && append-ldflags -Wl,-rpath,"${EPREFIX}/usr/$(get_libdir)/fltk-1"
+ use gui && append-ldflags -Wl,-rpath,"${EPREFIX}/usr/$(get_libdir)/qt4"
+ fi
+
+ has_version ">=sys-devel/llvm-3.4" && \
+ epatch "${FILESDIR}"/${PN}-3.8.0-llvm-3.4.patch
+
+ # Fix bug 501756
+ sed -i \
+ -e 's@A-Za-z0-9@[:alnum:]@g' \
+ -e 's@A-Za-z@[:alpha:]@g' \
+ libinterp/mkbuiltins || die
+ autotools-utils_src_prepare
+}
+
+src_configure() {
+ # occasional fail on install, force regeneration (bug #401189)
+ rm doc/interpreter/contributors.texi || die
+
+ # unfortunate dependency on mpi from hdf5 (bug #302621)
+ use hdf5 && has_version sci-libs/hdf5[mpi] && \
+ export CXX=mpicxx CC=mpicc FC=mpif77 F77=mpif77
+
+ local myeconfargs=(
+ --localstatedir="${EPREFIX}/var/state/octave"
+ --with-blas="$($(tc-getPKG_CONFIG) --libs blas)"
+ --with-lapack="$($(tc-getPKG_CONFIG) --libs lapack)"
+ $(use_enable doc docs)
+ $(use_enable java)
+ $(use_enable gui)
+ $(use_enable jit)
+ $(use_enable readline)
+ $(use_with curl)
+ $(use_with fftw fftw3)
+ $(use_with fftw fftw3f)
+ $(use_enable fftw fftw-threads)
+ $(use_with glpk)
+ $(use_with hdf5)
+ $(use_with opengl)
+ $(use_with qhull)
+ $(use_with qrupdate)
+ $(use_with sparse arpack)
+ $(use_with sparse umfpack)
+ $(use_with sparse colamd)
+ $(use_with sparse ccolamd)
+ $(use_with sparse cholmod)
+ $(use_with sparse cxsparse)
+ $(use_with X x)
+ $(use_with zlib z)
+ )
+ if use imagemagick; then
+ if has_version media-gfx/graphicsmagick[cxx]; then
+ myeconfargs+=( "--with-magick=GraphicsMagick" )
+ else
+ myeconfargs+=( "--with-magick=ImageMagick" )
+ fi
+ else
+ myeconfargs+=( "--without-magick" )
+ fi
+ autotools-utils_src_configure
+}
+
+src_compile() {
+ emake
+ if use java || use jit ; then
+ pax-mark m "${S}/src/.libs/octave-cli"
+ fi
+}
+
+src_install() {
+ autotools-utils_src_install
+ use doc && dodoc $(find doc -name \*.pdf)
+ [[ -e test/fntests.log ]] && dodoc test/fntests.log
+ use java && \
+ java-pkg_regjar "${ED}/usr/share/${PN}/${PV}/m/java/octave.jar"
+ echo "LDPATH=${EROOT}usr/$(get_libdir)/${PN}/${PV}" > 99octave
+ doenvd 99octave
+}
diff --git a/sci-mathematics/octave/octave-3.8.1.ebuild b/sci-mathematics/octave/octave-3.8.1.ebuild
new file mode 100644
index 000000000000..7dbd71083270
--- /dev/null
+++ b/sci-mathematics/octave/octave-3.8.1.ebuild
@@ -0,0 +1,202 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+AUTOTOOLS_AUTORECONF=1
+AUTOTOOLS_IN_SOURCE_BUILD=1
+
+inherit autotools-utils multilib toolchain-funcs fortran-2 flag-o-matic java-pkg-opt-2 pax-utils
+
+DESCRIPTION="High-level interactive language for numerical computations"
+LICENSE="GPL-3"
+HOMEPAGE="http://www.octave.org/"
+SRC_URI="mirror://gnu/${PN}/${P}.tar.bz2"
+
+SLOT="0/${PV}"
+IUSE="curl doc fftw +glpk gnuplot gui hdf5 +imagemagick java jit opengl postscript
+ +qhull +qrupdate readline +sparse static-libs X zlib"
+KEYWORDS="~amd64 ~hppa ~ppc ~ppc64 ~x86 ~x86-fbsd ~amd64-linux ~x86-linux"
+
+RDEPEND="
+ app-text/ghostscript-gpl
+ dev-libs/libpcre
+ sys-libs/ncurses
+ jit? ( <sys-devel/llvm-3.5 )
+ virtual/lapack
+ curl? ( net-misc/curl )
+ fftw? ( sci-libs/fftw:3.0 )
+ glpk? ( sci-mathematics/glpk )
+ gnuplot? ( sci-visualization/gnuplot )
+ gui? ( x11-libs/qscintilla )
+ hdf5? ( sci-libs/hdf5 )
+ imagemagick? ( || (
+ media-gfx/graphicsmagick[cxx]
+ media-gfx/imagemagick[cxx] ) )
+ opengl? (
+ media-libs/freetype:2
+ media-libs/fontconfig
+ >=x11-libs/fltk-1.3:1[opengl]
+ x11-libs/gl2ps
+ virtual/glu )
+ postscript? (
+ app-text/epstool
+ media-gfx/pstoedit
+ media-gfx/transfig )
+ qhull? ( media-libs/qhull )
+ qrupdate? ( sci-libs/qrupdate )
+ readline? ( sys-libs/readline:0 )
+ sparse? (
+ sci-libs/arpack
+ sci-libs/camd
+ sci-libs/ccolamd
+ sci-libs/cholmod
+ sci-libs/colamd
+ sci-libs/cxsparse
+ sci-libs/umfpack )
+ X? ( x11-libs/libX11 )
+ zlib? ( sys-libs/zlib )"
+
+DEPEND="${RDEPEND}
+ qrupdate? ( app-misc/pax-utils )
+ sparse? ( app-misc/pax-utils )
+ doc? (
+ virtual/latex-base
+ dev-texlive/texlive-genericrecommended
+ dev-texlive/texlive-metapost
+ sys-apps/texinfo )
+ dev-util/gperf
+ virtual/pkgconfig"
+
+PATCHES=(
+ "${FILESDIR}"/${PN}-3.8.0-pkgbuilddir.patch
+ "${FILESDIR}"/${PN}-3.4.3-texi.patch
+ "${FILESDIR}"/${PN}-3.8.0-imagemagick-configure.patch
+ "${FILESDIR}"/${PN}-3.8.1-imagemagick.patch
+ "${FILESDIR}"/${PN}-3.8.0-llvm-configure.patch
+ "${FILESDIR}"/${PN}-3.8.0-disable-getcwd-path-max-test-as-it-is-too-slow.patch
+)
+
+pkg_pretend() {
+ if use qrupdate || use sparse; then
+ local blaslib=$($(tc-getPKG_CONFIG) --libs-only-l blas | sed -e 's@-l\([^ \t]*\)@lib\1@' | cut -d' ' -f 1)
+ einfo "Checking dependencies are built with the same blas lib = ${blaslib}"
+ local usr_lib="${ROOT}usr/$(get_libdir)"
+ local libs=( )
+ use qrupdate && libs+=( "${usr_lib}"/libqrupdate.so )
+ use sparse && libs+=(
+ "${usr_lib}"/libarpack.so
+ "${usr_lib}"/libcholmod.so
+ "${usr_lib}"/libspqr.so
+ "${usr_lib}"/libumfpack.so
+ )
+ for i in ${libs[*]}
+ do
+ # Is it not linked with the current blas? This check is not enough though, as
+ # earlier versions of sci-libs/cholmod were not linked with blas, while as later
+ # versions are if built with the lapack use flag.
+ scanelf -n ${i} | grep -q "${blaslib}"
+ if [[ $? -ne 0 ]]; then
+ # Does it appear to be linked with some blas or lapack library?
+ scanelf -n ${i} | egrep -q "blas|lapack"
+ if [[ $? -eq 0 ]]; then
+ eerror "*******************************************************************************"
+ eerror "${i} must be rebuilt with ${blaslib}"
+ eerror ""
+ eerror "To check the libaries ${i} is currently built with:"
+ eerror ""
+ eerror "scanelf -n ${i}"
+ eerror ""
+ eerror "To find the package that needs to be rebuilt:"
+ eerror ""
+ eerror "equery belongs ${i}"
+ eerror "*******************************************************************************"
+ die
+ fi
+ fi
+ done
+ fi
+}
+
+src_prepare() {
+ # nasty prefix hack for fltk:1 linking
+ if use prefix && use opengl; then
+ sed -i \
+ -e "s:ldflags\`:ldflags\` -Wl,-rpath,${EPREFIX}/usr/$(get_libdir)/fltk-1:" \
+ configure.ac
+ fi
+ if has_version ">=sys-devel/llvm-3.4"; then
+ epatch "${FILESDIR}"/${PN}-3.8.0-llvm-3.4.patch
+ fi
+ # Fix bug 501756 - sci-mathematics/octave-3.8.0 LC_ALL=et_EE - octave.cc:485:56:
+ # error: 'Fallow_noninteger_range_as_index' was not declared in this scope
+ sed -e 's@A-Za-z0-9@[:alnum:]@g' \
+ -e 's@A-Za-z@[:alpha:]@g' \
+ -i "${S}/libinterp/mkbuiltins" \
+ || die "Could not patch ${S}/libinterp/mkbuiltins for some non-English locales"
+ autotools-utils_src_prepare
+}
+
+src_configure() {
+ # occasional fail on install, force regeneration (bug #401189)
+ rm doc/interpreter/contributors.texi || die
+
+ # unfortunate dependency on mpi from hdf5 (bug #302621)
+ use hdf5 && has_version sci-libs/hdf5[mpi] && \
+ export CXX=mpicxx CC=mpicc FC=mpif77 F77=mpif77
+
+ local myeconfargs=(
+ --localstatedir="${EPREFIX}/var/state/octave"
+ --with-blas="$($(tc-getPKG_CONFIG) --libs blas)"
+ --with-lapack="$($(tc-getPKG_CONFIG) --libs lapack)"
+ $(use_enable doc docs)
+ $(use_enable java)
+ $(use_enable gui gui)
+ $(use_enable jit)
+ $(use_enable readline)
+ $(use_with curl)
+ $(use_with fftw fftw3)
+ $(use_with fftw fftw3f)
+ $(use_enable fftw fftw-threads)
+ $(use_with glpk)
+ $(use_with hdf5)
+ $(use_with opengl)
+ $(use_with qhull)
+ $(use_with qrupdate)
+ $(use_with sparse arpack)
+ $(use_with sparse umfpack)
+ $(use_with sparse colamd)
+ $(use_with sparse ccolamd)
+ $(use_with sparse cholmod)
+ $(use_with sparse cxsparse)
+ $(use_with X x)
+ $(use_with zlib z)
+ )
+ if use imagemagick; then
+ if has_version media-gfx/graphicsmagick[cxx]; then
+ myeconfargs+=( "--with-magick=GraphicsMagick" )
+ else
+ myeconfargs+=( "--with-magick=ImageMagick" )
+ fi
+ else
+ myeconfargs+=( "--without-magick" )
+ fi
+ autotools-utils_src_configure
+}
+
+src_compile() {
+ emake
+ if use java || use jit ; then
+ pax-mark m "${S}/src/.libs/octave-cli"
+ fi
+}
+
+src_install() {
+ autotools-utils_src_install
+ use doc && dodoc $(find doc -name \*.pdf)
+ [[ -e test/fntests.log ]] && dodoc test/fntests.log
+ use java && java-pkg_regjar "${ED}/usr/share/${PN}/${PV}/m/java/octave.jar"
+ echo "LDPATH=${EROOT}usr/$(get_libdir)/${PN}/${PV}" > 99octave
+ doenvd 99octave
+}
diff --git a/sci-mathematics/octave/octave-3.8.2.ebuild b/sci-mathematics/octave/octave-3.8.2.ebuild
new file mode 100644
index 000000000000..f08b76a628ae
--- /dev/null
+++ b/sci-mathematics/octave/octave-3.8.2.ebuild
@@ -0,0 +1,163 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+AUTOTOOLS_AUTORECONF=1
+AUTOTOOLS_IN_SOURCE_BUILD=1
+
+inherit autotools-utils multilib toolchain-funcs fortran-2 flag-o-matic java-pkg-opt-2 pax-utils
+
+DESCRIPTION="High-level interactive language for numerical computations"
+LICENSE="GPL-3"
+HOMEPAGE="http://www.octave.org/"
+SRC_URI="mirror://gnu/${PN}/${P}.tar.bz2"
+
+SLOT="0/${PV}"
+IUSE="curl doc fftw +glpk gnuplot gui hdf5 +imagemagick java jit opengl
+ postscript +qhull +qrupdate readline +sparse static-libs X zlib"
+KEYWORDS="amd64 ~arm hppa ppc ppc64 x86 ~x86-fbsd ~amd64-linux ~x86-linux"
+
+RDEPEND="
+ app-text/ghostscript-gpl
+ dev-libs/libpcre:3=
+ sys-libs/ncurses:5=
+ virtual/lapack
+ curl? ( net-misc/curl:0= )
+ fftw? ( sci-libs/fftw:3.0= )
+ glpk? ( sci-mathematics/glpk:0= )
+ gnuplot? ( sci-visualization/gnuplot )
+ gui? ( x11-libs/qscintilla:0= )
+ hdf5? ( sci-libs/hdf5:0= )
+ imagemagick? ( || (
+ media-gfx/graphicsmagick[cxx]
+ media-gfx/imagemagick[cxx] ) )
+ java? ( >=virtual/jre-1.6.0:* )
+ jit? ( <sys-devel/llvm-3.5:0= )
+ opengl? (
+ media-libs/freetype:2=
+ media-libs/fontconfig:1.0=
+ >=x11-libs/fltk-1.3:1=[opengl,xft]
+ x11-libs/gl2ps:0=
+ virtual/glu )
+ postscript? (
+ app-text/epstool
+ media-gfx/pstoedit
+ media-gfx/transfig )
+ qhull? ( media-libs/qhull:0= )
+ qrupdate? ( sci-libs/qrupdate:0= )
+ readline? ( sys-libs/readline:0= )
+ sparse? (
+ sci-libs/arpack:0=
+ sci-libs/camd:0=
+ sci-libs/ccolamd:0=
+ sci-libs/cholmod:0=
+ sci-libs/colamd:0=
+ sci-libs/cxsparse:0=
+ sci-libs/umfpack:0= )
+ X? ( x11-libs/libX11:0= )
+ zlib? ( sys-libs/zlib:0= )"
+
+DEPEND="${RDEPEND}
+ qrupdate? ( app-misc/pax-utils )
+ sparse? ( app-misc/pax-utils )
+ java? ( >=virtual/jdk-1.6.0 )
+ doc? (
+ virtual/latex-base
+ dev-texlive/texlive-genericrecommended
+ dev-texlive/texlive-metapost
+ sys-apps/texinfo )
+ dev-util/gperf
+ virtual/pkgconfig"
+
+PATCHES=(
+ "${FILESDIR}"/${PN}-3.4.3-texi.patch
+ "${FILESDIR}"/${PN}-3.8.0-disable-getcwd-path-max-test-as-it-is-too-slow.patch
+ "${FILESDIR}"/${PN}-3.8.0-imagemagick-configure.patch
+ "${FILESDIR}"/${PN}-3.8.0-llvm-configure.patch
+ "${FILESDIR}"/${PN}-3.8.1-imagemagick.patch
+ "${FILESDIR}"/${PN}-3.8.1-pkgbuilddir.patch
+)
+
+src_prepare() {
+ # nasty prefix hacks for fltk:1 and qt4 linking
+ if use prefix; then
+ use opengl && append-ldflags -Wl,-rpath,"${EPREFIX}/usr/$(get_libdir)/fltk-1"
+ use gui && append-ldflags -Wl,-rpath,"${EPREFIX}/usr/$(get_libdir)/qt4"
+ fi
+
+ has_version ">=sys-devel/llvm-3.4" && \
+ epatch "${FILESDIR}"/${PN}-3.8.0-llvm-3.4.patch
+
+ # Fix bug 501756
+ sed -i \
+ -e 's@A-Za-z0-9@[:alnum:]@g' \
+ -e 's@A-Za-z@[:alpha:]@g' \
+ libinterp/mkbuiltins || die
+ autotools-utils_src_prepare
+}
+
+src_configure() {
+ # occasional fail on install, force regeneration (bug #401189)
+ rm doc/interpreter/contributors.texi || die
+
+ # unfortunate dependency on mpi from hdf5 (bug #302621)
+ use hdf5 && has_version sci-libs/hdf5[mpi] && \
+ export CXX=mpicxx CC=mpicc FC=mpif77 F77=mpif77
+
+ local myeconfargs=(
+ --localstatedir="${EPREFIX}/var/state/octave"
+ --with-blas="$($(tc-getPKG_CONFIG) --libs blas)"
+ --with-lapack="$($(tc-getPKG_CONFIG) --libs lapack)"
+ $(use_enable doc docs)
+ $(use_enable java)
+ $(use_enable gui)
+ $(use_enable jit)
+ $(use_enable readline)
+ $(use_with curl)
+ $(use_with fftw fftw3)
+ $(use_with fftw fftw3f)
+ $(use_enable fftw fftw-threads)
+ $(use_with glpk)
+ $(use_with hdf5)
+ $(use_with opengl)
+ $(use_with qhull)
+ $(use_with qrupdate)
+ $(use_with sparse arpack)
+ $(use_with sparse umfpack)
+ $(use_with sparse colamd)
+ $(use_with sparse ccolamd)
+ $(use_with sparse cholmod)
+ $(use_with sparse cxsparse)
+ $(use_with X x)
+ $(use_with zlib z)
+ )
+ if use imagemagick; then
+ if has_version media-gfx/graphicsmagick[cxx]; then
+ myeconfargs+=( "--with-magick=GraphicsMagick" )
+ else
+ myeconfargs+=( "--with-magick=ImageMagick" )
+ fi
+ else
+ myeconfargs+=( "--without-magick" )
+ fi
+ autotools-utils_src_configure
+}
+
+src_compile() {
+ emake
+ if use java || use jit ; then
+ pax-mark m "${S}/src/.libs/octave-cli"
+ fi
+}
+
+src_install() {
+ autotools-utils_src_install
+ use doc && dodoc $(find doc -name \*.pdf)
+ [[ -e test/fntests.log ]] && dodoc test/fntests.log
+ use java && \
+ java-pkg_regjar "${ED}/usr/share/${PN}/${PV}/m/java/octave.jar"
+ echo "LDPATH=${EROOT}usr/$(get_libdir)/${PN}/${PV}" > 99octave
+ doenvd 99octave
+}
diff --git a/sci-mathematics/octave/octave-4.0.0.ebuild b/sci-mathematics/octave/octave-4.0.0.ebuild
new file mode 100644
index 000000000000..822077444577
--- /dev/null
+++ b/sci-mathematics/octave/octave-4.0.0.ebuild
@@ -0,0 +1,169 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+AUTOTOOLS_AUTORECONF=1
+AUTOTOOLS_IN_SOURCE_BUILD=1
+
+inherit autotools-utils multilib toolchain-funcs fortran-2 flag-o-matic java-pkg-opt-2 pax-utils
+
+DESCRIPTION="High-level interactive language for numerical computations"
+LICENSE="GPL-3"
+HOMEPAGE="http://www.octave.org/"
+SRC_URI="mirror://gnu/${PN}/${P}.tar.xz"
+
+SLOT="0/${PV}"
+IUSE="curl doc fftw +glpk gnuplot gui hdf5 +imagemagick java jit opengl
+ postscript +qhull +qrupdate readline +sparse static-libs X zlib"
+KEYWORDS="~amd64 ~arm ~hppa ~ppc ~ppc64 ~x86 ~x86-fbsd ~amd64-linux ~x86-linux"
+
+RDEPEND="
+ app-text/ghostscript-gpl
+ dev-libs/libpcre:3=
+ sys-libs/ncurses:5=
+ virtual/blas
+ virtual/lapack
+ curl? ( net-misc/curl:0= )
+ fftw? ( sci-libs/fftw:3.0= )
+ glpk? ( sci-mathematics/glpk:0= )
+ gnuplot? ( sci-visualization/gnuplot )
+ gui? ( x11-libs/qscintilla:0= )
+ hdf5? ( sci-libs/hdf5:0= )
+ imagemagick? ( || (
+ media-gfx/graphicsmagick[cxx]
+ media-gfx/imagemagick[cxx] ) )
+ java? ( >=virtual/jre-1.6.0:* )
+ jit? (
+ >=sys-devel/autoconf-archive-2015.02.04
+ >=sys-devel/llvm-3.3:0= <sys-devel/llvm-3.6:0= )
+ opengl? (
+ media-libs/freetype:2=
+ media-libs/fontconfig:1.0=
+ >=x11-libs/fltk-1.3:1=[opengl,xft]
+ x11-libs/gl2ps:0=
+ virtual/glu )
+ postscript? (
+ app-text/epstool
+ media-gfx/pstoedit
+ media-gfx/transfig )
+ qhull? ( media-libs/qhull:0= )
+ qrupdate? ( sci-libs/qrupdate:0= )
+ readline? ( sys-libs/readline:0= )
+ sparse? (
+ sci-libs/arpack:0=
+ sci-libs/camd:0=
+ sci-libs/ccolamd:0=
+ sci-libs/cholmod:0=
+ sci-libs/colamd:0=
+ sci-libs/cxsparse:0=
+ sci-libs/umfpack:0= )
+ X? ( x11-libs/libX11:0= )
+ zlib? ( sys-libs/zlib:0= )"
+
+DEPEND="${RDEPEND}
+ qrupdate? ( app-misc/pax-utils )
+ sparse? ( app-misc/pax-utils )
+ java? ( >=virtual/jdk-1.6.0 )
+ doc? (
+ virtual/latex-base
+ dev-texlive/texlive-genericrecommended
+ dev-texlive/texlive-metapost
+ sys-apps/texinfo )
+ dev-util/gperf
+ virtual/pkgconfig"
+
+PATCHES=(
+ "${FILESDIR}"/${PN}-3.4.3-texi.patch
+ "${FILESDIR}"/${PN}-3.8.0-disable-getcwd-path-max-test-as-it-is-too-slow.patch
+ "${FILESDIR}"/${PN}-4.0.0-imagemagick-configure.patch
+ "${FILESDIR}"/${PN}-4.0.0-imagemagick.patch
+ "${FILESDIR}"/${PN}-3.8.1-pkgbuilddir.patch
+)
+
+src_prepare() {
+ # nasty prefix hacks for fltk:1 and qt4 linking
+ if use prefix; then
+ use opengl && append-ldflags -Wl,-rpath,"${EPREFIX}/usr/$(get_libdir)/fltk-1"
+ use gui && append-ldflags -Wl,-rpath,"${EPREFIX}/usr/$(get_libdir)/qt4"
+ fi
+
+ # Octave fails to build with LLVM 3.5 http://savannah.gnu.org/bugs/?41061
+ use jit && \
+ has_version ">=sys-devel/llvm-3.5" && \
+ epatch "${FILESDIR}"/${PN}-4.0.0-llvm-3.5.patch && \
+ epatch "${FILESDIR}"/${PN}-4.0.0-llvm-3.5-gnulib-hg.patch
+
+ # Fix bug 501756
+ sed -i \
+ -e 's@A-Za-z0-9@[:alnum:]@g' \
+ -e 's@A-Za-z@[:alpha:]@g' \
+ libinterp/mkbuiltins || die
+ autotools-utils_src_prepare
+}
+
+src_configure() {
+ # occasional fail on install, force regeneration (bug #401189)
+ rm doc/interpreter/contributors.texi || die
+
+ # unfortunate dependency on mpi from hdf5 (bug #302621)
+ use hdf5 && has_version sci-libs/hdf5[mpi] && \
+ export CXX=mpicxx CC=mpicc FC=mpif77 F77=mpif77
+
+ local myeconfargs=(
+ --localstatedir="${EPREFIX}/var/state/octave"
+ --with-blas="$($(tc-getPKG_CONFIG) --libs blas)"
+ --with-lapack="$($(tc-getPKG_CONFIG) --libs lapack)"
+ --disable-64
+ $(use_enable doc docs)
+ $(use_enable java)
+ $(use_enable gui)
+ $(use_enable jit)
+ $(use_enable readline)
+ $(use_with curl)
+ $(use_with fftw fftw3)
+ $(use_with fftw fftw3f)
+ $(use_enable fftw fftw-threads)
+ $(use_with glpk)
+ $(use_with hdf5)
+ $(use_with opengl)
+ $(use_with qhull)
+ $(use_with qrupdate)
+ $(use_with sparse arpack)
+ $(use_with sparse umfpack)
+ $(use_with sparse colamd)
+ $(use_with sparse ccolamd)
+ $(use_with sparse cholmod)
+ $(use_with sparse cxsparse)
+ $(use_with X x)
+ $(use_with zlib z)
+ )
+ if use imagemagick; then
+ if has_version media-gfx/graphicsmagick[cxx]; then
+ myeconfargs+=( "--with-magick=GraphicsMagick" )
+ else
+ myeconfargs+=( "--with-magick=ImageMagick" )
+ fi
+ else
+ myeconfargs+=( "--without-magick" )
+ fi
+ autotools-utils_src_configure
+}
+
+src_compile() {
+ emake
+ if use java || use jit ; then
+ pax-mark m "${S}/src/.libs/octave-cli"
+ fi
+}
+
+src_install() {
+ autotools-utils_src_install
+ use doc && dodoc $(find doc -name \*.pdf)
+ [[ -e test/fntests.log ]] && dodoc test/fntests.log
+ use java && \
+ java-pkg_regjar "${ED}/usr/share/${PN}/${PV}/m/java/octave.jar"
+ echo "LDPATH=${EROOT}usr/$(get_libdir)/${PN}/${PV}" > 99octave
+ doenvd 99octave
+}
diff --git a/sci-mathematics/otter/Manifest b/sci-mathematics/otter/Manifest
new file mode 100644
index 000000000000..36423c873b69
--- /dev/null
+++ b/sci-mathematics/otter/Manifest
@@ -0,0 +1 @@
+DIST otter-3.3.tar.gz 2809092 SHA256 40d7399e96491bcdabce1427c58945b3cfa414e1cefb8edae7bbea02dd6c0249
diff --git a/sci-mathematics/otter/files/otter-3.3-build.patch b/sci-mathematics/otter/files/otter-3.3-build.patch
new file mode 100644
index 000000000000..b933d86252d6
--- /dev/null
+++ b/sci-mathematics/otter/files/otter-3.3-build.patch
@@ -0,0 +1,114 @@
+diff -Naur otter-3.3/mace2/Makefile otter-3.3.new/mace2/Makefile
+--- otter-3.3/mace2/Makefile 2003-08-06 10:18:09.000000000 -0400
++++ otter-3.3.new/mace2/Makefile 2010-01-12 19:41:44.000000000 -0500
+@@ -1,8 +1,8 @@
+ DFLAGS = -DTP_NAMES -DTP_SIGNAL -DTP_RUSAGE
+
+-CC = gcc
++#CC = gcc
+
+-CFLAGS = -O $(DFLAGS)
++CFLAGS += $(DFLAGS)
+
+ # CFLAGS = -g $(DFLAGS)
+
+@@ -12,20 +12,17 @@
+ OBJECTS = clock.o avail.o opts.o stats.o miscellany.o flatten.o\
+ dp.o generate.o print.o part.o
+
+-all: mace2 anldp install clean
++all: mace2 anldp
+
+ mace2: mace2.o $(OBJECTS)
+- $(CC) $(CFLAGS) mace2.o $(OBJECTS) ../source/libotter.a -o mace2
++ $(CC) $(CFLAGS) $(LDFLAGS) mace2.o $(OBJECTS) ../source/libotter.a -o ../bin/mace2
+
+ anldp: anldp.o $(OBJECTS)
+- $(CC) $(CFLAGS) anldp.o $(OBJECTS) ../source/libotter.a -o anldp
++ $(CC) $(CFLAGS) $(LDFLAGS) anldp.o $(OBJECTS) ../source/libotter.a -o ../bin/anldp
+
+ mace2.o anldp.o $(OBJECTS): Mace2.h Clock.h Avail.h Opts.h Stats.h\
+ Miscellany.h Dp.h Generate.h Flatten.h Part.h
+
+-install:
+- /bin/mv mace2 anldp ../bin
+-
+ clean:
+ /bin/rm -f *.o
+
+diff -Naur otter-3.3/source/Makefile otter-3.3.new/source/Makefile
+--- otter-3.3/source/Makefile 2003-08-06 21:48:29.000000000 -0400
++++ otter-3.3.new/source/Makefile 2010-01-12 19:58:16.000000000 -0500
+@@ -66,7 +66,7 @@
+ # Specify the C compiler. I recommend gcc (GNU C Compiler) if you have it.
+ # In many Linux environments, cc is just a symlink to gcc.
+
+-CC = gcc
++#CC = gcc
+
+ #############################################################################
+ #
+@@ -74,7 +74,7 @@
+ #
+ # optimized
+
+-CFLAGS = -O $(DFLAGS)
++CFLAGS += $(DFLAGS)
+
+ #
+ # check for strict ANSI conformance with Solaris cc:
+@@ -108,19 +108,20 @@
+
+ #############################################################################
+
+-all: otter install clean
++all: formed
++
++formed: otter
++ +make -C formed clean
++ +make -C formed
+
+ otter: main.o libotter.a
+- $(CC) $(CFLAGS) main.o libotter.a -o otter
++ $(CC) $(CFLAGS) $(LDFLAGS) main.o libotter.a -o ../bin/otter
+
+ libotter.a: $(OBJECTS)
+ $(AR) rs libotter.a $(OBJECTS)
+
+ main.o $(OBJECTS): header.h types.h macros.h cos.h proto.h foreign.h lisp.h
+
+-install:
+- /bin/mv otter ../bin
+-
+ clean:
+ /bin/rm -f *.o
+
+diff -Naur otter-3.3/source/formed/Makefile otter-3.3.new/source/formed/Makefile
+--- otter-3.3/source/formed/Makefile 2003-07-21 15:34:44.000000000 -0400
++++ otter-3.3.new/source/formed/Makefile 2010-01-12 19:37:46.000000000 -0500
+@@ -1,14 +1,14 @@
+
+ DFLAGS = -DTP_NAMES -DTP_SIGNAL -DTP_FORK -DTP_RUSAGE
+
+-CC = gcc
++#CC = gcc
+
+ #############################################################################
+ # Specify the compiler flags; include DFLAGS (above)
+ #
+ # optimized
+
+-CFLAGS = -O $(DFLAGS)
++CFLAGS += $(DFLAGS)
+
+ #
+ # save symbols for debuggers
+@@ -40,7 +40,7 @@
+ XLIBS = -L/usr/X11R6/lib -lXaw
+
+ formed: formed.o display.o callback.o
+- $(CC) $(CFLAGS) formed.o display.o callback.o \
++ $(CC) $(CFLAGS) $(LDFLAGS) formed.o display.o callback.o \
+ ../libotter.a $(XLIBS) -o formed
+
+ display.o callback.o formed.o: formed.h
diff --git a/sci-mathematics/otter/files/otter-3.3-gold.patch b/sci-mathematics/otter/files/otter-3.3-gold.patch
new file mode 100644
index 000000000000..a41672321d67
--- /dev/null
+++ b/sci-mathematics/otter/files/otter-3.3-gold.patch
@@ -0,0 +1,16 @@
+ source/formed/Makefile | 2 +-
+ 1 files changed, 1 insertions(+), 1 deletions(-)
+
+diff --git a/source/formed/Makefile b/source/formed/Makefile
+index 39eaae5..7526c03 100644
+--- a/source/formed/Makefile
++++ b/source/formed/Makefile
+@@ -37,7 +37,7 @@ CFLAGS += $(DFLAGS)
+ #
+ # The following works on a RedHat 7.3 computer
+
+-XLIBS = -L/usr/X11R6/lib -lXaw
++XLIBS = -L/usr/X11R6/lib -lXaw -lXt -lX11
+
+ formed: formed.o display.o callback.o
+ $(CC) $(CFLAGS) $(LDFLAGS) formed.o display.o callback.o \
diff --git a/sci-mathematics/otter/metadata.xml b/sci-mathematics/otter/metadata.xml
new file mode 100644
index 000000000000..d369d068ffb8
--- /dev/null
+++ b/sci-mathematics/otter/metadata.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <herd>sci</herd>
+</pkgmetadata>
diff --git a/sci-mathematics/otter/otter-3.3-r1.ebuild b/sci-mathematics/otter/otter-3.3-r1.ebuild
new file mode 100644
index 000000000000..4bba0dcaf7e5
--- /dev/null
+++ b/sci-mathematics/otter/otter-3.3-r1.ebuild
@@ -0,0 +1,35 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+DESCRIPTION="An Automated Deduction System"
+HOMEPAGE="http://www.cs.unm.edu/~mccune/otter/"
+SRC_URI="http://www.cs.unm.edu/~mccune/otter/${P}.tar.gz"
+
+KEYWORDS="~amd64 ~ppc x86 ~amd64-linux ~x86-linux ~ppc-macos"
+LICENSE="otter"
+SLOT="0"
+IUSE=""
+
+RDEPEND="
+ x11-libs/libX11
+ x11-libs/libXaw
+ x11-libs/libXt"
+DEPEND="${RDEPEND}"
+
+src_compile() {
+ cd source
+ emake -j1 || die
+ cd "${S}"/mace2
+ emake -j1 || die
+}
+
+src_install() {
+ dobin bin/* source/formed/formed
+ dodoc README* Legal Changelog Contents documents/*.{tex,ps}
+ insinto /usr/share/doc/${PF}
+ doins documents/*.pdf
+ dohtml index.html
+ insinto /usr/share/doc/${PF}/html
+ doins -r examples examples-mace2
+}
diff --git a/sci-mathematics/otter/otter-3.3-r2.ebuild b/sci-mathematics/otter/otter-3.3-r2.ebuild
new file mode 100644
index 000000000000..96718abd3b00
--- /dev/null
+++ b/sci-mathematics/otter/otter-3.3-r2.ebuild
@@ -0,0 +1,44 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=4
+
+inherit eutils
+
+DESCRIPTION="An Automated Deduction System"
+HOMEPAGE="http://www.cs.unm.edu/~mccune/otter/"
+SRC_URI="http://www.cs.unm.edu/~mccune/otter/${P}.tar.gz"
+
+KEYWORDS="~amd64 ~ppc ~x86 ~amd64-linux ~x86-linux ~ppc-macos"
+LICENSE="otter"
+SLOT="0"
+IUSE=""
+
+RDEPEND="
+ x11-libs/libX11
+ x11-libs/libXaw
+ x11-libs/libXt"
+DEPEND="${RDEPEND}"
+
+src_prepare() {
+ epatch \
+ "${FILESDIR}"/${P}-build.patch \
+ "${FILESDIR}"/${P}-gold.patch
+}
+
+src_compile() {
+ cd source
+ CC=$(tc-getCC) emake
+ cd "${S}"/mace2
+ CC=$(tc-getCC) emake
+}
+
+src_install() {
+ dobin bin/* source/formed/formed
+ dodoc README* Legal Changelog Contents
+ insinto /usr/share/doc/${PF}
+ doins documents/*.pdf
+ insinto /usr/share/${PN}/
+ doins -r examples examples-mace2
+}
diff --git a/sci-mathematics/p9m4/Manifest b/sci-mathematics/p9m4/Manifest
new file mode 100644
index 000000000000..d7467c769075
--- /dev/null
+++ b/sci-mathematics/p9m4/Manifest
@@ -0,0 +1,2 @@
+DIST p9m4-v05-64bit.patch.bz2 5095 SHA256 038eafb0198deabb358e3b9aabe19052970730e7cace2b7dbbbc09947d901d6f SHA512 b80ea7ae9b652b55eee2542ba8d45712871e56dfda2e97bae2011a521e732d221a5c6a36ba33269a80f02ddc98a8f3c2470c7e832fc2b79331e7cca551aa7a36 WHIRLPOOL e5f8dcd5690c3d8ab0cd77c65d4fa31c313ccfe4bd8df57c3cc942c70b30aba694d3f48e6133a9a21f3a370d34c55853df14942c6cd85d523240ee9aa531913e
+DIST p9m4-v05.tar.gz 889707 SHA256 451a05179fcb025b666ec992cd45e0d71dac26e43c1fca814747bef541a040b4 SHA512 6ed8f3a5ab6e6b876eee388ab0f1bc535e60432317131657ba518781912f0f851aeab361d0169f96e29538130d691cf2d3798135e2386a7793799f0c4931120e WHIRLPOOL b05b02523c2e60ef594a34654b997925c43f7d64c0302f0b630d4a4036ccd20e58e39d292a4a1504914357cefc6b71ffdb10a52e5f1e3d467fc18e1d8603cfd7
diff --git a/sci-mathematics/p9m4/files/p9m4-v05-package.patch b/sci-mathematics/p9m4/files/p9m4-v05-package.patch
new file mode 100644
index 000000000000..9ca737ce2ffe
--- /dev/null
+++ b/sci-mathematics/p9m4/files/p9m4-v05-package.patch
@@ -0,0 +1,67 @@
+--- p9m4-v05-orig/setup.py 2007-11-17 09:31:26.000000000 +1100
++++ p9m4-v05/setup.py 2012-07-02 23:48:21.753760992 +1000
+@@ -26,23 +26,24 @@
+
+ from setuptools import setup
+
+-APP = ['prover9-mace4.py']
+-DATA_FILES = ['platforms.py',
+- 'utilities.py',
+- 'wx_utilities.py',
+- 'files.py',
+- 'options.py',
+- 'partition_input.py',
+- 'my_setup.py',
+- 'control.py',
+- 'Images',
+- 'Samples',
+- 'bin-mac']
+-OPTIONS = {'argv_emulation': True, 'iconfile': '/Users/mccune/gui/v4/p9.icns'}
++OPTIONS = {'argv_emulation': True, 'iconfile': '/usr/share/p9m4/Images/p9.ico'}
+
+ setup(
+- app=APP,
+- data_files=DATA_FILES,
+- options={'py2app': OPTIONS},
+- setup_requires=['py2app'],
++ name='p9m4',
++ version='05',
++ scripts=['prover9-mace4.py'],
++ package_dir = {'p9m4': 'p9m4'},
++ py_modules=['p9m4.platforms',
++ 'p9m4.utilities',
++ 'p9m4.wx_utilities',
++ 'p9m4.files',
++ 'p9m4.options',
++ 'p9m4.partition_input',
++ 'p9m4.my_setup',
++ 'p9m4.control'],
++ # remove py2app
++ # https://bugs.gentoo.org/show_bug.cgi?id=423555
++ # sci-mathematics/p9m4-05: tries to use network during install
++ # options={'py2app': OPTIONS},
++ # setup_requires=['py2app'],
+ )
+--- p9m4-v05-orig/prover9-mace4.py 2007-12-08 03:27:13.000000000 +1100
++++ p9m4-v05/prover9-mace4.py 2012-01-08 18:12:09.970620044 +1100
+@@ -27,13 +27,13 @@
+
+ # local imports
+
+-import partition_input
+-import utilities
+-from files import *
+-from platforms import *
+-from wx_utilities import *
+-from my_setup import *
+-from control import *
++import p9m4.partition_input
++import p9m4.utilities
++from p9m4.files import *
++from p9m4.platforms import *
++from p9m4.wx_utilities import *
++from p9m4.my_setup import *
++from p9m4.control import *
+
+ Program_name = 'Prover9-Mace4'
+ Program_version = '0.5'
diff --git a/sci-mathematics/p9m4/files/p9m4-v05-python2.6.patch b/sci-mathematics/p9m4/files/p9m4-v05-python2.6.patch
new file mode 100644
index 000000000000..70cb006d268e
--- /dev/null
+++ b/sci-mathematics/p9m4/files/p9m4-v05-python2.6.patch
@@ -0,0 +1,44 @@
+diff -Nur p9m4-0.5/my_setup.py p9m4-0.5.new/my_setup.py
+--- p9m4-0.5/my_setup.py 2008-01-14 23:30:55.000000000 +0000
++++ p9m4-0.5.new/my_setup.py 2008-01-14 23:35:45.000000000 +0000
+@@ -158,7 +158,9 @@
+ self.ed.SetStyle(start, end,
+ wx.TextAttr('RED',
+ wx.Colour(200,200,255)))
+- error_dialog('%s\n%s' % (message,error if error else ''))
++ error_dialog('%s\n%s' % (message,error))
++ else:
++ error_dialog(message)
+ else:
+ frame = Text_frame(self, to_top(self).box_font,
+ 'Error Output',
+diff -Nur p9m4-0.5/partition_input.py p9m4-0.5.new/partition_input.py
+--- p9m4-0.5/partition_input.py 2008-01-14 23:30:55.000000000 +0000
++++ p9m4-0.5.new/partition_input.py 2008-01-14 23:35:45.000000000 +0000
+@@ -63,14 +63,23 @@
+ m2 = r2.search(str, m1.end())
+ while m2 and in_span(m2.start(), comments):
+ m2 = r2.search(str, m2.end())
+- match_end = m2.end() if m2 else len(str)
++ if m2:
++ match_end = m2.end()
++ else:
++ match_end = len(str)
+ other += str[other_start:m1.start()]
+ if remove_patterns:
+ keep_start = m1.end()
+- keep_end = m2.start() if m2 else len(str)
++ if m2:
++ keep_end = m2.start()
++ else:
++ keep_end = len(str)
+ else:
+ keep_start = m1.start()
+- keep_end = m2.end() if m2 else len(str)
++ if m2:
++ keep_end = m2.end()
++ else:
++ keep_end = len(str)
+ matched += str[keep_start:keep_end]
+ next = other_start = match_end
+ else:
diff --git a/sci-mathematics/p9m4/files/p9m4-v05-use-inst-paths.patch b/sci-mathematics/p9m4/files/p9m4-v05-use-inst-paths.patch
new file mode 100644
index 000000000000..5b48b94b27bf
--- /dev/null
+++ b/sci-mathematics/p9m4/files/p9m4-v05-use-inst-paths.patch
@@ -0,0 +1,42 @@
+diff -Nur p9m4-0.5/files.py p9m4-0.5.new/files.py
+--- p9m4-0.5/files.py 2008-01-14 23:31:00.000000000 +0000
++++ p9m4-0.5.new/files.py 2008-01-14 23:39:51.000000000 +0000
+@@ -51,6 +51,9 @@
+ return sys.path[0]
+ # return os.path.dirname(os.path.abspath(sys.argv[0]))
+
++def data_dir():
++ return '/usr/share/p9m4'
++
+ def bin():
+ if Win32():
+ return 'bin-win32'
+@@ -63,13 +66,13 @@
+ return 'bin'
+
+ def bin_dir():
+- return os.path.join(program_dir(), bin())
++ return '/usr/bin'
+
+ def image_dir():
+- return os.path.join(program_dir(), 'Images')
++ return os.path.join(data_dir(), 'Images')
+
+ def sample_dir():
+- return os.path.join(program_dir(), 'Samples')
++ return os.path.join(data_dir(), 'Samples')
+
+ def binary_ok(fullpath):
+ if not fullpath:
+diff -Nur p9m4-0.5/prover9-mace4.py p9m4-0.5.new/prover9-mace4.py
+--- p9m4-0.5/prover9-mace4.py 2007-12-07 16:27:13.000000000 +0000
++++ p9m4-0.5.new/prover9-mace4.py 2008-02-10 22:45:45.000000000 +0000
+@@ -27,6 +27,8 @@
+
+ # local imports
+
++sys.path.append('/usr/share/p9m4/lib')
++
+ import partition_input
+ import utilities
+ from files import *
diff --git a/sci-mathematics/p9m4/metadata.xml b/sci-mathematics/p9m4/metadata.xml
new file mode 100644
index 000000000000..037c455fa05d
--- /dev/null
+++ b/sci-mathematics/p9m4/metadata.xml
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+<maintainer>
+ <email>gienah@gentoo.org</email>
+</maintainer>
+<herd>sci-mathematics</herd>
+<longdescription lang='en'>
+ This is a Graphical User Interface for Prover9 and Mace4.
+ Prover9 is an automated theorem prover for first-order and
+ equational logic, and Mace4 searches for finite models and
+ counterexamples. Prover9 is the successor of the Otter prover.
+</longdescription>
+</pkgmetadata>
diff --git a/sci-mathematics/p9m4/p9m4-05-r1.ebuild b/sci-mathematics/p9m4/p9m4-05-r1.ebuild
new file mode 100644
index 000000000000..00f30e2b5648
--- /dev/null
+++ b/sci-mathematics/p9m4/p9m4-05-r1.ebuild
@@ -0,0 +1,109 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="5"
+
+PYTHON_COMPAT=( python2_7 )
+DISTUTILS_SINGLE_IMPL=1
+
+inherit distutils-r1
+
+MY_PN="p9m4-v"
+MY_P="${MY_PN}${PV}"
+
+DESCRIPTION="This is a Graphical User Interface for Prover9 and Mace4"
+HOMEPAGE="http://www.cs.unm.edu/~mccune/mace4/"
+SRC_URI="http://www.cs.unm.edu/~mccune/prover9/gui/${MY_P}.tar.gz
+ http://dev.gentoo.org/~gienah/2big4tree/sci-mathematics/p9m4/p9m4-v05-64bit.patch.bz2"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE="examples"
+
+RDEPEND="dev-python/wxpython:*
+ sci-mathematics/prover9"
+DEPEND="${RDEPEND}
+ dev-python/setuptools"
+
+PATCHES=( "${DISTDIR}/${MY_PN}05-64bit.patch.bz2"
+ "${FILESDIR}/${MY_PN}05-use-inst-paths.patch"
+ "${FILESDIR}/${MY_PN}05-package.patch"
+ "${FILESDIR}/${MY_PN}05-python2.6.patch" )
+
+S="${WORKDIR}/${MY_P}/"
+
+python_check_deps() {
+ has_version "dev-python/foo[${PYTHON_USEDEP}]"
+}
+
+pkg_setup() {
+ python-single-r1_pkg_setup
+}
+
+python_prepare_all() {
+ rm -f p9m4-v05/bin/prover9 \
+ p9m4-v05/bin/mace4 \
+ p9m4-v05/bin/interpformat \
+ p9m4-v05/bin/prooftrans \
+ p9m4-v05/bin/isofilter \
+ p9m4-v05/bin/isofilter2 || die "Could not rm old executables"
+ distutils-r1_python_prepare_all
+ mkdir p9m4 || die "Could not create directory p9m4"
+ mv Mac-setup.py \
+ Win32-setup.py \
+ control.py \
+ files.py \
+ my_setup.py \
+ options.py \
+ partition_input.py \
+ platforms.py \
+ utilities.py \
+ wx_utilities.py \
+ p9m4 \
+ || die "Could not move package p9m4 python files to p9m4 directory"
+ touch p9m4/__init__.py \
+ || die "Could not create empty p9m4/__init__.py file"
+}
+
+python_install_all() {
+ dosym /usr/bin/prover9-mace4.py /usr/bin/prover9-mace4
+ insinto /usr/share
+ dodir /usr/share/${PN}/Images
+ insinto /usr/share/${PN}/Images
+ cd "${S}/Images" \
+ || die "Could not cd to Images"
+ doins *.gif *.ico
+ if use examples; then
+ dodir /usr/share/${PN}/Samples
+ insinto /usr/share/${PN}/Samples
+ cd "${S}/Samples" \
+ || die "Could not cd to Samples"
+ doins *.in
+
+ dodir /usr/share/${PN}/Samples/Equality/Mace4
+ insinto /usr/share/${PN}/Samples/Equality/Mace4
+ cd "${S}/Samples/Equality/Mace4" \
+ || die "Could not cd to Samples/Equality/Mace4"
+ doins *.in
+
+ dodir /usr/share/${PN}/Samples/Equality/Prover9
+ insinto /usr/share/${PN}/Samples/Equality/Prover9
+ cd "${S}/Samples/Equality/Prover9" \
+ || die "Could not cd to Samples/Equality/Prover9"
+ doins *.in
+
+ dodir /usr/share/${PN}/Samples/Non-Equality/Mace4
+ insinto /usr/share/${PN}/Samples/Non-Equality/Mace4
+ cd "${S}/Samples/Non-Equality/Mace4" \
+ || die "Could cd to Samples/Non-Equality/Mace4"
+ doins *.in
+
+ dodir /usr/share/${PN}/Samples/Non-Equality/Prover9
+ insinto /usr/share/${PN}/Samples/Non-Equality/Prover9
+ cd "${S}/Samples/Non-Equality/Prover9" \
+ || die "Could not cd to Samples/Non-Equality/Prover9"
+ doins *.in
+ fi
+}
diff --git a/sci-mathematics/pari-data/Manifest b/sci-mathematics/pari-data/Manifest
new file mode 100644
index 000000000000..494ea684c2af
--- /dev/null
+++ b/sci-mathematics/pari-data/Manifest
@@ -0,0 +1,5 @@
+DIST elldata-20120726.tgz 28386778 SHA256 07780ca9eafd32f8ab6d01724f679c4071a90004abd474cebe5ff75510994c0f SHA512 fa2d080783055e33e8338e4b54c484317896572c5b8e0227042608432f9839ac7467103f7cb74869c051ba70da0122b22ce1a190a688a220718abd5c141121fc WHIRLPOOL 319e1127106a3fe5042d16d21989e52222d54718547e544b3f19ef410ec13155b5e9253591e7070b0006f926d62b66fa87a9c82f1dffe626f261d78357c4f5a1
+DIST galdata-20120726.tgz 53229 SHA256 b7c1650099b24a20bdade47a85a928351c586287f0d4c73933313873e63290dd SHA512 bc89c8a42416e8ca25c356b7ad6d80ffcfff127e561fc338df87147a9e370ec71f7ae2eb6bef73d634cc7a8f18c794d7fd5ebfd0a042d3d356526a2eee28125a WHIRLPOOL 9332243fc120adde8bf511898c89c275b2db7e16f34b66e77ecd8789d0e14cc26a42d10bd7fb2cc849e9ed2b6494912e0baf4c6e8a12a6c9726f54e754a56e39
+DIST galpol-20120726.tgz 469851 SHA256 385d537b3c085d7885a9f6f02d63c2c2ad101dece07c2a19e4fba7bc81f72990 SHA512 4aa390761403f68f0d6b4f783e70b188f55d24c58614f72324c8cad86066e66153111fad674a38aeda84265ee994784a0bf276c49d1faa2c972bc1a075885f27 WHIRLPOOL 59b666f5b2106771af9f795343aefc73071de577e4b66d2bd771ccdf0a1e95e2913c0eec034f5f6b6642bf131051d39ed9902b9ea759722c37e8027d4cef4eef
+DIST nftables-20120726.tgz 8393731 SHA256 8dd3393ce6b3cfcf599f094f7b22bdffe17c3ba25deb912513d54676bd7cfe92 SHA512 cccc62fb0f6d8c578a4e165a1f2daf3b87acbbc38377044ddd98e2901a8e0554a46c8714bad0f4f4e09107b0c0c8f43069b4ddf4fba9c7832bad65ce3c901183 WHIRLPOOL 77f6dccd9c08722b5283670167975a17fdd732ddd234979b82c413b6ac529d068ff64de9bbc77fea45eb8663fa72b168143463642e9d8abcdb3739aa4845258c
+DIST seadata-20120726.tgz 19214199 SHA256 c9282a525ea3f92c1f9c6c69e37ac5a87b48fb9ccd943cfd7c881a3851195833 SHA512 393f2fae45964ad0921fcf417113e10b296cb4c3a0e0eec138c896827f43a5464c4b42a07313e0f3a4383e8df97912e2e359a4cd5225d014d7575e80c7dd996a WHIRLPOOL 0f1c94e8bf5be7ed923a8ff9012fa8df9cf851e1316b09ed28fff707e39abc034cb33ae84bdb80a302211c16ccfbd98ccdbad74254fbc5e3cd80ce28910516d9
diff --git a/sci-mathematics/pari-data/metadata.xml b/sci-mathematics/pari-data/metadata.xml
new file mode 100644
index 000000000000..05b8117db0af
--- /dev/null
+++ b/sci-mathematics/pari-data/metadata.xml
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+<herd>sci-mathematics</herd>
+<longdescription lang="en">
+ The extra data for PARI consists of:
+ * elldata is PARI/GP version of J. E. Cremona Elliptic Curve Data,
+ needed by ellsearch and ellidentify.
+ * galdata is needed by polgalois to compute Galois group in degrees
+ 8 through 11.
+ * seadata is needed by ellap for large primes.
+ * nftables is a repackaging of the historical megrez number field
+ tables (errors fixed, 1/10th the size, easier to use).
+</longdescription>
+</pkgmetadata>
diff --git a/sci-mathematics/pari-data/pari-data-20120726.ebuild b/sci-mathematics/pari-data/pari-data-20120726.ebuild
new file mode 100644
index 000000000000..6b2e6604a3e5
--- /dev/null
+++ b/sci-mathematics/pari-data/pari-data-20120726.ebuild
@@ -0,0 +1,26 @@
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=4
+
+DESCRIPTION="Data sets for pari"
+HOMEPAGE="http://pari.math.u-bordeaux.fr/"
+
+for p in elldata galdata galpol seadata nftables; do
+ SRC_URI="${SRC_URI} http://pari.math.u-bordeaux.fr/pub/pari/packages/${p}.tgz -> ${p}-${PV}.tgz"
+done
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~hppa ~mips ~ppc ~ppc64 ~sparc ~x86 ~x86-fbsd ~amd64-linux ~x86-linux ~x86-macos ~x86-solaris"
+IUSE=""
+
+RDEPEND="!<sci-libs/pari-2.5.0-r1"
+DEPEND="${RDEPEND}"
+S="${WORKDIR}"
+
+src_install() {
+ insinto /usr/share/pari
+ doins -r data/* nftables
+}
diff --git a/sci-mathematics/pari/Manifest b/sci-mathematics/pari/Manifest
new file mode 100644
index 000000000000..e81908eaa679
--- /dev/null
+++ b/sci-mathematics/pari/Manifest
@@ -0,0 +1,12 @@
+DIST elldata.tgz 14185595 SHA256 4102c23fdbeadc89b47ba31d05fc58cd3c3e0cca216b11ec5c3be1330d4a5218 SHA512 dc13d1cacb98a6c2774936997452bd34ae198da9206fea69bc7cdd28240d0cdd07bb0ec1f14b8e97bea4321a60a6a6144464ab3b629be2e37dd76a73efaf43ef WHIRLPOOL d77dd852997c15b2fbf56bb8c0403de49daae735e8d464c34ec3f44d38913285ea47122af8ddfd38fe6bbbc3187c1060a50c04ca14afae2d5b1532d815210435
+DIST galdata.tgz 53229 SHA256 b7c1650099b24a20bdade47a85a928351c586287f0d4c73933313873e63290dd SHA512 bc89c8a42416e8ca25c356b7ad6d80ffcfff127e561fc338df87147a9e370ec71f7ae2eb6bef73d634cc7a8f18c794d7fd5ebfd0a042d3d356526a2eee28125a WHIRLPOOL 9332243fc120adde8bf511898c89c275b2db7e16f34b66e77ecd8789d0e14cc26a42d10bd7fb2cc849e9ed2b6494912e0baf4c6e8a12a6c9726f54e754a56e39
+DIST nftables.tgz 8393731 SHA256 8dd3393ce6b3cfcf599f094f7b22bdffe17c3ba25deb912513d54676bd7cfe92 SHA512 cccc62fb0f6d8c578a4e165a1f2daf3b87acbbc38377044ddd98e2901a8e0554a46c8714bad0f4f4e09107b0c0c8f43069b4ddf4fba9c7832bad65ce3c901183 WHIRLPOOL 77f6dccd9c08722b5283670167975a17fdd732ddd234979b82c413b6ac529d068ff64de9bbc77fea45eb8663fa72b168143463642e9d8abcdb3739aa4845258c
+DIST pari-2.3.5.tar.gz 2018097 SHA256 47ddae1af73b4476660d2a89338483949067a97ffb8758c82e8189dfa4c89d88 SHA512 0e49e6310b4c76ef3370786a13aa8cbc5bb0b7dc84ec1665866d623e6284f45db8584eea759e8b5954dc9b5c8a3e866e77a377d18073ed33f11708a7e88a4cca WHIRLPOOL 1d7f3fcfb5c4b44479ea7494536bcb7c971df721a23bca9f7bdee878cc91c5beec5353920d352142534e89bb0158bfd8ad9a431a22c90fc577676e3f8ceb8b9b
+DIST pari-2.5.0.tar.gz 2714449 SHA256 5dc923b001ca0f8664facfafcd91946be63faf8f0e1df4b11bfac80f89ec37a2
+DIST pari-2.5.1.tar.gz 2718726 SHA256 72c1828af50878acf5f09b553e45ac04b24400e095d16e6948a06947538a8f4f SHA512 dd304bd02402602c1f114a7f4d1e54af0fce8707b196fd9da617c028ba3426418813aeaf818fecaa9f76572b1d36847463a3aa7f60848cdec607ec70131dc263 WHIRLPOOL acb4e2ce3b6680e6df1adc3d36d23b80b16e9efeb681ea726b74a3d83139152ca5e97ae95101cc79a69b9b34df34805efa09bec6663f30ea658d9cb07c587e45
+DIST pari-2.5.2.tar.gz 2719367 SHA256 6f04da2719b09fc7c4c713377df6541d641bbdd9ffc60aad280ba7951561ed98 SHA512 2d0332e5604a6bd41c8328c4cffc42302dd85db077a950e19769a0cc7b8c3e17b7c4c5c1514ecb2f75757015baa7e7df76f6174e997fbaa90874c5e6cf5e7fce WHIRLPOOL 27acb1350a1b4b06b97590f2e0c83d4cf03d6b321ca734c30c42efd50a370a3a1dabe346ed4bb8da63ee2f9f07a7353fc7358d71dd35c7e0eaab9a440ef19d08
+DIST pari-2.5.3.tar.gz 2720543 SHA256 f421530fe396f14be882e822f972b0514e30ca169c8ff984e413806d2d63527f SHA512 8606f1f1b59a8e9e8b5bdbaacd03f980da99616568c180eb37f6f530efad396343e3146f6c7adfc5dac6e43a1d35c898531ecf61dd6d62c26cafcd2554f8c43b WHIRLPOOL 01ed6c9133b2f16a21b3d9eda84a0ffbaff90fac2ed1ade055850e51524f9d1ba8bc39a9686c72e0705876a63cfd8dd31cd7364c825353b1781a22d305658d2e
+DIST pari-2.5.4.tar.gz 2721861 SHA256 9f37e14aca6c38cc9b7c18edec3319a30dcdb42e217981eda1fe85866c91fa3e SHA512 de2f0593682d638288908636d848489acf115f4858b91c574168db26c4ab7443465a21d1e6c43be19ecc57dcedcd883e5af72b65467a59a2c8811e4eec64e0b9 WHIRLPOOL 522c0451568f37dcbc89a2c47582051579fa7f3bd1eb4a0ad20f0023b1af0f0d5df14ef956bda170ed6539b0d2caa193c1b0807565abcdde9abfd03af0112be6
+DIST pari-2.7.0.tar.gz 3142306 SHA256 ffe9940194b4a1274d8aa690d985e11539be36fcdd2215b74c39b30470a567c2 SHA512 312ed6032e5b1b431d04cccb593e5ca6ca323361736669be0ed345cbb6cf22114c670984ae74120aacb4ac1af822a1fdf76aed7ba59a1cd4f94e26150562ad84 WHIRLPOOL 10473cfe8e873a4f3e15d70b5574502eac0fc7004af0842748436ee01d1470cdd3226864fb207bc31cef5387f41dc3d8503b7726de489469949a3ed0af98d05d
+DIST pari-2.7.1.tar.gz 3140893 SHA256 cc637918f3c0b20dc9bbea99e639e7a288b89ea4d0e4e3f9b7110a115bcb41be SHA512 ff32c181e6810af8a38f0dfe45b9f15d930923da5759c3e88595f56bf3c65ec0a79fdb9fb5f0e4ce0adb1ebc56a84e6b1606085057762073a85c0d1946857d5f WHIRLPOOL abd1f34de0d54f1b9d555927156baf8bdc54bf29c486ee41e943d414dadc3a68ada5e1af0e48acdfebb386273936a4925428a8fda1f69d250e66b15d857e236e
+DIST seadata.tgz 19214199 SHA256 c9282a525ea3f92c1f9c6c69e37ac5a87b48fb9ccd943cfd7c881a3851195833 SHA512 393f2fae45964ad0921fcf417113e10b296cb4c3a0e0eec138c896827f43a5464c4b42a07313e0f3a4383e8df97912e2e359a4cd5225d014d7575e80c7dd996a WHIRLPOOL 0f1c94e8bf5be7ed923a8ff9012fa8df9cf851e1316b09ed28fff707e39abc034cb33ae84bdb80a302211c16ccfbd98ccdbad74254fbc5e3cd80ce28910516d9
diff --git a/sci-mathematics/pari/files/50pari-gentoo.el b/sci-mathematics/pari/files/50pari-gentoo.el
new file mode 100644
index 000000000000..2f5b4da9084e
--- /dev/null
+++ b/sci-mathematics/pari/files/50pari-gentoo.el
@@ -0,0 +1,10 @@
+
+;; site-init for sci-mathematics/pari
+
+(add-to-list 'load-path "@SITELISP@")
+
+(autoload 'gp-mode "pari" nil t)
+(autoload 'gp-script-mode "pari" nil t)
+(autoload 'gp "pari" nil t)
+(autoload 'gpman "pari" nil t)
+(add-to-list 'auto-mode-alist '("\\.gp$" . gp-script-mode))
diff --git a/sci-mathematics/pari/files/pari-2.3.2-ppc-powerpc-arch-fix.patch b/sci-mathematics/pari/files/pari-2.3.2-ppc-powerpc-arch-fix.patch
new file mode 100644
index 000000000000..e3581c9de349
--- /dev/null
+++ b/sci-mathematics/pari/files/pari-2.3.2-ppc-powerpc-arch-fix.patch
@@ -0,0 +1,11 @@
+diff -Naur pari-2.3.2/config/arch-osname pari-2.3.2.new/config/arch-osname
+--- pari-2.3.2/config/arch-osname 2006-02-15 05:12:59.000000000 -0500
++++ pari-2.3.2.new/config/arch-osname 2007-11-26 00:17:17.000000000 -0500
+@@ -30,6 +30,7 @@
+ osf1) case "$5" in alpha) arch=alpha;; esac;;
+ linux) arch=`uname -m`
+ case $arch in
++ ppc) arch=powerpc;;
+ sparc64) arch=sparcv9;;
+ parisc*) arch=hppa;;
+ sparc) case "`cat /proc/cpuinfo`" in
diff --git a/sci-mathematics/pari/files/pari-2.3.2-strip.patch b/sci-mathematics/pari/files/pari-2.3.2-strip.patch
new file mode 100644
index 000000000000..0fee947fd556
--- /dev/null
+++ b/sci-mathematics/pari/files/pari-2.3.2-strip.patch
@@ -0,0 +1,11 @@
+--- config/Makefile.SH. 2007-10-01 23:45:45.000000000 +0200
++++ config/Makefile.SH 2007-10-01 23:55:10.000000000 +0200
+@@ -208,7 +208,7 @@
+ MV = mv -f
+ LN = $ln_s
+ CP_F = cp -f
+-STRIP = strip
++STRIP = true
+ STRIPFLAGS =
+
+ # Change these installation directories to suit your needs.
diff --git a/sci-mathematics/pari/files/pari-2.3.5-doc-make.patch b/sci-mathematics/pari/files/pari-2.3.5-doc-make.patch
new file mode 100644
index 000000000000..67edc8c70f11
--- /dev/null
+++ b/sci-mathematics/pari/files/pari-2.3.5-doc-make.patch
@@ -0,0 +1,46 @@
+--- config/DOC_Make.SH.orig 2010-09-21 21:24:56.655520480 +1200
++++ config/DOC_Make.SH 2010-09-21 21:26:24.683520242 +1200
+@@ -30,23 +30,23 @@
+ -rm -f libpari.std
+ pdftex libpari
+ pdftex libpari
+- make libpari.std; pdftex libpari; rm -f libpari.std
++ \$(MAKE) libpari.std; pdftex libpari; rm -f libpari.std
+ libpari.dvi: \$(PARI_TEX) \$(MACROS)
+ -rm -f libpari.std
+ tex libpari
+ tex libpari
+- make libpari.std; tex libpari; rm -f libpari.std
++ \$(MAKE) libpari.std; tex libpari; rm -f libpari.std
+
+ develop.pdf: develop.tex \$(MACROS)
+ -rm -f develop.std
+ pdftex develop
+ pdftex develop
+- make develop.std; pdftex develop; rm -f develop.std
++ \$(MAKE) develop.std; pdftex develop; rm -f develop.std
+ develop.dvi: develop.tex \$(MACROS)
+ -rm -f develop.std
+ tex develop
+ tex develop
+- make develop.std; tex develop; rm -f develop.std
++ \$(MAKE) develop.std; tex develop; rm -f develop.std
+
+ tutorial.pdf: tutorial.tex \$(MACROS)
+ -rm -f tutorial.std
+@@ -74,13 +74,13 @@
+ -rm -f users.std
+ tex users
+ tex users
+- make users.std; tex users; rm -f users.std
++ \$(MAKE) users.std; tex users; rm -f users.std
+
+ users.pdf: \$(USERS_TEX)
+ -rm -f users.std
+ pdftex users
+ pdftex users
+- make users.std; pdftex users; rm -f users.std
++ \$(MAKE) users.std; pdftex users; rm -f users.std
+
+ gpman: gp.1
+ nroff -man gp.1 | unix2dos -ascii > gp.man
diff --git a/sci-mathematics/pari/files/pari-2.5.0-doc-make.patch b/sci-mathematics/pari/files/pari-2.5.0-doc-make.patch
new file mode 100644
index 000000000000..0882da03e6a4
--- /dev/null
+++ b/sci-mathematics/pari/files/pari-2.5.0-doc-make.patch
@@ -0,0 +1,82 @@
+--- config/DOC_Make.SH.orig 2011-07-28 14:11:34.430896929 +1200
++++ config/DOC_Make.SH 2011-07-28 14:11:39.832738158 +1200
+@@ -21,7 +21,8 @@
+
+ doc all: develop.dvi libpari.dvi users.dvi refcard.ps tutorial.dvi
+ docps: develop.ps libpari.ps refcard.ps tutorial.ps users.ps INSTALL.ps
+-docpdf: develop.pdf libpari.pdf users.pdf tutorial.pdf refcard.pdf INSTALL.pdf
++#docpdf: develop.pdf libpari.pdf users.pdf tutorial.pdf refcard.pdf INSTALL.pdf
++docpdf: \$(PARI_TEX) \$(MACROS) pass1 pass2 indexing refcard.pdf INSTALL.pdf
+
+ .SUFFIXES: .tex .ipf .pod .inf .dumbpod .3 .html
+
+@@ -37,27 +38,49 @@
+ %.dvi: %.tex \$(MACROS)
+ tex \$<
+
++pass1: \$(PARI_TEX) \$(USERS_TEX) develop.tex tutorial.tex \$(MACROS)
++ -rm -f *.std
++ pdftex libpari
++ pdftex develop
++ pdftex tutorial
++ pdftex users
++
++pass2: pass1
++ pdftex libpari
++ pdftex develop
++ pdftex tutorial
++ pdftex users
++
++indexing: pass2
++ \$(MAKE) libpari.std
++ \$(MAKE) develop.std
++ \$(MAKE) users.std
++ pdftex libpari
++ pdftex develop
++ pdftex users
++ -rm -f *.std
++
+ libpari.pdf: \$(PARI_TEX) \$(MACROS)
+ -rm -f libpari.std
+ pdftex libpari
+ pdftex libpari
+- make libpari.std; pdftex libpari; rm -f libpari.std
++ \$(MAKE) libpari.std; pdftex libpari; rm -f libpari.std
+ libpari.dvi: \$(PARI_TEX) \$(MACROS)
+ -rm -f libpari.std
+ tex libpari
+ tex libpari
+- make libpari.std; tex libpari; rm -f libpari.std
++ \$(MAKE) libpari.std; tex libpari; rm -f libpari.std
+
+ develop.pdf: develop.tex \$(MACROS)
+ -rm -f develop.std
+ pdftex develop
+ pdftex develop
+- make develop.std; pdftex develop; rm -f develop.std
++ \$(MAKE)make develop.std; pdftex develop; rm -f develop.std
+ develop.dvi: develop.tex \$(MACROS)
+ -rm -f develop.std
+ tex develop
+ tex develop
+- make develop.std; tex develop; rm -f develop.std
++ \$(MAKE) develop.std; tex develop; rm -f develop.std
+
+ tutorial.pdf: tutorial.tex \$(MACROS)
+ -rm -f tutorial.std
+@@ -85,13 +108,13 @@
+ -rm -f users.std
+ tex users
+ tex users
+- make users.std; tex users; rm -f users.std
++ \$(MAKE) users.std; tex users; rm -f users.std
+
+ users.pdf: \$(USERS_TEX)
+ -rm -f users.std
+ pdftex users
+ pdftex users
+- make users.std; pdftex users; rm -f users.std
++ \$(MAKE) users.std; pdftex users; rm -f users.std
+
+ gpman: gp.1
+ nroff -man gp.1 | unix2dos -ascii > gp.man
diff --git a/sci-mathematics/pari/files/pari-2.5.0-macos.patch b/sci-mathematics/pari/files/pari-2.5.0-macos.patch
new file mode 100644
index 000000000000..1b4076009379
--- /dev/null
+++ b/sci-mathematics/pari/files/pari-2.5.0-macos.patch
@@ -0,0 +1,21 @@
+--- config/get_dlld.orig 2011-07-28 14:27:13.341072367 +1200
++++ config/get_dlld 2011-07-28 14:27:46.225178023 +1200
+@@ -94,7 +94,7 @@
+ *) extra=;;
+ esac
+ case "$osname" in
+- darwin) shared=-dynamiclib;;
++ darwin) shared="-dynamiclib -install_name \$(PURELIBDIR)/\$(LIBPARI_DYN)";;
+ *) shared=-shared;;
+ esac
+ DLLDFLAGS="$shared $extra \$(CFLAGS) \$(DLCFLAGS) $DLLDFLAGS"
+--- config/Makefile.SH.orig 2011-07-28 14:29:06.753681364 +1200
++++ config/Makefile.SH 2011-07-28 14:29:10.589276933 +1200
+@@ -234,6 +234,7 @@
+ # DESTDIR is used to install to a false hierachy (to build a Debian package)
+ INCLUDEDIR= "\$(DESTDIR)$includedir"
+ LIBDIR = "\$(DESTDIR)$libdir"
++PURELIBDIR= $libdir
+ BINDIR = "\$(DESTDIR)$bindir"
+ MANDIR = "\$(DESTDIR)$mandir"
+ DATADIR = "\$(DESTDIR)$datadir"
diff --git a/sci-mathematics/pari/files/pari-2.5.0-mp.c.patch b/sci-mathematics/pari/files/pari-2.5.0-mp.c.patch
new file mode 100644
index 000000000000..0bcfffc08176
--- /dev/null
+++ b/sci-mathematics/pari/files/pari-2.5.0-mp.c.patch
@@ -0,0 +1,23 @@
+Index: src/kernel/gmp/mp.c
+===================================================================
+--- src/kernel/gmp/mp.c (revision 13151)
++++ src/kernel/gmp/mp.c (working copy)
+@@ -45,18 +45,8 @@
+ /*We need PARI invmod renamed to invmod_pari*/
+ #define INVMOD_PARI
+
+-static void *gmp_realloc(void *ptr, size_t old_size, size_t new_size) {
+- (void)old_size; return (void *) pari_realloc(ptr,new_size);
+-}
+-
+-static void gmp_free(void *ptr, size_t old_size){
+- (void)old_size; pari_free(ptr);
+-}
+-
+ int pari_kernel_init(void)
+ {
+- /* Use pari_malloc instead of malloc */
+- mp_set_memory_functions((void *(*)(size_t)) pari_malloc, gmp_realloc, gmp_free);
+ return 0;
+ }
+
diff --git a/sci-mathematics/pari/files/pari-2.5.1-1302.patch b/sci-mathematics/pari/files/pari-2.5.1-1302.patch
new file mode 100644
index 000000000000..245e587d275c
--- /dev/null
+++ b/sci-mathematics/pari/files/pari-2.5.1-1302.patch
@@ -0,0 +1,33 @@
+commit 917b505c86a70dda2191d380861af05becc03858
+Author: Karim Belabas <Karim.Belabas@math.u-bordeaux1.fr>
+Date: Mon Mar 12 23:54:11 2012 +0100
+
+ ispower(x < 0,, &n): n could have the wrong sign [#1302]
+
+diff --git a/src/basemath/arith1.c b/src/basemath/arith1.c
+index ded946b..5502ba5 100644
+--- a/src/basemath/arith1.c
++++ b/src/basemath/arith1.c
+@@ -1109,6 +1109,7 @@ Z_isanypower(GEN x, GEN *pty)
+ *pty = gerepileuptoint(av, y);
+ return k;
+ }
++ if (pty) togglesign_safe(pty);
+ }
+ if (pty) *pty = gerepilecopy(av, *pty); else avma = av;
+ return k;
+diff --git a/src/test/32/ispower b/src/test/32/ispower
+index bf4b6f0..84d8de7 100644
+--- a/src/test/32/ispower
++++ b/src/test/32/ispower
+@@ -1118,7 +1118,7 @@
+ [2, 999]
+ [6, 10]
+ [3, -4]
+-[3, 2]
+-[3, 21218]
++[3, -2]
++[3, -21218]
+ [3, -1/4]
+-Total time spent: 3236
++Total time spent: 3012
diff --git a/sci-mathematics/pari/files/pari-2.5.1-1304.patch b/sci-mathematics/pari/files/pari-2.5.1-1304.patch
new file mode 100644
index 000000000000..3da2e8558dac
--- /dev/null
+++ b/sci-mathematics/pari/files/pari-2.5.1-1304.patch
@@ -0,0 +1,39 @@
+commit ff707a3f2ba2d5c555434ba50547453833a7570f
+Author: Karim Belabas <Karim.Belabas@math.u-bordeaux1.fr>
+Date: Sun Mar 18 23:54:02 2012 +0100
+
+ 71- issquarefree(0) => error [#1304]
+
+diff --git a/src/basemath/ifactor1.c b/src/basemath/ifactor1.c
+index 046491f..8f9fbaa 100644
+--- a/src/basemath/ifactor1.c
++++ b/src/basemath/ifactor1.c
+@@ -3493,7 +3493,11 @@ moebius(GEN n)
+ GEN
+ gissquarefree(GEN x) { return map_proto_lG(issquarefree,x); }
+ long
+-Z_issquarefree(GEN n) { return moebius(n)? 1: 0; }
++Z_issquarefree(GEN n)
++{
++ if (!signe(n)) return 0;
++ return moebius(n)? 1: 0;
++}
+ long
+ issquarefree(GEN x)
+ {
+diff --git a/src/test/32/arith b/src/test/32/arith
+new file mode 100644
+index 0000000..3c5981a
+--- /dev/null
++++ b/src/test/32/arith
+@@ -0,0 +1,2 @@
++0
++Total time spent: 8
+diff --git a/src/test/in/arith b/src/test/in/arith
+new file mode 100644
+index 0000000..fb92bed
+--- /dev/null
++++ b/src/test/in/arith
+@@ -0,0 +1,2 @@
++\\#1304
++issquarefree(0)
diff --git a/sci-mathematics/pari/files/pari-2.5.1-gcc47.patch b/sci-mathematics/pari/files/pari-2.5.1-gcc47.patch
new file mode 100644
index 000000000000..e7b27159fa06
--- /dev/null
+++ b/sci-mathematics/pari/files/pari-2.5.1-gcc47.patch
@@ -0,0 +1,18 @@
+Index: pari-2.5.1/src/basemath/bibli2.c
+===================================================================
+--- pari-2.5.1.orig/src/basemath/bibli2.c 2012-01-26 17:26:13.000000000 +0100
++++ pari-2.5.1/src/basemath/bibli2.c 2012-06-04 10:08:41.000000000 +0200
+@@ -1394,12 +1394,12 @@
+ int (*CMP)(void*,GEN,GEN);
+ int (*cmp)(GEN,GEN) = (flag & cmp_LEX)? &lexcmp: &gcmp;
+ void *E;
++ struct veccmp_s v;
+
+ if (flag < 0 || flag > (cmp_REV|cmp_LEX|cmp_IND|cmp_UNIQ))
+ pari_err(flagerr,"vecsort");
+ if (k) {
+ long i, j, l, lk, tx, lx;
+- struct veccmp_s v;
+ GEN y;
+
+ /* cf init_sort */
diff --git a/sci-mathematics/pari/files/pari-2.5.1-no-automagic.patch b/sci-mathematics/pari/files/pari-2.5.1-no-automagic.patch
new file mode 100644
index 000000000000..8fee1f7eaf70
--- /dev/null
+++ b/sci-mathematics/pari/files/pari-2.5.1-no-automagic.patch
@@ -0,0 +1,100 @@
+diff -Nur pari-2.5.1.orig/config/get_config_options pari-2.5.1/config/get_config_options
+--- pari-2.5.1.orig/config/get_config_options 2012-08-01 18:32:03.000000000 +0100
++++ pari-2.5.1/config/get_config_options 2012-08-01 20:57:09.000000000 +0100
+@@ -83,10 +83,12 @@
+ --with-ncurses-lib=*|--with-ncurses=*)
+ with_ncurses_lib=`echo "$1" | sed -e 's/[-a-z]*=//'` ;;
+
++ --without-qt|--with-qt=no) without_qt=yes ;;
+ --with-qt) with_qt=yes ;;
+ --with-qt=*)
+ with_qt=`echo "$1" | sed -e 's/[-a-z]*=//'` ;;
+
++ --without-fltk|--with-fltk=no) without_fltk=yes ;;
+ --with-fltk) with_fltk=yes ;;
+ --with-fltk=*)
+ with_fltk=`echo "$1" | sed -e 's/[-a-z]*=//'` ;;
+@@ -158,7 +160,9 @@
+ --with-gmp-lib=DIR specify location of gmp libs
+
+ --with-qt[=DIR] use the Qt graphical library [prefix for Qt dir.]
++ --without-qt do not try to use the Qt lib
+ --with-fltk[=DIR] use the FLTK graphical library [prefix for FLTK dir.]
++ --without-fltk do not try to use the FLTK lib
+
+ EOT
+ exit 1
+diff -Nur pari-2.5.1.orig/config/get_fltk pari-2.5.1/config/get_fltk
+--- pari-2.5.1.orig/config/get_fltk 2012-08-01 18:32:03.000000000 +0100
++++ pari-2.5.1/config/get_fltk 2012-08-01 22:28:23.000000000 +0100
+@@ -2,6 +2,9 @@
+ with_fltk=yes
+ fi
+ FLTKDIR=
++if test -z "$without_fltk; then
++ FLTKDIR="`fltk-config --prefix 2>/dev/null`"
++fi
+ case "$with_fltk" in
+ yes)
+ pth=$libpth; lib=fltk; . ./locatelib
+diff -Nur pari-2.5.1.orig/config/get_graphic_lib pari-2.5.1/config/get_graphic_lib
+--- pari-2.5.1.orig/config/get_graphic_lib 2012-08-01 18:32:03.000000000 +0100
++++ pari-2.5.1/config/get_graphic_lib 2012-08-01 22:16:57.000000000 +0100
+@@ -11,6 +11,7 @@
+ else
+ if test -n "$with_fltk"; then which_graphic_lib=fltk; fi
+ if test -n "$with_qt"; then which_graphic_lib=Qt; fi
++ if test -n "$without_fltk" -a -n "$without_qt"; then which_graphic_lib=none; fi
+ if test "$which_graphic_lib" != none; then
+ case $osname in
+ mingw) case $which_graphic_lib in
+@@ -41,7 +42,7 @@
+ case $which_graphic_lib in
+ auto|fltk)
+ . ./get_fltk # FLTKDIR, FLTK_LIBS
+- if test -z "$FLTKDIR"; then
++ if test -z "`fltk-config --ldflags 2> /dev/null`"; then
+ case $which_graphic_lib in fltk) which_graphic_lib=none;; esac
+ else
+ which_graphic_lib=fltk
+diff -Nur pari-2.5.1.orig/config/get_Qt pari-2.5.1/config/get_Qt
+--- pari-2.5.1.orig/config/get_Qt 2012-08-01 18:32:03.000000000 +0100
++++ pari-2.5.1/config/get_Qt 2012-08-01 20:39:28.000000000 +0100
+@@ -5,7 +5,7 @@
+ case "$with_qt" in
+ yes)
+ pth="/usr/local/lib /usr/local/share /usr/lib /usr/share"
+- QTDIR=`locatedir qt4/bin $pth`
++ QTDIR=`locatedir qt4 $pth`
+ QTLIB="-lQtCore -lQtGui"
+ which_graphic_lib=Qt4
+ if test -z "$QTDIR"; then
+diff -Nur pari-2.5.1.orig/config/Makefile.SH pari-2.5.1/config/Makefile.SH
+--- pari-2.5.1.orig/config/Makefile.SH 2012-08-01 18:32:03.000000000 +0100
++++ pari-2.5.1/config/Makefile.SH 2012-08-01 21:08:20.000000000 +0100
+@@ -65,12 +65,12 @@
+ PLOTLIBS="-L\$(QTDIR)/lib $QTLIB"
+ graph=plotQt;;
+ Qt4)
+- PLOTCFLAGS='-D__FANCY_WIN__ -I$(QTDIR)/include'
+- PLOTLIBS="-L\$(QTDIR)/lib $QTLIB"
++ PLOTCFLAGS='-D__FANCY_WIN__ `pkg-config --cflags QtGui`'
++ PLOTLIBS="`pkg-config --libs QtGui`"
+ graph=plotQt4;;
+ fltk)
+- PLOTCFLAGS="-I\$(FLTKDIR)/include $X11_INC"
+- PLOTLIBS="-L\$(FLTKDIR)/lib -lfltk $FLTK_LIBS"
++ PLOTCFLAGS="`fltk-config --cxxflags` $X11_INC"
++ PLOTLIBS="`fltk-config --ldflags`"
+ postconfig='-fltk-config --post '
+ graph=plotfltk;;
+ win32)
+@@ -254,7 +254,7 @@
+ GMPINCLUDE = $GMPINCLUDE
+ # Graphic library.
+ QTDIR = "$QTDIR"
+-MOC = \$(QTDIR)/bin/moc
++MOC = "`which moc`"
+ PLOTCFLAGS = $PLOTCFLAGS
+ PLOTLIBS = $PLOTLIBS
+ CPLUSPLUS = g++
diff --git a/sci-mathematics/pari/files/pari-2.5.4-polred.patch b/sci-mathematics/pari/files/pari-2.5.4-polred.patch
new file mode 100644
index 000000000000..4287c9d35d66
--- /dev/null
+++ b/sci-mathematics/pari/files/pari-2.5.4-polred.patch
@@ -0,0 +1,754 @@
+diff -ru src/src/basemath/base1.c b/src/basemath/base1.c
+--- src/src/basemath/base1.c 2013-05-06 16:01:56.000000000 +0200
++++ b/src/basemath/base1.c 2013-05-06 16:49:09.042406927 +0200
+@@ -1675,40 +1675,42 @@
+ ZX_is_better(GEN y, GEN x, GEN *dx)
+ {
+ GEN d = ZX_disc(y);
+- long cmp = absi_cmp(d, *dx);
++ int cmp;
++ if (!*dx) *dx = ZX_disc(x);
++ cmp = absi_cmp(d, *dx);
+ if (cmp < 0) { *dx = d; return 1; }
+ if (cmp == 0) return cmp_abs_ZX(y, x) < 0;
+ return 0;
+ }
+
+-static GEN polred_aux(nfbasic_t *T, GEN *pro, long flag);
++static void polredbest_aux(nfbasic_t *T, GEN *pro, GEN *px, GEN *pdx, GEN *pa);
+ /* Seek a simpler, polynomial pol defining the same number field as
+ * x (assumed to be monic at this point) */
+ static GEN
+ nfpolred(nfbasic_t *T, GEN *pro)
+ {
+- GEN x = T->x, dx = T->dx, a, z, rev, pow, dpow;
++ GEN x = T->x, dx, b, rev, pow, dpow;
+ long i, n = degpol(x), v = varn(x);
+
+ if (n == 1) {
+ T->x = deg1pol_shallow(gen_1, gen_m1, v);
+ *pro = NULL; return pol_1(v);
+ }
+- z = polred_aux(T, pro, nf_ORIG | nf_RED);
+- if (typ(z) != t_VEC || !ZX_is_better(gel(z,1),x,&dx))
+- return NULL; /* no improvement */
+-
+- rev = QXQ_reverse(gel(z,2), x);
+- x = gel(z,1); if (DEBUGLEVEL>1) err_printf("xbest = %Ps\n",x);
++ polredbest_aux(T, pro, &x, &dx, &b);
++ if (x == T->x) return NULL; /* no improvement */
++ if (DEBUGLEVEL>1) err_printf("xbest = %Ps\n",x);
+
+ /* update T */
++ rev = QXQ_reverse(b, T->x);
+ pow = QXQ_powers(rev, n-1, x);
+ pow = Q_remove_denom(pow, &dpow);
+- a = T->bas;
+- for (i=2; i<=n; i++) gel(a,i) = QX_ZXQV_eval(gel(a,i), pow, dpow);
++ for (i=2; i<=n; i++) gel(T->bas,i) = QX_ZXQV_eval(gel(T->bas,i), pow, dpow);
+ (void)Z_issquareall(diviiexact(dx,T->dK), &(T->index));
+- T->basden = get_bas_den(a);
+- T->dx = dx; T->x = x; *pro = NULL; return rev;
++ T->basden = get_bas_den(T->bas);
++ T->dx = dx;
++ T->x = x;
++ *pro = NULL; /* reset */
++ return rev;
+ }
+
+ /* let bas a t_VEC of QX giving a Z-basis of O_K. Return the index of the
+@@ -1776,7 +1778,7 @@
+ x = Q_primpart(x);
+ RgX_check_ZX(x, "nfinit");
+ if (!ZX_is_irred(x)) pari_err(redpoler, "nfinit");
+- if (flag & nf_RED || !gequal1(gel(x,lg(x)-1)))
++ if (flag & nf_RED || !equali1(gel(x,lg(x)-1)))
+ x = ZX_Q_normalize(x, &(T->lead));
+ nfmaxord(&S, x, flag, fa);
+ index = S.index;
+@@ -1822,26 +1824,32 @@
+ nfinitall(GEN x, long flag, long prec)
+ {
+ const pari_sp av = avma;
+- GEN nf;
++ GEN nf, lead;
+ nfbasic_t T;
+
+ nfbasic_init(x, flag, NULL, &T);
+ nfbasic_add_disc(&T); /* more expensive after set_LLL_basis */
+- if (T.lead != gen_1 && !(flag & nf_RED))
++ lead = T.lead;
++ if (lead != gen_1 && !(flag & nf_RED))
+ {
+ pari_warn(warner,"non-monic polynomial. Result of the form [nf,c]");
+ flag |= nf_RED | nf_ORIG;
+ }
+ if (flag & nf_RED)
+ {
+- GEN ro, rev = nfpolred(&T, &ro);
++ GEN ro, rev;
++ /* lie to polred: more efficient to update *after* modreverse, than to
++ * unscale in the polred subsystem */
++ T.lead = gen_1;
++ rev = nfpolred(&T, &ro);
+ nf = nfbasic_to_nf(&T, ro, prec);
+ if (flag & nf_ORIG)
+ {
+ if (!rev) rev = pol_x(varn(T.x)); /* no improvement */
+- if (T.lead != gen_1) rev = RgX_Rg_div(rev, T.lead);
++ if (lead != gen_1) rev = RgX_Rg_div(rev, lead);
+ nf = mkvec2(nf, mkpolmod(rev, T.x));
+ }
++ T.lead = lead; /* restore */
+ } else {
+ GEN ro; set_LLL_basis(&T, &ro, 0.99);
+ nf = nfbasic_to_nf(&T, ro, prec);
+@@ -1948,7 +1956,7 @@
+ get_polchar(CG_data *d, GEN x)
+ { return get_pol(d, RgM_RgC_mul(d->ZKembed,x)); }
+
+-/* return a defining polynomial for Q(w_i) */
++/* return a defining polynomial for Q(w_k) */
+ static GEN
+ get_polmin_w(CG_data *d, long k)
+ {
+@@ -1956,6 +1964,22 @@
+ if (g) (void)ZX_gcd_all(g, ZX_deriv(g), &g);
+ return g;
+ }
++/* return a defining polynomial for Q(w_k+w_l) */
++static GEN
++get_polmin_add2(CG_data *d, long k, long l)
++{
++ GEN g = get_pol(d, RgV_add(gel(d->ZKembed,k), gel(d->ZKembed,l)));
++ if (g) (void)ZX_gcd_all(g, ZX_deriv(g), &g);
++ return g;
++}
++/* return a defining polynomial for Q(w_k-w_l) */
++static GEN
++get_polmin_sub2(CG_data *d, long k, long l)
++{
++ GEN g = get_pol(d, RgV_sub(gel(d->ZKembed,k), gel(d->ZKembed,l)));
++ if (g) (void)ZX_gcd_all(g, ZX_deriv(g), &g);
++ return g;
++}
+
+ /* does x generate the correct field ? */
+ static GEN
+@@ -2044,13 +2068,67 @@
+ d->v = varn(T->x);
+ d->r1= T->r1; return prec;
+ }
++static void
++update(GEN *pai, GEN *pch, nfbasic_t *T, long orig)
++{
++ GEN ch = *pch, ai = *pai;
++ if (!ch)
++ { /* accuracy too low, compute algebraically */
++ ch = ZXQ_charpoly(ai, T->x, varn(T->x));
++ (void)ZX_gcd_all(ch, ZX_deriv(ch), &ch);
++ }
++ if (ZX_canon_neg(ch) && orig) ai = RgX_neg(ai);
++ if (DEBUGLEVEL>3) err_printf("polred: generator %Ps\n", ch);
++ if (T->lead != gen_1 && orig) ai = RgX_unscale(ai, ginv(T->lead));
++ *pch = ch; *pai = ai;
++}
++static GEN
++findmindisc(GEN y, GEN *pa)
++{
++ GEN a = *pa, x = gel(y,1), b = gel(a,1), dx = NULL;
++ long i, l = lg(y);
++ for (i = 2; i < l; i++)
++ {
++ GEN yi = gel(y,i);
++ if (ZX_is_better(yi,x,&dx)) { x = yi; b = gel(a,i); }
++ }
++ *pa = b; return x;
++}
++/* filter [y,b] from polred_aux: keep a single polynomial of degree n in y
++ * [ the best wrt discriminant ordering ], but keep all non-primitive
++ * polynomials */
++static void
++filter(GEN y, GEN b, long n)
++{
++ GEN x, a, dx;
++ long i, k = 1, l = lg(y);
++ a = x = dx = NULL;
++ for (i = 1; i < l; i++)
++ {
++ GEN yi = gel(y,i), ai = gel(b,i);
++ if (degpol(yi) == n)
++ {
++ if (dx && !ZX_is_better(yi,x,&dx)) continue;
++ if (!dx) dx = ZX_disc(yi);
++ x = yi; a = ai; continue;
++ }
++ gel(y,k) = yi;
++ gel(b,k) = ai; k++;
++ }
++ if (dx)
++ {
++ gel(y,k) = x;
++ gel(b,k) = a; k++;
++ }
++ setlg(y, k);
++ setlg(b, k);
++}
++
+ static GEN
+-polred_aux(nfbasic_t *T, GEN *pro, long flag)
++polred_aux(nfbasic_t *T, GEN *pro, long orig)
+ {
+ GEN b, y, x = T->x;
+- long i, v = varn(x), l = lg(T->bas);
+- const long orig = flag & nf_ORIG;
+- const long nfred = flag & nf_RED;
++ long maxi, i, j, k, v = varn(x), n = lg(T->bas)-1;
+ nffp_t F;
+ CG_data d;
+
+@@ -2058,27 +2136,41 @@
+ *pro = F.ro;
+ d.ZKembed = F.M;
+
+- y = cgetg(l, t_VEC);
+- b = cgetg(l, t_COL);
++ /* n + 2 sum_{1 <= i <= n} n-i = n + n(n-1) = n*n */
++ y = cgetg(n*n + 1, t_VEC);
++ b = cgetg(n*n + 1, t_COL);
++ /* i = 1 */
+ gel(y,1) = deg1pol_shallow(gen_1, gen_m1, v);
+ gel(b,1) = gen_1;
+- for (i = 2; i < l; i++)
++ for (i = k = 2; i <= n; i++)
+ {
+- GEN ch, ai = gel(T->bas,i);
++ GEN ch, ai;
++ ai = gel(T->bas,i);
+ ch = get_polmin_w(&d, i);
+- /* if accuracy too low, compute algebraically */
+- if (!ch)
++ update(&ai, &ch, T, orig);
++ gel(y,k) = ch;
++ gel(b,k) = ai; k++;
++ }
++ k = i;
++ maxi = minss(n, 3);
++ for (i = 1; i <= maxi; i++)
++ for (j = i+1; j <= n; j++)
+ {
+- ch = ZXQ_charpoly(ai, x, v);
+- (void)ZX_gcd_all(ch, ZX_deriv(ch), &ch);
++ GEN ch, ai;
++ ai = gadd(gel(T->bas,i), gel(T->bas,j));
++ ch = get_polmin_add2(&d, i, j);
++ update(&ai, &ch, T, orig);
++ gel(y,k) = ch;
++ gel(b,k) = ai; k++;
++
++ ai = gsub(gel(T->bas,i), gel(T->bas,j));
++ ch = get_polmin_sub2(&d, i, j);
++ update(&ai, &ch, T, orig);
++ gel(y,k) = ch;
++ gel(b,k) = ai; k++;
+ }
+- if (ZX_canon_neg(ch) && orig) ai = RgX_neg(ai);
+- if (nfred && degpol(ch) == l-1) return mkvec2(ch, ai);
+- if (DEBUGLEVEL>3) err_printf("polred: generator %Ps\n", ch);
+- if (T->lead != gen_1 && orig) ai = RgX_unscale(ai, ginv(T->lead));
+- gel(y,i) = ch;
+- gel(b,i) = ai;
+- }
++ setlg(y, k);
++ setlg(b, k); filter(y, b, n);
+ if (!orig) return gen_sort_uniq(y, (void*)cmpii, &gen_cmp_RgX);
+ (void)sort_factor_pol(mkmat2(y, b), cmpii);
+ settyp(y, t_COL); return mkmat2(b, y);
+@@ -2089,10 +2181,58 @@
+ {
+ pari_sp av = avma;
+ GEN ro;
+- nfbasic_t T; nfbasic_init(x, flag & (nf_PARTIALFACT|nf_RED), fa, &T);
++ nfbasic_t T; nfbasic_init(x, flag & nf_PARTIALFACT, fa, &T);
+ return gerepilecopy(av, polred_aux(&T, &ro, flag & nf_ORIG));
+ }
+
++/* finds "best" polynomial in polred_aux list, defaulting to T->x if none of
++ * them is primitive. *px is the ZX, characteristic polynomial of *pb, *pdx
++ * its discriminant.
++ * Set *pro = polroots(T->x) [ NOT *px ], in case caller needs it. */
++static void
++polredbest_aux(nfbasic_t *T, GEN *pro, GEN *px, GEN *pdx, GEN *pb)
++{
++ GEN a, v, y, x = T->x, b = pol_x(varn(x)); /* default values */
++ long i, l, n = degpol(x);
++ v = polred_aux(T, pro, nf_ORIG);
++ *pdx = T->dx;
++ y = gel(v,2);
++ a = gel(v,1); l = lg(a);
++ for (i=1; i<l; i++)
++ {
++ GEN yi = gel(y,i);
++ pari_sp av = avma;
++ if (degpol(yi) == n && ZX_is_better(yi,x,pdx)) { x = yi; b = gel(a,i); }
++ else avma = av;
++ }
++ *px = x;
++ *pb = b;
++}
++GEN
++polredbest(GEN x, long flag)
++{
++ pari_sp av = avma;
++ GEN dx, ro, b;
++ long fl;
++ nfbasic_t T;
++ switch(flag)
++ {
++ default: pari_err(talker, "invalid flag in polredbest()");
++ case 0: fl = nf_PARTIALFACT; break;
++ case 1: fl = nf_PARTIALFACT|nf_ORIG; break;
++ }
++ nfbasic_init(x, fl, NULL, &T);
++ polredbest_aux(&T, &ro, &x, &dx, &b);
++ if (flag)
++ {
++ if (x == T.x)
++ b = pol_x(varn(x)); /* no improvement */
++ else
++ b = QXQ_reverse(b, T.x);
++ x = mkvec2(x, mkpolmod(b,x));
++ }
++ return gerepilecopy(av, x);
++}
+ /* FIXME: backward compatibility */
+ GEN
+ polred0(GEN x, long flag, GEN fa)
+@@ -2273,22 +2413,6 @@
+ return bound;
+ }
+
+-static GEN
+-findmindisc(GEN y, GEN *pa)
+-{
+- GEN a = *pa, x = gel(y,1), b = gel(a,1), dx;
+- long i, l = lg(y);
+-
+- if (l == 2) { *pa = b; return x; }
+- dx = ZX_disc(x);
+- for (i = 2; i < l; i++)
+- {
+- GEN yi = gel(y,i);
+- if (ZX_is_better(yi,x,&dx)) { x = yi; b = gel(a,i); }
+- }
+- *pa = b; return x;
+-}
+-
+ /* z "small" minimal polynomial of Mod(a,x), deg z = deg x */
+ static GEN
+ store(GEN x, GEN z, GEN a, nfbasic_t *T, long flag, GEN u)
+@@ -2355,7 +2479,7 @@
+ GEN y, a, u;
+ nfbasic_t T;
+
+- nfbasic_init(x, flag & (nf_PARTIALFACT|nf_RED), NULL, &T);
++ nfbasic_init(x, flag & nf_PARTIALFACT, NULL, &T);
+ x = T.x; vx = varn(x);
+
+ if (degpol(x) == 1)
+diff -ru src/src/functions/number_fields/polredabs b/src/functions/number_fields/polredabs
+--- src/src/functions/number_fields/polredabs 2013-05-06 16:01:57.000000000 +0200
++++ b/src/functions/number_fields/polredabs 2013-05-06 16:47:04.542393431 +0200
+@@ -17,8 +17,8 @@
+ \misctitle{Warning} This routine uses an exponential-time algorithm to
+ enumerate all potential generators, and may be exceedingly slow when the
+ number field has many subfields, hence a lot of elements of small $T_2$-norm.
+- E.g. do not try it on the compositum of many quadratic fields; in that case,
+- use \tet{polred} instead.
++ The function \tet{polredbest} is in general much faster (it runs in
++ polynomial time), and tends to return polynomials with smaller discriminants.
+
+ The binary digits of $\fl$ mean
+
+@@ -38,6 +38,15 @@
+ (has at most one large prime factor not in the \kbd{addprimes} table), the
+ result is the same.
+
++ \bprog
++ ? T = x^16 - 136*x^14 + 6476*x^12 - 141912*x^10 + 1513334*x^8 - 7453176*x^6 + 13950764*x^4 - 5596840*x^2 + 46225
++ ? T1 = polredabs(T); T2 = polredbest(T);
++ ? [ norml2(polroots(T1)), norml2(polroots(T2)) ]
++ %3 = [88.0000000, 120.000000]
++ ? [ sizedigit(poldisc(T1)), sizedigit(poldisc(T2)) ]
++ %4 = [75, 67]
++ @eprog
++
+ Variant: Instead of the above hardcoded numerical flags, one should use an
+ or-ed combination of
+
+diff -ruN src/src/functions/number_fields/polredbest b/src/functions/number_fields/polredbest
+--- src/src/functions/number_fields/polredbest 1970-01-01 01:00:00.000000000 +0100
++++ b/src/functions/number_fields/polredbest 2013-01-31 14:49:05.547513332 +0100
+@@ -0,0 +1,21 @@
++Function: polredbest
++Section: number_fields
++C-Name: polredbest
++Prototype: GD0,L,
++Help: polredbest(T,{flag=0}): reduction of the polynomial T (gives minimal
++ polynomials only). If flag=1, gives also elements.
++Doc: finds a polynomial with reasonably
++ small coefficients defining the same number field as $T$.
++ All $T$ accepted by \tet{nfinit} are also allowed here (e.g. non-monic
++ polynomials, \kbd{nf}, \kbd{bnf}, \kbd{[T,Z\_K\_basis]}). Contrary to
++ \tet{polredabs}, this routine runs in polynomial time, but it offers no
++ guarantee as to the minimality of its result.
++
++ If $\fl = 1$: outputs a two-component row vector $[P,a]$, where $P$ is the
++ default output and \kbd{Mod(a, P)} is a root of the original $T$.
++ \bprog
++ ? polredbest(x^4 + 8, 1)
++ %1 = [x^4 + 2, Mod(x^3, x^4 + 2)]
++ ? charpoly(%[2])
++ %2 = x^4 + 8
++ @eprog
+diff -ruN src/src/headers/paridecl.h b/src/headers/paridecl.h
+--- src/src/headers/paridecl.h 2012-09-25 23:10:47.000000000 +0200
++++ b/src/headers/paridecl.h 2013-01-31 14:49:05.557525771 +0100
+@@ -889,6 +889,7 @@
+ GEN polredabs0(GEN x, long flag);
+ GEN polredabs2(GEN x);
+ GEN polredabsall(GEN x, long flun);
++GEN polredbest(GEN x, long flag);
+ GEN smallpolred(GEN x);
+ GEN smallpolred2(GEN x);
+ GEN tschirnhaus(GEN x);
+diff -ru src/src/test/32/compat b/src/test/32/compat
+--- src/src/test/32/compat 2013-05-06 16:01:57.000000000 +0200
++++ b/src/test/32/compat 2013-05-06 16:47:04.542393431 +0200
+@@ -787,13 +787,9 @@
+ ? factoreddiscf(p,fa)
+ 136866601
+ ? factoredpolred(p,fa)
+-[x - 1, x^5 - 2*x^4 - 62*x^3 + 85*x^2 + 818*x + 1, x^5 - 2*x^4 - 53*x^3 - 46
+-*x^2 + 508*x + 913, x^5 - 2*x^4 - 13*x^3 + 37*x^2 - 21*x - 1, x^5 - x^4 - 52
+-*x^3 - 197*x^2 - 273*x - 127]
++[x - 1, x^5 - 80*x^3 - 223*x^2 + 800*x + 2671]
+ ? factoredpolred2(p,fa)
+-[x - 1, x^5 - 2*x^4 - 62*x^3 + 85*x^2 + 818*x + 1, x^5 - 2*x^4 - 53*x^3 - 46
+-*x^2 + 508*x + 913, x^5 - 2*x^4 - 13*x^3 + 37*x^2 - 21*x - 1, x^5 - x^4 - 52
+-*x^3 - 197*x^2 - 273*x - 127]
++[x - 1, x^5 - 80*x^3 - 223*x^2 + 800*x + 2671]
+ ? factornf(x^3+x^2-2*x-1,t^3+t^2-2*t-1)
+
+ [x + mod(-t, t^3 + t^2 - 2*t - 1) 1]
+@@ -904,7 +900,7 @@
+ ? gcd(12345678,87654321)
+ 9
+ ? getheap()
+-[208, 45748]
++[208, 45584]
+ ? getrand()
+ Vecsmall([1220248512, -582244995, 485580680, -1643185972, -2103930341, -9694
+ 07356, 336208700, 1439513079, -1910826353, -2042699820, 222745475, 183991374
+@@ -2014,7 +2010,7 @@
+ ? orderell(tcurve,[1,2])
+ 6
+ ? ordred(x^3-12*x+45*x-1)
+-[x - 1, x^3 - 363*x - 2663, x^3 + 33*x - 1]
++[x - 1, x^3 + 33*x - 1]
+ ? padicprec(padicno,127)
+ 5
+ ? pascal(8)
+@@ -2093,15 +2089,16 @@
+ ? polint([0,2,3],[0,4,9],5)
+ 25
+ ? polred(x^5-2*x^4-4*x^3-96*x^2-352*x-568)
+-[x - 1, x^5 - x^4 - 6*x^3 + 6*x^2 + 13*x - 5, x^5 - x^4 + 2*x^3 - 4*x^2 + x
+-- 1, x^5 - x^4 + 4*x^3 - 2*x^2 + x - 1, x^5 + 4*x^3 - 4*x^2 + 8*x - 8]
++[x - 1, x^5 - x^4 + 2*x^3 - 4*x^2 + x - 1]
+ ? polred2(x^4-28*x^3-458*x^2+9156*x-25321)
+
+ [1 x - 1]
+
+-[1/115*x^2 - 14/115*x - 327/115 x^2 - 10]
++[1/115*x^2 - 14/115*x - 212/115 x^2 - 2*x - 9]
++
++[-1/115*x^2 + 14/115*x + 442/115 x^2 - 2*x - 9]
+
+-[2/897*x^3 - 14/299*x^2 - 1171/897*x + 9569/897 x^4 - 32*x^2 + 6]
++[1/115*x^2 - 14/115*x - 327/115 x^2 - 10]
+
+ [1/4485*x^3 - 7/1495*x^2 - 1034/4485*x + 7924/4485 x^4 - 8*x^2 + 6]
+
+@@ -2454,13 +2451,21 @@
+ ? smallinitell([0,0,0,-17,0])
+ [0, 0, 0, -17, 0, 0, -34, 0, -289, 816, 0, 314432, 1728]
+ ? smallpolred(x^4+576)
+-[x - 1, x^2 - x + 1, x^2 + 1, x^4 - x^2 + 1]
++[x - 1, x^2 - 3*x + 3, x^2 - 2*x + 2, x^2 - x + 1, x^2 + 1, x^4 - x^2 + 1]
+ ? smallpolred2(x^4+576)
+
+ [1 x - 1]
+
++[-1/192*x^3 - 1/8*x + 3/2 x^2 - 3*x + 3]
++
++[1/24*x^2 + 1 x^2 - 2*x + 2]
++
++[-1/24*x^2 + 1 x^2 - 2*x + 2]
++
+ [-1/192*x^3 - 1/8*x + 1/2 x^2 - x + 1]
+
++[1/192*x^3 + 1/8*x + 1/2 x^2 - x + 1]
++
+ [1/24*x^2 x^2 + 1]
+
+ [1/192*x^3 + 1/48*x^2 - 1/8*x x^4 - x^2 + 1]
+@@ -2650,6 +2655,6 @@
+ ? getstack()
+ 104
+ ? getheap()
+-[599, 110982]
++[599, 110954]
+ ? print("Total time spent: ",gettime);
+-Total time spent: 236
++Total time spent: 140
+diff -ru src/src/test/32/nfields b/src/test/32/nfields
+--- src/src/test/32/nfields 2013-05-06 16:01:57.000000000 +0200
++++ b/src/test/32/nfields 2013-05-06 16:47:04.542393431 +0200
+@@ -926,45 +926,50 @@
+ ? polgalois(x^6-3*x^2-1)
+ [12, 1, 1, "A_4(6) = [2^2]3"]
+ ? polred(x^5-2*x^4-4*x^3-96*x^2-352*x-568)
+-[x - 1, x^5 - x^4 - 6*x^3 + 6*x^2 + 13*x - 5, x^5 - x^4 + 2*x^3 - 4*x^2 + x
+-- 1, x^5 - x^4 + 4*x^3 - 2*x^2 + x - 1, x^5 + 4*x^3 - 4*x^2 + 8*x - 8]
++[x - 1, x^5 - x^4 + 2*x^3 - 4*x^2 + x - 1]
+ ? polred(x^4-28*x^3-458*x^2+9156*x-25321,3)
+
+ [1 x - 1]
+
+-[1/115*x^2 - 14/115*x - 327/115 x^2 - 10]
++[1/115*x^2 - 14/115*x - 212/115 x^2 - 2*x - 9]
++
++[-1/115*x^2 + 14/115*x + 442/115 x^2 - 2*x - 9]
+
+-[2/897*x^3 - 14/299*x^2 - 1171/897*x + 9569/897 x^4 - 32*x^2 + 6]
++[1/115*x^2 - 14/115*x - 327/115 x^2 - 10]
+
+ [1/4485*x^3 - 7/1495*x^2 - 1034/4485*x + 7924/4485 x^4 - 8*x^2 + 6]
+
+ ? polred(x^4+576,1)
+-[x - 1, x^2 - x + 1, x^2 + 1, x^4 - x^2 + 1]
++[x - 1, x^2 - 3*x + 3, x^2 - 2*x + 2, x^2 - x + 1, x^2 + 1, x^4 - x^2 + 1]
+ ? polred(x^4+576,3)
+
+ [1 x - 1]
+
++[-1/192*x^3 - 1/8*x + 3/2 x^2 - 3*x + 3]
++
++[1/24*x^2 + 1 x^2 - 2*x + 2]
++
++[-1/24*x^2 + 1 x^2 - 2*x + 2]
++
+ [-1/192*x^3 - 1/8*x + 1/2 x^2 - x + 1]
+
++[1/192*x^3 + 1/8*x + 1/2 x^2 - x + 1]
++
+ [1/24*x^2 x^2 + 1]
+
+ [1/192*x^3 + 1/48*x^2 - 1/8*x x^4 - x^2 + 1]
+
+ ? polred(p2,0,fa)
+-[x - 1, x^5 - 2*x^4 - 62*x^3 + 85*x^2 + 818*x + 1, x^5 - 2*x^4 - 53*x^3 - 46
+-*x^2 + 508*x + 913, x^5 - 2*x^4 - 13*x^3 + 37*x^2 - 21*x - 1, x^5 - x^4 - 52
+-*x^3 - 197*x^2 - 273*x - 127]
++[x - 1, x^5 - 80*x^3 - 223*x^2 + 800*x + 2671]
+ ? polred(p2,1,fa)
+-[x - 1, x^5 - 2*x^4 - 62*x^3 + 85*x^2 + 818*x + 1, x^5 - 2*x^4 - 53*x^3 - 46
+-*x^2 + 508*x + 913, x^5 - 2*x^4 - 13*x^3 + 37*x^2 - 21*x - 1, x^5 - x^4 - 52
+-*x^3 - 197*x^2 - 273*x - 127]
++[x - 1, x^5 - 80*x^3 - 223*x^2 + 800*x + 2671]
+ ? polredabs(x^5-2*x^4-4*x^3-96*x^2-352*x-568)
+ x^5 - x^4 + 2*x^3 - 4*x^2 + x - 1
+ ? polredabs(x^5-2*x^4-4*x^3-96*x^2-352*x-568,1)
+ [x^5 - x^4 + 2*x^3 - 4*x^2 + x - 1, Mod(2*x^4 - x^3 + 3*x^2 - 3*x - 1, x^5 -
+ x^4 + 2*x^3 - 4*x^2 + x - 1)]
+ ? polredord(x^3-12*x+45*x-1)
+-[x - 1, x^3 - 363*x - 2663, x^3 + 33*x - 1]
++[x - 1, x^3 + 33*x - 1]
+ ? polsubcyclo(31,5)
+ x^5 + x^4 - 12*x^3 - 21*x^2 + x + 5
+ ? setrand(1);poltschirnhaus(x^5-x-1)
+@@ -1028,6 +1033,6 @@
+ ? sizebyte(%)
+ 152
+ ? getheap
+-[175, 113027]
++[175, 112999]
+ ? print("Total time spent: ",gettime);
+-Total time spent: 116
++Total time spent: 76
+diff -ru src/src/test/64/compat b/src/test/64/compat
+--- src/src/test/64/compat 2013-05-06 16:01:58.000000000 +0200
++++ b/src/test/64/compat 2013-05-06 16:47:04.542393431 +0200
+@@ -789,13 +789,9 @@
+ ? factoreddiscf(p,fa)
+ 136866601
+ ? factoredpolred(p,fa)
+-[x - 1, x^5 - 2*x^4 - 62*x^3 + 85*x^2 + 818*x + 1, x^5 - 2*x^4 - 53*x^3 - 46
+-*x^2 + 508*x + 913, x^5 - 2*x^4 - 13*x^3 + 37*x^2 - 21*x - 1, x^5 - x^4 - 52
+-*x^3 - 197*x^2 - 273*x - 127]
++[x - 1, x^5 - 80*x^3 - 223*x^2 + 800*x + 2671]
+ ? factoredpolred2(p,fa)
+-[x - 1, x^5 - 2*x^4 - 62*x^3 + 85*x^2 + 818*x + 1, x^5 - 2*x^4 - 53*x^3 - 46
+-*x^2 + 508*x + 913, x^5 - 2*x^4 - 13*x^3 + 37*x^2 - 21*x - 1, x^5 - x^4 - 52
+-*x^3 - 197*x^2 - 273*x - 127]
++[x - 1, x^5 - 80*x^3 - 223*x^2 + 800*x + 2671]
+ ? factornf(x^3+x^2-2*x-1,t^3+t^2-2*t-1)
+
+ [x + mod(-t, t^3 + t^2 - 2*t - 1) 1]
+@@ -906,7 +902,7 @@
+ ? gcd(12345678,87654321)
+ 9
+ ? getheap()
+-[208, 44472]
++[208, 44308]
+ ? getrand()
+ Vecsmall([-696235626332558091, -7363039021536514678, -3123062006620239999, -
+ 2510915082749224356, -5278885121447018503, 8033304491650294704, 333461878925
+@@ -2014,7 +2010,7 @@
+ ? orderell(tcurve,[1,2])
+ 6
+ ? ordred(x^3-12*x+45*x-1)
+-[x - 1, x^3 - 363*x - 2663, x^3 + 33*x - 1]
++[x - 1, x^3 + 33*x - 1]
+ ? padicprec(padicno,127)
+ 5
+ ? pascal(8)
+@@ -2093,15 +2089,16 @@
+ ? polint([0,2,3],[0,4,9],5)
+ 25
+ ? polred(x^5-2*x^4-4*x^3-96*x^2-352*x-568)
+-[x - 1, x^5 - x^4 - 6*x^3 + 6*x^2 + 13*x - 5, x^5 - x^4 + 2*x^3 - 4*x^2 + x
+-- 1, x^5 - x^4 + 4*x^3 - 2*x^2 + x - 1, x^5 + 4*x^3 - 4*x^2 + 8*x - 8]
++[x - 1, x^5 - x^4 + 2*x^3 - 4*x^2 + x - 1]
+ ? polred2(x^4-28*x^3-458*x^2+9156*x-25321)
+
+ [1 x - 1]
+
+-[1/115*x^2 - 14/115*x - 327/115 x^2 - 10]
++[1/115*x^2 - 14/115*x - 212/115 x^2 - 2*x - 9]
++
++[-1/115*x^2 + 14/115*x + 442/115 x^2 - 2*x - 9]
+
+-[2/897*x^3 - 14/299*x^2 - 1171/897*x + 9569/897 x^4 - 32*x^2 + 6]
++[1/115*x^2 - 14/115*x - 327/115 x^2 - 10]
+
+ [1/4485*x^3 - 7/1495*x^2 - 1034/4485*x + 7924/4485 x^4 - 8*x^2 + 6]
+
+@@ -2454,13 +2451,21 @@
+ ? smallinitell([0,0,0,-17,0])
+ [0, 0, 0, -17, 0, 0, -34, 0, -289, 816, 0, 314432, 1728]
+ ? smallpolred(x^4+576)
+-[x - 1, x^2 - x + 1, x^2 + 1, x^4 - x^2 + 1]
++[x - 1, x^2 - 3*x + 3, x^2 - 2*x + 2, x^2 - x + 1, x^2 + 1, x^4 - x^2 + 1]
+ ? smallpolred2(x^4+576)
+
+ [1 x - 1]
+
++[-1/192*x^3 - 1/8*x + 3/2 x^2 - 3*x + 3]
++
++[1/24*x^2 + 1 x^2 - 2*x + 2]
++
++[-1/24*x^2 + 1 x^2 - 2*x + 2]
++
+ [-1/192*x^3 - 1/8*x + 1/2 x^2 - x + 1]
+
++[1/192*x^3 + 1/8*x + 1/2 x^2 - x + 1]
++
+ [1/24*x^2 x^2 + 1]
+
+ [1/192*x^3 + 1/48*x^2 - 1/8*x x^4 - x^2 + 1]
+@@ -2649,6 +2654,6 @@
+ ? getstack()
+ 200
+ ? getheap()
+-[599, 100048]
++[599, 100020]
+ ? print("Total time spent: ",gettime);
+-Total time spent: 152
++Total time spent: 180
+diff -ru src/src/test/64/nfields b/src/test/64/nfields
+--- src/src/test/64/nfields 2013-05-06 16:01:58.000000000 +0200
++++ b/src/test/64/nfields 2013-05-06 16:47:04.542393431 +0200
+@@ -928,45 +928,50 @@
+ ? polgalois(x^6-3*x^2-1)
+ [12, 1, 1, "A_4(6) = [2^2]3"]
+ ? polred(x^5-2*x^4-4*x^3-96*x^2-352*x-568)
+-[x - 1, x^5 - x^4 - 6*x^3 + 6*x^2 + 13*x - 5, x^5 - x^4 + 2*x^3 - 4*x^2 + x
+-- 1, x^5 - x^4 + 4*x^3 - 2*x^2 + x - 1, x^5 + 4*x^3 - 4*x^2 + 8*x - 8]
++[x - 1, x^5 - x^4 + 2*x^3 - 4*x^2 + x - 1]
+ ? polred(x^4-28*x^3-458*x^2+9156*x-25321,3)
+
+ [1 x - 1]
+
+-[1/115*x^2 - 14/115*x - 327/115 x^2 - 10]
++[1/115*x^2 - 14/115*x - 212/115 x^2 - 2*x - 9]
++
++[-1/115*x^2 + 14/115*x + 442/115 x^2 - 2*x - 9]
+
+-[2/897*x^3 - 14/299*x^2 - 1171/897*x + 9569/897 x^4 - 32*x^2 + 6]
++[1/115*x^2 - 14/115*x - 327/115 x^2 - 10]
+
+ [1/4485*x^3 - 7/1495*x^2 - 1034/4485*x + 7924/4485 x^4 - 8*x^2 + 6]
+
+ ? polred(x^4+576,1)
+-[x - 1, x^2 - x + 1, x^2 + 1, x^4 - x^2 + 1]
++[x - 1, x^2 - 3*x + 3, x^2 - 2*x + 2, x^2 - x + 1, x^2 + 1, x^4 - x^2 + 1]
+ ? polred(x^4+576,3)
+
+ [1 x - 1]
+
++[-1/192*x^3 - 1/8*x + 3/2 x^2 - 3*x + 3]
++
++[1/24*x^2 + 1 x^2 - 2*x + 2]
++
++[-1/24*x^2 + 1 x^2 - 2*x + 2]
++
+ [-1/192*x^3 - 1/8*x + 1/2 x^2 - x + 1]
+
++[1/192*x^3 + 1/8*x + 1/2 x^2 - x + 1]
++
+ [1/24*x^2 x^2 + 1]
+
+ [1/192*x^3 + 1/48*x^2 - 1/8*x x^4 - x^2 + 1]
+
+ ? polred(p2,0,fa)
+-[x - 1, x^5 - 2*x^4 - 62*x^3 + 85*x^2 + 818*x + 1, x^5 - 2*x^4 - 53*x^3 - 46
+-*x^2 + 508*x + 913, x^5 - 2*x^4 - 13*x^3 + 37*x^2 - 21*x - 1, x^5 - x^4 - 52
+-*x^3 - 197*x^2 - 273*x - 127]
++[x - 1, x^5 - 80*x^3 - 223*x^2 + 800*x + 2671]
+ ? polred(p2,1,fa)
+-[x - 1, x^5 - 2*x^4 - 62*x^3 + 85*x^2 + 818*x + 1, x^5 - 2*x^4 - 53*x^3 - 46
+-*x^2 + 508*x + 913, x^5 - 2*x^4 - 13*x^3 + 37*x^2 - 21*x - 1, x^5 - x^4 - 52
+-*x^3 - 197*x^2 - 273*x - 127]
++[x - 1, x^5 - 80*x^3 - 223*x^2 + 800*x + 2671]
+ ? polredabs(x^5-2*x^4-4*x^3-96*x^2-352*x-568)
+ x^5 - x^4 + 2*x^3 - 4*x^2 + x - 1
+ ? polredabs(x^5-2*x^4-4*x^3-96*x^2-352*x-568,1)
+ [x^5 - x^4 + 2*x^3 - 4*x^2 + x - 1, Mod(2*x^4 - x^3 + 3*x^2 - 3*x - 1, x^5 -
+ x^4 + 2*x^3 - 4*x^2 + x - 1)]
+ ? polredord(x^3-12*x+45*x-1)
+-[x - 1, x^3 - 363*x - 2663, x^3 + 33*x - 1]
++[x - 1, x^3 + 33*x - 1]
+ ? polsubcyclo(31,5)
+ x^5 + x^4 - 12*x^3 - 21*x^2 + x + 5
+ ? setrand(1);poltschirnhaus(x^5-x-1)
+@@ -1030,6 +1035,6 @@
+ ? sizebyte(%)
+ 288
+ ? getheap
+-[175, 102929]
++[175, 102901]
+ ? print("Total time spent: ",gettime);
+-Total time spent: 84
++Total time spent: 110
diff --git a/sci-mathematics/pari/files/pari-2.5.4-slow_determinant.patch b/sci-mathematics/pari/files/pari-2.5.4-slow_determinant.patch
new file mode 100644
index 000000000000..14833da62709
--- /dev/null
+++ b/sci-mathematics/pari/files/pari-2.5.4-slow_determinant.patch
@@ -0,0 +1,100 @@
+diff -ru src/src/basemath/alglin1.c b/src/basemath/alglin1.c
+--- src/src/basemath/alglin1.c 2012-09-25 23:10:46.000000000 +0200
++++ b/src/basemath/alglin1.c 2013-01-03 13:56:55.487513420 +0100
+@@ -2969,6 +2969,21 @@
+ return NULL; /* not reached */
+ }
+
++/* A a 2x2 matrix
++ returns the determinant of A computed by the simple formula
++*/
++static GEN
++det2x2(GEN A)
++{
++ pari_sp av = avma;
++ GEN a = gcoeff(A, 1, 1),
++ b = gcoeff(A, 1, 2),
++ c = gcoeff(A, 2, 1),
++ d = gcoeff(A, 2, 2);
++ return gerepileupto(av, gsub(gmul(a, d), gmul(b, c)));
++}
++
++
+ static GEN
+ det_simple_gauss(GEN a, GEN data, pivot_fun pivot)
+ {
+@@ -3021,6 +3036,7 @@
+ if (typ(a)!=t_MAT) pari_err(mattype1,"det2");
+ if (!nbco) return gen_1;
+ if (nbco != lg(a[1])-1) pari_err(mattype1,"det2");
++ if (nbco == 2) return det2x2 (a);
+ pivot = get_pivot_fun(a, &data);
+ return det_simple_gauss(a, data, pivot);
+ }
+@@ -3158,11 +3174,7 @@
+ {
+ case 0: return gen_1;
+ case 1: return gcopy(gcoeff(M,1,1));
+- case 2: {
+- GEN a = gcoeff(M,1,1), b = gcoeff(M,1,2);
+- GEN c = gcoeff(M,2,1), d = gcoeff(M,2,2);
+- return gerepileupto(av, gsub(gmul(a,d), gmul(b,c)));
+- }
++ case 2: return det2x2(M);
+ }
+ if (max > ((n+2)>>1)) max = (n+2)>>1;
+ for (j = 1; j <= n; j++)
+@@ -3193,9 +3205,10 @@
+ }
+ if (best_row)
+ {
++ double d = lbest-1;
+ GEN s = NULL;
+ long k;
+- bound /= (lbest-1);
++ bound /= d*d*d;
+ for (k = 1; k < lbest; k++)
+ {
+ GEN c = coeff_det(M, best_row, best[k], max, bound);
+@@ -3205,9 +3218,10 @@
+ }
+ if (best_col)
+ {
++ double d = lbest-1;
+ GEN s = NULL;
+ long k;
+- bound /= (lbest-1);
++ bound /= d*d*d;
+ for (k = 1; k < lbest; k++)
+ {
+ GEN c = coeff_det(M, best[k], best_col, max, bound);
+@@ -3230,15 +3244,24 @@
+ if (!n) return gen_1;
+ if (n != lg(a[1])-1) pari_err(mattype1,"det");
+ if (n == 1) return gcopy(gcoeff(a,1,1));
+- if (RgM_is_FpM(a, &p) && p)
++ if (RgM_is_FpM(a, &p))
+ {
+- pari_sp av = avma;
+- return gerepilecopy(av, Fp_to_mod(FpM_det(RgM_to_FpM(a, p), p), p));
++ pari_sp av;
++ if (!p)
++ { /* ZM */
++ return det_simple_gauss(a, NULL, &gauss_get_pivot_NZ);
++ }
++ else
++ { /* FpM */
++ av = avma;
++ return gerepilecopy(av, Fp_to_mod(FpM_det(RgM_to_FpM(a, p), p), p));
++ }
+ }
++ if (n == 2) return det2x2 (a);
+ pivot = get_pivot_fun(a, &data);
+ if (pivot != gauss_get_pivot_NZ) return det_simple_gauss(a, data, pivot);
+- B = (double)n; B = B*B; B = B*B;
+- return det_develop(a, 7, B);
++ B = (double)n;
++ return det_develop(a, 7, B*B*B);
+ }
+
+
diff --git a/sci-mathematics/pari/files/pari-2.7.0-doc-make.patch b/sci-mathematics/pari/files/pari-2.7.0-doc-make.patch
new file mode 100644
index 000000000000..4292688d97af
--- /dev/null
+++ b/sci-mathematics/pari/files/pari-2.7.0-doc-make.patch
@@ -0,0 +1,89 @@
+diff -Naur pari-2.7.0/config/DOC_Make.SH pari-2.7.0_a/config/DOC_Make.SH
+--- pari-2.7.0/config/DOC_Make.SH 2014-03-20 21:59:28.000000000 +1300
++++ pari-2.7.0_a/config/DOC_Make.SH 2014-05-05 13:20:09.119923587 +1200
+@@ -23,7 +23,8 @@
+
+ doc all: develop.dvi libpari.dvi parallel.dvi users.dvi refcard.ps tutorial.dvi
+ docps: develop.ps libpari.ps parallel.ps refcard.ps tutorial.ps users.ps INSTALL.ps
+-docpdf: develop.pdf libpari.pdf parallel.pdf users.pdf tutorial.pdf refcard.pdf INSTALL.pdf
++#docpdf: develop.pdf libpari.pdf parallel.pdf users.pdf tutorial.pdf refcard.pdf INSTALL.pdf
++docpdf: \$(PARI_TEX) \$(MACROS) pass1 pass2 indexing refcard.pdf INSTALL.pdf
+
+ .SUFFIXES: .tex .ipf .pod .inf .dumbpod .3 .html
+
+@@ -39,38 +40,60 @@
+ %.dvi: %.tex \$(MACROS)
+ \$(TEX) \$<
+
++pass1: \$(PARI_TEX) \$(USERS_TEX) develop.tex tutorial.tex \$(MACROS)
++ -rm -f *.std
++ pdftex libpari
++ pdftex develop
++ pdftex tutorial
++ pdftex users
++
++pass2: pass1
++ pdftex libpari
++ pdftex develop
++ pdftex tutorial
++ pdftex users
++
++indexing: pass2
++ \$(MAKE) libpari.std
++ \$(MAKE) develop.std
++ \$(MAKE) users.std
++ pdftex libpari
++ pdftex develop
++ pdftex users
++ -rm -f *.std
++
+ libpari.pdf: \$(PARI_TEX) \$(MACROS)
+ -rm -f libpari.std
+ \$(PDFTEX) libpari
+ \$(PDFTEX) libpari
+- make libpari.std; \$(PDFTEX) libpari; rm -f libpari.std
++ \$(MAKE) libpari.std; \$(PDFTEX) libpari; rm -f libpari.std
+ libpari.dvi: \$(PARI_TEX) \$(MACROS)
+ -rm -f libpari.std
+ \$(TEX) libpari
+ \$(TEX) libpari
+- make libpari.std; \$(TEX) libpari; rm -f libpari.std
++ \$(MAKE) libpari.std; \$(TEX) libpari; rm -f libpari.std
+
+ develop.pdf: develop.tex \$(MACROS)
+ -rm -f develop.std
+ \$(PDFTEX) develop
+ \$(PDFTEX) develop
+- make develop.std; \$(PDFTEX) develop; rm -f develop.std
++ \$(MAKE) develop.std; \$(PDFTEX) develop; rm -f develop.std
+ develop.dvi: develop.tex \$(MACROS)
+ -rm -f develop.std
+ \$(TEX) develop
+ \$(TEX) develop
+- make develop.std; \$(TEX) develop; rm -f develop.std
++ \$(MAKE) develop.std; \$(TEX) develop; rm -f develop.std
+
+ parallel.pdf: parallel.tex \$(MACROS)
+ -rm -f parallel.std
+ \$(PDFTEX) parallel
+ \$(PDFTEX) parallel
+- make parallel.std; \$(PDFTEX) parallel; rm -f parallel.std
++ \$(MAKE) parallel.std; \$(PDFTEX) parallel; rm -f parallel.std
+ parallel.dvi: parallel.tex \$(MACROS)
+ -rm -f parallel.std
+ \$(TEX) parallel
+ \$(TEX) parallel
+- make parallel.std; \$(TEX) parallel; rm -f parallel.std
++ \$(MAKE) parallel.std; \$(TEX) parallel; rm -f parallel.std
+
+ tutorial.pdf: tutorial.tex \$(MACROS)
+ -rm -f tutorial.std
+@@ -104,7 +127,7 @@
+ -rm -f users.std
+ \$(PDFTEX) users
+ \$(PDFTEX) users
+- make users.std; \$(PDFTEX) users; rm -f users.std
++ \$(MAKE) users.std; \$(PDFTEX) users; rm -f users.std
+
+ gpman: gp.1
+ nroff -man gp.1 | unix2dos -ascii > gp.man
diff --git a/sci-mathematics/pari/files/pari-2.7.0-no-automagic.patch b/sci-mathematics/pari/files/pari-2.7.0-no-automagic.patch
new file mode 100644
index 000000000000..2d77f19f9f54
--- /dev/null
+++ b/sci-mathematics/pari/files/pari-2.7.0-no-automagic.patch
@@ -0,0 +1,100 @@
+diff -Naur pari-2.7.0/config/Makefile.SH pari-2.7.0_a/config/Makefile.SH
+--- pari-2.7.0/config/Makefile.SH 2014-03-20 21:59:28.000000000 +1300
++++ pari-2.7.0_a/config/Makefile.SH 2014-05-05 12:00:21.095724368 +1200
+@@ -75,12 +75,12 @@
+ PLOTLIBS="-L\$(QTDIR)/lib $QTLIB"
+ graph=plotQt;;
+ Qt4)
+- PLOTCFLAGS='-D__FANCY_WIN__ -I$(QTDIR)/include'
+- PLOTLIBS="-L\$(QTDIR)/lib $QTLIB"
++ PLOTCFLAGS='-D__FANCY_WIN__ `pkg-config --cflags QtGui`'
++ PLOTLIBS="`pkg-config --libs QtGui`"
+ graph=plotQt4;;
+ fltk)
+- PLOTCFLAGS="-I\$(FLTKDIR)/include $X11_INC"
+- PLOTLIBS="$FLTK_LIBS"
++ PLOTCFLAGS="`fltk-config --cxxflags` $X11_INC"
++ PLOTLIBS="`fltk-config --ldflags`"
+ postconfig='fltk-config --post '
+ graph=plotfltk;;
+ win32)
+@@ -269,7 +269,7 @@
+ GMPINCLUDE = $GMPINCLUDE
+ # Graphic library.
+ QTDIR = "$QTDIR"
+-MOC = \$(QTDIR)/bin/moc
++MOC = "`which moc`"
+ PLOTCFLAGS = $PLOTCFLAGS
+ PLOTLIBS = $PLOTLIBS
+ CPLUSPLUS = g++
+diff -Naur pari-2.7.0/config/get_Qt pari-2.7.0_a/config/get_Qt
+--- pari-2.7.0/config/get_Qt 2014-03-20 21:59:28.000000000 +1300
++++ pari-2.7.0_a/config/get_Qt 2014-05-05 11:56:42.453465262 +1200
+@@ -5,7 +5,7 @@
+ case "$with_qt" in
+ yes)
+ pth="/usr/local/lib /usr/local/share /usr/lib /usr/share"
+- QTDIR=`locatedir qt4/bin $pth`
++ QTDIR=`locatedir qt4 $pth`
+ if test -n "$QTDIR"; then
+ QTLIB="-lQtCore -lQtGui"
+ which_graphic_lib=Qt4
+diff -Naur pari-2.7.0/config/get_config_options pari-2.7.0_a/config/get_config_options
+--- pari-2.7.0/config/get_config_options 2014-03-20 21:59:28.000000000 +1300
++++ pari-2.7.0_a/config/get_config_options 2014-05-05 11:49:14.577963840 +1200
+@@ -85,10 +85,12 @@
+ --with-ncurses-lib=*|--with-ncurses=*)
+ with_ncurses_lib=`echo "$1" | sed -e 's/[-a-z]*=//'` ;;
+
++ --without-qt|--with-qt=no) without_qt=yes ;;
+ --with-qt) with_qt=yes ;;
+ --with-qt=*)
+ with_qt=`echo "$1" | sed -e 's/[-a-z]*=//'` ;;
+
++ --without-fltk|--with-fltk=no) without_fltk=yes ;;
+ --with-fltk) with_fltk=yes ;;
+ --with-fltk=*)
+ with_fltk=`echo "$1" | sed -e 's/[-a-z]*=//'` ;;
+@@ -164,7 +166,9 @@
+ --with-gmp-lib=DIR specify location of gmp libs
+
+ --with-qt[=DIR] use the Qt graphical library [prefix for Qt dir.]
++ --without-qt do not try to use the Qt lib
+ --with-fltk[=DIR] use the FLTK graphical library [prefix for FLTK dir.]
++ --without-fltk do not try to use the FLTK lib
+
+ Environment variables affecting the build:
+ CC C compiler
+diff -Naur pari-2.7.0/config/get_fltk pari-2.7.0_a/config/get_fltk
+--- pari-2.7.0/config/get_fltk 2014-03-20 21:59:28.000000000 +1300
++++ pari-2.7.0_a/config/get_fltk 2014-05-05 11:49:14.578963841 +1200
+@@ -2,6 +2,9 @@
+ with_fltk=yes
+ fi
+ FLTKDIR=
++if test -z "$without_fltk; then
++ FLTKDIR="`fltk-config --prefix 2>/dev/null`"
++fi
+ case "$with_fltk" in
+ yes)
+ pth=$libpth; lib=fltk; . ./locatelib
+diff -Naur pari-2.7.0/config/get_graphic_lib pari-2.7.0_a/config/get_graphic_lib
+--- pari-2.7.0/config/get_graphic_lib 2014-03-20 21:59:28.000000000 +1300
++++ pari-2.7.0_a/config/get_graphic_lib 2014-05-05 11:54:45.469333702 +1200
+@@ -7,6 +7,7 @@
+
+ if test -n "$with_fltk"; then which_graphic_lib=fltk; fi
+ if test -n "$with_qt"; then which_graphic_lib=Qt; fi
++if test -n "$without_fltk" -a -n "$without_qt"; then which_graphic_lib=none; fi
+ if test "$fastread" != yes; then
+ cat << EOT
+ ==========================================================================
+@@ -38,7 +39,7 @@
+ case $osname in
+ darwin) ;; # fltk brings in CoreFoundation, incompatible with pari_daemon
+ *). ./get_fltk # FLTKDIR, FLTK_LIBS ;;
+- if test -z "$FLTKDIR"; then
++ if test -z "`fltk-config --ldflags 2> /dev/null`"; then
+ case $which_graphic_lib in fltk) which_graphic_lib=none;; esac
+ else
+ which_graphic_lib=fltk
diff --git a/sci-mathematics/pari/files/pari-2.7.0-slow-discriminant.patch b/sci-mathematics/pari/files/pari-2.7.0-slow-discriminant.patch
new file mode 100644
index 000000000000..814dc4b2ab9d
--- /dev/null
+++ b/sci-mathematics/pari/files/pari-2.7.0-slow-discriminant.patch
@@ -0,0 +1,54 @@
+diff -ru src/src/basemath/alglin1.c b/src/basemath/alglin1.c
+--- src/src/basemath/alglin1.c 2014-01-29 18:00:27.000000000 +0100
++++ b/src/basemath/alglin1.c 2014-02-09 01:54:37.676725196 +0100
+@@ -247,6 +247,7 @@
+ a = RgM_shallowcopy(a);
+ for (i=1; i<nbco; i++)
+ {
++ int garbage = 0; /* Only gerepile() once per loop iteration */
+ for(k=i; k<=nbco; k++)
+ {
+ gcoeff(a,k,i) = ff->red(E,gcoeff(a,k,i));
+@@ -271,7 +272,7 @@
+ for (j=i+1; j<=nbco; j++)
+ {
+ gcoeff(a,j,k) = ff->add(E, gcoeff(a,j,k), ff->mul(E,m,gcoeff(a,j,i)));
+- if (low_stack(lim, stack_lim(av,1)))
++ if (low_stack(lim, stack_lim(av,1)) && (garbage++ == 0))
+ {
+ if(DEBUGMEM>1) pari_warn(warnmem,"det. col = %ld",i);
+ gerepileall(av,4, &a,&x,&q,&m);
+@@ -3721,6 +3722,7 @@
+ a = RgM_shallowcopy(a);
+ for (i=1; i<nbco; i++)
+ {
++ int garbage = 0; /* Only gerepile() once per loop iteration */
+ k = pivot(a, data, i, NULL);
+ if (k > nbco) return gerepilecopy(av, gcoeff(a,i,i));
+ if (k != i)
+@@ -3740,7 +3742,7 @@
+ for (j=i+1; j<=nbco; j++)
+ {
+ gcoeff(a,j,k) = gsub(gcoeff(a,j,k), gmul(m,gcoeff(a,j,i)));
+- if (low_stack(lim, stack_lim(av,3)))
++ if (low_stack(lim, stack_lim(av,3)) && (garbage++ == 0))
+ {
+ if(DEBUGMEM>1) pari_warn(warnmem,"det. col = %ld",i);
+ gerepileall(av,2, &a,&x);
+@@ -3791,6 +3793,7 @@
+ {
+ GEN ci, ck, m;
+ int diveuc = (gequal1(pprec)==0);
++ int garbage = 0; /* Only gerepile() once per loop iteration */
+
+ p = gcoeff(a,i,i);
+ if (gequal0(p))
+@@ -3827,7 +3830,7 @@
+ GEN p1 = gsub(gmul(p,gel(ck,j)), gmul(m,gel(ci,j)));
+ if (diveuc) p1 = mydiv(p1,pprec);
+ gel(ck,j) = gerepileupto(av2, p1);
+- if (low_stack(lim,stack_lim(av,2)))
++ if (low_stack(lim,stack_lim(av,2)) && (garbage++ == 0))
+ {
+ if(DEBUGMEM>1) pari_warn(warnmem,"det. col = %ld",i);
+ gerepileall(av,2, &a,&pprec);
diff --git a/sci-mathematics/pari/metadata.xml b/sci-mathematics/pari/metadata.xml
new file mode 100644
index 000000000000..3f62c7c76948
--- /dev/null
+++ b/sci-mathematics/pari/metadata.xml
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <herd>sci-mathematics</herd>
+ <longdescription lang="en">
+ PARI is a widely used computer algebra system designed for fast
+ computations in number theory (factorizations, algebraic number
+ theory, elliptic curves...), but also contains a large number of other
+ useful functions to compute with mathematical entities such as
+ matrices, polynomials, power series, algebraic numbers, etc., and a
+ lot of transcendental functions.
+ The extra data is avaialable through use flag:
+ * elldata is PARI/GP version of J. E. Cremona Elliptic Curve Data,
+ needed by ellsearch and ellidentify.
+ * galdata is needed by polgalois to compute Galois group in degrees
+ 8 through 11.
+ * seadata is needed by ellap for large primes.
+ * nftables is a repackaging of the historical megrez number field
+tables (errors fixed, 1/10th the size, easier to use).
+
+</longdescription>
+ <use>
+ <flag name="data">Add additional data (elldata, galdata, seadata, nftables)</flag>
+ </use>
+</pkgmetadata>
diff --git a/sci-mathematics/pari/pari-2.3.5.ebuild b/sci-mathematics/pari/pari-2.3.5.ebuild
new file mode 100644
index 000000000000..0531c17ebd51
--- /dev/null
+++ b/sci-mathematics/pari/pari-2.3.5.ebuild
@@ -0,0 +1,138 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=3
+inherit elisp-common eutils flag-o-matic toolchain-funcs
+
+DESCRIPTION="A software package for computer-aided number theory"
+HOMEPAGE="http://pari.math.u-bordeaux.fr/"
+
+SRC_COM="http://pari.math.u-bordeaux.fr/pub/${PN}"
+SRC_URI="${SRC_COM}/unix/${P}.tar.gz
+ data? ( ${SRC_COM}/packages/elldata.tgz
+ ${SRC_COM}/packages/galdata.tgz
+ ${SRC_COM}/packages/seadata.tgz
+ ${SRC_COM}/packages/nftables.tgz )"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="alpha amd64 hppa ~mips ppc ppc64 sparc x86 ~x86-fbsd ~x86-solaris"
+IUSE="doc data fltk gmp static-libs X"
+
+RDEPEND="sys-libs/readline
+ fltk? ( x11-libs/fltk:1 )
+ gmp? ( dev-libs/gmp )
+ X? ( x11-libs/libX11 )
+ doc? ( X? ( x11-misc/xdg-utils ) )"
+DEPEND="${RDEPEND}
+ doc? ( virtual/latex-base )"
+
+get_compile_dir() {
+ pushd "${S}/config" >& /dev/null
+ local fastread=yes
+ source ./get_archos
+ popd >& /dev/null
+ echo "O${osname}-${arch}"
+}
+
+src_prepare() {
+ # move data into place
+ if use data; then
+ mv "${WORKDIR}"/data "${S}" || die "failed to move data"
+ fi
+ epatch "${FILESDIR}/"${PN}-2.3.2-strip.patch
+ epatch "${FILESDIR}/"${PN}-2.3.2-ppc-powerpc-arch-fix.patch
+ epatch "${FILESDIR}/"${PN}-2.3.5-doc-make.patch
+
+ # disable default building of docs during install
+ sed -i \
+ -e "s:install-doc install-examples:install-examples:" \
+ config/Makefile.SH || die "Failed to fix makefile"
+ # propagate ldflags
+ sed -i \
+ -e 's/-shared $extra/-shared $extra \\$(LDFLAGS)/' \
+ config/get_dlld || die "Failed to fix LDFLAGS"
+ # move doc dir to a gentoo doc dir and replace hardcoded xdvi by xdg-open
+ sed -i \
+ -e "s:\$d = \$0:\$d = '${EPREFIX}/usr/share/doc/${PF}':" \
+ -e 's:"xdvi":"xdg-open":' \
+ -e 's:xdvi -paper 29.7x21cm:xdg-open:' \
+ doc/gphelp.in || die "Failed to fix doc dir"
+ # disable emacs support
+ sed -i -e '/^list=/s/emacs//' Configure \
+ || die
+}
+
+src_configure() {
+ append-flags -fno-strict-aliasing
+ tc-export CC
+ # need to force optimization here, as it breaks without
+ if is-flag -O0; then
+ replace-flags -O0 -O2
+ elif ! is-flag -O?; then
+ append-flags -O2
+ fi
+ # sysdatadir installs a pari.cfg stuff which is informative only
+ ./Configure \
+ --prefix="${EPREFIX}"/usr \
+ --datadir="${EPREFIX}"/usr/share/${PN} \
+ --libdir="${EPREFIX}"/usr/$(get_libdir) \
+ --sysdatadir="${EPREFIX}"/usr/share/doc/${PF} \
+ --mandir="${EPREFIX}"/usr/share/man/man1 \
+ --with-readline \
+ $(use_with gmp) \
+ || die "./Configure failed"
+}
+
+src_compile() {
+ local installdir=$(get_compile_dir)
+ cd "${installdir}" || die "Bad directory"
+
+ emake ${mymake} CFLAGS="${CFLAGS} -DGCC_INLINE -fPIC" lib-dyn \
+ || die "Building shared library failed!"
+
+ if use static-libs; then
+ emake ${mymake} CFLAGS="${CFLAGS} -DGCC_INLINE" lib-sta \
+ || die "Building static library failed!"
+ fi
+
+ emake ${mymake} CFLAGS="${CFLAGS} -DGCC_INLINE" gp ../gp \
+ || die "Building executables failed!"
+
+ if use doc; then
+ cd "${S}"
+ # To prevent sandbox violations by metafont
+ VARTEXFONTS="${T}"/fonts emake docpdf \
+ || die "Failed to generate docs"
+ fi
+}
+
+src_test() {
+ emake test-kernel || die
+}
+
+src_install() {
+ emake DESTDIR="${D}" install || die "Install failed"
+
+ dodoc AUTHORS Announce.2.1 CHANGES README NEW MACHINES COMPAT
+ if use doc; then
+ emake \
+ DESTDIR="${D}" \
+ EXDIR="${ED}/usr/share/doc/${PF}/examples" \
+ DOCDIR="${ED}/usr/share/doc/${PF}" \
+ install-doc || die "Failed to install docs"
+ insinto /usr/share/doc/${PF}
+ doins doc/*.pdf || die "Failed to install pdf docs"
+ fi
+
+ if use data; then
+ emake DESTDIR="${D}" install-data || die "Failed to install data files"
+ fi
+
+ if use static-libs; then
+ emake \
+ DESTDIR="${D}" \
+ install-lib-sta || die "Install of static library failed"
+ fi
+}
diff --git a/sci-mathematics/pari/pari-2.5.0-r3.ebuild b/sci-mathematics/pari/pari-2.5.0-r3.ebuild
new file mode 100644
index 000000000000..0de7d3921dde
--- /dev/null
+++ b/sci-mathematics/pari/pari-2.5.0-r3.ebuild
@@ -0,0 +1,135 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="4"
+
+inherit eutils flag-o-matic toolchain-funcs
+
+DESCRIPTION="A software package for computer-aided number theory"
+HOMEPAGE="http://pari.math.u-bordeaux.fr/"
+SRC_URI="http://pari.math.u-bordeaux.fr/pub/${PN}/unix/${P}.tar.gz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~hppa ~mips ~ppc ~ppc64 ~sparc ~x86 ~x86-fbsd ~amd64-linux ~x86-linux ~x86-macos ~x86-solaris"
+IUSE="doc data fltk gmp X"
+
+RDEPEND="sys-libs/readline
+ fltk? ( x11-libs/fltk:1 )
+ gmp? ( dev-libs/gmp )
+ X? ( x11-libs/libX11 )
+ doc? ( X? ( x11-misc/xdg-utils ) )
+ data? ( sci-mathematics/pari-data )"
+DEPEND="${RDEPEND}
+ doc? ( virtual/latex-base )"
+
+get_compile_dir() {
+ pushd "${S}/config" > /dev/null
+ local fastread=yes
+ source ./get_archos
+ popd > /dev/null
+ echo "O${osname}-${arch}"
+}
+
+src_prepare() {
+ epatch "${FILESDIR}/${PN}"-2.3.2-strip.patch
+ epatch "${FILESDIR}/${PN}"-2.3.2-ppc-powerpc-arch-fix.patch
+ # fix parallel make
+ epatch "${FILESDIR}/${PN}"-2.5.0-doc-make.patch
+ # sage error handling patch
+ epatch "${FILESDIR}/${PN}"-2.5.0-mp.c.patch
+ # OS X: add -install_name to the linker option
+ epatch "${FILESDIR}/${PN}"-2.5.0-macos.patch
+
+ # disable default building of docs during install
+ sed -i \
+ -e "s:install-doc install-examples:install-examples:" \
+ config/Makefile.SH || die "Failed to fix makefile"
+
+ # propagate ldflags
+ sed -i \
+ -e 's/$shared $extra/$shared $extra \\$(LDFLAGS)/' \
+ config/get_dlld || die "failed to fix LDFLAGS"
+ # move doc dir to a gentoo doc dir and replace acroread by xdg-open
+ sed -i \
+ -e "s:\$d = \$0:\$d = '${EPREFIX}/usr/share/doc/${PF}':" \
+ -e 's:"acroread":"xdg-open":' \
+ doc/gphelp.in || die "Failed to fix doc dir"
+
+ sed -i "s:/usr:${EPREFIX}/usr:g" config/get_X11 \
+ || die "Failed to fix get_X11"
+
+ # usersch3.tex is generated
+ rm -f doc/usersch3.tex || die "failed to remove generated file"
+}
+
+src_configure() {
+ tc-export CC
+
+ # need to force optimization here, as it breaks without
+ if is-flag -O0; then
+ replace-flags -O0 -O2
+ elif ! is-flag -O?; then
+ append-flags -O2
+ fi
+
+ local myconfig
+ if use gmp ; then
+ myconfig="--with-gmp=${EPREFIX}/usr"
+ else
+ myconfig="--with-gmp=no"
+ fi
+
+ # sysdatadir installs a pari.cfg stuff which is informative only
+ ./Configure \
+ --prefix="${EPREFIX}"/usr \
+ --datadir="${EPREFIX}"/usr/share/${PN} \
+ --libdir="${EPREFIX}"/usr/$(get_libdir) \
+ --sysdatadir="${EPREFIX}"/usr/share/doc/${PF} \
+ --mandir="${EPREFIX}"/usr/share/man/man1 \
+ --with-readline="${EPREFIX}"/usr \
+ --with-ncurses-lib="${EPREFIX}"/usr/$(get_libdir) \
+ $myconfig \
+ || die "./Configure failed"
+}
+
+src_compile() {
+ local installdir=$(get_compile_dir)
+ cd "${installdir}" || die "failed to change directory"
+
+ # upstream set -fno-strict-aliasing.
+ # aliasing is a known issue on amd64, work on x86 by sheer luck
+ emake ${mymake} \
+ CFLAGS="${CFLAGS} -fno-strict-aliasing -DGCC_INLINE -fPIC" lib-dyn
+ emake ${mymake} \
+ CFLAGS="${CFLAGS} -DGCC_INLINE" gp ../gp
+
+ if use doc; then
+ cd "${S}" || die "failed to change directory"
+ # To prevent sandbox violations by metafont
+ VARTEXFONTS="${T}"/fonts emake docpdf
+ fi
+}
+
+src_test() {
+ emake dobench
+}
+
+src_install() {
+ default
+ dodoc MACHINES COMPAT
+ if use doc; then
+ # install gphelp and the pdf documentations manually.
+ # the install-doc target is overkill.
+ dodoc doc/*.pdf
+ dobin doc/gphelp
+ insinto /usr/share/doc/${PF}
+ # gphelp looks for some of the tex sources...
+ doins doc/*.tex doc/translations
+ # Install the examples - for real.
+ local installdir=$(get_compile_dir)
+ cd "${installdir}" || die "failed to change directory"
+ emake EXDIR="${ED}/usr/share/doc/${PF}/examples" install-examples
+ fi
+}
diff --git a/sci-mathematics/pari/pari-2.5.1-r1.ebuild b/sci-mathematics/pari/pari-2.5.1-r1.ebuild
new file mode 100644
index 000000000000..e9cc7f24cfbc
--- /dev/null
+++ b/sci-mathematics/pari/pari-2.5.1-r1.ebuild
@@ -0,0 +1,137 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="4"
+
+inherit eutils flag-o-matic toolchain-funcs multilib
+
+DESCRIPTION="A software package for computer-aided number theory"
+HOMEPAGE="http://pari.math.u-bordeaux.fr/"
+SRC_URI="http://pari.math.u-bordeaux.fr/pub/${PN}/unix/${P}.tar.gz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~hppa ~mips ~ppc ~ppc64 ~sparc ~x86 ~amd64-linux ~x86-fbsd ~x86-linux ~x86-macos ~x86-solaris"
+IUSE="data doc fltk gmp qt4 X"
+
+RDEPEND="sys-libs/readline
+ data? ( sci-mathematics/pari-data )
+ doc? ( X? ( x11-misc/xdg-utils ) )
+ fltk? ( x11-libs/fltk:1 )
+ gmp? ( dev-libs/gmp )
+ qt4? ( dev-qt/qtgui:4 )
+ X? ( x11-libs/libX11 )"
+DEPEND="${RDEPEND}
+ doc? ( virtual/latex-base )"
+
+get_compile_dir() {
+ pushd "${S}/config" > /dev/null
+ local fastread=yes
+ source ./get_archos
+ popd > /dev/null
+ echo "O${osname}-${arch}"
+}
+
+src_prepare() {
+ epatch "${FILESDIR}"/${PN}-2.3.2-strip.patch
+ epatch "${FILESDIR}"/${PN}-2.3.2-ppc-powerpc-arch-fix.patch
+ # fix parallel make
+ epatch "${FILESDIR}"/${PN}-2.5.0-doc-make.patch
+ # sage error handling patch
+ epatch "${FILESDIR}"/${PN}-2.5.0-mp.c.patch
+ # OS X: add -install_name to the linker option
+ epatch "${FILESDIR}"/${PN}-2.5.0-macos.patch
+ # from debian, fies bug #423617
+ epatch "${FILESDIR}"/${PN}-2.5.1-gcc47.patch
+ # fix automagic
+ epatch "${FILESDIR}"/${PN}-2.5.1-no-automagic.patch
+ # upstream fixes
+ epatch "${FILESDIR}"/${PN}-2.5.1-1302.patch
+ epatch "${FILESDIR}"/${PN}-2.5.1-1304.patch
+
+ # disable default building of docs during install
+ sed -i \
+ -e "s:install-doc install-examples:install-examples:" \
+ config/Makefile.SH || die "Failed to fix makefile"
+
+ # propagate ldflags
+ sed -i \
+ -e 's/$shared $extra/$shared $extra \\$(LDFLAGS)/' \
+ config/get_dlld || die "failed to fix LDFLAGS"
+ # move doc dir to a gentoo doc dir and replace acroread by xdg-open
+ sed -i \
+ -e "s:\$d = \$0:\$d = '${EPREFIX}/usr/share/doc/${PF}':" \
+ -e 's:"acroread":"xdg-open":' \
+ doc/gphelp.in || die "Failed to fix doc dir"
+
+ sed -i "s:/usr:${EPREFIX}/usr:g" config/get_X11 \
+ || die "Failed to fix get_X11"
+
+ # usersch3.tex is generated
+ rm -f doc/usersch3.tex || die "failed to remove generated file"
+}
+
+src_configure() {
+ tc-export CC
+
+ # need to force optimization here, as it breaks without
+ if is-flag -O0; then
+ replace-flags -O0 -O2
+ elif ! is-flag -O?; then
+ append-flags -O2
+ fi
+
+ # sysdatadir installs a pari.cfg stuff which is informative only
+ ./Configure \
+ --prefix="${EPREFIX}"/usr \
+ --datadir="${EPREFIX}"/usr/share/${PN} \
+ --libdir="${EPREFIX}"/usr/$(get_libdir) \
+ --sysdatadir="${EPREFIX}"/usr/share/doc/${PF} \
+ --mandir="${EPREFIX}"/usr/share/man/man1 \
+ --with-readline="${EPREFIX}"/usr \
+ --with-ncurses-lib="${EPREFIX}"/usr/$(get_libdir) \
+ $(use_with fltk) \
+ $(use_with gmp) \
+ $(use_with qt4 qt) \
+ || die "./Configure failed"
+}
+
+src_compile() {
+ local installdir=$(get_compile_dir)
+ cd "${installdir}" || die "failed to change directory"
+ # upstream set -fno-strict-aliasing.
+ # aliasing is a known issue on amd64, work on x86 by sheer luck
+ emake ${mymake} \
+ CFLAGS="${CFLAGS} -fno-strict-aliasing -DGCC_INLINE -fPIC" lib-dyn
+ emake ${mymake} \
+ CFLAGS="${CFLAGS} -DGCC_INLINE" gp ../gp
+
+ if use doc; then
+ cd "${S}" || die "failed to change directory"
+ # To prevent sandbox violations by metafont
+ VARTEXFONTS="${T}"/fonts emake docpdf
+ fi
+}
+
+src_test() {
+ emake dobench
+}
+
+src_install() {
+ default
+ dodoc MACHINES COMPAT
+ if use doc; then
+ # install gphelp and the pdf documentations manually.
+ # the install-doc target is overkill.
+ dodoc doc/*.pdf
+ dobin doc/gphelp
+ insinto /usr/share/doc/${PF}
+ # gphelp looks for some of the tex sources...
+ doins doc/*.tex doc/translations
+ # Install the examples - for real.
+ local installdir=$(get_compile_dir)
+ cd "${installdir}" || die "failed to change directory"
+ emake EXDIR="${ED}/usr/share/doc/${PF}/examples" install-examples
+ fi
+}
diff --git a/sci-mathematics/pari/pari-2.5.1.ebuild b/sci-mathematics/pari/pari-2.5.1.ebuild
new file mode 100644
index 000000000000..539c489d69a1
--- /dev/null
+++ b/sci-mathematics/pari/pari-2.5.1.ebuild
@@ -0,0 +1,137 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="4"
+
+inherit eutils flag-o-matic toolchain-funcs
+
+DESCRIPTION="A software package for computer-aided number theory"
+HOMEPAGE="http://pari.math.u-bordeaux.fr/"
+SRC_URI="http://pari.math.u-bordeaux.fr/pub/${PN}/unix/${P}.tar.gz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~hppa ~mips ~ppc ~ppc64 ~sparc ~x86 ~x86-fbsd ~amd64-linux ~x86-linux ~x86-macos ~x86-solaris"
+IUSE="doc data fltk gmp X"
+
+RDEPEND="sys-libs/readline
+ fltk? ( x11-libs/fltk:1 )
+ gmp? ( dev-libs/gmp )
+ X? ( x11-libs/libX11 )
+ doc? ( X? ( x11-misc/xdg-utils ) )
+ data? ( sci-mathematics/pari-data )"
+DEPEND="${RDEPEND}
+ doc? ( virtual/latex-base )"
+
+get_compile_dir() {
+ pushd "${S}/config" > /dev/null
+ local fastread=yes
+ source ./get_archos
+ popd > /dev/null
+ echo "O${osname}-${arch}"
+}
+
+src_prepare() {
+ epatch "${FILESDIR}/${PN}"-2.3.2-strip.patch
+ epatch "${FILESDIR}/${PN}"-2.3.2-ppc-powerpc-arch-fix.patch
+ # fix parallel make
+ epatch "${FILESDIR}/${PN}"-2.5.0-doc-make.patch
+ # sage error handling patch
+ epatch "${FILESDIR}/${PN}"-2.5.0-mp.c.patch
+ # OS X: add -install_name to the linker option
+ epatch "${FILESDIR}/${PN}"-2.5.0-macos.patch
+ # from debian, fies bug #423617
+ epatch "${FILESDIR}/${PN}"-2.5.1-gcc47.patch
+
+ # disable default building of docs during install
+ sed -i \
+ -e "s:install-doc install-examples:install-examples:" \
+ config/Makefile.SH || die "Failed to fix makefile"
+
+ # propagate ldflags
+ sed -i \
+ -e 's/$shared $extra/$shared $extra \\$(LDFLAGS)/' \
+ config/get_dlld || die "failed to fix LDFLAGS"
+ # move doc dir to a gentoo doc dir and replace acroread by xdg-open
+ sed -i \
+ -e "s:\$d = \$0:\$d = '${EPREFIX}/usr/share/doc/${PF}':" \
+ -e 's:"acroread":"xdg-open":' \
+ doc/gphelp.in || die "Failed to fix doc dir"
+
+ sed -i "s:/usr:${EPREFIX}/usr:g" config/get_X11 \
+ || die "Failed to fix get_X11"
+
+ # usersch3.tex is generated
+ rm -f doc/usersch3.tex || die "failed to remove generated file"
+}
+
+src_configure() {
+ tc-export CC
+
+ # need to force optimization here, as it breaks without
+ if is-flag -O0; then
+ replace-flags -O0 -O2
+ elif ! is-flag -O?; then
+ append-flags -O2
+ fi
+
+ local myconfig
+ if use gmp ; then
+ myconfig="--with-gmp=${EPREFIX}/usr"
+ else
+ myconfig="--with-gmp=no"
+ fi
+
+ # sysdatadir installs a pari.cfg stuff which is informative only
+ ./Configure \
+ --prefix="${EPREFIX}"/usr \
+ --datadir="${EPREFIX}"/usr/share/${PN} \
+ --libdir="${EPREFIX}"/usr/$(get_libdir) \
+ --sysdatadir="${EPREFIX}"/usr/share/doc/${PF} \
+ --mandir="${EPREFIX}"/usr/share/man/man1 \
+ --with-readline="${EPREFIX}"/usr \
+ --with-ncurses-lib="${EPREFIX}"/usr/$(get_libdir) \
+ $myconfig \
+ || die "./Configure failed"
+}
+
+src_compile() {
+ local installdir=$(get_compile_dir)
+ cd "${installdir}" || die "failed to change directory"
+
+ # upstream set -fno-strict-aliasing.
+ # aliasing is a known issue on amd64, work on x86 by sheer luck
+ emake ${mymake} \
+ CFLAGS="${CFLAGS} -fno-strict-aliasing -DGCC_INLINE -fPIC" lib-dyn
+ emake ${mymake} \
+ CFLAGS="${CFLAGS} -DGCC_INLINE" gp ../gp
+
+ if use doc; then
+ cd "${S}" || die "failed to change directory"
+ # To prevent sandbox violations by metafont
+ VARTEXFONTS="${T}"/fonts emake docpdf
+ fi
+}
+
+src_test() {
+ emake dobench
+}
+
+src_install() {
+ default
+ dodoc MACHINES COMPAT
+ if use doc; then
+ # install gphelp and the pdf documentations manually.
+ # the install-doc target is overkill.
+ dodoc doc/*.pdf
+ dobin doc/gphelp
+ insinto /usr/share/doc/${PF}
+ # gphelp looks for some of the tex sources...
+ doins doc/*.tex doc/translations
+ # Install the examples - for real.
+ local installdir=$(get_compile_dir)
+ cd "${installdir}" || die "failed to change directory"
+ emake EXDIR="${ED}/usr/share/doc/${PF}/examples" install-examples
+ fi
+}
diff --git a/sci-mathematics/pari/pari-2.5.2.ebuild b/sci-mathematics/pari/pari-2.5.2.ebuild
new file mode 100644
index 000000000000..69178ee14dbb
--- /dev/null
+++ b/sci-mathematics/pari/pari-2.5.2.ebuild
@@ -0,0 +1,133 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=4
+
+inherit eutils flag-o-matic toolchain-funcs multilib
+
+DESCRIPTION="A software package for computer-aided number theory"
+HOMEPAGE="http://pari.math.u-bordeaux.fr/"
+SRC_URI="http://pari.math.u-bordeaux.fr/pub/${PN}/unix/${P}.tar.gz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~hppa ~mips ~ppc ~ppc64 ~sparc ~x86 ~amd64-linux ~x86-fbsd ~x86-linux ~x86-macos ~x86-solaris"
+IUSE="data doc fltk gmp qt4 X"
+
+RDEPEND="sys-libs/readline
+ data? ( sci-mathematics/pari-data )
+ doc? ( X? ( x11-misc/xdg-utils ) )
+ fltk? ( x11-libs/fltk:1 )
+ gmp? ( dev-libs/gmp )
+ qt4? ( dev-qt/qtgui:4 )
+ X? ( x11-libs/libX11 )"
+DEPEND="${RDEPEND}
+ doc? ( virtual/latex-base )"
+
+get_compile_dir() {
+ pushd "${S}/config" > /dev/null
+ local fastread=yes
+ source ./get_archos
+ popd > /dev/null
+ echo "O${osname}-${arch}"
+}
+
+src_prepare() {
+ epatch "${FILESDIR}"/${PN}-2.3.2-strip.patch
+ epatch "${FILESDIR}"/${PN}-2.3.2-ppc-powerpc-arch-fix.patch
+ # fix parallel make
+ epatch "${FILESDIR}"/${PN}-2.5.0-doc-make.patch
+ # sage error handling patch
+ epatch "${FILESDIR}"/${PN}-2.5.0-mp.c.patch
+ # OS X: add -install_name to the linker option
+ epatch "${FILESDIR}"/${PN}-2.5.0-macos.patch
+ # fix automagic
+ epatch "${FILESDIR}"/${PN}-2.5.1-no-automagic.patch
+
+ # disable default building of docs during install
+ sed -i \
+ -e "s:install-doc install-examples:install-examples:" \
+ config/Makefile.SH || die "Failed to fix makefile"
+
+ # propagate ldflags
+ sed -i \
+ -e 's/$shared $extra/$shared $extra \\$(LDFLAGS)/' \
+ config/get_dlld || die "failed to fix LDFLAGS"
+ # move doc dir to a gentoo doc dir and replace acroread by xdg-open
+ sed -i \
+ -e "s:\$d = \$0:\$d = '${EPREFIX}/usr/share/doc/${PF}':" \
+ -e 's:"acroread":"xdg-open":' \
+ doc/gphelp.in || die "Failed to fix doc dir"
+
+ sed -i "s:/\(usr\|lib64\):${EPREFIX}/\1:g" \
+ config/get_{Qt,X11,include_path,libpth} \
+ || die "Failed to fix get_X11"
+
+ # usersch3.tex is generated
+ rm doc/usersch3.tex || die "failed to remove generated file"
+}
+
+src_configure() {
+ tc-export CC
+
+ # need to force optimization here, as it breaks without
+ if is-flag -O0; then
+ replace-flags -O0 -O2
+ elif ! is-flag -O?; then
+ append-flags -O2
+ fi
+
+ # sysdatadir installs a pari.cfg stuff which is informative only
+ ./Configure \
+ --prefix="${EPREFIX}"/usr \
+ --datadir="${EPREFIX}"/usr/share/${PN} \
+ --libdir="${EPREFIX}"/usr/$(get_libdir) \
+ --sysdatadir="${EPREFIX}"/usr/share/doc/${PF} \
+ --mandir="${EPREFIX}"/usr/share/man/man1 \
+ --with-readline="${EPREFIX}"/usr \
+ --with-ncurses-lib="${EPREFIX}"/usr/$(get_libdir) \
+ $(use_with fltk) \
+ $(use_with gmp) \
+ $(use_with qt4 qt) \
+ || die "./Configure failed"
+}
+
+src_compile() {
+ local installdir=$(get_compile_dir)
+ cd "${installdir}" || die "failed to change directory"
+ # upstream set -fno-strict-aliasing.
+ # aliasing is a known issue on amd64, work on x86 by sheer luck
+ emake ${mymake} \
+ CFLAGS="${CFLAGS} -fno-strict-aliasing -DGCC_INLINE -fPIC" lib-dyn
+ emake ${mymake} \
+ CFLAGS="${CFLAGS} -DGCC_INLINE" gp ../gp
+
+ if use doc; then
+ cd "${S}" || die "failed to change directory"
+ # To prevent sandbox violations by metafont
+ VARTEXFONTS="${T}"/fonts emake docpdf
+ fi
+}
+
+src_test() {
+ emake dobench
+}
+
+src_install() {
+ default
+ dodoc MACHINES COMPAT
+ if use doc; then
+ # install gphelp and the pdf documentations manually.
+ # the install-doc target is overkill.
+ dodoc doc/*.pdf
+ dobin doc/gphelp
+ insinto /usr/share/doc/${PF}
+ # gphelp looks for some of the tex sources...
+ doins doc/*.tex doc/translations
+ # Install the examples - for real.
+ local installdir=$(get_compile_dir)
+ cd "${installdir}" || die "failed to change directory"
+ emake EXDIR="${ED}/usr/share/doc/${PF}/examples" install-examples
+ fi
+}
diff --git a/sci-mathematics/pari/pari-2.5.3.ebuild b/sci-mathematics/pari/pari-2.5.3.ebuild
new file mode 100644
index 000000000000..5017be96fbc1
--- /dev/null
+++ b/sci-mathematics/pari/pari-2.5.3.ebuild
@@ -0,0 +1,133 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=4
+
+inherit eutils flag-o-matic toolchain-funcs multilib
+
+DESCRIPTION="A software package for computer-aided number theory"
+HOMEPAGE="http://pari.math.u-bordeaux.fr/"
+SRC_URI="http://pari.math.u-bordeaux.fr/pub/${PN}/unix/${P}.tar.gz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~hppa ~mips ~ppc ~ppc64 ~sparc ~x86 ~x86-fbsd ~amd64-linux ~x86-linux ~x86-macos ~x86-solaris"
+IUSE="data doc fltk gmp qt4 X"
+
+RDEPEND="sys-libs/readline
+ data? ( sci-mathematics/pari-data )
+ doc? ( X? ( x11-misc/xdg-utils ) )
+ fltk? ( x11-libs/fltk:1 )
+ gmp? ( dev-libs/gmp )
+ qt4? ( dev-qt/qtgui:4 )
+ X? ( x11-libs/libX11 )"
+DEPEND="${RDEPEND}
+ doc? ( virtual/latex-base )"
+
+get_compile_dir() {
+ pushd "${S}/config" > /dev/null
+ local fastread=yes
+ source ./get_archos
+ popd > /dev/null
+ echo "O${osname}-${arch}"
+}
+
+src_prepare() {
+ epatch "${FILESDIR}"/${PN}-2.3.2-strip.patch
+ epatch "${FILESDIR}"/${PN}-2.3.2-ppc-powerpc-arch-fix.patch
+ # fix parallel make
+ epatch "${FILESDIR}"/${PN}-2.5.0-doc-make.patch
+ # sage error handling patch
+ epatch "${FILESDIR}"/${PN}-2.5.0-mp.c.patch
+ # OS X: add -install_name to the linker option
+ epatch "${FILESDIR}"/${PN}-2.5.0-macos.patch
+ # fix automagic
+ epatch "${FILESDIR}"/${PN}-2.5.1-no-automagic.patch
+
+ # disable default building of docs during install
+ sed -i \
+ -e "s:install-doc install-examples:install-examples:" \
+ config/Makefile.SH || die "Failed to fix makefile"
+
+ # propagate ldflags
+ sed -i \
+ -e 's/$shared $extra/$shared $extra \\$(LDFLAGS)/' \
+ config/get_dlld || die "failed to fix LDFLAGS"
+ # move doc dir to a gentoo doc dir and replace acroread by xdg-open
+ sed -i \
+ -e "s:\$d = \$0:\$d = '${EPREFIX}/usr/share/doc/${PF}':" \
+ -e 's:"acroread":"xdg-open":' \
+ doc/gphelp.in || die "Failed to fix doc dir"
+
+ sed -i "s:/\(usr\|lib64\):${EPREFIX}/\1:g" \
+ config/get_{Qt,X11,include_path,libpth} \
+ || die "Failed to fix get_X11"
+
+ # usersch3.tex is generated
+ rm doc/usersch3.tex || die "failed to remove generated file"
+}
+
+src_configure() {
+ tc-export CC
+
+ # need to force optimization here, as it breaks without
+ if is-flag -O0; then
+ replace-flags -O0 -O2
+ elif ! is-flag -O?; then
+ append-flags -O2
+ fi
+
+ # sysdatadir installs a pari.cfg stuff which is informative only
+ ./Configure \
+ --prefix="${EPREFIX}"/usr \
+ --datadir="${EPREFIX}"/usr/share/${PN} \
+ --libdir="${EPREFIX}"/usr/$(get_libdir) \
+ --sysdatadir="${EPREFIX}"/usr/share/doc/${PF} \
+ --mandir="${EPREFIX}"/usr/share/man/man1 \
+ --with-readline="${EPREFIX}"/usr \
+ --with-ncurses-lib="${EPREFIX}"/usr/$(get_libdir) \
+ $(use_with fltk) \
+ $(use_with gmp) \
+ $(use_with qt4 qt) \
+ || die "./Configure failed"
+}
+
+src_compile() {
+ local installdir=$(get_compile_dir)
+ cd "${installdir}" || die "failed to change directory"
+ # upstream set -fno-strict-aliasing.
+ # aliasing is a known issue on amd64, work on x86 by sheer luck
+ emake ${mymake} \
+ CFLAGS="${CFLAGS} -fno-strict-aliasing -DGCC_INLINE -fPIC" lib-dyn
+ emake ${mymake} \
+ CFLAGS="${CFLAGS} -DGCC_INLINE" gp ../gp
+
+ if use doc; then
+ cd "${S}" || die "failed to change directory"
+ # To prevent sandbox violations by metafont
+ VARTEXFONTS="${T}"/fonts emake docpdf
+ fi
+}
+
+src_test() {
+ emake dobench
+}
+
+src_install() {
+ default
+ dodoc MACHINES COMPAT
+ if use doc; then
+ # install gphelp and the pdf documentations manually.
+ # the install-doc target is overkill.
+ dodoc doc/*.pdf
+ dobin doc/gphelp
+ insinto /usr/share/doc/${PF}
+ # gphelp looks for some of the tex sources...
+ doins doc/*.tex doc/translations
+ # Install the examples - for real.
+ local installdir=$(get_compile_dir)
+ cd "${installdir}" || die "failed to change directory"
+ emake EXDIR="${ED}/usr/share/doc/${PF}/examples" install-examples
+ fi
+}
diff --git a/sci-mathematics/pari/pari-2.5.4.ebuild b/sci-mathematics/pari/pari-2.5.4.ebuild
new file mode 100644
index 000000000000..f7a89d32eae6
--- /dev/null
+++ b/sci-mathematics/pari/pari-2.5.4.ebuild
@@ -0,0 +1,141 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+inherit eutils flag-o-matic toolchain-funcs multilib
+
+DESCRIPTION="Computer-aided number theory C library and tools"
+HOMEPAGE="http://pari.math.u-bordeaux.fr/"
+SRC_URI="http://pari.math.u-bordeaux.fr/pub/${PN}/unix/${P}.tar.gz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~hppa ~mips ~ppc ~ppc64 ~sparc ~x86 ~amd64-linux ~x86-fbsd ~x86-linux ~x86-macos ~x86-solaris"
+IUSE="data doc fltk gmp qt4 X"
+
+RDEPEND="
+ sys-libs/readline
+ data? ( sci-mathematics/pari-data )
+ doc? ( X? ( x11-misc/xdg-utils ) )
+ fltk? ( x11-libs/fltk:1 )
+ gmp? ( dev-libs/gmp )
+ qt4? ( dev-qt/qtgui:4 )
+ X? ( x11-libs/libX11 )"
+DEPEND="${RDEPEND}
+ doc? ( virtual/latex-base )"
+
+get_compile_dir() {
+ pushd "${S}/config" > /dev/null
+ local fastread=yes
+ source ./get_archos
+ popd > /dev/null
+ echo "O${osname}-${arch}"
+}
+
+src_prepare() {
+ epatch "${FILESDIR}"/${PN}-2.3.2-strip.patch
+ epatch "${FILESDIR}"/${PN}-2.3.2-ppc-powerpc-arch-fix.patch
+ # fix parallel make
+ epatch "${FILESDIR}"/${PN}-2.5.0-doc-make.patch
+ # sage error handling patch
+ epatch "${FILESDIR}"/${PN}-2.5.0-mp.c.patch
+ # OS X: add -install_name to the linker option
+ epatch "${FILESDIR}"/${PN}-2.5.0-macos.patch
+ # fix automagic
+ epatch "${FILESDIR}"/${PN}-2.5.1-no-automagic.patch
+ # sage-on-gentoo trac 13902: Slowdown for PARI integer determinant
+ epatch "${FILESDIR}"/${PN}-2.5.4-slow_determinant.patch
+ # sage-on-gentoo trac 13054: polred bug / pari bug 1395
+ epatch "${FILESDIR}"/${PN}-2.5.4-polred.patch
+
+ # disable default building of docs during install
+ sed -i \
+ -e "s:install-doc install-examples:install-examples:" \
+ config/Makefile.SH || die "Failed to fix makefile"
+
+ # propagate ldflags
+ sed -i \
+ -e 's/$shared $extra/$shared $extra \\$(LDFLAGS)/' \
+ config/get_dlld || die "failed to fix LDFLAGS"
+ # move doc dir to a gentoo doc dir and replace acroread by xdg-open
+ sed -i \
+ -e "s:\$d = \$0:\$d = '${EPREFIX}/usr/share/doc/${PF}':" \
+ -e 's:"acroread":"xdg-open":' \
+ doc/gphelp.in || die "Failed to fix doc dir"
+
+ sed -i "s:/\(usr\|lib64\):${EPREFIX}/\1:g" \
+ config/get_{Qt,X11,include_path,libpth} \
+ || die "Failed to fix get_X11"
+
+ # usersch3.tex is generated
+ rm doc/usersch3.tex || die "failed to remove generated file"
+}
+
+src_configure() {
+ tc-export CC
+ export CPLUSPLUS=$(tc-getCXX)
+
+ # need to force optimization here, as it breaks without
+ if is-flag -O0; then
+ replace-flags -O0 -O2
+ elif ! is-flag -O?; then
+ append-flags -O2
+ fi
+
+ # sysdatadir installs a pari.cfg stuff which is informative only
+ ./Configure \
+ --prefix="${EPREFIX}"/usr \
+ --datadir="${EPREFIX}"/usr/share/${PN} \
+ --libdir="${EPREFIX}"/usr/$(get_libdir) \
+ --sysdatadir="${EPREFIX}"/usr/share/doc/${PF} \
+ --mandir="${EPREFIX}"/usr/share/man/man1 \
+ --with-readline="${EPREFIX}"/usr \
+ --with-ncurses-lib="${EPREFIX}"/usr/$(get_libdir) \
+ $(use_with fltk) \
+ $(use_with gmp) \
+ $(use_with qt4 qt) \
+ || die "./Configure failed"
+}
+
+src_compile() {
+ mycxxmake=LD\=$(tc-getCXX)
+
+ local installdir=$(get_compile_dir)
+ cd "${installdir}" || die "failed to change directory"
+ # upstream set -fno-strict-aliasing.
+ # aliasing is a known issue on amd64, work on x86 by sheer luck
+ emake ${mymake} \
+ CFLAGS="${CFLAGS} -fno-strict-aliasing -DGCC_INLINE -fPIC" lib-dyn
+ emake ${mymake} ${mycxxmake} \
+ CFLAGS="${CFLAGS} -DGCC_INLINE" gp ../gp
+
+ if use doc; then
+ cd "${S}" || die "failed to change directory"
+ # To prevent sandbox violations by metafont
+ VARTEXFONTS="${T}"/fonts emake docpdf
+ fi
+}
+
+src_test() {
+ emake dobench
+}
+
+src_install() {
+ emake ${mymake} ${mycxxmake} DESTDIR="${D}" install
+ dodoc MACHINES COMPAT
+ if use doc; then
+ # install gphelp and the pdf documentations manually.
+ # the install-doc target is overkill.
+ dodoc doc/*.pdf
+ dobin doc/gphelp
+ insinto /usr/share/doc/${PF}
+ # gphelp looks for some of the tex sources...
+ doins doc/*.tex doc/translations
+ # Install the examples - for real.
+ local installdir=$(get_compile_dir)
+ cd "${installdir}" || die "failed to change directory"
+ emake EXDIR="${ED}/usr/share/doc/${PF}/examples" install-examples
+ fi
+}
diff --git a/sci-mathematics/pari/pari-2.7.0.ebuild b/sci-mathematics/pari/pari-2.7.0.ebuild
new file mode 100644
index 000000000000..1af3fe085342
--- /dev/null
+++ b/sci-mathematics/pari/pari-2.7.0.ebuild
@@ -0,0 +1,133 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+inherit eutils flag-o-matic toolchain-funcs multilib
+
+DESCRIPTION="Computer-aided number theory C library and tools"
+HOMEPAGE="http://pari.math.u-bordeaux.fr/"
+SRC_URI="http://pari.math.u-bordeaux.fr/pub/${PN}/unix/${P}.tar.gz"
+
+LICENSE="GPL-2"
+SLOT="0/4"
+KEYWORDS="~alpha ~amd64 ~hppa ~mips ~ppc ~ppc64 ~sparc ~x86 ~amd64-linux ~x86-fbsd ~x86-linux ~x86-macos ~x86-solaris"
+IUSE="data doc fltk gmp qt4 X"
+
+RDEPEND="
+ sys-libs/readline:0=
+ data? ( sci-mathematics/pari-data )
+ doc? ( X? ( x11-misc/xdg-utils ) )
+ fltk? ( x11-libs/fltk:1= )
+ gmp? ( dev-libs/gmp:0= )
+ qt4? ( dev-qt/qtgui:4= )
+ X? ( x11-libs/libX11:0= )"
+DEPEND="${RDEPEND}
+ doc? ( virtual/latex-base )"
+
+get_compile_dir() {
+ pushd "${S}/config" > /dev/null
+ local fastread=yes
+ source ./get_archos
+ popd > /dev/null
+ echo "O${osname}-${arch}"
+}
+
+src_prepare() {
+ epatch "${FILESDIR}"/${PN}-2.3.2-strip.patch
+ epatch "${FILESDIR}"/${PN}-2.3.2-ppc-powerpc-arch-fix.patch
+ # fix parallel make
+ epatch "${FILESDIR}"/${PN}-2.7.0-doc-make.patch
+ # fix automagic
+ epatch "${FILESDIR}"/${PN}-2.7.0-no-automagic.patch
+ # sage-on-gentoo trac 15654: PARI discriminant speed depends on stack size
+ epatch "${FILESDIR}"/${PN}-2.7.0-slow-discriminant.patch
+
+ # disable default building of docs during install
+ sed -i \
+ -e "s:install-doc install-examples:install-examples:" \
+ config/Makefile.SH || die "Failed to fix makefile"
+
+ # propagate ldflags
+ sed -i \
+ -e 's/$shared $extra/$shared $extra \\$(LDFLAGS)/' \
+ config/get_dlld || die "failed to fix LDFLAGS"
+ # move doc dir to a gentoo doc dir and replace acroread by xdg-open
+ sed -i \
+ -e "s:\$d = \$0:\$d = '${EPREFIX}/usr/share/doc/${PF}':" \
+ -e 's:"acroread":"xdg-open":' \
+ doc/gphelp.in || die "Failed to fix doc dir"
+
+ # usersch3.tex is generated
+ rm doc/usersch3.tex || die "failed to remove generated file"
+}
+
+src_configure() {
+ tc-export CC
+ export CPLUSPLUS=$(tc-getCXX)
+
+ # need to force optimization here, as it breaks without
+ if is-flag -O0; then
+ replace-flags -O0 -O2
+ elif ! is-flag -O?; then
+ append-flags -O2
+ fi
+
+ # sysdatadir installs a pari.cfg stuff which is informative only
+ ./Configure \
+ --prefix="${EPREFIX}"/usr \
+ --datadir="${EPREFIX}"/usr/share/${PN} \
+ --libdir="${EPREFIX}"/usr/$(get_libdir) \
+ --sysdatadir="${EPREFIX}"/usr/share/doc/${PF} \
+ --mandir="${EPREFIX}"/usr/share/man/man1 \
+ --with-readline="${EPREFIX}"/usr \
+ --with-ncurses-lib="${EPREFIX}"/usr/$(get_libdir) \
+ $(use_with fltk) \
+ $(use_with gmp) \
+ $(use_with qt4 qt) \
+ || die "./Configure failed"
+}
+
+src_compile() {
+ use hppa && \
+ mymake=DLLD\="${EPREFIX}"/usr/bin/gcc\ DLLDFLAGS\=-shared\ -Wl,-soname=\$\(LIBPARI_SONAME\)\ -lm
+
+ mycxxmake=LD\=$(tc-getCXX)
+
+ local installdir=$(get_compile_dir)
+ cd "${installdir}" || die "failed to change directory"
+ # upstream set -fno-strict-aliasing.
+ # aliasing is a known issue on amd64, work on x86 by sheer luck
+ emake ${mymake} \
+ CFLAGS="${CFLAGS} -fno-strict-aliasing -DGCC_INLINE -fPIC" lib-dyn
+ emake ${mymake} ${mycxxmake} \
+ CFLAGS="${CFLAGS} -DGCC_INLINE" gp ../gp
+
+ if use doc; then
+ cd "${S}" || die "failed to change directory"
+ # To prevent sandbox violations by metafont
+ VARTEXFONTS="${T}"/fonts emake docpdf
+ fi
+}
+
+src_test() {
+ emake dobench
+}
+
+src_install() {
+ emake ${mymake} ${mycxxmake} DESTDIR="${D}" install
+ dodoc MACHINES COMPAT
+ if use doc; then
+ # install gphelp and the pdf documentations manually.
+ # the install-doc target is overkill.
+ dodoc doc/*.pdf
+ dobin doc/gphelp
+ insinto /usr/share/doc/${PF}
+ # gphelp looks for some of the tex sources...
+ doins doc/*.tex doc/translations
+ # Install the examples - for real.
+ emake EXDIR="${ED}/usr/share/doc/${PF}/examples" \
+ -C $(get_compile_dir) install-examples
+ fi
+}
diff --git a/sci-mathematics/pari/pari-2.7.1.ebuild b/sci-mathematics/pari/pari-2.7.1.ebuild
new file mode 100644
index 000000000000..1af3fe085342
--- /dev/null
+++ b/sci-mathematics/pari/pari-2.7.1.ebuild
@@ -0,0 +1,133 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+inherit eutils flag-o-matic toolchain-funcs multilib
+
+DESCRIPTION="Computer-aided number theory C library and tools"
+HOMEPAGE="http://pari.math.u-bordeaux.fr/"
+SRC_URI="http://pari.math.u-bordeaux.fr/pub/${PN}/unix/${P}.tar.gz"
+
+LICENSE="GPL-2"
+SLOT="0/4"
+KEYWORDS="~alpha ~amd64 ~hppa ~mips ~ppc ~ppc64 ~sparc ~x86 ~amd64-linux ~x86-fbsd ~x86-linux ~x86-macos ~x86-solaris"
+IUSE="data doc fltk gmp qt4 X"
+
+RDEPEND="
+ sys-libs/readline:0=
+ data? ( sci-mathematics/pari-data )
+ doc? ( X? ( x11-misc/xdg-utils ) )
+ fltk? ( x11-libs/fltk:1= )
+ gmp? ( dev-libs/gmp:0= )
+ qt4? ( dev-qt/qtgui:4= )
+ X? ( x11-libs/libX11:0= )"
+DEPEND="${RDEPEND}
+ doc? ( virtual/latex-base )"
+
+get_compile_dir() {
+ pushd "${S}/config" > /dev/null
+ local fastread=yes
+ source ./get_archos
+ popd > /dev/null
+ echo "O${osname}-${arch}"
+}
+
+src_prepare() {
+ epatch "${FILESDIR}"/${PN}-2.3.2-strip.patch
+ epatch "${FILESDIR}"/${PN}-2.3.2-ppc-powerpc-arch-fix.patch
+ # fix parallel make
+ epatch "${FILESDIR}"/${PN}-2.7.0-doc-make.patch
+ # fix automagic
+ epatch "${FILESDIR}"/${PN}-2.7.0-no-automagic.patch
+ # sage-on-gentoo trac 15654: PARI discriminant speed depends on stack size
+ epatch "${FILESDIR}"/${PN}-2.7.0-slow-discriminant.patch
+
+ # disable default building of docs during install
+ sed -i \
+ -e "s:install-doc install-examples:install-examples:" \
+ config/Makefile.SH || die "Failed to fix makefile"
+
+ # propagate ldflags
+ sed -i \
+ -e 's/$shared $extra/$shared $extra \\$(LDFLAGS)/' \
+ config/get_dlld || die "failed to fix LDFLAGS"
+ # move doc dir to a gentoo doc dir and replace acroread by xdg-open
+ sed -i \
+ -e "s:\$d = \$0:\$d = '${EPREFIX}/usr/share/doc/${PF}':" \
+ -e 's:"acroread":"xdg-open":' \
+ doc/gphelp.in || die "Failed to fix doc dir"
+
+ # usersch3.tex is generated
+ rm doc/usersch3.tex || die "failed to remove generated file"
+}
+
+src_configure() {
+ tc-export CC
+ export CPLUSPLUS=$(tc-getCXX)
+
+ # need to force optimization here, as it breaks without
+ if is-flag -O0; then
+ replace-flags -O0 -O2
+ elif ! is-flag -O?; then
+ append-flags -O2
+ fi
+
+ # sysdatadir installs a pari.cfg stuff which is informative only
+ ./Configure \
+ --prefix="${EPREFIX}"/usr \
+ --datadir="${EPREFIX}"/usr/share/${PN} \
+ --libdir="${EPREFIX}"/usr/$(get_libdir) \
+ --sysdatadir="${EPREFIX}"/usr/share/doc/${PF} \
+ --mandir="${EPREFIX}"/usr/share/man/man1 \
+ --with-readline="${EPREFIX}"/usr \
+ --with-ncurses-lib="${EPREFIX}"/usr/$(get_libdir) \
+ $(use_with fltk) \
+ $(use_with gmp) \
+ $(use_with qt4 qt) \
+ || die "./Configure failed"
+}
+
+src_compile() {
+ use hppa && \
+ mymake=DLLD\="${EPREFIX}"/usr/bin/gcc\ DLLDFLAGS\=-shared\ -Wl,-soname=\$\(LIBPARI_SONAME\)\ -lm
+
+ mycxxmake=LD\=$(tc-getCXX)
+
+ local installdir=$(get_compile_dir)
+ cd "${installdir}" || die "failed to change directory"
+ # upstream set -fno-strict-aliasing.
+ # aliasing is a known issue on amd64, work on x86 by sheer luck
+ emake ${mymake} \
+ CFLAGS="${CFLAGS} -fno-strict-aliasing -DGCC_INLINE -fPIC" lib-dyn
+ emake ${mymake} ${mycxxmake} \
+ CFLAGS="${CFLAGS} -DGCC_INLINE" gp ../gp
+
+ if use doc; then
+ cd "${S}" || die "failed to change directory"
+ # To prevent sandbox violations by metafont
+ VARTEXFONTS="${T}"/fonts emake docpdf
+ fi
+}
+
+src_test() {
+ emake dobench
+}
+
+src_install() {
+ emake ${mymake} ${mycxxmake} DESTDIR="${D}" install
+ dodoc MACHINES COMPAT
+ if use doc; then
+ # install gphelp and the pdf documentations manually.
+ # the install-doc target is overkill.
+ dodoc doc/*.pdf
+ dobin doc/gphelp
+ insinto /usr/share/doc/${PF}
+ # gphelp looks for some of the tex sources...
+ doins doc/*.tex doc/translations
+ # Install the examples - for real.
+ emake EXDIR="${ED}/usr/share/doc/${PF}/examples" \
+ -C $(get_compile_dir) install-examples
+ fi
+}
diff --git a/sci-mathematics/polymake/Manifest b/sci-mathematics/polymake/Manifest
new file mode 100644
index 000000000000..b4b030adde48
--- /dev/null
+++ b/sci-mathematics/polymake/Manifest
@@ -0,0 +1,3 @@
+DIST polymake-2.13-1.tar.bz2 16539798 SHA256 d010edc206b22356333493e90bd24f807c7341730232276d47dbf1b62eb53aba SHA512 90fd0c7eacbb673734e08860a753f75dae06347ce8affcb5d50c55a51975b85260db841393979c0143be5a71a26b6737f9513509d75a5950b40654c54d0be3ea WHIRLPOOL cef5c95930c7633acb0652e6ce3cd6c85b469af912ad1adb695e58a018e4cedbdac9f63caaeb12f3da0a8f7fb2b71e853b782f308a1594cfc89d2c9697e6c170
+DIST polymake-2.14-minimal.tar.bz2 1996581 SHA256 c43b525c6f329ae2d8eb6d0e2af63f7846c4e5d408627665a28d0f421bbbcf9b SHA512 8989a8d2eb42c03e46569eca24334083154ff5107d7cd7d9dc481790b1553acd38025bd48ca016407e5c08b4b08f8062e19a1d4828ef535f83292510bdf5cd07 WHIRLPOOL 3f1521c60eafcff60b8ab2a443ff051835ee1c667eefcd59b33227e7a84293ccaefad4bc05eea4b8c541dea513b85b4e8538b6b572d762f2e1167b733029ec54
+DIST polymake-2.14.tar.bz2 38747874 SHA256 c181277b5cd45ac00f5667647e4eb5fa13c20547623fd6e63ce2522c058883c2 SHA512 f66eac2e821060719a16a6979fa0cc20edf9598d425ba2fff5bddfc053fd582b05a5579e1c2521fd382733a4808955aa49cb946234a183aba3ef75eed8c02b22 WHIRLPOOL 26b21d28d6b9a76b7a3164b6d5e45a00ed8a604b3f973a22db1472dce714dec5f8ad5d2ee7133321e2cd0f48d6380343b8e6d93db9e79b6726ef1e9954c04405
diff --git a/sci-mathematics/polymake/files/polymake_gcc49.patch b/sci-mathematics/polymake/files/polymake_gcc49.patch
new file mode 100644
index 000000000000..bc2cac5c5c58
--- /dev/null
+++ b/sci-mathematics/polymake/files/polymake_gcc49.patch
@@ -0,0 +1,68 @@
+commit 9fdecb57cb728170d0b87637c67947acf0cd27a4
+Author: Benjamin Lorenz <lorenz@math.tu-berlin.de>
+Date: Sat May 17 23:05:41 2014 +0200
+
+ fix ppl configure.pl test for gcc 4.9
+
+diff --git a/bundled/ppl/configure.pl b/bundled/ppl/configure.pl
+index 128af1f..a147ea1 100644
+--- a/bundled/ppl/configure.pl
++++ b/bundled/ppl/configure.pl
+@@ -43,6 +43,7 @@ sub proceed {
+
+ } else {
+ my $error=Polymake::Configure::build_test_program(<<"---", Libs => "-lppl -lgmp");
++#include <cstddef>
+ #include "ppl.hh"
+ #include <iostream>
+ int main() {
+
+commit 6651dd4b284085ffb7385d6cbca1785b6242003b
+Author: Benjamin Lorenz <lorenz@math.tu-berlin.de>
+Date: Wed May 7 15:53:12 2014 +0200
+
+ another gcc 4.9 cstddef header fix
+
+diff --git a/bundled/bliss/apps/graph/src/GraphIso.cc b/bundled/bliss/apps/graph/src/GraphIso.cc
+index 4000dd5..14e0e8f 100644
+--- a/bundled/bliss/apps/graph/src/GraphIso.cc
++++ b/bundled/bliss/apps/graph/src/GraphIso.cc
+@@ -15,6 +15,7 @@
+ */
+
+ #include <cstring>
++#include <cstddef> // needed for gcc 4.9, see http://gcc.gnu.org/gcc-4.9/porting_to.html
+ #include <bliss/graph.hh>
+ #include "polymake/graph/GraphIso.h"
+
+
+commit 716639b858f476d6a2fd8fe51da67d6cb347ec7c
+Author: Benjamin Lorenz <lorenz@math.tu-berlin.de>
+Date: Tue May 6 14:58:33 2014 +0200
+
+ cstddef include fix for gcc 4.9 (see http://gcc.gnu.org/gcc-4.9/porting_to.html)
+
+diff --git a/bundled/libnormaliz/apps/polytope/src/normaliz.cc b/bundled/libnormaliz/apps/polytope/src/normaliz.cc
+index e6f2208..81e9783 100644
+--- a/bundled/libnormaliz/apps/polytope/src/normaliz.cc
++++ b/bundled/libnormaliz/apps/polytope/src/normaliz.cc
+@@ -14,6 +14,7 @@
+ --------------------------------------------------------------------------------
+ */
+
++#include <cstddef> // needed for gcc 4.9, see http://gcc.gnu.org/gcc-4.9/porting_to.html
+ #include <gmpxx.h>
+
+ #include "polymake/client.h"
+diff --git a/bundled/ppl/apps/polytope/include/ppl_interface_impl.h b/bundled/ppl/apps/polytope/include/ppl_interface_impl.h
+index fda2f39..1040c9e 100644
+--- a/bundled/ppl/apps/polytope/include/ppl_interface_impl.h
++++ b/bundled/ppl/apps/polytope/include/ppl_interface_impl.h
+@@ -17,6 +17,7 @@
+ #ifndef POLYMAKE_POLYTOPE_PPL_INTERFACE_IMPL_H
+ #define POLYMAKE_POLYTOPE_PPL_INTERFACE_IMPL_H
+
++#include <cstddef> // needed for gcc 4.9, see http://gcc.gnu.org/gcc-4.9/porting_to.html
+ #include <gmpxx.h> //for mpz/mpq-handling
+ #include "polymake/polytope/ppl_interface.h"
+ #include "polymake/common/lattice_tools.h"
diff --git a/sci-mathematics/polymake/metadata.xml b/sci-mathematics/polymake/metadata.xml
new file mode 100644
index 000000000000..2e7b4a5deb47
--- /dev/null
+++ b/sci-mathematics/polymake/metadata.xml
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+<maintainer>
+<email>tomka@gentoo.org</email>
+<name>Thomas Kahle</name>
+</maintainer>
+<herd>sci-mathematics</herd>
+<use>
+ <flag name="cdd">Enable sci-libs/cddlib interface for convex hull
+ computations (Should be kept enabled).</flag>
+ <flag name="lrs">Enable sci-libs/lrslib interface for convex hull computations.</flag>
+ <flag name="ppl">Enable dev-libs/ppl interface for convex hull computations.</flag>
+ <flag name="bliss">Enable sci-libs/bliss interface for graph and face lattice isomorphism computations.</flag>
+ <flag name="group">Build extension for dealing with permutation groups and symmetric objects.</flag>
+ <flag name="libnormaliz">Build the bundled extension for lattice related computations.</flag>
+ <flag name="singular">Enable the interface to sci-mathematics/singular for ideal related computations.</flag>
+ <flag name="libpolymake">Build the polymake library to build applications using the C++ interface.</flag>
+</use>
+<longdescription lang="en">
+Polymake started out as a tool for the algorithmic treatment of convex
+polyhedra. By now it also deals with finite simplicial complexes,
+tight spans of finite metric spaces, and other objects.
+</longdescription>
+</pkgmetadata>
diff --git a/sci-mathematics/polymake/polymake-2.13.ebuild b/sci-mathematics/polymake/polymake-2.13.ebuild
new file mode 100644
index 000000000000..26e172f13b05
--- /dev/null
+++ b/sci-mathematics/polymake/polymake-2.13.ebuild
@@ -0,0 +1,64 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+inherit eutils flag-o-matic
+
+MY_PV=${PV}-1
+
+DESCRIPTION="research tool for polyhedral geometry and combinatorics"
+SRC_URI="http://polymake.org/lib/exe/fetch.php/download/${PN}-${MY_PV}.tar.bz2"
+HOMEPAGE="http://polymake.org"
+
+IUSE="libpolymake"
+
+SLOT="0"
+LICENSE="GPL-2"
+KEYWORDS="~amd64 ~x86 ~amd64-linux ~x86-linux"
+
+DEPEND="dev-libs/gmp
+ dev-libs/boost
+ dev-libs/libxml2:2
+ dev-perl/XML-LibXML
+ dev-libs/libxslt
+ dev-perl/XML-LibXSLT
+ dev-perl/XML-Writer
+ dev-perl/Term-ReadLine-Gnu"
+RDEPEND="${DEPEND}"
+
+S="${WORKDIR}/${PN}-${MY_PV}"
+
+src_prepare() {
+ # Don't strip
+ sed -i '/system "strip $to"/d' support/install.pl || die
+ epatch "${FILESDIR}/${PN}_gcc49.patch"
+
+ einfo "During compile this package uses up to"
+ einfo "750MB of RAM per process. Use MAKEOPTS=\"-j1\" if"
+ einfo "you run into trouble."
+}
+
+src_configure () {
+ export CXXOPT=$(get-flag -O)
+ # Configure does not accept --host, therefore econf cannot be used
+ ./configure --prefix="${EPREFIX}/usr" \
+ --without-java \
+ $(use_with libpolymake callable) \
+ --without-prereq \
+ --libdir="${EPREFIX}/usr/$(get_libdir)" \
+ --libexecdir="${EPREFIX}/usr/$(get_libdir)/polymake" \
+ "${myconf}" || die
+}
+
+src_install(){
+ emake -j1 DESTDIR="${D}" install
+ dosym libpolymake.so "${EPREFIX}/usr/$(get_libdir)/libpolymake.so.0"
+}
+
+pkg_postinst(){
+ elog "Docs can be found on http://www.polymake.org/doku.php/documentation"
+ elog " "
+ elog "Support for jreality is missing, sorry (see bug #346073)."
+}
diff --git a/sci-mathematics/polymake/polymake-2.14-r1.ebuild b/sci-mathematics/polymake/polymake-2.14-r1.ebuild
new file mode 100644
index 000000000000..d85b9c857663
--- /dev/null
+++ b/sci-mathematics/polymake/polymake-2.14-r1.ebuild
@@ -0,0 +1,90 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+inherit eutils flag-o-matic
+
+DESCRIPTION="research tool for polyhedral geometry and combinatorics"
+SRC_URI="http://polymake.org/lib/exe/fetch.php/download/${P}-minimal.tar.bz2"
+HOMEPAGE="http://polymake.org"
+
+IUSE="+cdd lrs ppl bliss group +libnormaliz singular libpolymake"
+
+REQUIRED_USE="group? ( cdd lrs )"
+
+SLOT="0"
+LICENSE="GPL-2"
+KEYWORDS="~amd64 ~x86 ~amd64-linux ~x86-linux"
+
+# do not allow new perl versions because our testbuilds segfault
+DEPEND="<dev-lang/perl-5.21
+ dev-libs/gmp
+ dev-libs/mpfr
+ dev-libs/libxml2:2
+ dev-libs/libxslt
+ ppl? ( dev-libs/ppl )
+ cdd? ( sci-libs/cddlib )
+ lrs? ( >=sci-libs/lrslib-051[gmp] )
+ bliss? ( sci-libs/bliss[gmp] )
+ group? ( dev-libs/boost )
+ libnormaliz? ( dev-libs/boost )
+ singular? ( >=sci-mathematics/singular-4.0.1 )"
+RDEPEND="${DEPEND}
+ dev-perl/XML-LibXML
+ dev-perl/XML-LibXSLT
+ dev-perl/XML-Writer
+ dev-perl/Term-ReadLine-Gnu"
+
+src_prepare() {
+ einfo "During compile this package uses up to"
+ einfo "750MB of RAM per process. Use MAKEOPTS=\"-j1\" if"
+ einfo "you run into trouble."
+}
+
+src_configure () {
+ export CXXOPT=$(get-flag -O)
+
+ # We need to define BLISS_USE_GMP if bliss was built with gmp support.
+ # Therefore we require gmp support on bliss, so that the package
+ # manager can prevent rebuilds with changed gmp flag.
+ if use bliss ; then
+ append-cxxflags -DBLISS_USE_GMP
+ fi
+
+ # Configure does not accept --host, therefore econf cannot be used
+
+ # Some of the options do not support using just '--with-option'
+ local myconf=""
+ use !group && myconf="$myconf --without-group"
+ use !libnormaliz && myconf="$myconf --without-libnormaliz"
+ use !libpolymake && myconf="$myconf --without-callable"
+
+ # And many other --with-arguments expect a path: --with-option=/path
+ ./configure --prefix="${EPREFIX}/usr" \
+ --libdir="${EPREFIX}/usr/$(get_libdir)" \
+ --libexecdir="${EPREFIX}/usr/$(get_libdir)/polymake" \
+ --without-prereq \
+ --without-java \
+ $(use_with cdd cdd "${EPREFIX}/usr") \
+ $(use_with lrs lrs "${EPREFIX}/usr") \
+ $(use_with ppl ppl "${EPREFIX}/usr") \
+ $(use_with bliss bliss "${EPREFIX}/usr") \
+ $(use_with singular singular "${EPREFIX}/usr") \
+ ${myconf} || die
+}
+
+src_install(){
+ emake -j1 DESTDIR="${D}" install
+}
+
+pkg_postinst(){
+ elog "Docs can be found on http://www.polymake.org/doku.php/documentation"
+ elog " "
+ elog "Support for jreality is missing, sorry (see bug #346073)."
+ elog " "
+ elog "Additional features for polymake are available through external"
+ elog "software such as sci-mathmatics/4ti2 and sci-mathematics/topcom."
+ elog "After installing new external software run 'polymake --reconfigure'."
+}
diff --git a/sci-mathematics/polymake/polymake-2.14.ebuild b/sci-mathematics/polymake/polymake-2.14.ebuild
new file mode 100644
index 000000000000..1e9a96a9749b
--- /dev/null
+++ b/sci-mathematics/polymake/polymake-2.14.ebuild
@@ -0,0 +1,59 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+inherit eutils flag-o-matic
+
+DESCRIPTION="research tool for polyhedral geometry and combinatorics"
+SRC_URI="http://polymake.org/lib/exe/fetch.php/download/${P}.tar.bz2"
+HOMEPAGE="http://polymake.org"
+
+IUSE="libpolymake"
+
+SLOT="0"
+LICENSE="GPL-2"
+KEYWORDS="~amd64 ~x86 ~amd64-linux ~x86-linux"
+
+DEPEND="dev-libs/gmp
+ dev-libs/boost
+ dev-libs/libxml2:2
+ dev-perl/XML-LibXML
+ dev-libs/libxslt
+ dev-perl/XML-LibXSLT
+ dev-perl/XML-Writer
+ dev-perl/Term-ReadLine-Gnu"
+RDEPEND="${DEPEND}"
+
+src_prepare() {
+ # Don't strip
+ sed -i '/system "strip $to"/d' support/install.pl || die
+
+ einfo "During compile this package uses up to"
+ einfo "750MB of RAM per process. Use MAKEOPTS=\"-j1\" if"
+ einfo "you run into trouble."
+}
+
+src_configure () {
+ export CXXOPT=$(get-flag -O)
+ # Configure does not accept --host, therefore econf cannot be used
+ ./configure --prefix="${EPREFIX}/usr" \
+ --without-java \
+ $(use_with libpolymake callable) \
+ --without-prereq \
+ --libdir="${EPREFIX}/usr/$(get_libdir)" \
+ --libexecdir="${EPREFIX}/usr/$(get_libdir)/polymake" \
+ "${myconf}" || die
+}
+
+src_install(){
+ emake -j1 DESTDIR="${D}" install
+ dosym libpolymake.so "${EPREFIX}/usr/$(get_libdir)/libpolymake.so.0"
+}
+
+pkg_postinst(){
+ elog "Docs can be found on http://www.polymake.org/doku.php/documentation"
+ elog " "
+ elog "Support for jreality is missing, sorry (see bug #346073)."
+}
diff --git a/sci-mathematics/prng/Manifest b/sci-mathematics/prng/Manifest
new file mode 100644
index 000000000000..53774578bc98
--- /dev/null
+++ b/sci-mathematics/prng/Manifest
@@ -0,0 +1 @@
+DIST prng-3.0.2.tar.gz 497047 SHA256 8299182b97c24b7891d74590a8a8438641a6c681ce34d6c3f7bc98a0649da48b SHA512 16addfedd16f1caf7489356770c15bde17d8ec5c66dca9fbaa52e50f850f2ab81a1af9d522bb6028ba5e279490beaf6c72060494e8a5367a7453a417a619367f WHIRLPOOL e23acec196e2fe9743ca083e2928db058c838e316581b8fcf041f83adc394bf92b5e19b8187caa2e02fca507808c00772dda651d310645396b8a76808197ad7f
diff --git a/sci-mathematics/prng/files/prng-3.0.2-shared.patch b/sci-mathematics/prng/files/prng-3.0.2-shared.patch
new file mode 100644
index 000000000000..c52929396c94
--- /dev/null
+++ b/sci-mathematics/prng/files/prng-3.0.2-shared.patch
@@ -0,0 +1,52 @@
+diff -Nur prng-3.0.2.orig/configure.ac prng-3.0.2/configure.ac
+--- prng-3.0.2.orig/configure.ac 2010-10-16 18:47:52.000000000 +0100
++++ prng-3.0.2/configure.ac 2010-10-16 18:49:16.000000000 +0100
+@@ -23,6 +23,7 @@
+ AC_PROG_RANLIB
+ AC_PROG_INSTALL
+ AC_PROG_LN_S
++AC_PROG_LIBTOOL
+
+ dnl Checks for typedefs, structures, and compiler characteristics.
+ AC_C_CONST
+@@ -39,6 +40,8 @@
+ dnl Checks for library functions.
+ AC_CHECK_FUNCS(strtoul)
+
++AC_CHECK_LIB([m], [pow])
++
+ dnl Set flags for compiler
+ if test X"$GCC" = Xyes ; then
+ AC_SUBST(AM_CFLAGS,"-Wall -fomit-frame-pointer")
+diff -Nur prng-3.0.2.orig/examples/Makefile.am prng-3.0.2/examples/Makefile.am
+--- prng-3.0.2.orig/examples/Makefile.am 2010-10-16 18:47:52.000000000 +0100
++++ prng-3.0.2/examples/Makefile.am 2010-10-16 18:48:08.000000000 +0100
+@@ -1,11 +1,11 @@
+ ## Process this file with automake to produce Makefile.in
+ # $Id$
+
+-LDADD = $(top_builddir)/src/libprng.a -lm
++LDADD = $(top_builddir)/src/libprng.la -lm
+
+ INCLUDES = -I$(top_srcdir)/src
+
+-noinst_PROGRAMS = pairs tuples
++check_PROGRAMS = pairs tuples
+
+ # clean backup files
+ CLEANFILES = *~
+diff -Nur prng-3.0.2.orig/src/Makefile.am prng-3.0.2/src/Makefile.am
+--- prng-3.0.2.orig/src/Makefile.am 2010-10-16 18:47:52.000000000 +0100
++++ prng-3.0.2/src/Makefile.am 2010-10-16 18:48:08.000000000 +0100
+@@ -3,9 +3,9 @@
+
+ INCLUDES =
+
+-lib_LIBRARIES = libprng.a
++lib_LTLIBRARIES = libprng.la
+
+-libprng_a_SOURCES = \
++libprng_la_SOURCES = \
+ prng.c \
+ dicg.c \
+ eicg.c \
diff --git a/sci-mathematics/prng/metadata.xml b/sci-mathematics/prng/metadata.xml
new file mode 100644
index 000000000000..49b2825cfbec
--- /dev/null
+++ b/sci-mathematics/prng/metadata.xml
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <herd>sci-mathematics</herd>
+ <longdescription lang="en">
+ The Pseudo-Random Number Generator library is a portable,
+ high-performance ANSI-C implementations of pseudorandom number
+ generators such as linear congruential, inversive congruential, and
+ explicit inversive congruential random number generators (called
+ LCG, ICG and EICG, respectively) created by Otmar Lendl. It is part
+ of the pLab project.
+</longdescription>
+</pkgmetadata>
diff --git a/sci-mathematics/prng/prng-3.0.2.ebuild b/sci-mathematics/prng/prng-3.0.2.ebuild
new file mode 100644
index 000000000000..9b4c2dc16cde
--- /dev/null
+++ b/sci-mathematics/prng/prng-3.0.2.ebuild
@@ -0,0 +1,30 @@
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=4
+
+AUTOTOOLS_AUTORECONF=yes
+
+inherit autotools-utils
+
+DESCRIPTION="Pseudo-Random Number Generator library"
+HOMEPAGE="http://statmath.wu.ac.at/prng/"
+SRC_URI="${HOMEPAGE}${P}.tar.gz"
+
+LICENSE="GPL-2"
+SLOT=0
+KEYWORDS="amd64 x86 ~amd64-linux ~x86-linux"
+IUSE="doc examples static-libs"
+
+PATCHES=( "${FILESDIR}"/${P}-shared.patch )
+
+src_install() {
+ autotools-utils_src_install
+ use doc && dodoc doc/${PN}.pdf
+ if use examples; then
+ rm examples/Makefile*
+ insinto /usr/share/doc/${PF}
+ doins -r examples
+ fi
+}
diff --git a/sci-mathematics/prover9/Manifest b/sci-mathematics/prover9/Manifest
new file mode 100644
index 000000000000..f791dc6bd655
--- /dev/null
+++ b/sci-mathematics/prover9/Manifest
@@ -0,0 +1,2 @@
+DIST LADR-2009-11A-makefile.patch.xz 4300 SHA256 7340ec2ce439a6ed039d7077a417ca5d81ad3acce0b174e96469e8ebad274adf SHA512 c1d2e27d991036af24a29deb4401fbf9687415d2a37bebabb9cfc77d8672e0804d974f92cbd7b8e16c0a0c10b75831847f7b8ddb94244d7e632de7b1be5081f1 WHIRLPOOL 15401ed0b9edafb3841bed7c1c270d8a38544470abf87abd9b70b9eb0aa194d7296146e88b797a568aff7e557a118bfc2ee40d5a5c8ae6a426902db51e11c0ae
+DIST LADR-2009-11A.tar.gz 1795750 SHA256 c32bed5807000c0b7161c276e50d9ca0af0cb248df2c1affb2f6fc02471b51d0 SHA512 f26d3713eb2ba809fb3d55ce179e9d91555ab9166e075aa0843bafe57ce00f153cfed178b61993d4fd471655840e4f40775d75dac9fb5242a67e5d59c970dfc7 WHIRLPOOL 6e6abd1a5c7bfc988fb693eeea08bdfba77c9badea3d4a77764efcb9ee16c36b372241fbf4d4dead911cabf9a03721988f334977379da47d04b4320bae257fad
diff --git a/sci-mathematics/prover9/files/LADR-2009-11A-manpages.patch b/sci-mathematics/prover9/files/LADR-2009-11A-manpages.patch
new file mode 100644
index 000000000000..6e2324a6a390
--- /dev/null
+++ b/sci-mathematics/prover9/files/LADR-2009-11A-manpages.patch
@@ -0,0 +1,466 @@
+--- /dev/null 2012-01-07 09:10:22.797165727 +1100
++++ LADR-2009-11A/manpages/clausefilter.1 2012-01-07 19:30:44.311801364 +1100
+@@ -0,0 +1,43 @@
++.TH CLAUSEFILTER 1 "January 20, 2007"
++.SH NAME
++clausefilter - filter formulas with models
++.SH SYNOPSIS
++.B clausefilter
++.RI < interpretations-file >
++.RI < test >
++<
++.RI < formulas-file >
++>
++.RI < passing-formulas-file >
++.SH DESCRIPTION
++This manual page documents briefly the
++.B clausefilter
++command.
++.PP
++Given a set of \fIinterpretations\fP, a \fItest\fP to perform, and a
++stream of \fIformulas\fP, \fBclausefilter\fP outputs the formulas
++that pass the test.
++.SH TESTS
++The following tests are available.
++.TP
++.B true_in_all
++Formula true in all interpretations.
++.TP
++.B true_in_some
++Formula true in some interpretation.
++.TP
++.B false_in_all
++Formula false in all interpretations.
++.TP
++.B false_in_some
++Formula false in some interpretation.
++.SH SEE ALSO
++.BR prover9 (1),
++.BR mace4 (1).
++.br
++Full documentation for \fBclausefilter\fP is found in the \fBprover9\fP manual, available on Gentoo systems at \fI/usr/share/doc/prover9-2009.11a/html/index.html\fP.
++.SH AUTHOR
++\fBclausefilter\fP was written by William McCune <mccune@cs.unm.edu>
++.PP
++This manual page was written by Peter Collingbourne <pcc03@doc.ic.ac.uk>,
++for the Debian project (but may be used by others).
+--- /dev/null 2012-01-07 09:10:22.797165727 +1100
++++ LADR-2009-11A/manpages/clausetester.1 2012-01-07 19:30:44.312801386 +1100
+@@ -0,0 +1,29 @@
++.TH CLAUSETESTER 1 "January 20, 2007"
++.SH NAME
++clausetester - check formulas in models
++.SH SYNOPSIS
++.B clausetester
++.RI < interpretations-file >
++<
++.RI < formulas-file >
++>
++.RI < annotated-formulas-file >
++.SH DESCRIPTION
++This manual page documents briefly the
++.B clausetester
++command.
++.PP
++This program takes a set of \fIinterpretations\fP and stream of
++\fIformulas\fP. For each formula, the interpretations in which the
++formula is true are shown, and at the end the number of formulas true
++in each interpretation is shown.
++.SH SEE ALSO
++.BR prover9 (1),
++.BR mace4 (1).
++.br
++Full documentation for \fBclausetester\fP is found in the \fBprover9\fP manual, available on Gentoo systems at \fI/usr/share/doc/prover9-2009.11a/html/index.html\fP.
++.SH AUTHOR
++\fBclausetester\fP was written by William McCune <mccune@cs.unm.edu>
++.PP
++This manual page was written by Peter Collingbourne <pcc03@doc.ic.ac.uk>,
++for the Debian project (but may be used by others).
+--- /dev/null 2012-01-07 09:10:22.797165727 +1100
++++ LADR-2009-11A/manpages/interpfilter.1 2012-01-07 19:30:44.312801386 +1100
+@@ -0,0 +1,43 @@
++.TH INTERPFILTER 1 "January 20, 2007"
++.SH NAME
++interpfilter - filter models with formulas
++.SH SYNOPSIS
++.B interpfilter
++.RI < formulas-file >
++.RI < test >
++<
++.RI < interpretations-file >
++>
++.RI < passing-interpretations-file >
++.SH DESCRIPTION
++This manual page documents briefly the
++.B interpfilter
++command.
++.PP
++Given a set of \fIformulas\fP, a \fItest\fP to perform, and a
++stream of \fIinterpretations\fP, \fBinterpfilter\fP outputs the interpretations
++that pass the test.
++.SH TESTS
++The following tests are available.
++.TP
++.B all_true
++All formulas true in given interpretation.
++.TP
++.B some_true
++Some formula true in given interpretation.
++.TP
++.B all_false
++All formulas false in given interpretation.
++.TP
++.B some_false
++Some formula false in given interpretation.
++.SH SEE ALSO
++.BR prover9 (1),
++.BR mace4 (1).
++.br
++Full documentation for \fBinterpfilter\fP is found in the \fBprover9\fP manual, available on Gentoo systems at \fI/usr/share/doc/prover9-2009.11a/html/index.html\fP.
++.SH AUTHOR
++\fBinterpfilter\fP was written by William McCune <mccune@cs.unm.edu>
++.PP
++This manual page was written by Peter Collingbourne <pcc03@doc.ic.ac.uk>,
++for the Debian project (but may be used by others).
+--- /dev/null 2012-01-07 09:10:22.797165727 +1100
++++ LADR-2009-11A/manpages/interpformat.1 2012-01-07 19:30:44.313801403 +1100
+@@ -0,0 +1,65 @@
++.TH INTERPFORMAT 1 "January 20, 2007"
++.SH NAME
++interpformat \- tool for transforming
++.BR mace4 (1)
++models
++.SH SYNOPSIS
++.B interpformat
++.RI [ options ]
++.RI < transformation >
++\-f
++.I input-file
++>
++.I output-file
++.br
++.B interpformat
++.RI [ options ]
++.RI < transformation >
++<
++.I input-file
++>
++.I output-file
++.SH DESCRIPTION
++The models (structures) in
++.BR mace4 (1)
++output files can be transformed in various ways with the program \fBinterpformat\fP.
++.SH TRANSFORMATIONS
++The transformations are listed here.
++.TP
++.B standard
++one line per operation
++.TP
++.B standard2
++standard, with binary operations in a square (default)
++.TP
++.B portable
++list of lists, suitable for parsing by Python, GAP, etc.
++.TP
++.B tabular
++as nice tables
++.TP
++.B raw
++similar to standard, but without punctuation
++.TP
++.B cooked
++as terms, e.g., f(0,1)=2
++.TP
++.B tex
++formatted for LaTeX
++.TP
++.B xml
++XML
++.SH OPTIONS
++A summary of options is included below.
++.TP
++.B output \fI<operations>
++Output only the listed \fIoperations\fP.
++.SH SEE ALSO
++.BR mace4 (1).
++.br
++Full documentation for \fBinterpformat\fP is found in the \fBprover9\fP manual, available on Gentoo systems at \fI/usr/share/doc/prover9-2009.11a/html/index.html\fP.
++.SH AUTHOR
++\fBinterpformat\fP was written by William McCune <mccune@cs.unm.edu>
++.PP
++This manual page was written by Peter Collingbourne <pcc03@doc.ic.ac.uk>,
++for the Debian project (but may be used by others).
+--- /dev/null 2012-01-07 09:10:22.797165727 +1100
++++ LADR-2009-11A/manpages/isofilter.1 2012-01-07 19:30:44.313801403 +1100
+@@ -0,0 +1,65 @@
++.TH ISOFILTER 1 "January 20, 2007"
++.SH NAME
++isofilter - removes isomorphic structures from
++.BR mace4 (1)
++models
++.SH SYNOPSIS
++.B isofilter
++.RI [ options ]
++<
++.I input-file
++>
++.I output-file
++.br
++.B isofilter0
++.RI [ options ]
++<
++.I input-file
++>
++.I output-file
++.br
++.B isofilter2
++.RI [ options ]
++<
++.I input-file
++>
++.I output-file
++.SH DESCRIPTION
++This manual page documents briefly the \fBisofilter\fP, \fBisofilter0\fP and \fBisofilter2\fP commands.
++.PP
++If
++.BR mace4 (1)
++produces more than one structure, some of them are very likely to be
++isomorphic to others. The program \fBisofilter\fP can be used to remove isomorphic
++structures.
++.SH ALGORITHM
++There are multiple \fBisofilter\fP variants providing alternative algorithms.
++.TP
++.B isofilter
++Uses Occurrence Profiles algorithm.
++.TP
++.B isofilter2
++Uses Canonical Forms algorithm.
++.SH OPTIONS
++A summary of options is included below.
++.TP
++.B ignore_constants
++Ignore all constants during the isomorphism tests.
++.TP
++.B check \fI<operations>
++Consider only the listed \fIoperations\fP in the isomorphism tests.
++.TP
++.B output \fI<operations>
++Output only the listed \fIoperations\fP.
++.TP
++.B wrap
++Enclose the resulting structures in \fBlist(interpretations). ... end_of_list.\fP
++.SH SEE ALSO
++.BR mace4 (1).
++.br
++Full documentation for \fBisofilter\fP is found in the \fBprover9\fP manual, available on Gentoo systems at \fI/usr/share/doc/prover9-2009.11a/html/index.html\fP.
++.SH AUTHOR
++\fBisofilter\fP was written by William McCune <mccune@cs.unm.edu>
++.PP
++This manual page was written by Peter Collingbourne <pcc03@doc.ic.ac.uk>,
++for the Debian project (but may be used by others).
+--- LADR-2009-11A-orig/manpages/mace4.1 2007-12-31 15:43:54.000000000 +1100
++++ LADR-2009-11A/manpages/mace4.1 2012-01-07 19:55:18.746508266 +1100
+@@ -76,11 +76,11 @@
+ .SH SEE ALSO
+ .BR prover9 (1).
+ .br
+-Full documentation for \fBmace4\fP is found in the \fBprover9\fP manual, available on Debian systems in the \fIprover9-doc\fP package at \fI/usr/share/doc/prover9-doc/manual/index.html\fP.
++Full documentation for \fBmace4\fP is found in the \fBprover9\fP manual, available on Gentoo systems at \fI/usr/share/doc/prover9-2009.11a/html/index.html\fP.
+ .br
+ The original \fBmace4\fP manual, which can be downloaded at http://www.cs.unm.edu/~mccune/prover9/mace4.pdf
+ .SH AUTHOR
+-\fBmace4\fP ws written by William McCune <mccune@cs.unm.edu>
++\fBmace4\fP was written by William McCune <mccune@cs.unm.edu>
+ .PP
+ This manual page was written by Peter Collingbourne <pcc03@doc.ic.ac.uk>,
+ for the Debian project (but may be used by others).
+--- /dev/null 2012-01-07 09:10:22.797165727 +1100
++++ LADR-2009-11A/manpages/prooftrans.1 2012-01-07 19:30:44.314801424 +1100
+@@ -0,0 +1,73 @@
++.TH PROOFTRANS 1 "January 20, 2007"
++.SH NAME
++prooftrans - tool for transforming Prover9 proofs
++.SH SYNOPSIS
++.B prooftrans
++.RI [ parents_only ]
++.RI [ expand ]
++.RI [ renumber ]
++.RI [ striplabels ]
++[\fI-f file\fP]
++.br
++.B prooftrans
++xml
++.RI [ expand ]
++.RI [ renumber ]
++.RI [ striplabels ]
++[\fI-f file\fP]
++.br
++.B prooftrans
++ivy
++.RI [ renumber ]
++[\fI-f file\fP]
++.br
++.B prooftrans
++hints
++[\fI-label label\fP]
++.RI [ expand ]
++.RI [ striplabels ]
++[\fI-f file\fP]
++.SH DESCRIPTION
++This manual page documents briefly the
++.B prooftrans
++command.
++.PP
++\fBprooftrans\fP can extract proofs from
++.BR prover9 (1)
++output files and transform them in various ways.
++
++.SH OPTIONS
++A summary of options is included below.
++.TP
++.B renumber
++Renumber steps.
++.TP
++.B parents_only
++Simplify justifications by listing only parents.
++.TP
++.B expand
++Expand all steps, turning secondary justifications into explicit steps.
++.TP
++.B xml
++Produce proofs in XML.
++.TP
++.B ivy
++Produce proofs for checking by the IVY proof checker.
++.TP
++.B hints
++Produce hints for guiding subsequent searches.
++.TP
++.B \-label \fIlabel\fP
++Attach label attributes to the hint clauses consisting of the string \fIlabel\fP and a sequence number generated by prooftrans.
++.TP
++.B \-f \fIfile
++Take input from \fIfile\fP instead of from standard input.
++.SH SEE ALSO
++.BR prover9 (1).
++.br
++Full documentation for \fBprooftrans\fP is found in the \fBprover9\fP manual, available on Gentoo systems at \fI/usr/share/doc/prover9-2009.11a/html/index.html\fP.
++.SH AUTHOR
++\fBprooftrans\fP was written by William McCune <mccune@cs.unm.edu>
++.PP
++This manual page was written by Peter Collingbourne <pcc03@doc.ic.ac.uk>,
++for the Debian project (but may be used by others).
+--- LADR-2009-11A-orig/manpages/prover9.1 2007-12-31 15:43:54.000000000 +1100
++++ LADR-2009-11A/manpages/prover9.1 2012-01-07 19:54:30.928968388 +1100
+@@ -11,7 +11,7 @@
+ .br
+ .B prover9
+ .RI [ options ]
+--f
++\-f
+ .I input-file
+ >
+ .I output-file
+@@ -38,15 +38,15 @@
+ .B \-t \fIn
+ Constrain the search to last about \fIn\fP seconds. For UNIX-like systems, the `user CPU' time is used.
+ .TP
+-.B \-f \fIfiles
+-Take input from \fIfiles\fP instead of from standard input.
++.B \-f \fIfile
++Take input from \fIfile\fP instead of from standard input.
+ .SH SEE ALSO
+ .BR mace4 (1),
+ .BR otter (1).
+ .br
+-On Debian systems, the manual is found in the \fIprover9-doc\fP package, at \fI/usr/share/doc/prover9-doc/manual/index.html\fP.
++On Gentoo systems, the manual is found at \fI/usr/share/doc/prover9-2009.11a/html/index.html\fP.
+ .SH AUTHOR
+-\fBprover9\fP ws written by William McCune <mccune@cs.unm.edu>
++\fBprover9\fP was written by William McCune <mccune@cs.unm.edu>
+ .PP
+ This manual page was written by Peter Collingbourne <pcc03@doc.ic.ac.uk>,
+ for the Debian project (but may be used by others).
+--- /dev/null 2012-01-07 09:10:22.797165727 +1100
++++ LADR-2009-11A/manpages/prover9-apps.1 2012-01-07 19:30:44.315801449 +1100
+@@ -0,0 +1,17 @@
++.TH PROVER9-APPS 1 "June 18, 2008"
++.SH NAME
++prover9-apps \- undocumented Prover9 applications
++.SH DESCRIPTION
++Some programs in the \fBprover9-apps\fP package currently have no manual
++pages. You can obtain documentation on some of these applications via the
++\fBprover9\fP manual, which is available
++at \fI/usr/share/doc/prover9-2009.11a/html/index.html\fP.
++Alternatively invoking the application with the \fB-help\fP option may
++produce documentation. Patches to add manual pages are welcome, and may
++be sent to the Debian package maintainer, whose details are listed below.
++.SH AUTHOR
++The applications were written by William McCune <mccune@cs.unm.edu>.
++.PP
++This manual page was written by Peter Collingbourne <pcc03@doc.ic.ac.uk>,
++for the Debian project (but may be used by others) and modified for Fedora
++by Tim Colles <timc@inf.ed.ac.uk>.
+--- /dev/null 2012-01-07 09:10:22.797165727 +1100
++++ LADR-2009-11A/manpages/rewriter.1 2012-01-07 19:30:44.315801449 +1100
+@@ -0,0 +1,60 @@
++.de Sp \" Vertical space (when we can't use .PP)
++.if t .sp .5v
++.if n .sp
++..
++.de Vb \" Begin verbatim text
++.ft CW
++.nf
++.ne \\$1
++..
++.de Ve \" End verbatim text
++.ft R
++.fi
++..
++.TH REWRITER 1 "January 20, 2007"
++.SH NAME
++rewriter - demodulate terms
++.SH SYNOPSIS
++.B rewriter
++.RI < demodulators-file >
++<
++.RI < terms-file >
++>
++.RI < rewritten-terms-file >
++.SH DESCRIPTION
++This manual page documents briefly the
++.B rewriter
++command.
++.PP
++Rewrite a stream of \fIterms\fP with a list of \fIdemodulators\fP. The
++demodulators are used left-to-right as given, and they are not checked
++for termination.
++.SH SYNTAX
++The file of demodulators contains optional commands
++then a list of demodulators. The commands can be used to
++declare infix operations and associativity/commutativity.
++Example file of demodulators:
++.Sp
++.Vb 10
++\& op(400, infix, ^).
++\& op(400, infix, v).
++\& assoc_comm(^).
++\& assoc_comm(v).
++\& formulas(demodulators).
++\& x ^ x = x.
++\& x ^ (x v y) = x.
++\& x v x = x.
++\& x v (x ^ y) = x.
++\& end_of_list.
++.Ve
++.Sp
++.SH SEE ALSO
++.BR prover9 (1),
++.BR mace4 (1).
++.br
++Full documentation for \fBrewriter\fP is found in the \fBprover9\fP manual, available on Gentoo systems at \fI/usr/share/doc/prover9-2009.11a/html/index.html\fP.
++.SH AUTHOR
++\fBrewriter\fP was written by William McCune <mccune@cs.unm.edu>
++.PP
++This manual page was written by Peter Collingbourne <pcc03@doc.ic.ac.uk>,
++for the Debian project (but may be used by others).
diff --git a/sci-mathematics/prover9/metadata.xml b/sci-mathematics/prover9/metadata.xml
new file mode 100644
index 000000000000..719fd32dcf90
--- /dev/null
+++ b/sci-mathematics/prover9/metadata.xml
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <maintainer>
+ <email>gienah@gentoo.org</email>
+ <name>Mark Wright</name>
+ </maintainer>
+ <herd>sci-mathematics</herd>
+ <longdescription lang="en">
+ Prover9 and Mace4 Prover9 is an automated theorem prover for
+ first-order and equational logic, and Mace4 searches for finite
+ models and counterexamples. Prover9 is the successor of the
+ Otter prover.
+</longdescription>
+</pkgmetadata>
diff --git a/sci-mathematics/prover9/prover9-2009.11a.ebuild b/sci-mathematics/prover9/prover9-2009.11a.ebuild
new file mode 100644
index 000000000000..5a45978b0ebe
--- /dev/null
+++ b/sci-mathematics/prover9/prover9-2009.11a.ebuild
@@ -0,0 +1,120 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+inherit eutils toolchain-funcs versionator
+
+MY_PN="LADR"
+typeset -u MY_PV
+MY_PV=$(replace_all_version_separators '-')
+MY_P="${MY_PN}-${MY_PV}"
+
+DESCRIPTION="Automated theorem prover for first-order and equational logic"
+HOMEPAGE="http://www.cs.unm.edu/~mccune/mace4/"
+SRC_URI="
+ http://www.cs.unm.edu/~mccune/mace4/download/${MY_P}.tar.gz
+ http://dev.gentoo.org/~jlec/distfiles/${MY_PN}-2009-11A-makefile.patch.xz"
+
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+LICENSE="GPL-2"
+IUSE="examples"
+
+PATCHES=(
+ "${WORKDIR}"/${MY_PN}-2009-11A-makefile.patch
+ "${FILESDIR}"/${MY_PN}-2009-11A-manpages.patch
+ )
+
+S="${WORKDIR}/${MY_P}/"
+
+src_prepare() {
+ MAKEOPTS+=" -j1"
+ epatch ${PATCHES[@]}
+ sed \
+ -e "/^CC =/s:gcc:$(tc-getCC):g" \
+ -i */Makefile || die
+}
+
+src_compile() {
+ emake all
+}
+
+src_install () {
+ dobin \
+ bin/attack \
+ bin/autosketches4 \
+ bin/clausefilter \
+ bin/clausetester \
+ bin/complex \
+ bin/directproof \
+ bin/dprofiles \
+ bin/fof-prover9 \
+ bin/gen_trc_defs \
+ bin/get_givens \
+ bin/get_interps \
+ bin/get_kept \
+ bin/gvizify \
+ bin/idfilter \
+ bin/interpfilter \
+ bin/interpformat \
+ bin/isofilter \
+ bin/isofilter0 \
+ bin/isofilter2 \
+ bin/ladr_to_tptp \
+ bin/latfilter \
+ bin/looper \
+ bin/mace4 \
+ bin/miniscope \
+ bin/mirror-flip \
+ bin/newauto \
+ bin/newsax \
+ bin/olfilter \
+ bin/perm3 \
+ bin/proof3fo.xsl \
+ bin/prooftrans \
+ bin/prover9 \
+ bin/renamer \
+ bin/rewriter \
+ bin/sigtest \
+ bin/test_clause_eval \
+ bin/test_complex \
+ bin/tptp_to_ladr \
+ bin/unfast \
+ bin/upper-covers
+
+ doman \
+ manpages/interpformat.1 \
+ manpages/isofilter.1 \
+ manpages/prooftrans.1 \
+ manpages/mace4.1 \
+ manpages/prover9.1 \
+ manpages/clausefilter.1 \
+ manpages/clausetester.1 \
+ manpages/interpfilter.1 \
+ manpages/rewriter.1 \
+ manpages/prover9-apps.1
+
+ dohtml ladr/index.html.master ladr/html/*
+
+ insinto /usr/$(get_libdir)
+ dolib.so ladr/.libs/libladr.so.4.0.0
+
+ dosym libladr.so.4.0.0 /usr/$(get_libdir)/libladr.so.4
+ dosym libladr.so.4.0.0 /usr/$(get_libdir)/libladr.so
+
+ dodir /usr/include/ladr
+ insinto /usr/include/ladr
+ doins ladr/*.h
+
+ if use examples; then
+ insinto /usr/share/${PN}/examples
+ doins prover9.examples/*
+
+ # The prover9-mace4 script is installed as an example script
+ # to avoid confusion with the GUI sci-mathematics/p9m4 prover9mace4.py
+ insinto /usr/share/${PN}/scripts
+ doins bin/prover9-mace4
+ fi
+}
diff --git a/sci-mathematics/pspp/Manifest b/sci-mathematics/pspp/Manifest
new file mode 100644
index 000000000000..2ba1ccf2655b
--- /dev/null
+++ b/sci-mathematics/pspp/Manifest
@@ -0,0 +1,2 @@
+DIST pspp-0.8.1.tar.gz 6514528 SHA256 fd48145d2ff77c39f624e26bf3c9a5623c2afaee7c040675b06cb4ce57d31d62 SHA512 2df758b3a2d8eba724d84ce7d77a6c0bbe469a11b86a8eb4227ec12a4957f468e74b3af0f81c953d87403a962937eef2680979a21ceba4fe8b93b55252b84a18 WHIRLPOOL 5be6ebcecffc3d8a7da669ea49028307b784a5b8b5d8a510d0f9e82a3740800966da5390f8abc120b55c9c621850be906f7610f86404b92c994d9a72697d413d
+DIST pspp-0.8.3.tar.gz 6247760 SHA256 adb8de281098b0d8632a8f2ea2af6514100786cf946f07a3c268d4baff15316f SHA512 7645a2de09ed1d6f1a53900961791b64b9420f457278d19e62ca7dabdb02b01ee78cdab0efddae384dc7deff65f7c5256227538caed89537efa014437937a61c WHIRLPOOL cff5921acce8bb3654ab0d10d63c42af8d5a9745263f423900ee290a30f1748aff023739ba49fabca33517e3deaf3fb0513a5fac7d0cf50170ba4b870d0ededf
diff --git a/sci-mathematics/pspp/files/50pspp-gentoo.el b/sci-mathematics/pspp/files/50pspp-gentoo.el
new file mode 100644
index 000000000000..adac2e8ed1da
--- /dev/null
+++ b/sci-mathematics/pspp/files/50pspp-gentoo.el
@@ -0,0 +1,6 @@
+
+;;; pspp site-lisp configuration
+
+(add-to-list 'load-path "@SITELISP@")
+(autoload 'pspp-mode "pspp-mode" nil t)
+(add-to-list 'auto-mode-alist '("\\.sps\\'" . pspp-mode))
diff --git a/sci-mathematics/pspp/files/pspp-0.8.0-gettext.patch b/sci-mathematics/pspp/files/pspp-0.8.0-gettext.patch
new file mode 100644
index 000000000000..73fb8dc8790a
--- /dev/null
+++ b/sci-mathematics/pspp/files/pspp-0.8.0-gettext.patch
@@ -0,0 +1,10 @@
+--- configure.ac.orig 2013-08-06 10:18:37.329909242 -0700
++++ configure.ac 2013-08-06 10:18:51.011975942 -0700
+@@ -30,6 +30,7 @@
+
+ dnl Disable automatic po/ support, because PSPP provides its own po/ support.
+ AC_PROVIDE([AM_PO_SUBDIRS])
++AM_GNU_GETTEXT_VERSION([0.17])
+ AM_GNU_GETTEXT([external], [need-ngettext])
+ LIBS="$LIBINTL $LIBS"
+
diff --git a/sci-mathematics/pspp/files/pspp-0.8.1-oos.patch b/sci-mathematics/pspp/files/pspp-0.8.1-oos.patch
new file mode 100644
index 000000000000..51612b993abd
--- /dev/null
+++ b/sci-mathematics/pspp/files/pspp-0.8.1-oos.patch
@@ -0,0 +1,28 @@
+ src/ui/gui/automake.mk | 8 ++++----
+ 1 file changed, 4 insertions(+), 4 deletions(-)
+
+diff --git a/src/ui/gui/automake.mk b/src/ui/gui/automake.mk
+index 47a3215..24f5b0b 100644
+--- a/src/ui/gui/automake.mk
++++ b/src/ui/gui/automake.mk
+@@ -333,16 +333,16 @@ PHONY += yelp-check
+ AM_CPPFLAGS += -Isrc
+
+ src/ui/gui/pspp.desktop: src/ui/gui/gen-dot-desktop.sh $(POFILES)
+- POFILES="$(POFILES)" top_builddir="$(top_builddir)" $(SHELL) $< > $@
++ POFILES="$(POFILES)" top_builddir="$(top_builddir)" $(SHELL) $< > ${top_srcdir}/$@
+
+ CLEANFILES+=src/ui/gui/pspp.desktop
+
+ src/ui/gui/psppire-marshal.c: src/ui/gui/marshaller-list
+- echo '#include <config.h>' > $@
+- $(GLIB_GENMARSHAL) --body --prefix=psppire_marshal $? >> $@
++ echo '#include <config.h>' > ${top_srcdir}/$@
++ $(GLIB_GENMARSHAL) --body --prefix=psppire_marshal $? >> ${top_srcdir}/$@
+
+ src/ui/gui/psppire-marshal.h: src/ui/gui/marshaller-list
+- $(GLIB_GENMARSHAL) --header --prefix=psppire_marshal $? > $@
++ $(GLIB_GENMARSHAL) --header --prefix=psppire_marshal $? > ${top_srcdir}/$@
+
+ desktopdir = $(datadir)/applications
+ desktop_DATA = src/ui/gui/pspp.desktop
diff --git a/sci-mathematics/pspp/files/pspp-0.8.1-underlinking.patch b/sci-mathematics/pspp/files/pspp-0.8.1-underlinking.patch
new file mode 100644
index 000000000000..2c533ee49658
--- /dev/null
+++ b/sci-mathematics/pspp/files/pspp-0.8.1-underlinking.patch
@@ -0,0 +1,29 @@
+ src/automake.mk | 5 +++--
+ 1 file changed, 3 insertions(+), 2 deletions(-)
+
+diff --git a/src/automake.mk b/src/automake.mk
+index 73ff813..8524000 100644
+--- a/src/automake.mk
++++ b/src/automake.mk
+@@ -20,7 +20,7 @@ src_libpspp_core_la_LIBADD = \
+ src/data/libdata.la \
+ src/libpspp/liblibpspp.la \
+ $(LIBXML2_LIBS) $(PG_LIBS) \
+- gl/libgl.la
++ gl/libgl.la $(CAIRO_LIBS)
+
+ src_libpspp_la_SOURCES =
+
+@@ -28,10 +28,11 @@ src_libpspp_la_CFLAGS = $(GSL_CFLAGS)
+ src_libpspp_la_LDFLAGS = -release $(VERSION)
+
+ src_libpspp_la_LIBADD = \
++ src/libpspp-core.la \
+ src/language/liblanguage.la \
+ src/math/libpspp-math.la \
+ src/output/liboutput.la \
+- $(GSL_LIBS)
++ $(GSL_LIBS) $(CAIRO_LIBS) $(LIBXML2_LIBS)
+
+ include $(top_srcdir)/src/math/automake.mk
+ include $(top_srcdir)/src/output/automake.mk
diff --git a/sci-mathematics/pspp/metadata.xml b/sci-mathematics/pspp/metadata.xml
new file mode 100644
index 000000000000..d62366a4d9b2
--- /dev/null
+++ b/sci-mathematics/pspp/metadata.xml
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <herd>sci-mathematics</herd>
+ <longdescription lang="en">
+ PSPP is a program for statistical analysis of sampled data. It
+ interprets commands in the SPSS language and produces tabular and
+ graphical output in ASCII, HTML, or PostScript format.
+ PSPP supports a large subset of SPSS's transformation language. Its
+ statistical procedure support is limited but growing.
+ PSPP has both text-based and a GTK+ based graphical user interfaces.
+</longdescription>
+</pkgmetadata>
diff --git a/sci-mathematics/pspp/pspp-0.8.1-r1.ebuild b/sci-mathematics/pspp/pspp-0.8.1-r1.ebuild
new file mode 100644
index 000000000000..ef3f0f8f3054
--- /dev/null
+++ b/sci-mathematics/pspp/pspp-0.8.1-r1.ebuild
@@ -0,0 +1,91 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+AUTOTOOLS_AUTORECONF=1
+
+inherit eutils elisp-common autotools-utils multilib
+
+DESCRIPTION="Program for statistical analysis of sampled data"
+HOMEPAGE="http://www.gnu.org/software/pspp/pspp.html"
+SRC_URI="mirror://gnu/${PN}/${P}.tar.gz"
+
+LICENSE="GPL-3"
+SLOT="0"
+KEYWORDS="~amd64 ~x86 ~amd64-linux ~x86-linux"
+IUSE="cairo doc emacs examples gtk ncurses nls perl postgres static-libs"
+
+RDEPEND="
+ dev-libs/libxml2:2
+ sci-libs/gsl
+ sys-devel/gettext
+ sys-libs/readline
+ sys-libs/zlib
+ virtual/libiconv
+ cairo? ( x11-libs/cairo )
+ emacs? ( virtual/emacs )
+ gtk? (
+ gnome-base/libglade:2.0
+ x11-libs/gtk+:2
+ >=x11-libs/gtksourceview-2.2:2.0 )
+ ncurses? ( sys-libs/ncurses )
+ postgres? ( dev-db/postgresql[server] )"
+DEPEND="${RDEPEND}
+ virtual/pkgconfig
+ doc? ( virtual/latex-base )"
+
+SITEFILE=50${PN}-gentoo.el
+
+PATCHES=(
+ "${FILESDIR}"/${PN}-0.8.0-gettext.patch
+ "${FILESDIR}"/${P}-underlinking.patch
+ "${FILESDIR}"/${P}-oos.patch
+)
+
+src_configure() {
+ local myeconfargs=(
+ --disable-rpath
+ $(use_enable nls)
+ $(use_with cairo)
+ $(use_with gtk gui)
+ $(use_with ncurses libncurses)
+ $(use_with perl perl-module)
+ $(use_with postgres libpq)
+ )
+ autotools-utils_src_configure
+}
+
+src_compile() {
+ autotools-utils_src_compile pkglibdir="${EPREFIX}/usr/$(get_libdir)"
+ use doc && autotools-utils_src_compile html pdf
+ use emacs && elisp-compile *.el
+}
+
+src_install() {
+ if use doc; then
+ HTML_DOCS=( "${BUILD_DIR}"/doc/pspp{,-dev}.html )
+ DOCS=( "${BUILD_DIR}"/doc/pspp{,-dev}.pdf )
+ fi
+
+ autotools-utils_src_install pkglibdir="${EPREFIX}/usr/$(get_libdir)"
+
+ if use examples; then
+ insinto /usr/share/doc/${PF}
+ doins -r examples
+ fi
+
+ if use emacs; then
+ elisp-install ${PN} *.el *.elc
+ elisp-site-file-install "${FILESDIR}/${SITEFILE}"
+ fi
+}
+
+pkg_postinst () {
+ use emacs && elisp-site-regen
+}
+
+pkg_postrm() {
+ use emacs && elisp-site-regen
+}
diff --git a/sci-mathematics/pspp/pspp-0.8.3.ebuild b/sci-mathematics/pspp/pspp-0.8.3.ebuild
new file mode 100644
index 000000000000..86461736cfc8
--- /dev/null
+++ b/sci-mathematics/pspp/pspp-0.8.3.ebuild
@@ -0,0 +1,90 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+AUTOTOOLS_AUTORECONF=1
+
+inherit eutils elisp-common autotools-utils multilib
+
+DESCRIPTION="Program for statistical analysis of sampled data"
+HOMEPAGE="http://www.gnu.org/software/pspp/pspp.html"
+SRC_URI="mirror://gnu/${PN}/${P}.tar.gz"
+
+LICENSE="GPL-3"
+SLOT="0/${PV}"
+KEYWORDS="~amd64 ~x86 ~amd64-linux ~x86-linux"
+IUSE="cairo doc emacs examples gtk ncurses nls perl postgres static-libs"
+
+RDEPEND="
+ dev-libs/libxml2:2=
+ sci-libs/gsl:0=
+ sys-devel/gettext:0=
+ sys-libs/readline:0=
+ sys-libs/zlib:0=
+ virtual/libiconv
+ cairo? ( x11-libs/cairo:0= )
+ emacs? ( virtual/emacs )
+ gtk? (
+ gnome-base/libglade:2.0
+ x11-libs/gtk+:2
+ >=x11-libs/gtksourceview-2.2:2.0 )
+ ncurses? ( sys-libs/ncurses )
+ postgres? ( dev-db/postgresql:=[server] )"
+DEPEND="${RDEPEND}
+ virtual/pkgconfig
+ doc? ( virtual/latex-base )"
+
+SITEFILE=50${PN}-gentoo.el
+
+PATCHES=(
+ "${FILESDIR}"/${PN}-0.8.0-gettext.patch
+ "${FILESDIR}"/${PN}-0.8.1-underlinking.patch
+ "${FILESDIR}"/${PN}-0.8.1-oos.patch
+)
+
+src_configure() {
+ local myeconfargs=(
+ $(use_enable nls)
+ $(use_with cairo)
+ $(use_with gtk gui)
+ $(use_with ncurses libncurses)
+ $(use_with perl perl-module)
+ $(use_with postgres libpq)
+ )
+ autotools-utils_src_configure
+}
+
+src_compile() {
+ autotools-utils_src_compile pkglibdir="${EPREFIX}/usr/$(get_libdir)"
+ use doc && autotools-utils_src_compile html pdf
+ use emacs && elisp-compile *.el
+}
+
+src_install() {
+ if use doc; then
+ HTML_DOCS=( "${BUILD_DIR}"/doc/pspp{,-dev}.html )
+ DOCS=( "${BUILD_DIR}"/doc/pspp{,-dev}.pdf )
+ fi
+
+ autotools-utils_src_install pkglibdir="${EPREFIX}/usr/$(get_libdir)"
+
+ if use examples; then
+ insinto /usr/share/doc/${PF}
+ doins -r examples
+ fi
+
+ if use emacs; then
+ elisp-install ${PN} *.el *.elc
+ elisp-site-file-install "${FILESDIR}/${SITEFILE}"
+ fi
+}
+
+pkg_postinst () {
+ use emacs && elisp-site-regen
+}
+
+pkg_postrm() {
+ use emacs && elisp-site-regen
+}
diff --git a/sci-mathematics/pymc/Manifest b/sci-mathematics/pymc/Manifest
new file mode 100644
index 000000000000..401575ac5a4b
--- /dev/null
+++ b/sci-mathematics/pymc/Manifest
@@ -0,0 +1 @@
+DIST pymc-2.2.tar.gz 13137644 SHA256 f618ebb9f075219b1aad5c06156f46fcd5ac543f391de4fa3752f311e9965278 SHA512 1fc44ec68f4a5b773d0705489810774e80c72c52dcfa601cf564737490fbf9e2f12696fb8bf6c706e0d157c3568f68b0b95f9a9846716a88c5a0f5c0ca706a96 WHIRLPOOL ec907b135e5d3bb2cbfb3158afbd8cf054abcdd81c6a11424a214646a471a08dc86e80423f299c5a152b8bd5356653399f5252f6ec06ec0ee87ab44f07a949ca
diff --git a/sci-mathematics/pymc/metadata.xml b/sci-mathematics/pymc/metadata.xml
new file mode 100644
index 000000000000..819dfe0bda55
--- /dev/null
+++ b/sci-mathematics/pymc/metadata.xml
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <maintainer>
+ <email>heroxbd@gentoo.org</email>
+ <name>Benda Xu</name>
+ </maintainer>
+ <longdescription lang="en">
+PyMC is a python module that implements Bayesian statistical models
+and fitting algorithms, including Markov chain Monte Carlo.
+</longdescription>
+ <upstream>
+ <remote-id type="github">pymc-devs/pymc</remote-id>
+ </upstream>
+</pkgmetadata>
diff --git a/sci-mathematics/pymc/pymc-2.2.ebuild b/sci-mathematics/pymc/pymc-2.2.ebuild
new file mode 100644
index 000000000000..9f72cae1f210
--- /dev/null
+++ b/sci-mathematics/pymc/pymc-2.2.ebuild
@@ -0,0 +1,24 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=4
+
+inherit distutils vcs-snapshot
+
+DESCRIPTION="Markov Chain Monte Carlo sampling toolkit"
+HOMEPAGE="http://github.com/${PN}-devs/${PN} http://pypi.python.org/pypi/${PN}"
+SRC_URI="http://github.com/${PN}-devs/${PN}/tarball/v${PV} -> ${P}.tar.gz"
+
+SLOT=0
+KEYWORDS="~amd64-linux ~x86-linux"
+LICENSE=AFL-3.0
+IUSE=""
+
+DEPEND="dev-python/setuptools
+ dev-python/pytables
+ dev-python/numpy"
+
+src_compile() {
+ distutils_src_compile --fcompiler=gnu95
+}
diff --git a/sci-mathematics/pymc/pymc-9999.ebuild b/sci-mathematics/pymc/pymc-9999.ebuild
new file mode 100644
index 000000000000..1702a1a18204
--- /dev/null
+++ b/sci-mathematics/pymc/pymc-9999.ebuild
@@ -0,0 +1,24 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=4
+
+inherit distutils git-2
+
+EGIT_REPO_URI="http://github.com/${PN}-devs/${PN}.git"
+DESCRIPTION="Markov chain Monte Carlo for Python"
+HOMEPAGE="http://github.com/${PN}-devs/${PN} http://pypi.python.org/pypi/${PN}"
+
+SLOT=0
+KEYWORDS=""
+LICENSE=AFL-3.0
+IUSE=""
+
+DEPEND="dev-python/setuptools
+ dev-python/pytables
+ dev-python/numpy"
+
+src_compile() {
+ distutils_src_compile --fcompiler=gnu95
+}
diff --git a/sci-mathematics/qtoctave/Manifest b/sci-mathematics/qtoctave/Manifest
new file mode 100644
index 000000000000..562118278f15
--- /dev/null
+++ b/sci-mathematics/qtoctave/Manifest
@@ -0,0 +1 @@
+DIST qtoctave-0.10.1.tar.gz 4215812 SHA256 4abd367924964887ea691f93c2c8ec90dcc64eb22827893dfb506ae43331b732 SHA512 b91e59ba9f16ebc2da9f2d606d0e7440d06e13cd6670fb7aa896eb30ad43835df74b7ba5127f1e9095c88de2468c6d2b2c174f1c5b1638678968bf81647b665f WHIRLPOOL fc5e3058bf18dcfe1f12315a37d07d4e80b76d6efaaf5c7f1b3622dd2ec6bb8277a76c19f45ce20a00a733db897ba839e23254c55b9cd41664d917a8c54bd097
diff --git a/sci-mathematics/qtoctave/files/qtoctave-0.10.1-build-out-of-source.patch b/sci-mathematics/qtoctave/files/qtoctave-0.10.1-build-out-of-source.patch
new file mode 100644
index 000000000000..e4e7ad9f6a69
--- /dev/null
+++ b/sci-mathematics/qtoctave/files/qtoctave-0.10.1-build-out-of-source.patch
@@ -0,0 +1,20 @@
+From: Thomas Weber <tweber@debian.org>
+Description: Remove configure.h to enable correct out-of-source builds
+ The file is included in the upstream tarball due to the way the release
+ tarball is generated.
+Forwarded: not-needed
+
+--- a/qtoctave/src/configure.h
++++ /dev/null
+@@ -1,11 +0,0 @@
+-
+-#ifndef __CONFIGURE_H__
+-#define __CONFIGURE_H__
+-#define CONFIG_PATH "/opt/qtoctave/share/qtoctave"
+-#define HELP_PATH "/opt/qtoctave/share/doc/octave-html/octave_doc/index.html"
+-#define ICON_PATH "/opt/qtoctave/share/qtoctave/images"
+-#define LANG_PATH "/opt/qtoctave/share/qtoctave/lang"
+-#define QTOCTAVE_HELP_PATH "/opt/qtoctave/share/doc/qtoctave/qtoctave_doc/index.html"
+-
+-#define PKG_CMD_PATH "/opt/qtoctave/share/qtoctave/pkg-commands.list"
+-#endif
diff --git a/sci-mathematics/qtoctave/files/qtoctave-0.10.1-build-widgetserver.patch b/sci-mathematics/qtoctave/files/qtoctave-0.10.1-build-widgetserver.patch
new file mode 100644
index 000000000000..17d92a61d5f2
--- /dev/null
+++ b/sci-mathematics/qtoctave/files/qtoctave-0.10.1-build-widgetserver.patch
@@ -0,0 +1,98 @@
+From: Jordi Gutiérrez Hermoso <jordigh@gmail.com>
+Subject: widgetserver wasn't included in newer CMake build, this fixes this
+Forwarded: http://lists.alioth.debian.org/pipermail/pkg-octave-devel/2010-June/007430.html
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -38,6 +38,7 @@
+
+ add_subdirectory (qtoctave_pkg/src)
+ add_subdirectory (xmlwidget/qt4)
++add_subdirectory (widgetserver)
+ add_subdirectory (easy_plot)
+ add_subdirectory (simple_rcs)
+ add_subdirectory (qtjs)
+--- /dev/null
++++ b/widgetserver/CMakeLists.txt
+@@ -0,0 +1,11 @@
++add_subdirectory(widgetserver)
++
++install(
++ DIRECTORY doc
++ DESTINATION share/doc/qtoctave-utils/widgetserver
++)
++
++install(
++ FILES "leeme.txt" "readme.txt"
++ DESTINATION share/doc/qtoctave-utils/widgetserver
++)
+--- /dev/null
++++ b/widgetserver/widgetserver/CMakeLists.txt
+@@ -0,0 +1,48 @@
++FIND_PACKAGE(Qt4 REQUIRED)
++
++MESSAGE (STATUS "Use file: ${QT_USE_FILE}")
++
++SET(QT_USE_QTXML 1)
++
++include(UseQt4)
++
++include_directories(${QT_INCLUDE_DIR})
++include_directories(${QT_QT_INCLUDE_DIR})
++include_directories(${QT_QTCORE_INCLUDE_DIR})
++include_directories(${QT_QTGUI_INCLUDE_DIR})
++include_directories(${QT_QTXML_INCLUDE_DIR})
++include_directories(${CMAKE_CURRENT_BINARY_DIR})
++include_directories(${QT_QTSCRIPT_INCLUDE_DIR})
++include_directories(${QT_QTUITOOLS_INCLUDE_DIR})
++
++FILE(GLOB widgetserver_moc_headers *.h )
++FILE(GLOB widgetserver_sources *.cpp )
++
++# run moc on these files:
++QT4_WRAP_CPP( widgetserver_moc_sources ${widgetserver_moc_headers} )
++
++add_executable(widgetserver
++ ${widgetserver_sources} ${widgetserver_moc_sources} ${widgetserver_moc_headers}
++)
++
++SET_TARGET_PROPERTIES(widgetserver
++ PROPERTIES INSTALL_RPATH ":usr/lib"
++ BUILD_WITH_INSTALL_RPATH true
++ INSTALL_RPATH_USE_LINK_PATH true
++)
++
++TARGET_LINK_LIBRARIES(widgetserver
++ ${Qt4_LIBRARIES}
++ ${QT_QTCORE_LIBRARY}
++ ${QT_QTGUI_LIBRARY}
++ ${QT_QTXML_LIBRARY}
++ ${QT_QTSCRIPT_LIBRARY}
++ ${QT_QTUITOOLS_LIBRARY}
++)
++
++
++install (
++ TARGETS widgetserver
++ RUNTIME DESTINATION bin
++ )
++
+--- a/widgetserver/widgetserver/input.h
++++ b/widgetserver/widgetserver/input.h
+@@ -4,6 +4,7 @@
+ #include <QThread>
+ #include "process.h"
+ #include "buffer.h"
++#include <cstdio>
+
+ class Input:public QThread
+ {
+--- a/widgetserver/widgetserver/process.h
++++ b/widgetserver/widgetserver/process.h
+@@ -5,6 +5,7 @@
+ #include <QMap>
+ #include <QWidget>
+ #include <QBuffer>
++#include <cstdio>
+
+
+ class Widget: public QObject
diff --git a/sci-mathematics/qtoctave/files/qtoctave-0.10.1-desktop-file.patch b/sci-mathematics/qtoctave/files/qtoctave-0.10.1-desktop-file.patch
new file mode 100644
index 000000000000..b48a3c215737
--- /dev/null
+++ b/sci-mathematics/qtoctave/files/qtoctave-0.10.1-desktop-file.patch
@@ -0,0 +1,8 @@
+--- qtoctave/src/config_files/qtoctave.desktop.orig 2013-07-16 11:26:02.619168052 -0700
++++ qtoctave/src/config_files/qtoctave.desktop 2013-07-16 11:25:54.316124742 -0700
+@@ -4,4 +4,4 @@
+ Icon=qtoctave
+ Exec=qtoctave
+ Type=Application
+-Categories=Education;Science;Math;Qt;
++Categories=Development;Education;Science;Math;Qt;
diff --git a/sci-mathematics/qtoctave/files/qtoctave-0.10.1-doc-path.patch b/sci-mathematics/qtoctave/files/qtoctave-0.10.1-doc-path.patch
new file mode 100644
index 000000000000..481520b5c656
--- /dev/null
+++ b/sci-mathematics/qtoctave/files/qtoctave-0.10.1-doc-path.patch
@@ -0,0 +1,64 @@
+--- qtoctave-0.10.1/qtjs/CMakeLists.txt 2011-01-06 23:48:05.000000000 +0200
++++ qtoctave-0.10.1/qtjs/CMakeLists.txt 2011-02-06 18:16:37.000000000 +0200
+@@ -2,10 +2,5 @@
+
+ install(
+ DIRECTORY doc
+- DESTINATION share/doc/qtoctave-utils/qtjs
++ DESTINATION share/qtoctave/qtjs
+ )
+-
+-install(
+- FILES "instalar.txt" "install.txt"
+- DESTINATION share/doc/qtoctave-utils/qtjs
+-)
+\ No newline at end of file
+--- qtoctave-0.10.1/qtoctave/src/CMakeLists.txt 2011-01-06 23:48:07.000000000 +0200
++++ qtoctave-0.10.1/qtoctave/src/CMakeLists.txt 2011-02-06 18:15:41.000000000 +0200
+@@ -74,7 +74,7 @@
+
+ install (
+ DIRECTORY qtoctave_doc
+- DESTINATION share/doc/qtoctave
++ DESTINATION share/qtoctave
+ PATTERN ".svn" EXCLUDE
+ )
+
+--- qtoctave-0.10.1/qtoctave/src/configure.h.in 2011-01-06 23:48:06.000000000 +0200
++++ qtoctave-0.10.1/qtoctave/src/configure.h.in 2011-02-06 18:15:41.000000000 +0200
+@@ -5,7 +5,7 @@
+ #define HELP_PATH "${CMAKE_INSTALL_PREFIX}/share/doc/octave-html/octave_doc/index.html"
+ #define ICON_PATH "${CMAKE_INSTALL_PREFIX}/share/qtoctave/images"
+ #define LANG_PATH "${CMAKE_INSTALL_PREFIX}/share/qtoctave/lang"
+-#define QTOCTAVE_HELP_PATH "${CMAKE_INSTALL_PREFIX}/share/doc/qtoctave/qtoctave_doc/index.html"
++#define QTOCTAVE_HELP_PATH "${CMAKE_INSTALL_PREFIX}/share/qtoctave/qtoctave_doc/index.html"
+
+ #define PKG_CMD_PATH "${CMAKE_INSTALL_PREFIX}/share/qtoctave/pkg-commands.list"
+ #endif
+--- qtoctave-0.10.1/simple_rcs/CMakeLists.txt 2011-01-06 23:48:06.000000000 +0200
++++ qtoctave-0.10.1/simple_rcs/CMakeLists.txt 2011-02-06 18:15:41.000000000 +0200
+@@ -17,6 +17,6 @@
+
+ install(
+ DIRECTORY design
+- DESTINATION share/doc/qtoctave-utils/simple_rcs
++ DESTINATION share/qtoctave/simple_rcs
+ PATTERN ".svn" EXCLUDE
+ )
+\ No newline at end of file
+--- qtoctave-0.10.1/xmlwidget/CMakeLists.txt 2011-01-06 23:48:06.000000000 +0200
++++ qtoctave-0.10.1/xmlwidget/CMakeLists.txt 2011-02-06 18:15:41.000000000 +0200
+@@ -2,10 +2,10 @@
+
+ install(
+ DIRECTORY doc
+- DESTINATION share/doc/qtoctave-utils/xmlwidget
++ DESTINATION share/qtoctave/xmlwidget
+ )
+
+ install(
+ DIRECTORY examples
+- DESTINATION share/doc/qtoctave-utils/xmlwidget
++ DESTINATION share/qtoctave/xmlwidget
+ )
+\ No newline at end of file
diff --git a/sci-mathematics/qtoctave/files/qtoctave-0.10.1-filedialog-filters.patch b/sci-mathematics/qtoctave/files/qtoctave-0.10.1-filedialog-filters.patch
new file mode 100644
index 000000000000..ddee96afc906
--- /dev/null
+++ b/sci-mathematics/qtoctave/files/qtoctave-0.10.1-filedialog-filters.patch
@@ -0,0 +1,37 @@
+Description: Fix *.m filename filters in file dialogs
+ Not forwarded to upstream since upstream author stopped development.
+Author: Sébastien Villemot <sebastien@debian.org>
+Bug-Debian: http://bugs.debian.org/620062
+Forwarded: no
+Last-Update: 2011-08-21
+--- a/qtoctave/src/editor.cpp
++++ b/qtoctave/src/editor.cpp
+@@ -295,7 +295,7 @@
+ {
+ QStringList filters;
+
+- filters << "Octave (*.m; *.M)"
++ filters << "Octave (*.m *.M)"
+ << "Plain text (*.txt)"
+ << "All files (*)";
+
+@@ -475,7 +475,7 @@
+ QFileDialog openDialog(this, tr("Open") /*Qt::Dialog*/);
+
+ QStringList filters;
+- filters << "Octave (*.m; *.M)"
++ filters << "Octave (*.m *.M)"
+ << "Plain text (*.txt)"
+ << "All files (*)";
+
+--- a/qtoctave/src/main.cpp
++++ b/qtoctave/src/main.cpp
+@@ -308,7 +308,7 @@
+ QFileDialog openDialog(NULL, tr("Open"), ".");
+ QStringList filters;
+
+- filters << "Octave (*.m; *.M)";
++ filters << "Octave (*.m *.M)";
+
+ openDialog.setFilters(filters);
+ openDialog.setAcceptMode(QFileDialog::AcceptOpen);
diff --git a/sci-mathematics/qtoctave/files/qtoctave-0.10.1-initial_position.patch b/sci-mathematics/qtoctave/files/qtoctave-0.10.1-initial_position.patch
new file mode 100644
index 000000000000..cd97291a9bd5
--- /dev/null
+++ b/sci-mathematics/qtoctave/files/qtoctave-0.10.1-initial_position.patch
@@ -0,0 +1,61 @@
+Description: Fix crash when closing a dock tool within the first 5 seconds
+ (a NULL pointer dereference caused by a race condition between the user
+ closing the tool and the timer setting the initial positions, prevented by
+ using a QWeakPointer instead of a raw QWidget *)
+Author: Kevin Kofler <kevin.kofler@chello.at>
+Bug-Fedora: https://bugzilla.redhat.com/show_bug.cgi?id=722986
+Forwarded: no
+Last-Update: 2011-10-06
+---
+This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
+diff -ur qtoctave-0.10.1/qtoctave/src/main.cpp qtoctave-0.10.1-initialposition/qtoctave/src/main.cpp
+--- qtoctave-0.10.1/qtoctave/src/main.cpp 2011-01-06 22:48:07.000000000 +0100
++++ qtoctave-0.10.1-initialposition/qtoctave/src/main.cpp 2011-10-06 20:17:03.000000000 +0200
+@@ -595,7 +595,7 @@
+ initPos.maximized=maximized;
+ initPos.minimized=minimized;
+ initPos.widget=bw->parentWidget();
+- if(initPos.widget!=NULL)
++ if(!initPos.widget.isNull())
+ initialPositionList.append(initPos);
+ //bw->show();
+ //bw->move(x,y);
+@@ -694,10 +694,14 @@
+ {
+ foreach(InitialPosition i, initialPositionList)
+ {
+- i.widget->move(i.x,i.y);
+- i.widget->resize(i.width, i.height);
+- if(i.maximized) i.widget->showMaximized();
+- if(i.minimized) i.widget->showMinimized();
++ QWidget *widget = i.widget.data();
++ if (widget)
++ {
++ widget->move(i.x,i.y);
++ widget->resize(i.width, i.height);
++ if(i.maximized) widget->showMaximized();
++ if(i.minimized) widget->showMinimized();
++ }
+ }
+ }
+
+diff -ur qtoctave-0.10.1/qtoctave/src/main.h qtoctave-0.10.1-initialposition/qtoctave/src/main.h
+--- qtoctave-0.10.1/qtoctave/src/main.h 2011-01-06 22:48:08.000000000 +0100
++++ qtoctave-0.10.1-initialposition/qtoctave/src/main.h 2011-10-06 20:12:55.000000000 +0200
+@@ -27,6 +27,7 @@
+ #include <QListWidget>
+ #include <QTimer>
+ #include <QVector>
++#include <QWeakPointer>
+ #include "mainwindow.h"
+ #include "octave_connection.h"
+ #include "terminal.h"
+@@ -41,7 +42,7 @@
+ struct InitialPosition
+ {
+ int x, y, width, height;
+- QWidget *widget;
++ QWeakPointer<QWidget> widget;
+ bool maximized, minimized;
+ };
+
diff --git a/sci-mathematics/qtoctave/files/qtoctave-0.10.1-no-native-menubars.patch b/sci-mathematics/qtoctave/files/qtoctave-0.10.1-no-native-menubars.patch
new file mode 100644
index 000000000000..677b5e5ed817
--- /dev/null
+++ b/sci-mathematics/qtoctave/files/qtoctave-0.10.1-no-native-menubars.patch
@@ -0,0 +1,35 @@
+Description: Do not export docked window menubars to desktop panel
+Author: Aurélien Gâteau <aurelien.gateau@canonical.com>
+Forwarded: Sent to http://groups.google.com/group/qtoctave-english
+Bug-Ubuntu: https://bugs.launchpad.net/appmenu-qt/+bug/673210
+Index: qtoctave-0.10.1/qtoctave/src/basewidget.cpp
+===================================================================
+--- qtoctave-0.10.1.orig/qtoctave/src/basewidget.cpp 2011-01-06 22:48:07.000000000 +0100
++++ qtoctave-0.10.1/qtoctave/src/basewidget.cpp 2011-09-14 11:03:11.000000000 +0200
+@@ -30,6 +30,7 @@
+ //setFocusPolicy(Qt::StrongFocus);
+ session=NULL;
+ QWidget *central=new QWidget(this);
++ menuBar()->setNativeMenuBar(false);
+ setCentralWidget(central);
+
+ QMenu *windows_menu=menuBar()->addMenu(tr("View"));
+Index: qtoctave-0.10.1/qtoctave/src/mainwindow.cpp
+===================================================================
+--- qtoctave-0.10.1.orig/qtoctave/src/mainwindow.cpp 2011-01-06 22:48:07.000000000 +0100
++++ qtoctave-0.10.1/qtoctave/src/mainwindow.cpp 2011-09-14 12:03:14.000000000 +0200
+@@ -39,7 +39,13 @@
+ setSession(session);
+ setWindowIcon(QIcon(QString(ICON_PATH) + "/qtoctave.png"));
+
+- menuBar()->clear();
++ //The menubar provided by BaseWidget is set as not-native to avoid showing up
++ //in top-panel menubars on desktops like Unity, but we want a native menubar
++ //here, and we also want to get rid of the generic "View" item BaseWidget
++ //added to the menubar. Setting a new menubar is the simplest way to do this
++ //(the old one gets deleted).
++ //[1] https://bugs.launchpad.net/appmenu-qt/+bug/673210
++ setMenuBar(new QMenuBar());
+
+ setWindowTitle("QtOctave ["+session->getProjectName()+"]");
+ //resize(QSize(800, 600).expandedTo(minimumSizeHint()));
diff --git a/sci-mathematics/qtoctave/files/qtoctave-0.10.1-qtinfo-octave3.4.patch b/sci-mathematics/qtoctave/files/qtoctave-0.10.1-qtinfo-octave3.4.patch
new file mode 100644
index 000000000000..5d8824789894
--- /dev/null
+++ b/sci-mathematics/qtoctave/files/qtoctave-0.10.1-qtinfo-octave3.4.patch
@@ -0,0 +1,15 @@
+Description: Make qtinfo compatible with Octave >= 3.4
+Origin: upstream, commit: 282
+Forwarded: not-needed
+Last-Update: 2012-03-11
+---
+This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
+--- a/qtoctave/src/scripts_octave/qtinfo.m
++++ b/qtoctave/src/scripts_octave/qtinfo.m
+@@ -1,5 +1,5 @@
+ function qtinfo()
+ command=sprintf("qtoctave-info-reader %s > /dev/null", info_file);
+ printf("Starting info: %s\n", command);
+- system(command, 1, "async");
++ system(command, 0, "async");
+ endfunction
diff --git a/sci-mathematics/qtoctave/files/qtoctave-0.10.1-use_octave_htmldoc.patch b/sci-mathematics/qtoctave/files/qtoctave-0.10.1-use_octave_htmldoc.patch
new file mode 100644
index 000000000000..08eeb9c52e34
--- /dev/null
+++ b/sci-mathematics/qtoctave/files/qtoctave-0.10.1-use_octave_htmldoc.patch
@@ -0,0 +1,34 @@
+Description: Update Octave's HTML doc path to use octave-htmldoc
+ Also, avoid failure on nonexistent path to upstream stripped HTML files.
+Author: Thomas Weber <tweber@debian.org>
+Author: Sébastien Villemot <sebastien@debian.org>
+Last-Update: 2012-03-11
+Forwarded: not-needed
+--- a/qtoctave/src/configure.h.in
++++ b/qtoctave/src/configure.h.in
+@@ -2,7 +2,7 @@
+ #ifndef __CONFIGURE_H__
+ #define __CONFIGURE_H__
+ #define CONFIG_PATH "${CMAKE_INSTALL_PREFIX}/share/qtoctave"
+-#define HELP_PATH "${CMAKE_INSTALL_PREFIX}/share/doc/octave-html/octave_doc/index.html"
++#define HELP_PATH "${CMAKE_INSTALL_PREFIX}/share/doc/octave-htmldoc/interpreter/index.html"
+ #define ICON_PATH "${CMAKE_INSTALL_PREFIX}/share/qtoctave/images"
+ #define LANG_PATH "${CMAKE_INSTALL_PREFIX}/share/qtoctave/lang"
+ #define QTOCTAVE_HELP_PATH "${CMAKE_INSTALL_PREFIX}/share/doc/qtoctave/qtoctave_doc/index.html"
+--- a/qtoctave/src/CMakeLists.txt
++++ b/qtoctave/src/CMakeLists.txt
+@@ -64,14 +64,6 @@
+ DESTINATION share/qtoctave/lang
+ )
+
+-
+-
+-install (
+- DIRECTORY octave_doc
+- DESTINATION share/doc/octave-html
+- PATTERN ".svn" EXCLUDE
+- )
+-
+ install (
+ DIRECTORY qtoctave_doc
+ DESTINATION share/doc/qtoctave
diff --git a/sci-mathematics/qtoctave/metadata.xml b/sci-mathematics/qtoctave/metadata.xml
new file mode 100644
index 000000000000..19eb759e10bc
--- /dev/null
+++ b/sci-mathematics/qtoctave/metadata.xml
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+<herd>sci-mathematics</herd>
+<longdescription lang='en'>
+ Besides offering an attractive front-end to GNU Octave, an
+ environment for numerical computation highly compatible with MATLAB,
+ QtOctave currently also features matrix data entry and display and
+ some GUI shortcuts to frequently used Octave functions. It also
+ offers access in place to Octave's documentation with octave-htmldoc
+ or octave-info.
+</longdescription>
+</pkgmetadata>
diff --git a/sci-mathematics/qtoctave/qtoctave-0.10.1-r1.ebuild b/sci-mathematics/qtoctave/qtoctave-0.10.1-r1.ebuild
new file mode 100644
index 000000000000..0e329968c1b5
--- /dev/null
+++ b/sci-mathematics/qtoctave/qtoctave-0.10.1-r1.ebuild
@@ -0,0 +1,48 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+inherit cmake-utils multilib
+
+PID=2054
+
+DESCRIPTION="Qt4 front-end for Octave"
+HOMEPAGE="http://forja.rediris.es/projects/csl-qtoctave/"
+SRC_URI="http://forja.rediris.es/frs/download.php/${PID}/${P}.tar.gz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="amd64 x86 ~x86-fbsd ~amd64-linux ~x86-linux"
+IUSE=""
+
+CDEPEND="
+ || ( ( >=dev-qt/qtgui-4.8.5:4 dev-qt/designer:4 ) <dev-qt/qtgui-4.8.5:4 )
+ >=dev-qt/qtsvg-4.6:4"
+RDEPEND="${CDEPEND}
+ sci-mathematics/octave"
+DEPEND="${CDEPEND}
+ virtual/pkgconfig"
+
+DOCS=(readme.txt leeme.txt)
+
+PATCHES=(
+ "${FILESDIR}"/${P}-build-out-of-source.patch
+ "${FILESDIR}"/${P}-build-widgetserver.patch
+ "${FILESDIR}"/${P}-doc-path.patch
+ "${FILESDIR}"/${P}-filedialog-filters.patch
+ "${FILESDIR}"/${P}-initial_position.patch
+ "${FILESDIR}"/${P}-no-native-menubars.patch
+ "${FILESDIR}"/${P}-qtinfo-octave3.4.patch
+ "${FILESDIR}"/${P}-use_octave_htmldoc.patch
+ "${FILESDIR}"/${P}-desktop-file.patch
+)
+
+src_configure() {
+ local mycmakeargs=(
+ -DCMAKE_SKIP_INSTALL_RPATH=ON
+ -DCMAKE_SKIP_RPATH=ON
+ )
+ cmake-utils_src_configure
+}
diff --git a/sci-mathematics/reduce/Manifest b/sci-mathematics/reduce/Manifest
new file mode 100644
index 000000000000..77b02484fac4
--- /dev/null
+++ b/sci-mathematics/reduce/Manifest
@@ -0,0 +1 @@
+DIST reduce-src-20110414.tar.bz2 136783974 SHA256 d6ac7a30e817ea71555d21b03a119a5236967b251eae8946a1817ae9a81cee03
diff --git a/sci-mathematics/reduce/files/64reduce-gentoo.el b/sci-mathematics/reduce/files/64reduce-gentoo.el
new file mode 100644
index 000000000000..2c20bff93ede
--- /dev/null
+++ b/sci-mathematics/reduce/files/64reduce-gentoo.el
@@ -0,0 +1,4 @@
+;; site-init for sci-mathematics/reduce
+(add-to-list 'load-path "@SITELISP@")
+(autoload 'reduce-mode "reduce-mode" "Major mode for REDUCE code editing" t)
+(add-to-list 'auto-mode-alist '("\\.red\\'" . reduce-mode))
diff --git a/sci-mathematics/reduce/files/csl b/sci-mathematics/reduce/files/csl
new file mode 100755
index 000000000000..895b6bd8f4a1
--- /dev/null
+++ b/sci-mathematics/reduce/files/csl
@@ -0,0 +1,2 @@
+#!/bin/sh
+exec /usr/lib/reduce/csl $*
diff --git a/sci-mathematics/reduce/files/redcsl b/sci-mathematics/reduce/files/redcsl
new file mode 100755
index 000000000000..ff40e3e073ab
--- /dev/null
+++ b/sci-mathematics/reduce/files/redcsl
@@ -0,0 +1,2 @@
+#!/bin/sh
+exec /usr/lib/reduce/reduce $*
diff --git a/sci-mathematics/reduce/metadata.xml b/sci-mathematics/reduce/metadata.xml
new file mode 100644
index 000000000000..2a54944facce
--- /dev/null
+++ b/sci-mathematics/reduce/metadata.xml
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <herd>sci-mathematics</herd>
+ <maintainer>
+ <email>grozin@gentoo.org</email>
+ <name>Andrey Grozin</name>
+ </maintainer>
+ <longdescription lang="en">
+A general-purpose computer algebra system.
+Powerful, mature and efficient.
+</longdescription>
+ <upstream>
+ <remote-id type="sourceforge">reduce-algebra</remote-id>
+ </upstream>
+</pkgmetadata>
diff --git a/sci-mathematics/reduce/reduce-20110414-r1.ebuild b/sci-mathematics/reduce/reduce-20110414-r1.ebuild
new file mode 100644
index 000000000000..7394f78f5e66
--- /dev/null
+++ b/sci-mathematics/reduce/reduce-20110414-r1.ebuild
@@ -0,0 +1,95 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+inherit elisp-common multilib
+
+DESCRIPTION="A general-purpose computer algebra system"
+HOMEPAGE="
+ http://reduce-algebra.sourceforge.net/
+ http://reduce-algebra.com/"
+SRC_URI="mirror://sourceforge/${PN}-algebra/${PN}-src-${PV}.tar.bz2"
+
+SLOT="0"
+LICENSE="BSD-2 X? ( LGPL-2.1 )"
+KEYWORDS="~amd64 ~x86"
+IUSE="doc emacs gnuplot X"
+
+RDEPEND="
+ X? (
+ x11-libs/libXrandr
+ x11-libs/libXcursor
+ x11-libs/libXft
+ )
+ gnuplot? ( sci-visualization/gnuplot )
+ emacs? ( virtual/emacs )"
+DEPEND="${RDEPEND}"
+
+src_configure() {
+ # If you pass --prefix to this damn configure,
+ # make (not make install!) will try to install stuff
+ # into the live file system => sandbox violation
+ # Therefore, I cannot use econf here
+ # Also, make calls configure in maintainer mode in subdirs *by design*
+ # The trunk sucks less => WONTFIX until the next release
+ ./configure --with-csl $(use_with X gui) || die
+ # psl build requires Internet connection at build time
+ # we cannot support it
+}
+
+src_compile() {
+ emake -j1 STRIP=true
+
+ pushd cslbuild/*/csl/reduce.doc > /dev/null
+ rm -f *.txt *.tex || die
+ popd > /dev/null
+
+ if use emacs; then
+ einfo "Compiling emacs lisp files"
+ elisp-compile generic/emacs/*.el || die "elisp-compile failed"
+ fi
+}
+
+src_test() {
+ emake -j1 testall
+}
+
+src_install() {
+ local lib="$(get_libdir)"
+ dodoc README BUILDING DEPENDENCY_TRACKING
+ pushd bin > /dev/null
+ cp "${FILESDIR}"/redcsl "${FILESDIR}"/csl . || die
+ sed -e "s/lib/${lib}/" -i redcsl || die
+ sed -e "s/lib/${lib}/" -i csl || die
+ dobin redcsl csl
+ popd > /dev/null
+
+ pushd cslbuild/*/csl > /dev/null
+ exeinto /usr/${lib}/${PN}
+ doexe reduce csl
+ insinto /usr/$(get_libdir)/${PN}
+ doins reduce.img csl.img
+ insinto /usr/share/${PN}
+ doins -r ${PN}.doc
+ mv "${D}"usr/share/${PN}/${PN}.doc "${D}"usr/share/${PN}/doc || die
+ dosym /usr/share/${PN}/doc /usr/${lib}/${PN}/${PN}.doc
+ if use X; then
+ doins -r ${PN}.fonts
+ mv "${D}"usr/share/${PN}/${PN}.fonts "${D}"usr/share/${PN}/fonts || die
+ dosym /usr/share/${PN}/fonts /usr/${lib}/${PN}/${PN}.fonts
+ fi
+ popd > /dev/null
+
+ if use doc; then
+ dodoc doc/util/r38.pdf
+ fi
+
+ if use emacs; then
+ pushd generic/emacs > /dev/null
+ elisp-install ${PN} *.el *.elc || die "elisp-install failed"
+ elisp-site-file-install "${FILESDIR}/64${PN}-gentoo.el"
+ popd > /dev/null
+ fi
+}
diff --git a/sci-mathematics/relational/Manifest b/sci-mathematics/relational/Manifest
new file mode 100644
index 000000000000..b970a4df6ac2
--- /dev/null
+++ b/sci-mathematics/relational/Manifest
@@ -0,0 +1 @@
+DIST relational-0.11.tar.gz 133002 RMD160 7f421b61f006fbce44886ae1c8db313417607a47 SHA1 8cb0aeea814b05cf5ffdb66f3289260a266ca130 SHA256 367b8ade98e4b9d34ff463a217e41d7206d201cdaee3e49cf5f5bcb28f558040
diff --git a/sci-mathematics/relational/metadata.xml b/sci-mathematics/relational/metadata.xml
new file mode 100644
index 000000000000..1d7818888617
--- /dev/null
+++ b/sci-mathematics/relational/metadata.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+<herd>qt</herd>
+<longdescription lang="en">
+</longdescription>
+</pkgmetadata>
+
diff --git a/sci-mathematics/relational/relational-0.11.ebuild b/sci-mathematics/relational/relational-0.11.ebuild
new file mode 100644
index 000000000000..4b0166dc0c4d
--- /dev/null
+++ b/sci-mathematics/relational/relational-0.11.ebuild
@@ -0,0 +1,51 @@
+# Copyright 1999-2011 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="3"
+PYTHON_DEPEND="2"
+
+inherit python eutils
+
+DESCRIPTION="Qt4 relational algebra application"
+HOMEPAGE="http://galileo.dmi.unict.it/wiki/relational/"
+# upstream url is not static
+SRC_URI="mirror://gentoo/${P}.tar.gz"
+
+LICENSE="GPL-3"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE="debug"
+
+DEPEND="dev-python/PyQt4[webkit,X]
+ media-fonts/dejavu"
+RDEPEND="${DEPEND}"
+
+S="${WORKDIR}/${PN}"
+
+pkg_setup() {
+ python_set_active_version 2
+ python_pkg_setup
+}
+
+src_compile() {
+ true
+}
+
+src_install() {
+ insinto "$(python_get_sitedir)/"
+ doins -r "${PN}_gui" || die "doins failed"
+ doins -r "${PN}" || die "doins failed"
+ newbin ${PN}_gui.py ${PN} || die "dobin failed"
+ domenu ${PN}.desktop || die "domenu failed"
+ dodoc CHANGELOG CREDITS README || die "dodoc failed"
+ doman ${PN}.1 || die "doman failed"
+}
+
+pkg_postinst() {
+ python_mod_optimize ${PN} ${PN}_gui
+}
+
+pkg_postrm() {
+ python_mod_cleanup ${PN} ${PN}_gui
+}
diff --git a/sci-mathematics/rkward/Manifest b/sci-mathematics/rkward/Manifest
new file mode 100644
index 000000000000..46d3c9999420
--- /dev/null
+++ b/sci-mathematics/rkward/Manifest
@@ -0,0 +1 @@
+DIST rkward-0.6.1.tar.gz 1529612 SHA256 7887bc22645a8e6de278da55e31a61acd91aca0ade777af11a110d0dfcfffde7 SHA512 5171b60ed42049de9e0f45b64f61a9bcf1fe8ba89e5a5a8b9ba77b9f7adb0d61630691adcb6636f5d5c5023c64a48220e85ea93c2ea09af34df2fa4be5d0cc9f WHIRLPOOL 2b195384dc0e093b445f7bf21c1f4bc2f378af7e51adb20f046a97e07d7f808b04eb3be9a35198b389b84edc79b3936d2f3d5e7eebc82ff3bb612465b813bcb3
diff --git a/sci-mathematics/rkward/metadata.xml b/sci-mathematics/rkward/metadata.xml
new file mode 100644
index 000000000000..c63c29a5b639
--- /dev/null
+++ b/sci-mathematics/rkward/metadata.xml
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <herd>sci-mathematics</herd>
+ <longdescription lang="en">
+RKWard aims to become an easy to use frontend to R. RKWard is still in
+development status. Right now it is most useful as an IDE to users
+with some experience in R, or willing to learn R.
+</longdescription>
+ <upstream>
+ <remote-id type="sourceforge">rkward</remote-id>
+ </upstream>
+</pkgmetadata>
diff --git a/sci-mathematics/rkward/rkward-0.6.1.ebuild b/sci-mathematics/rkward/rkward-0.6.1.ebuild
new file mode 100644
index 000000000000..53faf346573e
--- /dev/null
+++ b/sci-mathematics/rkward/rkward-0.6.1.ebuild
@@ -0,0 +1,37 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+KDE_DOC_DIRS="doc"
+KDE_HANDBOOK="optional"
+KDE_LINGUAS="ca cs da de el es fr it lt pl tr zh_CN"
+
+inherit kde4-base
+
+DESCRIPTION="IDE for the R-project"
+HOMEPAGE="http://rkward.sourceforge.net/"
+SRC_URI="mirror://sourceforge/rkward/${P}.tar.gz"
+
+LICENSE="GPL-2"
+SLOT="4"
+KEYWORDS="amd64 x86 ~amd64-linux ~x86-linux"
+IUSE="debug"
+
+DEPEND="
+ dev-lang/R
+ $(add_kdebase_dep katepart)"
+RDEPEND="${DEPEND}"
+
+src_configure() {
+ # to have it compatible with R which had a bad R_HOME
+ unset R_HOME
+ kde4-base_src_configure
+}
+
+src_install() {
+ kde4-base_src_install
+ # avoid file collision with kate
+ rm "${ED}"/usr/share/apps/katepart/syntax/r.xml || die
+}
diff --git a/sci-mathematics/rngstreams/Manifest b/sci-mathematics/rngstreams/Manifest
new file mode 100644
index 000000000000..bad647919c93
--- /dev/null
+++ b/sci-mathematics/rngstreams/Manifest
@@ -0,0 +1 @@
+DIST rngstreams-1.0.1.tar.gz 502458 SHA256 966195febb9fb9417e4e361948843425aee12efc8b4e85332acbcd011ff2d9b0 SHA512 665c27e72a4e1bdc59864f340208d42fc899c1c9429aafe1c7c3f8778dee0bb87ec9da26976a925197e07931bc1c2864dde0cb3fc08996155f775b7e44f9d7f4 WHIRLPOOL b0fe5036076cfb14980ea1f5e23ac19d2ade31f8b6ffef29d2d66f2b96aebf7df15038a913a6077c9eec15dcbda30c3b6ceadde5f5f44ec6461ae30e43f31b11
diff --git a/sci-mathematics/rngstreams/metadata.xml b/sci-mathematics/rngstreams/metadata.xml
new file mode 100644
index 000000000000..f2f1196ee510
--- /dev/null
+++ b/sci-mathematics/rngstreams/metadata.xml
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <herd>sci-mathematics</herd>
+ <longdescription lang="en">
+ RngStreams is a C implementation of a high quality uniform random
+ number generator that supports multiple "independent" streams of
+ uniform random numbers. It has been written by Pierre L'Ecuyer and
+ Richard Simard.
+ This is the GNU-style package maintained by Josef Leydold.
+</longdescription>
+</pkgmetadata>
diff --git a/sci-mathematics/rngstreams/rngstreams-1.0.1.ebuild b/sci-mathematics/rngstreams/rngstreams-1.0.1.ebuild
new file mode 100644
index 000000000000..e6eeef4afa9f
--- /dev/null
+++ b/sci-mathematics/rngstreams/rngstreams-1.0.1.ebuild
@@ -0,0 +1,25 @@
+# Copyright 1999-2013 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=4
+
+inherit autotools-utils
+
+DESCRIPTION="Multiple independent streams of pseudo-random numbers"
+HOMEPAGE="http://statmath.wu.ac.at/software/RngStreams/"
+SRC_URI="${HOMEPAGE}${P}.tar.gz"
+
+LICENSE="GPL-3"
+SLOT=0
+KEYWORDS="amd64 x86 ~amd64-linux ~x86-linux"
+IUSE="doc examples static-libs"
+
+src_install() {
+ autotools-utils_src_install
+ use doc && dohtml -r doc/rngstreams.html/* && dodoc doc/${PN}.pdf
+ if use examples; then
+ rm examples/Makefile*
+ dodoc -r examples
+ fi
+}
diff --git a/sci-mathematics/rstudio/Manifest b/sci-mathematics/rstudio/Manifest
new file mode 100644
index 000000000000..69be18ad6153
--- /dev/null
+++ b/sci-mathematics/rstudio/Manifest
@@ -0,0 +1,20 @@
+DIST chromedriver-linux 19303552 SHA256 1ff3e9fc17e456571c440ab160f25ee451b2a4d36e61c8e297737cff7433f48c SHA512 18774ede961dec222058dd0e3f128d63732cd444ee310136b44d5bf508a4f2f2c164a2c8d195d80bce8b5fb6303559e167f82f384e4a58e30f48b151a4206ee8 WHIRLPOOL 06534c131d3a8ade4fb12ad94955f430f23d86654342357d223e78e210cc401416361a847934bccb3957702bbe8fc8a6dd7f18416461edf486145bde96c7091e
+DIST core-dictionaries.zip 876339 SHA256 4341a9630efb9dcf7f215c324136407f3b3d6003e1c96f2e5e1f9f14d5787494 SHA512 9c5830cc9fed575e223f1c61f02e48c5aea6801bb0cd2586f02437c17fdffdb1d36c396d5a8ecbe02ba01196e73458304345b1f6b92c052bc7a7d05961fac2c9 WHIRLPOOL 316dced8ac46e4216613b0b850c33d4c1e10ef0ecd954d786eb131ea80b34e66ba3d39a0ef25b45230b64ded415737ddabef8f7d68f4d42caea98679cff44ee0
+DIST gin-1.5.zip 1055663 SHA256 f561f4eb5d5fe1cff95c881e6aed53a86e9f0de8a52863295a8600375f96ab94 SHA512 3f6649565f9600daaca6ddf3fb431925b5a1ce1ada38e6389de64cef617abba9d3f49c555d0a20053fb06f17ccbe4e1141b39966fbe4b2975d7b120377504897 WHIRLPOOL e66d348ed275eb20518369c39592a5a03ee4257422e2947520385377939de65a54d131332818362a47597392026db48ed1332f11ae218e336798498ae5d5b196
+DIST gwt-2.5.0.rc1.zip 104156555 SHA256 83a6dec583d1b7f3bf3fd2e321d89c1d95881eed1f81c7ea4056201fc105258b SHA512 c0c4f502b4ca191537eada53eb0458c0d33282661423f6d2648e6107ed8e38465b189377fcd0d9babcbf2c688e16080d33cbd7165ed20dafda7fedc39a74e163 WHIRLPOOL b37f12d1937b6479b97e274a59a1856dcf0c5cc3b767b6a19f65d7807e1f32cc2483358f1414c4c9e427d890eb1e0617fe8af84c6f0dca4a9ded64ae5ffde129
+DIST gwt-2.5.1.zip 111070580 SHA256 c457df45a3eed582452c5784ed11746685df494c0ffe4a8ae4de52945916593a SHA512 845c6bc6ce5ade57eeddd8b40cc3458f5e7d40d881cb4017615897eebd5349bfecfef8cd3e3b05a09b33ecf9ee0262d4a84700b0965a27b40cb60d701457a7ea WHIRLPOOL 9d820026e97f96402fc6b69a06f24d2f79df830a0afdba808ab98f14a32312bc999692ad5822005acf6fdcd1b4261918a318f9f20980c640cf32292d5df83a05
+DIST gwt-2.6.0.zip 108819959 SHA256 bd4c13a5d1078446d519a742ee233971e55c447d1b87ffd5b1f90e54dd876b9a SHA512 40690f83f6271ab58abf0ccbf2da1045ea142867ed88accdce91f65a70e39ecf48070696caffcab3f797523ee69b0431b67155b7f04c2856cd95856a7e20d2fb WHIRLPOOL d59ce0f9b13a9956b07905479b394397020fcbc85ac3aabff9ebd74d39b7e660c862e7fe1adb32160e82186d83db10d1254121846e1a9bdafacc38efc55a38fd
+DIST packrat-0.98.1000.tar.gz 97677 SHA256 c2da99ea6b62fd460f36b76f6c9b91865c42851545d61817c181bf6109e2df6b SHA512 2290c768ecf27a037e73c3f8336b9fd71c68ff19d071b4a8fbc469550d29007cacacdb75f854f73b5db2139a5104f129b85a3612e2ee47bd6118ee13f7d103a6 WHIRLPOOL a2d0c3c3e04cbc496f59abbf1065fcd0b7ae25433ce0b7ca8e75ab59362f320508537b2a62ed1028dd5baad6cbab5ef2e91dd9d3af327bbd04c08a96c57d80f4
+DIST packrat_0.3.0.tar.gz 79974 SHA256 5ea35b6cb964188f4ffe58a3c9cf2c1f5a436569117c218d097e0fa66d032ebb SHA512 7f964e94e62193466e9bc880fea2c2fef8a0996061d9b971789e4e33a2d1e6327033f03236327545aa73e1112e2bea730c3fc0984729ecdec6f1582855c1b249 WHIRLPOOL 7ff4c3f3681300d402e8738b1aceac7ee2dbd55edb36966e3b7453b1b90182093979436d2c1193d460418251bc370ab222f61142311d8fe1a5a42527c5869aa3
+DIST rmarkdown-0.98.1000.tar.gz 1423820 SHA256 56e9f964f805627f6d6face9bf09e6435be4cc48321447ad4041fee86d6f88b4 SHA512 df3540c24c87930fe55bff2ffe67c86c219800cb00ed72ba9451ecd0d0cad411548a78c1a04b9a2e301e853616dcb77e09129c4e48ade6f16d3f14b7ea7e4852 WHIRLPOOL 51098cd48a12a61da312fc1cc96927626db4a19cc069c88f615dd20abe40f52a7b1ac1325b52b1922110ffa76a7f255d9ff2a75cd05d3de01d1b96f0c8286790
+DIST rmarkdown_0.2.49.tar.gz 3846795 SHA256 56b9a032b07d62c6af2a4a2d04007cccf379a9c8e91426c59f265c8b7fd992ee SHA512 46d15c354c9a90ae75a7dc3660b1ea82d097aaceb3dd220a4a8c6f4b22751ad2d63fd5ef3d56821160716ab6552529cef6513b5cd7043368d13513f537511fef WHIRLPOOL d658a091d1b4508ea38fbf2f3691517dc2b814aa3ffaec25483263266106756a89712d7c8a2ec3de8d6d45234d5f8b11340c287509bd836be5875527077f7fcd
+DIST rstudio-0.97.336.tar.gz 12598580 SHA256 e6c24d6a865827d3a39e64508976a825bba705efe0921eb06f9a95ba58aefcd1 SHA512 bfaf6218cb400e83a97a320cf633e4656f1552e27bb9843fda1837945a3823fb0df20a2c86e0b6d76608d98806b0acf163aaba10783c923ef900b3eaf03b7569 WHIRLPOOL eca7b837ccff6cc6595298c3137f8663c0754256763a1d049e44a11e10daf53914234c426e004cc1f0158d7b4a38319f61653f78785c7189a64413fc196848c2
+DIST rstudio-0.97.551.tar.gz 12602738 SHA256 caed5f6b6ec57139ddf550dc2f51c1f9a74b39b81b878863b97e1a12edecf498 SHA512 f855a5ba3a86e44c870a4843e94678a1f6eeedc49934d8ad42f202815f93d282913a0be739435be63e510a6ec81b7a1436e4c911acbff955f5fb28b78b00fd10 WHIRLPOOL d8cd3d2978b690fc8c83696cb2017748e74b38309174ac85d6d35d5a1dd91d8e0d8ea06177b349754b3be9eb5e78e04b1d23b82f9e7940d062b262c1eb7eb58e
+DIST rstudio-0.98.1028.tar.gz 15555649 SHA256 19827c3d05b4817530fb07f235fe38ec5e391324acd1d5d8ab6711d0db4757ef SHA512 db1be9f91263386ad0fb8addc80421434695d2c8dd53101af268e878fd59c59b9349cc9456d7096d2c660ee2681cd0172d8f4d8432ccf7322a1a2b473ce291fd WHIRLPOOL ab2974d2e529fea03fe641569d4b74a6eb1d86179be47de46531a970d5f70624824e08573835d531a5033d20f800117174926b83aee290f784ac31f7a9627d7d
+DIST rstudio-0.98.1091.tar.gz 15551758 SHA256 61745708096b5feb3d88befab65adf67dd386262cde1ef2b351f56695f5b9ac2 SHA512 6b2fcd7418118b8845266dc12ff4680623a68a8fdfda2bdc523e8cd30139e99fa29063438fbb441f23d04e57715eec1ee21763baf0ab77d313b763d8b3d9e3a0 WHIRLPOOL 356297217bdc70954b79695755fb873127e9b7c5a8ff2be18e237b559638aa1ec3c0349d8606598bd81e4057914e518748c236dc4a701d9a1f27805c2a4c7327
+DIST rstudio-0.98.490.tar.gz 14989329 SHA256 e38296a10b12c9e769a8be0545c36745999b9ba90942f7ffb6d27f05192a7f93 SHA512 b167083eb4adf1203da63299e61c9e3f40b8aeb4728d25c9d840f8a22659aad8de442dbba3a68e7d11f6157680d3a3636f6d5fecbabab82fd8d1a8278e3f1cb1 WHIRLPOOL d7c07aea3aef424aa9fa05f74b8222cae69b9ce287ba67d80591dc2a433471e7127d975119667560bf6667190d128b0ffcf82f641792075dacf826f4d76df568
+DIST rstudio-0.98.932.tar.gz 15515025 SHA256 e4a69a2f746cb7cfcacd3811f15e41a9d156175607da334f412614cc4cb70728 SHA512 beeb8c035d4f8524bd3e497162e3a218e92fbd1c1704ff3bc99a70a1248244155e3998272a6aa985b59cfa67c640adec877465f5d50acb9e47abca2657f2a06f WHIRLPOOL e422a2cef857aa9d094dd11e62b6c762a2a7477e7d84fd66456152c6521aebd94d4c365980ed6c06fc1c90d5a62426376d978de0ed23186d4732c0b148cc62bc
+DIST rstudio-0.98.953.tar.gz 15518231 SHA256 944f5882a0d61f551cd6f6cbe7882b5a5ea5be12d2c6d5ec9e79cee65869dbb7 SHA512 38a17d1abf91f4e775c4d735152fe6c8030b2df771bd7333fb3c9408fe14ac0b6180d7eaad7ac09ce2d50e5dcaa5a3b828909b30f507fd7c35fe27f7bd96866c WHIRLPOOL e2135f425b48b952282d8c44bd121517098521715c70537a6ac1a3be1732928666c5cb40fbc20b9f394a606e0e116723190790a202cbf62986ffbca528646058
+DIST selenium-java-2.37.0.zip 24625928 SHA256 0eebba65d8edb01c1f46e462907c58f5d6e1cb0ddf63660a9985c8432bdffbb7 SHA512 68624e82dbc751a25c50fad72702a98eb30d77fd4337d2a969f8e06bcc49e5f8c835cd27ec53772f3375014ddde1d5636936e966b75f3594a9f86aa18ba4e779 WHIRLPOOL eb6659aae26f3c78b6f998546b23d0636c9d00ed8a7f985db1463ac4bd483ccb3e643d84e2ca0f59e0636a8de79eb552ff1d68eb6f9c06907029f7552d8f7777
+DIST selenium-server-standalone-2.37.0.jar 34730734 SHA256 97bc8c699037fb6e99ba7af570fb60dbb1b7ce30cde2448287a44ef65b13023e SHA512 b215446d42d2d1f69664349b6ae6dc53a532d3624c91254f0f4183d0ad764648792e5cc1126a55a1e60d9687d55200fed01d6d2f46cc3d853b1fa6ee38111018 WHIRLPOOL 20640591534f31f24825a9ed139589b182e8b60d86541bf0be104d3cc0280983f6566bd0459f2253ac3875b48a2798b205bac8f815a119fff6db625ce9bbc29e
+DIST shinyapps-0.98.1000.tar.gz 910095 SHA256 b95c512ae0a0fb4335878d9cfcf9073e2cb3ccfed73543abe27ea8878ed36d57 SHA512 3162317c4c20cfc1497e952a8235867084d629ae88407e6c465b3e208adb1dc97abfe6b9922e0374ddf4c8e38a76e112942bd312c54a66f74e6f2a3fe4c0a07c WHIRLPOOL ecc2bce78387cb42e9989163d8fca29220e66f085acde3323417058aebb624dafa8c0e1873c7d79e67324cbd5aad250ef9fcdbbc8f659d64482233b95d898a15
diff --git a/sci-mathematics/rstudio/files/rsession.conf b/sci-mathematics/rstudio/files/rsession.conf
new file mode 100644
index 000000000000..645bfa46b208
--- /dev/null
+++ b/sci-mathematics/rstudio/files/rsession.conf
@@ -0,0 +1,26 @@
+######rsession.conf############
+# Session Timeouts
+# By default if a user hasn't issued a command for 2 hours
+# RStudio will suspend that user's R session to disk so
+# they are no longer consuming server resources (the next
+# time the user attempts to access the server their session
+# will be restored). You can change the timeout (including
+# disabling it by specifying a value of 0) using the
+# session-timeout-minutes setting
+#session-timeout-minutes=30
+
+# By default RStudio sets the R_LIBS_USER environment
+# variable to ~/R/library. This ensures that packages
+# installed by end users do not have R version numbers
+# encoded in the path (which is the default behavior).
+# This in turn enables administrators to upgrade the version
+# of R on the server without reseting users installed packages
+# (which would occur if the installed packages were in an
+# R-version derived directory).
+# If you wish to override this behavior you can do so using
+# the r-libs-user settings
+#r-libs-user=~/R/packages
+
+# You can set the default CRAN repository for the server
+# using the r-cran-repos setting
+#r-cran-repos=http://cran.case.edu/
diff --git a/sci-mathematics/rstudio/files/rstudio-0.97.318-linker_flags.patch b/sci-mathematics/rstudio/files/rstudio-0.97.318-linker_flags.patch
new file mode 100644
index 000000000000..a336fccbc981
--- /dev/null
+++ b/sci-mathematics/rstudio/files/rstudio-0.97.318-linker_flags.patch
@@ -0,0 +1,18 @@
+Some gcc hardening options were added, however since we add
+"-Wl,--as-needed" we end up with "-Wl,--as-needed;-Wl,-z,relro" which
+leads to linker errors about unknown options, if we make it so the
+as-needed option is the last option on the line, everything is fine.
+
+diff --git a/src/cpp/CMakeLists.txt b/src/cpp/CMakeLists.txt
+index 0589ca0..fe5bd5f 100644
+--- a/src/cpp/CMakeLists.txt
++++ b/src/cpp/CMakeLists.txt
+@@ -57,7 +57,7 @@ if(UNIX)
+ add_definitions(-D_FORTIFY_SOURCE=2)
+ add_definitions(-fstack-protector --param ssp-buffer-size=4)
+ add_definitions(-pie -fPIE)
+- set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-z,relro,-z,now")
++ set(CMAKE_EXE_LINKER_FLAGS "-Wl,-z,relro,-z,now ${CMAKE_EXE_LINKER_FLAGS}")
+ endif()
+
+ # Win32 specific global directives
diff --git a/sci-mathematics/rstudio/files/rstudio-0.97.318-paths.patch b/sci-mathematics/rstudio/files/rstudio-0.97.318-paths.patch
new file mode 100644
index 000000000000..26f11f5bfac5
--- /dev/null
+++ b/sci-mathematics/rstudio/files/rstudio-0.97.318-paths.patch
@@ -0,0 +1,110 @@
+change the install path, as by default everything is dumped right under
+the prefix. After fixing install paths, now fix the source so the
+program can find the moved resources.
+
+diff --git a/CMakeGlobals.txt b/CMakeGlobals.txt
+index da74970..1537bff 100644
+--- a/CMakeGlobals.txt
++++ b/CMakeGlobals.txt
+@@ -103,7 +103,7 @@ else()
+ else()
+ set(RSTUDIO_INSTALL_BIN bin)
+ endif()
+- set(RSTUDIO_INSTALL_SUPPORTING .)
++ set(RSTUDIO_INSTALL_SUPPORTING ${DISTRO_SHARE})
+ endif()
+
+ # if the install prefix is /usr/local then tweak as appropriate
+diff --git a/src/cpp/server/CMakeLists.txt b/src/cpp/server/CMakeLists.txt
+index af4db1c..96b767e 100644
+--- a/src/cpp/server/CMakeLists.txt
++++ b/src/cpp/server/CMakeLists.txt
+@@ -142,7 +142,7 @@ if (UNIX AND NOT APPLE)
+ configure_file(${CMAKE_CURRENT_SOURCE_DIR}/${RSERVER_INITD_DEBIAN_SCRIPT}.in
+ ${CMAKE_CURRENT_BINARY_DIR}/${RSERVER_INITD_DEBIAN_SCRIPT})
+ install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/${RSERVER_INITD_DEBIAN_SCRIPT}
+- DESTINATION ${RSERVER_INITD_DEBIAN_DIR})
++ DESTINATION ${DISTRO_SHARE}/${RSERVER_INITD_DEBIAN_DIR})
+
+ # install configured redhat init.d script
+ set(RSERVER_INITD_REDHAT_DIR "extras/init.d/redhat")
+@@ -150,7 +150,7 @@ if (UNIX AND NOT APPLE)
+ configure_file(${CMAKE_CURRENT_SOURCE_DIR}/${RSERVER_INITD_REDHAT_SCRIPT}.in
+ ${CMAKE_CURRENT_BINARY_DIR}/${RSERVER_INITD_REDHAT_SCRIPT})
+ install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/${RSERVER_INITD_REDHAT_SCRIPT}
+- DESTINATION ${RSERVER_INITD_REDHAT_DIR})
++ DESTINATION ${DISTRO_SHARE}/${RSERVER_INITD_REDHAT_DIR})
+
+ # install configured suse init.d script
+ set(RSERVER_INITD_SUSE_DIR "extras/init.d/suse")
+@@ -158,13 +158,13 @@ if (UNIX AND NOT APPLE)
+ configure_file(${CMAKE_CURRENT_SOURCE_DIR}/${RSERVER_INITD_SUSE_SCRIPT}.in
+ ${CMAKE_CURRENT_BINARY_DIR}/${RSERVER_INITD_SUSE_SCRIPT})
+ install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/${RSERVER_INITD_SUSE_SCRIPT}
+- DESTINATION ${RSERVER_INITD_SUSE_DIR})
++ DESTINATION ${DISTRO_SHARE}/${RSERVER_INITD_SUSE_DIR})
+
+ # install pam profile
+ set(RSERVER_PAM_DIR "extras/pam")
+ set(RSERVER_PAM_PROFILE "${RSERVER_PAM_DIR}/rstudio")
+ install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/${RSERVER_PAM_PROFILE}
+- DESTINATION ${RSERVER_PAM_DIR})
++ DESTINATION ${DISTRO_SHARE}/${RSERVER_PAM_DIR})
+
+ # install configured apparmor profile
+ set(RSERVER_APPARMOR_DIR "extras/apparmor")
+@@ -172,9 +172,9 @@ if (UNIX AND NOT APPLE)
+ configure_file(${CMAKE_CURRENT_SOURCE_DIR}/${RSERVER_APPARMOR_PROFILE}.in
+ ${CMAKE_CURRENT_BINARY_DIR}/${RSERVER_APPARMOR_PROFILE})
+ install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${RSERVER_APPARMOR_PROFILE}
+- DESTINATION ${RSERVER_APPARMOR_DIR})
++ DESTINATION ${DISTRO_SHARE}/${RSERVER_APPARMOR_DIR})
+ install(PROGRAMS ${CMAKE_CURRENT_SOURCE_DIR}/${RSERVER_APPARMOR_DIR}/apparmor-profile-load
+- DESTINATION ${RSERVER_APPARMOR_DIR})
++ DESTINATION ${DISTRO_SHARE}/${RSERVER_APPARMOR_DIR})
+
+ # install configured upstart profile
+ set(RSERVER_UPSTART_DIR "extras/upstart")
+@@ -182,6 +182,6 @@ if (UNIX AND NOT APPLE)
+ configure_file(${CMAKE_CURRENT_SOURCE_DIR}/${RSERVER_UPSTART_PROFILE}.in
+ ${CMAKE_CURRENT_BINARY_DIR}/${RSERVER_UPSTART_PROFILE})
+ install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${RSERVER_UPSTART_PROFILE}
+- DESTINATION ${RSERVER_UPSTART_DIR})
++ DESTINATION ${DISTRO_SHARE}/${RSERVER_UPSTART_DIR})
+
+ endif()
+diff --git a/src/cpp/server/ServerOptions.cpp b/src/cpp/server/ServerOptions.cpp
+index 77a63f1..f0d25f0 100644
+--- a/src/cpp/server/ServerOptions.cpp
++++ b/src/cpp/server/ServerOptions.cpp
+@@ -201,7 +201,7 @@ ProgramStatus Options::read(int argc, char * const argv[])
+
+ // convert relative paths by completing from the system installation
+ // path (this allows us to be relocatable)
+- resolvePath(installPath, &wwwLocalPath_);
++ resolvePath(installPath.childPath(DISTRO_SHARE), &wwwLocalPath_);
+ resolvePath(installPath, &authPamHelperPath_);
+ resolvePath(installPath, &rsessionPath_);
+ resolvePath(installPath, &rldpathPath_);
+diff --git a/src/cpp/session/SessionOptions.cpp b/src/cpp/session/SessionOptions.cpp
+index 0df1081..777cc6a 100644
+--- a/src/cpp/session/SessionOptions.cpp
++++ b/src/cpp/session/SessionOptions.cpp
+@@ -314,12 +314,12 @@ core::ProgramStatus Options::read(int argc, char * const argv[])
+ }
+
+ // convert relative paths by completing from the app resource path
+- resolvePath(resourcePath, &rResourcesPath_);
++ resolvePath(resourcePath.childPath(DISTRO_SHARE), &rResourcesPath_);
+ resolvePath(resourcePath, &agreementFilePath_);
+- resolvePath(resourcePath, &wwwLocalPath_);
+- resolvePath(resourcePath, &coreRSourcePath_);
+- resolvePath(resourcePath, &modulesRSourcePath_);
+- resolvePath(resourcePath, &sessionPackagesPath_);
++ resolvePath(resourcePath.childPath(DISTRO_SHARE), &wwwLocalPath_);
++ resolvePath(resourcePath.childPath(DISTRO_SHARE), &coreRSourcePath_);
++ resolvePath(resourcePath.childPath(DISTRO_SHARE), &modulesRSourcePath_);
++ resolvePath(resourcePath.childPath(DISTRO_SHARE), &sessionPackagesPath_);
+ resolvePostbackPath(resourcePath, &rpostbackPath_);
+ #ifdef _WIN32
+ resolvePath(resourcePath, &consoleIoPath_);
diff --git a/sci-mathematics/rstudio/files/rstudio-0.97.318-prefs.patch b/sci-mathematics/rstudio/files/rstudio-0.97.318-prefs.patch
new file mode 100644
index 000000000000..3175d47235ab
--- /dev/null
+++ b/sci-mathematics/rstudio/files/rstudio-0.97.318-prefs.patch
@@ -0,0 +1,24 @@
+And now we fix src/gwt/build.xml since java's user preference class is
+braindead and insists on writing where it is not allowed.
+much thanks to http://www.allaboutbalance.com/articles/disableprefs/
+
+diff --git a/src/gwt/build.xml b/src/gwt/build.xml
+index e7d2418..ae3a331 100644
+--- a/src/gwt/build.xml
++++ b/src/gwt/build.xml
+@@ -25,6 +25,7 @@
+ <property name="gwt.extra.args" value=""/>
+ <property name="gwt.main.module" value="org.rstudio.studio.RStudio"/>
+ <property name="ace.bin" value="src/org/rstudio/studio/client/workbench/views/source/editors/text/ace"/>
++ <property environment="env"/>
+
+ <path id="project.class.path">
+ <pathelement location="bin"/>
+@@ -109,6 +110,7 @@
+ </classpath>
+ <!-- add jvmarg -Xss16M or similar if you see a StackOverflowError -->
+ <jvmarg value="-Xmx1024M"/>
++ <jvmarg value="-Djava.util.prefs.userRoot=${env.T}"/>
+ <arg value="-war"/>
+ <arg value="www"/>
+ <arg value="-localWorkers"/>
diff --git a/sci-mathematics/rstudio/files/rstudio-0.97.336-boost-1.53.patch b/sci-mathematics/rstudio/files/rstudio-0.97.336-boost-1.53.patch
new file mode 100644
index 000000000000..38bb63a8ab61
--- /dev/null
+++ b/sci-mathematics/rstudio/files/rstudio-0.97.336-boost-1.53.patch
@@ -0,0 +1,64 @@
+=== modified file 'src/cpp/core/include/core/http/AsyncServer.hpp'
+--- src/cpp/core/include/core/http/AsyncServer.hpp 2013-07-09 12:02:58 +0000
++++ src/cpp/core/include/core/http/AsyncServer.hpp 2013-07-09 12:03:34 +0000
+@@ -264,7 +264,7 @@
+
+ // convert to cannonical HttpConnection
+ boost::shared_ptr<AsyncConnection> pAsyncConnection =
+- boost::shared_static_cast<AsyncConnection>(pConnection);
++ boost::static_pointer_cast<AsyncConnection>(pConnection);
+
+ // call the appropriate handler to generate a response
+ std::string uri = pRequest->uri();
+
+=== modified file 'src/cpp/core/include/core/http/LocalStreamAsyncClient.hpp'
+--- src/cpp/core/include/core/http/LocalStreamAsyncClient.hpp 2013-07-09 12:02:58 +0000
++++ src/cpp/core/include/core/http/LocalStreamAsyncClient.hpp 2013-07-09 12:03:36 +0000
+@@ -87,7 +87,7 @@
+ boost::shared_ptr<AsyncClient<boost::asio::local::stream_protocol::socket> >
+ ptrShared = shared_from_this();
+
+- return boost::shared_static_cast<LocalStreamAsyncClient>(ptrShared);
++ return boost::static_pointer_cast<LocalStreamAsyncClient>(ptrShared);
+ }
+
+ private:
+
+=== modified file 'src/cpp/core/include/core/http/TcpIpAsyncClient.hpp'
+--- src/cpp/core/include/core/http/TcpIpAsyncClient.hpp 2013-07-09 12:02:58 +0000
++++ src/cpp/core/include/core/http/TcpIpAsyncClient.hpp 2013-07-09 12:03:32 +0000
+@@ -74,7 +74,7 @@
+ boost::shared_ptr<AsyncClient<boost::asio::ip::tcp::socket> > ptrShared
+ = shared_from_this();
+
+- return boost::shared_static_cast<TcpIpAsyncClient>(ptrShared);
++ return boost::static_pointer_cast<TcpIpAsyncClient>(ptrShared);
+ }
+
+ private:
+
+=== modified file 'src/cpp/core/include/core/http/TcpIpAsyncClientSsl.hpp'
+--- src/cpp/core/include/core/http/TcpIpAsyncClientSsl.hpp 2013-07-09 12:02:58 +0000
++++ src/cpp/core/include/core/http/TcpIpAsyncClientSsl.hpp 2013-07-09 12:03:39 +0000
+@@ -109,7 +109,7 @@
+ boost::shared_ptr<AsyncClient<boost::asio::ssl::stream<boost::asio::ip::tcp::socket> > > ptrShared
+ = shared_from_this();
+
+- return boost::shared_static_cast<TcpIpAsyncClientSsl>(ptrShared);
++ return boost::static_pointer_cast<TcpIpAsyncClientSsl>(ptrShared);
+ }
+
+ virtual bool isShutdownError(const boost::system::error_code& ec)
+
+=== modified file 'src/cpp/session/http/SessionHttpConnectionListenerImpl.hpp'
+--- src/cpp/session/http/SessionHttpConnectionListenerImpl.hpp 2013-07-09 12:02:58 +0000
++++ src/cpp/session/http/SessionHttpConnectionListenerImpl.hpp 2013-07-09 12:03:29 +0000
+@@ -256,7 +256,7 @@
+ {
+ // convert to cannonical HttpConnection
+ boost::shared_ptr<HttpConnection> ptrHttpConnection =
+- boost::shared_static_cast<HttpConnection>(ptrConnection);
++ boost::static_pointer_cast<HttpConnection>(ptrConnection);
+
+ if (!authenticate(ptrHttpConnection))
+ {
diff --git a/sci-mathematics/rstudio/files/rstudio-0.97.336-linker_flags.patch b/sci-mathematics/rstudio/files/rstudio-0.97.336-linker_flags.patch
new file mode 100644
index 000000000000..a336fccbc981
--- /dev/null
+++ b/sci-mathematics/rstudio/files/rstudio-0.97.336-linker_flags.patch
@@ -0,0 +1,18 @@
+Some gcc hardening options were added, however since we add
+"-Wl,--as-needed" we end up with "-Wl,--as-needed;-Wl,-z,relro" which
+leads to linker errors about unknown options, if we make it so the
+as-needed option is the last option on the line, everything is fine.
+
+diff --git a/src/cpp/CMakeLists.txt b/src/cpp/CMakeLists.txt
+index 0589ca0..fe5bd5f 100644
+--- a/src/cpp/CMakeLists.txt
++++ b/src/cpp/CMakeLists.txt
+@@ -57,7 +57,7 @@ if(UNIX)
+ add_definitions(-D_FORTIFY_SOURCE=2)
+ add_definitions(-fstack-protector --param ssp-buffer-size=4)
+ add_definitions(-pie -fPIE)
+- set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-z,relro,-z,now")
++ set(CMAKE_EXE_LINKER_FLAGS "-Wl,-z,relro,-z,now ${CMAKE_EXE_LINKER_FLAGS}")
+ endif()
+
+ # Win32 specific global directives
diff --git a/sci-mathematics/rstudio/files/rstudio-0.97.336-paths.patch b/sci-mathematics/rstudio/files/rstudio-0.97.336-paths.patch
new file mode 100644
index 000000000000..7b44374a72d2
--- /dev/null
+++ b/sci-mathematics/rstudio/files/rstudio-0.97.336-paths.patch
@@ -0,0 +1,112 @@
+change the install path, as by default everything is dumped right under
+the prefix. After fixing install paths, now fix the source so the
+program can find the moved resources.
+
+diff --git a/CMakeGlobals.txt b/CMakeGlobals.txt
+index da74970..1537bff 100644
+--- a/CMakeGlobals.txt
++++ b/CMakeGlobals.txt
+@@ -103,7 +103,7 @@ else()
+ else()
+ set(RSTUDIO_INSTALL_BIN bin)
+ endif()
+- set(RSTUDIO_INSTALL_SUPPORTING .)
++ set(RSTUDIO_INSTALL_SUPPORTING ${DISTRO_SHARE})
+ endif()
+
+ # if the install prefix is /usr/local then tweak as appropriate
+diff --git a/src/cpp/server/CMakeLists.txt b/src/cpp/server/CMakeLists.txt
+index af4db1c..96b767e 100644
+--- a/src/cpp/server/CMakeLists.txt
++++ b/src/cpp/server/CMakeLists.txt
+@@ -142,7 +142,7 @@ if (UNIX AND NOT APPLE)
+ configure_file(${CMAKE_CURRENT_SOURCE_DIR}/${RSERVER_INITD_DEBIAN_SCRIPT}.in
+ ${CMAKE_CURRENT_BINARY_DIR}/${RSERVER_INITD_DEBIAN_SCRIPT})
+ install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/${RSERVER_INITD_DEBIAN_SCRIPT}
+- DESTINATION ${RSERVER_INITD_DEBIAN_DIR})
++ DESTINATION ${DISTRO_SHARE}/${RSERVER_INITD_DEBIAN_DIR})
+
+ # install configured redhat init.d script
+ set(RSERVER_INITD_REDHAT_DIR "extras/init.d/redhat")
+@@ -150,7 +150,7 @@ if (UNIX AND NOT APPLE)
+ configure_file(${CMAKE_CURRENT_SOURCE_DIR}/${RSERVER_INITD_REDHAT_SCRIPT}.in
+ ${CMAKE_CURRENT_BINARY_DIR}/${RSERVER_INITD_REDHAT_SCRIPT})
+ install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/${RSERVER_INITD_REDHAT_SCRIPT}
+- DESTINATION ${RSERVER_INITD_REDHAT_DIR})
++ DESTINATION ${DISTRO_SHARE}/${RSERVER_INITD_REDHAT_DIR})
+
+ # install configured suse init.d script
+ set(RSERVER_INITD_SUSE_DIR "extras/init.d/suse")
+@@ -158,13 +158,13 @@ if (UNIX AND NOT APPLE)
+ configure_file(${CMAKE_CURRENT_SOURCE_DIR}/${RSERVER_INITD_SUSE_SCRIPT}.in
+ ${CMAKE_CURRENT_BINARY_DIR}/${RSERVER_INITD_SUSE_SCRIPT})
+ install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/${RSERVER_INITD_SUSE_SCRIPT}
+- DESTINATION ${RSERVER_INITD_SUSE_DIR})
++ DESTINATION ${DISTRO_SHARE}/${RSERVER_INITD_SUSE_DIR})
+
+ # install pam profile
+ set(RSERVER_PAM_DIR "extras/pam")
+ set(RSERVER_PAM_PROFILE "${RSERVER_PAM_DIR}/rstudio")
+ install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/${RSERVER_PAM_PROFILE}
+- DESTINATION ${RSERVER_PAM_DIR})
++ DESTINATION ${DISTRO_SHARE}/${RSERVER_PAM_DIR})
+
+ # install configured apparmor profile
+ set(RSERVER_APPARMOR_DIR "extras/apparmor")
+@@ -172,9 +172,9 @@ if (UNIX AND NOT APPLE)
+ configure_file(${CMAKE_CURRENT_SOURCE_DIR}/${RSERVER_APPARMOR_PROFILE}.in
+ ${CMAKE_CURRENT_BINARY_DIR}/${RSERVER_APPARMOR_PROFILE})
+ install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${RSERVER_APPARMOR_PROFILE}
+- DESTINATION ${RSERVER_APPARMOR_DIR})
++ DESTINATION ${DISTRO_SHARE}/${RSERVER_APPARMOR_DIR})
+ install(PROGRAMS ${CMAKE_CURRENT_SOURCE_DIR}/${RSERVER_APPARMOR_DIR}/apparmor-profile-load
+- DESTINATION ${RSERVER_APPARMOR_DIR})
++ DESTINATION ${DISTRO_SHARE}/${RSERVER_APPARMOR_DIR})
+
+ # install configured upstart profile
+ set(RSERVER_UPSTART_DIR "extras/upstart")
+@@ -182,6 +182,6 @@ if (UNIX AND NOT APPLE)
+ configure_file(${CMAKE_CURRENT_SOURCE_DIR}/${RSERVER_UPSTART_PROFILE}.in
+ ${CMAKE_CURRENT_BINARY_DIR}/${RSERVER_UPSTART_PROFILE})
+ install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${RSERVER_UPSTART_PROFILE}
+- DESTINATION ${RSERVER_UPSTART_DIR})
++ DESTINATION ${DISTRO_SHARE}/${RSERVER_UPSTART_DIR})
+
+ endif()
+diff --git a/src/cpp/server/ServerOptions.cpp b/src/cpp/server/ServerOptions.cpp
+index 77a63f1..f0d25f0 100644
+--- a/src/cpp/server/ServerOptions.cpp
++++ b/src/cpp/server/ServerOptions.cpp
+@@ -201,7 +201,7 @@ ProgramStatus Options::read(int argc, char * const argv[])
+
+ // convert relative paths by completing from the system installation
+ // path (this allows us to be relocatable)
+- resolvePath(installPath, &wwwLocalPath_);
++ resolvePath(installPath.childPath(DISTRO_SHARE), &wwwLocalPath_);
+ resolvePath(installPath, &authPamHelperPath_);
+ resolvePath(installPath, &rsessionPath_);
+ resolvePath(installPath, &rldpathPath_);
+diff --git a/src/cpp/session/SessionOptions.cpp b/src/cpp/session/SessionOptions.cpp
+index 0df1081..777cc6a 100644
+--- a/src/cpp/session/SessionOptions.cpp
++++ b/src/cpp/session/SessionOptions.cpp
+@@ -333,12 +333,12 @@ core::ProgramStatus Options::read(int argc, char * const argv[])
+
+ // convert relative paths by completing from the app resource path
+- resolvePath(resourcePath, &rResourcesPath_);
++ resolvePath(resourcePath.childPath(DISTRO_SHARE), &rResourcesPath_);
+ resolvePath(resourcePath, &agreementFilePath_);
+- resolvePath(resourcePath, &wwwLocalPath_);
+- resolvePath(resourcePath, &coreRSourcePath_);
+- resolvePath(resourcePath, &modulesRSourcePath_);
+- resolvePath(resourcePath, &sessionLibraryPath_);
+- resolvePath(resourcePath, &sessionPackagesPath_);
++ resolvePath(resourcePath.childPath(DISTRO_SHARE), &wwwLocalPath_);
++ resolvePath(resourcePath.childPath(DISTRO_SHARE), &coreRSourcePath_);
++ resolvePath(resourcePath.childPath(DISTRO_SHARE), &modulesRSourcePath_);
++ resolvePath(resourcePath.childPath(DISTRO_SHARE), &sessionLibraryPath_);
++ resolvePath(resourcePath.childPath(DISTRO_SHARE), &sessionPackagesPath_);
+ resolvePostbackPath(resourcePath, &rpostbackPath_);
+ #ifdef _WIN32
+ resolvePath(resourcePath, &consoleIoPath_);
+
diff --git a/sci-mathematics/rstudio/files/rstudio-0.97.336-prefs.patch b/sci-mathematics/rstudio/files/rstudio-0.97.336-prefs.patch
new file mode 100644
index 000000000000..3175d47235ab
--- /dev/null
+++ b/sci-mathematics/rstudio/files/rstudio-0.97.336-prefs.patch
@@ -0,0 +1,24 @@
+And now we fix src/gwt/build.xml since java's user preference class is
+braindead and insists on writing where it is not allowed.
+much thanks to http://www.allaboutbalance.com/articles/disableprefs/
+
+diff --git a/src/gwt/build.xml b/src/gwt/build.xml
+index e7d2418..ae3a331 100644
+--- a/src/gwt/build.xml
++++ b/src/gwt/build.xml
+@@ -25,6 +25,7 @@
+ <property name="gwt.extra.args" value=""/>
+ <property name="gwt.main.module" value="org.rstudio.studio.RStudio"/>
+ <property name="ace.bin" value="src/org/rstudio/studio/client/workbench/views/source/editors/text/ace"/>
++ <property environment="env"/>
+
+ <path id="project.class.path">
+ <pathelement location="bin"/>
+@@ -109,6 +110,7 @@
+ </classpath>
+ <!-- add jvmarg -Xss16M or similar if you see a StackOverflowError -->
+ <jvmarg value="-Xmx1024M"/>
++ <jvmarg value="-Djava.util.prefs.userRoot=${env.T}"/>
+ <arg value="-war"/>
+ <arg value="www"/>
+ <arg value="-localWorkers"/>
diff --git a/sci-mathematics/rstudio/files/rstudio-0.97.551-boost-1.53.patch b/sci-mathematics/rstudio/files/rstudio-0.97.551-boost-1.53.patch
new file mode 100644
index 000000000000..38bb63a8ab61
--- /dev/null
+++ b/sci-mathematics/rstudio/files/rstudio-0.97.551-boost-1.53.patch
@@ -0,0 +1,64 @@
+=== modified file 'src/cpp/core/include/core/http/AsyncServer.hpp'
+--- src/cpp/core/include/core/http/AsyncServer.hpp 2013-07-09 12:02:58 +0000
++++ src/cpp/core/include/core/http/AsyncServer.hpp 2013-07-09 12:03:34 +0000
+@@ -264,7 +264,7 @@
+
+ // convert to cannonical HttpConnection
+ boost::shared_ptr<AsyncConnection> pAsyncConnection =
+- boost::shared_static_cast<AsyncConnection>(pConnection);
++ boost::static_pointer_cast<AsyncConnection>(pConnection);
+
+ // call the appropriate handler to generate a response
+ std::string uri = pRequest->uri();
+
+=== modified file 'src/cpp/core/include/core/http/LocalStreamAsyncClient.hpp'
+--- src/cpp/core/include/core/http/LocalStreamAsyncClient.hpp 2013-07-09 12:02:58 +0000
++++ src/cpp/core/include/core/http/LocalStreamAsyncClient.hpp 2013-07-09 12:03:36 +0000
+@@ -87,7 +87,7 @@
+ boost::shared_ptr<AsyncClient<boost::asio::local::stream_protocol::socket> >
+ ptrShared = shared_from_this();
+
+- return boost::shared_static_cast<LocalStreamAsyncClient>(ptrShared);
++ return boost::static_pointer_cast<LocalStreamAsyncClient>(ptrShared);
+ }
+
+ private:
+
+=== modified file 'src/cpp/core/include/core/http/TcpIpAsyncClient.hpp'
+--- src/cpp/core/include/core/http/TcpIpAsyncClient.hpp 2013-07-09 12:02:58 +0000
++++ src/cpp/core/include/core/http/TcpIpAsyncClient.hpp 2013-07-09 12:03:32 +0000
+@@ -74,7 +74,7 @@
+ boost::shared_ptr<AsyncClient<boost::asio::ip::tcp::socket> > ptrShared
+ = shared_from_this();
+
+- return boost::shared_static_cast<TcpIpAsyncClient>(ptrShared);
++ return boost::static_pointer_cast<TcpIpAsyncClient>(ptrShared);
+ }
+
+ private:
+
+=== modified file 'src/cpp/core/include/core/http/TcpIpAsyncClientSsl.hpp'
+--- src/cpp/core/include/core/http/TcpIpAsyncClientSsl.hpp 2013-07-09 12:02:58 +0000
++++ src/cpp/core/include/core/http/TcpIpAsyncClientSsl.hpp 2013-07-09 12:03:39 +0000
+@@ -109,7 +109,7 @@
+ boost::shared_ptr<AsyncClient<boost::asio::ssl::stream<boost::asio::ip::tcp::socket> > > ptrShared
+ = shared_from_this();
+
+- return boost::shared_static_cast<TcpIpAsyncClientSsl>(ptrShared);
++ return boost::static_pointer_cast<TcpIpAsyncClientSsl>(ptrShared);
+ }
+
+ virtual bool isShutdownError(const boost::system::error_code& ec)
+
+=== modified file 'src/cpp/session/http/SessionHttpConnectionListenerImpl.hpp'
+--- src/cpp/session/http/SessionHttpConnectionListenerImpl.hpp 2013-07-09 12:02:58 +0000
++++ src/cpp/session/http/SessionHttpConnectionListenerImpl.hpp 2013-07-09 12:03:29 +0000
+@@ -256,7 +256,7 @@
+ {
+ // convert to cannonical HttpConnection
+ boost::shared_ptr<HttpConnection> ptrHttpConnection =
+- boost::shared_static_cast<HttpConnection>(ptrConnection);
++ boost::static_pointer_cast<HttpConnection>(ptrConnection);
+
+ if (!authenticate(ptrHttpConnection))
+ {
diff --git a/sci-mathematics/rstudio/files/rstudio-0.97.551-linker_flags.patch b/sci-mathematics/rstudio/files/rstudio-0.97.551-linker_flags.patch
new file mode 100644
index 000000000000..a336fccbc981
--- /dev/null
+++ b/sci-mathematics/rstudio/files/rstudio-0.97.551-linker_flags.patch
@@ -0,0 +1,18 @@
+Some gcc hardening options were added, however since we add
+"-Wl,--as-needed" we end up with "-Wl,--as-needed;-Wl,-z,relro" which
+leads to linker errors about unknown options, if we make it so the
+as-needed option is the last option on the line, everything is fine.
+
+diff --git a/src/cpp/CMakeLists.txt b/src/cpp/CMakeLists.txt
+index 0589ca0..fe5bd5f 100644
+--- a/src/cpp/CMakeLists.txt
++++ b/src/cpp/CMakeLists.txt
+@@ -57,7 +57,7 @@ if(UNIX)
+ add_definitions(-D_FORTIFY_SOURCE=2)
+ add_definitions(-fstack-protector --param ssp-buffer-size=4)
+ add_definitions(-pie -fPIE)
+- set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-z,relro,-z,now")
++ set(CMAKE_EXE_LINKER_FLAGS "-Wl,-z,relro,-z,now ${CMAKE_EXE_LINKER_FLAGS}")
+ endif()
+
+ # Win32 specific global directives
diff --git a/sci-mathematics/rstudio/files/rstudio-0.97.551-paths.patch b/sci-mathematics/rstudio/files/rstudio-0.97.551-paths.patch
new file mode 100644
index 000000000000..7b44374a72d2
--- /dev/null
+++ b/sci-mathematics/rstudio/files/rstudio-0.97.551-paths.patch
@@ -0,0 +1,112 @@
+change the install path, as by default everything is dumped right under
+the prefix. After fixing install paths, now fix the source so the
+program can find the moved resources.
+
+diff --git a/CMakeGlobals.txt b/CMakeGlobals.txt
+index da74970..1537bff 100644
+--- a/CMakeGlobals.txt
++++ b/CMakeGlobals.txt
+@@ -103,7 +103,7 @@ else()
+ else()
+ set(RSTUDIO_INSTALL_BIN bin)
+ endif()
+- set(RSTUDIO_INSTALL_SUPPORTING .)
++ set(RSTUDIO_INSTALL_SUPPORTING ${DISTRO_SHARE})
+ endif()
+
+ # if the install prefix is /usr/local then tweak as appropriate
+diff --git a/src/cpp/server/CMakeLists.txt b/src/cpp/server/CMakeLists.txt
+index af4db1c..96b767e 100644
+--- a/src/cpp/server/CMakeLists.txt
++++ b/src/cpp/server/CMakeLists.txt
+@@ -142,7 +142,7 @@ if (UNIX AND NOT APPLE)
+ configure_file(${CMAKE_CURRENT_SOURCE_DIR}/${RSERVER_INITD_DEBIAN_SCRIPT}.in
+ ${CMAKE_CURRENT_BINARY_DIR}/${RSERVER_INITD_DEBIAN_SCRIPT})
+ install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/${RSERVER_INITD_DEBIAN_SCRIPT}
+- DESTINATION ${RSERVER_INITD_DEBIAN_DIR})
++ DESTINATION ${DISTRO_SHARE}/${RSERVER_INITD_DEBIAN_DIR})
+
+ # install configured redhat init.d script
+ set(RSERVER_INITD_REDHAT_DIR "extras/init.d/redhat")
+@@ -150,7 +150,7 @@ if (UNIX AND NOT APPLE)
+ configure_file(${CMAKE_CURRENT_SOURCE_DIR}/${RSERVER_INITD_REDHAT_SCRIPT}.in
+ ${CMAKE_CURRENT_BINARY_DIR}/${RSERVER_INITD_REDHAT_SCRIPT})
+ install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/${RSERVER_INITD_REDHAT_SCRIPT}
+- DESTINATION ${RSERVER_INITD_REDHAT_DIR})
++ DESTINATION ${DISTRO_SHARE}/${RSERVER_INITD_REDHAT_DIR})
+
+ # install configured suse init.d script
+ set(RSERVER_INITD_SUSE_DIR "extras/init.d/suse")
+@@ -158,13 +158,13 @@ if (UNIX AND NOT APPLE)
+ configure_file(${CMAKE_CURRENT_SOURCE_DIR}/${RSERVER_INITD_SUSE_SCRIPT}.in
+ ${CMAKE_CURRENT_BINARY_DIR}/${RSERVER_INITD_SUSE_SCRIPT})
+ install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/${RSERVER_INITD_SUSE_SCRIPT}
+- DESTINATION ${RSERVER_INITD_SUSE_DIR})
++ DESTINATION ${DISTRO_SHARE}/${RSERVER_INITD_SUSE_DIR})
+
+ # install pam profile
+ set(RSERVER_PAM_DIR "extras/pam")
+ set(RSERVER_PAM_PROFILE "${RSERVER_PAM_DIR}/rstudio")
+ install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/${RSERVER_PAM_PROFILE}
+- DESTINATION ${RSERVER_PAM_DIR})
++ DESTINATION ${DISTRO_SHARE}/${RSERVER_PAM_DIR})
+
+ # install configured apparmor profile
+ set(RSERVER_APPARMOR_DIR "extras/apparmor")
+@@ -172,9 +172,9 @@ if (UNIX AND NOT APPLE)
+ configure_file(${CMAKE_CURRENT_SOURCE_DIR}/${RSERVER_APPARMOR_PROFILE}.in
+ ${CMAKE_CURRENT_BINARY_DIR}/${RSERVER_APPARMOR_PROFILE})
+ install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${RSERVER_APPARMOR_PROFILE}
+- DESTINATION ${RSERVER_APPARMOR_DIR})
++ DESTINATION ${DISTRO_SHARE}/${RSERVER_APPARMOR_DIR})
+ install(PROGRAMS ${CMAKE_CURRENT_SOURCE_DIR}/${RSERVER_APPARMOR_DIR}/apparmor-profile-load
+- DESTINATION ${RSERVER_APPARMOR_DIR})
++ DESTINATION ${DISTRO_SHARE}/${RSERVER_APPARMOR_DIR})
+
+ # install configured upstart profile
+ set(RSERVER_UPSTART_DIR "extras/upstart")
+@@ -182,6 +182,6 @@ if (UNIX AND NOT APPLE)
+ configure_file(${CMAKE_CURRENT_SOURCE_DIR}/${RSERVER_UPSTART_PROFILE}.in
+ ${CMAKE_CURRENT_BINARY_DIR}/${RSERVER_UPSTART_PROFILE})
+ install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${RSERVER_UPSTART_PROFILE}
+- DESTINATION ${RSERVER_UPSTART_DIR})
++ DESTINATION ${DISTRO_SHARE}/${RSERVER_UPSTART_DIR})
+
+ endif()
+diff --git a/src/cpp/server/ServerOptions.cpp b/src/cpp/server/ServerOptions.cpp
+index 77a63f1..f0d25f0 100644
+--- a/src/cpp/server/ServerOptions.cpp
++++ b/src/cpp/server/ServerOptions.cpp
+@@ -201,7 +201,7 @@ ProgramStatus Options::read(int argc, char * const argv[])
+
+ // convert relative paths by completing from the system installation
+ // path (this allows us to be relocatable)
+- resolvePath(installPath, &wwwLocalPath_);
++ resolvePath(installPath.childPath(DISTRO_SHARE), &wwwLocalPath_);
+ resolvePath(installPath, &authPamHelperPath_);
+ resolvePath(installPath, &rsessionPath_);
+ resolvePath(installPath, &rldpathPath_);
+diff --git a/src/cpp/session/SessionOptions.cpp b/src/cpp/session/SessionOptions.cpp
+index 0df1081..777cc6a 100644
+--- a/src/cpp/session/SessionOptions.cpp
++++ b/src/cpp/session/SessionOptions.cpp
+@@ -333,12 +333,12 @@ core::ProgramStatus Options::read(int argc, char * const argv[])
+
+ // convert relative paths by completing from the app resource path
+- resolvePath(resourcePath, &rResourcesPath_);
++ resolvePath(resourcePath.childPath(DISTRO_SHARE), &rResourcesPath_);
+ resolvePath(resourcePath, &agreementFilePath_);
+- resolvePath(resourcePath, &wwwLocalPath_);
+- resolvePath(resourcePath, &coreRSourcePath_);
+- resolvePath(resourcePath, &modulesRSourcePath_);
+- resolvePath(resourcePath, &sessionLibraryPath_);
+- resolvePath(resourcePath, &sessionPackagesPath_);
++ resolvePath(resourcePath.childPath(DISTRO_SHARE), &wwwLocalPath_);
++ resolvePath(resourcePath.childPath(DISTRO_SHARE), &coreRSourcePath_);
++ resolvePath(resourcePath.childPath(DISTRO_SHARE), &modulesRSourcePath_);
++ resolvePath(resourcePath.childPath(DISTRO_SHARE), &sessionLibraryPath_);
++ resolvePath(resourcePath.childPath(DISTRO_SHARE), &sessionPackagesPath_);
+ resolvePostbackPath(resourcePath, &rpostbackPath_);
+ #ifdef _WIN32
+ resolvePath(resourcePath, &consoleIoPath_);
+
diff --git a/sci-mathematics/rstudio/files/rstudio-0.97.551-prefs.patch b/sci-mathematics/rstudio/files/rstudio-0.97.551-prefs.patch
new file mode 100644
index 000000000000..3175d47235ab
--- /dev/null
+++ b/sci-mathematics/rstudio/files/rstudio-0.97.551-prefs.patch
@@ -0,0 +1,24 @@
+And now we fix src/gwt/build.xml since java's user preference class is
+braindead and insists on writing where it is not allowed.
+much thanks to http://www.allaboutbalance.com/articles/disableprefs/
+
+diff --git a/src/gwt/build.xml b/src/gwt/build.xml
+index e7d2418..ae3a331 100644
+--- a/src/gwt/build.xml
++++ b/src/gwt/build.xml
+@@ -25,6 +25,7 @@
+ <property name="gwt.extra.args" value=""/>
+ <property name="gwt.main.module" value="org.rstudio.studio.RStudio"/>
+ <property name="ace.bin" value="src/org/rstudio/studio/client/workbench/views/source/editors/text/ace"/>
++ <property environment="env"/>
+
+ <path id="project.class.path">
+ <pathelement location="bin"/>
+@@ -109,6 +110,7 @@
+ </classpath>
+ <!-- add jvmarg -Xss16M or similar if you see a StackOverflowError -->
+ <jvmarg value="-Xmx1024M"/>
++ <jvmarg value="-Djava.util.prefs.userRoot=${env.T}"/>
+ <arg value="-war"/>
+ <arg value="www"/>
+ <arg value="-localWorkers"/>
diff --git a/sci-mathematics/rstudio/files/rstudio-0.98.1091-boost-1.57.patch b/sci-mathematics/rstudio/files/rstudio-0.98.1091-boost-1.57.patch
new file mode 100644
index 000000000000..3a157183c22c
--- /dev/null
+++ b/sci-mathematics/rstudio/files/rstudio-0.98.1091-boost-1.57.patch
@@ -0,0 +1,60 @@
+--- rstudio-0.98.1091-orig/src/cpp/desktop/DesktopApplicationLaunch.hpp 2014-11-06 23:15:47.000000000 +1100
++++ rstudio-0.98.1091/src/cpp/desktop/DesktopApplicationLaunch.hpp 2015-02-28 14:01:51.970672316 +1100
+@@ -19,7 +19,10 @@
+ #include <QObject>
+ #include <QWidget>
+ #include <QApplication>
++// see https://bugreports.qt-project.org/browse/QTBUG-22829
++#ifndef Q_MOC_RUN
+ #include <boost/scoped_ptr.hpp>
++#endif
+
+ namespace desktop {
+
+--- rstudio-0.98.1091-orig/src/cpp/desktop/DesktopSessionLauncher.hpp 2014-11-06 23:15:47.000000000 +1100
++++ rstudio-0.98.1091/src/cpp/desktop/DesktopSessionLauncher.hpp 2015-02-28 14:01:51.972672316 +1100
+@@ -18,7 +18,10 @@
+
+ #include <string>
+
++// see https://bugreports.qt-project.org/browse/QTBUG-22829
++#ifndef Q_MOC_RUN
+ #include <boost/utility.hpp>
++#endif
+
+ #include <core/Error.hpp>
+ #include <core/FilePath.hpp>
+--- rstudio-0.98.1091-orig/src/cpp/core/include/core/FilePath.hpp 2014-11-06 23:15:47.000000000 +1100
++++ rstudio-0.98.1091/src/cpp/core/include/core/FilePath.hpp 2015-02-28 14:01:51.984672314 +1100
+@@ -23,11 +23,14 @@
+ #include <vector>
+ #include <iosfwd>
+
++// see https://bugreports.qt-project.org/browse/QTBUG-22829
++#ifndef Q_MOC_RUN
+ #include <boost/shared_ptr.hpp>
+ #include <boost/scoped_ptr.hpp>
+ #include <boost/function.hpp>
+
+ #include <boost/utility.hpp>
++#endif
+
+ #include <core/Error.hpp>
+ #include <core/Log.hpp>
+--- rstudio-0.98.1091-orig/src/cpp/core/include/core/Error.hpp 2014-11-06 23:15:47.000000000 +1100
++++ rstudio-0.98.1091/src/cpp/core/include/core/Error.hpp 2015-02-28 14:01:51.977672315 +1100
+@@ -20,11 +20,14 @@
+ #include <string>
+ #include <vector>
+
++// see https://bugreports.qt-project.org/browse/QTBUG-22829
++#ifndef Q_MOC_RUN
+ #include <boost/shared_ptr.hpp>
+
+ #include <boost/system/error_code.hpp>
+
+ #include <boost/current_function.hpp>
++#endif
+
+ namespace core {
+
diff --git a/sci-mathematics/rstudio/files/rstudio-0.98.1091-pandoc.patch b/sci-mathematics/rstudio/files/rstudio-0.98.1091-pandoc.patch
new file mode 100644
index 000000000000..3df8d1a986a3
--- /dev/null
+++ b/sci-mathematics/rstudio/files/rstudio-0.98.1091-pandoc.patch
@@ -0,0 +1,26 @@
+--- rstudio-0.98.1091-orig/src/cpp/session/CMakeLists.txt 2014-11-06 23:15:47.000000000 +1100
++++ rstudio-0.98.1091/src/cpp/session/CMakeLists.txt 2014-11-26 17:12:42.699712510 +1100
+@@ -25,9 +25,6 @@
+ if(NOT EXISTS "${RSTUDIO_DEPENDENCIES_DIR}/common/mathjax-23")
+ message(FATAL_ERROR "Mathjax 2.3 not found (re-run install-dependencies script to install)")
+ endif()
+-if(NOT EXISTS "${RSTUDIO_DEPENDENCIES_DIR}/common/pandoc")
+- message(FATAL_ERROR "pandoc not found (re-run install-dependencies script to install)")
+-endif()
+ if(NOT EXISTS "${RSTUDIO_DEPENDENCIES_DIR}/common/rmarkdown")
+ message(FATAL_ERROR "rmarkdown package not found (re-run install-dependencies script to install)")
+ endif()
+@@ -343,13 +340,6 @@
+ install(DIRECTORY "${RSTUDIO_DEPENDENCIES_DIR}/common/mathjax-23"
+ DESTINATION "${RSTUDIO_INSTALL_SUPPORTING}/resources")
+
+- # install pandoc
+- set(PANDOC_BIN "${RSTUDIO_DEPENDENCIES_DIR}/common/pandoc/1.12.4.2")
+- file(GLOB PANDOC_FILES "${PANDOC_BIN}/pandoc*")
+- install(FILES ${PANDOC_FILES}
+- PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE
+- DESTINATION ${RSTUDIO_INSTALL_BIN}/pandoc)
+-
+ # install rmarkdown package
+ file(GLOB RMARKDOWN_PACKAGE "${RSTUDIO_DEPENDENCIES_DIR}/common/rmarkdown*.tar.gz")
+ install(FILES ${RMARKDOWN_PACKAGE}
diff --git a/sci-mathematics/rstudio/files/rstudio-0.98.490-linker_flags.patch b/sci-mathematics/rstudio/files/rstudio-0.98.490-linker_flags.patch
new file mode 100644
index 000000000000..a336fccbc981
--- /dev/null
+++ b/sci-mathematics/rstudio/files/rstudio-0.98.490-linker_flags.patch
@@ -0,0 +1,18 @@
+Some gcc hardening options were added, however since we add
+"-Wl,--as-needed" we end up with "-Wl,--as-needed;-Wl,-z,relro" which
+leads to linker errors about unknown options, if we make it so the
+as-needed option is the last option on the line, everything is fine.
+
+diff --git a/src/cpp/CMakeLists.txt b/src/cpp/CMakeLists.txt
+index 0589ca0..fe5bd5f 100644
+--- a/src/cpp/CMakeLists.txt
++++ b/src/cpp/CMakeLists.txt
+@@ -57,7 +57,7 @@ if(UNIX)
+ add_definitions(-D_FORTIFY_SOURCE=2)
+ add_definitions(-fstack-protector --param ssp-buffer-size=4)
+ add_definitions(-pie -fPIE)
+- set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-z,relro,-z,now")
++ set(CMAKE_EXE_LINKER_FLAGS "-Wl,-z,relro,-z,now ${CMAKE_EXE_LINKER_FLAGS}")
+ endif()
+
+ # Win32 specific global directives
diff --git a/sci-mathematics/rstudio/files/rstudio-0.98.490-paths.patch b/sci-mathematics/rstudio/files/rstudio-0.98.490-paths.patch
new file mode 100644
index 000000000000..d28ad5cb0752
--- /dev/null
+++ b/sci-mathematics/rstudio/files/rstudio-0.98.490-paths.patch
@@ -0,0 +1,120 @@
+diff --git a/CMakeGlobals.txt b/CMakeGlobals.txt
+index cc10191..f75b85a 100644
+--- a/CMakeGlobals.txt
++++ b/CMakeGlobals.txt
+@@ -105,7 +105,7 @@ else()
+ else()
+ set(RSTUDIO_INSTALL_BIN bin)
+ endif()
+- set(RSTUDIO_INSTALL_SUPPORTING .)
++ set(RSTUDIO_INSTALL_SUPPORTING ${DISTRO_SHARE})
+ endif()
+
+ # if the install prefix is /usr/local then tweak as appropriate
+diff --git a/src/cpp/server/CMakeLists.txt b/src/cpp/server/CMakeLists.txt
+index 184e514..d09aac5 100644
+--- a/src/cpp/server/CMakeLists.txt
++++ b/src/cpp/server/CMakeLists.txt
+@@ -145,7 +145,7 @@ if (UNIX AND NOT APPLE)
+ configure_file(${CMAKE_CURRENT_SOURCE_DIR}/${RSERVER_INITD_DEBIAN_SCRIPT}.in
+ ${CMAKE_CURRENT_BINARY_DIR}/${RSERVER_INITD_DEBIAN_SCRIPT})
+ install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/${RSERVER_INITD_DEBIAN_SCRIPT}
+- DESTINATION ${RSERVER_INITD_DEBIAN_DIR})
++ DESTINATION ${DISTRO_SHARE}/${RSERVER_INITD_DEBIAN_DIR})
+
+ # install configured redhat init.d script
+ set(RSERVER_INITD_REDHAT_DIR "extras/init.d/redhat")
+@@ -153,7 +153,7 @@ if (UNIX AND NOT APPLE)
+ configure_file(${CMAKE_CURRENT_SOURCE_DIR}/${RSERVER_INITD_REDHAT_SCRIPT}.in
+ ${CMAKE_CURRENT_BINARY_DIR}/${RSERVER_INITD_REDHAT_SCRIPT})
+ install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/${RSERVER_INITD_REDHAT_SCRIPT}
+- DESTINATION ${RSERVER_INITD_REDHAT_DIR})
++ DESTINATION ${DISTRO_SHARE}/${RSERVER_INITD_REDHAT_DIR})
+
+ # install configured suse init.d script
+ set(RSERVER_INITD_SUSE_DIR "extras/init.d/suse")
+@@ -161,13 +161,13 @@ if (UNIX AND NOT APPLE)
+ configure_file(${CMAKE_CURRENT_SOURCE_DIR}/${RSERVER_INITD_SUSE_SCRIPT}.in
+ ${CMAKE_CURRENT_BINARY_DIR}/${RSERVER_INITD_SUSE_SCRIPT})
+ install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/${RSERVER_INITD_SUSE_SCRIPT}
+- DESTINATION ${RSERVER_INITD_SUSE_DIR})
++ DESTINATION ${DISTRO_SHARE}/${RSERVER_INITD_SUSE_DIR})
+
+ # install pam profile
+ set(RSERVER_PAM_DIR "extras/pam")
+ set(RSERVER_PAM_PROFILE "${RSERVER_PAM_DIR}/rstudio")
+ install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/${RSERVER_PAM_PROFILE}
+- DESTINATION ${RSERVER_PAM_DIR})
++ DESTINATION ${DISTRO_SHARE}/${RSERVER_PAM_DIR})
+
+ # install configured apparmor profile
+ set(RSERVER_APPARMOR_DIR "extras/apparmor")
+@@ -175,9 +175,9 @@ if (UNIX AND NOT APPLE)
+ configure_file(${CMAKE_CURRENT_SOURCE_DIR}/${RSERVER_APPARMOR_PROFILE}.in
+ ${CMAKE_CURRENT_BINARY_DIR}/${RSERVER_APPARMOR_PROFILE})
+ install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${RSERVER_APPARMOR_PROFILE}
+- DESTINATION ${RSERVER_APPARMOR_DIR})
++ DESTINATION ${DISTRO_SHARE}/${RSERVER_APPARMOR_DIR})
+ install(PROGRAMS ${CMAKE_CURRENT_SOURCE_DIR}/${RSERVER_APPARMOR_DIR}/apparmor-profile-load
+- DESTINATION ${RSERVER_APPARMOR_DIR})
++ DESTINATION ${DISTRO_SHARE}/${RSERVER_APPARMOR_DIR})
+
+ # install configured upstart profile
+ set(RSERVER_UPSTART_DIR "extras/upstart")
+@@ -185,12 +185,12 @@ if (UNIX AND NOT APPLE)
+ configure_file(${CMAKE_CURRENT_SOURCE_DIR}/${RSERVER_UPSTART_PROFILE}.in
+ ${CMAKE_CURRENT_BINARY_DIR}/${RSERVER_UPSTART_PROFILE})
+ install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${RSERVER_UPSTART_PROFILE}
+- DESTINATION ${RSERVER_UPSTART_DIR})
++ DESTINATION ${DISTRO_SHARE}/${RSERVER_UPSTART_DIR})
+ set(RSERVER_UPSTART_PROFILE_REDHAT "${RSERVER_UPSTART_DIR}/rstudio-server.redhat.conf")
+ configure_file(${CMAKE_CURRENT_SOURCE_DIR}/${RSERVER_UPSTART_PROFILE_REDHAT}.in
+ ${CMAKE_CURRENT_BINARY_DIR}/${RSERVER_UPSTART_PROFILE_REDHAT})
+ install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${RSERVER_UPSTART_PROFILE_REDHAT}
+- DESTINATION ${RSERVER_UPSTART_DIR})
++ DESTINATION ${DISTRO_SHARE}/${RSERVER_UPSTART_DIR})
+
+ endif()
+
+diff --git a/src/cpp/server/ServerOptions.cpp b/src/cpp/server/ServerOptions.cpp
+index 1eaf7c0..4b25fa1 100644
+--- a/src/cpp/server/ServerOptions.cpp
++++ b/src/cpp/server/ServerOptions.cpp
+@@ -307,8 +307,8 @@ ProgramStatus Options::read(int argc,
+
+ // convert relative paths by completing from the system installation
+ // path (this allows us to be relocatable)
+- resolvePath(resourcePath, &wwwLocalPath_);
+- resolvePath(resourcePath, &wwwSymbolMapsPath_);
++ resolvePath(resourcePath.childPath(DISTRO_SHARE), &wwwLocalPath_);
++ resolvePath(resourcePath.childPath(DISTRO_SHARE), &wwwSymbolMapsPath_);
+ resolvePath(binaryPath, &authPamHelperPath_);
+ resolvePath(binaryPath, &rsessionPath_);
+ resolvePath(binaryPath, &rldpathPath_);
+diff --git a/src/cpp/session/SessionOptions.cpp b/src/cpp/session/SessionOptions.cpp
+index 44b3d55..a48cdb6 100644
+--- a/src/cpp/session/SessionOptions.cpp
++++ b/src/cpp/session/SessionOptions.cpp
+@@ -357,14 +357,14 @@ core::ProgramStatus Options::read(int argc, char * const argv[])
+ timeoutMinutes_ = 0;
+
+ // convert relative paths by completing from the app resource path
+- resolvePath(resourcePath, &rResourcesPath_);
+- resolvePath(resourcePath, &agreementFilePath_);
+- resolvePath(resourcePath, &wwwLocalPath_);
+- resolvePath(resourcePath, &wwwSymbolMapsPath_);
+- resolvePath(resourcePath, &coreRSourcePath_);
+- resolvePath(resourcePath, &modulesRSourcePath_);
+- resolvePath(resourcePath, &sessionLibraryPath_);
+- resolvePath(resourcePath, &sessionPackagesPath_);
++ resolvePath(resourcePath.childPath(DISTRO_SHARE), &rResourcesPath_);
++ resolvePath(resourcePath.childPath(DISTRO_SHARE), &agreementFilePath_);
++ resolvePath(resourcePath.childPath(DISTRO_SHARE), &wwwLocalPath_);
++ resolvePath(resourcePath.childPath(DISTRO_SHARE), &coreRSourcePath_);
++ resolvePath(resourcePath.childPath(DISTRO_SHARE), &modulesRSourcePath_);
++ resolvePath(resourcePath.childPath(DISTRO_SHARE), &sessionLibraryPath_);
++ resolvePath(resourcePath.childPath(DISTRO_SHARE), &sessionPackagesPath_);
++ resolvePath(resourcePath.childPath(DISTRO_SHARE), &wwwSymbolMapsPath_);
+ resolvePostbackPath(resourcePath, &rpostbackPath_);
+ #ifdef _WIN32
+ resolvePath(resourcePath, &consoleIoPath_);
diff --git a/sci-mathematics/rstudio/files/rstudio-0.98.490-prefs.patch b/sci-mathematics/rstudio/files/rstudio-0.98.490-prefs.patch
new file mode 100644
index 000000000000..3175d47235ab
--- /dev/null
+++ b/sci-mathematics/rstudio/files/rstudio-0.98.490-prefs.patch
@@ -0,0 +1,24 @@
+And now we fix src/gwt/build.xml since java's user preference class is
+braindead and insists on writing where it is not allowed.
+much thanks to http://www.allaboutbalance.com/articles/disableprefs/
+
+diff --git a/src/gwt/build.xml b/src/gwt/build.xml
+index e7d2418..ae3a331 100644
+--- a/src/gwt/build.xml
++++ b/src/gwt/build.xml
+@@ -25,6 +25,7 @@
+ <property name="gwt.extra.args" value=""/>
+ <property name="gwt.main.module" value="org.rstudio.studio.RStudio"/>
+ <property name="ace.bin" value="src/org/rstudio/studio/client/workbench/views/source/editors/text/ace"/>
++ <property environment="env"/>
+
+ <path id="project.class.path">
+ <pathelement location="bin"/>
+@@ -109,6 +110,7 @@
+ </classpath>
+ <!-- add jvmarg -Xss16M or similar if you see a StackOverflowError -->
+ <jvmarg value="-Xmx1024M"/>
++ <jvmarg value="-Djava.util.prefs.userRoot=${env.T}"/>
+ <arg value="-war"/>
+ <arg value="www"/>
+ <arg value="-localWorkers"/>
diff --git a/sci-mathematics/rstudio/files/rstudio-0.98.932-pandoc.patch b/sci-mathematics/rstudio/files/rstudio-0.98.932-pandoc.patch
new file mode 100644
index 000000000000..d2b6911eabb8
--- /dev/null
+++ b/sci-mathematics/rstudio/files/rstudio-0.98.932-pandoc.patch
@@ -0,0 +1,25 @@
+--- a/src/cpp/session/CMakeLists.txt
++++ b/src/cpp/session/CMakeLists.txt
+@@ -25,9 +25,6 @@
+ if(NOT EXISTS "${RSTUDIO_DEPENDENCIES_DIR}/common/mathjax")
+ message(FATAL_ERROR "Mathjax not found (re-run install-dependencies script to install)")
+ endif()
+-if(NOT EXISTS "${RSTUDIO_DEPENDENCIES_DIR}/common/pandoc")
+- message(FATAL_ERROR "pandoc not found (re-run install-dependencies script to install)")
+-endif()
+ if(NOT EXISTS "${RSTUDIO_DEPENDENCIES_DIR}/common/rmarkdown")
+ message(FATAL_ERROR "rmarkdown package not found (re-run install-dependencies script to install)")
+ endif()
+@@ -337,12 +334,6 @@
+ install(DIRECTORY "${RSTUDIO_DEPENDENCIES_DIR}/common/mathjax"
+ DESTINATION "${RSTUDIO_INSTALL_SUPPORTING}/resources")
+
+- # install pandoc
+- set(PANDOC_BIN "${RSTUDIO_DEPENDENCIES_DIR}/common/pandoc/1.12.3")
+- file(GLOB PANDOC_FILES "${PANDOC_BIN}/pandoc*")
+- install(PROGRAMS ${PANDOC_FILES}
+- DESTINATION ${RSTUDIO_INSTALL_BIN}/pandoc)
+-
+ # install rmarkdown package
+ file(GLOB RMARKDOWN_PACKAGE "${RSTUDIO_DEPENDENCIES_DIR}/common/rmarkdown*.tar.gz")
+ install(FILES ${RMARKDOWN_PACKAGE}
diff --git a/sci-mathematics/rstudio/files/rstudio-0.98.932-paths.patch b/sci-mathematics/rstudio/files/rstudio-0.98.932-paths.patch
new file mode 100644
index 000000000000..d4bb4249f1a6
--- /dev/null
+++ b/sci-mathematics/rstudio/files/rstudio-0.98.932-paths.patch
@@ -0,0 +1,140 @@
+diff --git a/CMakeGlobals.txt b/CMakeGlobals.txt
+index cc10191..f75b85a 100644
+--- a/CMakeGlobals.txt
++++ b/CMakeGlobals.txt
+@@ -105,7 +105,7 @@ else()
+ else()
+ set(RSTUDIO_INSTALL_BIN bin)
+ endif()
+- set(RSTUDIO_INSTALL_SUPPORTING .)
++ set(RSTUDIO_INSTALL_SUPPORTING ${DISTRO_SHARE})
+ endif()
+
+ # if the install prefix is /usr/local then tweak as appropriate
+diff --git a/src/cpp/server/CMakeLists.txt b/src/cpp/server/CMakeLists.txt
+index 184e514..d09aac5 100644
+--- a/src/cpp/server/CMakeLists.txt
++++ b/src/cpp/server/CMakeLists.txt
+@@ -145,7 +145,7 @@ if (UNIX AND NOT APPLE)
+ configure_file(${CMAKE_CURRENT_SOURCE_DIR}/${RSERVER_INITD_DEBIAN_SCRIPT}.in
+ ${CMAKE_CURRENT_BINARY_DIR}/${RSERVER_INITD_DEBIAN_SCRIPT})
+ install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/${RSERVER_INITD_DEBIAN_SCRIPT}
+- DESTINATION ${RSERVER_INITD_DEBIAN_DIR})
++ DESTINATION ${DISTRO_SHARE}/${RSERVER_INITD_DEBIAN_DIR})
+
+ # install configured redhat init.d script
+ set(RSERVER_INITD_REDHAT_DIR "extras/init.d/redhat")
+@@ -153,7 +153,7 @@ if (UNIX AND NOT APPLE)
+ configure_file(${CMAKE_CURRENT_SOURCE_DIR}/${RSERVER_INITD_REDHAT_SCRIPT}.in
+ ${CMAKE_CURRENT_BINARY_DIR}/${RSERVER_INITD_REDHAT_SCRIPT})
+ install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/${RSERVER_INITD_REDHAT_SCRIPT}
+- DESTINATION ${RSERVER_INITD_REDHAT_DIR})
++ DESTINATION ${DISTRO_SHARE}/${RSERVER_INITD_REDHAT_DIR})
+
+ # install configured suse init.d script
+ set(RSERVER_INITD_SUSE_DIR "extras/init.d/suse")
+@@ -161,13 +161,13 @@ if (UNIX AND NOT APPLE)
+ configure_file(${CMAKE_CURRENT_SOURCE_DIR}/${RSERVER_INITD_SUSE_SCRIPT}.in
+ ${CMAKE_CURRENT_BINARY_DIR}/${RSERVER_INITD_SUSE_SCRIPT})
+ install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/${RSERVER_INITD_SUSE_SCRIPT}
+- DESTINATION ${RSERVER_INITD_SUSE_DIR})
++ DESTINATION ${DISTRO_SHARE}/${RSERVER_INITD_SUSE_DIR})
+
+ # install pam profile
+ set(RSERVER_PAM_DIR "extras/pam")
+ set(RSERVER_PAM_PROFILE "${RSERVER_PAM_DIR}/rstudio")
+ install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/${RSERVER_PAM_PROFILE}
+- DESTINATION ${RSERVER_PAM_DIR})
++ DESTINATION ${DISTRO_SHARE}/${RSERVER_PAM_DIR})
+
+ # install configured apparmor profile
+ set(RSERVER_APPARMOR_DIR "extras/apparmor")
+@@ -175,9 +175,9 @@ if (UNIX AND NOT APPLE)
+ configure_file(${CMAKE_CURRENT_SOURCE_DIR}/${RSERVER_APPARMOR_PROFILE}.in
+ ${CMAKE_CURRENT_BINARY_DIR}/${RSERVER_APPARMOR_PROFILE})
+ install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${RSERVER_APPARMOR_PROFILE}
+- DESTINATION ${RSERVER_APPARMOR_DIR})
++ DESTINATION ${DISTRO_SHARE}/${RSERVER_APPARMOR_DIR})
+ install(PROGRAMS ${CMAKE_CURRENT_SOURCE_DIR}/${RSERVER_APPARMOR_DIR}/apparmor-profile-load
+- DESTINATION ${RSERVER_APPARMOR_DIR})
++ DESTINATION ${DISTRO_SHARE}/${RSERVER_APPARMOR_DIR})
+
+ # install configured upstart profile
+ set(RSERVER_UPSTART_DIR "extras/upstart")
+@@ -185,12 +185,12 @@ if (UNIX AND NOT APPLE)
+ configure_file(${CMAKE_CURRENT_SOURCE_DIR}/${RSERVER_UPSTART_PROFILE}.in
+ ${CMAKE_CURRENT_BINARY_DIR}/${RSERVER_UPSTART_PROFILE})
+ install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${RSERVER_UPSTART_PROFILE}
+- DESTINATION ${RSERVER_UPSTART_DIR})
++ DESTINATION ${DISTRO_SHARE}/${RSERVER_UPSTART_DIR})
+ set(RSERVER_UPSTART_PROFILE_REDHAT "${RSERVER_UPSTART_DIR}/rstudio-server.redhat.conf")
+ configure_file(${CMAKE_CURRENT_SOURCE_DIR}/${RSERVER_UPSTART_PROFILE_REDHAT}.in
+ ${CMAKE_CURRENT_BINARY_DIR}/${RSERVER_UPSTART_PROFILE_REDHAT})
+ install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${RSERVER_UPSTART_PROFILE_REDHAT}
+- DESTINATION ${RSERVER_UPSTART_DIR})
++ DESTINATION ${DISTRO_SHARE}/${RSERVER_UPSTART_DIR})
+
+ endif()
+
+diff --git a/src/cpp/server/ServerOptions.cpp b/src/cpp/server/ServerOptions.cpp
+index 1eaf7c0..4b25fa1 100644
+--- a/src/cpp/server/ServerOptions.cpp
++++ b/src/cpp/server/ServerOptions.cpp
+@@ -307,8 +307,8 @@ ProgramStatus Options::read(int argc,
+
+ // convert relative paths by completing from the system installation
+ // path (this allows us to be relocatable)
+- resolvePath(resourcePath, &wwwLocalPath_);
+- resolvePath(resourcePath, &wwwSymbolMapsPath_);
++ resolvePath(resourcePath.childPath(DISTRO_SHARE), &wwwLocalPath_);
++ resolvePath(resourcePath.childPath(DISTRO_SHARE), &wwwSymbolMapsPath_);
+ resolvePath(binaryPath, &authPamHelperPath_);
+ resolvePath(binaryPath, &rsessionPath_);
+ resolvePath(binaryPath, &rldpathPath_);
+diff --git a/src/cpp/session/SessionOptions.cpp b/src/cpp/session/SessionOptions.cpp
+index 44b3d55..a48cdb6 100644
+--- a/src/cpp/session/SessionOptions.cpp
++++ b/src/cpp/session/SessionOptions.cpp
+@@ -40,7 +40,7 @@
+ namespace session {
+
+ namespace {
+-const char* const kDefaultPandocPath = "bin/pandoc";
++const char* const kDefaultPandocPath = "bin";
+ const char* const kDefaultPostbackPath = "bin/postback/rpostback";
+ } // anonymous namespace
+
+@@ -392,15 +392,15 @@
+ }
+
+ // convert relative paths by completing from the app resource path
+- resolvePath(resourcePath, &rResourcesPath_);
+- resolvePath(resourcePath, &agreementFilePath_);
+- resolvePath(resourcePath, &wwwLocalPath_);
+- resolvePath(resourcePath, &wwwSymbolMapsPath_);
+- resolvePath(resourcePath, &coreRSourcePath_);
+- resolvePath(resourcePath, &modulesRSourcePath_);
+- resolvePath(resourcePath, &sessionLibraryPath_);
+- resolvePath(resourcePath, &sessionPackagesPath_);
+- resolvePath(resourcePath, &sessionPackageArchivesPath_);
++ resolvePath(resourcePath.childPath(DISTRO_SHARE), &rResourcesPath_);
++ resolvePath(resourcePath.childPath(DISTRO_SHARE), &agreementFilePath_);
++ resolvePath(resourcePath.childPath(DISTRO_SHARE), &wwwLocalPath_);
++ resolvePath(resourcePath.childPath(DISTRO_SHARE), &coreRSourcePath_);
++ resolvePath(resourcePath.childPath(DISTRO_SHARE), &modulesRSourcePath_);
++ resolvePath(resourcePath.childPath(DISTRO_SHARE), &sessionLibraryPath_);
++ resolvePath(resourcePath.childPath(DISTRO_SHARE), &sessionPackagesPath_);
++ resolvePath(resourcePath.childPath(DISTRO_SHARE), &sessionPackageArchivesPath_);
++ resolvePath(resourcePath.childPath(DISTRO_SHARE), &wwwSymbolMapsPath_);
+ resolvePostbackPath(resourcePath, &rpostbackPath_);
+ #ifdef _WIN32
+ resolvePath(resourcePath, &consoleIoPath_);
+@@ -409,7 +409,7 @@
+ resolvePath(resourcePath, &msysSshPath_);
+ resolvePath(resourcePath, &sumatraPath_);
+ #endif
+- resolvePath(resourcePath, &hunspellDictionariesPath_);
++ resolvePath(resourcePath.childPath(DISTRO_SHARE), &hunspellDictionariesPath_);
+ resolvePath(resourcePath, &mathjaxPath_);
+ resolvePandocPath(resourcePath, &pandocPath_);
+
diff --git a/sci-mathematics/rstudio/files/rstudio-server.conf b/sci-mathematics/rstudio/files/rstudio-server.conf
new file mode 100644
index 000000000000..ebf1a1649169
--- /dev/null
+++ b/sci-mathematics/rstudio/files/rstudio-server.conf
@@ -0,0 +1,35 @@
+###########rstudio-server.conf#############
+
+# www-port entry corresponding to the port you want RStudio to listen on
+#www-port=80
+
+
+# By default RStudio binds to address 0.0.0.0 (accepting connections
+# from any remote IP). You can modify this behavior using the
+# www-address entry.
+#www-address=127.0.0.1
+
+
+# You can add elements to the default LD_LIBRARY_PATH for R
+# sessions (as determined by the R ldpaths script) by adding
+# an rsession-ld-library-path entry to the server config file.
+# This might be useful for ensuring that packages can
+# locate external library dependencies that aren't installed
+# in the system standard library paths
+#rsession-ld-library-path=/opt/local/lib:/opt/local/someapp/lib
+
+
+#By default RStudio Server runs against the version of R which
+# is found on the system PATH (using which R). You can override
+# which version of R is used via the rsession-which-r setting
+# in the server config file. For example, if you have two
+# versions of R installed on the server and want to make sure
+# the one at /usr/local/bin/R is used by RStudio then you would use:
+rsession-which-r=/usr/bin/R
+
+########ADDITIONALAL#########
+
+# To limit the users who can login to RStudio to the members
+# of a specific group, you use the auth-required-user-group
+# setting
+auth-required-user-group=rstudio_users
diff --git a/sci-mathematics/rstudio/files/rstudio-server.initd b/sci-mathematics/rstudio/files/rstudio-server.initd
new file mode 100644
index 000000000000..e6ca6b942bb9
--- /dev/null
+++ b/sci-mathematics/rstudio/files/rstudio-server.initd
@@ -0,0 +1,15 @@
+#!/sbin/runscript
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+start() {
+ ebegin "Starting RStudio Server"
+ start-stop-daemon --start --quiet --exec /usr/bin/rserver
+ eend $?
+}
+
+stop() {
+ ebegin "Stopping RStudio Server"
+ start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5 --name /usr/bin/rserver
+ eend $?
+}
diff --git a/sci-mathematics/rstudio/metadata.xml b/sci-mathematics/rstudio/metadata.xml
new file mode 100644
index 000000000000..ba90cdbe1e84
--- /dev/null
+++ b/sci-mathematics/rstudio/metadata.xml
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <maintainer>
+ <email>gienah@gentoo.org</email>
+ <name>Mark Wright</name>
+ </maintainer>
+ <longdescription lang="en">
+ RStudio is an integrated development environment (IDE) for R. It can
+ run it on a desktop or even over the web using RStudio Server.
+</longdescription>
+ <use>
+ <flag name="server">Build and install the RStudio server</flag>
+ </use>
+ <upstream>
+ <remote-id type="github">rstudio/rstudio</remote-id>
+ </upstream>
+</pkgmetadata>
diff --git a/sci-mathematics/rstudio/rstudio-0.97.336.ebuild b/sci-mathematics/rstudio/rstudio-0.97.336.ebuild
new file mode 100644
index 000000000000..f473f63dd0fe
--- /dev/null
+++ b/sci-mathematics/rstudio/rstudio-0.97.336.ebuild
@@ -0,0 +1,141 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+inherit eutils user cmake-utils gnome2-utils pam versionator fdo-mime java-pkg-2 pax-utils
+
+# TODO
+# * package gin and gwt
+# * use dict from tree, linguas
+# * do src_test (use junit from tree?)
+# * fix the about/help/menu and get rid of license
+
+GWTVER=2.5.0.rc1
+GINVER=1.5
+
+DESCRIPTION="IDE for the R language"
+HOMEPAGE="http://www.rstudio.org"
+SRC_URI="https://github.com/rstudio/rstudio/archive/v${PV}.tar.gz -> ${P}.tar.gz
+ https://s3.amazonaws.com/rstudio-buildtools/gin-${GINVER}.zip
+ https://s3.amazonaws.com/rstudio-buildtools/gwt-${GWTVER}.zip
+ https://s3.amazonaws.com/rstudio-dictionaries/core-dictionaries.zip"
+
+LICENSE="AGPL-3"
+SLOT="0"
+KEYWORDS="~amd64 ~x86 ~amd64-linux ~x86-linux"
+IUSE="dedicated server"
+
+QTVER=4.8
+QTSLOT=4
+RDEPEND=">=dev-lang/R-2.11.1
+ >=dev-libs/boost-1.50:=
+ dev-libs/mathjax
+ dev-libs/openssl:0
+ >=virtual/jre-1.5:=
+ x11-libs/pango
+ !dedicated? (
+ >=dev-qt/qtcore-${QTVER}:${QTSLOT}
+ >=dev-qt/qtdbus-${QTVER}:${QTSLOT}
+ >=dev-qt/qtgui-${QTVER}:${QTSLOT}
+ >=dev-qt/qtwebkit-${QTVER}:${QTSLOT}
+ >=dev-qt/qtxmlpatterns-${QTVER}:${QTSLOT}
+ server? ( virtual/pam )
+ )
+ dedicated? ( virtual/pam )"
+DEPEND="${RDEPEND}
+ app-arch/unzip
+ dev-java/ant-core
+ >=virtual/jdk-1.5
+ virtual/pkgconfig"
+# test? ( dev-java/junit:4 )
+
+src_unpack() {
+ unpack ${P}.tar.gz gwt-${GWTVER}.zip
+ cd "${S}" || die
+ mkdir -p src/gwt/lib/{gin,gwt} dependencies/common/dictionaries || die
+ mv ../gwt-${GWTVER} src/gwt/lib/gwt/${GWTVER} || die
+ unzip -qd src/gwt/lib/gin/${GINVER} "${DISTDIR}"/gin-${GINVER}.zip || die
+ unzip -qd dependencies/common/dictionaries "${DISTDIR}"/core-dictionaries.zip || die
+}
+
+src_prepare() {
+ java-pkg-2_src_prepare
+
+ find . -name .gitignore -delete || die
+
+ epatch "${FILESDIR}"/${P}-prefs.patch \
+ "${FILESDIR}"/${P}-paths.patch \
+ "${FILESDIR}"/${P}-linker_flags.patch \
+ "${FILESDIR}"/${P}-boost-1.53.patch
+
+ # Adding -DDISTRO_SHARE=... to append-flags breaks cmake so using
+ # this sed hack for now. ~RMH
+ sed -i \
+ -e "s|DISTRO_SHARE|\"share/${PN}\"|g" \
+ src/cpp/server/ServerOptions.cpp \
+ src/cpp/session/SessionOptions.cpp || die
+
+ # use mathjax from system
+ ln -sf "${EPREFIX}"/usr/share/mathjax dependencies/common/mathjax || die
+
+ # make sure icons and mime stuff are with prefix
+ sed -i \
+ -e "s:/usr:${EPREFIX}/usr:g" \
+ CMakeGlobals.txt src/cpp/desktop/CMakeLists.txt || die
+
+ # specify that namespace core the is in the global namespace and not
+ # relative to some other namespace (like its ::core not ::boost::core)
+ find . \( -name *.cpp -or -name *.hpp \) -exec sed \
+ -e 's@<core::@< ::core::@g' -e 's@\([^:]\)core::@\1::core::@g' -i {} \;
+}
+
+src_configure() {
+ export RSTUDIO_VERSION_MAJOR=$(get_version_component_range 1)
+ export RSTUDIO_VERSION_MINOR=$(get_version_component_range 2)
+ export RSTUDIO_VERSION_PATCH=$(get_version_component_range 3)
+
+ local mycmakeargs=(
+ -DDISTRO_SHARE=share/${PN}
+ $(cmake-utils_use !dedicated RSTUDIO_INSTALL_FREEDESKTOP)
+ -DRSTUDIO_TARGET=$(usex dedicated "Server" "$(usex server "All" "Desktop")")
+ )
+
+ cmake-utils_src_configure
+}
+
+src_compile() {
+ cmake-utils_src_compile
+}
+
+src_install() {
+ cmake-utils_src_install
+ pax-mark m "${ED}usr/bin/rstudio"
+ if use dedicated || use server; then
+ dopamd src/cpp/server/extras/pam/rstudio
+ newinitd "${FILESDIR}"/rstudio-server.initd rstudio-server
+ fi
+}
+
+pkg_preinst() {
+ use dedicated || gnome2_icon_savelist
+ java-pkg-2_pkg_preinst
+}
+
+pkg_postinst() {
+ use dedicated || { fdo-mime_desktop_database_update
+ fdo-mime_mime_database_update
+ gnome2_icon_cache_update ;}
+
+ if use dedicated || use server; then
+ enewgroup rstudio-server
+ enewuser rstudio-server -1 -1 -1 rstudio-server
+ fi
+}
+
+pkg_postrm() {
+ use dedicated || { fdo-mime_desktop_database_update
+ fdo-mime_mime_database_update
+ gnome2_icon_cache_update ;}
+}
diff --git a/sci-mathematics/rstudio/rstudio-0.97.551.ebuild b/sci-mathematics/rstudio/rstudio-0.97.551.ebuild
new file mode 100644
index 000000000000..f473f63dd0fe
--- /dev/null
+++ b/sci-mathematics/rstudio/rstudio-0.97.551.ebuild
@@ -0,0 +1,141 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+inherit eutils user cmake-utils gnome2-utils pam versionator fdo-mime java-pkg-2 pax-utils
+
+# TODO
+# * package gin and gwt
+# * use dict from tree, linguas
+# * do src_test (use junit from tree?)
+# * fix the about/help/menu and get rid of license
+
+GWTVER=2.5.0.rc1
+GINVER=1.5
+
+DESCRIPTION="IDE for the R language"
+HOMEPAGE="http://www.rstudio.org"
+SRC_URI="https://github.com/rstudio/rstudio/archive/v${PV}.tar.gz -> ${P}.tar.gz
+ https://s3.amazonaws.com/rstudio-buildtools/gin-${GINVER}.zip
+ https://s3.amazonaws.com/rstudio-buildtools/gwt-${GWTVER}.zip
+ https://s3.amazonaws.com/rstudio-dictionaries/core-dictionaries.zip"
+
+LICENSE="AGPL-3"
+SLOT="0"
+KEYWORDS="~amd64 ~x86 ~amd64-linux ~x86-linux"
+IUSE="dedicated server"
+
+QTVER=4.8
+QTSLOT=4
+RDEPEND=">=dev-lang/R-2.11.1
+ >=dev-libs/boost-1.50:=
+ dev-libs/mathjax
+ dev-libs/openssl:0
+ >=virtual/jre-1.5:=
+ x11-libs/pango
+ !dedicated? (
+ >=dev-qt/qtcore-${QTVER}:${QTSLOT}
+ >=dev-qt/qtdbus-${QTVER}:${QTSLOT}
+ >=dev-qt/qtgui-${QTVER}:${QTSLOT}
+ >=dev-qt/qtwebkit-${QTVER}:${QTSLOT}
+ >=dev-qt/qtxmlpatterns-${QTVER}:${QTSLOT}
+ server? ( virtual/pam )
+ )
+ dedicated? ( virtual/pam )"
+DEPEND="${RDEPEND}
+ app-arch/unzip
+ dev-java/ant-core
+ >=virtual/jdk-1.5
+ virtual/pkgconfig"
+# test? ( dev-java/junit:4 )
+
+src_unpack() {
+ unpack ${P}.tar.gz gwt-${GWTVER}.zip
+ cd "${S}" || die
+ mkdir -p src/gwt/lib/{gin,gwt} dependencies/common/dictionaries || die
+ mv ../gwt-${GWTVER} src/gwt/lib/gwt/${GWTVER} || die
+ unzip -qd src/gwt/lib/gin/${GINVER} "${DISTDIR}"/gin-${GINVER}.zip || die
+ unzip -qd dependencies/common/dictionaries "${DISTDIR}"/core-dictionaries.zip || die
+}
+
+src_prepare() {
+ java-pkg-2_src_prepare
+
+ find . -name .gitignore -delete || die
+
+ epatch "${FILESDIR}"/${P}-prefs.patch \
+ "${FILESDIR}"/${P}-paths.patch \
+ "${FILESDIR}"/${P}-linker_flags.patch \
+ "${FILESDIR}"/${P}-boost-1.53.patch
+
+ # Adding -DDISTRO_SHARE=... to append-flags breaks cmake so using
+ # this sed hack for now. ~RMH
+ sed -i \
+ -e "s|DISTRO_SHARE|\"share/${PN}\"|g" \
+ src/cpp/server/ServerOptions.cpp \
+ src/cpp/session/SessionOptions.cpp || die
+
+ # use mathjax from system
+ ln -sf "${EPREFIX}"/usr/share/mathjax dependencies/common/mathjax || die
+
+ # make sure icons and mime stuff are with prefix
+ sed -i \
+ -e "s:/usr:${EPREFIX}/usr:g" \
+ CMakeGlobals.txt src/cpp/desktop/CMakeLists.txt || die
+
+ # specify that namespace core the is in the global namespace and not
+ # relative to some other namespace (like its ::core not ::boost::core)
+ find . \( -name *.cpp -or -name *.hpp \) -exec sed \
+ -e 's@<core::@< ::core::@g' -e 's@\([^:]\)core::@\1::core::@g' -i {} \;
+}
+
+src_configure() {
+ export RSTUDIO_VERSION_MAJOR=$(get_version_component_range 1)
+ export RSTUDIO_VERSION_MINOR=$(get_version_component_range 2)
+ export RSTUDIO_VERSION_PATCH=$(get_version_component_range 3)
+
+ local mycmakeargs=(
+ -DDISTRO_SHARE=share/${PN}
+ $(cmake-utils_use !dedicated RSTUDIO_INSTALL_FREEDESKTOP)
+ -DRSTUDIO_TARGET=$(usex dedicated "Server" "$(usex server "All" "Desktop")")
+ )
+
+ cmake-utils_src_configure
+}
+
+src_compile() {
+ cmake-utils_src_compile
+}
+
+src_install() {
+ cmake-utils_src_install
+ pax-mark m "${ED}usr/bin/rstudio"
+ if use dedicated || use server; then
+ dopamd src/cpp/server/extras/pam/rstudio
+ newinitd "${FILESDIR}"/rstudio-server.initd rstudio-server
+ fi
+}
+
+pkg_preinst() {
+ use dedicated || gnome2_icon_savelist
+ java-pkg-2_pkg_preinst
+}
+
+pkg_postinst() {
+ use dedicated || { fdo-mime_desktop_database_update
+ fdo-mime_mime_database_update
+ gnome2_icon_cache_update ;}
+
+ if use dedicated || use server; then
+ enewgroup rstudio-server
+ enewuser rstudio-server -1 -1 -1 rstudio-server
+ fi
+}
+
+pkg_postrm() {
+ use dedicated || { fdo-mime_desktop_database_update
+ fdo-mime_mime_database_update
+ gnome2_icon_cache_update ;}
+}
diff --git a/sci-mathematics/rstudio/rstudio-0.98.1028.ebuild b/sci-mathematics/rstudio/rstudio-0.98.1028.ebuild
new file mode 100644
index 000000000000..d836f0673361
--- /dev/null
+++ b/sci-mathematics/rstudio/rstudio-0.98.1028.ebuild
@@ -0,0 +1,162 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+inherit eutils cmake-utils gnome2-utils versionator fdo-mime java-pkg-2 pax-utils
+
+# TODO
+# * package gin and gwt
+# * use dict from tree, linguas
+# * do src_test (use junit from tree?)
+
+# update from scripts in dependencies/common
+GWTVER=2.6.0
+GINVER=1.5
+SELENIUMVER=2.37.0
+CHROMEDRIVER_VER=2.7
+PANDOC_VER=1.12.3
+PACKRAT_VER=0.3.0
+RMARKDOWN_VER=0.2.49
+
+DESCRIPTION="IDE for the R language"
+HOMEPAGE="http://www.rstudio.org
+ https://github.com/rstudio/rstudio/"
+SRC_URI="https://github.com/rstudio/rstudio/archive/v${PV}.tar.gz -> ${P}.tar.gz
+ https://s3.amazonaws.com/rstudio-buildtools/gin-${GINVER}.zip
+ https://s3.amazonaws.com/rstudio-buildtools/gwt-${GWTVER}.zip
+ https://s3.amazonaws.com/rstudio-buildtools/selenium-java-${SELENIUMVER}.zip
+ https://s3.amazonaws.com/rstudio-buildtools/selenium-server-standalone-${SELENIUMVER}.jar
+ https://s3.amazonaws.com/rstudio-buildtools/chromedriver-linux
+ https://s3.amazonaws.com/rstudio-dictionaries/core-dictionaries.zip
+ http://dev.gentoo.org/~hasufell/distfiles/packrat_${PACKRAT_VER}.tar.gz
+ http://dev.gentoo.org/~hasufell/distfiles/rmarkdown_${RMARKDOWN_VER}.tar.gz"
+
+LICENSE="AGPL-3"
+SLOT="0"
+KEYWORDS="~amd64 ~x86 ~amd64-linux ~x86-linux"
+IUSE=""
+
+QTVER=4.8
+QTSLOT=4
+RDEPEND="
+ app-text/pandoc
+ dev-haskell/pandoc-citeproc
+ >=dev-lang/R-2.11.1
+ >=dev-libs/boost-1.50
+ dev-libs/mathjax
+ dev-libs/openssl:0
+ sys-apps/util-linux
+ sys-libs/zlib
+ >=virtual/jre-1.5:=
+ x11-libs/pango
+ >=dev-qt/qtcore-${QTVER}:${QTSLOT}
+ >=dev-qt/qtdbus-${QTVER}:${QTSLOT}
+ >=dev-qt/qtgui-${QTVER}:${QTSLOT}
+ >=dev-qt/qtwebkit-${QTVER}:${QTSLOT}
+ >=dev-qt/qtxmlpatterns-${QTVER}:${QTSLOT}"
+DEPEND="${RDEPEND}
+ app-arch/unzip
+ dev-java/ant-core
+ >=virtual/jdk-1.5
+ virtual/pkgconfig"
+# test? ( dev-java/junit:4 )
+
+src_unpack() {
+ unpack ${P}.tar.gz gwt-${GWTVER}.zip
+ cd "${S}" || die
+ mkdir -p src/gwt/lib/{gin,gwt} \
+ dependencies/common/dictionaries \
+ src/gwt/lib/selenium/${SELENIUMVER} \
+ src/gwt/lib/selenium/chromedriver/${CHROMEDRIVER_VER} || die
+ mv ../gwt-${GWTVER} src/gwt/lib/gwt/${GWTVER} || die
+ unzip -qd src/gwt/lib/gin/${GINVER} \
+ "${DISTDIR}"/gin-${GINVER}.zip || die
+ unzip -qd dependencies/common/dictionaries \
+ "${DISTDIR}"/core-dictionaries.zip || die
+ unzip -qd src/gwt/lib/selenium/${SELENIUMVER} \
+ "${DISTDIR}"/selenium-java-${SELENIUMVER}.zip || die
+ cp "${DISTDIR}"/selenium-server-standalone-${SELENIUMVER}.jar \
+ src/gwt/lib/selenium/${SELENIUMVER}/ || die
+ cp "${DISTDIR}"/chromedriver-linux \
+ src/gwt/lib/selenium/chromedriver/${CHROMEDRIVER_VER}/ || die
+ cd dependencies/common || die
+ unpack packrat_${PACKRAT_VER}.tar.gz
+ unpack rmarkdown_${RMARKDOWN_VER}.tar.gz
+ cp "${DISTDIR}"/rmarkdown_${RMARKDOWN_VER}.tar.gz \
+ . || die
+ cp "${DISTDIR}"/packrat_${PACKRAT_VER}.tar.gz \
+ . || die
+}
+
+src_prepare() {
+ java-pkg-2_src_prepare
+
+ find . -name .gitignore -delete || die
+
+ epatch "${FILESDIR}"/${PN}-0.98.490-prefs.patch \
+ "${FILESDIR}"/${PN}-0.98.932-paths.patch \
+ "${FILESDIR}"/${PN}-0.98.932-pandoc.patch \
+ "${FILESDIR}"/${PN}-0.98.490-linker_flags.patch
+
+ # Adding -DDISTRO_SHARE=... to append-flags breaks cmake so using
+ # this sed hack for now. ~RMH
+ sed -i \
+ -e "s|DISTRO_SHARE|\"share/${PN}\"|g" \
+ src/cpp/server/ServerOptions.cpp \
+ src/cpp/session/SessionOptions.cpp || die
+
+ # use mathjax from system
+ ln -sf "${EPREFIX}"/usr/share/mathjax dependencies/common/mathjax || die
+
+ # make sure icons and mime stuff are with prefix
+ sed -i \
+ -e "s:/usr:${EPREFIX}/usr:g" \
+ CMakeGlobals.txt src/cpp/desktop/CMakeLists.txt || die
+
+ # specify that namespace core the is in the global namespace and not
+ # relative to some other namespace (like its ::core not ::boost::core)
+ find . \( -name *.cpp -or -name *.hpp \) -exec sed \
+ -e 's@<core::@< ::core::@g' -e 's@\([^:]\)core::@\1::core::@g' -i {} \;
+}
+
+src_configure() {
+ export RSTUDIO_VERSION_MAJOR=$(get_version_component_range 1)
+ export RSTUDIO_VERSION_MINOR=$(get_version_component_range 2)
+ export RSTUDIO_VERSION_PATCH=$(get_version_component_range 3)
+
+ local mycmakeargs=(
+ -DDISTRO_SHARE=share/${PN}
+ -DRSTUDIO_INSTALL_FREEDESKTOP=ON
+ -DRSTUDIO_TARGET=Desktop
+ )
+
+ cmake-utils_src_configure
+}
+
+src_compile() {
+ cmake-utils_src_compile
+}
+
+src_install() {
+ cmake-utils_src_install
+ pax-mark m "${ED}usr/bin/rstudio"
+}
+
+pkg_preinst() {
+ gnome2_icon_savelist
+ java-pkg-2_pkg_preinst
+}
+
+pkg_postinst() {
+ fdo-mime_desktop_database_update
+ fdo-mime_mime_database_update
+ gnome2_icon_cache_update
+}
+
+pkg_postrm() {
+ fdo-mime_desktop_database_update
+ fdo-mime_mime_database_update
+ gnome2_icon_cache_update
+}
diff --git a/sci-mathematics/rstudio/rstudio-0.98.1091.ebuild b/sci-mathematics/rstudio/rstudio-0.98.1091.ebuild
new file mode 100644
index 000000000000..1c4e51b22358
--- /dev/null
+++ b/sci-mathematics/rstudio/rstudio-0.98.1091.ebuild
@@ -0,0 +1,196 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+inherit eutils user cmake-utils gnome2-utils pam versionator fdo-mime java-pkg-2 pax-utils
+
+# TODO
+# * package gin and gwt
+# * use dict from tree, linguas
+# * do src_test (use junit from tree?)
+
+# update from scripts in dependencies/common
+GWTVER=2.6.0
+GINVER=1.5
+SELENIUMVER=2.37.0
+CHROMEDRIVER_VER=2.7
+PANDOC_VER=1.12.4.2
+PACKRAT_VER=0.98.1000
+RMARKDOWN_VER=0.98.1000
+SHINYAPPS_VER=0.98.1000
+
+DESCRIPTION="IDE for the R language"
+HOMEPAGE="http://www.rstudio.org
+ https://github.com/rstudio/rstudio/"
+SRC_URI="https://github.com/rstudio/rstudio/archive/v${PV}.tar.gz -> ${P}.tar.gz
+ https://s3.amazonaws.com/rstudio-buildtools/gin-${GINVER}.zip
+ https://s3.amazonaws.com/rstudio-buildtools/gwt-${GWTVER}.zip
+ https://s3.amazonaws.com/rstudio-buildtools/selenium-java-${SELENIUMVER}.zip
+ https://s3.amazonaws.com/rstudio-buildtools/selenium-server-standalone-${SELENIUMVER}.jar
+ https://s3.amazonaws.com/rstudio-buildtools/chromedriver-linux
+ https://s3.amazonaws.com/rstudio-dictionaries/core-dictionaries.zip
+ http://dev.gentoo.org/~gienah/distfiles/packrat-${PACKRAT_VER}.tar.gz
+ http://dev.gentoo.org/~gienah/distfiles/rmarkdown-${RMARKDOWN_VER}.tar.gz
+ http://dev.gentoo.org/~gienah/distfiles/shinyapps-${SHINYAPPS_VER}.tar.gz"
+
+LICENSE="AGPL-3"
+SLOT="0"
+KEYWORDS="~amd64 ~x86 ~amd64-linux ~x86-linux"
+IUSE="dedicated server"
+
+QTVER=4.8
+QTSLOT=4
+RDEPEND="
+ app-text/pandoc
+ dev-haskell/pandoc-citeproc
+ >=dev-lang/R-2.11.1
+ >=dev-libs/boost-1.50:=
+ >=dev-libs/mathjax-2.3
+ dev-libs/openssl:0
+ sys-apps/util-linux
+ sys-libs/zlib
+ >=virtual/jre-1.5:=
+ x11-libs/pango
+ !dedicated? (
+ >=dev-qt/qtcore-${QTVER}:${QTSLOT}
+ >=dev-qt/qtdbus-${QTVER}:${QTSLOT}
+ >=dev-qt/qtgui-${QTVER}:${QTSLOT}
+ >=dev-qt/qtwebkit-${QTVER}:${QTSLOT}
+ >=dev-qt/qtxmlpatterns-${QTVER}:${QTSLOT}
+ server? ( virtual/pam )
+ )
+ dedicated? ( virtual/pam )"
+DEPEND="${RDEPEND}
+ app-arch/unzip
+ dev-java/ant-core
+ >=virtual/jdk-1.5
+ virtual/pkgconfig"
+# test? ( dev-java/junit:4 )
+
+src_unpack() {
+ unpack ${P}.tar.gz gwt-${GWTVER}.zip
+ cd "${S}" || die
+ mkdir -p src/gwt/lib/{gin,gwt} \
+ dependencies/common/dictionaries \
+ src/gwt/lib/selenium/${SELENIUMVER} \
+ src/gwt/lib/selenium/chromedriver/${CHROMEDRIVER_VER} || die
+ mv ../gwt-${GWTVER} src/gwt/lib/gwt/${GWTVER} || die
+ unzip -qd src/gwt/lib/gin/${GINVER} \
+ "${DISTDIR}"/gin-${GINVER}.zip || die
+ unzip -qd dependencies/common/dictionaries \
+ "${DISTDIR}"/core-dictionaries.zip || die
+ unzip -qd src/gwt/lib/selenium/${SELENIUMVER} \
+ "${DISTDIR}"/selenium-java-${SELENIUMVER}.zip || die
+ cp "${DISTDIR}"/selenium-server-standalone-${SELENIUMVER}.jar \
+ src/gwt/lib/selenium/${SELENIUMVER}/ || die
+ cp "${DISTDIR}"/chromedriver-linux \
+ src/gwt/lib/selenium/chromedriver/${CHROMEDRIVER_VER}/ || die
+ cd dependencies/common || die
+ unpack packrat-${PACKRAT_VER}.tar.gz
+ unpack rmarkdown-${RMARKDOWN_VER}.tar.gz
+ unpack shinyapps-${RMARKDOWN_VER}.tar.gz
+ cp "${DISTDIR}"/rmarkdown-${RMARKDOWN_VER}.tar.gz \
+ . || die
+ cp "${DISTDIR}"/packrat-${PACKRAT_VER}.tar.gz \
+ . || die
+ cp "${DISTDIR}"/shinyapps-${SHINYAPPS_VER}.tar.gz \
+ . || die
+}
+
+src_prepare() {
+ java-pkg-2_src_prepare
+
+ find . -name .gitignore -delete || die
+
+ epatch "${FILESDIR}"/${PN}-0.98.490-prefs.patch \
+ "${FILESDIR}"/${PN}-0.98.932-paths.patch \
+ "${FILESDIR}"/${PN}-0.98.1091-pandoc.patch \
+ "${FILESDIR}"/${PN}-0.98.490-linker_flags.patch \
+ "${FILESDIR}"/${PN}-0.98.1091-boost-1.57.patch
+
+ # Adding -DDISTRO_SHARE=... to append-flags breaks cmake so using
+ # this sed hack for now. ~RMH
+ sed -i \
+ -e "s|DISTRO_SHARE|\"share/${PN}\"|g" \
+ src/cpp/server/ServerOptions.cpp \
+ src/cpp/session/SessionOptions.cpp || die
+
+ # use mathjax from system
+ ln -sf "${EPREFIX}"/usr/share/mathjax dependencies/common/mathjax-23 || die
+
+ # make sure icons and mime stuff are with prefix
+ sed -i \
+ -e "s:/usr:${EPREFIX}/usr:g" \
+ CMakeGlobals.txt src/cpp/desktop/CMakeLists.txt || die
+
+ # specify that namespace core the is in the global namespace and not
+ # relative to some other namespace (like its ::core not ::boost::core)
+ find . \( -name *.cpp -or -name *.hpp \) -exec sed \
+ -e 's@<core::@< ::core::@g' -e 's@\([^:]\)core::@\1::core::@g' -i {} \;
+
+ # On Gentoo the rstudio-server configuration file is /etc/conf.d/rstudio-server.conf
+ sed -e "s@/etc/rstudio/rserver.conf@${EROOT}etc/conf.d/rstudio-server.conf@" \
+ -i src/cpp/server/ServerOptions.cpp \
+ || die
+
+ # Set the rsession.conf file location for Gentoo prefix
+ sed -e "s@/etc/rstudio/rsession.conf@${EROOT}etc/rstudio/rsession.conf@" \
+ -i src/cpp/session/SessionOptions.cpp \
+ || die
+}
+
+src_configure() {
+ export RSTUDIO_VERSION_MAJOR=$(get_version_component_range 1)
+ export RSTUDIO_VERSION_MINOR=$(get_version_component_range 2)
+ export RSTUDIO_VERSION_PATCH=$(get_version_component_range 3)
+
+ local mycmakeargs=(
+ -DDISTRO_SHARE=share/${PN}
+ $(cmake-utils_use !dedicated RSTUDIO_INSTALL_FREEDESKTOP)
+ -DRSTUDIO_TARGET=$(usex dedicated "Server" "$(usex server "Development" "Desktop")")
+ )
+
+ cmake-utils_src_configure
+}
+
+src_compile() {
+ cmake-utils_src_compile
+}
+
+src_install() {
+ cmake-utils_src_install
+ pax-mark m "${ED}usr/bin/rstudio"
+ doconfd "${FILESDIR}"/rstudio-server.conf
+ dodir /etc/rstudio
+ insinto /etc/rstudio
+ doins "${FILESDIR}"/rsession.conf
+ dosym /etc/conf.d/rstudio-server.conf /etc/rstudio/rserver.conf
+ if use dedicated || use server; then
+ dopamd src/cpp/server/extras/pam/rstudio
+ newinitd "${FILESDIR}"/rstudio-server.initd rstudio-server
+ fi
+}
+
+pkg_preinst() {
+ use dedicated || gnome2_icon_savelist
+ java-pkg-2_pkg_preinst
+}
+
+pkg_postinst() {
+ use dedicated || { fdo-mime_desktop_database_update
+ fdo-mime_mime_database_update
+ gnome2_icon_cache_update ;}
+
+ if use dedicated || use server; then
+ enewgroup rstudio-server
+ enewuser rstudio-server -1 -1 -1 rstudio-server
+ fi
+}
+
+pkg_postrm() {
+ use dedicated || { fdo-mime_desktop_database_update
+ fdo-mime_mime_database_update
+ gnome2_icon_cache_update ;}
+}
diff --git a/sci-mathematics/rstudio/rstudio-0.98.490-r1.ebuild b/sci-mathematics/rstudio/rstudio-0.98.490-r1.ebuild
new file mode 100644
index 000000000000..898d7bf14097
--- /dev/null
+++ b/sci-mathematics/rstudio/rstudio-0.98.490-r1.ebuild
@@ -0,0 +1,127 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+inherit eutils cmake-utils gnome2-utils versionator fdo-mime java-pkg-2 pax-utils
+
+# TODO
+# * package gin and gwt
+# * use dict from tree, linguas
+# * do src_test (use junit from tree?)
+
+GWTVER=2.5.1
+GINVER=1.5
+
+DESCRIPTION="IDE for the R language"
+HOMEPAGE="http://www.rstudio.org"
+SRC_URI="https://github.com/rstudio/rstudio/archive/v${PV}.tar.gz -> ${P}.tar.gz
+ https://s3.amazonaws.com/rstudio-buildtools/gin-${GINVER}.zip
+ https://s3.amazonaws.com/rstudio-buildtools/gwt-${GWTVER}.zip
+ https://s3.amazonaws.com/rstudio-dictionaries/core-dictionaries.zip"
+
+LICENSE="AGPL-3"
+SLOT="0"
+KEYWORDS="amd64 x86 ~amd64-linux ~x86-linux"
+IUSE=""
+
+QTVER=4.8
+QTSLOT=4
+RDEPEND=">=dev-lang/R-2.11.1
+ >=dev-libs/boost-1.50:=
+ dev-libs/mathjax
+ dev-libs/openssl:0
+ sys-libs/zlib
+ >=virtual/jre-1.5:=
+ x11-libs/pango
+ >=dev-qt/qtcore-${QTVER}:${QTSLOT}
+ >=dev-qt/qtdbus-${QTVER}:${QTSLOT}
+ >=dev-qt/qtgui-${QTVER}:${QTSLOT}
+ >=dev-qt/qtwebkit-${QTVER}:${QTSLOT}
+ >=dev-qt/qtxmlpatterns-${QTVER}:${QTSLOT}"
+DEPEND="${RDEPEND}
+ app-arch/unzip
+ dev-java/ant-core
+ >=virtual/jdk-1.5
+ virtual/pkgconfig"
+# test? ( dev-java/junit:4 )
+
+src_unpack() {
+ unpack ${P}.tar.gz gwt-${GWTVER}.zip
+ cd "${S}" || die
+ mkdir -p src/gwt/lib/{gin,gwt} dependencies/common/dictionaries || die
+ mv ../gwt-${GWTVER} src/gwt/lib/gwt/${GWTVER} || die
+ unzip -qd src/gwt/lib/gin/${GINVER} "${DISTDIR}"/gin-${GINVER}.zip || die
+ unzip -qd dependencies/common/dictionaries "${DISTDIR}"/core-dictionaries.zip || die
+}
+
+src_prepare() {
+ java-pkg-2_src_prepare
+
+ find . -name .gitignore -delete || die
+
+ epatch "${FILESDIR}"/${P}-prefs.patch \
+ "${FILESDIR}"/${P}-paths.patch \
+ "${FILESDIR}"/${P}-linker_flags.patch
+
+ # Adding -DDISTRO_SHARE=... to append-flags breaks cmake so using
+ # this sed hack for now. ~RMH
+ sed -i \
+ -e "s|DISTRO_SHARE|\"share/${PN}\"|g" \
+ src/cpp/server/ServerOptions.cpp \
+ src/cpp/session/SessionOptions.cpp || die
+
+ # use mathjax from system
+ ln -sf "${EPREFIX}"/usr/share/mathjax dependencies/common/mathjax || die
+
+ # make sure icons and mime stuff are with prefix
+ sed -i \
+ -e "s:/usr:${EPREFIX}/usr:g" \
+ CMakeGlobals.txt src/cpp/desktop/CMakeLists.txt || die
+
+ # specify that namespace core the is in the global namespace and not
+ # relative to some other namespace (like its ::core not ::boost::core)
+ find . \( -name *.cpp -or -name *.hpp \) -exec sed \
+ -e 's@<core::@< ::core::@g' -e 's@\([^:]\)core::@\1::core::@g' -i {} \;
+}
+
+src_configure() {
+ export RSTUDIO_VERSION_MAJOR=$(get_version_component_range 1)
+ export RSTUDIO_VERSION_MINOR=$(get_version_component_range 2)
+ export RSTUDIO_VERSION_PATCH=$(get_version_component_range 3)
+
+ local mycmakeargs=(
+ -DDISTRO_SHARE=share/${PN}
+ -DRSTUDIO_INSTALL_FREEDESKTOP=ON
+ -DRSTUDIO_TARGET=Desktop
+ )
+
+ cmake-utils_src_configure
+}
+
+src_compile() {
+ cmake-utils_src_compile
+}
+
+src_install() {
+ cmake-utils_src_install
+ pax-mark m "${ED}usr/bin/rstudio"
+}
+
+pkg_preinst() {
+ gnome2_icon_savelist
+ java-pkg-2_pkg_preinst
+}
+
+pkg_postinst() {
+ fdo-mime_desktop_database_update
+ fdo-mime_mime_database_update
+ gnome2_icon_cache_update
+}
+
+pkg_postrm() {
+ fdo-mime_desktop_database_update
+ fdo-mime_mime_database_update
+ gnome2_icon_cache_update
+}
diff --git a/sci-mathematics/rstudio/rstudio-0.98.490.ebuild b/sci-mathematics/rstudio/rstudio-0.98.490.ebuild
new file mode 100644
index 000000000000..7614e2491d84
--- /dev/null
+++ b/sci-mathematics/rstudio/rstudio-0.98.490.ebuild
@@ -0,0 +1,140 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+inherit eutils user cmake-utils gnome2-utils pam versionator fdo-mime java-pkg-2 pax-utils
+
+# TODO
+# * package gin and gwt
+# * use dict from tree, linguas
+# * do src_test (use junit from tree?)
+
+GWTVER=2.5.1
+GINVER=1.5
+
+DESCRIPTION="IDE for the R language"
+HOMEPAGE="http://www.rstudio.org"
+SRC_URI="https://github.com/rstudio/rstudio/archive/v${PV}.tar.gz -> ${P}.tar.gz
+ https://s3.amazonaws.com/rstudio-buildtools/gin-${GINVER}.zip
+ https://s3.amazonaws.com/rstudio-buildtools/gwt-${GWTVER}.zip
+ https://s3.amazonaws.com/rstudio-dictionaries/core-dictionaries.zip"
+
+LICENSE="AGPL-3"
+SLOT="0"
+KEYWORDS="~amd64 x86 ~amd64-linux ~x86-linux"
+IUSE="dedicated server"
+
+QTVER=4.8
+QTSLOT=4
+RDEPEND=">=dev-lang/R-2.11.1
+ >=dev-libs/boost-1.50:=
+ dev-libs/mathjax
+ dev-libs/openssl:0
+ sys-libs/zlib
+ >=virtual/jre-1.5:=
+ x11-libs/pango
+ !dedicated? (
+ >=dev-qt/qtcore-${QTVER}:${QTSLOT}
+ >=dev-qt/qtdbus-${QTVER}:${QTSLOT}
+ >=dev-qt/qtgui-${QTVER}:${QTSLOT}
+ >=dev-qt/qtwebkit-${QTVER}:${QTSLOT}
+ >=dev-qt/qtxmlpatterns-${QTVER}:${QTSLOT}
+ server? ( virtual/pam )
+ )
+ dedicated? ( virtual/pam )"
+DEPEND="${RDEPEND}
+ app-arch/unzip
+ dev-java/ant-core
+ >=virtual/jdk-1.5
+ virtual/pkgconfig"
+# test? ( dev-java/junit:4 )
+
+src_unpack() {
+ unpack ${P}.tar.gz gwt-${GWTVER}.zip
+ cd "${S}" || die
+ mkdir -p src/gwt/lib/{gin,gwt} dependencies/common/dictionaries || die
+ mv ../gwt-${GWTVER} src/gwt/lib/gwt/${GWTVER} || die
+ unzip -qd src/gwt/lib/gin/${GINVER} "${DISTDIR}"/gin-${GINVER}.zip || die
+ unzip -qd dependencies/common/dictionaries "${DISTDIR}"/core-dictionaries.zip || die
+}
+
+src_prepare() {
+ java-pkg-2_src_prepare
+
+ find . -name .gitignore -delete || die
+
+ epatch "${FILESDIR}"/${P}-prefs.patch \
+ "${FILESDIR}"/${P}-paths.patch \
+ "${FILESDIR}"/${P}-linker_flags.patch
+
+ # Adding -DDISTRO_SHARE=... to append-flags breaks cmake so using
+ # this sed hack for now. ~RMH
+ sed -i \
+ -e "s|DISTRO_SHARE|\"share/${PN}\"|g" \
+ src/cpp/server/ServerOptions.cpp \
+ src/cpp/session/SessionOptions.cpp || die
+
+ # use mathjax from system
+ ln -sf "${EPREFIX}"/usr/share/mathjax dependencies/common/mathjax || die
+
+ # make sure icons and mime stuff are with prefix
+ sed -i \
+ -e "s:/usr:${EPREFIX}/usr:g" \
+ CMakeGlobals.txt src/cpp/desktop/CMakeLists.txt || die
+
+ # specify that namespace core the is in the global namespace and not
+ # relative to some other namespace (like its ::core not ::boost::core)
+ find . \( -name *.cpp -or -name *.hpp \) -exec sed \
+ -e 's@<core::@< ::core::@g' -e 's@\([^:]\)core::@\1::core::@g' -i {} \;
+}
+
+src_configure() {
+ export RSTUDIO_VERSION_MAJOR=$(get_version_component_range 1)
+ export RSTUDIO_VERSION_MINOR=$(get_version_component_range 2)
+ export RSTUDIO_VERSION_PATCH=$(get_version_component_range 3)
+
+ local mycmakeargs=(
+ -DDISTRO_SHARE=share/${PN}
+ $(cmake-utils_use !dedicated RSTUDIO_INSTALL_FREEDESKTOP)
+ -DRSTUDIO_TARGET=$(usex dedicated "Server" "$(usex server "Development" "Desktop")")
+ )
+
+ cmake-utils_src_configure
+}
+
+src_compile() {
+ cmake-utils_src_compile
+}
+
+src_install() {
+ cmake-utils_src_install
+ pax-mark m "${ED}usr/bin/rstudio"
+ if use dedicated || use server; then
+ dopamd src/cpp/server/extras/pam/rstudio
+ newinitd "${FILESDIR}"/rstudio-server.initd rstudio-server
+ fi
+}
+
+pkg_preinst() {
+ use dedicated || gnome2_icon_savelist
+ java-pkg-2_pkg_preinst
+}
+
+pkg_postinst() {
+ use dedicated || { fdo-mime_desktop_database_update
+ fdo-mime_mime_database_update
+ gnome2_icon_cache_update ;}
+
+ if use dedicated || use server; then
+ enewgroup rstudio-server
+ enewuser rstudio-server -1 -1 -1 rstudio-server
+ fi
+}
+
+pkg_postrm() {
+ use dedicated || { fdo-mime_desktop_database_update
+ fdo-mime_mime_database_update
+ gnome2_icon_cache_update ;}
+}
diff --git a/sci-mathematics/rstudio/rstudio-0.98.932.ebuild b/sci-mathematics/rstudio/rstudio-0.98.932.ebuild
new file mode 100644
index 000000000000..0321cea7de7d
--- /dev/null
+++ b/sci-mathematics/rstudio/rstudio-0.98.932.ebuild
@@ -0,0 +1,172 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+inherit eutils user cmake-utils gnome2-utils pam versionator fdo-mime java-pkg-2 pax-utils
+
+# TODO
+# * package gin and gwt
+# * use dict from tree, linguas
+# * do src_test (use junit from tree?)
+
+GWTVER=2.6.0
+GINVER=1.5
+SELENIUMVER=2.37.0
+CHROMEDRIVER_VER=2.7
+PANDOC_VER=1.12.3
+PACKRAT_VER=0.3.0
+RMARKDOWN_VER=0.2.49
+
+DESCRIPTION="IDE for the R language"
+HOMEPAGE="http://www.rstudio.org"
+SRC_URI="https://github.com/rstudio/rstudio/archive/v${PV}.tar.gz -> ${P}.tar.gz
+ https://s3.amazonaws.com/rstudio-buildtools/gin-${GINVER}.zip
+ https://s3.amazonaws.com/rstudio-buildtools/gwt-${GWTVER}.zip
+ https://s3.amazonaws.com/rstudio-buildtools/selenium-java-${SELENIUMVER}.zip
+ https://s3.amazonaws.com/rstudio-buildtools/selenium-server-standalone-${SELENIUMVER}.jar
+ https://s3.amazonaws.com/rstudio-buildtools/chromedriver-linux
+ https://s3.amazonaws.com/rstudio-dictionaries/core-dictionaries.zip
+ http://dev.gentoo.org/~hasufell/distfiles/packrat_${PACKRAT_VER}.tar.gz
+ http://dev.gentoo.org/~hasufell/distfiles/rmarkdown_${RMARKDOWN_VER}.tar.gz"
+
+LICENSE="AGPL-3"
+SLOT="0"
+KEYWORDS="~amd64 ~x86 ~amd64-linux ~x86-linux"
+IUSE="dedicated server"
+
+QTVER=4.8
+QTSLOT=4
+RDEPEND="
+ app-text/pandoc
+ dev-haskell/pandoc-citeproc
+ >=dev-lang/R-2.11.1
+ >=dev-libs/boost-1.50:=
+ dev-libs/mathjax
+ dev-libs/openssl:0
+ sys-libs/zlib
+ >=virtual/jre-1.5:=
+ x11-libs/pango
+ !dedicated? (
+ >=dev-qt/qtcore-${QTVER}:${QTSLOT}
+ >=dev-qt/qtdbus-${QTVER}:${QTSLOT}
+ >=dev-qt/qtgui-${QTVER}:${QTSLOT}
+ >=dev-qt/qtwebkit-${QTVER}:${QTSLOT}
+ >=dev-qt/qtxmlpatterns-${QTVER}:${QTSLOT}
+ server? ( virtual/pam )
+ )
+ dedicated? ( virtual/pam )"
+DEPEND="${RDEPEND}
+ app-arch/unzip
+ dev-java/ant-core
+ >=virtual/jdk-1.5
+ virtual/pkgconfig"
+# test? ( dev-java/junit:4 )
+
+src_unpack() {
+ unpack ${P}.tar.gz gwt-${GWTVER}.zip
+ cd "${S}" || die
+ mkdir -p src/gwt/lib/{gin,gwt} \
+ dependencies/common/dictionaries \
+ src/gwt/lib/selenium/${SELENIUMVER} \
+ src/gwt/lib/selenium/chromedriver/${CHROMEDRIVER_VER} || die
+ mv ../gwt-${GWTVER} src/gwt/lib/gwt/${GWTVER} || die
+ unzip -qd src/gwt/lib/gin/${GINVER} \
+ "${DISTDIR}"/gin-${GINVER}.zip || die
+ unzip -qd dependencies/common/dictionaries \
+ "${DISTDIR}"/core-dictionaries.zip || die
+ unzip -qd src/gwt/lib/selenium/${SELENIUMVER} \
+ "${DISTDIR}"/selenium-java-${SELENIUMVER}.zip || die
+ cp "${DISTDIR}"/selenium-server-standalone-${SELENIUMVER}.jar \
+ src/gwt/lib/selenium/${SELENIUMVER}/ || die
+ cp "${DISTDIR}"/chromedriver-linux \
+ src/gwt/lib/selenium/chromedriver/${CHROMEDRIVER_VER}/ || die
+ cd dependencies/common || die
+ unpack packrat_${PACKRAT_VER}.tar.gz
+ unpack rmarkdown_${RMARKDOWN_VER}.tar.gz
+ cp "${DISTDIR}"/rmarkdown_${RMARKDOWN_VER}.tar.gz \
+ . || die
+ cp "${DISTDIR}"/packrat_${PACKRAT_VER}.tar.gz \
+ . || die
+}
+
+src_prepare() {
+ java-pkg-2_src_prepare
+
+ find . -name .gitignore -delete || die
+
+ epatch "${FILESDIR}"/${PN}-0.98.490-prefs.patch \
+ "${FILESDIR}"/${P}-paths.patch \
+ "${FILESDIR}"/${P}-pandoc.patch \
+ "${FILESDIR}"/${PN}-0.98.490-linker_flags.patch
+
+ # Adding -DDISTRO_SHARE=... to append-flags breaks cmake so using
+ # this sed hack for now. ~RMH
+ sed -i \
+ -e "s|DISTRO_SHARE|\"share/${PN}\"|g" \
+ src/cpp/server/ServerOptions.cpp \
+ src/cpp/session/SessionOptions.cpp || die
+
+ # use mathjax from system
+ ln -sf "${EPREFIX}"/usr/share/mathjax dependencies/common/mathjax || die
+
+ # make sure icons and mime stuff are with prefix
+ sed -i \
+ -e "s:/usr:${EPREFIX}/usr:g" \
+ CMakeGlobals.txt src/cpp/desktop/CMakeLists.txt || die
+
+ # specify that namespace core the is in the global namespace and not
+ # relative to some other namespace (like its ::core not ::boost::core)
+ find . \( -name *.cpp -or -name *.hpp \) -exec sed \
+ -e 's@<core::@< ::core::@g' -e 's@\([^:]\)core::@\1::core::@g' -i {} \;
+}
+
+src_configure() {
+ export RSTUDIO_VERSION_MAJOR=$(get_version_component_range 1)
+ export RSTUDIO_VERSION_MINOR=$(get_version_component_range 2)
+ export RSTUDIO_VERSION_PATCH=$(get_version_component_range 3)
+
+ local mycmakeargs=(
+ -DDISTRO_SHARE=share/${PN}
+ $(cmake-utils_use !dedicated RSTUDIO_INSTALL_FREEDESKTOP)
+ -DRSTUDIO_TARGET=$(usex dedicated "Server" "$(usex server "Development" "Desktop")")
+ )
+
+ cmake-utils_src_configure
+}
+
+src_compile() {
+ cmake-utils_src_compile
+}
+
+src_install() {
+ cmake-utils_src_install
+ pax-mark m "${ED}usr/bin/rstudio"
+ if use dedicated || use server; then
+ dopamd src/cpp/server/extras/pam/rstudio
+ newinitd "${FILESDIR}"/rstudio-server.initd rstudio-server
+ fi
+}
+
+pkg_preinst() {
+ use dedicated || gnome2_icon_savelist
+ java-pkg-2_pkg_preinst
+}
+
+pkg_postinst() {
+ use dedicated || { fdo-mime_desktop_database_update
+ fdo-mime_mime_database_update
+ gnome2_icon_cache_update ;}
+
+ if use dedicated || use server; then
+ enewgroup rstudio-server
+ enewuser rstudio-server -1 -1 -1 rstudio-server
+ fi
+}
+
+pkg_postrm() {
+ use dedicated || { fdo-mime_desktop_database_update
+ fdo-mime_mime_database_update
+ gnome2_icon_cache_update ;}
+}
diff --git a/sci-mathematics/rstudio/rstudio-0.98.953.ebuild b/sci-mathematics/rstudio/rstudio-0.98.953.ebuild
new file mode 100644
index 000000000000..60fe809b28fc
--- /dev/null
+++ b/sci-mathematics/rstudio/rstudio-0.98.953.ebuild
@@ -0,0 +1,173 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+inherit eutils user cmake-utils gnome2-utils pam versionator fdo-mime java-pkg-2 pax-utils
+
+# TODO
+# * package gin and gwt
+# * use dict from tree, linguas
+# * do src_test (use junit from tree?)
+
+GWTVER=2.6.0
+GINVER=1.5
+SELENIUMVER=2.37.0
+CHROMEDRIVER_VER=2.7
+PANDOC_VER=1.12.3
+PACKRAT_VER=0.3.0
+RMARKDOWN_VER=0.2.49
+
+DESCRIPTION="IDE for the R language"
+HOMEPAGE="http://www.rstudio.org"
+SRC_URI="https://github.com/rstudio/rstudio/archive/v${PV}.tar.gz -> ${P}.tar.gz
+ https://s3.amazonaws.com/rstudio-buildtools/gin-${GINVER}.zip
+ https://s3.amazonaws.com/rstudio-buildtools/gwt-${GWTVER}.zip
+ https://s3.amazonaws.com/rstudio-buildtools/selenium-java-${SELENIUMVER}.zip
+ https://s3.amazonaws.com/rstudio-buildtools/selenium-server-standalone-${SELENIUMVER}.jar
+ https://s3.amazonaws.com/rstudio-buildtools/chromedriver-linux
+ https://s3.amazonaws.com/rstudio-dictionaries/core-dictionaries.zip
+ http://dev.gentoo.org/~hasufell/distfiles/packrat_${PACKRAT_VER}.tar.gz
+ http://dev.gentoo.org/~hasufell/distfiles/rmarkdown_${RMARKDOWN_VER}.tar.gz"
+
+LICENSE="AGPL-3"
+SLOT="0"
+KEYWORDS="~amd64 ~x86 ~amd64-linux ~x86-linux"
+IUSE="dedicated server"
+
+QTVER=4.8
+QTSLOT=4
+RDEPEND="
+ app-text/pandoc
+ dev-haskell/pandoc-citeproc
+ >=dev-lang/R-2.11.1
+ >=dev-libs/boost-1.50:=
+ dev-libs/mathjax
+ dev-libs/openssl:0
+ sys-apps/util-linux
+ sys-libs/zlib
+ >=virtual/jre-1.5:=
+ x11-libs/pango
+ !dedicated? (
+ >=dev-qt/qtcore-${QTVER}:${QTSLOT}
+ >=dev-qt/qtdbus-${QTVER}:${QTSLOT}
+ >=dev-qt/qtgui-${QTVER}:${QTSLOT}
+ >=dev-qt/qtwebkit-${QTVER}:${QTSLOT}
+ >=dev-qt/qtxmlpatterns-${QTVER}:${QTSLOT}
+ server? ( virtual/pam )
+ )
+ dedicated? ( virtual/pam )"
+DEPEND="${RDEPEND}
+ app-arch/unzip
+ dev-java/ant-core
+ >=virtual/jdk-1.5
+ virtual/pkgconfig"
+# test? ( dev-java/junit:4 )
+
+src_unpack() {
+ unpack ${P}.tar.gz gwt-${GWTVER}.zip
+ cd "${S}" || die
+ mkdir -p src/gwt/lib/{gin,gwt} \
+ dependencies/common/dictionaries \
+ src/gwt/lib/selenium/${SELENIUMVER} \
+ src/gwt/lib/selenium/chromedriver/${CHROMEDRIVER_VER} || die
+ mv ../gwt-${GWTVER} src/gwt/lib/gwt/${GWTVER} || die
+ unzip -qd src/gwt/lib/gin/${GINVER} \
+ "${DISTDIR}"/gin-${GINVER}.zip || die
+ unzip -qd dependencies/common/dictionaries \
+ "${DISTDIR}"/core-dictionaries.zip || die
+ unzip -qd src/gwt/lib/selenium/${SELENIUMVER} \
+ "${DISTDIR}"/selenium-java-${SELENIUMVER}.zip || die
+ cp "${DISTDIR}"/selenium-server-standalone-${SELENIUMVER}.jar \
+ src/gwt/lib/selenium/${SELENIUMVER}/ || die
+ cp "${DISTDIR}"/chromedriver-linux \
+ src/gwt/lib/selenium/chromedriver/${CHROMEDRIVER_VER}/ || die
+ cd dependencies/common || die
+ unpack packrat_${PACKRAT_VER}.tar.gz
+ unpack rmarkdown_${RMARKDOWN_VER}.tar.gz
+ cp "${DISTDIR}"/rmarkdown_${RMARKDOWN_VER}.tar.gz \
+ . || die
+ cp "${DISTDIR}"/packrat_${PACKRAT_VER}.tar.gz \
+ . || die
+}
+
+src_prepare() {
+ java-pkg-2_src_prepare
+
+ find . -name .gitignore -delete || die
+
+ epatch "${FILESDIR}"/${PN}-0.98.490-prefs.patch \
+ "${FILESDIR}"/${PN}-0.98.932-paths.patch \
+ "${FILESDIR}"/${PN}-0.98.932-pandoc.patch \
+ "${FILESDIR}"/${PN}-0.98.490-linker_flags.patch
+
+ # Adding -DDISTRO_SHARE=... to append-flags breaks cmake so using
+ # this sed hack for now. ~RMH
+ sed -i \
+ -e "s|DISTRO_SHARE|\"share/${PN}\"|g" \
+ src/cpp/server/ServerOptions.cpp \
+ src/cpp/session/SessionOptions.cpp || die
+
+ # use mathjax from system
+ ln -sf "${EPREFIX}"/usr/share/mathjax dependencies/common/mathjax || die
+
+ # make sure icons and mime stuff are with prefix
+ sed -i \
+ -e "s:/usr:${EPREFIX}/usr:g" \
+ CMakeGlobals.txt src/cpp/desktop/CMakeLists.txt || die
+
+ # specify that namespace core the is in the global namespace and not
+ # relative to some other namespace (like its ::core not ::boost::core)
+ find . \( -name *.cpp -or -name *.hpp \) -exec sed \
+ -e 's@<core::@< ::core::@g' -e 's@\([^:]\)core::@\1::core::@g' -i {} \;
+}
+
+src_configure() {
+ export RSTUDIO_VERSION_MAJOR=$(get_version_component_range 1)
+ export RSTUDIO_VERSION_MINOR=$(get_version_component_range 2)
+ export RSTUDIO_VERSION_PATCH=$(get_version_component_range 3)
+
+ local mycmakeargs=(
+ -DDISTRO_SHARE=share/${PN}
+ $(cmake-utils_use !dedicated RSTUDIO_INSTALL_FREEDESKTOP)
+ -DRSTUDIO_TARGET=$(usex dedicated "Server" "$(usex server "Development" "Desktop")")
+ )
+
+ cmake-utils_src_configure
+}
+
+src_compile() {
+ cmake-utils_src_compile
+}
+
+src_install() {
+ cmake-utils_src_install
+ pax-mark m "${ED}usr/bin/rstudio"
+ if use dedicated || use server; then
+ dopamd src/cpp/server/extras/pam/rstudio
+ newinitd "${FILESDIR}"/rstudio-server.initd rstudio-server
+ fi
+}
+
+pkg_preinst() {
+ use dedicated || gnome2_icon_savelist
+ java-pkg-2_pkg_preinst
+}
+
+pkg_postinst() {
+ use dedicated || { fdo-mime_desktop_database_update
+ fdo-mime_mime_database_update
+ gnome2_icon_cache_update ;}
+
+ if use dedicated || use server; then
+ enewgroup rstudio-server
+ enewuser rstudio-server -1 -1 -1 rstudio-server
+ fi
+}
+
+pkg_postrm() {
+ use dedicated || { fdo-mime_desktop_database_update
+ fdo-mime_mime_database_update
+ gnome2_icon_cache_update ;}
+}
diff --git a/sci-mathematics/rw/Manifest b/sci-mathematics/rw/Manifest
new file mode 100644
index 000000000000..35074019b987
--- /dev/null
+++ b/sci-mathematics/rw/Manifest
@@ -0,0 +1 @@
+DIST rw-0.7.tar.gz 322255 SHA256 e049966e5c4f446b639d4b0c40d3ceddd57a79a8890c10dce90614d105d962e7 SHA512 2bccbaf1a7432b845e9bf14d79e350275d1ca417cb368e870b6cb1a310a92cce67c9e4ce3c550da2900a8e08c3771cc534d593f67267eee17d25c756d8c36e3b WHIRLPOOL 27d274a528a7f074b8ca1b38872220fe4e49488199fa496fab5330fd1866b504851250cfba2539a86c63104bbdee7be29a677aa6a21a7bf899cb546204e9138c
diff --git a/sci-mathematics/rw/metadata.xml b/sci-mathematics/rw/metadata.xml
new file mode 100644
index 000000000000..29dcd6cef151
--- /dev/null
+++ b/sci-mathematics/rw/metadata.xml
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <herd>proxy-maintainers</herd>
+ <herd>sci</herd>
+
+ <maintainer>
+ <email>mjo@gentoo.org</email>
+ <name>Michael Orlitzky</name>
+ </maintainer>
+
+ <maintainer>
+ <email>francois.bissey@canterbury.ac.nz</email>
+ <name>François Bissey</name>
+ </maintainer>
+
+ <longdescription lang="en">
+ rw is a program that calculates rank-width and rank-decompositions.
+ It is based on ideas from "Computing rank-width exactly" by Sang-il Oum,
+ "Sopra una formula numerica" by Ernesto Pascal, "Generation of a Vector
+ from the Lexicographical Index" by B.P. Buckles and M. Lybanon and "Fast
+ additions on masked integers" by Michael D. Adams and David S. Wise.
+ </longdescription>
+
+ <use>
+ <flag name='executable'>Build the 'rw' program.</flag>
+ </use>
+</pkgmetadata>
diff --git a/sci-mathematics/rw/rw-0.7.ebuild b/sci-mathematics/rw/rw-0.7.ebuild
new file mode 100644
index 000000000000..e623511f73c9
--- /dev/null
+++ b/sci-mathematics/rw/rw-0.7.ebuild
@@ -0,0 +1,41 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+inherit autotools-utils
+
+DESCRIPTION="Compute rank-width decompositions of graphs"
+AUTHORPAGE="http://pholia.tdi.informatik.uni-frankfurt.de/~philipp/"
+HOMEPAGE="${AUTHORPAGE}software/${PN}.shtml"
+SRC_URI="${AUTHORPAGE}/software/${P}.tar.gz"
+
+LICENSE="GPL-2+"
+SLOT="0"
+KEYWORDS="~amd64 ~amd64-linux ~x86-linux ~ppc-macos ~x86-macos ~x64-macos"
+IUSE="+executable static-libs"
+
+DEPEND="executable? ( >=dev-libs/igraph-0.6 )"
+RDEPEND="${DEPEND}"
+
+DOCDIR="/usr/share/doc/${PF}"
+
+AUTOTOOLS_IN_SOURCE_BUILD=1
+
+src_configure(){
+ local myeconfargs=(
+ $(use_enable executable)
+ --docdir="${EPREFIX}${DOCDIR}"
+ )
+
+ autotools-utils_src_configure
+}
+
+src_install(){
+ # The examples graphs are meant to be fed uncompressed into the 'rw'
+ # program. The rest of the docs are small so just leave everything
+ # uncompressed.
+ docompress -x "${DOCDIR}"
+ autotools-utils_src_install
+}
diff --git a/sci-mathematics/sha1-polyml/Manifest b/sci-mathematics/sha1-polyml/Manifest
new file mode 100644
index 000000000000..480d96f4a083
--- /dev/null
+++ b/sci-mathematics/sha1-polyml/Manifest
@@ -0,0 +1 @@
+DIST polyml-5.5.0.tar.gz 12776783 SHA256 1ada41fba3f3cd5bb9b3e3dd1585e8576284e9a74ad7c4ddf88c020f716ec7dc SHA512 4d8accc7083e12a0117fb4e34367e9b22c500d31094d8f0e381b91e91a3e8122cb5ca760ecc86bdcf7ff50a460848a181747bafc068b4a300b01de54e55fbad7 WHIRLPOOL 2bc658af92f0b85ae8ba63d3f07caced91a335a3d5541e3988fa78147ef6f6c8713e479cde0ed41077621ead4b3d6eaca466a05d6d87d2f27d427299513d7033
diff --git a/sci-mathematics/sha1-polyml/metadata.xml b/sci-mathematics/sha1-polyml/metadata.xml
new file mode 100644
index 000000000000..c3a2e907f34c
--- /dev/null
+++ b/sci-mathematics/sha1-polyml/metadata.xml
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+<maintainer>
+ <email>gienah@gentoo.org</email>
+ <name>Mark Wright</name>
+</maintainer>
+<herd>sci-mathematics</herd>
+<longdescription lang='en'>
+sci-mathematics/sha1-polyml is the implementation of SHA1 taken from
+the GNU coreutils package as described in the sci-mathematics/sha1-polyml
+README. It is required by sci-mathematics/isabelle.
+</longdescription>
+</pkgmetadata>
diff --git a/sci-mathematics/sha1-polyml/sha1-polyml-5.5.0.ebuild b/sci-mathematics/sha1-polyml/sha1-polyml-5.5.0.ebuild
new file mode 100644
index 000000000000..b8150e07cd2b
--- /dev/null
+++ b/sci-mathematics/sha1-polyml/sha1-polyml-5.5.0.ebuild
@@ -0,0 +1,79 @@
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="5"
+
+inherit multilib
+
+MY_PN=polyml
+MY_P="${MY_PN}-${PV}"
+
+DESCRIPTION="implementation of SHA1 is taken from the GNU coreutils package"
+HOMEPAGE="http://isabelle.in.tum.de/"
+SRC_URI="http://isabelle.in.tum.de/components/${MY_P}.tar.gz"
+
+LICENSE="GPL-3"
+SLOT="0"
+KEYWORDS="~x86 ~amd64"
+IUSE=""
+
+RDEPEND=""
+DEPEND="${RDEPEND}"
+
+S="${WORKDIR}/${MY_P}/sha1"
+
+LIBDIR="/usr/"$(get_libdir)"/${PN}"
+
+# sci-mathematics/isabelle requires sci-mathematics/sha1-polyml, to avoid
+# this warning:
+# ### load_lib </usr/bin/libsha1.so> : /usr/bin/libsha1.so: cannot open shared
+# object file: No such file or directory
+# ### Using slow ML implementation of SHA1.digest
+# sci-mathematics/sha1-polyml supplies the library libsha1.so. Which
+# is the implementation of SHA1 taken from the GNU coreutils package
+# as described in the sci-mathematics/sha1-polyml README. Isabelle
+# builds libsha1.so in the contrib/polyml/$ML_PLATFORM directory.
+# isabelle dynamically loads libsha1.so as a plugin. The Isabelle-2012
+# linux binary bundle places libsha1.so in the contrib/polyml directory, which
+# is referred to as ML_HOME in the Isabelle Pure/General/sha1_polyml.ML source file.
+# ML_HOME is /usr/bin on Gentoo, and we want isabelle to depend o sha1-polyml.
+# For these reasons isabelle is patched to load it from
+# /usr/$(get_libdir)/sha1-polyml/libsha1.so
+
+src_prepare() {
+ cp -p "${S}/build" "${S}/build-orig" || die "Could not cp build to build-orig"
+ sed -e "s@CFLAGS=\"@CFLAGS=\"${CFLAGS} @g" \
+ -e "s@LDFLAGS=\"@LDFLAGS=\"${LDFLAGS} @g" \
+ -i "${S}/build" || die "Could not set flags in build"
+ cp -p "${S}/build" "${S}/tests" || die "Could not cp build to tests"
+ sed -e '/echo "Running tests ..."/,$d' \
+ -i "${S}/build" || die "Could not remove run tests from build"
+ sed -e '$i\\nexit 0' \
+ -i "${S}/build" || die "Could not add exit 0 to build"
+ sed -e 's/echo "Running tests ..."/echo "Running tests ..."\necho "Running tests ..."/' \
+ -i "${S}/tests" || die "Could not duplicate echo line in tests"
+ sed -e '/# building/,/echo "Running tests ..."/d' \
+ -i "${S}/tests" || die "Could not remove build from run tests"
+ sed -e '$i\\nexit 0' \
+ -i "${S}/tests" || die "Could not add exit 0 to tests"
+}
+
+src_compile() {
+ arch=$(uname -m)
+ uos=$(uname)
+ los=${uos,,}
+ ./build "${arch}-${los}" || die "build failed"
+}
+
+src_test() {
+ ./tests "${arch}-${los}" || die "tests failed"
+}
+
+src_install() {
+ dodoc README
+ insinto "/usr/"$(get_libdir)
+ dodir ${LIBDIR}
+ exeinto ${LIBDIR}
+ doexe ${arch}-${los}/libsha1.so
+}
diff --git a/sci-mathematics/singular/Manifest b/sci-mathematics/singular/Manifest
new file mode 100644
index 000000000000..6d7beb859000
--- /dev/null
+++ b/sci-mathematics/singular/Manifest
@@ -0,0 +1,4 @@
+DIST Singular-3-1-6-share.tar.gz 10620177 SHA256 c74a97b7eb8ed53417682637fe11c2480aeb1a6cbf4a8db27a1b16a162e83c4d SHA512 54bff29c5d64609583ec8b1c43005a1ff453c8f2cedfe9a26ac840888e9d306e3104e14aea5a3cc923fac916215c4285ecfe5ae7e1242aee0308b5e4c6e2d48d WHIRLPOOL a1edc8fa9cad189af413870b0e63316e135e8456075f13b3d8036afafd6c25f4bcc854432cdcb8c2ec690c63b43f616367aa9f1027c096e95f22aa0508943f67
+DIST Singular-3-1-6.tar.gz 25535111 SHA256 7956a17a0b5d428fea25bc0bc6c19c753748fb98bb2926c49b9fbcbec94172ff SHA512 103a10dd474d93cceb678bcef1a4aae5ec693cb9e68c9d63a7536929b738a0127501ee145a79cc3b9ddfa4bd1ca0f05e640eeb3b0fbdb60de4f56aa5beacc213 WHIRLPOOL 71ef6d505f7c8b2eeacd46666640d7b3c79f75d6c2c858b135553b1fb3a9dd7d88df74924009468c32aa4aa748b88ccb7762010ab4d36eec420a07fd36e8dd22
+DIST singular-4.0.2-share.tar.gz 8789162 SHA256 fe81cb100f3b73b159eb4a8122a29bc0f7705ef6f62ad55b68b5582c1ec0642d SHA512 068827df04a5d1b4407dbaab1296d0120071dc109b749037b02263d51906852a5c2c1ef321733953a181c2d3d0fe799c197ef0af3b9341810ecf31a5324e0a25 WHIRLPOOL 615487e95e32d9f07552e92ebcd46e3071d110dd31e7d980b01340d22a5205ba2d771532fad1bf44863a38820428157284a171e0b901861fda6e51482d546adc
+DIST singular-4.0.2.tar.gz 8635172 SHA256 c105a2c8ace0b3c9189b782ed63660ce235407d0160907c2cafc2128d36d8cb7 SHA512 4543a45839ce8adc45e3b2edd84a6e398b7ba157da1eda050dbce2a8b20333eb0c63433e3e7eaf59d76bf6bcb65c1b1611bfc08c25fd493c88e2f06624898e3d WHIRLPOOL fe30bc87c6b403b2e30bd1c016aeeb015c2a64a63d87b81536dc53a2555ac068f3e0c6d8763775d8be5e5e1a935aadab1c86b603cbb698234a19cc9cfffac282
diff --git a/sci-mathematics/singular/files/60singular-gentoo.el b/sci-mathematics/singular/files/60singular-gentoo.el
new file mode 100644
index 000000000000..7be8c08ef7e9
--- /dev/null
+++ b/sci-mathematics/singular/files/60singular-gentoo.el
@@ -0,0 +1,10 @@
+
+;; site-file for sci-mathematics/singular
+
+(add-to-list 'load-path "@SITELISP@")
+(autoload 'singular "singular"
+ "Start Singular using default values." t)
+(autoload 'singular-other "singular"
+ "Ask for arguments and start Singular." t)
+
+(add-to-list 'auto-mode-alist '("\\.sing\\'" . c++-mode))
diff --git a/sci-mathematics/singular/files/singular-3.0.4.4-nostrip.patch b/sci-mathematics/singular/files/singular-3.0.4.4-nostrip.patch
new file mode 100644
index 000000000000..5884b6cd2d60
--- /dev/null
+++ b/sci-mathematics/singular/files/singular-3.0.4.4-nostrip.patch
@@ -0,0 +1,12 @@
+diff -Naur Singular-3-0-4/IntegerProgramming/Makefile.in Singular-3-0-4.new/IntegerProgramming/Makefile.in
+--- Singular-3-0-4/IntegerProgramming/Makefile.in 2008-07-09 07:55:13.000000000 -0400
++++ Singular-3-0-4.new/IntegerProgramming/Makefile.in 2008-10-19 22:40:41.000000000 -0400
+@@ -21,7 +21,7 @@
+ endif
+
+ INSTALL = @INSTALL@
+-INSTALL_PROGRAM = @INSTALL_PROGRAM@ -s
++INSTALL_PROGRAM = @INSTALL_PROGRAM@
+ MKINSTALLDIRS = ../mkinstalldirs
+
+ ##
diff --git a/sci-mathematics/singular/files/singular-3.1.0-emacs-22.patch b/sci-mathematics/singular/files/singular-3.1.0-emacs-22.patch
new file mode 100644
index 000000000000..3f4f3c76203c
--- /dev/null
+++ b/sci-mathematics/singular/files/singular-3.1.0-emacs-22.patch
@@ -0,0 +1,13 @@
+diff -Naur Singular-3-1-0/emacs/singular.el Singular-3-1-0.new/emacs/singular.el
+--- Singular-3-1-0/emacs/singular.el 2008-11-03 09:16:38.000000000 -0500
++++ Singular-3-1-0.new/emacs/singular.el 2009-08-20 22:16:57.000000000 -0400
+@@ -865,7 +865,8 @@
+ (add-hook 'singular-post-output-filter-functions 'singular-prompt-remove-filter nil t)
+
+ ;; some relict from Comint mode
+- (setq comint-prompt-regexp singular-comint-prompt-regexp))
++ (setq comint-prompt-regexp singular-comint-prompt-regexp)
++ (setq comint-use-prompt-regexp-instead-of-fields 1))
+ ;; required to use prompt-regexp
+ (setq comint-use-prompt-regexp t)
+ ;;}}}
diff --git a/sci-mathematics/singular/files/singular-3.1.0-gentoo.patch b/sci-mathematics/singular/files/singular-3.1.0-gentoo.patch
new file mode 100644
index 000000000000..ebb402289386
--- /dev/null
+++ b/sci-mathematics/singular/files/singular-3.1.0-gentoo.patch
@@ -0,0 +1,81 @@
+--- kernel/feResource.cc.orig 2010-04-30 10:20:14.000000000 +0000
++++ kernel/feResource.cc 2010-10-11 09:19:01.431179334 +0000
+@@ -41,7 +41,7 @@
+ #define SINGULAR_DEFAULT_DIR "/usr/local/Singular/"S_VERSION1
+ #endif
+ #else // ! defined(MAKE_DISTRIBUTION)
+-#define SINGULAR_DEFAULT_DIR S_ROOT_DIR
++#define SINGULAR_DEFAULT_DIR "@GENTOO_PORTAGE_EPREFIX@/usr"
+ #endif // defined(MAKE_DISTRIBUTION)
+
+ /*****************************************************************
+@@ -73,33 +73,31 @@
+ {
+ {"SearchPath", 's', feResPath, NULL,
+ "$SINGULARPATH;"
+- "%b/LIB;"
+- "%b/MOD;"
++ "%r/share/singular/MOD;"
+ "%r/LIB;"
+- "%r/../LIB;"
++ "%r/share/singular/LIB;"
+ "%d/LIB;"
+- "%d/../LIB"
+ ""},
+- {"Singular", 'S', feResBinary,"SINGULAR_EXECUTABLE", "%d/"S_UNAME"/Singular",(char *)""},
+- {"BinDir", 'b', feResDir, "SINGULAR_BIN_DIR", "%d/"S_UNAME, (char *)""},
+- {"RootDir", 'r', feResDir, "SINGULAR_ROOT_DIR", "%b/..", (char *)""},
++ {"Singular", 'S', feResBinary,"SINGULAR_EXECUTABLE", "%d/bin/Singular",(char *)""},
++ {"BinDir", 'b', feResDir, "SINGULAR_BIN_DIR", "%d/bin", (char *)""},
++ {"RootDir", 'r', feResDir, "SINGULAR_ROOT_DIR", "%d", (char *)""},
+ {"DefaultDir",'d', feResDir, "SINGULAR_DEFAULT_DIR", SINGULAR_DEFAULT_DIR, (char *)""},
+- {"InfoFile", 'i', feResFile, "SINGULAR_INFO_FILE", "%r/info/singular.hlp", (char *)""},
+- {"IdxFile", 'x', feResFile, "SINGULAR_IDX_FILE", "%r/doc/singular.idx", (char *)""},
+- {"HtmlDir", 'h', feResDir, "SINGULAR_HTML_DIR", "%r/html", (char *)""},
++ {"InfoFile", 'i', feResFile, "SINGULAR_INFO_FILE", "%r/share/info/singular.info.bz2", (char *)""},
++ {"IdxFile", 'x', feResFile, "SINGULAR_IDX_FILE", "%r/share/singular/singular.idx", (char *)""},
++ {"HtmlDir", 'h', feResDir, "SINGULAR_HTML_DIR", "%r/share/doc/PFSUBST/html", (char *)""},
+ #ifdef ix86_Win
+ {"HtmlHelpFile",'C', feResFile, "SINGULAR_CHM_FILE", "%r/doc/Manual.chm", (char *)""},
+ #endif
+ {"ManualUrl", 'u', feResUrl, "SINGULAR_URL", "http://www.singular.uni-kl.de/Manual/"S_VERSION1, (char *)""},
+- {"ExDir", 'm', feResDir, "SINGULAR_EXAMPLES_DIR","%r/examples", (char *)""},
++ {"ExDir", 'm', feResDir, "SINGULAR_EXAMPLES_DIR","%r/share/doc/PFSUBST/examples", (char *)""},
+ {"Path", 'p', feResPath, NULL, "%b;$PATH", (char *)""},
+
+ #ifdef ESINGULAR
+ {"emacs", 'E', feResBinary,"ESINGULAR_EMACS", "%b/emacs", (char *)""},
+ {"xemacs", 'A', feResBinary,"ESINGULAR_EMACS", "%b/xemacs", (char *)""},
+ {"SingularEmacs",'M', feResBinary,"ESINGULAR_SINGULAR", "%b/Singular", (char *)""},
+- {"EmacsLoad", 'l', feResFile, "ESINGULAR_EMACS_LOAD", "%e/.emacs-singular", (char *)""},
+- {"EmacsDir", 'e', feResDir, "ESINGULAR_EMACS_DIR", "%r/emacs", (char *)""},
++ {"EmacsLoad", 'l', feResFile, "ESINGULAR_EMACS_LOAD", "%r/share/emacs/site-lisp/singular/.emacs-singular", (char *)""},
++ {"EmacsDir", 'e', feResDir, "ESINGULAR_EMACS_DIR", "%r/share/emacs/site-lisp/singular", (char *)""},
+ #elif defined(TSINGULAR)
+ {"SingularXterm",'M', feResBinary,"TSINGULAR_SINGULAR", "%b/Singular", (char *)""},
+ #ifdef ix86_Win
+@@ -108,7 +106,7 @@
+ {"xterm", 'X', feResBinary,"XTERM", "%b/xterm", (char *)""},
+ #endif
+ #else
+- {"EmacsDir", 'e', feResDir, "SINGULAR_EMACS_DIR", "%r/emacs", (char *)""},
++ {"EmacsDir", 'e', feResDir, "SINGULAR_EMACS_DIR", "%r/share/emacs/site-lisp/singular", (char *)""},
+ #endif
+ {NULL, 0, feResUndef, NULL, NULL, NULL}, // must be the last record
+ };
+--- kernel/mod_raw.cc.orig 2009-11-02 10:12:22.000000000 +0000
++++ kernel/mod_raw.cc 2010-10-11 09:19:01.432179264 +0000
+@@ -109,11 +109,11 @@
+ void* dynl_open_binary_warn(const char* binary_name, const char* msg)
+ {
+ void* handle = NULL;
+- const char* bin_dir = feGetResource('b');
++ const char* bin_dir = feGetResource('r');
+ if (bin_dir != NULL)
+ {
+ char path_name[MAXPATHLEN];
+- sprintf(path_name, "%s%s%s.%s", bin_dir, DIR_SEPP, binary_name,
++ sprintf(path_name, "%s%s%s%s.%s", bin_dir,"/lib/singular", DIR_SEPP, binary_name,
+ DL_TAIL);
+ handle = dynl_open(path_name);
+ if (handle == NULL && ! warn_handle)
diff --git a/sci-mathematics/singular/files/singular-3.1.3.2-python.patch b/sci-mathematics/singular/files/singular-3.1.3.2-python.patch
new file mode 100644
index 000000000000..2cc29c9a553b
--- /dev/null
+++ b/sci-mathematics/singular/files/singular-3.1.3.2-python.patch
@@ -0,0 +1,45 @@
+--- Singular/pyobject.cc.orig 2011-01-31 15:03:16.000000000 +0100
++++ Singular/pyobject.cc 2011-08-24 17:22:57.000000000 +0200
+@@ -14,7 +14,7 @@
+
+
+
+-
++#include <Python.h>
+
+ #include <Singular/mod2.h>
+
+@@ -27,7 +27,7 @@
+
+ #include <Singular/lists.h>
+
+-#include <Python.h>
++
+ #include <iterator> // std::distance
+ #include <stdio.h>
+
+@@ -592,11 +592,12 @@
+ long len = newElts.size();
+ for (long idx = 0; idx < len; ++idx)
+ {
+- char* name = newElts[idx][0].str();
++ PythonObject current (newElts[idx]);
++ char* name = current.operator[](0).str();
+ if (name && (*name != '\0') && (*name != '_'))
+ {
+ Py_XDECREF(get_current_definition(name));
+- newElts[idx][1].import_as(name);
++ newElts[idx].operator[](1).import_as(name);
+ }
+
+ }
+--- Singular/pyobject_setup.cc.orig 2011-02-10 19:15:30.000000000 +0100
++++ Singular/pyobject_setup.cc 2011-08-24 17:23:55.000000000 +0200
+@@ -12,6 +12,7 @@
+ **/
+ //*****************************************************************************
+
++#include <Python.h>
+ #include <Singular/mod2.h>
+ #include <kernel/febase.h>
+ #include "static.h"
diff --git a/sci-mathematics/singular/files/singular-3.1.3.3-Minor.h.patch b/sci-mathematics/singular/files/singular-3.1.3.3-Minor.h.patch
new file mode 100644
index 000000000000..1d03e61ae308
--- /dev/null
+++ b/sci-mathematics/singular/files/singular-3.1.3.3-Minor.h.patch
@@ -0,0 +1,10 @@
+--- src/Singular/Minor.h 2010-02-02 08:22:24.000000000 -0500
++++ patches/Minor.h 2011-06-28 13:26:01.000000000 -0400
+@@ -2,6 +2,7 @@
+ #define MINOR_H
+
+ #include <assert.h>
++#include <time.h>
+ #include <iostream>
+ #include <string>
+
diff --git a/sci-mathematics/singular/files/singular-3.1.3.3-install_name.patch b/sci-mathematics/singular/files/singular-3.1.3.3-install_name.patch
new file mode 100644
index 000000000000..6a7826c390f6
--- /dev/null
+++ b/sci-mathematics/singular/files/singular-3.1.3.3-install_name.patch
@@ -0,0 +1,23 @@
+--- kernel/Makefile.in.orig 2011-10-13 23:36:54.000000000 +0200
++++ kernel/Makefile.in 2011-10-13 23:37:46.000000000 +0200
+@@ -267,7 +267,7 @@
+ -rm -f p_Procs_Dynamic p_Procs_Dynamic.exe
+
+ p_Procs_%.so: p_Procs_Lib_%.dl_o
+- $(LD) ${SLDFLAGS} -o $@ $^
++ $(LD) ${SLDFLAGS} -install_name @GENTOO_PORTAGE_EPREFIX@/usr/lib/singular/$@ -o $@ $^
+
+ ##
+ ## install targets
+
+--- Singular/Makefile.in.orig 2011-10-14 23:59:07.000000000 +0200
++++ Singular/Makefile.in 2011-10-14 23:58:34.000000000 +0200
+@@ -492,7 +492,7 @@
+ $(LD) ${SLDFLAGS} -o $@ $^ -L${libdir} ${MP_LIBS} ${GLIBC_DYN_FIX}
+
+ dbmsr.so: $(DBMSR_SOURCES:.cc=.dl_o)
+- $(LD) ${SLDFLAGS} -o $@ $^ ${GLIBC_DYN_FIX}
++ $(LD) ${SLDFLAGS} -install_name @GENTOO_PORTAGE_EPREFIX@/usr/lib/singular/$@ -o $@ $^ ${GLIBC_DYN_FIX}
+
+ # dynamic module for python bject support
+ pyobject.${MODULE_SUFFIX}: pyobject.dl_o
diff --git a/sci-mathematics/singular/files/singular-3.1.3.3-os_x_ppc.patch b/sci-mathematics/singular/files/singular-3.1.3.3-os_x_ppc.patch
new file mode 100644
index 000000000000..e0c54f465548
--- /dev/null
+++ b/sci-mathematics/singular/files/singular-3.1.3.3-os_x_ppc.patch
@@ -0,0 +1,14 @@
+diff -r -u src/kernel/mod_raw.cc src.osx/kernel/mod_raw.cc
+--- src/kernel/mod_raw.cc 2011-04-25 08:25:05.000000000 +0200
++++ src.osx/kernel/mod_raw.cc 2011-10-10 10:47:17.000000000 +0200
+@@ -172,6 +172,10 @@
+ #define HAVE_ELF_SYSTEM
+ #endif
+
++#if defined(ppcMac_darwin)
++#define HAVE_ELF_SYSTEM
++#endif
++
+ #if defined(ix86Mac_darwin)
+ #define HAVE_ELF_SYSTEM
+ #endif
diff --git a/sci-mathematics/singular/files/singular-3.1.3.3.make_parallel.2.patch b/sci-mathematics/singular/files/singular-3.1.3.3.make_parallel.2.patch
new file mode 100644
index 000000000000..8eeaed88d9fb
--- /dev/null
+++ b/sci-mathematics/singular/files/singular-3.1.3.3.make_parallel.2.patch
@@ -0,0 +1,45 @@
+diff -ru src/Makefile.in src.parallel/Makefile.in
+--- src/Makefile.in 2011-08-10 19:47:17.000000000 +0200
++++ src.parallel/Makefile.in 2011-12-10 13:40:18.000000000 +0100
+@@ -146,14 +146,14 @@
+ rm -rf configure
+
+ clean mostlyclean: local-clean
+- $(recurse)
++ +$(recurse)
+
+ distclean: local-distclean
+- $(recurse)
++ +$(recurse)
+ rm -rf build
+
+ maintainer-clean: uninstall local-maintainer-clean
+- $(recurse)
++ +$(recurse)
+
+ ##############################################################
+ # some extra targets for the specific packages
+diff -ru src/Singular/Makefile.in src.parallel/Singular/Makefile.in
+--- src/Singular/Makefile.in 2011-09-30 12:10:15.000000000 +0200
++++ src.parallel/Singular/Makefile.in 2011-12-10 13:39:41.000000000 +0100
+@@ -413,7 +413,7 @@
+
+ cntrlc.o cntrlc.og : feOptES.inc feOptTS.inc feOpt.inc version.h
+
+-misc_ip.o emacs.o tesths.o: version.h
++misc_ip.o emacs.o tesths.o: feOpt.inc version.h
+
+ claptmpl.o: claptmpl.cc mod2.h
+ ${CXX} ${CXXFLAGS} ${CPPFLAGS} ${DEFS} -c $<
+diff -ru src/kernel/Makefile.in src.parallel/kernel/Makefile.in
+--- src/kernel/Makefile.in 2011-05-18 09:37:59.000000000 +0200
++++ src.parallel/kernel/Makefile.in 2011-12-10 13:39:41.000000000 +0100
+@@ -243,7 +243,7 @@
+
+ # Hmm compiling with -fomit-frame-pointer resulted in access violation
+ # under cygwin
+-prCopy.o: prCopy.inc
++prCopy.o prCopy.og prCopy.op: prCopy.inc
+
+ prCopy.inc : prCopyMacros.h prCopyTemplate.cc prCopy.pl
+ $(PERL) prCopy.pl > prCopy.xx && mv prCopy.xx prCopy.inc
diff --git a/sci-mathematics/singular/files/singular-3.1.6-factory_template_instantiation.patch b/sci-mathematics/singular/files/singular-3.1.6-factory_template_instantiation.patch
new file mode 100644
index 000000000000..edf764a758eb
--- /dev/null
+++ b/sci-mathematics/singular/files/singular-3.1.6-factory_template_instantiation.patch
@@ -0,0 +1,26 @@
+diff --git a/libfac/factor/tmpl_inst.cc b/libfac/factor/tmpl_inst.cc
+index bda287a..2f5ba49 100644
+Index: libfac/factor/tmpl_inst.cc
+===================================================================
+--- a/libfac/factor/tmpl_inst.cc
++++ b/libfac/factor/tmpl_inst.cc
+@@ -3,7 +3,7 @@
+ ////////////////////////////////////////////////////////////
+
+
+-//#include <templates/ftmpl_array.cc>
++#include <factory/templates/ftmpl_array.cc>
+ //#include <templates/ftmpl_factor.cc>
+ #include <templates/ftmpl_list.h>
+ #include <factory/templates/ftmpl_list.cc>
+@@ -75,8 +75,8 @@ template OSTREAM & operator << ( OSTREAM &, const List<Variable> & );
+ template OSTREAM & operator << ( OSTREAM &, const Array<int> & );
+ #endif
+
+-template class Array<int>;
+-template class Array<Variable>;
++//template class Array<int>;
++//template class Array<Variable>;
+ //template class Array<REvaluation>;
+
+ // for database
diff --git a/sci-mathematics/singular/files/singular-3.1.6-ntl6compat.patch b/sci-mathematics/singular/files/singular-3.1.6-ntl6compat.patch
new file mode 100644
index 000000000000..b0330ccdfc86
--- /dev/null
+++ b/sci-mathematics/singular/files/singular-3.1.6-ntl6compat.patch
@@ -0,0 +1,44 @@
+diff --git a/Singular/claptmpl.cc b/Singular/claptmpl.cc
+index 0fa6109..553afa5 100644
+Index: Singular/claptmpl.cc
+===================================================================
+--- a/Singular/claptmpl.cc
++++ b/Singular/claptmpl.cc
+@@ -123,3 +123,37 @@ template class std::list<PolyMinorValue>;
+ template class Cache<MinorKey, IntMinorValue>;
+ template class Cache<MinorKey, PolyMinorValue>;
+
++#ifdef HAVE_NTL
++#include<NTL/version.h>
++#if NTL_MAJOR_VERSION == 6
++
++#include<NTL/tools.h>
++#include<NTL/lzz_pE.h>
++#include<NTL/lzz_pEX.h>
++#include<NTL/lzz_p.h>
++#include<NTL/vector.h>
++#include<NTL/pair.h>
++#include<NTL/GF2X.h>
++#include<NTL/GF2EX.h>
++#include<NTL/ZZ.h>
++#include<NTL/ZZX.h>
++#include<NTL/ZZ_pX.h>
++#ifdef NTL_CLIENT // in <NTL/tools.h>: using of name space NTL
++NTL_CLIENT
++#endif
++template class Vec<zz_p>;
++template class Vec<zz_pE>;
++template class Mat<zz_p>;
++template class Mat<zz_pE>;
++template class Mat<ZZ>;
++template class Vec<Pair<zz_pEX, long> >;
++template class Vec<Pair<GF2EX, long> >;
++template class Vec<Pair<ZZX, long> >;
++template class Vec<Pair<ZZ_pX, long> >;
++template class Vec<Pair<GF2X, long> >;
++template void swap<zz_pE>(Vec<zz_pE>&, Vec<zz_pE>&);
++template long operator==<zz_p>(Vec<zz_p> const&, Vec<zz_p> const&);
++template Vec<Pair<zz_pX, long> >& Vec<Pair<zz_pX, long> >::operator=(const Vec<Pair<zz_pX, long> >&);
++#endif
++
++#endif
diff --git a/sci-mathematics/singular/files/singular-4.0.0-fix-omalloc-ar-detection.patch b/sci-mathematics/singular/files/singular-4.0.0-fix-omalloc-ar-detection.patch
new file mode 100644
index 000000000000..87b44234af5f
--- /dev/null
+++ b/sci-mathematics/singular/files/singular-4.0.0-fix-omalloc-ar-detection.patch
@@ -0,0 +1,12 @@
+diff -U 3 -dHrN singular-4.0.0.orig/omalloc/configure.ac singular-4.0.0/omalloc/configure.ac
+--- singular-4.0.0.orig/omalloc/configure.ac 2014-03-06 18:07:49.000000000 +0100
++++ singular-4.0.0/omalloc/configure.ac 2014-05-09 15:41:19.755097185 +0200
+@@ -117,7 +117,7 @@
+ dnl check for programs
+ dnl
+ AC_CHECK_PROG(AR, ar, ar, :)
+-if test "$ac_cv_prog_AR" != ar; then
++if test "$ac_cv_prog_AR" = no; then
+ AC_MSG_ERROR(*** ar program not found)
+ fi
+ AC_CHECK_PROGS(PERL, perl, "no")
diff --git a/sci-mathematics/singular/files/singular-4.0.2-ntl8-compat.patch b/sci-mathematics/singular/files/singular-4.0.2-ntl8-compat.patch
new file mode 100644
index 000000000000..d3e6b77a28e9
--- /dev/null
+++ b/sci-mathematics/singular/files/singular-4.0.2-ntl8-compat.patch
@@ -0,0 +1,38 @@
+diff --git a/factory/NTLconvert.cc b/factory/NTLconvert.cc
+index 41ce9b2..e32093d 100644
+--- a/factory/NTLconvert.cc
++++ b/factory/NTLconvert.cc
+@@ -30,6 +30,7 @@
+ #include <NTL/GF2EXFactoring.h>
+ #include <NTL/tools.h>
+ #include <NTL/mat_ZZ.h>
++#include <NTL/version.h>
+ #include "int_int.h"
+ #include <limits.h>
+ #include "NTLconvert.h"
+@@ -500,8 +501,14 @@ convertZZ2CF (const ZZ & a)
+ return CanonicalForm(coeff_long);
+ }
+ else
+- {
+- long sizeofrep= ((long *) a.rep) [1];
++ {
++ const long * rep =
++#if NTL_MAJOR_VERSION <= 6
++ static_cast<long *>( a.rep );
++#else
++ static_cast<long *>( a.rep.rep ); // what about NTL7?
++#endif
++ long sizeofrep= rep[1];
+ bool lessZero= false;
+ if (sizeofrep < 0)
+ {
+@@ -519,7 +526,7 @@ convertZZ2CF (const ZZ & a)
+ cf_stringtemp_l= sizeofrep*sizeof(mp_limb_t)*2;
+ cf_stringtemp= (unsigned char*) Alloc (cf_stringtemp_l);
+ }
+- int cc= mpn_get_str (cf_stringtemp, 16, (mp_limb_t *) (((long *) (a.rep)) + 2), sizeofrep);
++ int cc= mpn_get_str (cf_stringtemp, 16, (mp_limb_t *) ((rep) + 2), sizeofrep);
+
+ char* cf_stringtemp2;
+ if (lessZero)
diff --git a/sci-mathematics/singular/metadata.xml b/sci-mathematics/singular/metadata.xml
new file mode 100644
index 000000000000..2a047b6737c1
--- /dev/null
+++ b/sci-mathematics/singular/metadata.xml
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <maintainer>
+ <email>tomka@gentoo.org</email>
+ <name>Thomas Kahle</name>
+ </maintainer>
+ <herd>sci-mathematics</herd>
+ <use>
+ <flag name="boost">Compile against external boost headers (<pkg>dev-libs/boost</pkg>)</flag>
+ </use>
+</pkgmetadata>
diff --git a/sci-mathematics/singular/singular-3.1.6.ebuild b/sci-mathematics/singular/singular-3.1.6.ebuild
new file mode 100644
index 000000000000..20e3c262c94f
--- /dev/null
+++ b/sci-mathematics/singular/singular-3.1.6.ebuild
@@ -0,0 +1,176 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+PYTHON_COMPAT=( python2_7 )
+
+inherit autotools eutils elisp-common flag-o-matic multilib prefix python-single-r1 versionator
+
+MY_PN=Singular
+MY_PV=$(replace_all_version_separators -)
+MY_DIR=$(get_version_component_range 1-3 ${MY_PV})
+# Note: Upstream's share tarball may not get updated on every release
+MY_SHARE_DIR="3-1-6"
+MY_PV_SHARE="${MY_PV}"
+
+DESCRIPTION="Computer algebra system for polynomial computations"
+HOMEPAGE="http://www.singular.uni-kl.de/"
+
+SRC_COM="http://www.mathematik.uni-kl.de/ftp/pub/Math/${MY_PN}/SOURCES/"
+SRC_URI="${SRC_COM}${MY_DIR}/${MY_PN}-${MY_PV}.tar.gz
+ ${SRC_COM}${MY_SHARE_DIR}/${MY_PN}-${MY_PV_SHARE}-share.tar.gz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="amd64 ppc x86 ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos"
+IUSE="boost doc emacs examples python readline test"
+
+RDEPEND="
+ dev-libs/gmp:0=
+ dev-libs/ntl:0=
+ emacs? ( >=virtual/emacs-22 )
+ readline? ( sys-libs/readline:0= )"
+DEPEND="${RDEPEND}
+ dev-lang/perl
+ boost? ( dev-libs/boost:0= )"
+
+# Upstream does not care about tests
+RESTRICT="test"
+
+S="${WORKDIR}/${MY_PN}-${MY_DIR}"
+
+pkg_setup() {
+ append-flags -fPIC
+ append-ldflags -fPIC
+ tc-export CC CPP CXX
+ use emacs && elisp-need-emacs 22
+ use python && python-single-r1_pkg_setup
+}
+
+src_prepare () {
+ epatch \
+ "${FILESDIR}"/${PN}-3.1.0-gentoo.patch \
+ "${FILESDIR}"/${PN}-3.1.0-emacs-22.patch \
+ "${FILESDIR}"/${PN}-3.0.4.4-nostrip.patch \
+ "${FILESDIR}"/${PN}-3.1.3.3-Minor.h.patch \
+ "${FILESDIR}"/${PN}-3.1.6-ntl6compat.patch \
+ "${FILESDIR}"/${PN}-3.1.6-factory_template_instantiation.patch
+ use python && epatch "${FILESDIR}"/${PN}-3.1.3.2-python.patch
+
+ if [[ ${CHOST} == *-darwin* ]] ; then
+ epatch "${FILESDIR}"/${PN}-3.1.3.3-install_name.patch
+ eprefixify kernel/Makefile.in
+ eprefixify Singular/Makefile.in
+ fi
+
+ eprefixify kernel/feResource.cc
+
+ # The SLDFLAGS mangling prevents passing raw LDLAGS to gcc (see e.g. bug 414709)
+ sed -i \
+ -e "/CXXFLAGS/ s/--no-exceptions//g" \
+ -e "s/SLDFLAGS=-shared/SLDFLAGS=\"$(raw-ldflags) -shared\"\n\t \tSLDFLAGS2=\"${LDFLAGS} -shared\"/" \
+ -e "s/ SLDFLAGS=/ SLDFLAGS=\n SLDFLAGS2=/" \
+ -e "s/AC_SUBST(SLDFLAGS)/AC_SUBST(SLDFLAGS)\nAC_SUBST(SLDFLAGS2)/" \
+ "${S}"/Singular/configure.in || die
+
+ sed -i \
+ -e "s/@SLDFLAGS@/@SLDFLAGS@\nSLDFLAGS2\t= @SLDFLAGS2@/" \
+ -e "/\$(CXX).*SLDFLAGS/s/SLDFLAGS/SLDFLAGS2/" \
+ "${S}"/Singular/Makefile.in || die
+
+ # remove ntl sources for safety.
+ rm -r ntl || die
+
+ cd "${S}"/Singular || die "failed to cd into Singular/"
+
+ eautoconf
+}
+
+src_configure() {
+ econf \
+ --prefix="${S}"/build \
+ --exec-prefix="${S}"/build \
+ --bindir="${S}"/build/bin \
+ --libdir="${S}"/build/lib \
+ --libexecdir="${S}"/build/lib \
+ --includedir="${S}"/build/include \
+ --with-apint=gmp \
+ --with-NTL \
+ --disable-doc \
+ --without-MP \
+ --without-flint \
+ --enable-factory \
+ --enable-libfac \
+ --enable-IntegerProgramming \
+ --enable-Singular \
+ --with-malloc=system \
+ $(use_with python python embed) \
+ $(use_with boost Boost) \
+ $(use_enable emacs) \
+ $(use_with readline)
+}
+
+src_compile() {
+ emake
+ if use emacs; then
+ cd "${WORKDIR}"/${MY_PN}/${MY_SHARE_DIR}/emacs/
+ elisp-compile *.el
+ fi
+}
+
+src_test() {
+ # Tests fail to link -lsingular, upstream ticket #243
+ emake test
+}
+
+src_install () {
+ dodoc README
+ # execs and libraries
+ cd "${S}"/build/bin
+ dobin ${MY_PN}* gen_test change_cost solve_IP toric_ideal LLL
+ insinto /usr/$(get_libdir)/${PN}
+ doins *.so
+
+ dosym ${MY_PN}-${MY_DIR} /usr/bin/${MY_PN}
+ dosym ${MY_PN}-${MY_DIR} /usr/bin/${PN}
+
+ # stuff from the share tar ball
+ cd "${WORKDIR}"/${MY_PN}/${MY_SHARE_DIR}
+ insinto /usr/share/${PN}
+ doins -r LIB
+ if use examples; then
+ insinto /usr/share/doc/${PF}
+ doins -r examples
+ fi
+ if use doc; then
+ dohtml -r html/*
+ insinto /usr/share/${PN}
+ doins doc/singular.idx
+ cp info/${PN}.hlp info/${PN}.info &&
+ doinfo info/${PN}.info
+ fi
+ if use emacs; then
+ elisp-install ${PN} emacs/*.el emacs/*.elc emacs/.emacs*
+ elisp-site-file-install "${FILESDIR}"/60${PN}-gentoo.el
+ fi
+}
+
+pkg_postinst() {
+ einfo "The authors ask you to register as a SINGULAR user."
+ einfo "Please check the license file for details."
+ if use emacs; then
+ echo
+ ewarn "Please note that the ESingular emacs wrapper has been"
+ ewarn "removed in favor of full fledged singular support within"
+ ewarn "Gentoo's emacs infrastructure; i.e. just fire up emacs"
+ ewarn "and you should be good to go! See bug #193411 for more info."
+ echo
+ fi
+ use emacs && elisp-site-regen
+}
+
+pkg_postrm() {
+ use emacs && elisp-site-regen
+}
diff --git a/sci-mathematics/singular/singular-4.0.2.ebuild b/sci-mathematics/singular/singular-4.0.2.ebuild
new file mode 100644
index 000000000000..1f60ff3b9e07
--- /dev/null
+++ b/sci-mathematics/singular/singular-4.0.2.ebuild
@@ -0,0 +1,145 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+inherit autotools eutils elisp-common flag-o-matic multilib prefix versionator
+
+MY_PN=Singular
+MY_PV=$(replace_all_version_separators '.')
+# Consistency is different...
+MY_DIR2=$(get_version_component_range 1-3 ${PV})
+MY_DIR=$(replace_all_version_separators '-' ${MY_DIR2})
+# This is where the share tarball unpacks to
+MY_SHARE_DIR="${WORKDIR}"/share/
+
+DESCRIPTION="Computer algebra system for polynomial computations"
+HOMEPAGE="http://www.singular.uni-kl.de/"
+SRC_URI="http://www.mathematik.uni-kl.de/ftp/pub/Math/${MY_PN}/SOURCES/${MY_DIR}/${PN}-${MY_PV}.tar.gz
+ http://www.mathematik.uni-kl.de/ftp/pub/Math/${MY_PN}/SOURCES/${MY_DIR}/${PN}-${MY_PV}-share.tar.gz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="amd64 x86 ~x86-linux ~x86-macos"
+IUSE="boost doc emacs examples python +readline"
+
+RDEPEND="dev-libs/gmp:0
+ >=dev-libs/ntl-5.5.1
+ emacs? ( >=virtual/emacs-22 )
+ sci-mathematics/flint
+ sci-mathematics/4ti2
+ sci-libs/cddlib"
+
+DEPEND="${RDEPEND}
+ dev-lang/perl
+ boost? ( dev-libs/boost )
+ readline? ( sys-libs/readline )"
+
+SITEFILE=60${PN}-gentoo.el
+
+S="${WORKDIR}/${PN}-${MY_DIR2}"
+
+pkg_setup() {
+ append-flags "-fPIC"
+ append-ldflags "-fPIC"
+ tc-export AR CC CPP CXX
+
+ # Ensure that >=emacs-22 is selected
+ if use emacs; then
+ elisp-need-emacs 22 || die "Emacs version too low"
+ fi
+}
+
+src_prepare () {
+ # Need to do something about resources later...
+ # epatch "${FILESDIR}"/${PN}-4.0.0-gentoo.patch
+
+ # omalloc's old configure will fail if ar is not exactly 'ar'.
+ epatch "${FILESDIR}"/${PN}-4.0.0-fix-omalloc-ar-detection.patch
+
+ epatch "${FILESDIR}"/${PN}-4.0.2-ntl8-compat.patch
+
+ # autoreconf everything since otherwise it assumes autmake-1.13 is installed
+ eautoreconf
+}
+
+src_configure() {
+ econf --with-gmp \
+ --with-ntl \
+ --with-flint \
+ --enable-gfanlib \
+ --disable-debug \
+ --disable-doc \
+ --enable-factory \
+ --enable-libfac \
+ --enable-IntegerProgramming \
+ $(use_with python python embed) \
+ $(use_with boost Boost) \
+ $(use_enable emacs) \
+ $(use_with readline) || die "configure failed"
+}
+
+src_compile() {
+ emake || die "emake failed"
+
+ if use emacs; then
+ cd "${MY_SHARE_DIR}"singular/emacs/
+ elisp-compile *.el || die "elisp-compile failed"
+ fi
+}
+
+# src_install () {
+# dodoc README
+# # execs and libraries
+# cd "${S}"/build/bin
+# dobin ${MY_PN}* gen_test change_cost solve_IP toric_ideal LLL \
+# || die "failed to install binaries"
+# insinto /usr/$(get_libdir)/${PN}
+# doins *.so || die "failed to install libraries"
+#
+# dosym ${MY_PN}-${MY_DIR} /usr/bin/${MY_PN} \
+# || die "failed to create symbolic link"
+#
+# # stuff from the share tar ball
+# cd "${WORKDIR}"/${MY_PN}/${MY_SHARE_DIR}
+# insinto /usr/share/${PN}
+# doins -r LIB || die "failed to install lib files"
+# if use examples; then
+# insinto /usr/share/doc/${PF}
+# doins -r examples || die "failed to install examples"
+# fi
+# if use doc; then
+# dohtml -r html/* || die "failed to install html docs"
+# insinto /usr/share/${PN}
+# doins doc/singular.idx || die "failed to install idx file"
+# cp info/${PN}.hlp info/${PN}.info &&
+# doinfo info/${PN}.info \
+# || die "failed to install info files"
+# fi
+# if use emacs; then
+# elisp-install ${PN} emacs/*.el emacs/*.elc emacs/.emacs* \
+# || die "elisp-install failed"
+# elisp-site-file-install "${FILESDIR}/${SITEFILE}"
+# fi
+# }
+
+pkg_postinst() {
+ einfo "The authors ask you to register as a SINGULAR user."
+ einfo "Please check the license file for details."
+
+ if use emacs; then
+ echo
+ ewarn "Please note that the ESingular emacs wrapper has been"
+ ewarn "removed in favor of full fledged singular support within"
+ ewarn "Gentoo's emacs infrastructure; i.e. just fire up emacs"
+ ewarn "and you should be good to go! See bug #193411 for more info."
+ echo
+ fi
+
+ use emacs && elisp-site-regen
+}
+
+pkg_postrm() {
+ use emacs && elisp-site-regen
+}
diff --git a/sci-mathematics/snns/Manifest b/sci-mathematics/snns/Manifest
new file mode 100644
index 000000000000..3cc5f12e65df
--- /dev/null
+++ b/sci-mathematics/snns/Manifest
@@ -0,0 +1,8 @@
+DIST PySNNS-20040605.tar.gz 20158 SHA256 c2dff5a88faa756546dac1c850d5196d8bba39f793537c5ebcaa61e21f0db317
+DIST PythonFunctionSupport-20050210.patch.gz 15728 SHA256 c507c70aa158ffb1422aeef693d45f2e8486b1fc7056142736796dd4273f4869
+DIST SNNSv4.2.Manual.pdf 2103861 SHA256 ffed74a4d63f78b8bf8a400a18ce32c3e8d8b3e89682394cc6af122c097aba62
+DIST SNNSv4.2.tar.gz 2170375 SHA256 13a36eb7e7838cc7df92a2eaa36c955579a99007c2936d85c20ec0c6a3036c38 SHA512 1e7943204783f742048182cc2ea90fcf31f54c9ce868aef0c48baed68056ded2300f86bb0f2f3219fd9e2a6bab1e65aa3101734c0476a95af97e12cffc379614 WHIRLPOOL eb7c49e5039056e56bed3de10cb88f4d90cc65f89e7fe87747aea2b361f72dff04e78a06f8d8ade79de0da67031af1efb148e18a4a7a5935da4d07760d5bea04
+DIST SNNSv4.3.tar.gz 5076669 SHA256 54bf92d23e9198f9030a3c3d2b741472e9b8660b27d3b419ade6393b1ebf6f62 SHA512 a057dc946b581eee01334956c33d6870b8b994d1b835834d58c37ae3a8585dfb1206f3082b17a49ee97b22f4c07c0efb47e4e3ae5aeb37e97f69472da3e21f0b WHIRLPOOL 29e1afc09a6e5ba7de5fc21d2a995f7f093e02e9f6125831ce29dfeaddd125241f440b362b97af5fe0933a21455b4002f606ecdce7b13f24046d20167bd5ad7d
+DIST python.patch.gz 52650 SHA256 de4b97a208bf7a9a1ee40256e153fbd142aa612822e1451d50fd36cbd3ecc1d9
+DIST snns-4.2-20040227.patch.gz 55476 SHA256 08a5fa51552b33e5e981d68cbf05792d40d6d0015abad090697b6f88544d3468 SHA512 29378fead9c59c5c3341e03aa08009230b805ce910a95932c34a9c0f6eaf31ef978410add7e79249fe302992890e693567e32d6686589f2d939efae7d0bc32b0 WHIRLPOOL 64f1283979a06e86d25cd2a750ff53978bc47e8fd5df708d416be3886288ebae6534b10d1a2a6eec3931c81b39ab9b5322c2602094b3b62c3397d7d41671eff8
+DIST snns-4.2-patched.tar.gz 2188658 SHA256 d0fc25dcb82979a46bfdfd24a090ec113b039d0f144f8f7c10404775acd129a7
diff --git a/sci-mathematics/snns/files/4.2-fPIC-python.patch b/sci-mathematics/snns/files/4.2-fPIC-python.patch
new file mode 100644
index 000000000000..c16e9e867280
--- /dev/null
+++ b/sci-mathematics/snns/files/4.2-fPIC-python.patch
@@ -0,0 +1,12 @@
+diff -urpN configuration.orig/Makefile.din configuration/Makefile.din
+--- configuration.orig/Makefile.din 2005-01-30 16:40:54.430169528 +0100
++++ configuration/Makefile.din 2005-01-30 16:41:20.971134688 +0100
+@@ -114,7 +114,7 @@ SUBSTOBJECTS = @LIBOBJS@ @ALLOCA@
+ .SUFFIXES:
+ .SUFFIXES: .c .o
+ .c.o:
+- $(CC) $(CPPFLAGS) $(CFLAGS) -c $<
++ $(CC) -fPIC $(CPPFLAGS) $(CFLAGS) -c $<
+
+ #*****************************************************************************
+ # End of common Makefile.defs
diff --git a/sci-mathematics/snns/files/4.2-ldflags.patch b/sci-mathematics/snns/files/4.2-ldflags.patch
new file mode 100644
index 000000000000..752380d1d8f0
--- /dev/null
+++ b/sci-mathematics/snns/files/4.2-ldflags.patch
@@ -0,0 +1,42 @@
+Respect LDFLAGS
+
+https://bugs.gentoo.org/show_bug.cgi?id=332475
+
+--- tools/sources/Makefile
++++ tools/sources/Makefile
+@@ -147,19 +147,19 @@
+ # Linking of single stand alone programs
+
+ analyze: analyze.o
+- $(CC) analyze.o -lm -o analyze
++ $(CC) $(LDFLAGS) analyze.o -lm -o analyze
+
+ pat_sel_simple: pat_sel_simple.o
+- $(CC) pat_sel_simple.o -lm -o pat_sel_simple
++ $(CC) $(LDFLAGS) pat_sel_simple.o -lm -o pat_sel_simple
+
+ mkhead: mkhead.o
+- $(CC) mkhead.o -lm -o mkhead
++ $(CC) $(LDFLAGS) mkhead.o -lm -o mkhead
+
+ mkout: mkout.o
+- $(CC) mkout.o -lm -o mkout
++ $(CC) $(LDFLAGS) mkout.o -lm -o mkout
+
+ mkpat: mkpat.o
+- $(CC) mkpat.o -lm -o mkpat
++ $(CC) $(LDFLAGS) mkpat.o -lm -o mkpat
+
+
+ # Make sure that kernel libs are available and up to date
+--- xgui/sources/Makefile
++++ xgui/sources/Makefile
+@@ -202,7 +202,7 @@
+ # Linking of xgui
+
+ xgui: $(LIBXGUI1) $(LIBXGUI2) $(BN3DLIB) $(KERNELLIBS)
+- $(CC) $(LIBXGUI1) $(LIBXGUI2) $(BN3DLIB) \
++ $(CC) $(LDFLAGS) $(LIBXGUI1) $(LIBXGUI2) $(BN3DLIB) \
+ $(X_LIBS) -lXaw3d -lXmu -lXt -lXext $(X_PRE_LIBS) -lX11 $(X_EXTRA_LIBS) \
+ $(KERNELALLLIBS) -o xgui
+
diff --git a/sci-mathematics/snns/files/4.3-bison-version.patch b/sci-mathematics/snns/files/4.3-bison-version.patch
new file mode 100644
index 000000000000..73da70187254
--- /dev/null
+++ b/sci-mathematics/snns/files/4.3-bison-version.patch
@@ -0,0 +1,11 @@
+--- configure.old 2015-04-08 16:27:05.000000000 -0400
++++ configure 2015-04-08 16:26:41.000000000 -0400
+@@ -5071,7 +5071,7 @@
+ else
+ { echo "$as_me:$LINENO: checking for version of bison" >&5
+ echo $ECHO_N "checking for version of bison... $ECHO_C" >&6; }
+- bison_version=`$BISON --version`
++ bison_version=`$BISON --version |head -n 1`
+ { echo "$as_me:$LINENO: result: $bison_version" >&5
+ echo "${ECHO_T}$bison_version" >&6; }
+ warn_bison=yes
diff --git a/sci-mathematics/snns/files/4.3-snns-netperf.patch b/sci-mathematics/snns/files/4.3-snns-netperf.patch
new file mode 100644
index 000000000000..f154a538b2d9
--- /dev/null
+++ b/sci-mathematics/snns/files/4.3-snns-netperf.patch
@@ -0,0 +1,164 @@
+--- a/examples/nettalk.README 2008-04-21 03:55:43.000000000 -0400
++++ b/examples/nettalk.README 2015-04-14 09:38:23.836014999 -0400
+@@ -60,7 +60,7 @@
+ Hints:
+ ======
+
+-We usually call nettalk.net from the tool 'netperf', a benchmarking
++We usually call nettalk.net from the tool 'snns-netperf', a benchmarking
+ version of SNNS without graphical user interface but with the full and
+ current SNNS kernel. It is supplied with SNNS in the tools directory.
+ We usually train and test nettalk for 10 cycles. Since convergence is
+--- a/man/man1/snns.1 2008-04-21 03:56:05.000000000 -0400
++++ b/man/man1/snns.1 2015-04-14 09:36:27.406012874 -0400
+@@ -111,7 +111,7 @@
+ .BR netlearn (1)
+ backpropagation test program
+
+-.BR netperf (1)
++.BR snns-netperf (1)
+ benchmark program
+
+ .BR pat_sel (1)
+@@ -132,4 +132,4 @@
+ yet.
+
+ .SH AUTHOR
+-Guenter W. Mamier
+\ No newline at end of file
++Guenter W. Mamier
+--- a/tools/doc/netperf.doc 2008-04-21 03:56:06.000000000 -0400
++++ b/tools/doc/netperf.doc 1969-12-31 19:00:00.000000000 -0500
+@@ -1,49 +0,0 @@
+- ===============================
+- Description of the tool NETPERF
+- ===============================
+-
+-This is a benchmark program for SNNS. Propagtion and
+-backpropagation tests are performed.
+-
+-synopsis: netperf
+-
+-
+-example:
+-
+-unix >netperf
+-
+-produces
+-
+- SNNS 3D-Kernel V3.1000
+- ----- Benchmark Test -----
+-
+- Filename of the network file: ../../../examples/nettalk.net
+- Loading the network ...
+-
+- Network name: nettalk1
+- No. of units : 349
+- No. of input units : 203
+- No. of output units: 26
+- No. of sites: 0
+- No. of links: 27480
+-
+- Learning function: Std_Backpropagation
+- Update function : Topological_Order
+-
+- Do you want to benchmark
+- Propagation [1] or
+- Backpropagation [2] ?
+- Input: 1
+-
+- Choose no. of cycles: 100
+-
+- Begin propagation ...
+-
+-
+- No. of units updated: 34900
+- No. of sites updated: 0
+- No. of links updated: 2748000
+- CPU Time used: 3.05 seconds
+-
+- No. of connection per second (CPS): 9.0098e+05
+-
+--- a/tools/doc/snns-netperf.doc 1969-12-31 19:00:00.000000000 -0500
++++ b/tools/doc/snns-netperf.doc 2015-04-14 09:37:21.126013855 -0400
+@@ -0,0 +1,49 @@
++ ====================================
++ Description of the tool SNNS-NETPERF
++ ====================================
++
++This is a benchmark program for SNNS. Propagtion and
++backpropagation tests are performed.
++
++synopsis: snns-netperf
++
++
++example:
++
++unix >snns-netperf
++
++produces
++
++ SNNS 3D-Kernel V3.1000
++ ----- Benchmark Test -----
++
++ Filename of the network file: ../../../examples/nettalk.net
++ Loading the network ...
++
++ Network name: nettalk1
++ No. of units : 349
++ No. of input units : 203
++ No. of output units: 26
++ No. of sites: 0
++ No. of links: 27480
++
++ Learning function: Std_Backpropagation
++ Update function : Topological_Order
++
++ Do you want to benchmark
++ Propagation [1] or
++ Backpropagation [2] ?
++ Input: 1
++
++ Choose no. of cycles: 100
++
++ Begin propagation ...
++
++
++ No. of units updated: 34900
++ No. of sites updated: 0
++ No. of links updated: 2748000
++ CPU Time used: 3.05 seconds
++
++ No. of connection per second (CPS): 9.0098e+05
++
+--- a/tools/sources/Makefile 2015-04-14 09:34:31.386010756 -0400
++++ b/tools/sources/Makefile 2015-04-14 09:35:50.526012201 -0400
+@@ -89,7 +89,7 @@
+
+ TOOLS_PRG = $(TOOLS_SOURCES_C:.c=)
+ KRTOOLS_PRG = snns2c pat_sel netlearn td_bignet ff_bignet \
+- netperf snnsbat feedback-gennet convert2snns \
++ snns-netperf snnsbat feedback-gennet convert2snns \
+ isnns linknets
+ BATCH_PRG = batchman
+
+@@ -110,7 +110,7 @@
+ tools: $(TOOLS_PRG) $(KRTOOLS_PRG) $(BATCH_PRG)
+
+ $(TOOLSBINDIR):
+- -mkdir $(TOOLSBINDIR)
++ -mkdir -p $(TOOLSBINDIR)
+
+ install: tools $(TOOLSBINDIR)
+ for tooltarget in $(TOOLS_PRG) $(KRTOOLS_PRG) $(BATCH_PRG) ; do \
+@@ -191,8 +191,8 @@
+ ff_bignet: ff_bignet.o $(KERNELLIBS)
+ $(CC) $(LDFLAGS) ff_bignet.o $(KERNELALLLIBS) -o ff_bignet
+
+-netperf: netperf.o $(KERNELLIBS)
+- $(CC) $(LDFLAGS) netperf.o $(KERNELALLLIBS) -o netperf
++snns-netperf: netperf.o $(KERNELLIBS)
++ $(CC) $(LDFLAGS) netperf.o $(KERNELALLLIBS) -o snns-netperf
+
+ snnsbat: snnsbat.o $(KERNELLIBS)
+ $(CC) $(LDFLAGS) snnsbat.o $(KERNELALLLIBS) -o snnsbat
diff --git a/sci-mathematics/snns/files/4.3-unstrip.patch b/sci-mathematics/snns/files/4.3-unstrip.patch
new file mode 100644
index 000000000000..4f36040e2218
--- /dev/null
+++ b/sci-mathematics/snns/files/4.3-unstrip.patch
@@ -0,0 +1,11 @@
+--- a/configuration/install-sh 2008-04-21 03:55:33.000000000 -0400
++++ b/configuration/install-sh 2015-04-08 16:59:32.000000000 -0400
+@@ -79,7 +79,7 @@
+ shift
+ continue;;
+
+- -s) stripcmd="$stripprog"
++ -s) stripcmd=""
+ shift
+ continue;;
+
diff --git a/sci-mathematics/snns/metadata.xml b/sci-mathematics/snns/metadata.xml
new file mode 100644
index 000000000000..601be9594b9b
--- /dev/null
+++ b/sci-mathematics/snns/metadata.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+<herd>sci-mathematics</herd>
+<maintainer>
+ <email>axs@gentoo.org</email>
+ <name>Ian Stakenvicius</name>
+</maintainer>
+</pkgmetadata>
diff --git a/sci-mathematics/snns/snns-4.2-r8.ebuild b/sci-mathematics/snns/snns-4.2-r8.ebuild
new file mode 100644
index 000000000000..15da02f7ae69
--- /dev/null
+++ b/sci-mathematics/snns/snns-4.2-r8.ebuild
@@ -0,0 +1,134 @@
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="3"
+PYTHON_DEPEND="python? 2"
+SUPPORT_PYTHON_ABIS="1"
+RESTRICT_PYTHON_ABIS="3.* *-jython"
+
+inherit distutils eutils
+
+MY_P="SNNSv${PV}"
+MYPATCH="${P}-20040227"
+MYPYTHONEXT="PySNNS-20040605"
+MYPYTHONPATCH="PythonFunctionSupport-20050210.patch"
+
+DESCRIPTION="Stuttgart Neural Network Simulator"
+HOMEPAGE="http://www-ra.informatik.uni-tuebingen.de/SNNS/"
+SRC_URI="http://www-ra.informatik.uni-tuebingen.de/downloads/SNNS/${MY_P}.tar.gz
+ mirror://berlios/snns-dev/${MYPATCH}.patch.gz
+ doc? ( http://www-ra.informatik.uni-tuebingen.de/downloads/SNNS/${MY_P}.Manual.pdf )
+ python? ( mirror://berlios/snns-dev/${MYPYTHONEXT}.tar.gz
+ mirror://berlios/snns-dev/${MYPYTHONPATCH}.gz )"
+
+LICENSE="SNNS-${PV}"
+KEYWORDS="amd64 ppc x86"
+SLOT="0"
+IUSE="X doc python"
+
+RDEPEND="X? ( x11-libs/libXaw3d )"
+DEPEND="${RDEPEND}
+ X? ( x11-proto/xproto )"
+
+S="${WORKDIR}/${MY_P}"
+
+src_unpack() {
+ unpack ${MY_P}.tar.gz
+ unpack ${MYPATCH}.patch.gz
+
+ if use python; then
+ unpack ${MYPYTHONEXT}.tar.gz
+ unpack ${MYPYTHONPATCH}.gz
+ fi
+}
+
+src_prepare() {
+ epatch "${WORKDIR}/${MYPATCH}.patch" \
+ "${FILESDIR}/${PV}-ldflags.patch"
+
+ if use python; then
+ epatch "${FILESDIR}/${PV}-fPIC-python.patch"
+ epatch "${WORKDIR}/${MYPYTHONPATCH}"
+ fi
+
+ cd xgui/sources
+ for file in *.c; do
+ sed -e "s:X11/Xaw/:X11/Xaw3d/:g" -i "${file}"
+ done
+}
+
+src_configure() {
+ local myconf="--enable-global"
+
+ if use X; then
+ myconf+=" --with-x"
+ else
+ myconf+=" --without-x"
+ fi
+
+ econf ${myconf}
+}
+
+src_compile() {
+ local compileopts="compile-kernel compile-tools"
+ if use X; then
+ compileopts+=" compile-xgui"
+ fi
+
+ # parallel make sometimes fails (phosphan)
+ emake -j1 ${compileopts} || die "make failed"
+
+ if use python; then
+ pushd python > /dev/null
+ distutils_src_compile
+ popd > /dev/null
+ fi
+}
+
+src_install() {
+ for file in `find tools -type f -perm +100`; do
+ dobin $file
+ done
+
+ mv "${D}/usr/bin/netperf" "${D}/usr/bin/snns-netperf"
+
+ if use X; then
+ newbin xgui/sources/xgui snns
+
+ dodir /etc/env.d
+ echo XGUILOADPATH=/usr/share/doc/${PF}/ > "${D}"/etc/env.d/99snns
+
+ insinto /usr/share/doc/${PF}
+ doins default.cfg help.hdoc
+ fi
+
+ if use python; then
+ pushd python > /dev/null
+ distutils_src_install
+ cp -pPR examples "${D}"/usr/share/doc/${PF}/python-examples
+ chmod +x "${D}"/usr/share/doc/${PF}/python-examples/*.py
+ newdoc README README.python
+ popd > /dev/null
+ fi
+
+ insinto /usr/share/doc/${PF}
+ use doc && doins "${DISTDIR}"/${MY_P}.Manual.pdf
+
+ insinto /usr/share/doc/${PF}/examples
+ doins examples/*
+
+ doman man/man*/*
+}
+
+pkg_postinst() {
+ if use python; then
+ distutils_pkg_postinst
+ fi
+}
+
+pkg_postrm() {
+ if use python; then
+ distutils_pkg_postrm
+ fi
+}
diff --git a/sci-mathematics/snns/snns-4.2-r9.ebuild b/sci-mathematics/snns/snns-4.2-r9.ebuild
new file mode 100644
index 000000000000..af5ebc4090fa
--- /dev/null
+++ b/sci-mathematics/snns/snns-4.2-r9.ebuild
@@ -0,0 +1,123 @@
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="3"
+PYTHON_DEPEND="python? 2"
+SUPPORT_PYTHON_ABIS="1"
+RESTRICT_PYTHON_ABIS="3.* *-jython"
+
+inherit distutils eutils
+
+MY_P="SNNSv${PV}"
+DESCRIPTION="Stuttgart Neural Network Simulator"
+HOMEPAGE="http://sourceforge.net/projects/snns/"
+SRC_URI="mirror://sourceforge/snns/${PN}-${PV}-patched.tar.gz
+ doc? ( http://www-ra.informatik.uni-tuebingen.de/downloads/SNNS/${MY_P}.Manual.pdf )
+ python? ( mirror://sourceforge/snns/python.patch.gz )"
+
+LICENSE="LGPL-2.1"
+KEYWORDS="~amd64 ~ppc ~x86"
+SLOT="0"
+IUSE="X doc python"
+
+RDEPEND="X? ( x11-libs/libXaw3d )"
+DEPEND="${RDEPEND}
+ X? ( x11-proto/xproto )"
+
+S="${WORKDIR}/${PN}"
+
+src_unpack() {
+ unpack ${PN}-${PV}-patched.tar.gz
+
+ if use python; then
+ unpack python.patch.gz
+ fi
+}
+
+src_prepare() {
+
+ if use python; then
+ epatch "${WORKDIR}/python.patch"
+ fi
+
+ cd xgui/sources
+ for file in *.c; do
+ sed -e "s:X11/Xaw/:X11/Xaw3d/:g" -i "${file}"
+ done
+}
+
+src_configure() {
+ local myconf="--enable-global"
+
+ if use X; then
+ myconf+=" --with-x"
+ else
+ myconf+=" --without-x"
+ fi
+
+ econf ${myconf}
+}
+
+src_compile() {
+ local compileopts="compile-kernel compile-tools"
+ if use X; then
+ compileopts+=" compile-xgui"
+ fi
+
+ # parallel make sometimes fails (phosphan)
+ emake -j1 ${compileopts} || die "make failed"
+
+ if use python; then
+ pushd python > /dev/null
+ distutils_src_compile
+ popd > /dev/null
+ fi
+}
+
+src_install() {
+ for file in `find tools -type f -perm +100`; do
+ dobin $file
+ done
+
+ mv "${D}/usr/bin/netperf" "${D}/usr/bin/snns-netperf"
+
+ if use X; then
+ newbin xgui/sources/xgui snns
+
+ dodir /etc/env.d
+ echo XGUILOADPATH=/usr/share/doc/${PF}/ > "${D}"/etc/env.d/99snns
+
+ insinto /usr/share/doc/${PF}
+ doins default.cfg help.hdoc
+ fi
+
+ if use python; then
+ pushd python > /dev/null
+ distutils_src_install
+ cp -pPR examples "${D}"/usr/share/doc/${PF}/python-examples
+ chmod +x "${D}"/usr/share/doc/${PF}/python-examples/*.py
+ newdoc README README.python
+ popd > /dev/null
+ fi
+
+ insinto /usr/share/doc/${PF}
+ use doc && doins "${DISTDIR}"/${MY_P}.Manual.pdf
+
+ insinto /usr/share/doc/${PF}/examples
+ doins examples/*
+
+ doman man/man*/*
+}
+
+pkg_postinst() {
+ if use python; then
+ distutils_pkg_postinst
+ fi
+}
+
+pkg_postrm() {
+ if use python; then
+ distutils_pkg_postrm
+ fi
+}
diff --git a/sci-mathematics/snns/snns-4.3-r2.ebuild b/sci-mathematics/snns/snns-4.3-r2.ebuild
new file mode 100644
index 000000000000..78d50c673e98
--- /dev/null
+++ b/sci-mathematics/snns/snns-4.3-r2.ebuild
@@ -0,0 +1,124 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+PYTHON_COMPAT=( python2_7 )
+DISTUTILS_OPTIONAL=1
+inherit distutils-r1 eutils
+
+MY_P="SNNSv${PV}"
+DESCRIPTION="Stuttgart Neural Network Simulator"
+HOMEPAGE="http://sourceforge.net/projects/snns/"
+SRC_URI="http://www.ra.cs.uni-tuebingen.de/downloads/SNNS/${MY_P}.tar.gz
+ doc? ( http://www.ra.cs.uni-tuebingen.de/downloads/SNNS/SNNSv4.2.Manual.pdf )"
+
+LICENSE="LGPL-2.1"
+KEYWORDS="~amd64 ~ppc ~x86"
+SLOT="0"
+IUSE="X doc python"
+
+RDEPEND="X? (
+ x11-libs/libX11
+ x11-libs/libXaw3d
+ x11-libs/libXt
+ )"
+DEPEND="${RDEPEND}
+ X? ( x11-proto/xproto )
+ >=sys-devel/bison-1.2.2"
+
+RDEPEND+=" python? ( ${PYTHON_DEPS} )"
+REQUIRED_USE="python? ( ${PYTHON_REQUIRED_USE} )"
+
+S="${WORKDIR}/${MY_P}"
+
+src_prepare() {
+ epatch "${FILESDIR}"/4.3-unstrip.patch
+ epatch "${FILESDIR}"/4.3-bison-version.patch
+ epatch "${FILESDIR}"/4.2-ldflags.patch
+ epatch "${FILESDIR}"/4.3-snns-netperf.patch # bug 248322
+
+ # change all references of Xaw to Xaw3d
+ cd "${S}"/xgui/sources
+ for file in *.c; do
+ sed -e "s:X11/Xaw/:X11/Xaw3d/:g" -i "${file}"
+ done
+
+ # clean up the dirty dist sources and remove files that apparently
+ # are not removed by any clean rules
+ emake clean
+ rm -Rf "${S}"/{tools,xgui}/bin \
+ "${S}"/{Makefile.def,config.h} \
+ "${S}"/configuration/config.{guess,log}
+
+ epatch_user
+
+ if use python; then
+ pushd "${S}"/python > /dev/null || die
+ distutils-r1_src_prepare
+ popd > /dev/null || die
+ fi
+}
+
+src_configure() {
+ econf --enable-global \
+ $(use_with X x)
+
+ if use python; then
+ pushd python > /dev/null || die
+ distutils-r1_src_configure
+ popd > /dev/null || die
+ fi
+}
+
+src_compile() {
+ local compileopts=( compile-kernel compile-tools )
+ use X && compileopts+=( compile-xgui )
+
+ # parallel make sometimes fails (phosphan)
+ # so emake each phase separately (axs)
+ for tgt in "${compileopts[@]}"; do
+ emake ${tgt}
+ done
+
+ if use python; then
+ pushd python > /dev/null || die
+ distutils-r1_src_compile
+ popd > /dev/null || die
+ fi
+}
+
+src_install() {
+ pushd "${S}"/tools/sources > /dev/null || die
+ emake TOOLSBINDIR="${ED}"usr/bin install
+ popd > /dev/null || die
+
+ if use X; then
+ newbin xgui/sources/xgui snns
+
+ echo XGUILOADPATH=/usr/share/doc/${PF} > "${T}"/99snns
+ doenvd "${T}"/99snns
+
+ docompress -x /usr/share/doc/${PF}/{default.cfg,help.hdoc}
+ insinto /usr/share/doc/${PF}
+ doins default.cfg help.hdoc
+ fi
+
+ if use python; then
+ pushd python > /dev/null || die
+ distutils-r1_src_install
+ insinto /usr/share/doc/${PF}/python-examples
+ doins examples/*
+ newdoc README README.python
+ popd > /dev/null || die
+ fi
+
+ if use doc; then
+ insinto /usr/share/doc/${PF}
+ doins "${DISTDIR}"/${MY_P}.Manual.pdf
+ fi
+
+ insinto /usr/share/doc/${PF}/examples
+ doins examples/*
+ doman man/man*/*
+}
diff --git a/sci-mathematics/spass/Manifest b/sci-mathematics/spass/Manifest
new file mode 100644
index 000000000000..5fb13726e6ab
--- /dev/null
+++ b/sci-mathematics/spass/Manifest
@@ -0,0 +1 @@
+DIST spass37.tgz 1340925 SHA256 13c67e5e09b814ba50f38a391fe653661ba714e7541ffd4951efef91274aaacc SHA512 5b4efd7b767dfee3f24e7917a6ec58ac240ab33bf601722eabd50af57637d8fdd62de9e34e7cd1cd98b8b7e371c9e2d47c8fa3e07c6e7ce2fa616a76646a4e12 WHIRLPOOL 2fa8881b08a0fcdb9f1a6e7d27849f5c900a32f2cb27d878fbdae4986d0854608fd137e4608349c4eb612f4e1981142e63af8462ab904f7d08c3e2758f319835
diff --git a/sci-mathematics/spass/metadata.xml b/sci-mathematics/spass/metadata.xml
new file mode 100644
index 000000000000..c836a3b70c4d
--- /dev/null
+++ b/sci-mathematics/spass/metadata.xml
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <maintainer>
+ <email>gienah@gentoo.org</email>
+ </maintainer>
+ <herd>sci-mathematics</herd>
+ <longdescription lang="en">
+SPASS: An Automated Theorem Prover for First-Order Logic with Equality.
+</longdescription>
+ <use>
+ <flag name="isabelle">Add integration support for the Isabelle/HOL
+ theorem prover.</flag>
+ </use>
+</pkgmetadata>
diff --git a/sci-mathematics/spass/spass-3.7.ebuild b/sci-mathematics/spass/spass-3.7.ebuild
new file mode 100644
index 000000000000..30967c76c84d
--- /dev/null
+++ b/sci-mathematics/spass/spass-3.7.ebuild
@@ -0,0 +1,81 @@
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+inherit versionator
+
+MY_PV=$(delete_all_version_separators "${PV}")
+MY_P="${PN}${MY_PV}"
+
+DESCRIPTION="An Automated Theorem Prover for First-Order Logic with Equality"
+HOMEPAGE="http://www.spass-prover.org/"
+SRC_URI="http://www.spass-prover.org/download/sources/${MY_P}.tgz"
+
+LICENSE="BSD-2"
+SLOT="0/${PV}"
+KEYWORDS="~amd64 ~x86"
+IUSE="doc examples isabelle"
+
+RDEPEND="isabelle? (
+ >=sci-mathematics/isabelle-2011.1-r1:=
+ )"
+DEPEND="${RDEPEND}"
+
+S="${WORKDIR}/SPASS-${PV}"
+
+src_prepare() {
+ sed \
+ -e "s:-O3:${CFLAGS}:g" \
+ -i configure || die
+}
+
+src_install() {
+ default
+
+ if use examples; then
+ insinto /usr/share/${PN}/
+ doins -r examples
+ fi
+
+ if use isabelle; then
+ ISABELLE_HOME="$(isabelle getenv ISABELLE_HOME | cut -d'=' -f 2)"
+ [[ -n "${ISABELLE_HOME}" ]] || die "ISABELLE_HOME empty"
+ dodir "${ISABELLE_HOME}/contrib/${PN}-${PV}/etc"
+ cat <<- EOF >> "${S}/settings"
+ SPASS_HOME="${ROOT}usr/bin"
+ SPASS_VERSION="${PV}"
+ EOF
+ insinto "${ISABELLE_HOME}/contrib/${PN}-${PV}/etc"
+ doins "${S}/settings"
+ fi
+}
+
+pkg_postinst() {
+ if use isabelle; then
+ if [ -f "${ROOT}etc/isabelle/components" ]; then
+ if egrep "contrib/${PN}-[0-9.]*" "${ROOT}etc/isabelle/components"; then
+ sed -e "/contrib\/${PN}-[0-9.]*/d" \
+ -i "${ROOT}etc/isabelle/components"
+ fi
+ cat <<- EOF >> "${ROOT}etc/isabelle/components"
+ contrib/${PN}-${PV}
+ EOF
+ fi
+ fi
+}
+
+pkg_postrm() {
+ if use isabelle; then
+ if [ ! -f "${ROOT}usr/bin/SPASS" ]; then
+ if [ -f "${ROOT}etc/isabelle/components" ]; then
+ # Note: this sed should only match the version of this ebuild
+ # Which is what we want as we do not want to remove the line
+ # of a new spass being installed during an upgrade.
+ sed -e "/contrib\/${PN}-${PV}/d" \
+ -i "${ROOT}etc/isabelle/components"
+ fi
+ fi
+ fi
+}
diff --git a/sci-mathematics/spin/Manifest b/sci-mathematics/spin/Manifest
new file mode 100644
index 000000000000..3063713d9e14
--- /dev/null
+++ b/sci-mathematics/spin/Manifest
@@ -0,0 +1,3 @@
+DIST spin621.tar.gz 463101 SHA256 2b3a9163e1bce4cb6402550819f6e190449e0e5aeb7b81630a017e130f7921cb
+DIST spin623.tar.gz 465637 SHA256 a056a7d360c4ab0322e5e8d09c6a0f23178b2ad471413e208136c5a29f1650ec SHA512 7a4faeee95a8c10b6a875e6bbfe6fdab91f982401601cd33d2701a8001ee27aa21738fe10e01720505b54f9b1369e0e79ae19bdf7909b0ef23bc49f70d76992b WHIRLPOOL 7bb4450313037c65ba0326b3261584592950060fdc28de6bb968958ed7f75976ee45d72499970a08e44021a71d70c2aa61f12072d5a1be266f07968a17db0890
+DIST spin625.tar.gz 468314 SHA256 3273c15af419912b00f1a3b9683af8f516a6a2afae788a575006d5fee0ecf330 SHA512 1679fb52981da762f6a5955116bfa0906bf12de7a219319fedf7ba068ba0c2ad51aa6a49d3b30115391f7070c7169c7c0753a23ef95257d350a9160e2d1f3ded WHIRLPOOL 6d4743449b28f0bd132fe69ea37160c4cce258d020883297f76df34e01e1acaf236c420f2aca600994d310d029051cc0bb2378237efa11903695018144c02733
diff --git a/sci-mathematics/spin/files/spin-6.0.1-makefile.patch b/sci-mathematics/spin/files/spin-6.0.1-makefile.patch
new file mode 100644
index 000000000000..d1840875fc03
--- /dev/null
+++ b/sci-mathematics/spin/files/spin-6.0.1-makefile.patch
@@ -0,0 +1,21 @@
+--- makefile.orig 2011-01-01 16:51:18.000000000 +0100
++++ makefile 2011-01-01 16:52:00.000000000 +0100
+@@ -13,9 +13,6 @@
+
+ # see also ./make_pc for a simpler script, not requiring make
+
+-CC=gcc
+-CFLAGS=-O2 -ansi -DNXT -D_POSIX_SOURCE -Wno-format-security # on some systems add: -I/usr/include
+-
+ # CC=cc -m32 # for 32bit compilation on a 64bit system (not recommended)
+ # for a more picky compilation use gcc-4 and:
+ # CFLAGS=-std=c99 -Wstrict-prototypes -pedantic -fno-strength-reduce -fno-builtin -W -Wshadow -Wpointer-arith -Wcast-qual -Winline -Wall -g -DNXT -DPC
+@@ -43,7 +40,7 @@
+ tl_mem.o tl_rewrt.o tl_cache.o
+
+ spin: $(SPIN_OS) $(TL_OS)
+- $(CC) $(CFLAGS) -o spin $(SPIN_OS) $(TL_OS)
++ $(CC) $(CFLAGS) $(LDFLAGS) -o spin $(SPIN_OS) $(TL_OS)
+
+ spin.o: spin.y
+ $(YACC) $(YFLAGS) spin.y
diff --git a/sci-mathematics/spin/files/spin-6.2.1-makefile.patch b/sci-mathematics/spin/files/spin-6.2.1-makefile.patch
new file mode 100644
index 000000000000..9133f54f9fac
--- /dev/null
+++ b/sci-mathematics/spin/files/spin-6.2.1-makefile.patch
@@ -0,0 +1,21 @@
+--- makefile.orig 2012-05-21 14:59:56.000000000 +0200
++++ makefile 2012-05-21 15:00:47.000000000 +0200
+@@ -13,9 +13,6 @@
+
+ # see also ./make_pc for a simpler script, not requiring make
+
+-CC=gcc
+-CFLAGS=-O2 -DNXT # on some systems add: -I/usr/include
+-
+ # CC=gcc -m32 # 32bit compilation on a 64bit system
+ # for a more picky compilation use gcc-4 and:
+ # CFLAGS=-std=c99 -Wstrict-prototypes -pedantic -fno-strength-reduce -fno-builtin -W -Wshadow -Wpointer-arith -Wcast-qual -Winline -Wall -g -DNXT -DPC
+@@ -43,7 +40,7 @@
+ tl_mem.o tl_rewrt.o tl_cache.o
+
+ spin: $(SPIN_OS) $(TL_OS) spin.o
+- $(CC) $(CFLAGS) -o spin spin.o $(SPIN_OS) $(TL_OS)
++ $(CC) $(CFLAGS) $(LDFLAGS) -o spin spin.o $(SPIN_OS) $(TL_OS)
+
+ spin.o: spin.y
+ $(YACC) $(YFLAGS) spin.y
diff --git a/sci-mathematics/spin/files/spin-6.2.5-makefile.patch b/sci-mathematics/spin/files/spin-6.2.5-makefile.patch
new file mode 100644
index 000000000000..585e78b6f550
--- /dev/null
+++ b/sci-mathematics/spin/files/spin-6.2.5-makefile.patch
@@ -0,0 +1,21 @@
+--- makefile.orig 2013-05-05 01:21:02.000000000 +0200
++++ makefile 2013-11-18 01:07:20.000000000 +0100
+@@ -13,9 +13,6 @@
+
+ # see also ./make_pc for a simpler script, not requiring make
+
+-CC=gcc
+-CFLAGS=-O2 -DNXT # on some systems add: -I/usr/include
+-
+ # CFLAGS=-g -O2 -DNXT
+
+ # CC=gcc -m32 # 32bit compilation on a 64bit system
+@@ -45,7 +42,7 @@
+ tl_mem.o tl_rewrt.o tl_cache.o
+
+ spin: $(SPIN_OS) $(TL_OS) spin.o
+- $(CC) $(CFLAGS) -o spin spin.o $(SPIN_OS) $(TL_OS)
++ $(CC) $(CFLAGS) $(LDFLAGS) -o spin spin.o $(SPIN_OS) $(TL_OS)
+
+ spin.o: spin.y
+ $(YACC) $(YFLAGS) spin.y
diff --git a/sci-mathematics/spin/metadata.xml b/sci-mathematics/spin/metadata.xml
new file mode 100644
index 000000000000..d047926ffe02
--- /dev/null
+++ b/sci-mathematics/spin/metadata.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <maintainer>
+ <email>phajdan.jr@gentoo.org</email>
+ <name>Pawel Hajdan jr</name>
+ </maintainer>
+</pkgmetadata>
diff --git a/sci-mathematics/spin/spin-6.2.1.ebuild b/sci-mathematics/spin/spin-6.2.1.ebuild
new file mode 100644
index 000000000000..01079b8e55bc
--- /dev/null
+++ b/sci-mathematics/spin/spin-6.2.1.ebuild
@@ -0,0 +1,43 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="4"
+
+inherit eutils versionator
+
+MY_PV=$(replace_all_version_separators '')
+MY_P="${PN}${MY_PV}"
+
+DESCRIPTION="Tool for formal verification of distributed software systems"
+HOMEPAGE="http://spinroot.com/"
+SRC_URI="http://spinroot.com/spin/Src/${MY_P}.tar.gz"
+
+LICENSE="|| ( spin-commercial spin-educational )"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE="graphviz tk"
+
+DEPEND="sys-devel/bison"
+RDEPEND="sys-devel/gcc
+ sys-process/time
+ tk? (
+ dev-lang/tk
+ graphviz? ( media-gfx/graphviz )
+ )"
+
+S="${WORKDIR}/Spin/Src${PV}"
+
+src_prepare() {
+ epatch "${FILESDIR}/${PN}-6.2.1-makefile.patch"
+}
+
+src_install() {
+ dobin spin
+ doman ../Man/spin.1
+ dodoc ../Doc/*
+ if use tk; then
+ newbin "${WORKDIR}/Spin/iSpin/ispin.tcl" ispin
+ make_desktop_entry ispin
+ fi
+}
diff --git a/sci-mathematics/spin/spin-6.2.3.ebuild b/sci-mathematics/spin/spin-6.2.3.ebuild
new file mode 100644
index 000000000000..1f6b7682b22a
--- /dev/null
+++ b/sci-mathematics/spin/spin-6.2.3.ebuild
@@ -0,0 +1,48 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="5"
+
+inherit eutils toolchain-funcs versionator
+
+MY_PV=$(replace_all_version_separators '')
+MY_P="${PN}${MY_PV}"
+
+DESCRIPTION="Tool for formal verification of distributed software systems"
+HOMEPAGE="http://spinroot.com/"
+SRC_URI="http://spinroot.com/spin/Src/${MY_P}.tar.gz"
+
+LICENSE="|| ( spin-commercial spin-educational )"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE="graphviz tk"
+
+DEPEND="sys-devel/bison"
+RDEPEND="sys-devel/gcc
+ sys-process/time
+ tk? (
+ dev-lang/tk
+ graphviz? ( media-gfx/graphviz )
+ )"
+
+S="${WORKDIR}/Spin/Src${PV}"
+
+src_prepare() {
+ epatch "${FILESDIR}/${PN}-6.2.1-makefile.patch"
+}
+
+src_compile() {
+ tc-export CC
+ default
+}
+
+src_install() {
+ dobin spin
+ doman ../Man/spin.1
+ dodoc ../Doc/*
+ if use tk; then
+ newbin "${WORKDIR}/Spin/iSpin/ispin.tcl" ispin
+ make_desktop_entry ispin
+ fi
+}
diff --git a/sci-mathematics/spin/spin-6.2.5.ebuild b/sci-mathematics/spin/spin-6.2.5.ebuild
new file mode 100644
index 000000000000..6874070cf674
--- /dev/null
+++ b/sci-mathematics/spin/spin-6.2.5.ebuild
@@ -0,0 +1,48 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="5"
+
+inherit eutils toolchain-funcs versionator
+
+MY_PV=$(replace_all_version_separators '')
+MY_P="${PN}${MY_PV}"
+
+DESCRIPTION="Tool for formal verification of distributed software systems"
+HOMEPAGE="http://spinroot.com/"
+SRC_URI="http://spinroot.com/spin/Src/${MY_P}.tar.gz"
+
+LICENSE="|| ( spin-commercial spin-educational )"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE="graphviz tk"
+
+DEPEND="sys-devel/bison"
+RDEPEND="sys-devel/gcc
+ sys-process/time
+ tk? (
+ dev-lang/tk
+ graphviz? ( media-gfx/graphviz )
+ )"
+
+S="${WORKDIR}/Spin/Src${PV}"
+
+src_prepare() {
+ epatch "${FILESDIR}/${PN}-6.2.5-makefile.patch"
+}
+
+src_compile() {
+ tc-export CC
+ default
+}
+
+src_install() {
+ dobin spin
+ doman ../Man/spin.1
+ dodoc ../Doc/*
+ if use tk; then
+ newbin "${WORKDIR}/Spin/iSpin/ispin.tcl" ispin
+ make_desktop_entry ispin
+ fi
+}
diff --git a/sci-mathematics/topcom/Manifest b/sci-mathematics/topcom/Manifest
new file mode 100644
index 000000000000..f4ee9d06fecd
--- /dev/null
+++ b/sci-mathematics/topcom/Manifest
@@ -0,0 +1,2 @@
+DIST TOPCOM-0.17.4.tar.gz 8666508 SHA256 42f3ff4e04613009966a3e3cd942f1fb6aa7bc7439f54f20a0b81d1989f9fef1 SHA512 29cee145ee8ec1a63c0b1ec5d9e5f34a11084767405435eed515f864ba1094ca4566c92bbf7cf56914e3e455dd8bdf9746c0f7192a9455fe7852a65704a6009c WHIRLPOOL 4b5f18b8eee251470281a352a354a683b7f42c852cb47552e4227699d9570aee09cda9f9e84f9e7abc5b9e1997818437618776ed90a8667cb186143da6deab4b
+DIST TOPCOM-manual.html 19251 SHA256 b1c3b326044fdb512264fa2bde6fa10962fd276d43fcab71cb0dc8778378608e
diff --git a/sci-mathematics/topcom/files/topcom-0.17.4-buildsystem.patch b/sci-mathematics/topcom/files/topcom-0.17.4-buildsystem.patch
new file mode 100644
index 000000000000..e8546aa846dc
--- /dev/null
+++ b/sci-mathematics/topcom/files/topcom-0.17.4-buildsystem.patch
@@ -0,0 +1,105 @@
+ lib-src-reg/Makefile.am | 8 +++-----
+ lib-src/Makefile.am | 8 +++-----
+ src-reg/Makefile.am | 12 +++++-------
+ src/Makefile.am | 12 +++++-------
+ wrap-gmp-gmpxx/Makefile.am | 2 +-
+ 5 files changed, 17 insertions(+), 25 deletions(-)
+
+diff --git a/lib-src-reg/Makefile.am b/lib-src-reg/Makefile.am
+index 67c1dc9..202d6fa 100644
+--- a/lib-src-reg/Makefile.am
++++ b/lib-src-reg/Makefile.am
+@@ -10,11 +10,9 @@ SPXinterface.hh \
+ RegularityCheck.hh \
+ LPinterface.hh
+
+-INCLUDES = -I../lib-src
+-INCLUDES += -I../wrap-gmp-gmpxx
+-INCLUDES += -I../external/include
++INCLUDES = -I$(top_srcdir)/lib-src
++INCLUDES += -I$(top_srcdir)/wrap-gmp-gmpxx
++INCLUDES += -I$(top_srcdir)/external/include
+ INCLUDES += -I$(includedir)
+
+ AM_CPPFLAGS = -DVERBOSE -DGMPRATIONAL -ftemplate-depth-30
+-
+-AM_CXXFLAGS = -O2
+diff --git a/lib-src/Makefile.am b/lib-src/Makefile.am
+index defed87..c94109c 100644
+--- a/lib-src/Makefile.am
++++ b/lib-src/Makefile.am
+@@ -88,11 +88,9 @@ VertexFacetTable.hh \
+ VertexFacetTableArray.hh \
+ VirtualChiro.hh
+
+-INCLUDES = -I../lib-src-reg
+-INCLUDES += -I../wrap-gmp-gmpxx
+-INCLUDES += -I../external/include
++INCLUDES = -I$(top_srcdir)/lib-src-reg
++INCLUDES += -I$(top_srcdir)/wrap-gmp-gmpxx
++INCLUDES += -I$(top_srcdir)/external/include
+ INCLUDES += -I$(includedir)
+
+ AM_CPPFLAGS = -DVERBOSE -DGMPRATIONAL -ftemplate-depth-35
+-
+-AM_CXXFLAGS = -O2 -g
+diff --git a/src-reg/Makefile.am b/src-reg/Makefile.am
+index b0219a5..e9b00bc 100644
+--- a/src-reg/Makefile.am
++++ b/src-reg/Makefile.am
+@@ -2,15 +2,13 @@ bin_PROGRAMS = checkregularity
+
+ checkregularity_SOURCES = checkregularity.cc
+
+-LDADD = ../lib-src-reg/libCHECKREG.a \
+- ../lib-src/libTOPCOM.a
++LDADD = $(top_builddir)/lib-src-reg/libCHECKREG.a \
++ $(top_builddir)/lib-src/libTOPCOM.a
+
+-INCLUDES = -I../lib-src
+-INCLUDES += -I../lib-src-reg
+-INCLUDES += -I../wrap-gmp-gmpxx
++INCLUDES = -I$(top_srcdir)/lib-src
++INCLUDES += -I$(top_srcdir)/lib-src-reg
++INCLUDES += -I$(top_srcdir)/wrap-gmp-gmpxx
+ INCLUDES += -I$(includedir)
+
+
+ AM_CPPFLAGS = -DVERBOSE -DGMPRATIONAL -ftemplate-depth-30
+-
+-AM_CXXFLAGS = -O2
+diff --git a/src/Makefile.am b/src/Makefile.am
+index 5ba9b22..4c59202 100644
+--- a/src/Makefile.am
++++ b/src/Makefile.am
+@@ -85,14 +85,12 @@ santos_triang_SOURCES = santos_triang.cc
+ santos_dim4_triang_SOURCES = santos_dim4_triang.cc
+ santos_22_triang_SOURCES = santos_22_triang.cc
+
+-LDADD = ../lib-src/libTOPCOM.a \
+- ../lib-src-reg/libCHECKREG.a
++LDADD = $(top_builddir)/lib-src/libTOPCOM.a \
++ $(top_builddir)/lib-src-reg/libCHECKREG.a
+
+-INCLUDES = -I../lib-src
+-INCLUDES += -I../lib-src-reg
+-INCLUDES += -I../wrap-gmp-gmpxx
++INCLUDES = -I$(top_srcdir)/lib-src
++INCLUDES += -I$(top_srcdir)/lib-src-reg
++INCLUDES += -I$(top_srcdir)/wrap-gmp-gmpxx
+ INCLUDES += -I$(includedir)
+
+ AM_CPPFLAGS = -DVERBOSE -DGMPRATIONAL -ftemplate-depth-30
+-
+-AM_CXXFLAGS = -O2
+diff --git a/wrap-gmp-gmpxx/Makefile.am b/wrap-gmp-gmpxx/Makefile.am
+index 383e003..d93a637 100644
+--- a/wrap-gmp-gmpxx/Makefile.am
++++ b/wrap-gmp-gmpxx/Makefile.am
+@@ -2,5 +2,5 @@ include_HEADERS = \
+ Integer.h \
+ Rational.h
+
+-INCLUDES = -I../external/include
++INCLUDES = -I$(top_srcdir)/external/include
+ INCLUDES += -I$(includedir)
diff --git a/sci-mathematics/topcom/files/topcom-0.17.4-no-internal-libs.patch b/sci-mathematics/topcom/files/topcom-0.17.4-no-internal-libs.patch
new file mode 100644
index 000000000000..e9cffeec7440
--- /dev/null
+++ b/sci-mathematics/topcom/files/topcom-0.17.4-no-internal-libs.patch
@@ -0,0 +1,77 @@
+ Makefile.am | 4 ----
+ configure.ac | 6 +-----
+ src-reg/Makefile.am | 6 +-----
+ src/Makefile.am | 6 +-----
+ 4 files changed, 3 insertions(+), 19 deletions(-)
+
+diff --git a/Makefile.am b/Makefile.am
+index 640652f..00ba26a 100644
+--- a/Makefile.am
++++ b/Makefile.am
+@@ -1,6 +1,2 @@
+ SUBDIRS = wrap-gmp-gmpxx lib-src-reg lib-src src-reg src examples
+ EXTRA_DIST = external/Makefile
+-EXTRA_DIST += external/gmp-5.0.5.tar.bz2
+-EXTRA_DIST += external/cddlib-0.94f-TOPCOM.tar.gz
+-EXTRA_DIST += external/gmpxx-patch
+-
+diff --git a/configure.ac b/configure.ac
+index b737f27..ecd38ce 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -17,12 +17,8 @@ dnl Replace `main' with a function in -lstdc:
+ dnl AC_CHECK_LIB(stdc, main)
+ dnl Replace `main' with a function in -lstdc++:
+ dnl AC_CHECK_LIB(stdc++, main)
+-dnl Make libgmp:
+-make -C external gmp
+-dnl Make libcddgmp:
+-make -C external cdd
+ dnl Check for soplex:
+-AC_CHECK_LIB(soplex, main, , csh -c 'echo soplex not found: --soplex will not work.')
++AC_CHECK_LIB(soplex, main, , sh -c 'echo soplex not found: --soplex will not work.')
+
+ dnl Checks for header files.
+ AC_HEADER_STDC
+diff --git a/src-reg/Makefile.am b/src-reg/Makefile.am
+index c976e34..b0219a5 100644
+--- a/src-reg/Makefile.am
++++ b/src-reg/Makefile.am
+@@ -3,15 +3,11 @@ bin_PROGRAMS = checkregularity
+ checkregularity_SOURCES = checkregularity.cc
+
+ LDADD = ../lib-src-reg/libCHECKREG.a \
+- ../lib-src/libTOPCOM.a \
+- ../external/lib/libcddgmp.a \
+- ../external/lib/libgmpxx.a \
+- ../external/lib/libgmp.a
++ ../lib-src/libTOPCOM.a
+
+ INCLUDES = -I../lib-src
+ INCLUDES += -I../lib-src-reg
+ INCLUDES += -I../wrap-gmp-gmpxx
+-INCLUDES += -I../external/include
+ INCLUDES += -I$(includedir)
+
+
+diff --git a/src/Makefile.am b/src/Makefile.am
+index 4c35135..5ba9b22 100644
+--- a/src/Makefile.am
++++ b/src/Makefile.am
+@@ -86,15 +86,11 @@ santos_dim4_triang_SOURCES = santos_dim4_triang.cc
+ santos_22_triang_SOURCES = santos_22_triang.cc
+
+ LDADD = ../lib-src/libTOPCOM.a \
+- ../lib-src-reg/libCHECKREG.a \
+- ../external/lib/libcddgmp.a \
+- ../external/lib/libgmpxx.a \
+- ../external/lib/libgmp.a
++ ../lib-src-reg/libCHECKREG.a
+
+ INCLUDES = -I../lib-src
+ INCLUDES += -I../lib-src-reg
+ INCLUDES += -I../wrap-gmp-gmpxx
+-INCLUDES += -I../external/include
+ INCLUDES += -I$(includedir)
+
+ AM_CPPFLAGS = -DVERBOSE -DGMPRATIONAL -ftemplate-depth-30
diff --git a/sci-mathematics/topcom/metadata.xml b/sci-mathematics/topcom/metadata.xml
new file mode 100644
index 000000000000..623d96beb1cf
--- /dev/null
+++ b/sci-mathematics/topcom/metadata.xml
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <maintainer>
+ <email>tomka@gentoo.org</email>
+ <name>Thomas Kahle</name>
+ </maintainer>
+ <herd>sci</herd>
+ <longdescription lang="en">
+TOPCOM is a package for computing Triangulations Of Point Configurations and Oriented Matroids
+</longdescription>
+</pkgmetadata>
diff --git a/sci-mathematics/topcom/topcom-0.17.4-r1.ebuild b/sci-mathematics/topcom/topcom-0.17.4-r1.ebuild
new file mode 100644
index 000000000000..3745a131ebb2
--- /dev/null
+++ b/sci-mathematics/topcom/topcom-0.17.4-r1.ebuild
@@ -0,0 +1,60 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=4
+
+AUTOTOOLS_AUTORECONF=yes
+
+inherit autotools-utils flag-o-matic
+
+DESCRIPTION="Computing Triangulations Of Point Configurations and Oriented Matroids"
+HOMEPAGE="http://www.rambau.wm.uni-bayreuth.de/TOPCOM/"
+SRC_URI="
+ http://www.uni-bayreuth.de/departments/wirtschaftsmathematik/rambau/Software/TOPCOM-${PV}.tar.gz
+ doc? ( http://www.rambau.wm.uni-bayreuth.de/TOPCOM/TOPCOM-manual.html )"
+
+KEYWORDS="~amd64 ~x86"
+SLOT="0"
+LICENSE="GPL-2"
+IUSE="doc examples static-libs"
+
+DEPEND="
+ >=dev-libs/gmp-5.0.5
+ >=sci-libs/cddlib-094f"
+RDEPEND="${DEPEND}"
+
+S="${WORKDIR}"/TOPCOM-${PV}
+
+PATCHES=(
+ "${FILESDIR}"/${P}-no-internal-libs.patch
+ "${FILESDIR}"/${P}-buildsystem.patch
+ )
+
+src_prepare () {
+ # ... and link in tree versions:
+ append-libs -lgmp -lgmpxx -lcddgmp
+
+ find external -delete || die
+
+ mv configure.{in,ac} || die
+
+ autotools-utils_src_prepare
+}
+
+src_install () {
+ autotools-utils_src_install
+
+ use static-libs || rm -f "${ED}"/usr/$(get_libdir)/*a
+
+ use doc && dohtml "${DISTDIR}"/TOPCOM-manual.html
+
+ use examples && dodoc -r "${S}"/examples
+
+ mv "${ED}"/usr/bin/cube "${ED}"/usr/bin/topcom_cube || die
+}
+
+pkg_postinst() {
+ elog "Due to a file collision with media-libs/lib3ds the helper"
+ elog "'cube' has been installed as topcom_cube (see bug #547030)."
+}
diff --git a/sci-mathematics/twelf/Manifest b/sci-mathematics/twelf/Manifest
new file mode 100644
index 000000000000..3854299117d4
--- /dev/null
+++ b/sci-mathematics/twelf/Manifest
@@ -0,0 +1 @@
+DIST twelf-src-1.7.1.tar.gz 1147610 SHA256 91b0d4d8c2e54452a042da0ff642f3b46b25efb36a84497aa8b96598f49a213a SHA512 1b4baa0f385b6b605583a9da312f23c775aab43e7398c6e151833a6b95c74112492530f44fcb7b14f8288774e9b63e2f9618a5debfbc4d34737bc2588f5850df WHIRLPOOL 231879beb66ff143acd3245c10b5e25a91994e67eb3b12aedd0e5a2378a94a2e1f3b29953b1ea24e98ca0063f27aff662cfdd1cea01163be435a6dbba1f0d2b9
diff --git a/sci-mathematics/twelf/files/50twelf-gentoo.el b/sci-mathematics/twelf/files/50twelf-gentoo.el
new file mode 100644
index 000000000000..5bda54b2f19a
--- /dev/null
+++ b/sci-mathematics/twelf/files/50twelf-gentoo.el
@@ -0,0 +1,4 @@
+;;; twelf site-lisp configuration
+
+(setq twelf-root "@SITELISP@")
+(add-to-list 'load-path "@SITELISP@")
diff --git a/sci-mathematics/twelf/files/twelf-1.7.1-Makefile.patch b/sci-mathematics/twelf/files/twelf-1.7.1-Makefile.patch
new file mode 100644
index 000000000000..84631f357d9d
--- /dev/null
+++ b/sci-mathematics/twelf/files/twelf-1.7.1-Makefile.patch
@@ -0,0 +1,43 @@
+--- twelf-orig/Makefile 2011-03-03 09:41:47.000000000 +1100
++++ twelf/Makefile 2012-12-10 00:19:52.255787064 +1100
+@@ -17,6 +17,18 @@
+ twelfdir = `pwd`
+ twelfserver = twelf-server
+
++ifdef CFLAGS
++ccopts=$(foreach cf,$(CFLAGS),-cc-opt $(cf))
++else
++ccopts=
++endif
++
++ifdef LDFLAGS
++linkopts=$(foreach lf,$(LDFLAGS),-link-opt $(lf))
++else
++linkopts=
++endif
++
+ # ---------------------------------------------------------------
+ # You should not need to edit beyond this point
+ # ---------------------------------------------------------------
+@@ -53,12 +65,12 @@
+ echo; echo "Error: MLton >= 20041109 required"; echo; \
+ exit 1; \
+ fi; \
+- $(mlton) -output bin/$(twelfserver) build/$${cmfileid}
++ $(mlton) $(ccopts) $(linkopts) -as-opt -Wa,--noexecstack -output bin/$(twelfserver) build/$${cmfileid}
+
+ .PHONY: twelf-server-smlnj
+ twelf-server-smlnj:
+ $(smlnj) < build/twelf-server-smlnj.sml ;
+- bin/.mkexec "$(smlnj)" "$(twelfdir)" twelf-server "$(twelfserver)" ;
++ bin/.mkexec "$(smlnj)" "$(twelfdir)" twelf-server "$(twelfserver)" "$(twelfexecdir)" ;
+
+ .PHONY: twelf-emacs
+ twelf-emacs: ;
+@@ -87,4 +99,4 @@
+ $(mlton) -output bin/twelf-regression TEST/mlton-regression.cm
+
+ check : twelf-regression
+- $(make) -C TEST check
+\ No newline at end of file
++ $(make) -C TEST check
diff --git a/sci-mathematics/twelf/files/twelf-1.7.1-doc-guide-Makefile.patch b/sci-mathematics/twelf/files/twelf-1.7.1-doc-guide-Makefile.patch
new file mode 100644
index 000000000000..092b12b20dc0
--- /dev/null
+++ b/sci-mathematics/twelf/files/twelf-1.7.1-doc-guide-Makefile.patch
@@ -0,0 +1,13 @@
+--- twelf-orig/doc/guide/Makefile 2002-09-24 13:59:23.000000000 +1000
++++ twelf/doc/guide/Makefile 2012-12-10 00:51:02.758835185 +1100
+@@ -38,8 +38,8 @@
+
+ twelf_toc.html : twelf.texi;
+ @echo "---------- Creating HTML: twelf_*.html"
+- $(texi2html) -menu -number -split_chapter twelf.texi;
+- $(texi2html) -check *.html;
++ $(texi2html) -menu -number-sections -split_chapter twelf.texi;
++# $(texi2html) -check *.html;
+
+ twelf.pdf : twelf.texi;
+ @echo "---------- Creating unindexed PDF: twelf.pdf"
diff --git a/sci-mathematics/twelf/files/twelf-1.7.1-doc-guide-twelf-dot-texi.patch b/sci-mathematics/twelf/files/twelf-1.7.1-doc-guide-twelf-dot-texi.patch
new file mode 100644
index 000000000000..877ecd60b710
--- /dev/null
+++ b/sci-mathematics/twelf/files/twelf-1.7.1-doc-guide-twelf-dot-texi.patch
@@ -0,0 +1,14 @@
+--- twelf-orig/doc/guide/twelf.texi 2004-04-01 04:26:38.000000000 +1000
++++ twelf/doc/guide/twelf.texi 2012-12-08 21:14:17.026139996 +1100
+@@ -12,6 +12,11 @@
+ @syncodeindex fn cp
+ @c %**end of header
+
++@dircategory Programming
++@direntry
++* Twelf User Guide: (twelf). The Twelf User's Guide.
++@end direntry
++
+ @titlepage
+ @title Twelf User's Guide
+ @subtitle Version @value{VERSION}
diff --git a/sci-mathematics/twelf/files/twelf-1.7.1-emacs-twelf-init.patch b/sci-mathematics/twelf/files/twelf-1.7.1-emacs-twelf-init.patch
new file mode 100644
index 000000000000..983c3c2290ed
--- /dev/null
+++ b/sci-mathematics/twelf/files/twelf-1.7.1-emacs-twelf-init.patch
@@ -0,0 +1,22 @@
+--- twelf-orig/emacs/twelf-init.el 2002-12-28 16:15:42.000000000 +1100
++++ twelf/emacs/twelf-init.el 2012-12-10 00:45:49.363104690 +1100
+@@ -20,16 +20,13 @@
+ auto-mode-alist)))))
+
+ ;; Default Twelf server program location
+-(setq twelf-server-program
+- (concat twelf-root "bin/twelf-server"))
++(setq twelf-server-program "/usr/bin/twelf-server")
+
+ ;; Default Twelf SML program location
+-(setq twelf-sml-program
+- (concat twelf-root "bin/twelf-sml"))
++(setq twelf-sml-program "/usr/bin/twelf-sml")
+
+ ;; Default documentation location (in info format)
+-(setq twelf-info-file
+- (concat twelf-root "doc/info/twelf.info"))
++(setq twelf-info-file "/usr/share/info/twelf.info")
+
+ ;; Automatically highlight Twelf sources using font-lock
+ (add-hook 'twelf-mode-hook 'twelf-font-fontify-buffer)
diff --git a/sci-mathematics/twelf/files/twelf-1.7.1-emacs-twelf.patch b/sci-mathematics/twelf/files/twelf-1.7.1-emacs-twelf.patch
new file mode 100644
index 000000000000..c6c3a9b1fae1
--- /dev/null
+++ b/sci-mathematics/twelf/files/twelf-1.7.1-emacs-twelf.patch
@@ -0,0 +1,11 @@
+--- twelf-orig/emacs/twelf.el 2008-07-13 06:06:03.000000000 +1000
++++ twelf/emacs/twelf.el 2012-12-10 00:39:05.332036491 +1100
+@@ -1815,7 +1815,7 @@
+ (twelf-server-process (twelf-server-process twelf-server-buffer))
+ (proc-mark (process-mark twelf-server-process))
+ (_ (display-buffer twelf-server-buffer))
+- (twelf-server-window (get-buffer-window twelf-server-buffer)))
++ (twelf-server-window (get-buffer-window twelf-server-buffer t)))
+ (if (not (pos-visible-in-window-p proc-mark twelf-server-window))
+ (progn
+ (push-mark proc-mark)
diff --git a/sci-mathematics/twelf/files/twelf-1.7.1-mlton-mlb.patch b/sci-mathematics/twelf/files/twelf-1.7.1-mlton-mlb.patch
new file mode 100644
index 000000000000..24d16049c0e5
--- /dev/null
+++ b/sci-mathematics/twelf/files/twelf-1.7.1-mlton-mlb.patch
@@ -0,0 +1,409 @@
+commit 35216e78de99558a39b147bf06fef85e1aabb2c6
+Author: Rob Simmons <robsimmons@gmail.com>
+Date: Mon Aug 19 11:49:04 2013 -0400
+
+ Transfer Mlton build over to mlb files, as they've been asking us to do for years and now insist on.
+
+diff --git a/Makefile b/Makefile
+index 9d7d422..2422f36 100644
+--- a/Makefile
++++ b/Makefile
+@@ -46,9 +46,9 @@ twelf-server-announce:
+ twelf-server-mlton:
+ mltonversion=`$(mlton) 2>&1 | awk 'NR==1 { print 0+$$2 }'`; \
+ if [ $$mltonversion -ge 20041109 ]; then \
+- cmfileid="twelf-server-mlton.cm"; \
++ cmfileid="twelf-server-mlton.mlb"; \
+ elif [ $$mltonversion="MLTONVERSION" ]; then \
+- cmfileid="twelf-server-mlton.cm"; \
++ cmfileid="twelf-server-mlton.mlb"; \
+ else \
+ echo; echo "Error: MLton >= 20041109 required"; echo; \
+ exit 1; \
+@@ -84,7 +84,7 @@ mlton : twelf-server-announce buildid twelf-server-mlton twelf-emacs
+
+ .PHONY: twelf-regression check
+ twelf-regression: buildid
+- $(mlton) -output bin/twelf-regression TEST/mlton-regression.cm
++ $(mlton) -output bin/twelf-regression TEST/mlton-regression.mlb
+
+ check : twelf-regression
+ $(make) -C TEST check
+diff --git a/TEST/mlton-regression.mlb b/TEST/mlton-regression.mlb
+new file mode 100644
+index 0000000..b77a9ee
+--- /dev/null
++++ b/TEST/mlton-regression.mlb
+@@ -0,0 +1,7 @@
++(* MLton version *)
++
++../build/twelf-core-mlton.mlb
++
++regression.sml
++runquiet.sml
++
+diff --git a/build/twelf-core-mlton.mlb b/build/twelf-core-mlton.mlb
+new file mode 100644
+index 0000000..26843cd
+--- /dev/null
++++ b/build/twelf-core-mlton.mlb
+@@ -0,0 +1,348 @@
++(* Common MLton version *)
++
++$(SML_LIB)/basis/basis.mlb
++$(SML_LIB)/basis/mlton.mlb
++$(SML_LIB)/basis/sml-nj.mlb
++
++../src/compat/array.sig
++../src/compat/vector.sig
++../src/compat/path.sig
++../src/compat/substring.sig
++../src/compat/text-io.sig
++../src/compat/timer.sig
++../src/compat/socket.sig
++../src/compat/compat.sig
++../src/compat/socket.sml
++../src/compat/compat.fun
++../src/compat/compat.sml
++../src/timing/timing.sml
++../src/timing/timers.sig
++../src/timing/timers.fun
++../src/timing/timers.sml
++../src/global/global.sig
++../src/global/global.sml
++../src/lambda/fgnopn.sig
++../src/lambda/fgnopntable.fun
++../src/lambda/intsyn.sig
++../src/lambda/intsyn.fun
++../src/lambda/whnf.sig
++../src/lambda/whnf.fun
++../src/lambda/conv.sig
++../src/lambda/conv.fun
++
++../src/table/table.sig
++../src/table/hash-table.sml
++../src/table/string-hash.sig
++../src/table/string-hash.sml
++../src/table/red-black-tree.fun
++../src/table/sparse-array.sig
++../src/table/sparse-array.fun
++../src/table/sparse-array2.sig
++../src/table/sparse-array2.fun
++../src/table/table.sml
++
++../src/order/order.sig
++../src/order/order.fun
++../src/order/order.sml
++
++../src/lambda/tomega.sig
++../src/lambda/tomega.fun
++../src/lambda/tomega.sml
++../src/paths/paths.sig
++../src/paths/paths.fun
++../src/paths/origins.sig
++../src/paths/origins.fun
++../src/paths/paths.sml
++../src/table/queue.sig
++../src/table/queue.sml
++../src/index/index.sig
++../src/index/index.fun
++../src/index/index-skolem.fun
++../src/index/index.sml
++../src/trail/trail.sig
++../src/trail/notrail.sml
++../src/trail/trail.sml
++../src/lambda/constraints.sig
++../src/lambda/constraints.fun
++../src/lambda/unify.sig
++../src/lambda/unify.fun
++../src/lambda/match.sig
++../src/lambda/match.fun
++../src/lambda/abstract.sig
++../src/lambda/abstract.fun
++../src/lambda/approx.sig
++../src/lambda/approx.fun
++../src/lambda/lambda.sml
++../src/names/names.sig
++../src/names/names.fun
++../src/names/names.sml
++../src/style/style.sig
++../src/style/style.fun
++../src/style/style.sml
++../src/stream/stream.sml
++../src/frontend/lexer.sig
++../src/frontend/lexer.fun
++../src/frontend/twelf.sig
++../src/formatter/formatter.sig
++../src/formatter/formatter.fun
++../src/formatter/formatter.sml
++../src/print/print-omdoc.sig
++../src/print/print-xml.sig
++../src/print/print-omdoc.fun
++../src/print/print-xml.fun
++../src/print/print-twega.sig
++../src/print/print-twega.fun
++../src/print/symbol.sig
++../src/print/symbol.fun
++../src/print/print.sig
++../src/print/print.fun
++../src/print/clause-print.sig
++../src/print/clause-print.fun
++../src/print/print.sml
++../src/typecheck/strict.sig
++../src/typecheck/strict.fun
++../src/typecheck/typecheck.sig
++../src/typecheck/typecheck.fun
++../src/typecheck/typecheck.sml
++../src/modes/modesyn.sml
++../src/modes/modetable.sig
++../src/modes/modetable.fun
++../src/modes/modedec.sig
++../src/modes/modedec.fun
++../src/modes/modecheck.sig
++../src/modes/modecheck.fun
++../src/modes/modeprint.sig
++../src/modes/modeprint.fun
++../src/modes/modes.sml
++../src/tabling/tabledsyn.sig
++../src/tabling/tabledsyn.fun
++../src/tabling/tabled.sml
++../src/subordinate/intset.sml
++../src/subordinate/subordinate.sig
++../src/subordinate/subordinate.fun
++../src/subordinate/subordinate.sml
++../src/solvers/cs-manager.sig
++../src/solvers/cs-manager.fun
++../src/domains/integers.sig
++../src/domains/integers.fun
++../src/domains/field.sig
++../src/domains/ordered-field.sig
++../src/domains/rationals.sig
++../src/domains/rationals.fun
++../src/domains/integers-mod.fun
++../src/domains/domains.sml
++../src/solvers/cs.sig
++../src/solvers/cs-eq-field.sig
++../src/solvers/cs-eq-field.fun
++../src/solvers/cs-ineq-field.fun
++../src/solvers/cs-eq-strings.fun
++../src/solvers/cs-eq-bools.fun
++../src/solvers/cs-eq-integers.sig
++../src/solvers/cs-eq-integers.fun
++../src/solvers/cs-ineq-integers.fun
++../src/solvers/cs-integers-word.fun
++../src/solvers/solvers.sml
++../src/terminate/checking.sig
++../src/terminate/checking.fun
++../src/terminate/reduces.sig
++../src/terminate/reduces.fun
++../src/terminate/terminate.sml
++../src/thm/thmsyn.sig
++../src/thm/thmsyn.fun
++../src/thm/thmprint.sig
++../src/thm/thmprint.fun
++../src/thm/thm.sig
++../src/thm/thm.fun
++../src/thm/thm.sml
++../src/table/red-black-set.sig
++../src/table/red-black-set.sml
++../src/compile/compsyn.sig
++../src/compile/compsyn.fun
++../src/compile/cprint.sig
++../src/compile/cprint.fun
++../src/compile/subtree.sig
++../src/compile/subtree.fun
++../src/compile/compile.sig
++../src/compile/compile.fun
++../src/compile/assign.sig
++../src/compile/assign.fun
++../src/compile/compile.sml
++../src/opsem/absmachine.sig
++../src/opsem/absmachine.fun
++../src/opsem/table-param.sig
++../src/opsem/table-param.fun
++../src/opsem/table-param.sml
++../src/opsem/abstract.sig
++../src/opsem/abstract.fun
++../src/opsem/sw-subtree.sig
++../src/opsem/subtree.fun
++../src/opsem/subtree-inst.fun
++../src/opsem/sw-subtree.fun
++../src/opsem/tabled.sig
++../src/opsem/tabled.fun
++../src/opsem/ptrecon.sig
++../src/opsem/ptrecon.fun
++../src/opsem/trace.sig
++../src/opsem/trace.fun
++../src/opsem/absmachine-sbt.sig
++../src/opsem/absmachine-sbt.fun
++../src/opsem/tmachine.fun
++../src/opsem/swmachine.fun
++../src/opsem/opsem.sml
++../src/m2/meta-global.sig
++../src/m2/meta-global.sml
++../src/table/ring.sig
++../src/table/ring.sml
++../src/m2/metasyn.sig
++../src/m2/metasyn.fun
++../src/m2/meta-abstract.sig
++../src/m2/meta-abstract.fun
++../src/m2/meta-print.sig
++../src/m2/meta-print.fun
++../src/m2/init.sig
++../src/m2/init.fun
++../src/m2/search.sig
++../src/m2/search.fun
++../src/m2/lemma.sig
++../src/m2/lemma.fun
++../src/m2/splitting.sig
++../src/m2/splitting.fun
++../src/m2/filling.sig
++../src/m2/filling.fun
++../src/m2/recursion.sig
++../src/m2/recursion.fun
++../src/m2/qed.sig
++../src/m2/qed.fun
++../src/compat/time-limit.sig
++../src/compat/time-limit.sml
++../src/m2/strategy.sig
++../src/m2/strategy.fun
++../src/m2/prover.sig
++../src/m2/prover.fun
++../src/m2/mpi.sig
++../src/m2/mpi.fun
++../src/m2/skolem.sig
++../src/m2/skolem.fun
++../src/m2/m2.sml
++../src/modules/modsyn.sig
++../src/modules/modsyn.fun
++../src/modules/modules.sml
++../src/heuristic/heuristic.sig
++../src/heuristic/heuristic.sum.fun
++../src/meta/global.sig
++../src/meta/funsyn.sig
++../src/meta/funsyn.fun
++../src/meta/statesyn.sig
++../src/meta/init.sig
++../src/meta/strategy.sig
++../src/meta/relfun.sig
++../src/meta/prover.fun
++../src/meta/funprint.sig
++../src/meta/print.sig
++../src/meta/print.fun
++../src/meta/filling.sig
++../src/meta/data.sig
++../src/meta/splitting.sig
++../src/meta/recursion.sig
++../src/meta/inference.sig
++../src/meta/strategy.fun
++../src/meta/statesyn.fun
++../src/meta/funtypecheck.sig
++../src/meta/uniquesearch.sig
++../src/meta/inference.fun
++../src/meta/abstract.sig
++../src/meta/splitting.fun
++../src/meta/uniquesearch.fun
++../src/meta/search.sig
++../src/meta/search.fun
++../src/meta/recursion.fun
++../src/meta/mpi.sig
++../src/meta/mpi.fun
++../src/meta/data.fun
++../src/meta/global.fun
++../src/meta/filling.fun
++../src/meta/init.fun
++../src/meta/abstract.fun
++../src/meta/funnames.sig
++../src/meta/funnames.fun
++../src/meta/funprint.fun
++../src/meta/weaken.sig
++../src/meta/weaken.fun
++../src/meta/funweaken.sig
++../src/meta/funweaken.fun
++../src/meta/funtypecheck.fun
++../src/meta/relfun.fun
++../src/meta/meta.sml
++../src/worldcheck/worldsyn.sig
++../src/worldcheck/worldsyn.fun
++../src/worldcheck/worldify.sig
++../src/worldcheck/worldify.fun
++../src/worldcheck/worldcheck.sml
++../src/unique/unique.sig
++../src/unique/unique.fun
++../src/unique/unique.sml
++../src/cover/cover.sig
++../src/cover/cover.fun
++../src/cover/total.sig
++../src/cover/total.fun
++../src/cover/cover.sml
++../src/tomega/abstract.sig
++../src/tomega/abstract.fun
++../src/tomega/tomegaprint.sig
++../src/tomega/tomegaprint.fun
++../src/tomega/typecheck.sig
++../src/tomega/typecheck.fun
++../src/tomega/opsem.sig
++../src/tomega/opsem.fun
++../src/tomega/redundant.sig
++../src/tomega/redundant.fun
++../src/tomega/converter.sig
++../src/tomega/converter.fun
++../src/tomega/coverage.sig
++../src/tomega/coverage.fun
++../src/tomega/tomega.sml
++../src/msg/msg.sml
++../src/frontend/recon-term.sig
++../src/frontend/recon-term.fun
++../src/frontend/recon-condec.sig
++../src/frontend/recon-condec.fun
++../src/frontend/recon-query.sig
++../src/frontend/recon-query.fun
++../src/frontend/recon-mode.sig
++../src/frontend/recon-mode.fun
++../src/frontend/recon-thm.sig
++../src/frontend/recon-thm.fun
++../src/frontend/recon-module.sig
++../src/frontend/recon-module.fun
++../src/frontend/parsing.sig
++../src/frontend/parsing.fun
++../src/frontend/parse-term.sig
++../src/frontend/parse-term.fun
++../src/frontend/parse-condec.sig
++../src/frontend/parse-condec.fun
++../src/frontend/parse-query.sig
++../src/frontend/parse-query.fun
++../src/frontend/parse-fixity.sig
++../src/frontend/parse-fixity.fun
++../src/frontend/parse-mode.sig
++../src/frontend/parse-mode.fun
++../src/frontend/parse-thm.sig
++../src/frontend/parse-thm.fun
++../src/frontend/parse-module.sig
++../src/frontend/parse-module.fun
++../src/frontend/parser.sig
++../src/frontend/parser.fun
++../src/frontend/solve.sig
++../src/frontend/solve.fun
++../src/frontend/fquery.sig
++../src/frontend/fquery.fun
++../src/frontend/unknownexn.sig
++../src/frontend/buildid.sml
++../src/frontend/version.sml
++../src/frontend/twelf.fun
++../src/frontend/unknownexn.fun
++../src/frontend/unknownexn-smlnj.sml
++../src/frontend/frontend.sml
++../src/server/sigint.sig
++../src/server/sigint-mlton.sml
++../src/server/server.sml
+diff --git a/build/twelf-server-mlton.mlb b/build/twelf-server-mlton.mlb
+new file mode 100644
+index 0000000..fa4332f
+--- /dev/null
++++ b/build/twelf-server-mlton.mlb
+@@ -0,0 +1,4 @@
++
++twelf-core-mlton.mlb
++twelf-server-mlton.sml
++
+
diff --git a/sci-mathematics/twelf/metadata.xml b/sci-mathematics/twelf/metadata.xml
new file mode 100644
index 000000000000..aa2d0983be79
--- /dev/null
+++ b/sci-mathematics/twelf/metadata.xml
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <maintainer>
+ <email>gienah@gentoo.org</email>
+ <name>Mark Wright</name>
+ </maintainer>
+ <longdescription lang="en">
+Twelf is an implementation of the logical framework LF. It is used for
+logic programming and for the formalization of programming language
+theory.
+</longdescription>
+</pkgmetadata>
diff --git a/sci-mathematics/twelf/twelf-1.7.1.ebuild b/sci-mathematics/twelf/twelf-1.7.1.ebuild
new file mode 100644
index 000000000000..e5e8a82361c3
--- /dev/null
+++ b/sci-mathematics/twelf/twelf-1.7.1.ebuild
@@ -0,0 +1,111 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="5"
+
+inherit elisp-common eutils multilib
+
+MY_PN="${PN}-src"
+MY_P="${MY_PN}-${PV}"
+
+DESCRIPTION="Implementation of the logical framework LF"
+HOMEPAGE="http://twelf.org/"
+SRC_URI="http://twelf.plparty.org/releases/${MY_P}.tar.gz"
+
+SLOT="0/${PV}"
+KEYWORDS="~amd64 ~x86"
+LICENSE="BSD-2"
+IUSE="doc emacs examples"
+
+# tests reference non-existing directory TEST
+RESTRICT="test"
+
+RDEPEND="
+ dev-lang/mlton
+ doc? (
+ virtual/latex-base
+ )
+ emacs? (
+ virtual/emacs
+ )"
+DEPEND="${RDEPEND}"
+
+S=${WORKDIR}/${PN}
+
+SITEFILE=50${PN}-gentoo.el
+
+PATCHES=(
+ "${FILESDIR}/${PN}-1.7.1-doc-guide-twelf-dot-texi.patch"
+ "${FILESDIR}/${PN}-1.7.1-doc-guide-Makefile.patch"
+ "${FILESDIR}/${PN}-1.7.1-emacs-twelf.patch"
+ "${FILESDIR}/${PN}-1.7.1-emacs-twelf-init.patch"
+ "${FILESDIR}/${PN}-1.7.1-Makefile.patch"
+ "${FILESDIR}/${PN}-1.7.1-mlton-mlb.patch"
+ )
+
+src_prepare() {
+ epatch ${PYTCHES[@]}
+ sed \
+ -e "s@/usr/bin@${ROOT}usr/bin@g" \
+ -e "s@/usr/share@${ROOT}usr/share@" \
+ -i "${S}"/emacs/twelf-init.el \
+ || die "Could not set ROOT in ${S}/emacs/twelf-init.el"
+}
+
+src_compile() {
+ emake mlton CFLAGS="${CFLAGS}" LDFLAGS="${LDFLAGS} -fno-PIE"
+ if use emacs ; then
+ pushd "${S}/emacs" || die "Could change directory to emacs"
+ elisp-compile \
+ auc-menu.el \
+ twelf-font.el \
+ twelf-init.el \
+ twelf.el \
+ || die "emacs elisp compile failed"
+ popd
+ fi
+ if use doc; then
+ pushd doc/guide
+ emake all
+ popd
+ fi
+}
+
+ins_example_dir() {
+ insinto "/usr/share/${PN}/examples/${1}"
+ pushd "${S}/${1}"
+ doins -r *
+ popd
+}
+
+src_install() {
+ if use emacs ; then
+ elisp-install ${PN} emacs/*.{el,elc}
+ cp "${FILESDIR}"/${SITEFILE} "${S}"
+ elisp-site-file-install ${SITEFILE}
+ fi
+ if use examples; then
+ ins_example_dir examples
+ ins_example_dir examples-clp
+ ins_example_dir examples-delphin
+ fi
+ dobin bin/twelf-server
+ dohtml doc/html/index.html
+ doinfo doc/guide/twelf.info
+ dodoc doc/guide/twelf.dvi doc/guide/twelf.ps doc/guide/twelf.pdf
+ dohtml doc/guide/twelf/*
+}
+
+pkg_postinst() {
+ if use emacs; then
+ elisp-site-regen
+ ewarn "For twelf emacs, add this line to ~/.emacs"
+ ewarn ""
+ ewarn '(load (concat twelf-root "/twelf-init.el"))'
+ fi
+}
+
+pkg_postrm() {
+ use emacs && elisp-site-regen
+}
diff --git a/sci-mathematics/unuran/Manifest b/sci-mathematics/unuran/Manifest
new file mode 100644
index 000000000000..62476394ef98
--- /dev/null
+++ b/sci-mathematics/unuran/Manifest
@@ -0,0 +1 @@
+DIST unuran-1.8.1.tar.gz 4409911 SHA256 c270ae96857857dbac6450043df865e0517f52856ddbe5202fd35583b13c5193 SHA512 4d98861914afe39065ec31ee837c0e21e0fb4f4667f559dee38a7a5c4e06f0d09bd550b20d06321d1f5fcd4799d482a9eebc66ac35f8cd7fff834f536d24854c WHIRLPOOL 7a93a0bb9f052c56f188c117decd4324aeba6bf61bdb8d6d3c10aae921b6a3f174f40baac4f5ecae519c134f8e97cd43fa580ba761429a88f35957b054391b9c
diff --git a/sci-mathematics/unuran/files/unuran-1.8.0-nogsl.patch b/sci-mathematics/unuran/files/unuran-1.8.0-nogsl.patch
new file mode 100644
index 000000000000..f6266532e83e
--- /dev/null
+++ b/sci-mathematics/unuran/files/unuran-1.8.0-nogsl.patch
@@ -0,0 +1,48 @@
+diff -Nur unuran-1.8.0.orig/configure.ac unuran-1.8.0/configure.ac
+--- unuran-1.8.0.orig/configure.ac 2010-12-22 05:11:07.000000000 +0000
++++ unuran-1.8.0/configure.ac 2010-12-22 05:15:35.000000000 +0000
+@@ -62,10 +62,6 @@
+ dnl libm: the standard math library
+ AC_CHECK_LIB([m], [sqrt])
+
+-dnl libmgsl: the GNU Scientific library
+-dnl (only used for experimental code)
+-AC_CHECK_LIB([gsl], [gsl_integration_qagiu])
+-
+ dnl Optional support for external uniform random number generators
+
+ dnl RngStream: Pierre L'Ecuyer's multiple random stream generator
+@@ -80,6 +76,11 @@
+ AX_ADD_URNG_LIB([gsl],[GSL],[random number generators from GNU Scientific Library],
+ [gsl],[gsl_rng_alloc],[gsl/gsl_rng.h])
+
++if test -n $UNURAN_SUPPORTS_GSL; then
++ AC_PATH_PROG(GSL_CONFIG, gsl-config, no)
++ LIBS="$LIBS `$GSL_CONFIG --libs`"
++fi
++
+ dnl Default URNG
+ AC_ARG_WITH(urng_default,
+ [AS_HELP_STRING([--with-urng-default],
+@@ -215,7 +216,8 @@
+ [],
+ [enable_experimental=no])
+ AS_IF([test "x$enable_experimental" = xyes],
+- [AC_DEFINE([USE_EXPERIMENTAL_CODE], [1],
++ [AC_CHECK_LIB([gsl], [gsl_integration_qagiu])
++ AC_DEFINE([USE_EXPERIMENTAL_CODE], [1],
+ [Define to 1 if you want to use experimental code])],
+ [])
+ AM_CONDITIONAL(ENABLE_EXPERIMENTAL, test x$enable_experimental = xyes)
+diff -Nur unuran-1.8.0.orig/tests/Makefile.am unuran-1.8.0/tests/Makefile.am
+--- unuran-1.8.0.orig/tests/Makefile.am 2010-12-22 05:11:07.000000000 +0000
++++ unuran-1.8.0/tests/Makefile.am 2010-12-22 05:11:19.000000000 +0000
+@@ -9,7 +9,7 @@
+ -I$(top_srcdir)/src \
+ -I$(top_srcdir)/src/tests
+
+-noinst_LTLIBRARIES = libtestroutines.la
++check_LTLIBRARIES = libtestroutines.la
+ libtestroutines_la_SOURCES = testroutines.c testcounter.c
+
+ LDADD = \
diff --git a/sci-mathematics/unuran/metadata.xml b/sci-mathematics/unuran/metadata.xml
new file mode 100644
index 000000000000..2901b3b649b9
--- /dev/null
+++ b/sci-mathematics/unuran/metadata.xml
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <herd>sci-mathematics</herd>
+ <longdescription lang="en">
+ UNU.RAN is an ANSI C library licensed under GPL.
+ It contains universal (also called automatic or black-box) algorithms
+ that can generate random numbers from large classes of continuous or
+ discrete distributions, and also from practically all standard
+ distributions.
+</longdescription>
+ <use>
+ <flag name="rngstreams">Use <pkg>sci-mathematics/rngstreams</pkg> library</flag>
+ <flag name="prng">Use <pkg>sci-mathematics/prng</pkg> library</flag>
+ </use>
+</pkgmetadata>
diff --git a/sci-mathematics/unuran/unuran-1.8.1.ebuild b/sci-mathematics/unuran/unuran-1.8.1.ebuild
new file mode 100644
index 000000000000..d3f0623ac75f
--- /dev/null
+++ b/sci-mathematics/unuran/unuran-1.8.1.ebuild
@@ -0,0 +1,45 @@
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=4
+
+inherit autotools-utils
+
+DESCRIPTION="Universal Non-Uniform Random number generator"
+HOMEPAGE="http://statmath.wu.ac.at/unuran/"
+SRC_URI="${HOMEPAGE}${P}.tar.gz"
+
+LICENSE="GPL-2"
+SLOT=0
+KEYWORDS="amd64 x86 ~amd64-linux ~x86-linux"
+IUSE="doc examples gsl prng +rngstreams static-libs"
+
+DEPEND="
+ gsl? ( sci-libs/gsl )
+ prng? ( sci-mathematics/prng )
+ rngstreams? ( sci-mathematics/rngstreams )"
+RDEPEND="${DEPEND}"
+
+src_configure() {
+ local udefault=builtin
+ use rngstreams && udefault=rngstream
+ local myeconfargs=(
+ --enable-shared
+ --with-urng-default=${udefault}
+ $(use_with gsl urng-gsl)
+ $(use_with prng urng-prng)
+ $(use_with rngstreams urng-rngstream)
+ )
+ autotools-utils_src_configure
+}
+
+src_install() {
+ autotools-utils_src_install
+ use doc && dodoc doc/${PN}.pdf
+ if use examples; then
+ rm examples/Makefile*
+ insinto /usr/share/doc/${PF}
+ doins -r examples
+ fi
+}
diff --git a/sci-mathematics/wxmaxima/Manifest b/sci-mathematics/wxmaxima/Manifest
new file mode 100644
index 000000000000..87c8ce24cac9
--- /dev/null
+++ b/sci-mathematics/wxmaxima/Manifest
@@ -0,0 +1,2 @@
+DIST wxMaxima-13.04.2.tar.gz 1652680 SHA256 29352db75dd3ff27393ab0971543fd0b3c3a9c330c2c8d07ebfd373741ded4eb SHA512 36d035282aca8d40d9f5950c21e8e3abe8d3a76ffbb91f6436a3588e252ca2455c4c1c4e5eed4111888f917406ac758f551198ca97acb67bcc6655e579db20aa WHIRLPOOL 7579a5d7b72e0c10f9162b92da03b2f4f51052cf8800fc0c01312718cfc31c0d8ff608aff6f873e07b46247a2c2ad7dc666e0e469dda1f1a8e8af52629a6e69d
+DIST wxmaxima-15.04.0.tar.gz 4990313 SHA256 c178067a2f75d91dd378f88b4d0f87af6b2705ca32bea509d63e7347b2a1d21e SHA512 1a899259698da38f97a1859ba0526406cbc654a130dc1d18e01cf248ac4d7292c82cb00dd92ce2fac2c3cfc002788fdef0a6a4f95eca54b9096efc73c6aa45b7 WHIRLPOOL 225456c073b1aa87d2e599b9c63244ff7c97378fb6b5a60fcb8730655d193a0f032b27a1264e12eefb4abf08389f2337a11c380b6d89af2de9a4fb6e14f614dc
diff --git a/sci-mathematics/wxmaxima/metadata.xml b/sci-mathematics/wxmaxima/metadata.xml
new file mode 100644
index 000000000000..60b646350479
--- /dev/null
+++ b/sci-mathematics/wxmaxima/metadata.xml
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <herd>sci-mathematics</herd>
+ <longdescription lang="en">
+wxMaxima is a wxWidgets GUI for the computer algebra system maxima.
+Most of maxima functions are accessible through menus, some have
+dialogs. The input line has command history (up-key, down-key) and
+completion based on previous input (tab-key).
+wxMaxima provides 2d formated display of maxima output.
+</longdescription>
+ <upstream>
+ <remote-id type="sourceforge">wxmaxima</remote-id>
+ </upstream>
+</pkgmetadata>
diff --git a/sci-mathematics/wxmaxima/wxmaxima-13.04.2.ebuild b/sci-mathematics/wxmaxima/wxmaxima-13.04.2.ebuild
new file mode 100644
index 000000000000..ff8730a0b4bf
--- /dev/null
+++ b/sci-mathematics/wxmaxima/wxmaxima-13.04.2.ebuild
@@ -0,0 +1,80 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+WX_GTK_VER="2.8"
+
+inherit eutils gnome2-utils wxwidgets fdo-mime
+
+MYP=wxMaxima-${PV}
+
+DESCRIPTION="Graphical frontend to Maxima, using the wxWidgets toolkit"
+HOMEPAGE="http://wxmaxima.sourceforge.net/"
+SRC_URI="mirror://sourceforge/${PN}/${MYP}.tar.gz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="amd64 ppc x86"
+
+DEPEND="
+ dev-libs/libxml2:2
+ x11-libs/wxGTK:${WX_GTK_VER}"
+RDEPEND="${DEPEND}
+ media-fonts/jsmath
+ sci-visualization/gnuplot[wxwidgets]
+ sci-mathematics/maxima"
+
+S="${WORKDIR}/${MYP}"
+
+src_prepare() {
+ local i
+
+ # consistent package names
+ sed -e "s:\${datadir}/wxMaxima:\${datadir}/${PN}:g" \
+ -i Makefile.in data/Makefile.in || die "sed failed"
+
+ sed -e 's:share/wxMaxima:share/wxmaxima:g' \
+ -i src/wxMaxima.cpp src/wxMaximaFrame.cpp src/Config.cpp \
+ || die "sed failed"
+
+ # correct gettext behavior
+ if [[ -n "${LINGUAS+x}" ]] ; then
+ for i in $(cd "${S}"/locales ; echo *.mo) ; do
+ if ! has ${i%.mo} ${LINGUAS} ; then
+ sed -i \
+ -e "/^WXMAXIMA_LINGUAS/s# ${i%.mo}##" \
+ -e "/^WXWIN_LINGUAS/s# ${i%.mo}##" \
+ locales/Makefile.in || die
+ fi
+ done
+ fi
+}
+
+src_configure() {
+ econf \
+ --enable-printing \
+ --with-wx-config=${WX_CONFIG}
+}
+
+src_install () {
+ default
+ doicon -s 128 data/wxmaxima.png
+ make_desktop_entry wxmaxima wxMaxima wxmaxima
+ dosym /usr/share/${PN}/README /usr/share/doc/${PF}/README
+}
+
+pkg_preinst() {
+ gnome2_icon_savelist
+}
+
+pkg_postinst() {
+ gnome2_icon_cache_update
+ fdo-mime_desktop_database_update
+}
+
+pkg_postrm() {
+ gnome2_icon_cache_update
+ fdo-mime_desktop_database_update
+}
diff --git a/sci-mathematics/wxmaxima/wxmaxima-15.04.0-r1.ebuild b/sci-mathematics/wxmaxima/wxmaxima-15.04.0-r1.ebuild
new file mode 100644
index 000000000000..bf28bb6fb3fa
--- /dev/null
+++ b/sci-mathematics/wxmaxima/wxmaxima-15.04.0-r1.ebuild
@@ -0,0 +1,77 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+WX_GTK_VER="3.0"
+
+inherit eutils gnome2-utils wxwidgets fdo-mime
+
+DESCRIPTION="Graphical frontend to Maxima, using the wxWidgets toolkit"
+HOMEPAGE="http://andrejv.github.io/wxmaxima/"
+SRC_URI="mirror://sourceforge/${PN}/${P}.tar.gz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~amd64 ~ppc ~x86"
+
+DEPEND="
+ dev-libs/libxml2:2
+ x11-libs/wxGTK:${WX_GTK_VER}"
+RDEPEND="${DEPEND}
+ media-fonts/jsmath
+ sci-visualization/gnuplot[wxwidgets]
+ sci-mathematics/maxima"
+
+src_prepare() {
+ local i
+
+ # consistent package names
+ sed -e "s:\${datadir}/wxMaxima:\${datadir}/${PN}:g" \
+ -i Makefile.in data/Makefile.in || die "sed failed"
+
+ sed -e 's:share/wxMaxima:share/wxmaxima:g' \
+ -i src/wxMaxima.cpp src/wxMaximaFrame.cpp src/Config.cpp \
+ -i src/wxMaxima.cpp src/wxMaximaFrame.cpp src/Dirstructure.h src/Dirstructure.cpp \
+ || die "sed failed"
+
+ # correct gettext behavior
+ if [[ -n "${LINGUAS+x}" ]] ; then
+ for i in $(cd "${S}"/locales ; echo *.mo) ; do
+ if ! has ${i%.mo} ${LINGUAS} ; then
+ sed -i \
+ -e "/^WXMAXIMA_LINGUAS/s# ${i%.mo}##" \
+ -e "/^WXWIN_LINGUAS/s# ${i%.mo}##" \
+ locales/Makefile.in || die
+ fi
+ done
+ fi
+}
+
+src_configure() {
+ econf \
+ --enable-printing \
+ --with-wx-config=${WX_CONFIG}
+}
+
+src_install () {
+ default
+ doicon -s 128 data/wxmaxima.png
+ make_desktop_entry wxmaxima wxMaxima wxmaxima
+ dosym /usr/share/${PN}/README /usr/share/doc/${PF}/README
+}
+
+pkg_preinst() {
+ gnome2_icon_savelist
+}
+
+pkg_postinst() {
+ gnome2_icon_cache_update
+ fdo-mime_desktop_database_update
+}
+
+pkg_postrm() {
+ gnome2_icon_cache_update
+ fdo-mime_desktop_database_update
+}
diff --git a/sci-mathematics/xmds/Manifest b/sci-mathematics/xmds/Manifest
new file mode 100644
index 000000000000..e0146b2f4798
--- /dev/null
+++ b/sci-mathematics/xmds/Manifest
@@ -0,0 +1,3 @@
+DIST xmds-1.6.5.tar.gz 528593 SHA256 f7128c7c847bafd3a5ed582415cbddd1f31234278d62231faaeb9bec04d6b5ff
+DIST xmds-1.6.6.tar.gz 607585 SHA256 0deb74cf52ea9df58d1a5714d7edd42e027c06ae3eb2cfc12f1fcf477f69f11e
+DIST xmds_doc_20080226.pdf 8093270 SHA256 93ca478d70cfc684cabb24e278181a50f70f4a2b769e8cf7028b6ecc1cb10009
diff --git a/sci-mathematics/xmds/files/xmds-1.6.5-gcc43.patch b/sci-mathematics/xmds/files/xmds-1.6.5-gcc43.patch
new file mode 100644
index 000000000000..766056d5ae51
--- /dev/null
+++ b/sci-mathematics/xmds/files/xmds-1.6.5-gcc43.patch
@@ -0,0 +1,108 @@
+diff -Naurp xmds-1.6.5-orig/source/xmds_integrate_ark45.cc xmds-1.6.5/source/xmds_integrate_ark45.cc
+--- xmds-1.6.5-orig/source/xmds_integrate_ark45.cc 2008-06-28 21:48:21.000000000 +0200
++++ xmds-1.6.5/source/xmds_integrate_ark45.cc 2008-06-28 21:48:57.000000000 +0200
+@@ -35,6 +35,7 @@
+ #include <xmds_simulation.h>
+ #include <xmds_vector.h>
+ #include <cstdlib>
++#include <cstring>
+
+ // **************************************************************************
+ // **************************************************************************
+@@ -289,7 +290,7 @@ void xmdsIntegrateARK45::writeTimestepEr
+ fprintf(outfile, "for(unsigned long _i0=0; _i0<_%s_size; _i0++){\n", fieldName);
+ }
+ fprintf(outfile, " for(unsigned long _i1=0; _i1<_%s_main_ncomponents; _i1++){\n", fieldName);
+- if (strcmp(typeName, "complex") == 0) {
++ if (std::strcmp(typeName, "complex") == 0) {
+ fprintf(outfile, " _temp_mod=mod2(_%s_main[_%s_main_index_pointer + _i1]);\n", fieldName, fieldName);
+ }
+ else {
+@@ -347,7 +348,7 @@ void xmdsIntegrateARK45::writeTimestepEr
+ }
+ fprintf(outfile, " for(unsigned long _i1=0; _i1<_%s_main_ncomponents; _i1++)\n", fieldName);
+
+- if (strcmp(typeName, "complex") == 0) {
++ if (std::strcmp(typeName, "complex") == 0) {
+ fprintf(outfile, " if(mod2(_%s_main[_%s_main_index_pointer + _i1])>_peak[_i1]){\n", fieldName, fieldName);
+ fprintf(outfile, " _temp_error=mod(_%s_main[_%s_main_index_pointer + _i1]-_checkfield[_%s_main_index_pointer + _i1])/(mod(_%s_main[_%s_main_index_pointer + _i1])+1e-20);\n", fieldName, fieldName, fieldName, fieldName, fieldName);
+ }
+@@ -364,7 +365,7 @@ void xmdsIntegrateARK45::writeTimestepEr
+ else{ // if ndims==0
+ fprintf(outfile, " for(unsigned long _i1=0; _i1<_%s_main_ncomponents; _i1++){\n", fieldName);
+
+- if (strcmp(typeName, "complex") == 0) {
++ if (std::strcmp(typeName, "complex") == 0) {
+ fprintf(outfile, " _temp_error=mod(_%s_main[_i1]-_checkfield[_i1])/(mod(_%s_main[_i1])+1e-20);\n", fieldName, fieldName);
+ }
+ else{
+diff -Naurp xmds-1.6.5-orig/source/xmds_integrate_ark89.cc xmds-1.6.5/source/xmds_integrate_ark89.cc
+--- xmds-1.6.5-orig/source/xmds_integrate_ark89.cc 2008-06-28 21:48:21.000000000 +0200
++++ xmds-1.6.5/source/xmds_integrate_ark89.cc 2008-06-28 21:48:57.000000000 +0200
+@@ -35,6 +35,7 @@
+ #include <xmds_simulation.h>
+ #include <xmds_vector.h>
+ #include <cstdlib>
++#include <cstring>
+
+ // **************************************************************************
+ // **************************************************************************
+@@ -284,7 +285,7 @@ void xmdsIntegrateARK89::writeTimestepEr
+ fprintf(outfile, "for (unsigned long _i0=0; _i0<_%s_size; _i0++){\n", fieldName);
+ }
+ fprintf(outfile, " for (unsigned long _i1=0; _i1<_%s_main_ncomponents; _i1++){\n", fieldName);
+- if (strcmp(typeName, "complex") == 0) {
++ if (std::strcmp(typeName, "complex") == 0) {
+ fprintf(outfile, " _temp_mod=mod2(_%s_main[_%s_main_index_pointer + _i1]);\n", fieldName, fieldName);
+ }
+ else {
+@@ -334,7 +335,7 @@ void xmdsIntegrateARK89::writeTimestepEr
+ }
+ fprintf(outfile, " for (unsigned long _i1=0; _i1<_%s_main_ncomponents; _i1++)\n", fieldName);
+
+- if (strcmp(typeName, "complex") == 0) {
++ if (std::strcmp(typeName, "complex") == 0) {
+ fprintf(outfile, " if (mod2(_%s_main[_%s_main_index_pointer + _i1])>_peak[_i1]){\n", fieldName, fieldName);
+ fprintf(outfile, " _temp_error=mod(_%s_main[_%s_main_index_pointer + _i1]-_checkfield[_%s_main_index_pointer + _i1])/(mod(_%s_main[_%s_main_index_pointer + _i1])+1e-20);\n", fieldName, fieldName, fieldName, fieldName, fieldName);
+ }
+@@ -352,7 +353,7 @@ void xmdsIntegrateARK89::writeTimestepEr
+
+ fprintf(outfile, " for (unsigned long _i1=0; _i1<_%s_main_ncomponents; _i1++){\n", fieldName);
+
+- if (strcmp(typeName, "complex") == 0){
++ if (std::strcmp(typeName, "complex") == 0){
+ fprintf(outfile, " _temp_error=mod(_%s_main[_i1]-_checkfield[_i1])/(mod(_%s_main[_i1])+1e-20);\n", fieldName, fieldName);
+ }
+ else{
+diff -Naurp xmds-1.6.5-orig/source/xmds_simulation.h xmds-1.6.5/source/xmds_simulation.h
+--- xmds-1.6.5-orig/source/xmds_simulation.h 2008-06-28 21:48:21.000000000 +0200
++++ xmds-1.6.5/source/xmds_simulation.h 2008-06-28 21:48:57.000000000 +0200
+@@ -40,6 +40,8 @@
+ #include <xmds_sequence.h>
+ #include <xmds_globals.h>
+
++#include <string>
++
+ // *****************************************************************************
+ // *****************************************************************************
+ // xmdsSimulation
+diff -Naurp xmds-1.6.5-orig/source/xsil2graphics.cc xmds-1.6.5/source/xsil2graphics.cc
+--- xmds-1.6.5-orig/source/xsil2graphics.cc 2008-06-28 21:48:21.000000000 +0200
++++ xmds-1.6.5/source/xsil2graphics.cc 2008-06-28 21:48:57.000000000 +0200
+@@ -40,6 +40,7 @@
+ #include <xsil_field.h>
+ #include <getopt_xmds.h>
+ #include <iostream>
++#include <cstring>
+
+ // **********************************************************************
+
+@@ -306,7 +307,7 @@ int main(
+
+ const DOMString *mgName = nextElement->getAttribute("Name");
+ int mgNumber = i+1;
+- if (strcmp("breakpoint", mgName->c_str()) == 0) {
++ if (std::strcmp("breakpoint", mgName->c_str()) == 0) {
+ mgNumber = 1;
+ }
+ else {
diff --git a/sci-mathematics/xmds/metadata.xml b/sci-mathematics/xmds/metadata.xml
new file mode 100644
index 000000000000..607ce9407204
--- /dev/null
+++ b/sci-mathematics/xmds/metadata.xml
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <herd>sci</herd>
+ <maintainer>
+ <email>tomka@gentoo.org</email>
+ <name>Thomas Kahle</name>
+ </maintainer>
+ <longdescription lang="en">
+XMDS is a code generator that integrates differential equations (ODEs, PDEs and
+SDEs are all supported). The system of equations to be integrated is specified
+in a XML file, which XMDS then uses to generate a C++ integrator. The code can
+autamatically take advantage of MPI and FFTW.
+ </longdescription>
+ <upstream>
+ <remote-id type="sourceforge">xmds</remote-id>
+ </upstream>
+</pkgmetadata>
diff --git a/sci-mathematics/xmds/xmds-1.6.5.ebuild b/sci-mathematics/xmds/xmds-1.6.5.ebuild
new file mode 100644
index 000000000000..4ddb29d68b82
--- /dev/null
+++ b/sci-mathematics/xmds/xmds-1.6.5.ebuild
@@ -0,0 +1,58 @@
+# Copyright 1999-2008 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+inherit eutils
+
+doc_ver=20080226
+
+DESCRIPTION="XMDS - The eXtensible Multi-Dimensional Simulator"
+HOMEPAGE="http://www.xmds.org"
+SRC_URI="mirror://sourceforge/xmds/${P}.tar.gz
+ doc? ( mirror://sourceforge/xmds/xmds_doc_${doc_ver}.pdf )"
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="amd64 x86"
+IUSE="doc examples mpi threads"
+
+DEPEND="sci-libs/fftw
+ mpi? ( virtual/mpi )"
+
+src_unpack() {
+ unpack ${P}.tar.gz
+ cd "${S}"
+
+ epatch "${FILESDIR}"/${PN}-1.6.5-gcc43.patch
+ touch "${S}/source/version.h"
+
+ # Fix broken installation of sample scripts.
+ sed -i -e 's/install-data-am: install-dist_doc_examplesDATA install-man/install-data-am: install-man/' Makefile.in
+}
+
+src_compile() {
+ local my_opts=""
+
+ if has_version "=sci-libs/fftw-3*" ; then
+ my_opts="${my_opts} --enable-fftw3"
+ fi
+
+ econf \
+ $(use_enable mpi) \
+ $(use_enable threads) \
+ ${my_opts} || die
+ emake || die
+}
+
+src_install() {
+ make DESTDIR="${D}" install || die
+
+ if use doc; then
+ insinto /usr/share/doc/${PF}
+ doins "${DISTDIR}/xmds_doc_${doc_ver}.pdf"
+ fi
+
+ if use examples; then
+ insinto /usr/share/doc/${PF}/examples
+ doins examples/*
+ fi
+}
diff --git a/sci-mathematics/xmds/xmds-1.6.6.ebuild b/sci-mathematics/xmds/xmds-1.6.6.ebuild
new file mode 100644
index 000000000000..9d3e48b854d2
--- /dev/null
+++ b/sci-mathematics/xmds/xmds-1.6.6.ebuild
@@ -0,0 +1,51 @@
+# Copyright 1999-2009 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+inherit eutils
+
+doc_ver=20080226
+
+DESCRIPTION="XMDS - The eXtensible Multi-Dimensional Simulator"
+HOMEPAGE="http://www.xmds.org"
+SRC_URI="mirror://sourceforge/xmds/${P}.tar.gz
+ doc? ( mirror://sourceforge/xmds/xmds_doc_${doc_ver}.pdf )"
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="amd64 x86"
+IUSE="doc examples mpi threads"
+
+DEPEND="sci-libs/fftw
+ mpi? ( virtual/mpi )"
+
+src_compile() {
+ local my_opts=""
+
+ if has_version "=sci-libs/fftw-3*" ; then
+ my_opts="${my_opts} --enable-fftw3"
+ fi
+
+ econf \
+ $(use_enable mpi) \
+ $(use_enable threads) \
+ ${my_opts} || die
+ emake || die
+}
+
+src_install() {
+ make DESTDIR="${D}" install || die
+
+ if use doc; then
+ insinto /usr/share/doc/${PF}
+ doins "${DISTDIR}/xmds_doc_${doc_ver}.pdf"
+ fi
+
+ if use examples; then
+ insinto /usr/share/doc/${PF}/examples
+ for i in "${D}"/usr/share/doc/${PN}/examples/* ; do
+ doins "$i"
+ done
+ fi
+
+ rm -rf "${D}/usr/share/doc/${PN}"
+}
diff --git a/sci-mathematics/yacas/Manifest b/sci-mathematics/yacas/Manifest
new file mode 100644
index 000000000000..07e576e073f9
--- /dev/null
+++ b/sci-mathematics/yacas/Manifest
@@ -0,0 +1,3 @@
+DIST yacas-1.3.2.tar.gz 1292706 SHA256 82c7dc0de492b4290633e6abf18d35a2ec03117e6ea3e0f9418e6e85372c030e
+DIST yacas-1.3.3.tar.gz 1296777 SHA256 6c73c653c5e13567510888800a68c14d231b1ef4f2b33193a158b8caec142141 SHA512 a0c60f78a0d3f19d5fa820bdf62b2ae25ece00f985422a17a56f091ff240b74811af1c1480c24eff5dcb5cb021aa9709664e929913a33f411e6d2b64f37d3c70 WHIRLPOOL f1334fd7cd191b1e9448efaed0542f338f35cf769ef2c6e8ca43ab0a75994aa09286fb6e5688b78927980ba4967093f971be33785f4a3d92a377532dd5e09a34
+DIST yacas-1.3.4.tar.gz 1582029 SHA256 11de62f7ff014bc8a14c5f48f9c34107509506636b4701999413d0cb4dac5c69 SHA512 9ec26e2c9d5355aa124a17f7dc4164c224fed880481ebd0a672c500dae9e066e37700cbd5bf896686f713a7615a58dde7be7a7a843ab236bfd0921774dc50a43 WHIRLPOOL 1d1028083ebdb1bb4d25346200b76ab76e807174886179194bc4fffb582771861535e738d47635c5df45e21edf942458dc58221cfa7826a53df0119b71c6dade
diff --git a/sci-mathematics/yacas/files/yacas-1.3.4-java-version.patch b/sci-mathematics/yacas/files/yacas-1.3.4-java-version.patch
new file mode 100644
index 000000000000..7f6ab2da5144
--- /dev/null
+++ b/sci-mathematics/yacas/files/yacas-1.3.4-java-version.patch
@@ -0,0 +1,29 @@
+--- JavaYacas/dumpversion.cpp.orig 2014-06-09 12:10:15.095959491 -0700
++++ JavaYacas/dumpversion.cpp 2014-06-09 12:11:09.565339056 -0700
+@@ -1,11 +1,11 @@
+ #include <stdio.h>
+ #include <stdlib.h>
+-#include "version.h"
++#include "yacas/yacas_version.h"
+
+ int main(int argc, char** argv)
+ {
+ printf("package net.sf.yacas;\n");
+- printf("class CVersion { static String VERSION = \"%s\"; }\n", VERSION);
++ printf("class CVersion { static String VERSION = \"%s\"; }\n", YACAS_VERSION);
+ return 0;
+ }
+
+--- JavaYacas/makefile.yacas.orig 2014-06-09 12:11:47.516603467 -0700
++++ JavaYacas/makefile.yacas 2014-06-09 15:03:17.329987079 -0700
+@@ -32,8 +32,8 @@
+ .java.class:
+ $(JAVAC) $(JAVACFLAGS) $*.java
+
+-net/sf/yacas/CVersion.java: ../src/version.h dumpversion.cpp
+- $(CXX) $(CXXFLAGS) -I ../src dumpversion.cpp -o dumpversion
++net/sf/yacas/CVersion.java: ../include/yacas/yacas_version.h dumpversion.cpp
++ $(CXX) $(CXXFLAGS) -I ../include dumpversion.cpp -o dumpversion
+ ./dumpversion > net/sf/yacas/CVersion.java
+
+
diff --git a/sci-mathematics/yacas/metadata.xml b/sci-mathematics/yacas/metadata.xml
new file mode 100644
index 000000000000..e992686a974a
--- /dev/null
+++ b/sci-mathematics/yacas/metadata.xml
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+<herd>sci-mathematics</herd>
+<longdescription lang="en">
+ Yacas (Yet Another Computer Algebra System) is a small and highly
+ flexible general-purpose computer algebra language. The syntax uses a
+ infix-operator grammar parser. The distribution contains a small
+ library of mathematical functions, but its real strength is in the
+ language in which you can easily write your own symbolic manipulation
+ algorithms.
+</longdescription>
+<use>
+ <flag name="server">Build the network server version</flag>
+</use>
+</pkgmetadata>
diff --git a/sci-mathematics/yacas/yacas-1.3.2.ebuild b/sci-mathematics/yacas/yacas-1.3.2.ebuild
new file mode 100644
index 000000000000..6b284a29ae52
--- /dev/null
+++ b/sci-mathematics/yacas/yacas-1.3.2.ebuild
@@ -0,0 +1,46 @@
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=4
+
+inherit autotools eutils java-pkg-opt-2
+
+DESCRIPTION="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"
+IUSE="doc java server"
+
+DEPEND="java? ( >=virtual/jdk-1.6 )"
+RDEPEND="java? ( >=virtual/jre-1.6 )"
+
+src_configure() {
+ econf \
+ $(use_enable doc html-doc) \
+ $(use_enable server) \
+ --with-html-dir="/usr/share/doc/${PF}/html"
+}
+
+src_compile() {
+ default
+ if use java; then
+ cd JavaYacas || die
+ # -j1 because of file generation dependence
+ emake -j1 -f makefile.yacas
+ fi
+}
+
+src_install() {
+ default
+ if use java; then
+ cd JavaYacas || die
+ java-pkg_dojar yacas.jar
+ java-pkg_dolauncher jyacas --main net.sf.yacas.YacasConsole
+ insinto /usr/share/${PN}
+ doins hints.txt yacasconsole.html
+ fi
+}
diff --git a/sci-mathematics/yacas/yacas-1.3.3.ebuild b/sci-mathematics/yacas/yacas-1.3.3.ebuild
new file mode 100644
index 000000000000..42c15e4e0118
--- /dev/null
+++ b/sci-mathematics/yacas/yacas-1.3.3.ebuild
@@ -0,0 +1,46 @@
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=4
+
+inherit autotools eutils java-pkg-opt-2
+
+DESCRIPTION="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 ~amd64-linux ~x86-linux"
+IUSE="doc java server"
+
+DEPEND="java? ( >=virtual/jdk-1.6 )"
+RDEPEND="java? ( >=virtual/jre-1.6 )"
+
+src_configure() {
+ econf \
+ $(use_enable doc html-doc) \
+ $(use_enable server) \
+ --with-html-dir="/usr/share/doc/${PF}/html"
+}
+
+src_compile() {
+ default
+ if use java; then
+ cd JavaYacas || die
+ # -j1 because of file generation dependence
+ emake -j1 -f makefile.yacas
+ fi
+}
+
+src_install() {
+ default
+ if use java; then
+ cd JavaYacas || die
+ java-pkg_dojar yacas.jar
+ java-pkg_dolauncher jyacas --main net.sf.yacas.YacasConsole
+ insinto /usr/share/${PN}
+ doins hints.txt yacasconsole.html
+ fi
+}
diff --git a/sci-mathematics/yacas/yacas-1.3.4.ebuild b/sci-mathematics/yacas/yacas-1.3.4.ebuild
new file mode 100644
index 000000000000..dd401974d862
--- /dev/null
+++ b/sci-mathematics/yacas/yacas-1.3.4.ebuild
@@ -0,0 +1,55 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+AUTOTOOLS_AUTORECONF=1
+AUTOTOOLS_IN_SOURCE_BUILD=1
+
+inherit java-pkg-opt-2 autotools-utils
+
+DESCRIPTION="General purpose computer algebra system"
+HOMEPAGE="http://yacas.sourceforge.net/"
+SRC_URI="http://${PN}.sourceforge.net/backups/${P}.tar.gz"
+
+SLOT="0/1"
+LICENSE="GPL-2"
+KEYWORDS="~amd64 ~ppc ~x86 ~amd64-linux ~x86-linux"
+IUSE="doc java static-libs server"
+
+DEPEND="java? ( >=virtual/jdk-1.6 )"
+RDEPEND="java? ( >=virtual/jre-1.6 )"
+
+PATCHES=(
+ "${FILESDIR}"/${PN}-1.3.4-java-version.patch
+)
+
+src_configure() {
+ local myeconfargs=(
+ --with-html-dir="/usr/share/doc/${PF}/html"
+ $(use_enable doc html-doc)
+ $(use_enable server)
+ )
+ autotools-utils_src_configure
+}
+
+src_compile() {
+ autotools-utils_src_compile -j1
+ if use java; then
+ cd "${BUILD_DIR}"/JavaYacas || die
+ # -j1 because of file generation dependence
+ emake -j1 -f makefile.yacas
+ fi
+}
+
+src_install() {
+ autotools-utils_src_install
+ if use java; then
+ cd "${BUILD_DIR}"/JavaYacas || die
+ java-pkg_dojar yacas.jar
+ java-pkg_dolauncher jyacas --main net.sf.yacas.YacasConsole
+ insinto /usr/share/${PN}
+ doins "${S}"/JavaYacas/{hints.txt,yacasconsole.html}
+ fi
+}
diff --git a/sci-mathematics/yafu/Manifest b/sci-mathematics/yafu/Manifest
new file mode 100644
index 000000000000..e6c96aed4607
--- /dev/null
+++ b/sci-mathematics/yafu/Manifest
@@ -0,0 +1 @@
+DIST yafu-1.34-src.zip 686655 SHA256 ad3e6b74f766a7c59280642065ea9482d438dc3be383962f50119f43948631be SHA512 f8afba77e0286c579b4152517ba3a0b6b85d43606e4fafc653dc06b7f7c2aba0f8f3c65b38f3496657495bff476dd4cc8e06daaad8a7a78a36fc6e1c0cf046a4 WHIRLPOOL 69a2b0a99914bbf3cbb6b0cc91597b3d9ae25f29622af859a279f53c2281ae5e0f4e691112f111ad53781b0fe0258f73b1c9ee400cb4d22c28cfeb136785ca41
diff --git a/sci-mathematics/yafu/files/fix-Makefile.patch b/sci-mathematics/yafu/files/fix-Makefile.patch
new file mode 100644
index 000000000000..82b8e0d7d2ff
--- /dev/null
+++ b/sci-mathematics/yafu/files/fix-Makefile.patch
@@ -0,0 +1,11 @@
+--- Makefile.orig 2013-03-17 11:20:40.248683894 +0400
++++ Makefile 2013-03-17 11:20:47.352683657 +0400
+@@ -87,7 +87,7 @@ ifeq ($(CC),icc)
+ CFLAGS += -mtune=core2 -march=core2
+ endif
+
+-LIBS += -lecm -lgmp
++LIBS += -lecm -lgmp -lgomp
+
+ CFLAGS += $(OPT_FLAGS) $(WARN_FLAGS) $(INC)
+
diff --git a/sci-mathematics/yafu/metadata.xml b/sci-mathematics/yafu/metadata.xml
new file mode 100644
index 000000000000..0bc3be1ea5ed
--- /dev/null
+++ b/sci-mathematics/yafu/metadata.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <maintainer>
+ <email>patrick@gentoo.org</email>
+ <name>Patrick Lauer</name>
+ </maintainer>
+ <use>
+ <flag name="sieve">Use msieve for the sieving steps of NFS</flag>
+ </use>
+</pkgmetadata>
diff --git a/sci-mathematics/yafu/yafu-1.34.3.ebuild b/sci-mathematics/yafu/yafu-1.34.3.ebuild
new file mode 100644
index 000000000000..49dce30f425d
--- /dev/null
+++ b/sci-mathematics/yafu/yafu-1.34.3.ebuild
@@ -0,0 +1,56 @@
+# Copyright 1999-2013 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+inherit eutils versionator
+
+MY_PV="$(get_version_component_range 1-2)"
+
+DESCRIPTION="Yet another factoring utility"
+HOMEPAGE="http://sourceforge.net/projects/yafu/"
+SRC_URI="mirror://sourceforge/${PN}/${MY_PV}/${PN}-${MY_PV}-src.zip"
+
+SLOT="0"
+LICENSE="public-domain"
+KEYWORDS="~amd64 ~x86"
+# nfs is overloaded, so using less confusing sieve here
+IUSE="+sieve"
+
+DEPEND="
+ dev-libs/gmp
+ sci-mathematics/gmp-ecm
+ sieve? (
+ sci-mathematics/msieve
+ sci-mathematics/ggnfs )"
+RDEPEND="${DEPEND}"
+
+src_prepare() {
+ epatch "${FILESDIR}/fix-Makefile.patch"
+ # This is not nice. But then the Makefile is quite special :)
+ sed -i -e 's:../gmp/include:gmp:' Makefile || die "Failed to rectify things"
+ sed -i -e 's:../gmp-ecm/include:gmp-ecm:' Makefile || die "Failed to rectify things"
+ sed -i -e 's:LIBS += -L../:# LIBS += -L../:g' Makefile || die "Failed to rectify things"
+ sed -i -e 's:\"config.h\":<gmp-ecm/config.h>:g' top/driver.c || die "Failed to rectify things"
+ sed -i -e 's:# LIBS += -L../msieve/lib/linux/x86_64:LIBS += -lmsieve -lz -ldl:' Makefile || die "Failed to rectify things"
+ sed -i -e 's:CFLAGS = -g:#CFLAGS = -g:' Makefile || die "Failed to rectify things"
+ sed -i -e '/$(LIBS)$/s:$(CC):$(CC) $(LDFLAGS):g' Makefile || die
+
+ # proper ggnfs default path
+ sed -i -e 's~strcpy(fobj->nfs_obj.ggnfs_dir,"./");~strcpy(fobj->nfs_obj.ggnfs_dir,"/usr/bin/");~' factor/factor_common.c || die "Failed to rectify things"
+}
+
+src_compile() {
+ local VAR=""
+ # hmm, not that useful:
+ #VAR="TIMING=1 "
+ use sieve && VAR+="NFS=1"
+ use amd64 && emake $VAR x86_64
+ use x86 && emake $VAR x86
+}
+
+src_install() {
+ dobin "${S}/yafu"
+ dodoc docfile.txt README yafu.ini
+}
diff --git a/sci-mathematics/yafu/yafu-9999.ebuild b/sci-mathematics/yafu/yafu-9999.ebuild
new file mode 100644
index 000000000000..f19d80fb8b5f
--- /dev/null
+++ b/sci-mathematics/yafu/yafu-9999.ebuild
@@ -0,0 +1,56 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+inherit eutils subversion versionator
+
+DESCRIPTION="Yet another factoring utility"
+HOMEPAGE="http://sourceforge.net/projects/yafu/"
+#SRC_URI="mirror://sourceforge/${PN}/${PV}/${P}-src.zip"
+ESVN_REPO_URI="https://svn.code.sf.net/p/yafu/code/"
+
+SLOT="0"
+LICENSE="public-domain"
+KEYWORDS=""
+# nfs is overloaded, so using less confusing sieve here
+IUSE="+sieve"
+
+DEPEND="
+ dev-libs/gmp
+ sci-mathematics/gmp-ecm
+ sieve? (
+ sci-mathematics/msieve
+ sci-mathematics/ggnfs )"
+RDEPEND="${DEPEND}"
+
+src_prepare() {
+ cd trunk
+ # This is not nice. But then the Makefile is quite special :)
+ sed -i -e 's:../gmp/include:gmp:' Makefile || die "Failed to rectify things"
+ sed -i -e 's:../gmp-ecm/include:gmp-ecm:' Makefile || die "Failed to rectify things"
+ sed -i -e 's:LIBS += -L../:# LIBS += -L../:g' Makefile || die "Failed to rectify things"
+ sed -i -e 's:\"config.h\":<gmp-ecm/config.h>:g' top/driver.c || die "Failed to rectify things"
+ sed -i -e 's:# LIBS += -L../msieve/lib/linux/x86_64:LIBS += -lmsieve -lz -ldl:' Makefile || die "Failed to rectify things"
+ sed -i -e 's:CFLAGS = -g:#CFLAGS = -g:' Makefile || die "Failed to rectify things"
+ sed -i -e '/$(LIBS)$/s:$(CC):$(CC) $(LDFLAGS):g' Makefile || die
+
+ # proper ggnfs default path
+ sed -i -e 's~strcpy(fobj->nfs_obj.ggnfs_dir,"./");~strcpy(fobj->nfs_obj.ggnfs_dir,"/usr/bin/");~' factor/factor_common.c || die "Failed to rectify things"
+}
+
+src_compile() {
+ local VAR=""
+ cd trunk
+ # hmm, not that useful:
+ #VAR="TIMING=1 "
+ use sieve && VAR+="NFS=1"
+ use amd64 && emake $VAR x86_64
+ use x86 && emake $VAR x86
+}
+
+src_install() {
+ dobin "${S}/yafu"
+ dodoc docfile.txt README yafu.ini
+}