#deptype pkg,selfdep

sci-CRAN/csound {
   Csound
}

# IRKernel has a conflicting named sci-R/repr.
~sci-CRAN/repr :: ^repr$

~sci-CRAN/mimR :: ^mim$

sci-CRAN/quadprog :: portfolio.optim needs package quadprog

sci-CRAN/rgl :: rgl packages for rendering

sci-CRAN/MVA {
   package.*mva
}

~sci-CRAN/sgeostat {
   geostat
}

# the following rule is _not_ correct
#  the dependency strings listed here want the "xgobi" program from
#   http://www.research.att.com/areas/stat/xgobi/, not the R package
#
## sci-CRAN/xgobi {
##    xgobi must be installed additionally
##    xgobi & xgvis programs: http://www.research.att.com/areas/stat/xgobi/
## }

~sci-CRAN/BayesFactor :: BayesFactorPCL

sci-CRAN/adimpro {
   adimpro
}
#deptype pkg,selfdep

# FIXME: this may be incorrect
~sci-R/BSgenome {
   BSgenome.Celegans.UCSC.ce2
   BSgenome.Dmelanogaster.UCSC.dm3
   BSgenome.Ecoli.NCBI.20080805
   BSgenome.Hsapiens.UCSC.hg18
   BSgenome.Hsapiens.UCSC.hg19
   BSgenome.Mmusculus.UCSC.mm9
   BSgenome.Rnorvegicus.UCSC.rn4
   BSgenome.Scerevisiae.UCSC.sacCer2
}
#deptype all

# R versions available in portage:
#  2.10.1, 2.14.1, 2.14.2, 2.15.0, 2.15.1

#deptype all

# using fuzzy dep matches
~dev-lang/R :: ^R$

dev-lang/R[tk] {
	tcl/tk
	tcltk
}

# modreg is in stats, according to https://stat.ethz.ch/pipermail/bioconductor/2010-June/034197.html
! :: modreg

# R is always compiled with '--enabled-R-shlib'
! {
        --enable-R-shlib
        xls.getshlib
	R built as a shared
	R-0.64 or later
}

# base packages that always assumed to be provided by dev-lang/R (taken from generate_ebuild)
! {
	^base$
	^compiler$
	^datasets$
	^graphics$
	^grDevices$
	^grid$
	^methods$
	^parallel$
	^splines$
	^stats4?
        ^tools$
        ^utils$
}

# FIXME, seems to be provided too
% {
	^stepfun$
	^ts$
	package.*ts
}
#deptype all

# ignored text
! {
	does not support
	all other functions are stand alone
        documentation
        README
        INSTALL
        so for instance
        optional
        suggested
        See the
	see topic SoPhy below
	some Windows variants are supported experimentally
	your mileage may vary
	Windows
	Solaris
	distributions package
	distributions often package
	probably
	which is included with standard Mac and Windowsinstallations of Csound. Some Linux distributions package thelibrary file separately from the executible
	binary Linux distributions often package the library separatelyfrom the executible file
	For the MERLIN wrapper
        Debian
        Ubuntu
	Mac
        OSX
	OS X
	Linux/64bit
	sources are included for other OSes.
	see readme.txt
	so for instance
        you would need the
	which requires the free
	drivers
	License
	its development files
	^library
	Google Chrome
	for externalization
	writing some graphicformats
	available at
	it is used in the demos too
	headers
	OpenCSW
	Linux
	precision AMD or Nvidia GPU
	^and$
	in addition
}

# ignore "Windows" in dependency fields:
# (a) there's OS_Type for OS restrictions
# (b) it's a filler word sometimes ("xyz on Solaris, Linux and Windows")
# (c) windows-only packages usually have more specific windows-only deps
#
# That said, add windows-only packages to a "do-not-process" package rule
#
! :: Windows

# how to dependend on ARCHes? -- ignoring it
! :: Little Endian

! :: None

! {
	Will use djmrgl or rgl packages for rendering
	SYMPHONY libraries
}

# SoPhy splits its Depends field into windows and linux
! {
	zlib1.dll and jpeg62.dll
}

# typo, and glibc is always built with pthreads nowadays
! :: lippthread
#deptype all

