# $Id: Portfile,v 1.38 2006/03/01 16:37:34 olegb Exp $
PortSystem		1.0

name			ruby
version			1.8.4
revision		2

categories		lang ruby
maintainers		darwinports@opendarwin.org

description		Powerful and clean object-oriented scripting language
long_description	Ruby is the interpreted scripting language for quick \
					and easy object-oriented programming. It has many \
					features to process text files and to do system \
					management tasks (as in Perl). It is simple, \
					straight-forward, extensible, and portable.
homepage		http://www.ruby-lang.org/
master_sites	ruby:1.8
dist_subdir		ruby
checksums		md5 bd8c2e593e1fa4b01fd98eaf016329bb
platforms		darwin

depends_lib		port:libiconv \
				port:readline \
				port:openssl \
				port:zlib
				
patchfiles		patch-Makefile.in \
				patch-configure.in \
				patch-instruby.rb \
				patch-mkconfig.rb \
				patch-mkmf.rb \
				patch-ruby.c

use_autoconf	yes

configure.args	--enable-shared \
				--mandir="${prefix}/share/man" \
				--enable-pthread
configure.env	CFLAGS="-O -pipe -I${prefix}/include" \
				CPPFLAGS="-O -pipe -I${prefix}/include" \
				LDFLAGS="-L${prefix}/lib"

destroot.target	install install-doc
post-destroot {
	foreach type {site vendor} {
		set libdir ${destroot}${prefix}/lib/ruby/${type}_ruby
		xinstall -m 0755 -d ${libdir}
		
		# special file for installation control of modules
		xinstall -m 0644 ${filespath}/${type}-specific.rb ${libdir}
		
		# prevent empty site/vendor directories from being pruned
		foreach subdir [exec find ${libdir} -type d -empty] {
			destroot.keepdirs-append ${subdir}
		}
	}
}

platform darwin {
	# for proper rdoc/ri creation, make sure to link to destroot libruby.dylib
	destroot.env	DYLD_LIBRARY_PATH=${destroot}${prefix}/lib
}

