# $Id: Portfile,v 1.4 2005/08/11 21:33:40 rshaw Exp $
PortSystem		1.0

name			sword
version			1.5.7a
revision		1
categories		textproc
maintainers		darwinports@opendarwin.org
description		cross-platform API/library for Bible software
long_description	The SWORD Project is an open source, cross-platform \
					(Linux, Windows, Solaris, etc.) API/library for \
					Bible software with a constantly growing list of \
					front-ends (GUI, textmode, web-based, etc.) and a \
					library of over 200 text modules.
homepage		http://www.crosswire.org/${name}/index.jsp
master_sites	http://www.crosswire.org/ftpmirror/pub/${name}/source/v1.5/
checksums		md5 e77801ac7abb7a940eb8a75d725e346f
platforms		darwin

depends_build	bin:autoconf:autoconf \
				bin:automake:automake \
				bin:glibtoolize:libtool \
				bin:pkg-config:pkgconfig
depends_lib		lib:libcurl.2:curl \
				lib:libssl.0.9:openssl \
				lib:libz.1:zlib

platform darwin {
	depends_build-delete	bin:autoconf:autoconf \
							bin:automake:automake \
							bin:glibtoolize:libtool
}

worksrcdir		${name}-[strsed ${version} {s/a$//}]

patchfiles		patch-autogen.sh \
				patch-configure.ac \
				patch-untgz.c

pre-configure {
	if {[variant_isset darwin]} {
		system "cd ${worksrcpath} && AUTODIR=/usr/bin/ ./autogen.sh"
	} else {
		system "cd ${worksrcpath} && ./autogen.sh"
	}
}
configure.args	--with-zlib --with-conf --with-curl \
				--without-icu --without-lucene

post-destroot {
	cd ${worksrcpath}/samples/mods.d
	xinstall -d -m 0755 ${destroot}${prefix}/share/${name}/mods.d
	xinstall -m 0644 globals.conf ${destroot}${prefix}/share/${name}/mods.d

	xinstall -d -m 0755 ${destroot}${prefix}/share/${name}/modules
	system "touch ${destroot}${prefix}/share/${name}/modules/.turd"

	cd ${worksrcpath}
	xinstall -d -m 0755 ${destroot}${prefix}/share/doc/${name}
	xinstall -m 0644 README ${destroot}${prefix}/share/doc/${name}
	xinstall -m 0644 INSTALL ${destroot}${prefix}/share/doc/${name}
	xinstall -m 0644 LICENSE ${destroot}${prefix}/share/doc/${name}
	foreach dir [exec find samples -type d] {
		xinstall -d -m 0755 ${destroot}${prefix}/share/doc/${name}/${dir}
	}
	foreach file [exec find samples -type f] {
		xinstall -m 0644 ${file} ${destroot}${prefix}/share/doc/${name}/${file}
	}
}

