--- /dev/null
+--- orpie-1.5.2/Makefile.in
++++ orpie-1.5.2/Makefile.in
+@@ -44,7 +44,7 @@
+ CURSES_LIB = @CURSES_LIB@
+ GSL_LIB = @GSL_LIB@
+
+-INCLUDES = -I ./curses -I ./gsl -I ./units
++INCLUDES = -I ./curses -I /usr/lib/ocaml/gsl -I ./units
+ BFLAGS = -pp camlp4o -g $(INCLUDES) -thread
+ OFLAGS = -pp camlp4o $(INCLUDES) -thread
+ BLFLAGS = -custom -cclib '$(LDFLAGS) $(CURSES_LIB) $(GSL_LIB) -lm'
+@@ -78,17 +78,8 @@
+ CURSES_BOBJS = $(CURSES_CMO) $(CURSES_COBJS)
+ CURSES_OOBJS = $(CURSES_CMX) $(CURSES_COBJS)
+
+-GSL_CMO = gsl/gsl_error.cmo gsl/gsl_blas.cmo gsl/gsl_complex.cmo gsl/gsl_matrix.cmo gsl/gsl_matrix_complex.cmo \
+- gsl/gsl_vector.cmo gsl/gsl_vector_complex.cmo gsl/gsl_vector_flat.cmo gsl/gsl_matrix_flat.cmo \
+- gsl/gsl_vector_complex_flat.cmo gsl/gsl_matrix_complex_flat.cmo gsl/gsl_vectmat.cmo \
+- gsl/gsl_permut.cmo gsl/gsl_linalg.cmo gsl/gsl_fun.cmo
+-GSL_CMX = $(GSL_CMO:.cmo=.cmx)
+-GSL_COBJS = gsl/mlgsl_error.o gsl/mlgsl_blas.o gsl/mlgsl_blas_complex.o gsl/mlgsl_complex.o gsl/mlgsl_blas_float.o \
+- gsl/mlgsl_blas_complex_float.o gsl/mlgsl_matrix_complex.o gsl/mlgsl_matrix_double.o gsl/mlgsl_matrix_float.o \
+- gsl/mlgsl_matrix_complex_float.o gsl/mlgsl_vector_double.o gsl/mlgsl_vector_float.o \
+- gsl/mlgsl_permut.o gsl/mlgsl_linalg.o gsl/mlgsl_linalg_complex.o gsl/mlgsl_fun.o gsl/mlgsl_math.o gsl/mlgsl_sf.o
+-GSL_BOBJS = $(GSL_COBJS) $(GSL_CMO)
+-GSL_OOBJS = $(GSL_COBJS) $(GSL_CMX)
++GSL_BOBJS = /usr/lib/ocaml/gsl/gsl.cma
++GSL_OOBJS = /usr/lib/ocaml/gsl/gsl.cmxa
+
+ UNITS_CMO = units/units.cmo
+ UNITS_CMX = $(UNITS_CMO:.cmo=.cmx)
+@@ -324,7 +305,7 @@
+ config.status: configure
+ ./config.status --recheck
+
+-configure: configure.in
++configure: configure.ac
+ autoconf
+
+ # clean
+--- orpie-1.5.2/curses_keys.ml
++++ orpie-1.5.2/curses_keys.ml
+@@ -19,7 +19,7 @@
+ *)
+
+ open Curses;;
+-
++open Curses_assist;;
+
+ begin
+ let std = initscr () in
--- /dev/null
+# Copyright 1999-2016 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=6
+
+inherit autotools
+
+DESCRIPTION="A fullscreen RPN calculator for the console"
+HOMEPAGE="http://pessimization.com/software/orpie/"
+SRC_URI="http://pessimization.com/software/${PN}/${P}.tar.gz"
+LICENSE="GPL-2"
+
+SLOT="0"
+KEYWORDS="~amd64 ~ppc ~x86 ~amd64-linux ~x86-linux"
+IUSE="doc"
+
+DEPEND="dev-ml/ocamlgsl
+ sys-libs/ncurses:0=
+ || ( <dev-lang/ocaml-4.02 dev-ml/camlp4 )"
+RDEPEND="${DEPEND}"
+
+PATCHES=(
+ "${FILESDIR}/${PN}-1.5.1-ocaml311.patch"
+ "${FILESDIR}/${P}-nogsl.patch"
+ "${FILESDIR}/${PN}-1.5.1-orpierc.patch"
+ "${FILESDIR}/${PN}-1.5.1-tinfo.patch"
+)
+
+src_prepare() {
+ default
+ sed -i -e "s:/usr:${EPREFIX}/usr:g" Makefile.in || die
+ mv configure.{in,ac} || die
+ eautoreconf
+}
+
+src_compile() {
+ # TODO: fix missing edges in dependency graph
+ emake -j1
+}
+
+src_install() {
+ default
+ if use doc; then
+ dodoc doc/manual.pdf
+ docinto html/
+ dodoc doc/manual.html
+ fi
+}