--- Portfile.orig	2008-03-13 04:22:13.000000000 -0700
+++ Portfile	2008-03-13 13:22:45.000000000 -0700
@@ -25,9 +25,39 @@
 
 depends_lib     port:gmp
 
+configure.args	--enable-iodbc=no \
+		--enable-mysql=no
+
 test.run        yes
 test.target     check
 
+variant examples {
+	post-destroot {
+		set examplesdir ${destroot}${prefix}/share/doc/${name}/examples
+		xinstall -m 755 -d ${examplesdir}
+		foreach fl [glob -tails -directory ${worksrcpath}/examples *.{c,mod,lp,mps,dat}] {
+			xinstall -m 644 -W ${worksrcpath}/examples $fl ${examplesdir}
+		}
+		xinstall -m 755 -d ${examplesdir}/sql
+		foreach fl [glob -tails -directory ${worksrcpath}/examples/sql *.{mod,sql}] {
+			xinstall -m 644 -W ${worksrcpath}/examples/sql $fl ${examplesdir}/sql
+		}
+	}
+}
+
+variant doc {
+	depends_build-append path:${prefix}/bin/pdflatex:texlive \
+			     path:${prefix}/bin/texi2pdf:texinfo
+	post-destroot {
+		set docdir ${destroot}${prefix}/share/doc/${name}
+		xinstall -m 755 -d ${docdir}
+		system "cd ${worksrcpath}/doc && ${prefix}/bin/pdflatex glpk.latex && ${prefix}/bin/pdflatex glpk.latex"
+		system "cd ${worksrcpath}/doc && ${prefix}/bin/texi2pdf gmpl.texi"
+		xinstall -m 644 -W ${worksrcpath}/doc glpk.pdf gmpl.pdf ${docdir}
+		xinstall -m 644 -W ${worksrcpath} AUTHORS COPYING ChangeLog INSTALL NEWS README ${docdir}
+	}
+}
+
 livecheck.check regex
 livecheck.url   http://ftp.gnu.org/gnu/${name}/?C=M&O=D
 livecheck.regex ${name}-(\\d+\\.\\d+)

