Re: gd-octave 1.8.4

Rafael Laboissiere <[email protected]> Mon, 18 Oct 2004 16:40:04 -0500
Newsgroups gmane.comp.gnu.octave.graphics
Organization SourceForge.net
Message-ID <20041018213638.GB16934@laboiss2>
* Muthu <[email protected]> [2004-10-17 01:47]:

> Hello Folks!
> Im happy to announce gd-octave.
> GD library a generalpurpose 2-D graphics
> library has been successfully ported to
> Octave.
> 
> Please go through the web page at
> http://cybernetics.freewebspace.com/gd-otave/
> For downloading and details.
> 
> You need:
> A standard GNU/Linux distro [Debian,FC2,RH9,Mandrake]
> GD Library itself [Old version 1.8.4]
> Octave package
> http://www.boutell.com/gd/http/gd-1.8.4.tar.gz
> libjpeg,libzip,libpng12 
> 
> To BUILD the package:
> tar -xzvf ./gd-octave-0.0.3.tgz
> cd gd-octave-0.0.3
> cd src
> make

Unfortunately, compilation fails with GD 2.0.28.  The reason is because your
src/rules.flex does not cope with the new syntax in /usr/include/gd.h. I
hacked src/Makefile (using Perl and sed, sorry, no Python knowledge here) as
in the patch is attached below.

Furthermore, you hardcoded too much things for generating the gd.oct file.
Instead of using:

    gcc --shared -o gd.oct gdwrap.cpp -I/usr/include/octave-2.1.50  -I /usr/include/octave-2.1.50/octave -lgd

it is far better and failure-proof to use:

    mkoctfile -o gd.oct gdwrap.cpp -lgd

Finally, you should consider using Autoconf/Automake for configuring your
package.  For an alternate (and probably more robust) approach for
generating the wrapper code, you might take a look at Matwrap
(http://lnc.usc.edu/~holt/matwrap/). We have been using it in the PLplot
project (http://plplot.sf.net) and it works very well.

At any rate, thanks for your effort and keep going!

-- 
Rafael
gd-octave-0.0.3-Makefile.patch (text/plain, 719 B)
--- Makefile.orig	2004-10-16 13:13:02.000000000 +0200
+++ Makefile	2004-10-18 23:11:02.000000000 +0200
@@ -1,11 +1,11 @@
 package:
 	make parser
-	./fparser < /usr/include/gd.h > fcns
+	perl -pe 's/BGD_DECLARE\(([^)]+)\)/$$1/' < /usr/include/gd.h | ./fparser | sed 's/\* /*/g' > fcns
 	./codegen.py ./fcns ./overrides ./std.header | indent > gdwrap.cpp 
-	gcc --shared -o gd.oct gdwrap.cpp -I/usr/include/octave-2.1.50  -I /usr/include/octave-2.1.50/octave -lgd
+	mkoctfile -o gd.oct gdwrap.cpp -lgd
 	mv ./gd.oct ../
 compile:
-	gcc --shared -o gd.oct gdwrap.cpp -I/usr/include/octave-2.1.50  -I /usr/include/octave-2.1.50/octave -lgd
+	mkoctfile -o gd.oct gdwrap.cpp -lgd
 	mv ./gd.oct ../
 parser:
 	flex rules.flex