# ignored text
! {
	does not support
	all other functions are stand alone
        documentation
        README
        INSTALL
        so for instance
        optional
        suggested
        See the
	see topic SoPhy below
	some Windows variants are supported experimentally
	your mileage may vary
	Windows
	Solaris
	distributions package
	distributions often package
	probably
	which is included with standard Mac and Windowsinstallations of Csound. Some Linux distributions package thelibrary file separately from the executible
	binary Linux distributions often package the library separatelyfrom the executible file
	onlyfor full source build
	For the MERLIN wrapper
        Debian
        Ubuntu
	Mac
        OSX
	OS X
	little-endian platform
	sources are included for other OSes.
	see readme.txt
	so for instance
        you would need the
	which requires the free
	drivers
	License
	its development files
	^library
	Google Chrome
	for externalization
	writing some graphicformats
	available at
	it is used in the demos too
	headers
	OpenCSW
	Linux
	precision AMD or Nvidia GPU
	^and$
	in addition
}

# ignore "Windows" in dependency fields:
# (a) there's OS_Type for OS restrictions
# (b) it's a filler word sometimes ("xyz on Solaris, Linux and Windows")
# (c) windows-only packages usually have more specific windows-only deps
#
# That said, add windows-only packages to a "do-not-process" package rule
#
! :: Windows

# how to dependend on ARCHes? -- ignoring it
! :: Little Endian

! :: None

! {
	Will use djmrgl or rgl packages for rendering
	SYMPHONY libraries
}

# SoPhy splits its Depends field into windows and linux
! {
	zlib1.dll and jpeg62.dll
}

# typo, and glibc is always built with pthreads nowadays
! :: lippthread
#deptype sys

~x11-libs/cairo :: cairo

~x11-libs/gtk+ :: gtk\+

~x11-libs/pango :: pango

# qt has its own category now
dev-qt/qtcore {
	^qt$
	^Qt4.*libraries
}

x11-misc/xclip {
	xclip
}

gui-apps/wl-clipboard {
        wl-clipboard
}

virtual/opencl {
	OpenCl
}

~virtual/glu :: GLU Library
virtual/opengl :: opengl
#deptype sys

~dev-libs/atk :: ^ATK$

~dev-libs/openssl :: OpenSSL

~dev-libs/boost :: boost

~dev-libs/glib :: glib

~dev-libs/gmp {
	libgmp
	^gmp
        gmplib
}

~dev-libs/libffi :: libffi

~dev-libs/libpcre {
	pcre
}

~dev-libs/libxml2 {
	^xml
	^libxml
}

~dev-libs/libxslt :: libxslt

dev-libs/mpc {
        ^mpc$
        multi.*precision
}

~dev-libs/mpfr :: mpfr

# FIXME versions -> fuzzy
dev-libs/quantlib :: QuantLib

~dev-libs/quantlib {
	QuantLib library
}

~dev-libs/xerces-c :: xerces-c

~sys-devel/clang {
	clang
}

dev-libs/geoip :: GeoIP

dev-libs/icu :: ICU4C
#deptype sys

# FIXME: which library is meant?
! {
	^C.*library
	^library
}
#deptype sys

~media-libs/flac :: flac

# FIXME: some packages write optional deps into SystemRequirements (e.g. rgl from CRAN)
~media-libs/freetype :: freetype
media-libs/freetype:2 :: recommended: freetype2

media-libs/gd :: libgd

media-libs/libpng :: libpng

~media-libs/libpng {
	png$
	libpng
}

~media-libs/libsndfile :: libsndfile

~media-libs/netpbm :: netpbm

media-libs/raptor :: libraptor

media-libs/tiff :: libtiff

~media-libs/tiff {
	tiff
	libtiff
	libtiff-devel
}

virtual/jpeg :: jpeg
dev-vcs/git :: ^git$

>=app-emulation/wine-1.5.26 {
   wine.*1.5.26
}


# spGoogle 0.1.2 from CRAN wants "Google Chrome" or "Firefox"
#  TODO: check whether this dep can be dropped/ignored or other browsers
#        would suffice, too
#
|| ( www-client/google-chrome www-client/firefox www-client/firefox-bin ) {
   Linux users orFirefox just for Linux users.
}
#deptype sys

net-misc/curl :: curl
~net-misc/curl {
	curl
	libcurl
	the libcurl library
}

# FIXME
net-libs/czmq :: libzmq

net-libs/zeromq :: ZeroMQ

net-misc/s3cmd :: s3cmd

