diff --git a/CMakeLists.txt b/CMakeLists.txt index d801cbdaff..665d4f15e3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1620,6 +1620,24 @@ else() endif() endif() +if(APPLE) + # + # As https://developer.apple.com/library/archive/technotes/tn2206/_index.html + # says, + # + # "Note that a location where code is expected to reside cannot generally + # contain directories full of nested code, because those directories tend + # to be interpreted as bundles. So this occasional practice is not + # recommended and not officially supported. If you do do this, do not use + # periods in the directory names. The code signing machinery interprets + # directories with periods in their names as code bundles and will reject + # them if they don't conform to the expected code bundle layout." + # + set(PLUGIN_PATH_ID "${PROJECT_MAJOR_VERSION}-${PROJECT_MINOR_VERSION}") +else() + set(PLUGIN_PATH_ID "${PROJECT_MAJOR_VERSION}.${PROJECT_MINOR_VERSION}") +endif() + # Directory where plugins and Lua dissectors can be found. if(WIN32 AND NOT USE_MSYSTEM) set(PLUGIN_INSTALL_LIBDIR "plugins" CACHE INTERNAL "The plugin dir") @@ -1627,6 +1645,8 @@ else() set(PLUGIN_INSTALL_LIBDIR "${CMAKE_INSTALL_LIBDIR}/${PROJECT_NAME}/plugins" CACHE INTERNAL "The plugin dir") endif() set(PLUGIN_INSTALL_FULL_LIBDIR "${CMAKE_INSTALL_PREFIX}/${PLUGIN_INSTALL_LIBDIR}") +set(PLUGIN_INSTALL_VERSION_LIBDIR "${PLUGIN_INSTALL_LIBDIR}/${PLUGIN_PATH_ID}") +set(PLUGIN_VERSION_DIR "plugins/${PLUGIN_PATH_ID}") add_subdirectory( capture ) add_subdirectory( doc ) @@ -1779,22 +1799,22 @@ endif() if(ENABLE_APPLICATION_BUNDLE) if(CMAKE_CFG_INTDIR STREQUAL ".") - set(_plugin_dir "${CMAKE_BINARY_DIR}/run/Wireshark.app/Contents/PlugIns/wireshark") + set(_plugin_dir "${CMAKE_BINARY_DIR}/run/Wireshark.app/Contents/PlugIns/wireshark/${PLUGIN_PATH_ID}") else() # Xcode - set(_plugin_dir "${CMAKE_BINARY_DIR}/run/$/Wireshark.app/Contents/PlugIns/wireshark") + set(_plugin_dir "${CMAKE_BINARY_DIR}/run/$/Wireshark.app/Contents/PlugIns/wireshark/${PLUGIN_PATH_ID}") endif() if(CMAKE_CFG_INTDIR STREQUAL ".") - set(_logray_plugin_dir "${CMAKE_BINARY_DIR}/run/Logray.app/Contents/PlugIns/logray") + set(_logray_plugin_dir "${CMAKE_BINARY_DIR}/run/Logray.app/Contents/PlugIns/logray/${PLUGIN_PATH_ID}") else() # Xcode - set(_logray_plugin_dir "${CMAKE_BINARY_DIR}/run/$/Logray.app/Contents/PlugIns/logray") + set(_logray_plugin_dir "${CMAKE_BINARY_DIR}/run/$/Logray.app/Contents/PlugIns/logray/${PLUGIN_PATH_ID}") endif() elseif(MSVC AND NOT CMAKE_CFG_INTDIR STREQUAL ".") - set(_plugin_dir "${CMAKE_BINARY_DIR}/run/$/plugins") + set(_plugin_dir "${CMAKE_BINARY_DIR}/run/$/${PLUGIN_VERSION_DIR}") set(_logray_plugin_dir ${_plugin_dir}) else() - set(_plugin_dir "${DATAFILE_DIR}/plugins") + set(_plugin_dir "${DATAFILE_DIR}/${PLUGIN_VERSION_DIR}") set(_logray_plugin_dir ${_plugin_dir}) endif() set (PLUGIN_DIR ${_plugin_dir} CACHE INTERNAL "Build time plugin location.") @@ -4126,7 +4146,7 @@ configure_package_config_file(WiresharkConfig.cmake.in PATH_VARS CMAKE_INSTALL_LIBDIR CMAKE_INSTALL_INCLUDEDIR - PLUGIN_INSTALL_LIBDIR + PLUGIN_INSTALL_VERSION_LIBDIR EXTCAP_INSTALL_LIBDIR ) diff --git a/WiresharkConfig.cmake.in b/WiresharkConfig.cmake.in index 3e432690d4..d8981b8b2f 100644 --- a/WiresharkConfig.cmake.in +++ b/WiresharkConfig.cmake.in @@ -3,15 +3,8 @@ set(Wireshark_MINOR_VERSION @PROJECT_MINOR_VERSION@) set(Wireshark_PATCH_VERSION @PROJECT_PATCH_VERSION@) set(Wireshark_VERSION "@PROJECT_VERSION@") -set(Wireshark_ABI_VERSION_EPAN @PROJECT_ABI_VERSION_EPAN@) -set(Wireshark_ABI_VERSION_WIRETAP @PROJECT_ABI_VERSION_WIRETAP@) -set(Wireshark_ABI_VERSION_CODEC @PROJECT_ABI_VERSION_CODEC@) - set(Wireshark_PLUGINS_ENABLED @HAVE_PLUGINS@) -set(Wireshark_PLUGIN_SUFFIX_EPAN "${CMAKE_SHARED_MODULE_SUFFIX}.${Wireshark_ABI_VERSION_EPAN}") -set(Wireshark_PLUGIN_SUFFIX_WIRETAP "${CMAKE_SHARED_MODULE_SUFFIX}.${Wireshark_ABI_VERSION_WIRETAP}") -set(Wireshark_PLUGIN_SUFFIX_CODEC "${CMAKE_SHARED_MODULE_SUFFIX}.${Wireshark_ABI_VERSION_CODEC}") -set(Wireshark_PLUGIN_LIBDIR "@PLUGIN_INSTALL_LIBDIR@") +set(Wireshark_PLUGIN_LIBDIR "@PLUGIN_INSTALL_VERSION_LIBDIR@") @PACKAGE_INIT@ @@ -25,7 +18,9 @@ set_and_check(Wireshark_INCLUDE_DIR "@PACKAGE_CMAKE_INSTALL_INCLUDEDIR@/w # which is not helpful because the variable is correct, it's just that the empty directories # were not created (also correctly, empty directories are just noise). # -set(Wireshark_PLUGIN_INSTALL_DIR "@PACKAGE_PLUGIN_INSTALL_LIBDIR@") +if(Wireshark_PLUGINS_ENABLED) + set(Wireshark_PLUGIN_INSTALL_DIR "@PACKAGE_PLUGIN_INSTALL_VERSION_LIBDIR@") +endif() set(Wireshark_EXTCAP_INSTALL_DIR "@PACKAGE_EXTCAP_INSTALL_LIBDIR@") include("${CMAKE_CURRENT_LIST_DIR}/WiresharkTargets.cmake") diff --git a/cmake/modules/WiresharkPlugin.cmake b/cmake/modules/WiresharkPlugin.cmake index 4d8cd7a9f8..b8975d3989 100644 --- a/cmake/modules/WiresharkPlugin.cmake +++ b/cmake/modules/WiresharkPlugin.cmake @@ -28,7 +28,7 @@ macro(SET_MODULE_INFO _plugin _ver_major _ver_minor _ver_micro _ver_extra) add_definitions(-DPLUGIN_VERSION=\"${PLUGIN_VERSION}\") endmacro() -macro(ADD_PLUGIN_LIBRARY _plugin _output_dir _abi_version) +macro(ADD_PLUGIN_LIBRARY _plugin _output_dir) add_library(${_plugin} MODULE ${PLUGIN_FILES} ${PLUGIN_RC_FILE} @@ -38,7 +38,6 @@ macro(ADD_PLUGIN_LIBRARY _plugin _output_dir _abi_version) set_target_properties(${_plugin} PROPERTIES PREFIX "" - SUFFIX "${CMAKE_SHARED_MODULE_SUFFIX}.${_abi_version}" LINK_FLAGS "${WS_LINK_FLAGS}" FOLDER "Plugins" LIBRARY_OUTPUT_DIRECTORY ${_output_dir} @@ -52,25 +51,25 @@ macro(ADD_PLUGIN_LIBRARY _plugin _output_dir _abi_version) endmacro() macro(ADD_WIRESHARK_EPAN_PLUGIN_LIBRARY _plugin) - ADD_PLUGIN_LIBRARY(${_plugin} "${PLUGIN_DIR}/epan" ${PROJECT_ABI_VERSION_EPAN}) + ADD_PLUGIN_LIBRARY(${_plugin} "${PLUGIN_DIR}/epan") endmacro() macro(ADD_WIRESHARK_WIRETAP_PLUGIN_LIBRARY _plugin) - ADD_PLUGIN_LIBRARY(${_plugin} "${PLUGIN_DIR}/wiretap" ${PROJECT_ABI_VERSION_WIRETAP}) + ADD_PLUGIN_LIBRARY(${_plugin} "${PLUGIN_DIR}/wiretap") endmacro() macro(ADD_WIRESHARK_CODEC_PLUGIN_LIBRARY _plugin) - ADD_PLUGIN_LIBRARY(${_plugin} "${PLUGIN_DIR}/codecs" ${PROJECT_ABI_VERSION_CODEC}) + ADD_PLUGIN_LIBRARY(${_plugin} "${PLUGIN_DIR}/codecs") endmacro() macro(ADD_LOGRAY_EPAN_PLUGIN_LIBRARY _plugin) - ADD_PLUGIN_LIBRARY(${_plugin} "${LOGRAY_PLUGIN_DIR}/epan" ${PROJECT_ABI_VERSION_EPAN}) + ADD_PLUGIN_LIBRARY(${_plugin} "${LOGRAY_PLUGIN_DIR}/epan") endmacro() macro(INSTALL_PLUGIN _plugin _subfolder) install(TARGETS ${_plugin} - LIBRARY DESTINATION ${PLUGIN_INSTALL_LIBDIR}/${_subfolder} NAMELINK_SKIP - RUNTIME DESTINATION ${PLUGIN_INSTALL_LIBDIR} - ARCHIVE DESTINATION ${PLUGIN_INSTALL_LIBDIR} + LIBRARY DESTINATION ${PLUGIN_INSTALL_VERSION_LIBDIR}/${_subfolder} NAMELINK_SKIP + RUNTIME DESTINATION ${PLUGIN_INSTALL_VERSION_LIBDIR} + ARCHIVE DESTINATION ${PLUGIN_INSTALL_VERSION_LIBDIR} ) endmacro() diff --git a/cmakeconfig.h.in b/cmakeconfig.h.in index 38cd494b4f..d78e673524 100644 --- a/cmakeconfig.h.in +++ b/cmakeconfig.h.in @@ -19,10 +19,9 @@ /* Version number of Logray and associated utilities */ #define LOG_VERSION "${LOG_PROJECT_VERSION}${VERSION_EXTRA}" +#define PLUGIN_PATH_ID "${PLUGIN_PATH_ID}" #define VERSION_FLAVOR "${VERSION_FLAVOR}" -#define SHARED_MODULE_SUFFIX "${CMAKE_SHARED_MODULE_SUFFIX}" - /* Build wsutil with SIMD optimization */ #cmakedefine HAVE_SSE4_2 1 diff --git a/doc/plugins.example/CMakeLists.txt b/doc/plugins.example/CMakeLists.txt index a685ab37a2..26e3ad25c9 100644 --- a/doc/plugins.example/CMakeLists.txt +++ b/doc/plugins.example/CMakeLists.txt @@ -39,11 +39,7 @@ add_compile_definitions( ) add_library(hello MODULE hello.c) -set_target_properties(hello PROPERTIES - PREFIX "" - SUFFIX "${Wireshark_PLUGIN_SUFFIX_EPAN}" - DEFINE_SYMBOL "" -) +set_target_properties(hello PROPERTIES PREFIX "" DEFINE_SYMBOL "") target_link_libraries(hello epan) # This is the normal installation target to CMAKE_INSTALL_PREFIX. It is relocatable diff --git a/doc/release-notes.adoc b/doc/release-notes.adoc index ad8b74b00e..9bccd7242a 100644 --- a/doc/release-notes.adoc +++ b/doc/release-notes.adoc @@ -179,11 +179,6 @@ The following features are new (or have been significantly updated) since versio * The personal binary plugins folder now has higher priority than the global folder. -* The binary plugins folder path no longer uses an X.Y version component. Plugins - are required to add the ABI version to the file name. - -* Truncated fields in the detail view are now displayed as "Field name […]: data" instead of "Field name [truncated]: data" - * When capturing files in multiple file mode, a pattern that places the date and time before the index number can be used (e.g., foo_20240714110102_00001.pcap instead of foo_00001_20240714110102.pcap). This causes filenames to sort in chronological order diff --git a/docbook/wsug_src/wsug_files.adoc b/docbook/wsug_src/wsug_files.adoc index c64162530b..3c4364bbce 100644 --- a/docbook/wsug_src/wsug_files.adoc +++ b/docbook/wsug_src/wsug_files.adoc @@ -551,16 +551,12 @@ machine code. Wireshark looks for plugins in both a personal plugin folder and a global plugin folder. Lua plugins are stored in the plugin folders; compiled plugins are stored in subfolders of the plugin folders, with -the subfolder name being the plugin binary type. Each Wireshark binary plugin -has one of three distinct types (libwireshark, libwiretap and codecs). -So for example the location for a libwireshark plugin -_foo.so_ (_foo.dll_ on Windows) would be _PLUGINDIR/epan_ -(libwireshark used to be called libepan), for libwiretap it would be -_PLUGINDIR/wiretap_ and for codecs _PLUGINDIR/codecs_. - -Plugins should come with the ABI version appended to the filename, so the -complete example for an epan binary plugin would be _PLUGINDIR/epan_/foo.so.1_ -for epan ABI version 1. +the subfolder name being the Wireshark minor version number (X.Y). There is +another hierarchical level for each Wireshark plugin type (libwireshark, +libwiretap and codecs). So for example the location for a libwireshark plugin +_foo.so_ (_foo.dll_ on Windows) would be _PLUGINDIR/X.Y/epan_ +(libwireshark used to be called libepan; the other folder names are _codecs_ +and _wiretap_). On Windows: diff --git a/packaging/macosx/osx-app.sh.in b/packaging/macosx/osx-app.sh.in index fa146e52ad..0bd0b9323a 100755 --- a/packaging/macosx/osx-app.sh.in +++ b/packaging/macosx/osx-app.sh.in @@ -145,7 +145,7 @@ app_lower=$(echo "$app_name" | tr '[:upper:]' '[:lower:]') pkgexec="$bundle/Contents/MacOS" #pkgres="$bundle/Contents/Resources" pkglib="$bundle/Contents/Frameworks" -pkgplugin="$bundle/Contents/PlugIns/$app_lower" +pkgplugin="$bundle/Contents/PlugIns/$app_lower/@PLUGIN_PATH_ID@" # Set the 'macosx' directory, usually the current directory. #resdir=$( pwd ) diff --git a/packaging/nsis/custom_plugins.txt b/packaging/nsis/custom_plugins.txt index 6c71b57dc5..12338056e7 100644 --- a/packaging/nsis/custom_plugins.txt +++ b/packaging/nsis/custom_plugins.txt @@ -1,3 +1,3 @@ ;Add your custom plugins directives here ; Example: -;File "${STAGING_DIR}\plugins\epan\foo.dll.${ABI_VERSION_EPAN}" +;File "${STAGING_DIR}\plugins\${MAJOR_VERSION}.${MINOR_VERSION}\epan\foo.dll" diff --git a/packaging/nsis/logray-config.nsh.in b/packaging/nsis/logray-config.nsh.in index 0bac1e1c56..93d8a08893 100644 --- a/packaging/nsis/logray-config.nsh.in +++ b/packaging/nsis/logray-config.nsh.in @@ -11,9 +11,6 @@ #define EXTRA_INSTALLER_DIR "@EXTRA_INSTALLER_DIR@" #define VERSION @LOG_PROJECT_VERSION@ #define PRODUCT_VERSION @LOG_PRODUCT_VERSION@ -#define ABI_VERSION_EPAN @PROJECT_ABI_VERSION_EPAN@ -#define ABI_VERSION_WIRETAP @PROJECT_ABI_VERSION_WIRETAP@ -#define ABI_VERSION_CODEC @PROJECT_ABI_VERSION_CODEC@ # Plugins #define MAJOR_VERSION @PROJECT_MAJOR_VERSION@ #define MINOR_VERSION @PROJECT_MINOR_VERSION@ diff --git a/packaging/nsis/logray.nsi b/packaging/nsis/logray.nsi index de9de973f5..d6946ecf15 100644 --- a/packaging/nsis/logray.nsi +++ b/packaging/nsis/logray.nsi @@ -880,19 +880,19 @@ SectionEnd Section "-Plugins & Extensions" ;------------------------------------------- -SetOutPath '$INSTDIR\plugins\epan' -File "${STAGING_DIR}\plugins\epan\falco-bridge.dll.${ABI_VERSION_EPAN}" +SetOutPath '$INSTDIR\plugins\${MAJOR_VERSION}.${MINOR_VERSION}\epan' +File "${STAGING_DIR}\plugins\${MAJOR_VERSION}.${MINOR_VERSION}\epan\falco-bridge.dll" SetOutPath '$INSTDIR\plugins\falco' File "${STAGING_DIR}\plugins\falco\cloudtrail.dll" !include "custom_plugins.txt" ;------------------------------------------- -SetOutPath '$INSTDIR\plugins\epan' -File "${STAGING_DIR}\plugins\epan\stats_tree.dll.${ABI_VERSION_EPAN}" +SetOutPath '$INSTDIR\plugins\${MAJOR_VERSION}.${MINOR_VERSION}\epan' +File "${STAGING_DIR}\plugins\${MAJOR_VERSION}.${MINOR_VERSION}\epan\stats_tree.dll" ;------------------------------------------- -SetOutPath '$INSTDIR\plugins\epan' -File "${STAGING_DIR}\plugins\epan\mate.dll.${ABI_VERSION_EPAN}" +SetOutPath '$INSTDIR\plugins\${MAJOR_VERSION}.${MINOR_VERSION}\epan' +File "${STAGING_DIR}\plugins\${MAJOR_VERSION}.${MINOR_VERSION}\epan\mate.dll" ;------------------------------------------- ; This should be a function or macro diff --git a/packaging/nsis/wireshark-config.nsh.in b/packaging/nsis/wireshark-config.nsh.in index 0e3b0b13ab..10485cca03 100644 --- a/packaging/nsis/wireshark-config.nsh.in +++ b/packaging/nsis/wireshark-config.nsh.in @@ -16,10 +16,6 @@ #define MINOR_VERSION @PROJECT_MINOR_VERSION@ #define PRODUCT_VERSION @PRODUCT_VERSION@ -#define ABI_VERSION_EPAN @PROJECT_ABI_VERSION_EPAN@ -#define ABI_VERSION_WIRETAP @PROJECT_ABI_VERSION_WIRETAP@ -#define ABI_VERSION_CODEC @PROJECT_ABI_VERSION_CODEC@ - #define VCREDIST_DIR "@VCREDIST_DIR@" #define VCREDIST_EXE "@VCREDIST_EXE@" diff --git a/packaging/nsis/wireshark.nsi b/packaging/nsis/wireshark.nsi index 23ddb071ce..d86e0e3efd 100644 --- a/packaging/nsis/wireshark.nsi +++ b/packaging/nsis/wireshark.nsi @@ -1040,24 +1040,24 @@ SectionEnd Section "-Plugins & Extensions" -SetOutPath '$INSTDIR\plugins\codecs' -File "${STAGING_DIR}\plugins\codecs\g711.dll.${ABI_VERSION_CODEC}" +SetOutPath '$INSTDIR\plugins\${MAJOR_VERSION}.${MINOR_VERSION}\codecs' +File "${STAGING_DIR}\plugins\${MAJOR_VERSION}.${MINOR_VERSION}\codecs\g711.dll" !ifdef SPANDSP_FOUND -File "${STAGING_DIR}\plugins\codecs\g722.dll.${ABI_VERSION_CODEC}" -File "${STAGING_DIR}\plugins\codecs\g726.dll.${ABI_VERSION_CODEC}" +File "${STAGING_DIR}\plugins\${MAJOR_VERSION}.${MINOR_VERSION}\codecs\g722.dll" +File "${STAGING_DIR}\plugins\${MAJOR_VERSION}.${MINOR_VERSION}\codecs\g726.dll" !endif !ifdef BCG729_FOUND -File "${STAGING_DIR}\plugins\codecs\g729.dll.${ABI_VERSION_CODEC}" +File "${STAGING_DIR}\plugins\${MAJOR_VERSION}.${MINOR_VERSION}\codecs\g729.dll" !endif -File "${STAGING_DIR}\plugins\codecs\l16mono.dll.${ABI_VERSION_CODEC}" +File "${STAGING_DIR}\plugins\${MAJOR_VERSION}.${MINOR_VERSION}\codecs\l16mono.dll" !ifdef SBC_FOUND -File "${STAGING_DIR}\plugins\codecs\sbc.dll.${ABI_VERSION_CODEC}" +File "${STAGING_DIR}\plugins\${MAJOR_VERSION}.${MINOR_VERSION}\codecs\sbc.dll" !endif !ifdef ILBC_FOUND -File "${STAGING_DIR}\plugins\codecs\ilbc.dll.${ABI_VERSION_CODEC}" +File "${STAGING_DIR}\plugins\${MAJOR_VERSION}.${MINOR_VERSION}\codecs\ilbc.dll" !endif !ifdef OPUS_FOUND -File "${STAGING_DIR}\plugins\codecs\opus_dec.dll.${ABI_VERSION_CODEC}" +File "${STAGING_DIR}\plugins\${MAJOR_VERSION}.${MINOR_VERSION}\codecs\opus_dec.dll" !endif ; This should be a function or macro @@ -1069,23 +1069,23 @@ File "${STAGING_DIR}\profiles\Classic\colorfilters" SetOutPath '$INSTDIR\profiles\No Reassembly' File "${STAGING_DIR}\profiles\No Reassembly\preferences" -SetOutPath '$INSTDIR\plugins\epan' -File "${STAGING_DIR}\plugins\epan\ethercat.dll.${ABI_VERSION_EPAN}" -File "${STAGING_DIR}\plugins\epan\gryphon.dll.${ABI_VERSION_EPAN}" -File "${STAGING_DIR}\plugins\epan\irda.dll.${ABI_VERSION_EPAN}" -File "${STAGING_DIR}\plugins\epan\opcua.dll.${ABI_VERSION_EPAN}" -File "${STAGING_DIR}\plugins\epan\profinet.dll.${ABI_VERSION_EPAN}" -File "${STAGING_DIR}\plugins\epan\unistim.dll.${ABI_VERSION_EPAN}" -File "${STAGING_DIR}\plugins\epan\wimax.dll.${ABI_VERSION_EPAN}" -File "${STAGING_DIR}\plugins\epan\wimaxasncp.dll.${ABI_VERSION_EPAN}" -File "${STAGING_DIR}\plugins\epan\wimaxmacphy.dll.${ABI_VERSION_EPAN}" +SetOutPath '$INSTDIR\plugins\${MAJOR_VERSION}.${MINOR_VERSION}\epan' +File "${STAGING_DIR}\plugins\${MAJOR_VERSION}.${MINOR_VERSION}\epan\ethercat.dll" +File "${STAGING_DIR}\plugins\${MAJOR_VERSION}.${MINOR_VERSION}\epan\gryphon.dll" +File "${STAGING_DIR}\plugins\${MAJOR_VERSION}.${MINOR_VERSION}\epan\irda.dll" +File "${STAGING_DIR}\plugins\${MAJOR_VERSION}.${MINOR_VERSION}\epan\opcua.dll" +File "${STAGING_DIR}\plugins\${MAJOR_VERSION}.${MINOR_VERSION}\epan\profinet.dll" +File "${STAGING_DIR}\plugins\${MAJOR_VERSION}.${MINOR_VERSION}\epan\unistim.dll" +File "${STAGING_DIR}\plugins\${MAJOR_VERSION}.${MINOR_VERSION}\epan\wimax.dll" +File "${STAGING_DIR}\plugins\${MAJOR_VERSION}.${MINOR_VERSION}\epan\wimaxasncp.dll" +File "${STAGING_DIR}\plugins\${MAJOR_VERSION}.${MINOR_VERSION}\epan\wimaxmacphy.dll" !include "custom_plugins.txt" -SetOutPath '$INSTDIR\plugins\wiretap' -File "${STAGING_DIR}\plugins\wiretap\usbdump.dll.${ABI_VERSION_WIRETAP}" +SetOutPath '$INSTDIR\plugins\${MAJOR_VERSION}.${MINOR_VERSION}\wiretap' +File "${STAGING_DIR}\plugins\${MAJOR_VERSION}.${MINOR_VERSION}\wiretap\usbdump.dll" -SetOutPath '$INSTDIR\plugins\epan' -File "${STAGING_DIR}\plugins\epan\mate.dll.${ABI_VERSION_EPAN}" +SetOutPath '$INSTDIR\plugins\${MAJOR_VERSION}.${MINOR_VERSION}\epan' +File "${STAGING_DIR}\plugins\${MAJOR_VERSION}.${MINOR_VERSION}\epan\mate.dll" !ifdef SMI_DIR SetOutPath '$INSTDIR\snmp\mibs' @@ -1098,11 +1098,11 @@ File "${SMI_DIR}\share\yang\*.yang" !include "custom_mibs.txt" !endif -SetOutPath '$INSTDIR\plugins\epan' -File "${STAGING_DIR}\plugins\epan\transum.dll.${ABI_VERSION_EPAN}" +SetOutPath '$INSTDIR\plugins\${MAJOR_VERSION}.${MINOR_VERSION}\epan' +File "${STAGING_DIR}\plugins\${MAJOR_VERSION}.${MINOR_VERSION}\epan\transum.dll" -SetOutPath '$INSTDIR\plugins\epan' -File "${STAGING_DIR}\plugins\epan\stats_tree.dll.${ABI_VERSION_EPAN}" +SetOutPath '$INSTDIR\plugins\${MAJOR_VERSION}.${MINOR_VERSION}\epan' +File "${STAGING_DIR}\plugins\${MAJOR_VERSION}.${MINOR_VERSION}\epan\stats_tree.dll" SectionEnd ; "Plugins / Extensions" diff --git a/packaging/wix/CMakeLists.txt b/packaging/wix/CMakeLists.txt index 60178a2655..0c74fba863 100644 --- a/packaging/wix/CMakeLists.txt +++ b/packaging/wix/CMakeLists.txt @@ -188,9 +188,8 @@ set(WIX_CANDLE_DEFINES -dPlatform=${WIRESHARK_TARGET_PLATFORM} -dWiresharkName=${CMAKE_PROJECT_NAME} -dWiresharkVersion=${PRODUCT_VERSION} - -dWiresharkAbiVersionEpan=${PROJECT_ABI_VERSION_EPAN} - -dWiresharkAbiVersionWtap=${PROJECT_ABI_VERSION_WIRETAP} - -dWiresharkAbiVersionCodec=${PROJECT_ABI_VERSION_CODEC} + -dWiresharkMajorVersion=${PROJECT_MAJOR_VERSION} + -dWiresharkMinorVersion=${PROJECT_MINOR_VERSION} -dAssetDir=${CMAKE_SOURCE_DIR}/packaging/wix -dBuildOutputDir=${EXECUTABLE_OUTPUT_PATH}/${CMAKE_CFG_INTDIR} -dDiameterDir=${ARCHIVE_OUTPUT_PATH}/${CMAKE_CFG_INTDIR}/diameter diff --git a/packaging/wix/Plugins.wxi b/packaging/wix/Plugins.wxi index 594603a777..0b53cf485a 100644 --- a/packaging/wix/Plugins.wxi +++ b/packaging/wix/Plugins.wxi @@ -5,31 +5,31 @@ - + - + - + - + - + - + - + - + - + @@ -53,7 +53,7 @@ - + @@ -67,7 +67,7 @@ - + @@ -81,7 +81,7 @@ - + @@ -95,7 +95,7 @@ - + @@ -109,28 +109,28 @@ - + - + - + - + - + - + - + - + diff --git a/resources/wireshark.pc.in b/resources/wireshark.pc.in index 4287aca639..212d4ec311 100644 --- a/resources/wireshark.pc.in +++ b/resources/wireshark.pc.in @@ -3,7 +3,7 @@ exec_prefix=${prefix} libdir=${prefix}/@CMAKE_INSTALL_LIBDIR@ includedir=${prefix}/@CMAKE_INSTALL_INCLUDEDIR@ sharedlibdir=${libdir} -plugindir=${libdir}/wireshark/plugins +plugindir=${libdir}/wireshark/@PLUGIN_VERSION_DIR@ Name: Wireshark Description: Network Protocol Analyzer (Packet Dissection Library) diff --git a/tshark.c b/tshark.c index 64a044de61..3a63f1702a 100644 --- a/tshark.c +++ b/tshark.c @@ -797,13 +797,13 @@ about_folders(void) constpath = get_progfile_dir(); printf("%-21s\t%s\n", "Program:", constpath); - if (plugins_supported()) { - /* pers plugins */ - printf("%-21s\t%s\n", "Personal Plugins:", get_plugins_pers_dir()); +#ifdef HAVE_PLUGINS + /* pers plugins */ + printf("%-21s\t%s\n", "Personal Plugins:", get_plugins_pers_dir_with_version()); - /* global plugins */ - printf("%-21s\t%s\n", "Global Plugins:", get_plugins_dir()); - } + /* global plugins */ + printf("%-21s\t%s\n", "Global Plugins:", get_plugins_dir_with_version()); +#endif #ifdef HAVE_LUA /* pers lua plugins */ diff --git a/ui/qt/about_dialog.cpp b/ui/qt/about_dialog.cpp index 9f4d556b93..ee1cd7e57d 100644 --- a/ui/qt/about_dialog.cpp +++ b/ui/qt/about_dialog.cpp @@ -264,13 +264,13 @@ FolderListModel::FolderListModel(QObject * parent): /* program */ appendRow(QStringList() << tr("Program") << get_progfile_dir() << tr("Program files")); - if (plugins_supported()) { - /* pers plugins */ - appendRow(QStringList() << tr("Personal Plugins") << get_plugins_pers_dir() << tr("Binary plugins")); +#ifdef HAVE_PLUGINS + /* pers plugins */ + appendRow(QStringList() << tr("Personal Plugins") << get_plugins_pers_dir_with_version() << tr("Binary plugins")); - /* global plugins */ - appendRow(QStringList() << tr("Global Plugins") << get_plugins_dir() << tr("Binary plugins")); - } + /* global plugins */ + appendRow(QStringList() << tr("Global Plugins") << get_plugins_dir_with_version() << tr("Binary plugins")); +#endif #ifdef HAVE_LUA /* pers plugins */ diff --git a/ui/qt/wireshark_main_window.cpp b/ui/qt/wireshark_main_window.cpp index 14c97d389e..11bd0c1f82 100644 --- a/ui/qt/wireshark_main_window.cpp +++ b/ui/qt/wireshark_main_window.cpp @@ -3180,7 +3180,7 @@ void WiresharkMainWindow::installPersonalBinaryPlugin() QString caption = mainApp->windowTitleString(tr("Install plugin")); // Get the plugin file path to install - QString plugin_filter = tr("Binary plugin (*%1 *%1.[0-9]*)").arg(WS_PLUGIN_MODULE_SUFFIX); + QString plugin_filter = tr("Binary plugin (*%1)").arg(WS_PLUGIN_MODULE_SUFFIX); QString src_path = WiresharkFileDialog::getOpenFileName(this, caption, "", plugin_filter); if (src_path.isEmpty()) { return; @@ -3220,10 +3220,6 @@ void WiresharkMainWindow::installPersonalBinaryPlugin() // a way to load and unload plugins without having to restart the program. QFileInfo file_info(src_path); QString file_name = file_info.fileName(); - if (file_name.endsWith(WS_PLUGIN_MODULE_SUFFIX)) { - // Append the version to our destination name - file_name = QString("%1.%2").arg(file_name).arg(plugins_abi_version(have_type)); - } if (type_dir.exists(file_name)) { reply = QMessageBox::question(this, caption, tr("The file already exists. Do you want to overwrite it?")); diff --git a/wsutil/filesystem.c b/wsutil/filesystem.c index ef2199382a..099239ba1b 100644 --- a/wsutil/filesystem.c +++ b/wsutil/filesystem.c @@ -1154,7 +1154,9 @@ get_doc_dir(void) * configure script. */ static char *plugin_dir; +static char *plugin_dir_with_version; static char *plugin_pers_dir; +static char *plugin_pers_dir_with_version; static char *extcap_pers_dir; static void @@ -1240,6 +1242,16 @@ get_plugins_dir(void) return plugin_dir; } +const char * +get_plugins_dir_with_version(void) +{ + if (!plugin_dir) + init_plugin_dir(); + if (plugin_dir && !plugin_dir_with_version) + plugin_dir_with_version = g_build_filename(plugin_dir, PLUGIN_PATH_ID, (char *)NULL); + return plugin_dir_with_version; +} + /* Get the personal plugin dir */ const char * get_plugins_pers_dir(void) @@ -1249,6 +1261,16 @@ get_plugins_pers_dir(void) return plugin_pers_dir; } +const char * +get_plugins_pers_dir_with_version(void) +{ + if (!plugin_pers_dir) + init_plugin_pers_dir(); + if (plugin_pers_dir && !plugin_pers_dir_with_version) + plugin_pers_dir_with_version = g_build_filename(plugin_pers_dir, PLUGIN_PATH_ID, (char *)NULL); + return plugin_pers_dir_with_version; +} + /* * Find the directory where the extcap hooks are stored. * @@ -2674,8 +2696,12 @@ free_progdirs(void) #if defined(HAVE_PLUGINS) || defined(HAVE_LUA) g_free(plugin_dir); plugin_dir = NULL; + g_free(plugin_dir_with_version); + plugin_dir_with_version = NULL; g_free(plugin_pers_dir); plugin_pers_dir = NULL; + g_free(plugin_pers_dir_with_version); + plugin_pers_dir_with_version = NULL; #endif g_free(extcap_dir); extcap_dir = NULL; diff --git a/wsutil/filesystem.h b/wsutil/filesystem.h index 9cd0d1c0d3..c3e139d1ff 100644 --- a/wsutil/filesystem.h +++ b/wsutil/filesystem.h @@ -80,11 +80,21 @@ WS_DLL_PUBLIC char *get_executable_path(const char *filename); */ WS_DLL_PUBLIC const char *get_plugins_dir(void); +/* + * Append VERSION_MAJOR.VERSION_MINOR to the plugin dir. + */ +WS_DLL_PUBLIC const char *get_plugins_dir_with_version(void); + /* * Get the personal plugin dir. */ WS_DLL_PUBLIC const char *get_plugins_pers_dir(void); +/* + * Append VERSION_MAJOR.VERSION_MINOR to the plugin personal dir. + */ +WS_DLL_PUBLIC const char *get_plugins_pers_dir_with_version(void); + /* * Get the directory in which extcap hooks are stored; this must not be called * before configuration_init() is called, as they might be stored in a diff --git a/wsutil/plugins.c b/wsutil/plugins.c index fb54b0f6f7..d737fe0eb0 100644 --- a/wsutil/plugins.c +++ b/wsutil/plugins.c @@ -130,14 +130,12 @@ scan_plugins_dir(GHashTable *plugins_module, const char *dirpath, const char *name; /* current file name */ char *plugin_folder; char *plugin_file; /* current file full path */ - char *plugin_ext; /* plugin file extension */ GModule *handle; /* handle returned by g_module_open */ void *symbol; plugin *new_plug; plugin_type_e have_type; int abi_version; struct ws_module *module; - char *s; plugin_folder = g_build_filename(dirpath, type_to_dir(type), (char *)NULL); @@ -147,13 +145,11 @@ scan_plugins_dir(GHashTable *plugins_module, const char *dirpath, return; } - plugin_ext = plugins_file_suffix(type); - - ws_debug("Scanning plugins folder \"%s\" for *%s", plugin_folder, plugin_ext); + ws_debug("Scanning plugins folder \"%s\"", plugin_folder); while ((name = g_dir_read_name(dir)) != NULL) { /* Skip anything but files with .dll or .so. */ - if (!g_str_has_suffix(name, plugin_ext)) + if (!g_str_has_suffix(name, WS_PLUGIN_MODULE_SUFFIX)) continue; plugin_file = g_build_filename(plugin_folder, name, (char *)NULL); @@ -223,20 +219,14 @@ DIAG_ON_PEDANTIC new_plug->module = module; new_plug->scope = scope; - // Strip version from plugin display name - s = strrchr(new_plug->name, '.'); - if (s != NULL && g_ascii_isdigit(*(s+1))) - *s = '\0'; - /* Add it to the list of plugins. */ - g_hash_table_replace(plugins_module, g_strdup(name), new_plug); + g_hash_table_replace(plugins_module, new_plug->name, new_plug); ws_info("Registered plugin: %s (%s)", new_plug->name, plugin_file); ws_debug("plugin '%s' meta data: version = %s, flags = 0x%"PRIu32", spdx = %s, blurb = %s", name, module->version, module->flags, module->spdx_id, module->blurb); g_free(plugin_file); } ws_dir_close(dir); - wmem_free(NULL, plugin_ext); g_free(plugin_folder); } @@ -249,7 +239,7 @@ plugins_init(plugin_type_e type) if (!plugins_supported()) return NULL; /* nothing to do */ - GHashTable *plugins_module = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, free_plugin); + GHashTable *plugins_module = g_hash_table_new_full(g_str_hash, g_str_equal, NULL, free_plugin); /* Scan the users plugins directory first, giving it priority over the * global plugins folder. Only scan it if we weren't started with special @@ -259,7 +249,7 @@ plugins_init(plugin_type_e type) * if we need privileges to start capturing, we'd need to * reclaim them before each time we start capturing.) */ - const char *user_dir = get_plugins_pers_dir(); + const char *user_dir = get_plugins_pers_dir_with_version(); if (!started_with_special_privs()) { scan_plugins_dir(plugins_module, user_dir, type, WS_PLUGIN_SCOPE_USER); } @@ -272,7 +262,7 @@ plugins_init(plugin_type_e type) * Scan the global plugin directory. Make sure we don't scan the same directory * twice (under some unusual install configurations). */ - const char *global_dir = get_plugins_dir(); + const char *global_dir = get_plugins_dir_with_version(); if (strcmp(global_dir, user_dir) != 0) { scan_plugins_dir(plugins_module, global_dir, type, WS_PLUGIN_SCOPE_GLOBAL); } @@ -402,16 +392,10 @@ DIAG_ON_PEDANTIC char * plugins_pers_type_folder(plugin_type_e type) { - return g_build_filename(get_plugins_pers_dir(), + return g_build_filename(get_plugins_pers_dir_with_version(), type_to_dir(type), (const char *)NULL); } -char * -plugins_file_suffix(plugin_type_e type) -{ - return ws_strdup_printf("%s.%d", WS_PLUGIN_MODULE_SUFFIX, plugins_abi_version(type)); -} - int plugins_abi_version(plugin_type_e type) { diff --git a/wsutil/plugins.h b/wsutil/plugins.h index fcd1a436bf..f9d7003e5d 100644 --- a/wsutil/plugins.h +++ b/wsutil/plugins.h @@ -41,9 +41,8 @@ typedef enum { #define WS_PLUGIN_DESC_TAP_LISTENER (1UL << 4) #define WS_PLUGIN_DESC_DFUNCTION (1UL << 5) -#if defined(SHARED_MODULE_SUFFIX) -#define WS_PLUGIN_MODULE_SUFFIX SHARED_MODULE_SUFFIX -#elif defined(_WIN32) +// GLib and Qt allow ".dylib" and ".so" on macOS. Should we do the same? +#ifdef _WIN32 #define WS_PLUGIN_MODULE_SUFFIX ".dll" #else #define WS_PLUGIN_MODULE_SUFFIX ".so" @@ -92,8 +91,6 @@ WS_DLL_PUBLIC plugin_type_e plugins_check_file(const char *path); WS_DLL_PUBLIC char *plugins_pers_type_folder(plugin_type_e type); -WS_DLL_PUBLIC char *plugins_file_suffix(plugin_type_e type); - WS_DLL_PUBLIC int plugins_abi_version(plugin_type_e type);