# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4
# $Id: Portfile 80772 2011-07-17 05:27:23Z jeremyhu@macports.org $

PortSystem 1.0
PortGroup	muniversal 1.0

name		guile
version		1.8.7
revision	2
categories	lang
maintainers	nomaintainer
platforms	darwin

description	GNU's Ubiquitous Intelligent Language for Extension (guile)
long_description	\
		Guile is an interpreter for the Scheme programming	\
		language, packaged for use in a wide variety of		\
		environments. Guile implements Scheme as described in	\
		the Revised^5 Report on the Algorithmic Language Scheme	\
		(usually known as R5RS), providing clean and general	\
		data and control structures.				\
									\
		Guile goes beyond the rather austere language presented	\
		in R5RS, extending it with a module system, full access	\
		to POSIX system calls, networking support, multiple	\
		threads, dynamic linking, a foreign function call	\
		interface, powerful string processing, and many other	\
		features needed for programming in the real world.

#user_notes	You may need to set the environment variable		\
#		DYLD_LIBRARY_PATH to ${prefix}/lib (or wherever		\
#		the guile libraries have been installed) if you want	\
#		to load guile modules from an application linked with	\
#		libguile.  This should only apply to developers using	\
#		guile as an extension language.

distname        guile-${version}
homepage	http://www.gnu.org/software/guile/guile.html
master_sites	ftp://ftp.gnu.org/pub/gnu/guile/

checksums       md5     991b5b3efcbbc3f7507d05bc42f80a5e \
                sha1    24cd2f06439c76d41d982a7384fe8a0fe5313b54 \
                rmd160  3ccd581cff4ad743fc1328597bd8cb241cbd3fd6

patchfiles	patch-srfi-60.c.diff \
		patch-libguile-fports.c.diff

depends_lib	port:readline \
                port:gettext \
                port:libiconv \
                port:libtool \
                port:gmp

# llvm-gcc miscompiles guile
if {${configure.compiler} == "llvm-gcc-4.2"} {
    configure.compiler clang
}

configure.args	CPPFLAGS="-I${prefix}/include"		\
		LDFLAGS="-L${prefix}/lib"		\
		--infodir="${prefix}/share/info"	\
		--mandir="${prefix}/share/man"		\
		--enable-regex                          \
		--disable-error-on-warning

post-patch {
    # This changes configure to do what the author actually intended based on their comments
    reinplace "s|-Werror -Wmissing-braces|-Werror=missing-braces|" ${worksrcpath}/configure
}

if {${os.platform} == "darwin" && ($build_arch == "x86_64" || $build_arch == "ppc64")} {
    configure.args-append --build=${build_arch}-apple-darwin${os.version}
}

#post-destroot	{
#		  file delete ${destroot}${prefix}/share/${name}/1.6/ice-9/and-let\*.scm
#		}

livecheck.type  regex
livecheck.url   "http://ftp.gnu.org/pub/gnu/guile/?C=N;O=D"
livecheck.regex "${name}-(\\d+(?:\\.\\d+)*)${extract.suffix}"
