From 3d25b3e398a8461a971dceefb2a6aef0386d693c Mon Sep 17 00:00:00 2001 From: ellson Date: Sat, 26 Mar 2005 21:40:38 +0000 Subject: [PATCH] adds java support more packaging fixes --- configure.ac | 16 ++++++ graphviz.spec.in | 120 ++++++++++++++++++++++++------------------ tclpkg/gv/.cvsignore | 9 ++++ tclpkg/gv/Makefile.am | 72 +++++++++++++++---------- tclpkg/gv/gv.cpp | 14 ++++- tclpkg/gv/gv.i | 7 --- tclpkg/gv/test.pl | 34 ------------ tclpkg/gv/test.py | 34 ------------ tclpkg/gv/test.rb | 34 ------------ tclpkg/gv/test.tcl | 36 ------------- 10 files changed, 149 insertions(+), 227 deletions(-) create mode 100644 tclpkg/gv/.cvsignore delete mode 100644 tclpkg/gv/test.pl delete mode 100644 tclpkg/gv/test.py delete mode 100644 tclpkg/gv/test.rb delete mode 100644 tclpkg/gv/test.tcl diff --git a/configure.ac b/configure.ac index 655cc2cc6..4a806c493 100644 --- a/configure.ac +++ b/configure.ac @@ -218,6 +218,22 @@ dnl check for SWIG - needed for script-language bindings 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 diff --git a/graphviz.spec.in b/graphviz.spec.in index 86f38b859..8eab7a313 100644 --- a/graphviz.spec.in +++ b/graphviz.spec.in @@ -17,6 +17,7 @@ Vendor: http://www.graphviz.org/ 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} @@ -36,6 +37,25 @@ Prefix: %{_prefix} 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} @@ -43,13 +63,13 @@ 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 @@ -79,24 +99,14 @@ Requires: %{name} = %{version}-%{release} ruby 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 @@ -144,36 +154,15 @@ rm -rf $RPM_BUILD_ROOT %{_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 @@ -185,15 +174,42 @@ rm -rf $RPM_BUILD_ROOT %{_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/* diff --git a/tclpkg/gv/.cvsignore b/tclpkg/gv/.cvsignore new file mode 100644 index 000000000..4439d4493 --- /dev/null +++ b/tclpkg/gv/.cvsignore @@ -0,0 +1,9 @@ +*.la +*.lo +.deps +.libs +Makefile +Makefile.in +pkgIndex.tcl +*.pdf +gv_*.cpp diff --git a/tclpkg/gv/Makefile.am b/tclpkg/gv/Makefile.am index 30accfcf2..0b08653b6 100644 --- a/tclpkg/gv/Makefile.am +++ b/tclpkg/gv/Makefile.am @@ -29,13 +29,21 @@ noinst_HEADERS = gv.h 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 @@ -45,6 +53,9 @@ pkglib_LTLIBRARIES += libgv_tcl.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@ @@ -57,59 +68,62 @@ libgv_ruby_la_LIBADD = $(BASELIBS) @RUBY_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 = diff --git a/tclpkg/gv/gv.cpp b/tclpkg/gv/gv.cpp index 3a269e177..a1ab782d7 100644 --- a/tclpkg/gv/gv.cpp +++ b/tclpkg/gv/gv.cpp @@ -24,7 +24,7 @@ char *Info[] = { BUILDDATE }; -void gvinit() +static void gvinit() { aginit(); agnodeattr(NULL, "label", NODENAME_ESC); @@ -40,6 +40,8 @@ Agraph_t *digraph(char *name) { Agraph_t *g; + if (!gvc) + gvinit(); g = agopen(name, AGDIGRAPH); GD_drawing(g) = NULL; return g; @@ -49,6 +51,8 @@ Agraph_t *digraphstrict(char *name) { Agraph_t *g; + if (!gvc) + gvinit(); g = agopen(name, AGDIGRAPHSTRICT); GD_drawing(g) = NULL; return g; @@ -58,6 +62,8 @@ Agraph_t *graph(char *name) { Agraph_t *g; + if (!gvc) + gvinit(); g = agopen(name, AGRAPH); GD_drawing(g) = NULL; return g; @@ -67,6 +73,8 @@ Agraph_t *graphstrict(char *name) { Agraph_t *g; + if (!gvc) + gvinit(); g = agopen(name, AGRAPHSTRICT); GD_drawing(g) = NULL; return g; @@ -76,6 +84,8 @@ Agraph_t *stringgraph(char *string) { Agraph_t *g; + if (!gvc) + gvinit(); g = agmemread(string); GD_drawing(g) = NULL; return g; @@ -86,6 +96,8 @@ Agraph_t *readgraph(char *filename) FILE *f; Agraph_t *g; + if (!gvc) + gvinit(); f = fopen(filename, "r"); g = agread(f); fclose(f); diff --git a/tclpkg/gv/gv.i b/tclpkg/gv/gv.i index 6e91894b8..ccf7d78e0 100644 --- a/tclpkg/gv/gv.i +++ b/tclpkg/gv/gv.i @@ -19,13 +19,6 @@ #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 */ diff --git a/tclpkg/gv/test.pl b/tclpkg/gv/test.pl deleted file mode 100644 index a6a9f503e..000000000 --- a/tclpkg/gv/test.pl +++ /dev/null @@ -1,34 +0,0 @@ -#!/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; diff --git a/tclpkg/gv/test.py b/tclpkg/gv/test.py deleted file mode 100644 index 716044e95..000000000 --- a/tclpkg/gv/test.py +++ /dev/null @@ -1,34 +0,0 @@ -#!/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) diff --git a/tclpkg/gv/test.rb b/tclpkg/gv/test.rb deleted file mode 100644 index 1c5ffed44..000000000 --- a/tclpkg/gv/test.rb +++ /dev/null @@ -1,34 +0,0 @@ -#!/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) diff --git a/tclpkg/gv/test.tcl b/tclpkg/gv/test.tcl deleted file mode 100644 index 926e298fa..000000000 --- a/tclpkg/gv/test.tcl +++ /dev/null @@ -1,36 +0,0 @@ -#!/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 -- 2.40.0