virtual/ssh {
	^ssh
        ssh$
}
#deptype sys

( media-libs/fontconfig media-fonts/corefonts ) {
	fontconfig and msttcorefonts
}

( net-libs/liboauth net-misc/curl ) {
	liboauth.*curl
}

# FIXME
( sci-libs/blas-atlas dev-util/nvidia-cuda-toolkit ) {
	Atlas.*Nvidia GPU.*CUDA
}

|| ( dev-libs/libxml2 dev-libs/expat ) {
	libxml.*expat
}

( media-libs/tiff >=sci-libs/fftw-3  ) {
	libtiff.*fftw3
}

( sci-libs/gdal sci-libs/proj ) {
	GDAL.*PROJ.4
}

( dev-libs/mpfr dev-libs/gmp ) {
	mpfr.*GMP
}

|| ( media-gfx/imagemagick media-gfx/graphicsmagick ) {
	ImageMagick.*GraphicsMagick
}

|| ( media-gfx/imagemagick media-gfx/graphicsmagick app-office/lyx ) {
	ImageMagick.*GraphicsMagick.*LyX
}

|| ( media-libs/tiff virtual/jpeg ) {
	libtiff.*libjpeg
}

( virtual/blas virtual/lapack ) {
	BLAS.*LAPACK
}
#deptype sys

~dev-libs/atk :: ^ATK$

~dev-libs/openssl :: OpenSSL

~dev-libs/boost :: boost

~dev-libs/fribidi :: fribidi

~dev-libs/glib :: glib

~dev-libs/gmp {
	libgmp
	^gmp
        gmplib
}

~dev-libs/libffi :: libffi

~dev-libs/libpcre {
	pcre
}

~dev-libs/libxml2 {
	^xml
	^libxml
}

~dev-libs/libxslt :: libxslt

dev-libs/mpc {
        ^mpc$
        multi.*precision
}

~dev-libs/mpfr :: mpfr

# FIXME versions -> fuzzy
dev-libs/quantlib :: QuantLib

~dev-libs/quantlib {
	QuantLib library
}

~dev-libs/xerces-c :: xerces-c

~sys-devel/clang {
	clang
}

dev-libs/geoip :: GeoIP

dev-libs/icu :: ICU4C
#deptype sys

app-text/antiword :: Antiword

~app-text/ghostscript-gpl :: ghostscript

app-text/poppler {
	poppler
	pdfinfo
	pdftotext
}

# pdflatex?
app-text/texlive :: LaTeX

~app-text/pandoc :: pandoc
#deptype sys

# lowest cuda version in portage is 4.2.9
dev-util/nvidia-cuda-toolkit {
	NVIDIA.*CUDA.*Toolkit
}

>=dev-util/nvidia-cuda-toolkit-5.0 {
	Nvidia's CUDA toolkit.*5.0
}

# FIXME cuda-toolkit or sdk?
dev-util/nvidia-cuda-toolkit {
	nvcc
}

>=dev-util/nvidia-cuda-toolkit-4.1 {
	Nvidia's CUDA toolkit.*4.1
}

>=dev-util/nvidia-cuda-toolkit-4.5 {
	Nvidia's CUDA toolkit.*4.5
}

~dev-util/nvidia-cuda-toolkit {
	CUDA SDK
}

>=x11-drivers/nvidia-drivers-270 {
	Nvidia CUDA driver.*270
}
virtual/boot :: boot
virtual/class :: class
virtual/cluster :: cluster
virtual/codetools :: codetools
virtual/foreign :: foreign
virtual/KernSmooth :: KernSmooth
virtual/lattice :: lattice
virtual/MASS :: MASS
virtual/Matrix :: Matrix
virtual/mgcv :: mgcv
virtual/nlme :: nlme
virtual/nnet :: nnet
virtual/rpart :: rpart
virtual/spatial :: spatial
virtual/survival :: survival
virtual/pkgconfig :: pkgconfig
#deptype sys

# @system
! {
	bash
	^awk$
	gmake
	GNU make
	g\+\+ GNU compiler
	chmod
        ^gcc
        ^g\+\+
        ^C\+\+1[147]
        C\+\+1[147].*compiler
}

# always provided? (except for Gentoo/*BSD)
! {
	Linux.*operating.*system
}
# always provided
! {
	^POSIX
	Unix
}

