Update to apvlv 0.1.5.

Switch to github, migrated to gtk+3
This commit is contained in:
landry 2017-04-27 21:37:04 +00:00
parent e8f56ad2a6
commit 8ba575e8a3
7 changed files with 37 additions and 224 deletions

View File

@ -1,32 +1,27 @@
# $OpenBSD: Makefile,v 1.14 2017/04/10 11:46:32 sthen Exp $
# $OpenBSD: Makefile,v 1.15 2017/04/27 21:37:04 landry Exp $
COMMENT= lightweight PDF document viewer with vi bindings
DISTNAME= apvlv-0.0.9.6
REVISION= 6
GH_ACCOUNT = naihe2010
GH_PROJECT = apvlv
GH_COMMIT = 9ab76264c7818097a38e69a2d7d6b47199fffc1f
DISTNAME= apvlv-0.1.5pl0
CATEGORIES= print
HOMEPAGE= https://code.google.com/p/apvlv/
MASTER_SITES= ${MASTER_SITE_GOOGLECODE:=apvlv/}
HOMEPAGE= https://naihe2010.github.io/apvlv/
# GPLv2
PERMIT_PACKAGE_CDROM= Yes
WANTLIB += GL X11 Xau Xcomposite Xcursor Xdamage Xdmcp Xext Xfixes Xi
WANTLIB += Xinerama Xrandr Xrender Xxf86vm atk-1.0 c cairo drm expat
WANTLIB += fontconfig freetype gdk-x11-2.0>=0.14 gdk_pixbuf-2.0>=0.14
WANTLIB += gio-2.0 glib-2.0 gmodule-2.0 gobject-2.0 gthread-2.0
WANTLIB += gtk-x11-2.0>=0.14 m pango-1.0 pangocairo-1.0
WANTLIB += pangoft2-1.0 pixman-1 png poppler-glib>=3 poppler>=3
WANTLIB += pthread pthread-stubs ${LIBCXX} xcb xcb-shm xcb-render z
MODULES= devel/gettext \
devel/cmake
MODULES= devel/gettext
WANTLIB += atk-1.0 c cairo cairo-gobject gdk-3 gdk_pixbuf-2.0
WANTLIB += gio-2.0 glib-2.0 gobject-2.0 gthread-2.0 gtk-3 m pango-1.0
WANTLIB += pangocairo-1.0 poppler-glib pthread ${LIBCXX}
LIB_DEPENDS= x11/gtk+2 \
LIB_DEPENDS= x11/gtk+3 \
print/poppler
CONFIGURE_STYLE = gnu
CONFIGURE_ARGS+= --without-djvu
FAKE_FLAGS = sysconfdir=${PREFIX}/share/examples/apvlv
CONFIGURE_ARGS=-DMANDIR=${PREFIX}/man
.include <bsd.port.mk>

View File

@ -1,2 +1,2 @@
SHA256 (apvlv-0.0.9.6.tar.gz) = XWNjv1fShpZ5skbPz4ODNXgkI+DCqIkvj9xk4FZNmvM=
SIZE (apvlv-0.0.9.6.tar.gz) = 215077
SHA256 (apvlv-0.1.5pl0.tar.gz) = rNa1L3qXvIw7M7O9Jx7CpKrRhhx/6TiVRoAwqZtb4fA=
SIZE (apvlv-0.1.5pl0.tar.gz) = 4256625

View File

