From 737e9be2d02d07e3ce0e94e51ca78d3afb4b3f5c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Va=CC=81clav=20Slavi=CC=81k?= Date: Mon, 5 Oct 2020 14:45:35 +0200 Subject: [PATCH 1/5] CMake: use same location for web-extensions as Bakefile Fix the location where the web-extension plugin is installed to be consistent with the primary bakefile-based build system: i.e. to use lib/wx/x.y.z for devel versions and lib/wx/x.y for stable. --- build/cmake/lib/webview/CMakeLists.txt | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/build/cmake/lib/webview/CMakeLists.txt b/build/cmake/lib/webview/CMakeLists.txt index dc9850fa27..721a215bac 100644 --- a/build/cmake/lib/webview/CMakeLists.txt +++ b/build/cmake/lib/webview/CMakeLists.txt @@ -26,7 +26,11 @@ endif() wx_add_library(wxwebview ${WEBVIEW_FILES}) if(WXGTK AND wxUSE_WEBVIEW_WEBKIT2) - set(WX_WEB_EXTENSIONS_DIRECTORY "lib/wx/${wxMAJOR_VERSION}.${wxMINOR_VERSION}/web-extensions") + if(wxVERSION_IS_DEV) + set(WX_WEB_EXTENSIONS_DIRECTORY "lib/wx/${wxMAJOR_VERSION}.${wxMINOR_VERSION}.${wxRELEASE_NUMBER}/web-extensions") + else() + set(WX_WEB_EXTENSIONS_DIRECTORY "lib/wx/${wxMAJOR_VERSION}.${wxMINOR_VERSION}/web-extensions") + endif() wx_lib_compile_definitions(wxwebview PRIVATE -DWX_WEB_EXTENSIONS_DIRECTORY="${CMAKE_INSTALL_PREFIX}/${WX_WEB_EXTENSIONS_DIRECTORY}" ) From 40e5152cfcfdd0cee56db94f404d7699767583cf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Va=CC=81clav=20Slavi=CC=81k?= Date: Mon, 5 Oct 2020 16:54:07 +0200 Subject: [PATCH 2/5] Remove WX_WEB_EXTENSIONS_DIRECTORY define wxWidgets already has a mechanism for locating plugins under $libdir/wx/*, there's no reason to duplicate it with another compile-time symbol. As a consequence, this makes the library relocatable via WXPREFIX again. --- Makefile.in | 46 ++++++++++---------------- autoconf_inc.m4 | 2 +- build/bakefiles/common.bkl | 5 --- build/bakefiles/monolithic.bkl | 2 -- build/bakefiles/multilib.bkl | 2 -- build/cmake/lib/webview/CMakeLists.txt | 3 -- src/common/dynlib.cpp | 2 ++ src/gtk/webview_webkit2.cpp | 21 +++++++----- 8 files changed, 33 insertions(+), 50 deletions(-) diff --git a/Makefile.in b/Makefile.in index 62beaa8482..74838af176 100644 --- a/Makefile.in +++ b/Makefile.in @@ -949,8 +949,8 @@ MONODLL_CFLAGS = $(__monodll_PCH_INC) $(__INC_TIFF_BUILD_p) $(__INC_TIFF_p) \ -I$(top_srcdir)/src/stc/scintilla/include \ -I$(top_srcdir)/src/stc/scintilla/lexlib \ -I$(top_srcdir)/src/stc/scintilla/src -D__WX__ -DSCI_LEXER -DNO_CXX11_REGEX \ - -DLINK_LEXERS -DwxUSE_BASE=1 -DWXMAKINGDLL $(__webviewdll_ext_dir_define_p) \ - $(PIC_FLAG) $(WX_CFLAGS) $(CPPFLAGS) $(CFLAGS) + -DLINK_LEXERS -DwxUSE_BASE=1 -DWXMAKINGDLL $(PIC_FLAG) $(WX_CFLAGS) \ + $(CPPFLAGS) $(CFLAGS) MONODLL_CXXFLAGS = $(__monodll_PCH_INC) $(__INC_TIFF_BUILD_p) $(__INC_TIFF_p) \ $(__INC_JPEG_p) $(__INC_PNG_p) $(__INC_ZLIB_p) $(__INC_REGEX_p) \ $(__INC_EXPAT_p) $(WX_CPPFLAGS) -D__WX$(TOOLKIT)__ $(__WXUNIV_DEFINE_p) \ @@ -959,8 +959,8 @@ MONODLL_CXXFLAGS = $(__monodll_PCH_INC) $(__INC_TIFF_BUILD_p) $(__INC_TIFF_p) \ -I$(top_srcdir)/src/stc/scintilla/include \ -I$(top_srcdir)/src/stc/scintilla/lexlib \ -I$(top_srcdir)/src/stc/scintilla/src -D__WX__ -DSCI_LEXER -DNO_CXX11_REGEX \ - -DLINK_LEXERS -DwxUSE_BASE=1 -DWXMAKINGDLL $(__webviewdll_ext_dir_define_p) \ - $(PIC_FLAG) $(WX_CXXFLAGS) $(CPPFLAGS) $(CXXFLAGS) + -DLINK_LEXERS -DwxUSE_BASE=1 -DWXMAKINGDLL $(PIC_FLAG) $(WX_CXXFLAGS) \ + $(CPPFLAGS) $(CXXFLAGS) MONODLL_OBJCXXFLAGS = $(__monodll_PCH_INC) $(__INC_TIFF_BUILD_p) \ $(__INC_TIFF_p) $(__INC_JPEG_p) $(__INC_PNG_p) $(__INC_ZLIB_p) \ $(__INC_REGEX_p) $(__INC_EXPAT_p) $(WX_CPPFLAGS) -D__WX$(TOOLKIT)__ \ @@ -969,8 +969,8 @@ MONODLL_OBJCXXFLAGS = $(__monodll_PCH_INC) $(__INC_TIFF_BUILD_p) \ -I$(top_srcdir)/src/stc/scintilla/include \ -I$(top_srcdir)/src/stc/scintilla/lexlib \ -I$(top_srcdir)/src/stc/scintilla/src -D__WX__ -DSCI_LEXER -DNO_CXX11_REGEX \ - -DLINK_LEXERS -DwxUSE_BASE=1 -DWXMAKINGDLL $(__webviewdll_ext_dir_define_p) \ - $(PIC_FLAG) $(CPPFLAGS) $(OBJCXXFLAGS) + -DLINK_LEXERS -DwxUSE_BASE=1 -DWXMAKINGDLL $(PIC_FLAG) $(CPPFLAGS) \ + $(OBJCXXFLAGS) MONODLL_OBJECTS = \ monodll_any.o \ monodll_appbase.o \ @@ -1092,8 +1092,7 @@ MONOLIB_CFLAGS = $(__monolib_PCH_INC) $(__INC_TIFF_BUILD_p) $(__INC_TIFF_p) \ -I$(top_srcdir)/src/stc/scintilla/include \ -I$(top_srcdir)/src/stc/scintilla/lexlib \ -I$(top_srcdir)/src/stc/scintilla/src -D__WX__ -DSCI_LEXER -DNO_CXX11_REGEX \ - -DLINK_LEXERS -DwxUSE_BASE=1 $(__webviewdll_ext_dir_define_p) $(WX_CFLAGS) \ - $(CPPFLAGS) $(CFLAGS) + -DLINK_LEXERS -DwxUSE_BASE=1 $(WX_CFLAGS) $(CPPFLAGS) $(CFLAGS) MONOLIB_CXXFLAGS = $(__monolib_PCH_INC) $(__INC_TIFF_BUILD_p) $(__INC_TIFF_p) \ $(__INC_JPEG_p) $(__INC_PNG_p) $(__INC_ZLIB_p) $(__INC_REGEX_p) \ $(__INC_EXPAT_p) $(WX_CPPFLAGS) -D__WX$(TOOLKIT)__ $(__WXUNIV_DEFINE_p) \ @@ -1102,8 +1101,7 @@ MONOLIB_CXXFLAGS = $(__monolib_PCH_INC) $(__INC_TIFF_BUILD_p) $(__INC_TIFF_p) \ -I$(top_srcdir)/src/stc/scintilla/include \ -I$(top_srcdir)/src/stc/scintilla/lexlib \ -I$(top_srcdir)/src/stc/scintilla/src -D__WX__ -DSCI_LEXER -DNO_CXX11_REGEX \ - -DLINK_LEXERS -DwxUSE_BASE=1 $(__webviewdll_ext_dir_define_p) \ - $(WX_CXXFLAGS) $(CPPFLAGS) $(CXXFLAGS) + -DLINK_LEXERS -DwxUSE_BASE=1 $(WX_CXXFLAGS) $(CPPFLAGS) $(CXXFLAGS) MONOLIB_OBJCXXFLAGS = $(__monolib_PCH_INC) $(__INC_TIFF_BUILD_p) \ $(__INC_TIFF_p) $(__INC_JPEG_p) $(__INC_PNG_p) $(__INC_ZLIB_p) \ $(__INC_REGEX_p) $(__INC_EXPAT_p) $(WX_CPPFLAGS) -D__WX$(TOOLKIT)__ \ @@ -1112,8 +1110,7 @@ MONOLIB_OBJCXXFLAGS = $(__monolib_PCH_INC) $(__INC_TIFF_BUILD_p) \ -I$(top_srcdir)/src/stc/scintilla/include \ -I$(top_srcdir)/src/stc/scintilla/lexlib \ -I$(top_srcdir)/src/stc/scintilla/src -D__WX__ -DSCI_LEXER -DNO_CXX11_REGEX \ - -DLINK_LEXERS -DwxUSE_BASE=1 $(__webviewdll_ext_dir_define_p) $(CPPFLAGS) \ - $(OBJCXXFLAGS) + -DLINK_LEXERS -DwxUSE_BASE=1 $(CPPFLAGS) $(OBJCXXFLAGS) MONOLIB_OBJECTS = \ monolib_any.o \ monolib_appbase.o \ @@ -1669,16 +1666,15 @@ WEBVIEWDLL_CXXFLAGS = $(__webviewdll_PCH_INC) $(__INC_TIFF_BUILD_p) \ $(__INC_REGEX_p) $(__INC_EXPAT_p) $(WX_CPPFLAGS) -D__WX$(TOOLKIT)__ \ $(__WXUNIV_DEFINE_p) $(__DEBUG_DEFINE_p) $(__EXCEPTIONS_DEFINE_p) \ $(__RTTI_DEFINE_p) $(__THREAD_DEFINE_p) -DWXBUILDING -DWXUSINGDLL \ - -DWXMAKINGDLL_WEBVIEW $(__webviewdll_ext_dir_define_p) \ - $(__webview_additional_include_p) $(PIC_FLAG) $(WX_CXXFLAGS) $(CPPFLAGS) \ - $(CXXFLAGS) + -DWXMAKINGDLL_WEBVIEW $(__webview_additional_include_p) $(PIC_FLAG) \ + $(WX_CXXFLAGS) $(CPPFLAGS) $(CXXFLAGS) WEBVIEWDLL_OBJCXXFLAGS = $(__webviewdll_PCH_INC) $(__INC_TIFF_BUILD_p) \ $(__INC_TIFF_p) $(__INC_JPEG_p) $(__INC_PNG_p) $(__INC_ZLIB_p) \ $(__INC_REGEX_p) $(__INC_EXPAT_p) $(WX_CPPFLAGS) -D__WX$(TOOLKIT)__ \ $(__WXUNIV_DEFINE_p) $(__DEBUG_DEFINE_p) $(__EXCEPTIONS_DEFINE_p) \ $(__RTTI_DEFINE_p) $(__THREAD_DEFINE_p) -DWXBUILDING -DWXUSINGDLL \ - -DWXMAKINGDLL_WEBVIEW $(__webviewdll_ext_dir_define_p) \ - $(__webview_additional_include_p) $(PIC_FLAG) $(CPPFLAGS) $(OBJCXXFLAGS) + -DWXMAKINGDLL_WEBVIEW $(__webview_additional_include_p) $(PIC_FLAG) \ + $(CPPFLAGS) $(OBJCXXFLAGS) WEBVIEWDLL_OBJECTS = \ $(__WEBVIEW_SRC_PLATFORM_OBJECTS_2) \ webviewdll_webview.o \ @@ -1691,15 +1687,13 @@ WEBVIEWLIB_CXXFLAGS = $(__webviewlib_PCH_INC) $(__INC_TIFF_BUILD_p) \ $(__INC_REGEX_p) $(__INC_EXPAT_p) $(WX_CPPFLAGS) -D__WX$(TOOLKIT)__ \ $(__WXUNIV_DEFINE_p) $(__DEBUG_DEFINE_p) $(__EXCEPTIONS_DEFINE_p) \ $(__RTTI_DEFINE_p) $(__THREAD_DEFINE_p) -DWXBUILDING \ - $(__webviewdll_ext_dir_define_p) $(__webview_additional_include_p) \ - $(WX_CXXFLAGS) $(CPPFLAGS) $(CXXFLAGS) + $(__webview_additional_include_p) $(WX_CXXFLAGS) $(CPPFLAGS) $(CXXFLAGS) WEBVIEWLIB_OBJCXXFLAGS = $(__webviewlib_PCH_INC) $(__INC_TIFF_BUILD_p) \ $(__INC_TIFF_p) $(__INC_JPEG_p) $(__INC_PNG_p) $(__INC_ZLIB_p) \ $(__INC_REGEX_p) $(__INC_EXPAT_p) $(WX_CPPFLAGS) -D__WX$(TOOLKIT)__ \ $(__WXUNIV_DEFINE_p) $(__DEBUG_DEFINE_p) $(__EXCEPTIONS_DEFINE_p) \ $(__RTTI_DEFINE_p) $(__THREAD_DEFINE_p) -DWXBUILDING \ - $(__webviewdll_ext_dir_define_p) $(__webview_additional_include_p) \ - $(CPPFLAGS) $(OBJCXXFLAGS) + $(__webview_additional_include_p) $(CPPFLAGS) $(OBJCXXFLAGS) WEBVIEWLIB_OBJECTS = \ $(__WEBVIEW_SRC_PLATFORM_OBJECTS_3) \ webviewlib_webview.o \ @@ -13341,9 +13335,6 @@ COND_PLATFORM_MACOSX_1___OSX_LOWLEVEL_SRC_OBJECTS = \ monodll_core_timer.o \ monodll_utilsexc_cf.o @COND_PLATFORM_MACOSX_1@__OSX_LOWLEVEL_SRC_OBJECTS = $(COND_PLATFORM_MACOSX_1___OSX_LOWLEVEL_SRC_OBJECTS) -COND_USE_WEBVIEW_WEBKIT2_1___webviewdll_ext_dir_define_p_0 = --define \ - WX_WEB_EXTENSIONS_DIRECTORY=\"$(PLUGINS_INST_DIR)/web-extensions\" -@COND_USE_WEBVIEW_WEBKIT2_1@__webviewdll_ext_dir_define_p_0 = $(COND_USE_WEBVIEW_WEBKIT2_1___webviewdll_ext_dir_define_p_0) @COND_PLATFORM_MACOSX_1@__PLATFORM_SRC_OBJECTS_0 = monolib_unix_apptraits.o @COND_PLATFORM_UNIX_1@__PLATFORM_SRC_OBJECTS_0 = monolib_unix_apptraits.o COND_PLATFORM_MACOSX_1___OSX_COMMON_SRC_OBJECTS_0 = \ @@ -13758,9 +13749,6 @@ COND_PLATFORM_MACOSX_1___OSX_LOWLEVEL_SRC_OBJECTS_1_4 = \ corelib_core_timer.o \ corelib_utilsexc_cf.o @COND_PLATFORM_MACOSX_1@__OSX_LOWLEVEL_SRC_OBJECTS_1_4 = $(COND_PLATFORM_MACOSX_1___OSX_LOWLEVEL_SRC_OBJECTS_1_4) -@COND_USE_WEBVIEW_WEBKIT2_1@__webviewdll_ext_dir_define_p \ -@COND_USE_WEBVIEW_WEBKIT2_1@ = \ -@COND_USE_WEBVIEW_WEBKIT2_1@ -DWX_WEB_EXTENSIONS_DIRECTORY=\"$(PLUGINS_INST_DIR)/web-extensions\" @COND_TOOLKIT_MSW@__webview_additional_include_p = \ @COND_TOOLKIT_MSW@ -I$(top_srcdir)/3rdparty/webview2/build/native/include @COND_MONOLITHIC_0_SHARED_1_USE_GUI_1_USE_HTML_1@__htmldll_library_link_DEP \ @@ -20872,7 +20860,7 @@ monodll_sound_sdl.o: $(srcdir)/src/unix/sound_sdl.cpp $(MONODLL_ODEP) @COND_PLATFORM_MACOSX_1_USE_GUI_1@ $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/html/chm.cpp monodll_version_rc.o: $(srcdir)/src/msw/version.rc $(MONODLL_ODEP) - $(WINDRES) -i$< -o$@ $(__INC_TIFF_BUILD_p_54) $(__INC_TIFF_p_54) $(__INC_JPEG_p_54) $(__INC_PNG_p_53) $(__INC_ZLIB_p_67) $(__INC_REGEX_p_65) $(__INC_EXPAT_p_65) --define __WX$(TOOLKIT)__ $(__WXUNIV_DEFINE_p_67) $(__DEBUG_DEFINE_p_66) $(__EXCEPTIONS_DEFINE_p_65) $(__RTTI_DEFINE_p_65) $(__THREAD_DEFINE_p_65) --define WXBUILDING --define WXDLLNAME=$(WXDLLNAMEPREFIXGUI)$(WXUNICODEFLAG)$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)$(WXCOMPILER)$(VENDORTAG)$(WXDLLVERSIONTAG) $(__RCDEFDIR_p) --include-dir $(top_srcdir)/include --include-dir $(top_srcdir)/src/stc/scintilla/include --include-dir $(top_srcdir)/src/stc/scintilla/lexlib --include-dir $(top_srcdir)/src/stc/scintilla/src --define __WX__ --define SCI_LEXER --define NO_CXX11_REGEX --define LINK_LEXERS --define wxUSE_BASE=1 --define WXMAKINGDLL $(__webviewdll_ext_dir_define_p_0) + $(WINDRES) -i$< -o$@ $(__INC_TIFF_BUILD_p_54) $(__INC_TIFF_p_54) $(__INC_JPEG_p_54) $(__INC_PNG_p_53) $(__INC_ZLIB_p_67) $(__INC_REGEX_p_65) $(__INC_EXPAT_p_65) --define __WX$(TOOLKIT)__ $(__WXUNIV_DEFINE_p_67) $(__DEBUG_DEFINE_p_66) $(__EXCEPTIONS_DEFINE_p_65) $(__RTTI_DEFINE_p_65) $(__THREAD_DEFINE_p_65) --define WXBUILDING --define WXDLLNAME=$(WXDLLNAMEPREFIXGUI)$(WXUNICODEFLAG)$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)$(WXCOMPILER)$(VENDORTAG)$(WXDLLVERSIONTAG) $(__RCDEFDIR_p) --include-dir $(top_srcdir)/include --include-dir $(top_srcdir)/src/stc/scintilla/include --include-dir $(top_srcdir)/src/stc/scintilla/lexlib --include-dir $(top_srcdir)/src/stc/scintilla/src --define __WX__ --define SCI_LEXER --define NO_CXX11_REGEX --define LINK_LEXERS --define wxUSE_BASE=1 --define WXMAKINGDLL monolib_any.o: $(srcdir)/src/common/any.cpp $(MONOLIB_ODEP) $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/common/any.cpp @@ -36010,7 +35998,7 @@ webviewdll_webviewfshandler.o: $(srcdir)/src/common/webviewfshandler.cpp $(WEBVI $(CXXC) -c -o $@ $(WEBVIEWDLL_CXXFLAGS) $(srcdir)/src/common/webviewfshandler.cpp webviewdll_version_rc.o: $(srcdir)/src/msw/version.rc $(WEBVIEWDLL_ODEP) - $(WINDRES) -i$< -o$@ $(__INC_TIFF_BUILD_p_54) $(__INC_TIFF_p_54) $(__INC_JPEG_p_54) $(__INC_PNG_p_53) $(__INC_ZLIB_p_67) $(__INC_REGEX_p_65) $(__INC_EXPAT_p_65) --define __WX$(TOOLKIT)__ $(__WXUNIV_DEFINE_p_67) $(__DEBUG_DEFINE_p_66) $(__EXCEPTIONS_DEFINE_p_65) $(__RTTI_DEFINE_p_65) $(__THREAD_DEFINE_p_65) --define WXBUILDING --define WXDLLNAME=$(WXDLLNAMEPREFIXGUI)$(WXUNICODEFLAG)$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)_webview$(WXCOMPILER)$(VENDORTAG)$(WXDLLVERSIONTAG) $(__RCDEFDIR_p) --include-dir $(top_srcdir)/include --define WXUSINGDLL --define WXMAKINGDLL_WEBVIEW $(__webviewdll_ext_dir_define_p_0) $(__webview_additional_include_p_1) + $(WINDRES) -i$< -o$@ $(__INC_TIFF_BUILD_p_54) $(__INC_TIFF_p_54) $(__INC_JPEG_p_54) $(__INC_PNG_p_53) $(__INC_ZLIB_p_67) $(__INC_REGEX_p_65) $(__INC_EXPAT_p_65) --define __WX$(TOOLKIT)__ $(__WXUNIV_DEFINE_p_67) $(__DEBUG_DEFINE_p_66) $(__EXCEPTIONS_DEFINE_p_65) $(__RTTI_DEFINE_p_65) $(__THREAD_DEFINE_p_65) --define WXBUILDING --define WXDLLNAME=$(WXDLLNAMEPREFIXGUI)$(WXUNICODEFLAG)$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)_webview$(WXCOMPILER)$(VENDORTAG)$(WXDLLVERSIONTAG) $(__RCDEFDIR_p) --include-dir $(top_srcdir)/include --define WXUSINGDLL --define WXMAKINGDLL_WEBVIEW $(__webview_additional_include_p_1) webviewlib_webview_ie.o: $(srcdir)/src/msw/webview_ie.cpp $(WEBVIEWLIB_ODEP) $(CXXC) -c -o $@ $(WEBVIEWLIB_CXXFLAGS) $(srcdir)/src/msw/webview_ie.cpp diff --git a/autoconf_inc.m4 b/autoconf_inc.m4 index eae0f23231..9f06e653b9 100644 --- a/autoconf_inc.m4 +++ b/autoconf_inc.m4 @@ -980,7 +980,7 @@ dnl ### begin block 20_COND_USE_THREADS_1[../../demos/bombs/bombs.bkl,../../demo COND_USE_THREADS_1="" fi AC_SUBST(COND_USE_THREADS_1) -dnl ### begin block 20_COND_USE_WEBVIEW_WEBKIT2_1[../../demos/bombs/bombs.bkl,../../demos/forty/forty.bkl,../../demos/fractal/fractal.bkl,../../demos/life/life.bkl,../../demos/poem/poem.bkl,../../samples/access/access.bkl,../../samples/animate/anitest.bkl,../../samples/archive/archive.bkl,../../samples/artprov/artprov.bkl,../../samples/aui/auidemo.bkl,../../samples/calendar/calendar.bkl,../../samples/caret/caret.bkl,../../samples/clipboard/clipboard.bkl,../../samples/collpane/collpane.bkl,../../samples/combo/combo.bkl,../../samples/config/config.bkl,../../samples/console/console.bkl,../../samples/dataview/dataview.bkl,../../samples/debugrpt/debugrpt.bkl,../../samples/dialogs/dialogs.bkl,../../samples/dialup/dialup.bkl,../../samples/display/display.bkl,../../samples/dll/dll.bkl,../../samples/dnd/dnd.bkl,../../samples/docview/docview.bkl,../../samples/dragimag/dragimag.bkl,../../samples/drawing/drawing.bkl,../../samples/erase/erase.bkl,../../samples/event/event.bkl,../../samples/except/except.bkl,../../samples/exec/exec.bkl,../../samples/font/font.bkl,../../samples/fswatcher/fswatcher.bkl,../../samples/grid/grid.bkl,../../samples/help/help.bkl,../../samples/htlbox/htlbox.bkl,../../samples/html/about/about.bkl,../../samples/html/help/help.bkl,../../samples/html/helpview/helpview.bkl,../../samples/html/htmlctrl/htmlctrl.bkl,../../samples/html/printing/printing.bkl,../../samples/html/test/test.bkl,../../samples/html/virtual/virtual.bkl,../../samples/html/widget/widget.bkl,../../samples/html/zip/zip.bkl,../../samples/image/image.bkl,../../samples/internat/internat.bkl,../../samples/ipc/ipc.bkl,../../samples/joytest/joytest.bkl,../../samples/keyboard/keyboard.bkl,../../samples/layout/layout.bkl,../../samples/listctrl/listctrl.bkl,../../samples/mdi/mdi.bkl,../../samples/mediaplayer/mediaplayer.bkl,../../samples/memcheck/memcheck.bkl,../../samples/menu/menu.bkl,../../samples/minimal/minimal.bkl,../../samples/nativdlg/nativdlg.bkl,../../samples/notebook/notebook.bkl,../../samples/oleauto/oleauto.bkl,../../samples/opengl/cube/cube.bkl,../../samples/opengl/isosurf/isosurf.bkl,../../samples/opengl/penguin/penguin.bkl,../../samples/opengl/pyramid/pyramid.bkl,../../samples/ownerdrw/ownerdrw.bkl,../../samples/popup/popup.bkl,../../samples/power/power.bkl,../../samples/preferences/preferences.bkl,../../samples/printing/printing.bkl,../../samples/propgrid/propgrid.bkl,../../samples/regtest/regtest.bkl,../../samples/render/render.bkl,../../samples/ribbon/ribbon.bkl,../../samples/richtext/richtext.bkl,../../samples/sashtest/sashtest.bkl,../../samples/scroll/scroll.bkl,../../samples/secretstore/secretstore.bkl,../../samples/shaped/shaped.bkl,../../samples/sockets/sockets.bkl,../../samples/sound/sound.bkl,../../samples/splash/splash.bkl,../../samples/splitter/splitter.bkl,../../samples/statbar/statbar.bkl,../../samples/stc/stctest.bkl,../../samples/svg/svgtest.bkl,../../samples/taborder/taborder.bkl,../../samples/taskbar/taskbar.bkl,../../samples/taskbarbutton/taskbarbutton.bkl,../../samples/text/text.bkl,../../samples/thread/thread.bkl,../../samples/toolbar/toolbar.bkl,../../samples/treectrl/treectrl.bkl,../../samples/treelist/treelist.bkl,../../samples/typetest/typetest.bkl,../../samples/uiaction/uiaction.bkl,../../samples/validate/validate.bkl,../../samples/vscroll/vscroll.bkl,../../samples/webview/webview.bkl,../../samples/widgets/widgets.bkl,../../samples/wizard/wizard.bkl,../../samples/wrapsizer/wrapsizer.bkl,../../samples/xrc/xrcdemo.bkl,../../samples/xti/xti.bkl,../../tests/benchmarks/bench.bkl,../../tests/test.bkl,../../utils/emulator/src/emulator.bkl,../../utils/execmon/execmon.bkl,../../utils/helpview/src/helpview.bkl,../../utils/hhp2cached/hhp2cached.bkl,../../utils/ifacecheck/src/ifacecheck.bkl,../../utils/screenshotgen/src/screenshotgen.bkl,../../utils/wxrc/wxrc.bkl,wx.bkl] ### +dnl ### begin block 20_COND_USE_WEBVIEW_WEBKIT2_1[wx.bkl] ### COND_USE_WEBVIEW_WEBKIT2_1="#" if test "x$USE_WEBVIEW_WEBKIT2" = "x1" ; then COND_USE_WEBVIEW_WEBKIT2_1="" diff --git a/build/bakefiles/common.bkl b/build/bakefiles/common.bkl index e22e718bbb..62748bbb32 100644 --- a/build/bakefiles/common.bkl +++ b/build/bakefiles/common.bkl @@ -897,9 +897,4 @@ $(TAB)cl /EP /nologo "$(DOLLAR)(InputPath)" > "$(SETUPHDIR)\wx\msw\rcdefs.h" top_srcdir - - WX_WEB_EXTENSIONS_DIRECTORY=\"$(PLUGINS_INST_DIR)/web-extensions\" - - - diff --git a/build/bakefiles/monolithic.bkl b/build/bakefiles/monolithic.bkl index 278a308af4..90cdc085ed 100644 --- a/build/bakefiles/monolithic.bkl +++ b/build/bakefiles/monolithic.bkl @@ -28,7 +28,6 @@ WXMAKINGDLL - $(webviewdll_ext_dir_define) $(EXTRALIBS_XML) $(EXTRALIBS_HTML) $(EXTRALIBS_MEDIA) @@ -40,7 +39,6 @@ - $(webviewdll_ext_dir_define) 8192 diff --git a/build/bakefiles/multilib.bkl b/build/bakefiles/multilib.bkl index 3367df44bc..c378688dd7 100644 --- a/build/bakefiles/multilib.bkl +++ b/build/bakefiles/multilib.bkl @@ -184,7 +184,6 @@ cond="SHARED=='1' and USE_GUI=='1' and USE_WEBVIEW=='1' and MONOLITHIC=='0'"> WXUSINGDLL WXMAKINGDLL_WEBVIEW - $(webviewdll_ext_dir_define) $(WEBVIEW_SRC) coredll basedll @@ -195,7 +194,6 @@ - $(webviewdll_ext_dir_define) $(WEBVIEW_SRC) $(WEBVIEW_HDR) $(webview_additional_include) diff --git a/build/cmake/lib/webview/CMakeLists.txt b/build/cmake/lib/webview/CMakeLists.txt index 721a215bac..1e2e7057a9 100644 --- a/build/cmake/lib/webview/CMakeLists.txt +++ b/build/cmake/lib/webview/CMakeLists.txt @@ -31,9 +31,6 @@ if(WXGTK AND wxUSE_WEBVIEW_WEBKIT2) else() set(WX_WEB_EXTENSIONS_DIRECTORY "lib/wx/${wxMAJOR_VERSION}.${wxMINOR_VERSION}/web-extensions") endif() - wx_lib_compile_definitions(wxwebview PRIVATE - -DWX_WEB_EXTENSIONS_DIRECTORY="${CMAKE_INSTALL_PREFIX}/${WX_WEB_EXTENSIONS_DIRECTORY}" - ) endif() if(APPLE) diff --git a/src/common/dynlib.cpp b/src/common/dynlib.cpp index 37fea09768..8130f93f9d 100644 --- a/src/common/dynlib.cpp +++ b/src/common/dynlib.cpp @@ -227,6 +227,8 @@ wxString wxDynamicLibrary::GetPluginsDirectory() { #ifdef __UNIX__ wxString format = wxGetInstallPrefix(); + if ( format.empty() ) + return wxEmptyString; wxString dir; format << wxFILE_SEP_PATH << wxT("lib") << wxFILE_SEP_PATH diff --git a/src/gtk/webview_webkit2.cpp b/src/gtk/webview_webkit2.cpp index 69583a546a..72351dd8e5 100644 --- a/src/gtk/webview_webkit2.cpp +++ b/src/gtk/webview_webkit2.cpp @@ -369,7 +369,7 @@ wxgtk_webview_webkit_counted_matches(WebKitFindController *, } // This function checks if the specified directory contains our web extension. -static bool CheckDirectoryForWebExt(const char* dirname) +static bool CheckDirectoryForWebExt(const wxString& dirname) { wxDir dir; if ( !wxDir::Exists(dirname) || !dir.Open(dirname) ) @@ -409,33 +409,38 @@ wxgtk_initialize_web_extensions(WebKitWebContext *context, // The first value is the location in which the extension is supposed to be // normally installed, while the other three are used as fallbacks to allow // running the tests and sample using wxWebView before installing it. - const char* const directories[] = + + wxString normalLocation = wxDynamicLibrary::GetPluginsDirectory(); + if ( !normalLocation.empty() ) + normalLocation += "/web-extensions"; + + wxString const directories[] = { - WX_WEB_EXTENSIONS_DIRECTORY, + normalLocation, "..", "../..", "lib", }; - const char* dir = NULL; + wxString dir; for ( size_t n = 0; n < WXSIZEOF(directories); ++n ) { - if ( CheckDirectoryForWebExt(directories[n]) ) + if ( !directories[n].empty() && CheckDirectoryForWebExt(directories[n]) ) { dir = directories[n]; break; } } - if ( dir ) + if ( !dir.empty() ) { - webkit_web_context_set_web_extensions_directory(context, dir); + webkit_web_context_set_web_extensions_directory(context, dir.utf8_str()); } else { wxLogWarning(_("Web extension not found in \"%s\", " "some wxWebView functionality will be not available"), - WX_WEB_EXTENSIONS_DIRECTORY); + directories[0]); } webkit_web_context_set_web_extensions_initialization_user_data(context, From 2388f5d33fa2dac91cfaa205ed9bd797ed936fb3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Va=CC=81clav=20Slavi=CC=81k?= Date: Mon, 5 Oct 2020 16:44:23 +0200 Subject: [PATCH 3/5] Don't crash if WXPREFIX env. variable is set Change wxGetInstallPrefix() to return a string instead of const wxChar*. The latter was incorrectly obtained from a temporary string if WXPREFIX was set. While it's possible to fix in a backward compatible manner without changing the function's signature, it's not worth the effort for something pretty obscure and used mostly internally. --- docs/changes.txt | 2 ++ include/wx/utils.h | 2 +- src/common/utilscmn.cpp | 4 ++-- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/docs/changes.txt b/docs/changes.txt index a5196548aa..ba14312ee6 100644 --- a/docs/changes.txt +++ b/docs/changes.txt @@ -105,6 +105,8 @@ Changes in behaviour not resulting in compilation errors - wxFileDialog::GetPath() and wxFileDialog::GetFilename() now assert and return an empty string if called on dialogs with the wxFD_MULTIPLE style. +- wxGetInstallPrefix() now returns wxString. + Changes in behaviour which may result in build errors ----------------------------------------------------- diff --git a/include/wx/utils.h b/include/wx/utils.h index c6d35299c2..3f4aea8daf 100644 --- a/include/wx/utils.h +++ b/include/wx/utils.h @@ -162,7 +162,7 @@ WXDLLIMPEXP_BASE wxLinuxDistributionInfo wxGetLinuxDistributionInfo(); WXDLLIMPEXP_BASE wxString wxNow(); // Return path where wxWidgets is installed (mostly useful in Unices) -WXDLLIMPEXP_BASE const wxChar *wxGetInstallPrefix(); +WXDLLIMPEXP_BASE wxString wxGetInstallPrefix(); // Return path to wxWin data (/usr/share/wx/%{version}) (Unices) WXDLLIMPEXP_BASE wxString wxGetDataDir(); diff --git a/src/common/utilscmn.cpp b/src/common/utilscmn.cpp index 05b6fa002f..bcfee48b33 100644 --- a/src/common/utilscmn.cpp +++ b/src/common/utilscmn.cpp @@ -182,12 +182,12 @@ void wxUsleep(unsigned long milliseconds) } #endif -const wxChar *wxGetInstallPrefix() +wxString wxGetInstallPrefix() { wxString prefix; if ( wxGetEnv(wxT("WXPREFIX"), &prefix) ) - return prefix.c_str(); + return prefix; #ifdef wxINSTALL_PREFIX return wxT(wxINSTALL_PREFIX); From b355e001491b60fd8add1002966fd3f54199b0cc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Va=CC=81clav=20Slavi=CC=81k?= Date: Mon, 5 Oct 2020 16:41:26 +0200 Subject: [PATCH 4/5] Only warn about missing WebKit extension when used Don't log failure to load the extension during initialization, because it isn't needed for many uses of wxWebView. Instead, only report the failure at the time when functionality depending on it is used. Also use g_warning() for logging consistently with other failures in this file. This doesn't interrupt the user, yet shows the problem highly visibly in the console. --- include/wx/gtk/webview_webkit.h | 1 + src/gtk/webview_webkit2.cpp | 70 ++++++++++++++++++--------------- 2 files changed, 40 insertions(+), 31 deletions(-) diff --git a/include/wx/gtk/webview_webkit.h b/include/wx/gtk/webview_webkit.h index acabc88e94..fccdfcd8d8 100644 --- a/include/wx/gtk/webview_webkit.h +++ b/include/wx/gtk/webview_webkit.h @@ -162,6 +162,7 @@ private: #if wxUSE_WEBVIEW_WEBKIT2 bool CanExecuteEditingCommand(const gchar* command) const; void SetupWebExtensionServer(); + GDBusProxy *GetExtensionProxy() const; bool RunScriptSync(const wxString& javascript, wxString* output = NULL); #endif diff --git a/src/gtk/webview_webkit2.cpp b/src/gtk/webview_webkit2.cpp index 72351dd8e5..43df84702b 100644 --- a/src/gtk/webview_webkit2.cpp +++ b/src/gtk/webview_webkit2.cpp @@ -399,6 +399,14 @@ static bool CheckDirectoryForWebExt(const wxString& dirname) return false; } +static wxString GetStandardWebExtensionsDir() +{ + wxString dir = wxDynamicLibrary::GetPluginsDirectory(); + if ( !dir.empty() ) + dir += "/web-extensions"; + return dir; +} + static void wxgtk_initialize_web_extensions(WebKitWebContext *context, GDBusServer *dbusServer) @@ -409,40 +417,23 @@ wxgtk_initialize_web_extensions(WebKitWebContext *context, // The first value is the location in which the extension is supposed to be // normally installed, while the other three are used as fallbacks to allow // running the tests and sample using wxWebView before installing it. - - wxString normalLocation = wxDynamicLibrary::GetPluginsDirectory(); - if ( !normalLocation.empty() ) - normalLocation += "/web-extensions"; - wxString const directories[] = { - normalLocation, + GetStandardWebExtensionsDir(), "..", "../..", "lib", }; - wxString dir; for ( size_t n = 0; n < WXSIZEOF(directories); ++n ) { if ( !directories[n].empty() && CheckDirectoryForWebExt(directories[n]) ) { - dir = directories[n]; + webkit_web_context_set_web_extensions_directory(context, directories[n].utf8_str()); break; } } - if ( !dir.empty() ) - { - webkit_web_context_set_web_extensions_directory(context, dir.utf8_str()); - } - else - { - wxLogWarning(_("Web extension not found in \"%s\", " - "some wxWebView functionality will be not available"), - directories[0]); - } - webkit_web_context_set_web_extensions_initialization_user_data(context, user_data); } @@ -1025,10 +1016,11 @@ bool wxWebViewWebKit::IsEditable() const void wxWebViewWebKit::DeleteSelection() { - if (m_extension) + GDBusProxy *extension = GetExtensionProxy(); + if (extension) { guint64 page_id = webkit_web_view_get_page_id(m_web_view); - GVariant *retval = g_dbus_proxy_call_sync(m_extension, + GVariant *retval = g_dbus_proxy_call_sync(extension, "DeleteSelection", g_variant_new("(t)", page_id), G_DBUS_CALL_FLAGS_NONE, -1, @@ -1042,10 +1034,11 @@ void wxWebViewWebKit::DeleteSelection() bool wxWebViewWebKit::HasSelection() const { - if (m_extension) + GDBusProxy *extension = GetExtensionProxy(); + if (extension) { guint64 page_id = webkit_web_view_get_page_id(m_web_view); - GVariant *retval = g_dbus_proxy_call_sync(m_extension, + GVariant *retval = g_dbus_proxy_call_sync(extension, "HasSelection", g_variant_new("(t)", page_id), G_DBUS_CALL_FLAGS_NONE, -1, @@ -1069,10 +1062,11 @@ void wxWebViewWebKit::SelectAll() wxString wxWebViewWebKit::GetSelectedText() const { - if (m_extension) + GDBusProxy *extension = GetExtensionProxy(); + if (extension) { guint64 page_id = webkit_web_view_get_page_id(m_web_view); - GVariant *retval = g_dbus_proxy_call_sync(m_extension, + GVariant *retval = g_dbus_proxy_call_sync(extension, "GetSelectedText", g_variant_new("(t)", page_id), G_DBUS_CALL_FLAGS_NONE, -1, @@ -1090,10 +1084,11 @@ wxString wxWebViewWebKit::GetSelectedText() const wxString wxWebViewWebKit::GetSelectedSource() const { - if (m_extension) + GDBusProxy *extension = GetExtensionProxy(); + if (extension) { guint64 page_id = webkit_web_view_get_page_id(m_web_view); - GVariant *retval = g_dbus_proxy_call_sync(m_extension, + GVariant *retval = g_dbus_proxy_call_sync(extension, "GetSelectedSource", g_variant_new("(t)", page_id), G_DBUS_CALL_FLAGS_NONE, -1, @@ -1111,10 +1106,11 @@ wxString wxWebViewWebKit::GetSelectedSource() const void wxWebViewWebKit::ClearSelection() { - if (m_extension) + GDBusProxy *extension = GetExtensionProxy(); + if (extension) { guint64 page_id = webkit_web_view_get_page_id(m_web_view); - GVariant *retval = g_dbus_proxy_call_sync(m_extension, + GVariant *retval = g_dbus_proxy_call_sync(extension, "ClearSelection", g_variant_new("(t)", page_id), G_DBUS_CALL_FLAGS_NONE, -1, @@ -1128,10 +1124,11 @@ void wxWebViewWebKit::ClearSelection() wxString wxWebViewWebKit::GetPageText() const { - if (m_extension) + GDBusProxy *extension = GetExtensionProxy(); + if (extension) { guint64 page_id = webkit_web_view_get_page_id(m_web_view); - GVariant *retval = g_dbus_proxy_call_sync(m_extension, + GVariant *retval = g_dbus_proxy_call_sync(extension, "GetPageText", g_variant_new("(t)", page_id), G_DBUS_CALL_FLAGS_NONE, -1, @@ -1415,4 +1412,15 @@ void wxWebViewWebKit::SetupWebExtensionServer() g_object_unref(observer); } +GDBusProxy *wxWebViewWebKit::GetExtensionProxy() const +{ + if (!m_extension) + { + g_warning("Web extension not found in \"%s\", " + "some wxWebView functionality will be not available", + (const char*)GetStandardWebExtensionsDir().utf8_str()); + } + return m_extension; +} + #endif // wxUSE_WEBVIEW && wxUSE_WEBVIEW_WEBKIT2 From 8756ff4320d6636d81c30c24c7afaee822be40fa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Va=CC=81clav=20Slavi=CC=81k?= Date: Thu, 8 Oct 2020 19:41:30 +0200 Subject: [PATCH 5/5] Don't load webkit extensions from CWD-relative paths wxgtk_initialize_web_extensions() tries to find extensions in the location where "make install" puts them. If that fails, either because wx wasn't installed yet, or it was deployed (e.g. in static build) without them, it looks into additional places - paths relative to CWD. This is to faciliate running wx samples and tests, but by being enabled in release builds too, it allowed loading unexpected executable code from untrusted locations. For example, on typical desktops, one could put malicious .so files into $HOME/lib to have them loaded by wxWebView-using applications. Address this by making the helper paths relative to the executable's location, not working directory. --- src/gtk/webview_webkit2.cpp | 44 ++++++++++++++++++++++++------------- 1 file changed, 29 insertions(+), 15 deletions(-) diff --git a/src/gtk/webview_webkit2.cpp b/src/gtk/webview_webkit2.cpp index 43df84702b..c507d4b64a 100644 --- a/src/gtk/webview_webkit2.cpp +++ b/src/gtk/webview_webkit2.cpp @@ -14,6 +14,7 @@ #include "wx/dir.h" #include "wx/dynlib.h" #include "wx/filename.h" +#include "wx/stdpaths.h" #include "wx/stockitem.h" #include "wx/gtk/webview_webkit.h" #include "wx/gtk/control.h" @@ -399,6 +400,15 @@ static bool CheckDirectoryForWebExt(const wxString& dirname) return false; } +static bool TrySetWebExtensionsDirectory(WebKitWebContext *context, const wxString& dir) +{ + if (dir.empty() || !CheckDirectoryForWebExt(dir)) + return false; + + webkit_web_context_set_web_extensions_directory(context, dir.utf8_str()); + return true; +} + static wxString GetStandardWebExtensionsDir() { wxString dir = wxDynamicLibrary::GetPluginsDirectory(); @@ -414,23 +424,27 @@ wxgtk_initialize_web_extensions(WebKitWebContext *context, const char *address = g_dbus_server_get_client_address(dbusServer); GVariant *user_data = g_variant_new("(s)", address); - // The first value is the location in which the extension is supposed to be - // normally installed, while the other three are used as fallbacks to allow - // running the tests and sample using wxWebView before installing it. - wxString const directories[] = + // Try to setup extension loading from the location it is supposed to be + // normally installed in. + if ( !TrySetWebExtensionsDirectory(context, GetStandardWebExtensionsDir()) ) { - GetStandardWebExtensionsDir(), - "..", - "../..", - "lib", - }; - - for ( size_t n = 0; n < WXSIZEOF(directories); ++n ) - { - if ( !directories[n].empty() && CheckDirectoryForWebExt(directories[n]) ) + // These relative locations are used as fallbacks to allow running + // the tests and sample using wxWebView before installing it. + wxString exepath = wxFileName(wxStandardPaths::Get().GetExecutablePath()).GetPath(); + if ( !exepath.empty() ) { - webkit_web_context_set_web_extensions_directory(context, directories[n].utf8_str()); - break; + wxString const directories[] = + { + exepath + "/..", + exepath + "/../..", + exepath + "/lib", + }; + + for ( size_t n = 0; n < WXSIZEOF(directories); ++n ) + { + if ( !TrySetWebExtensionsDirectory(context, directories[n]) ) + break; + } } }