# rpcgen is part of glibc
! :: rpcgen
#deptype sys

~sci-libs/armadillo :: armadillo

~sci-libs/cddlib :: cddlib

# lowest fftw-3 version in portage is 3.2.2
# Use slot when the resolver can deal with them properly
>=sci-libs/fftw-3 {
	fftw3
}
~sci-libs/fftw :: fftw
# Use slot when the resolver can deal with them properly
~sci-libs/fftw :: fftw3

sci-libs/gdal {
	GDAL library

}
~sci-libs/gdal {
	gdal
	for building from source: GDAL
}

~sci-libs/geos {
	geos
	for building from source: GEOS
}

sci-libs/gsl {
	^gsl
}
~sci-libs/gsl {
	GNU GSL
	^gsl
	libgsl
	GNU Scientific Library
}

~sci-libs/hdf5 :: hdf5
sci-libs/hdf5[cxx] {
	libhdf5.*C\+\+
}
# remnant of hdf5
! :: v18 API enabled

~sci-libs/itpp {
	itpp$
}

# FIXME: dev-lang/R[lapack]?
virtual/lapack {
	LAPACK
}

sci-libs/lapack-atlas :: lapack_atlas

#FIXME
sci-libs/libsvm :: SVMlight

~sci-libs/mkl :: Intel MKL

~sci-libs/netcdf :: netcdf

sci-libs/proj :: ^proj

# FIXME, portage version is 2.1.21
sci-libs/udunits :: udunits

virtual/blas :: blas

# In the science overlay
~sci-libs/coinor-clp :: COIN-OR Clp
#deptype sys

~x11-libs/cairo :: cairo

~x11-libs/gtk+ :: gtk\+

~x11-libs/pango :: pango

# qt has its own category now
dev-qt/qtcore {
	^qt$
	^Qt4.*libraries
}

x11-misc/xclip {
	xclip
}

virtual/opencl {
	OpenCl
}

~virtual/glu :: GLU Library
virtual/opengl :: opengl
#deptype sys

# lowest perl version in portage: 5.8 (masked) -> 5.12
~dev-lang/perl :: perl

dev-perl/OLE-StorageLite :: OLE::Storage_Lite
dev-perl/Parse-RecDescent :: Parse::RecDescent
dev-perl/Spreadsheet-WriteExcel :: Spreadsheet::WriteExcel
dev-perl/Text-CSV_XS :: Text::CSV_XS

# FIXME: this is very specific, required by WriteXLS from CRAN
virtual/perl-Encode :: Encode
#deptype sys

~media-sound/csound :: csound
media-sound/csound {
	open source software synthesizerCsound
	Windowsinstallations of Csound. Some Linux distributions package thelibrary file separately from the executible
}

~media-gfx/imagemagick {
	imagemagick
}

#deptype all
media-gfx/imagemagick {
	Image Magick
}
#deptype sys

media-gfx/graphviz :: dot from graphviz
~media-gfx/graphviz {
	graphviz
	graphviz version
}

media-gfx/swftools {
	SWF.*Tools
}

virtual/ffmpeg {
	ffmpeg
}

media-gfx/dcraw :: dcraw

media-libs/fontconfig :: fontconfig

media-fonts/corefonts :: msttcorefonts
#deptype sys

# == geo ==
~sci-geosciences/gmt {
	gmt$
}
~sci-geosciences/grass :: grass

# == math ==

~sci-mathematics/glpk {
	glpk
}

~sci-mathematics/jags :: jags

# lowest octave version in portage is 3.4
sci-mathematics/octave {
	Octave
}

# lowest version in portage is 2.3.4-r1
sci-mathematics/pari {
	pari/gp
}

sci-mathematics/singular {
	Singular
}

~sci-mathematics/yacas :: yacas
sci-mathematics/yacas {
	yacas
}

sci-mathematics/octave {
	Octave
}

sci-libs/netcdf {
	NetCDF4
}

# there's also sci-biology/clustalw-mpi
#
sci-biology/clustalw {
	clustalw
}

sci-biology/ncbi-tools++ {
	ncbi-blast\+
	ncbi-tools\+\+
}

sci-biology/kalign {
	kalign
}

sci-mathematics/glpk {
	libglpk-dev
}

#deptype all

# some packages have glpk in "pkg" deps
# FIXME: does glpk in that context refer to an R package?
~sci-mathematics/glpk {
	glpk
}

