# Copyright 1999-2005 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Header: $ inherit eutils DESCRIPTION="The webdot cgi-bin to generate dynamic image maps for graphviz input" HOMEPAGE="http://www.graphviz.org" SRC_URI="http://www.graphviz.org/pub/graphviz/ARCHIVE/${P}.tar.gz" LICENSE="CPL-1.0" KEYWORDS="~x86" SLOT="0" IUSE="" DEPEND="media-gfx/graphviz net-www/apache dev-lang/tcl app-text/ghostscript media-fonts/corefonts" # Assumes: apache # Assumes: cgi-bin location: /var/www/localhost/cgi-bin # Assumes: html location: /var/www/localhost/htdocs (dohtml doesn't do this!) # Assumes: graphviz package installs libtcldot.so in /usr/lib/graphviz/ # Assumes: webdot build cache location will be: /var/cache (see CACHEROOT) CACHEROOT="/var/cache" src_compile() { cd ${S} mkdir .build cat < .build/webdot.start #!`which tclsh` source /etc/conf.d/webdot.cfg EOF cat .build/webdot.start cgi-bin/webdot > .build/webdot && rm .build/webdot.start TTFDIRS=`find /usr/share/fonts -name '*.ttf' | xargs -n1 dirname | sort -u | xargs echo | sed -e's/ /:/g'` cat < .build/webdot.cfg set LIBTCLDOT /usr/lib/graphviz/libtcldot.so set CACHE_ROOT ${CACHEROOT}/webdot set GS `which gs` set PS2EPSI `which ps2epsi` set LOCALHOSTONLY 0 set env(GDFONTPATH) "${TTFDIRS}:$env(GDFONTPATH)" EOF } src_install() { cd ${S} dodoc README cd ${S}/html/webdot insinto /var/www/localhost/htdocs/webdot doins * cd ${S}/cgi-bin exeinto /var/www/localhost/cgi-bin doexe webdot.tclet cd ${S}/.build doexe webdot doconfd webdot.cfg keepdir ${CACHEROOT}/webdot fowners apache:apache ${CACHEROOT}/webdot fperms 0700 ${CACHEROOT}/webdot } pkg_postinst() { # same as above; can't make global or portage will complain... TTFDIRS=`find /usr/share/fonts -name '*.ttf' | xargs -n1 dirname | sort -u | xargs echo | sed -e's/ /:/g'` # sigh... a hackish fix for internal demand for Times font from libtcldot.so (cd /usr/share/fonts/corefonts && ( [ -r Times.ttf ] || ln -s times.ttf Times.ttf )) einfo "Note: webdot will serve requests from any host." einfo "This could allow remote users to significantly consume" einfo "local CPU and disk resources. To change, modify the" einfo "LOCALHOSTONLY setting in /etc/conf.d/webdot.cfg" einfo "" einfo "The /etc/conf.d/webdot.cfg specifies font settings for" einfo "the currently installed set of truetype fonts (.ttf):" einfo "" einfo " ${TTFDIRS}" einfo "" einfo "If more .ttf fonts are installed, update the GDFONTPATH" einfo "setting in /etc/conf.d/webdot.cfg" einfo "" einfo "To try it out:" einfo " $ mkdir ~/public_html/mywebdot" einfo " $ echo 'graph G { a -- b -- c -- d; b -- e -- d -- f }' > ~/public_html/mywebdot/test.dot" einfo " Browse to: http://localhost/cgi-bin/webdot/~USER/mywebdot/test.dot.neato.png" einfo "" einfo "See http://localhost/webdot/index.html for more information" }