commit 00145c3aaea2801f922d5c7bbb30ab4a8bf93a8d
parent 3bf1a29835ea753597ccab93919a41a2f195422a
Author: Jonathan Boeing <jonathan@claws-mail.org>
Date: Sun, 22 Aug 2021 17:04:29 -0700
port pdf viewer plugin to windows
Diffstat:
5 files changed, 142 insertions(+), 9 deletions(-)
diff --git a/src/plugins/pdf_viewer/Makefile.am b/src/plugins/pdf_viewer/Makefile.am
@@ -1,8 +1,55 @@
-# Copyright 1999-2014 the Claws Mail team.
+# Copyright 1999-2021 the Claws Mail team.
# This file is part of Claws Mail package, and distributed under the
# terms of the General Public License version 3 (or later).
# See COPYING file for license details.
+EXTRA_DIST = claws.def plugin.def version.rc
+
+IFLAGS = \
+ -I$(top_builddir)/src \
+ -I$(top_srcdir)/src \
+ -I$(top_srcdir)/src/common \
+ -I$(top_builddir)/src/common \
+ -I$(top_srcdir)/src/gtk
+
+if OS_WIN32
+
+LTRCCOMPILE = $(LIBTOOL) --mode=compile --tag=RC $(RC) \
+ `echo $(DEFS) $(DEFAULT_INCLUDES) $(IFLAGS) | \
+ sed -e 's/-I/--include-dir /g;s/-D/--define /g'`
+
+%.lo: %.rc
+ $(LTRCCOMPILE) -i $< -o $@
+
+plugin_res = version.lo
+plugin_res_ldflag = -Wl,.libs/version.o
+export_symbols = -export-symbols $(srcdir)/plugin.def
+plugin_deps = libclaws.a $(plugin_res) plugin.def
+plugin_ldadd = -L. -lclaws
+
+libclaws.a: claws.def
+ $(DLLTOOL) --output-lib $@ --def $<
+
+else
+plugin_res =
+plugin_res_ldflag =
+export_symbols =
+plugin_deps =
+plugin_ldadd =
+endif
+
+if PLATFORM_WIN32
+no_undefined = -no-undefined
+else
+no_undefined =
+endif
+
+if CYGWIN
+cygwin_export_lib = -L$(top_builddir)/src -lclaws-mail
+else
+cygwin_export_lib =
+endif
+
plugindir = $(pkglibdir)/plugins
if BUILD_PDF_VIEWER_PLUGIN
@@ -10,20 +57,21 @@ plugin_LTLIBRARIES = pdf_viewer.la
endif
pdf_viewer_la_SOURCES = \
- poppler_viewer.c \
- poppler_viewer.h
+ poppler_viewer.c \
+ poppler_viewer.h
pdf_viewer_la_LDFLAGS = \
- -avoid-version -module \
+ $(plugin_res_ldflag) $(no_undefined) $(export_symbols) \
+ -avoid-version -module
+
+pdf_viewer_la_DEPENDENCIES = $(plugin_deps)
+
+pdf_viewer_la_LIBADD = $(plugin_ldadd) $(cygwin_export_lib) \
$(GTK_LIBS) \
$(POPPLER_LIBS)
pdf_viewer_la_CPPFLAGS = \
- -I$(top_builddir)/src \
- -I$(top_srcdir)/src \
- -I$(top_srcdir)/src/common \
- -I$(top_builddir)/src/common \
- -I$(top_srcdir)/src/gtk \
+ $(IFLAGS) \
$(GLIB_CFLAGS) \
$(GTK_CFLAGS) \
$(ENCHANT_CFLAGS) \
diff --git a/src/plugins/pdf_viewer/claws.def b/src/plugins/pdf_viewer/claws.def
@@ -0,0 +1,37 @@
+LIBRARY CLAWS-MAIL.EXE
+EXPORTS
+alertpanel_error
+alertpanel_full
+alertpanel_warning
+check_plugin_version
+claws_unlink
+compose_new
+conv_get_locale_charset_str
+debug_print_real
+execute_command_line
+get_tmp_file
+gtkutils_scroll_one_line
+gtkutils_scroll_page
+input_dialog_with_invisible
+main_window_cursor_normal
+main_window_cursor_wait
+mainwindow_get_mainwindow
+mimeview_register_viewer_factory
+mimeview_unregister_viewer_factory
+open_uri
+prefs_common_get_uri_cmd
+printing_get_renderer_data
+printing_get_zoom
+printing_print_full
+printing_set_n_pages
+procmime_get_content_type_str
+procmime_get_mime_type
+procmime_get_part
+procmime_get_part_file_name
+procmime_get_tmp_file_name
+procmime_mimeinfo_get_parameter
+stock_pixbuf_gdk
+stock_pixmap_widget
+strretchomp
+summary_print
+to_human_readable
diff --git a/src/plugins/pdf_viewer/plugin.def b/src/plugins/pdf_viewer/plugin.def
@@ -0,0 +1,10 @@
+EXPORTS
+ plugin_desc
+ plugin_done
+ plugin_init
+ plugin_licence
+ plugin_name
+ plugin_type
+ plugin_provides
+ plugin_version
+
diff --git a/src/plugins/pdf_viewer/poppler_viewer.h b/src/plugins/pdf_viewer/poppler_viewer.h
@@ -26,7 +26,9 @@
//#include <unistd.h>
#include <stdio.h>
#include <gtk/gtk.h>
+#ifndef G_OS_WIN32
#include <gdk/gdkx.h>
+#endif
#include <gdk/gdkkeysyms.h>
#include <poppler.h>
#include <version.h>
diff --git a/src/plugins/pdf_viewer/version.rc b/src/plugins/pdf_viewer/version.rc
@@ -0,0 +1,36 @@
+1 VERSIONINFO
+ FILEVERSION 0, 0, 0, 0
+ PRODUCTVERSION 0, 0, 0, 0
+ FILEFLAGSMASK 0x3fL
+#ifdef _DEBUG
+ FILEFLAGS 0x1L
+#else
+ FILEFLAGS 0x0L
+#endif
+ FILEOS 0x40004L
+ FILETYPE 0x2L
+ FILESUBTYPE 0x0L
+BEGIN
+ BLOCK "StringFileInfo"
+ BEGIN
+ BLOCK "000004b0"
+ BEGIN
+ VALUE "FileDescription", "Claws Mail PDF Viewer Plugin\0"
+ VALUE "FileVersion", "0.0.0.0\0"
+ VALUE "ProductVersion", "0.0.0.0 Win32\0"
+ VALUE "LegalCopyright", "GPL / © 1999-2021 Hiroyuki Yamamoto & The Claws Mail Team\0"
+ VALUE "CompanyName", "GNU / Free Software Foundation\0"
+ VALUE "ProductName", "Claws Mail\0"
+// VALUE "Comments", "\0"
+// VALUE "InternalName", "\0"
+// VALUE "LegalTrademarks", "\0"
+// VALUE "OriginalFilename", "\0"
+// VALUE "PrivateBuild", "\0"
+// VALUE "SpecialBuild", "\0"
+ END
+ END
+ BLOCK "VarFileInfo"
+ BEGIN
+ VALUE "Translation", 0x0, 1200
+ END
+END