# $Id: Portfile 67505 2010-05-11 11:15:23Z jmr@macports.org $

PortSystem 1.0
PortGroup xcodeversion 1.0

name			gnuplot
version			4.4.0
categories		math science
maintainers		nomaintainer
description		A command-driven interactive function plotting program
long_description	Gnuplot is a command-driven interactive function \
					plotting program. Plots any number of functions, \
					built up of C operators, C library functions, and \
					some things C doesn't have like **, sgn(), etc. \
					Also support for plotting data files, to compare \
					actual data to theoretical curves.
platforms		darwin
homepage		http://gnuplot.sourceforge.net/
master_sites	sourceforge
distfiles-append ${name}-${version}.pdf
extract.only	${distname}.tar.gz
checksums		${distname}.tar.gz \
					md5     e708665bd512153ad5c35252fe499059 \
					sha1    04a2eede7b2af8e64144aa8ffede6535b7a043b5 \
					rmd160  ed15fd44d32b0bf610f52b99e2c36cd160cb08a6 \
				${name}-${version}.pdf \
					md5 f618b64e3679511a385a7ae25b0cdbc7 \
					sha1 6107557d3c8d893e8f0f67cd610fc890efc4fbb2 \
					rmd160 783bf418250dc04ccf41fbdf07dc8202d4c34d00

depends_lib		port:expat \
				port:fontconfig \
				port:gd2 \
				port:jpeg \
				port:pdflib \
				port:libiconv \
				port:libpng \
				port:ncurses \
				port:readline \
				port:xpm \
				port:zlib

platform darwin {
	depends_lib-append		port:aquaterm
	configure.cflags-append	'-DDEFAULTTERM=\\"aqua\\"'
}

minimum_xcodeversions {9 3.1}

configure.args	--with-readline=${prefix} \
                --with-gd=${prefix} \
                --with-pdf=${prefix} \
                --with-png=${prefix} \
                --with-x \
				--enable-datastrings --enable-histograms \
				--infodir='\${prefix}/share/info' \
				--mandir='\${prefix}/share/man' \
				--disable-wxwidgets \
				--without-latex \
				--without-tutorial \
				--without-cairo

configure.ccache	no

variant no_x11 {
	depends_lib-delete		port:xpm
	configure.args-delete	--with-x
	configure.args-append	--without-x
}

variant wxwidgets description "Enable wxWidgets front-end" {
	depends_lib-append		port:wxWidgets
	configure.args-delete	--disable-wxwidgets
	configure.args-append	--with-wx-config=${prefix}/bin/wx-config
}

variant tutorial description "Build the tutorial (requires a tex install)" {
	depends_lib-append		bin:tex:texlive
	configure.args-delete	--without-tutorial --without-latex
	configure.args-append	--with-tutorial
}

destroot.destdir	prefix=${destroot}${prefix}
post-destroot {
	xinstall -d -m 0755 ${destroot}${prefix}/share/doc/${name}
	xinstall -m 0644 ${distpath}/${name}-${version}.pdf \
		${destroot}${prefix}/share/doc/${name}/
}
