# $Id: Portfile 58993 2009-10-08 11:13:24Z jmr@macports.org $

PortSystem          1.0
PortGroup           ruby 1.0

ruby.setup          plruby 0.5.3 extconf.rb {README.en docs/plruby.rb ex_trans.sql example.run plruby.html} rubyforge:56891
categories-append   databases

maintainers         nomaintainer
platforms           darwin
description         PL/Ruby for PostgreSQL
long_description    The procedural language PL/Ruby allows you to write stored procedures for PostgreSQL in Ruby

homepage            http://moulon.inra.fr/ruby/plruby.html

checksums           md5     9411bb29e1aa5521c5327e4d916de934 \
                    sha1    5c89ea18dcc07c285faae44a1bc0212ec2692e9a \
                    rmd160  51897c169ba783375730983a292a01cdecf8ee35

depends_lib-append  port:postgresql83

configure.args-append extconf.rb  --with-pgsql-include=${prefix}/include/postgresql83/ \
                                  --with-pgsql-lib=${prefix}/lib/postgresql83/

variant safe_level0 {
  configure.args-append --with-safe-level=0
}

post-activate {
  ui_msg "To install pl/ruby in your database, issue the following commands:
-----------------------------------------------------------------\n"
  ui_msg "  create function plruby_call_handler() returns language_handler"
  ui_msg "    as '${ruby.archlib}/plruby.bundle' language 'C';"
  ui_msg "  create trusted language 'plruby' handler plruby_call_handler lancompiler 'PL/Ruby';"
  ui_msg "\n-----------------------------------------------------------------"
}