@ -0,0 +1,12 @@
$OpenBSD: patch-CMakeLists_txt,v 1.1 2017/04/27 21:37:05 landry Exp $
--- CMakeLists.txt.orig Mon Feb 13 10:28:46 2017
+++ CMakeLists.txt Mon Feb 13 10:29:37 2017
@@ -66,7 +66,7 @@ IF (WIN32)
INSTALL (DIRECTORY icons DESTINATION ".")
INSTALL (DIRECTORY ${CMAKE_HOME_DIRECTORY}/win32/poppler-data DESTINATION ".")
ELSE (WIN32)
- INSTALL (FILES apvlvrc.example DESTINATION ${SYSCONFDIR}
+ INSTALL (FILES apvlvrc.example DESTINATION ${CMAKE_INSTALL_PREFIX}/share/examples/apvlv
RENAME apvlvrc)
INSTALL (FILES apvlvrc.example Startup.pdf Startup.tex main_menubar.glade DESTINATION ${DOCDIR})
INSTALL (DIRECTORY icons DESTINATION ${DOCDIR})

View File

@ -1,29 +0,0 @@
$OpenBSD: patch-src_ApvlvFile_cpp,v 1.2 2011/11/26 19:47:40 kili Exp $
Fixes for poppler-0.16 and poppler-0.18. The latter gyped from archlinux.
--- src/ApvlvFile.cpp.orig Tue Apr 20 03:01:33 2010
+++ src/ApvlvFile.cpp Thu Nov 17 19:36:01 2011
@@ -29,6 +29,10 @@
#include "ApvlvUtil.hpp"
#include "ApvlvView.hpp"
+#ifndef POPPLER_WITH_GDK
+#include "poppler-gdk.h"
+#endif
+
#include <iostream>
#include <fstream>
@@ -267,9 +271,9 @@ ApvlvPDF::ApvlvPDF (const char *filename, bool check):
bool ApvlvPDF::pagetext (int pn, int x1, int y1, int x2, int y2, char **out)
{
- PopplerRectangle rect = { x1, y1, x2, y2 };
+ PopplerRectangle rect = { x1, y2, x2, y1 };
PopplerPage *page = poppler_document_get_page (mDoc, pn);
- *out = poppler_page_get_text (page, POPPLER_SELECTION_WORD, &rect);
+ *out = poppler_page_get_selected_text (page, POPPLER_SELECTION_WORD, &rect);
if (*out != NULL)
{
return true;

View File

@ -1,32 +0,0 @@
$OpenBSD: patch-src_ApvlvUtil_cpp,v 1.1.1.1 2010/05/13 16:05:05 landry Exp $
HOME and PWD are not always set in env.
--- src/ApvlvUtil.cpp.orig Tue Apr 20 03:01:33 2010
+++ src/ApvlvUtil.cpp Tue May 4 10:44:58 2010
@@ -28,6 +28,9 @@
#include "ApvlvUtil.hpp"
+#include <sys/types.h>
+#include <unistd.h>
+
#include <stdlib.h>
#ifndef WIN32
#include <sys/wait.h>
@@ -84,7 +87,7 @@ namespace apvlv
gchar *home =
g_win32_get_package_installation_directory_of_module (NULL);
#else
- char *home = getenv ("HOME");
+ const gchar *home = g_get_home_dir();
#endif
g_snprintf (abpath, sizeof abpath, "%s%s", home, ++path);
}
@@ -95,7 +98,7 @@ namespace apvlv
GetCurrentDirectoryA (sizeof cpath, cpath);
g_snprintf (abpath, sizeof abpath, "%s\\%s", cpath, path);
#else
- snprintf (abpath, sizeof abpath, "%s/%s", getenv ("PWD"), path);
+ snprintf (abpath, sizeof abpath, "%s/%s", g_get_current_dir(), path);
#endif
}

View File

@ -1,139 +0,0 @@
$OpenBSD: patch-src_poppler-gdk_h,v 1.1 2011/11/26 19:47:40 kili Exp $
Fix for poppler-0.18. Patch gyped from archlinux.
--- src/poppler-gdk.h.orig Thu Nov 17 19:35:27 2011
+++ src/poppler-gdk.h Thu Nov 17 19:35:27 2011
@@ -0,0 +1,132 @@
+#include <goo/gtypes.h>
+
+static void
+copy_cairo_surface_to_pixbuf (cairo_surface_t *surface,
+ GdkPixbuf *pixbuf)
+{
+ int cairo_width, cairo_height, cairo_rowstride;
+ unsigned char *pixbuf_data, *dst, *cairo_data;
+ int pixbuf_rowstride, pixbuf_n_channels;
+ unsigned int *src;
+ int x, y;
+
+ cairo_width = cairo_image_surface_get_width (surface);
+ cairo_height = cairo_image_surface_get_height (surface);
+ cairo_rowstride = cairo_image_surface_get_stride (surface);
+ cairo_data = cairo_image_surface_get_data (surface);
+
+ pixbuf_data = gdk_pixbuf_get_pixels (pixbuf);
+ pixbuf_rowstride = gdk_pixbuf_get_rowstride (pixbuf);
+ pixbuf_n_channels = gdk_pixbuf_get_n_channels (pixbuf);
+
+ if (cairo_width > gdk_pixbuf_get_width (pixbuf))
+ cairo_width = gdk_pixbuf_get_width (pixbuf);
+ if (cairo_height > gdk_pixbuf_get_height (pixbuf))
+ cairo_height = gdk_pixbuf_get_height (pixbuf);
+ for (y = 0; y < cairo_height; y++)
+ {
+ src = (unsigned int *) (cairo_data + y * cairo_rowstride);
+ dst = pixbuf_data + y * pixbuf_rowstride;
+ for (x = 0; x < cairo_width; x++)
+ {
+ dst[0] = (*src >> 16) & 0xff;
+ dst[1] = (*src >> 8) & 0xff;
+ dst[2] = (*src >> 0) & 0xff;
+ if (pixbuf_n_channels == 4)
+ dst[3] = (*src >> 24) & 0xff;
+ dst += pixbuf_n_channels;
+ src++;
+ }
+ }
+}
+
+static void
+_poppler_page_render_to_pixbuf (PopplerPage *page,
+ int src_x, int src_y,
+ int src_width, int src_height,
+ double scale,
+ int rotation,
+ GBool printing,
+ GdkPixbuf *pixbuf)
+{
+ cairo_t *cr;
+ cairo_surface_t *surface;
+
+ surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32,
+ src_width, src_height);
+ cr = cairo_create (surface);
+ cairo_save (cr);
+ switch (rotation) {
+ case 90:
+ cairo_translate (cr, src_x + src_width, -src_y);
+ break;
+ case 180:
+ cairo_translate (cr, src_x + src_width, src_y + src_height);
+ break;
+ case 270:
+ cairo_translate (cr, -src_x, src_y + src_height);
+ break;
+ default:
+ cairo_translate (cr, -src_x, -src_y);
+ }
+
+ if (scale != 1.0)
+ cairo_scale (cr, scale, scale);
+
+ if (rotation != 0)
+ cairo_rotate (cr, rotation * G_PI / 180.0);
+
+ if (printing)
+ poppler_page_render_for_printing (page, cr);
+ else
+ poppler_page_render (page, cr);
+ cairo_restore (cr);
+
+ cairo_set_operator (cr, CAIRO_OPERATOR_DEST_OVER);
+ cairo_set_source_rgb (cr, 1., 1., 1.);
+ cairo_paint (cr);
+
+ cairo_destroy (cr);
+
+ copy_cairo_surface_to_pixbuf (surface, pixbuf);
+ cairo_surface_destroy (surface);
+}
+
+/**
+ * poppler_page_render_to_pixbuf:
+ * @page: the page to render from
+ * @src_x: x coordinate of upper left corner
+ * @src_y: y coordinate of upper left corner
+ * @src_width: width of rectangle to render
+ * @src_height: height of rectangle to render
+ * @scale: scale specified as pixels per point
+ * @rotation: rotate the document by the specified degree
+ * @pixbuf: pixbuf to render into
+ *
+ * First scale the document to match the specified pixels per point,
+ * then render the rectangle given by the upper left corner at
+ * (src_x, src_y) and src_width and src_height.
+ * This function is for rendering a page that will be displayed.
+ * If you want to render a page that will be printed use
+ * poppler_page_render_to_pixbuf_for_printing() instead
+ *
+ * Deprecated: 0.16
+ **/
+void
+poppler_page_render_to_pixbuf (PopplerPage *page,
+ int src_x, int src_y,
+ int src_width, int src_height,
+ double scale,
+ int rotation,
+ GdkPixbuf *pixbuf)
+{
+ g_return_if_fail (POPPLER_IS_PAGE (page));
+ g_return_if_fail (scale > 0.0);
+ g_return_if_fail (pixbuf != NULL);
+
+ _poppler_page_render_to_pixbuf (page, src_x, src_y,
+ src_width, src_height,
+ scale, rotation,
+ gFalse,
+ pixbuf);
+}

View File

@ -1,12 +1,18 @@
@comment $OpenBSD: PLIST,v 1.1.1.1 2010/05/13 16:05:05 landry Exp $
@comment $OpenBSD: PLIST,v 1.2 2017/04/27 21:37:05 landry Exp $
@bin bin/apvlv
@man man/man1/apvlv.1
share/applications/apvlv.desktop
share/doc/apvlv/
share/doc/apvlv/Startup.pdf
share/doc/apvlv/Startup.tex
share/doc/apvlv/apvlvrc.example
share/doc/apvlv/dir.png
share/doc/apvlv/pdf.png
share/doc/apvlv/reg.png
share/doc/apvlv/icons/
share/doc/apvlv/icons/dir.png
share/doc/apvlv/icons/pdf.png
share/doc/apvlv/icons/reg.png
share/doc/apvlv/main_menubar.glade
share/examples/apvlv/
share/examples/apvlv/apvlvrc
@sample ${SYSCONFDIR}/apvlvrc
@exec %D/bin/update-desktop-database
@unexec-delete %D/bin/update-desktop-database