[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Preview of some introspection stuff



Aloha,

for people who feel like living on the bleeding edge, here's a preview
of Glib::Object::Introspection, a wrapper for the gobject-introspection
library, and PDF::Poppler, a binding for libpoppler-glib.so written in
pure Perl.

It's not exactly trivial to get this going, so here's a step-by-step
guide.

First, you need Poppler.  It's best to build it with jhbuild, so you
need that too.  I have jhbuild setup to install from the gnome-2.12
moduleset, into /home/torsten/opt/gnome.

  $ jhbuild poppler

Get into a jhbuild shell for a sane environment:

  $ jhbuild shell

Then you need libffi, which is required by gobject-introspection.  There
are some tarballs of libffi floating around, but I used gcc's CVS
repository:

  $ cvs -d:ext:anoncvs savannah gnu org:/cvsroot/gcc -qz9 checkout -P gcc

Now configure gcc, but don't build it:

  $ cd gcc
  $ ./configure --prefix /home/torsten/opt/gnome

Instead, go into the libffi sub directory and configure, build and
install it.  I had to apply the attached libffi-configure.patch first.

  $ cd libffi
  $ patch -p0 < ~/libffi-configure.patch
  $ ./configure --prefix /home/torsten/opt/gnome
  $ make install

You'll also need a pkg-config file for libffi.  I used the attached
libffi.pc:

  $ cp ~/libffi.pc /home/torsten/opt/gnome/lib/pkgconfig

Now you can checkout gobject-introspection:

  $ cvs -d :pserver:anonymous anoncvs gnome org:/cvs/gnome co gobject-introspection

Apply the attached gobject-introspection.patch and build and install:

  $ cd gobject-introspection
  $ patch -p0 < ~/gobject-introspection.patch
  $ ./autogen.sh --prefix /home/torsten/opt/gnome
  $ make install

Finally, build the Perl modules:

  $ tar xvzf Glib-Object-Introspection-0.01.tar.gz
  $ cd Glib-Object-Introspection-0.01/
  $ perl Makefile.PL PREFIX=/home/torsten/opt/perl
  $ make all test install

  $ tar xvzf PDF-Poppler-0.01.tar.gz
  $ cd PDF-Poppler-0.01/
  $ perl Build.PL install_base=/home/torsten/opt/perl
  $ ./Build
  $ ./Build test
  $ ./Build install

That should be it.  For a little example PDF viewer, use:

  $ perl examples/viewer.pl t/test.pdf

Unfortunately, you'll have to always be in PDF-Poppler-0.01/ for
anything to work, because otherwise the needed data/poppler.raw will not
be found.  If anyone has some insights into how to install data files,
I'd appreciate any advise.

If anything doesn't work for you, I'd like to know about it too.

-- 
Have fun,
-Torsten
Index: configure
===================================================================
RCS file: /cvsroot/gcc/gcc/libffi/configure,v
retrieving revision 1.82
diff -u -d -p -r1.82 configure
--- configure	11 Aug 2005 21:18:19 -0000	1.82
+++ configure	21 Aug 2005 14:58:58 -0000
@@ -9317,7 +9317,7 @@ echo "$as_me: executing $ac_dest command
 # Makefile.
 case " $CONFIG_FILES " in
  *" Makefile "*)
-   ac_file=Makefile . ${multi_basedir}/config-ml.in
+   ac_file=Makefile . ${multi_basedir}/gcc/config-ml.in
    ;;
 esac ;;
     depfiles ) test x"$AMDEP_TRUE" != x"" || for mf in $CONFIG_FILES; do
prefix=/home/torsten/opt/gnome
exec_prefix=${prefix}/bin
libdir=${prefix}/lib
includedir=${prefix}/include

Name: libffi
Description: Foreign Function Interface Library
Version: 2.00
Libs: -L${libdir} -lffi
Cflags: -I${includedir}
? .cvsignore
? COPYING
? INSTALL
? src/.cvsignore
? tests/.cvsignore
? tests/invoke/.cvsignore
? tests/invoke/testfns-metadata.c
Index: src/ginvoke.c
===================================================================
RCS file: /cvs/gnome/gobject-introspection/src/ginvoke.c,v
retrieving revision 1.2
diff -u -d -p -r1.2 ginvoke.c
--- src/ginvoke.c	21 May 2005 00:08:26 -0000	1.2
+++ src/ginvoke.c	21 Aug 2005 15:03:23 -0000
@@ -35,9 +35,6 @@ g_invoke_error_quark (void)
   return quark;
 }
 
-
-#ifdef HAVE_LIBFFI
-
 #include "ffi.h"
 
 static ffi_type *
@@ -288,25 +285,3 @@ g_function_info_invoke (GIFunctionInfo *
   
   return success;
 }
-
-#else /* !HAVE_LIBFFI */
-
-gboolean 
-g_function_info_invoke (GIFunctionInfo   *info, 
-			const GArgument  *in_args,
-			int               n_in_args,
-			const GArgument  *out_args,
-			int               n_out_args,
-			GArgument        *return_value,
-			GError          **error)
-{
-  g_set_error (error,
-	       G_INVOKE_ERROR,
-	       G_INVOKE_ERROR_FAILED,
-	       "g_function_info_invoke() is not available");	      
-
-  return FALSE;
-}
-
-#endif
-
Index: src/girepository.h
===================================================================
RCS file: /cvs/gnome/gobject-introspection/src/girepository.h,v
retrieving revision 1.7
diff -u -d -p -r1.7 girepository.h
--- src/girepository.h	21 May 2005 00:08:26 -0000	1.7
+++ src/girepository.h	21 Aug 2005 15:03:23 -0000
@@ -173,6 +173,7 @@ typedef union 
 } GArgument;
 
 #define G_INVOKE_ERROR (g_invoke_error_quark ())
+GQuark g_invoke_error_quark (void);
 
 typedef enum
 {
Index: src/gmetadata.c
===================================================================
RCS file: /cvs/gnome/gobject-introspection/src/gmetadata.c,v
retrieving revision 1.6
diff -u -d -p -r1.6 gmetadata.c
--- src/gmetadata.c	25 Jul 2005 18:48:39 -0000	1.6
+++ src/gmetadata.c	21 Aug 2005 15:03:29 -0000
@@ -592,6 +592,7 @@ validate_function_blob (const guchar  *d
 	case BLOB_TYPE_BOXED:
 	case BLOB_TYPE_OBJECT:
 	case BLOB_TYPE_INTERFACE:
+	case BLOB_TYPE_STRUCT:
 	  break;
 	default:
 	  g_set_error (error,

Attachment: Glib-Object-Introspection-0.01.tar.gz
Description: application/compressed-tar

Attachment: PDF-Poppler-0.01.tar.gz
Description: application/compressed-tar



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]