From 6e3ec235efd0b13eb5862780d9ce529205b89d63 Mon Sep 17 00:00:00 2001 From: dsomero Date: Mon, 28 Mar 2011 01:26:21 -0400 Subject: [PATCH] python/pypoppler: Patched to build with poppler 0.16. Patched for poppler 0.16 and added some upstream fixes. Signed-off-by: dsomero --- .../patches/poppler0.15.0-changes.patch | 66 +++++++++++++++++ .../patches/pypoppler-0.12.1-75_74.diff | 73 +++++++++++++++++++ .../patches/pypoppler-0.12.1-76_75.diff | 66 +++++++++++++++++ .../patches/pypoppler-0.12.1-79_78.diff | 52 +++++++++++++ python/pypoppler/pypoppler.SlackBuild | 8 +- python/pypoppler/pypoppler.info | 2 +- 6 files changed, 265 insertions(+), 2 deletions(-) create mode 100644 python/pypoppler/patches/poppler0.15.0-changes.patch create mode 100644 python/pypoppler/patches/pypoppler-0.12.1-75_74.diff create mode 100644 python/pypoppler/patches/pypoppler-0.12.1-76_75.diff create mode 100644 python/pypoppler/patches/pypoppler-0.12.1-79_78.diff diff --git a/python/pypoppler/patches/poppler0.15.0-changes.patch b/python/pypoppler/patches/poppler0.15.0-changes.patch new file mode 100644 index 0000000000..a480cfa437 --- /dev/null +++ b/python/pypoppler/patches/poppler0.15.0-changes.patch @@ -0,0 +1,66 @@ +--- poppler.defs ++++ poppler.defs +@@ -1760,6 +1760,12 @@ + (return-type "int") + ) + ++(define-method get_label ++ (of-object "PopplerPage") ++ (c-name "poppler_page_get_label") ++ (return-type "gchar*") ++) ++ + (define-method get_duration + (of-object "PopplerPage") + (c-name "poppler_page_get_duration") +@@ -1805,9 +1811,15 @@ + (of-object "PopplerPage") + (c-name "poppler_page_get_text") + (return-type "char*") ++) ++ ++(define-method get_selected_text ++ (of-object "PopplerPage") ++ (c-name "poppler_page_get_selected_text") ++ (return-type "char*") + (parameters + '("PopplerSelectionStyle" "style") +- '("PopplerRectangle*" "rect") ++ '("PopplerRectangle*" "selection") + ) + ) + +@@ -1895,6 +1907,16 @@ + ) + ) + ++(define-function poppler_page_add_annot ++ (of-object "PopplerPage") ++ (c-name "poppler_page_add_annot") ++ (return-type "none") ++ (parameters ++ '("PopplerAnnot*" "annot") ++ '("GList*" "list") ++ ) ++) ++ + (define-method get_crop_box + (of-object "PopplerPage") + (c-name "poppler_page_get_crop_box") +@@ -1904,6 +1926,16 @@ + ) + ) + ++(define-method get_text_layout ++ (of-object "PopplerPage") ++ (c-name "poppler_page_get_text_layout") ++ (return-type "gboolean") ++ (parameters ++ '("PopplerRectangle**" "rectangles") ++ '("guint*" "n_rectangles") ++ ) ++) ++ + (define-function poppler_rectangle_get_type + (c-name "poppler_rectangle_get_type") + (return-type "GType") diff --git a/python/pypoppler/patches/pypoppler-0.12.1-75_74.diff b/python/pypoppler/patches/pypoppler-0.12.1-75_74.diff new file mode 100644 index 0000000000..47b7a678e3 --- /dev/null +++ b/python/pypoppler/patches/pypoppler-0.12.1-75_74.diff @@ -0,0 +1,73 @@ +--- poppler.defs ++++ poppler.defs +@@ -1642,6 +1642,7 @@ + (of-object "PopplerPage") + (c-name "poppler_page_render_to_pixbuf") + (return-type "none") ++ (unblock-threads #t) + (parameters + '("int" "src_x") + '("int" "src_y") +@@ -1657,6 +1658,7 @@ + (of-object "PopplerPage") + (c-name "poppler_page_render_to_pixbuf_for_printing") + (return-type "none") ++ (unblock-threads #t) + (parameters + '("int" "src_x") + '("int" "src_y") +@@ -1672,12 +1674,14 @@ + (of-object "PopplerPage") + (c-name "poppler_page_get_thumbnail_pixbuf") + (return-type "GdkPixbuf*") ++ (unblock-threads #t) + ) + + (define-method render_selection_to_pixbuf + (of-object "PopplerPage") + (c-name "poppler_page_render_selection_to_pixbuf") + (return-type "none") ++ (unblock-threads #t) + (parameters + '("gdouble" "scale") + '("int" "rotation") +@@ -1694,6 +1698,7 @@ + (of-object "PopplerPage") + (c-name "poppler_page_render") + (return-type "none") ++ (unblock-threads #t) + (parameters + '("cairo_t*" "cairo") + ) +@@ -1703,6 +1708,7 @@ + (of-object "PopplerPage") + (c-name "poppler_page_render_for_printing") + (return-type "none") ++ (unblock-threads #t) + (parameters + '("cairo_t*" "cairo") + ) +@@ -1712,12 +1718,14 @@ + (of-object "PopplerPage") + (c-name "poppler_page_get_thumbnail") + (return-type "cairo_surface_t*") ++ (unblock-threads #t) + ) + + (define-method render_selection + (of-object "PopplerPage") + (c-name "poppler_page_render_selection") + (return-type "none") ++ (unblock-threads #t) + (parameters + '("cairo_t*" "cairo") + '("PopplerRectangle*" "selection") +@@ -1779,6 +1787,7 @@ + (of-object "PopplerPage") + (c-name "poppler_page_render_to_ps") + (return-type "none") ++ (unblock-threads #t) + (parameters + '("PopplerPSFile*" "ps_file") + ) + diff --git a/python/pypoppler/patches/pypoppler-0.12.1-76_75.diff b/python/pypoppler/patches/pypoppler-0.12.1-76_75.diff new file mode 100644 index 0000000000..94f4543e87 --- /dev/null +++ b/python/pypoppler/patches/pypoppler-0.12.1-76_75.diff @@ -0,0 +1,66 @@ +--- poppler.override ++++ poppler.override +@@ -600,3 +600,62 @@ + return PycairoSurface_FromSurface(surface, NULL, NULL); + #endif + } ++%% ++override poppler_page_render_to_pixbuf kwargs ++static PyObject * ++_wrap_poppler_page_render_to_pixbuf(PyGObject *self, ++ PyObject *args, ++ PyObject *kwargs) ++{ ++ static char *kwlist[] = { "src_x", "src_y", "src_width", ++ "src_height", "scale", "rotation", NULL }; ++ int src_x, src_y, src_width, src_height, rotation; ++ double scale; ++ GdkPixbuf *pixbuf = NULL; ++ ++ if (!PyArg_ParseTupleAndKeywords(args, kwargs, ++ "iiiidi:Poppler.Page.render_to_pixbuf", ++ kwlist, &src_x, &src_y, &src_width, ++ &src_height, &scale, &rotation)) ++ return NULL; ++ ++ pyg_begin_allow_threads; ++ ++ poppler_page_render_to_pixbuf(POPPLER_PAGE(self->obj), src_x, src_y, ++ src_width, src_height, scale, ++ rotation, pixbuf); ++ ++ pyg_end_allow_threads; ++ ++ return pygobject_new((GObject *)pixbuf); ++} ++%% ++override poppler_page_render_to_pixbuf_for_printing kwargs ++static PyObject * ++_wrap_poppler_page_render_to_pixbuf_for_printing(PyGObject *self, ++ PyObject *args, ++ PyObject *kwargs) ++{ ++ static char *kwlist[] = { "src_x", "src_y", "src_width", ++ "src_height", "scale", "rotation", NULL }; ++ int src_x, src_y, src_width, src_height, rotation; ++ double scale; ++ GdkPixbuf *pixbuf = NULL; ++ ++ if (!PyArg_ParseTupleAndKeywords(args, kwargs, ++ "iiiidi:Poppler.Page.render_to_pixbuf_for_printing", ++ kwlist, &src_x, &src_y, &src_width, ++ &src_height, &scale, &rotation)) ++ return NULL; ++ ++ pyg_begin_allow_threads; ++ ++ poppler_page_render_to_pixbuf_for_printing(POPPLER_PAGE(self->obj), ++ src_x, src_y, src_width, ++ src_height, scale, ++ rotation, pixbuf); ++ ++ pyg_end_allow_threads; ++ ++ return pygobject_new((GObject *)pixbuf); ++} + diff --git a/python/pypoppler/patches/pypoppler-0.12.1-79_78.diff b/python/pypoppler/patches/pypoppler-0.12.1-79_78.diff new file mode 100644 index 0000000000..161ec588e1 --- /dev/null +++ b/python/pypoppler/patches/pypoppler-0.12.1-79_78.diff @@ -0,0 +1,52 @@ +--- poppler.override ++++ poppler.override +@@ -266,6 +266,12 @@ + import gobject.GObject as PyGObject_Type + import gtk.gdk.Pixbuf as PyGdkPixbuf_Type + %% ++ignore ++poppler_page_free_link_mapping ++poppler_page_free_image_mapping ++poppler_page_free_form_field_mapping ++poppler_page_free_annot_mapping ++%% + ignore-glob + *_get_type + _* +@@ -359,7 +365,7 @@ + + item_list = poppler_page_get_link_mapping(POPPLER_PAGE(self->obj)); + ret = _glist_to_pylist_boxed(item_list, POPPLER_TYPE_LINK_MAPPING); +- g_list_free(item_list); ++ poppler_page_free_link_mapping(item_list); + return ret; + } + %% +@@ -372,7 +378,7 @@ + + item_list = poppler_page_get_image_mapping(POPPLER_PAGE(self->obj)); + ret = _glist_to_pylist_boxed(item_list, POPPLER_TYPE_IMAGE_MAPPING); +- g_list_free(item_list); ++ poppler_page_free_image_mapping(item_list); + return ret; + } + %% +@@ -385,7 +391,7 @@ + + item_list = poppler_page_get_form_field_mapping(POPPLER_PAGE(self->obj)); + ret = _glist_to_pylist_boxed(item_list, POPPLER_TYPE_FORM_FIELD_MAPPING); +- g_list_free(item_list); ++ poppler_page_free_form_field_mapping(item_list); + return ret; + } + %% +@@ -398,7 +404,7 @@ + + item_list = poppler_page_get_annot_mapping(POPPLER_PAGE(self->obj)); + ret = _glist_to_pylist_boxed(item_list, POPPLER_TYPE_ANNOT_MAPPING); +- g_list_free(item_list); ++ poppler_page_free_annot_mapping(item_list); + return ret; + } + %% + diff --git a/python/pypoppler/pypoppler.SlackBuild b/python/pypoppler/pypoppler.SlackBuild index 3daca31ae4..1d723c8e1e 100644 --- a/python/pypoppler/pypoppler.SlackBuild +++ b/python/pypoppler/pypoppler.SlackBuild @@ -6,7 +6,7 @@ PRGNAM=pypoppler VERSION=0.12.1 -BUILD=${BUILD:-1} +BUILD=${BUILD:-2} TAG=${TAG:-_SBo} if [ -z "$ARCH" ]; then @@ -48,6 +48,12 @@ find . \ \( -perm 666 -o -perm 664 -o -perm 600 -o -perm 444 -o -perm 440 -o -perm 400 \) \ -exec chmod 644 {} \; +# Fix building with poppler 0.15+ and some upstream fixes. +patch -p0 < $CWD/patches/pypoppler-0.12.1-75_74.diff +patch -p0 < $CWD/patches/pypoppler-0.12.1-76_75.diff +patch -p0 < $CWD/patches/pypoppler-0.12.1-79_78.diff +patch -p0 < $CWD/patches/poppler0.15.0-changes.patch + CFLAGS="$SLKCFLAGS" \ CXXFLAGS="$SLKCFLAGS" \ ./configure \ diff --git a/python/pypoppler/pypoppler.info b/python/pypoppler/pypoppler.info index c38ebc8cf0..56f9468c84 100644 --- a/python/pypoppler/pypoppler.info +++ b/python/pypoppler/pypoppler.info @@ -7,4 +7,4 @@ DOWNLOAD_x86_64="" MD5SUM_x86_64="" MAINTAINER="Larry Hajali" EMAIL="larryhaja[at]gmail[dot]com" -APPROVED="rworkman" +APPROVED="dsomero"