AC_CHECK_PROG(SWIG,swig,swig)
AM_CONDITIONAL(WITH_SWIG, [test "x$SWIG" != "x"])
+dnl -----------------------------------
+dnl INCLUDES and LIBS for JAVA
+
+AC_CHECK_PROG(JAVA,java,java)
+AM_CONDITIONAL(WITH_JAVA, [test "x$JAVA" != "x"])
+if test "x$JAVA" = "x"; then
+ HAVE_JAVA=0
+else
+ HAVE_JAVA=1
+ JAVA_INCLUDES=
+ JAVA_LIBS=
+fi
+AC_SUBST(HAVE_JAVA)
+AC_SUBST(JAVA_INCLUDES)
+AC_SUBST(JAVA_LIBS)
+
dnl -----------------------------------
dnl INCLUDES and LIBS for PERL
BuildRequires: /bin/ksh tcl >= 0:8.3 tk expat expat-devel libjpeg
Buildrequires: libjpeg-devel libpng libpng-devel zlib zlib-devel
+Buildrequires: java java-devel perl python python-devel ruby ruby-devel
%{?fc4:BuildRequires: freetype >= 2 freetype-devel fontconfig fontconfig-devel tcl-devel tk-devel xorg-x11-devel}
%{?fc3:BuildRequires: freetype >= 2 freetype-devel fontconfig fontconfig-devel tcl-devel tk-devel xorg-x11-devel}
%{?fc2:BuildRequires: freetype >= 2 freetype-devel fontconfig fontconfig-devel tcl-devel tk-devel XFree86-devel}
A collection of tools and tcl packages for the manipulation and layout
of graphs (as in nodes and edges, not as in barcharts).
+%package devel
+Group: Development/Libraries
+Summary: Development tools for using the %{name} libraries.
+Requires: %{name} = %{version}-%{release} %{name}-tcl = %{version}-%{release}
+# The following doesn't work on RH9 or RHE where there is no tcl-devel
+#Requires: tcl-devel tk-devel
+
+%description devel
+The %{name}-devel package contains the header files
+and man3 pages necessary for developing programs
+using version %{version} of the %{name} libraries.
+
+%package doc
+Group: Documentation
+Summary: PDF and HTML documents for %{name}
+
+%description doc
+The %{name}-doc package provides some additional PDF and HTML documentation for %{name}.
+
%package graphs
Group: Applications/Multimedia
Summary: Demo graphs for %{name}
%description graphs
This package provides some example graphs for %{name}.
-%package tcl
+%package java
Group: Applications/Multimedia
-Summary: Tcl extension tools for %{name}
-Requires: %{name} = %{version}-%{release} tcl >= 0:8.3 tk
+Summary: Java extension tools for %{name}
+Requires: %{name} = %{version}-%{release} java
-%description tcl
-The %{name}-tcl package contains various tcl packages (extensions)
+%description java
+The %{name}-java package contains a java module (extension)
for version %{version} of the %{name} tools.
%package perl
The %{name}-ruby package contains a ruby module (extension)
for version %{version} of the %{name} tools.
-%package devel
-Group: Development/Libraries
-Summary: Development tools for using the %{name} libraries.
-Requires: %{name} = %{version}-%{release} %{name}-tcl = %{version}-%{release}
-# The following doesn't work on RH9 or RHE where there is no tcl-devel
-#Requires: tcl-devel tk-devel
-
-%description devel
-The %{name}-devel package contains the header files
-and man3 pages necessary for developing programs
-using version %{version} of the %{name} libraries.
-
-%package doc
-Group: Documentation
-Summary: PDF and HTML documents for %{name}
+%package tcl
+Group: Applications/Multimedia
+Summary: Tcl extension tools for %{name}
+Requires: %{name} = %{version}-%{release} tcl >= 0:8.3 tk
-%description doc
-The %{name}-doc package provides some additional PDF and HTML documentation for %{name}.
+%description tcl
+The %{name}-tcl package contains various tcl packages (extensions)
+for version %{version} of the %{name} tools.
%prep
%setup -q
%{_mandir}/man1/*.1*
%dir %{_datadir}/%{name}
%{_datadir}/%{name}/lefty
+%exclude %{_libdir}/%{name}/lib*_java.so.*
+%exclude %{_libdir}/%{name}/lib*_perl.so.*
+%exclude %{_libdir}/%{name}/lib*_python.so.*
+%exclude %{_libdir}/%{name}/lib*_ruby.so.*
%exclude %{_libdir}/%{name}/lib*tcl*.so.*
%exclude %{_libdir}/%{name}/libtk*.so.*
-%exclude %{_libdir}/%{name}/lib*perl.so.*
-%exclude %{_libdir}/%{name}/lib*python.so.*
-%exclude %{_libdir}/%{name}/lib*ruby.so.*
%exclude %{_bindir}/dotneato-config
%exclude %{_mandir}/man1/dotneato-config.1*
-%files tcl
-%defattr(-,root,root,-)
-%{_libdir}/%{name}/lib*tcl*.so.*.*.*
-%{_libdir}/%{name}/libtk*.so.*.*.*
-%{_libdir}/%{name}/pkgIndex.tcl
-%{_datadir}/%{name}/demo
-%{_mandir}/mann/*
-
-%files perl
-%defattr(-,root,root,-)
-%{_libdir}/%{name}/lib*perl*.so.*.*.*
-%{_libdir}/%{name}/gv.pm
-
-%files python
-%defattr(-,root,root,-)
-%{_libdir}/%{name}/lib*python*.so.*.*.*
-%{_libdir}/%{name}/gv.py
-
-%files ruby
-%defattr(-,root,root,-)
-%{_libdir}/%{name}/lib*ruby*.so.*.*.*
-
%files devel
%defattr(-,root,root,-)
%{_bindir}/dotneato-config
%{_mandir}/man3/*.3*
%exclude %{_libdir}/%{name}/lib*tcl*.*
%exclude %{_libdir}/%{name}/libtk*.*
-%exclude %{_libdir}/%{name}/lib_perl*.*
-%exclude %{_libdir}/%{name}/lib_python*.*
-%exclude %{_libdir}/%{name}/lib_ruby*.*
+%exclude %{_libdir}/%{name}/lib*_perl*.*
+%exclude %{_libdir}/%{name}/lib*_python*.*
+%exclude %{_libdir}/%{name}/lib*_ruby*.*
+
+%files doc
+%defattr(-,root,root,-)
+%doc __doc/*
%files graphs
%defattr(-,root,root,-)
%dir %{_datadir}/%{name}
%{_datadir}/%{name}/graphs
-%files doc
+%files java
%defattr(-,root,root,-)
-%doc __doc/*
+%{_libdir}/%{name}/lib*_java*.so.*.*.*
+%{_libdir}/%{name}/*.java
+
+%files perl
+%defattr(-,root,root,-)
+%{_libdir}/%{name}/lib*_perl*.so.*.*.*
+%{_libdir}/%{name}/gv.pm
+
+%files python
+%defattr(-,root,root,-)
+%{_libdir}/%{name}/lib*_python*.so.*.*.*
+%{_libdir}/%{name}/gv.py
+
+%files ruby
+%defattr(-,root,root,-)
+%{_libdir}/%{name}/lib*_ruby*.so.*.*.*
+
+%files tcl
+%defattr(-,root,root,-)
+%{_libdir}/%{name}/lib*tcl*.so.*.*.*
+%{_libdir}/%{name}/libtk*.so.*.*.*
+%{_libdir}/%{name}/pkgIndex.tcl
+%{_datadir}/%{name}/demo
+%{_mandir}/mann/*
--- /dev/null
+*.la
+*.lo
+.deps
+.libs
+Makefile
+Makefile.in
+pkgIndex.tcl
+*.pdf
+gv_*.cpp
pkglib_LTLIBRARIES =
pkglib_DATA =
if WITH_SWIG
+if WITH_JAVA
+pkglib_LTLIBRARIES += libgv_java.la
+pkglib_DATA += \
+ java/SWIGTYPE_p_Agraph_t.java \
+ java/SWIGTYPE_p_Agnode_t.java \
+ java/SWIGTYPE_p_Agedge_t.java \
+ java/gv.java java/gvJNI.java
+endif
if WITH_PERL
pkglib_LTLIBRARIES += libgv_perl.la
-pkglib_DATA += gv.pm
+pkglib_DATA += perl/gv.pm
endif
if WITH_PYTHON
pkglib_LTLIBRARIES += libgv_python.la
-pkglib_DATA += gv.py
+pkglib_DATA += python/gv.py
endif
if WITH_RUBY
pkglib_LTLIBRARIES += libgv_ruby.la
endif
endif
+libgv_java_la_SOURCES = gv.cpp gv_java.cpp plugins.c
+libgv_java_la_LIBADD = $(BASELIBS) @JAVA_LIBS@
+
libgv_perl_la_SOURCES = gv.cpp gv_perl.cpp plugins.c
libgv_perl_la_LIBADD = $(BASELIBS) @PERL_LIBS@
libgv_tcl_la_SOURCES = gv.cpp gv_tcl.cpp plugins.c
libgv_tcl_la_LIBADD = $(BASELIBS) @TCL_LIBS@
-gv_perl.cpp gv.pm: gv.i
- $(SWIG) -c++ -perl -o gv_perl.cpp gv.i
+java/SWIGTYPE_p_Agraph_t.java \
+java/SWIGTYPE_p_Agnode_t.java \
+java/SWIGTYPE_p_Agedge_t.java \
+java/gv.java java/gvJNI.java \
+gv_java.cpp: gv.i
+ $(SWIG) -c++ -java -outdir java -o gv_java.cpp gv.i
+
+perl/gv.pm \
+gv_perl.cpp: gv.i
+ $(SWIG) -c++ -perl -outdir perl -o gv_perl.cpp gv.i
-gv_python.cpp gv.py: gv.i
- $(SWIG) -c++ -python -o gv_python.cpp gv.i
+python/gv.py \
+gv_python.cpp: gv.i
+ $(SWIG) -c++ -python -outdir python -o gv_python.cpp gv.i
gv_ruby.cpp: gv.i
- $(SWIG) -c++ -ruby -o gv_ruby.cpp gv.i
+ $(SWIG) -c++ -ruby -outdir ruby -o gv_ruby.cpp gv.i
gv_tcl.cpp: gv.i
- $(SWIG) -c++ -tcl -namespace -o gv_tcl.cpp gv.i
+ $(SWIG) -c++ -tcl -namespace -outdir tcl -o gv_tcl.cpp gv.i
-test: test_perl test_python test_ruby test_tcl
+test: test_java test_perl test_python test_ruby test_tcl
+
+test_java:
+ (cd java; \
+ ln -fs ../.libs/libgv_java.so libgv.so; \
+ javac *.java; \
+ LD_LIBRARY_PATH=. java test)
test_perl:
- mkdir -p perl
(cd perl; \
ln -fs ../.libs/libgv_perl.so gv.so; \
- ln -fs ../gv.pm gv.pm; \
- ln -fs ../hello.dot hello.dot; \
- ln -fs ../test.pl test.pl; \
./test.pl)
test_python:
- mkdir -p python
(cd python; \
ln -fs ../.libs/libgv_python.so _gv.so; \
- ln -fs ../gv.py gv.py; \
- ln -fs ../hello.dot hello.dot; \
- ln -fs ../test.py test.py; \
PYTHONPATH=. ./test.py)
test_ruby:
- mkdir -p ruby
(cd ruby; \
ln -fs ../.libs/libgv_ruby.so gv.so; \
- ln -fs ../hello.dot hello.dot; \
- ln -fs ../test.rb test.rb; \
./test.rb)
test_tcl:
- mkdir -p tcl
(cd tcl; \
- ln -fs ../.libs/libgv_tcl.so gv.so; \
- ln -fs ../hello.dot hello.dot; \
- ln -fs ../test.tcl test.tcl; \
+ ln -fs ../.libs/libgv_tcl.so libgv_tcl.so; \
./test.tcl)
-install-exec-hook:
-
-EXTRA_DIST = gv.i
+EXTRA_DIST = gv.i java/test.java perl/test.pl python/test.py ruby/test.rb tcl/test.tcl
-CLEANFILES = gv_perl.cpp gv.pm gv_python.cpp gv.py gv.pyc gv_ruby.cpp gv_tcl.cpp \
- perl/* python/* ruby/* tcl/*
+CLEANFILES = gv_java.cpp gv_perl.cpp gv.pm gv_python.cpp gv.py gv.pyc gv_ruby.cpp gv_tcl.cpp \
+ java/SWIG*.java java/gv*.java java/*.class java/*.so java/*.dot java/*.png \
+ perl/gv.pm perl/gv.so perl/*.dot perl/*.png \
+ python/gv.py python/gv.pyc python/_gv.so python/*.dot python/*.png \
+ ruby/gv.so ruby/*.dot ruby/*.png \
+ tcl/libgv_tcl.so tcl/*.dot tcl/*.png
DISTCLEANFILES =
BUILDDATE
};
-void gvinit()
+static void gvinit()
{
aginit();
agnodeattr(NULL, "label", NODENAME_ESC);
{
Agraph_t *g;
+ if (!gvc)
+ gvinit();
g = agopen(name, AGDIGRAPH);
GD_drawing(g) = NULL;
return g;
{
Agraph_t *g;
+ if (!gvc)
+ gvinit();
g = agopen(name, AGDIGRAPHSTRICT);
GD_drawing(g) = NULL;
return g;
{
Agraph_t *g;
+ if (!gvc)
+ gvinit();
g = agopen(name, AGRAPH);
GD_drawing(g) = NULL;
return g;
{
Agraph_t *g;
+ if (!gvc)
+ gvinit();
g = agopen(name, AGRAPHSTRICT);
GD_drawing(g) = NULL;
return g;
{
Agraph_t *g;
+ if (!gvc)
+ gvinit();
g = agmemread(string);
GD_drawing(g) = NULL;
return g;
FILE *f;
Agraph_t *g;
+ if (!gvc)
+ gvinit();
f = fopen(filename, "r");
g = agread(f);
fclose(f);
#include "gv.h"
%}
-extern void gvinit();
-
-%init
-%{
- gvinit();
-%}
-
/* new graph objects */
extern Agraph_t *stringgraph(char *string); /* from dot-formatted string */
extern Agraph_t *readgraph(char *filename); /* from dot-formatted file */
+++ /dev/null
-#!/usr/bin/perl
-
-use gv;
-
-$g = gv::digraph "G";
-print $g, "\n";
-print gv::set($g, "aaa", "xxx"), "\n";
-print gv::set($g, "aaa"), "\n";
-$n = gv::node $g, "hello";
-print $n, "\n";
-print gv::set($n,"label"), "\n";
-print gv::set($n, "aaa", "xxx"), "\n";
-print gv::set($n, "aaa"), "\n";
-$m = gv::node $g, "world";
-print $m, "\n";
-print gv::set($m, "aaa"), "\n";
-$e = gv::edge $n, $m;
-print $e, "\n";
-print gv::set($e, "aaa", "xxx"), "\n";
-print gv::set($e, "aaa"), "\n";
-gv::rm $e;
-gv::rm $n;
-gv::rm $m;
-gv::rm $g;
-
-$g = gv::stringgraph "digraph G {a->b}";
-print $g, "\n";
-gv::rm $g;
-
-$g = gv::readgraph "hello.dot";
-print $g, "\n";
-gv::layout($g, "dot");
-gv::writegraph($g, "hello_perl.png", "png");
-gv::rm $g;
+++ /dev/null
-#!/usr/bin/python
-
-import gv
-
-g = gv.digraph("G")
-print g
-print gv.set(g,"aaa","xxx")
-print gv.set(g,"aaa")
-n = gv.node(g,"hello")
-print n
-print gv.set(n,"label")
-print gv.set(n,"aaa","xxx")
-print gv.set(n,"aaa")
-m = gv.node(g,"world")
-print m
-print gv.set(m,"aaa")
-e = gv.edge(n,m)
-print e
-print gv.set(e,"aaa","xxx")
-print gv.set(e,"aaa")
-gv.rm(e)
-gv.rm(m)
-gv.rm(n)
-gv.rm(g)
-
-g = gv.stringgraph("digraph G {a->b}")
-print g
-gv.rm(g)
-
-g = gv.readgraph("hello.dot")
-print g
-gv.layout(g, "dot")
-gv.writegraph(g, "hello_python.png", "png")
-gv.rm(g)
+++ /dev/null
-#!/usr/bin/ruby
-
-require 'gv'
-
-g = Gv.digraph("G")
-print(g, "\n")
-print(Gv::set(g, "aaa", "xxx"), "\n")
-print(Gv::set(g, "aaa"), "\n")
-n = Gv.node(g,"hello")
-print(n, "\n")
-print(Gv::set(n, "label"), "\n")
-print(Gv::set(n, "aaa", "xxx"), "\n")
-print(Gv::set(n, "aaa"), "\n")
-m = Gv.node(g,"world")
-print(m, "\n")
-print(Gv::set(m, "aaa"), "\n")
-e = Gv.edge(n,m)
-print(e, "\n")
-print(Gv::set(e, "aaa", "xxx"), "\n")
-print(Gv::set(e, "aaa"), "\n")
-Gv.rm(e)
-Gv.rm(n)
-Gv.rm(m)
-Gv.rm(g)
-
-g = Gv.stringgraph("digraph G {a->b}")
-print(g, "\n")
-Gv.rm(g)
-
-g = Gv.readgraph("hello.dot")
-print(g, "\n")
-Gv.layout(g, "dot")
-Gv.writegraph(g, "hello_ruby.png", "png")
-Gv.rm(g)
+++ /dev/null
-#!/usr/bin/tclsh
-
-load gv.so
-
-set g [gv::digraph G]
-puts $g
-puts [gv::set $g aaa xxx]
-puts [gv::set $g aaa]
-set sg [gv::graph $g SG]
-puts $sg
-set n [gv::node $g hello]
-puts $n
-puts [gv::set $n label]
-puts [gv::set $n aaa xxx]
-puts [gv::set $n aaa]
-set m [gv::node $g world]
-puts $m
-puts [gv::set $m aaa]
-set e [gv::edge $n $m]
-puts $e
-puts [gv::set $e aaa xxx]
-puts [gv::set $e aaa]
-gv::rm $e
-gv::rm $n
-gv::rm $m
-gv::rm $g
-
-set g [gv::stringgraph "digraph G {a->b}"]
-puts $g
-gv::rm $g
-
-set g [gv::readgraph hello.dot]
-puts $g
-gv::layout $g dot
-gv::writegraph $g hello_tcl.png png
-gv::rm $g