#deptype pkg
sci-mathematics/rstudio {
	manipulate
}

#deptype sys

# == misc ==

# FIXME: correct?
~sci-misc/netlogo-bin :: NetLogo

# == physics ==

# lowest sci-physics/root version in portage is 5.32.03
sci-physics/root {
	root_v5.32.01
}

# == visualization ==

~sci-visualization/ggobi :: ggobi

sci-biology/merlin :: MERLIN

sci-visualization/gnuplot {
	gnuplot
}
#deptype sys

# @system
! {
	bash
	^awk$
	gmake
	GNU make
	g\+\+ GNU compiler
	chmod
        ^gcc
        ^g\+\+
        ^C\+\+1[14]
        C\+\+11.*compiler
}

# always provided? (except for Gentoo/*BSD)
! {
	Linux.*operating.*system
}
# always provided
! {
	^POSIX
	Unix
}

# rpcgen is part of glibc
! :: rpcgen
#deptype sys

app-admin/ec2-api-tools :: ec2-api-tools

# FIXME zip or unzip?
app-arch/zip :: ^zip$

# FIXME: this is not satisfiable, latest dieharder version in portage is 2.28.1
app-crypt/dieharder :: DieHarder#deptype sys

~gnome-base/libglade :: libglade

gnome-base/libgnome :: GNOME development libraries
#deptype sys

dev-cpp/gtkmm :: gtkmm-2.4

dev-cpp/tbb :: TBB

~dev-db/mongodb :: mongodb

# FIXME: dev-db/postgresql-server ?
~dev-db/postgresql-base {
	PostgreSql
}

# FIXME
dev-db/unixODBC :: ODBC

dev-java/ant :: ^ant$
dev-java/jdbc-postgresql :: PostgreSQL JDBCdriver

# else fall back to fuzzy
~dev-lang/python {
   ^python
}
# lowest python version in portage: 2.7 (2.6 masked)
dev-lang/python {
   ^Python
}

dev-lang/lua :: lua version>= 5.1.4
~dev-lang/lua :: lua

dev-python/pandas :: pandas

~dev-tex/pgf :: ^pgf$

>=dev-tex/pgf-2.10 :: pgf.*>=2.10

~dev-tcltk/bwidget :: bwidget

~dev-tcltk/tktable :: tktable

dev-util/cmake :: cmake

~dev-python/numpy :: numpy

# slot-relative rules take precedence
#  TODO: slot-restricted rules should get a lower priority
#        than "catch-all" slot rules
~virtual/jdk {
	java
	Java 1.4 or later
	Java 1.5 or higher
	Java version
	java runtime
}

~dev-db/mariadb-connector-c {
	mariadb
	mysql
}
#deptype sys

~sys-libs/db {
	BerkelyDB
	Berkeley.*DB
}

~sys-libs/zlib :: zlib

sys-apps/findutils :: grep

sys-apps/coreutils :: whoami

# => sys-cluster/
virtual/mpi {
	LamMPI
	Open.*MPI
        MPICH2
	MPI2
	MPICH2
	MPI.*library
}

! {
	rgl packages for rendering
}

# Some packages list Rcpp in system dependencies
@selfdep
~sci-R/Rcpp :: Rcpp

# Split across multiple lines, next line adds Linux and Mac
>=sys-cluster/openmpi-1.5.4 :: OpenMPI

@selfdep
sci-R/rJava :: ^JRI$

~dev-tcltk/tktable :: Tktable

~app-text/aspell :: aspell

dev-libs/openssl :: OpenSSL

~app-crypt/dieharder :: DieHarder
#deptype sys

~media-libs/flac :: flac

# FIXME: some packages write optional deps into SystemRequirements (e.g. rgl from CRAN)
~media-libs/freetype :: freetype
media-libs/freetype:2 :: recommended: freetype2

media-libs/gd :: libgd

~media-libs/harfbuzz :: harfbuzz

media-libs/libpng :: libpng

~media-libs/libpng {
	png$
	libpng
}

~media-libs/libsndfile :: libsndfile

~media-libs/netpbm :: netpbm

media-libs/raptor :: libraptor

media-libs/tiff :: libtiff

~media-libs/tiff {
	tiff
	libtiff
	libtiff-devel
}

virtual/jpeg :: jpeg