Packaging: Add initial support for AppImage.
Add an "appimage" target that will create an AppImage package. Current AppImage tools assume that you only have one executable, so add a custom AppRun wrapper that will let you run our associated CLI utilities via symlinks, e.g. ln -s ./Wireshark-3.2.1-x86.appimage capinfos ./capinfos --help Packaging requires both linuxdeployqt and appimagetool, although we might be able to reduce this to just linuxdeployqt: https://github.com/probonopd/linuxdeployqt https://github.com/AppImage/AppImageKit I haven't done much testing beyond running Wireshark and capinfos. There are undoubtedly issues that need to be fixed. Bug: 14464 Change-Id: Ic004ba1962e6a8630ebb017349d9b2c0462fd5fe Reviewed-on: https://code.wireshark.org/review/30953 Reviewed-by: Gerald Combs <gerald@wireshark.org>
This commit is contained in:
parent
3a7df1eded
commit
4d6509854c
|
@ -2721,6 +2721,11 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
|
|||
find_program(RPMBUILD_EXECUTABLE rpmbuild)
|
||||
find_program(DPKG_BUILDPACKAGE_EXECUTABLE dpkg-buildpackage)
|
||||
find_program(GIT_EXECUTABLE git)
|
||||
# Should we add appimaged's monitored directories
|
||||
# as HINTS?
|
||||
# https://github.com/AppImage/appimaged
|
||||
find_program(LINUXDEPLOYQT_EXECUTABLE linuxdeployqt)
|
||||
find_program(APPIMAGETOOL_EXECUTABLE appimagetool)
|
||||
endif()
|
||||
|
||||
function(_SET_GITVERSION_CMAKE_VARIABLE OUTPUT_VARIABLE)
|
||||
|
@ -2825,6 +2830,54 @@ if(DPKG_BUILDPACKAGE_EXECUTABLE)
|
|||
)
|
||||
endif()
|
||||
|
||||
if(LINUXDEPLOYQT_EXECUTABLE AND APPIMAGETOOL_EXECUTALBE)
|
||||
# The documentation at https://github.com/probonopd/linuxdeployqt
|
||||
# says that you need to set CMAKE_BUILD_TYPE=Release and
|
||||
# CMAKE_INSTALL_PREFIX=/usr. I (gcc) also had to set
|
||||
# CMAKE_INSTALL_LIBDIR=/usr/lib.
|
||||
if (CMAKE_BUILD_TYPE STREQUAL "Release" AND CMAKE_INSTALL_PREFIX STREQUAL "/usr" AND CMAKE_INSTALL_LIBDIR STREQUAL "/usr/lib" )
|
||||
add_custom_target(appimage-prerequisites)
|
||||
add_dependencies(appimage-prerequisites ${PROGLIST})
|
||||
else()
|
||||
add_custom_target(appimage-prerequisites
|
||||
COMMAND echo "CMAKE_BUILD_TYPE isn't Release or CMAKE_INSTALL_PREFIX isn't /usr or CMAKE_INSTALL_LIBDIR isn't /usr/lib."
|
||||
COMMAND false
|
||||
)
|
||||
endif()
|
||||
set (_ai_appdir "${CMAKE_BINARY_DIR}/packaging/appimage/appdir")
|
||||
add_custom_target(appimage-appdir
|
||||
COMMAND ${CMAKE_COMMAND} -E make_directory "${_ai_appdir}"
|
||||
COMMAND env DESTDIR=${_ai_appdir}
|
||||
${CMAKE_COMMAND} --build . --target install
|
||||
DEPENDS appimage-prerequisites
|
||||
)
|
||||
set(_exe_args)
|
||||
foreach(_prog ${PROGLIST})
|
||||
# XXX Is this the correct path?
|
||||
list(APPEND _exe_args "-executable=${_ai_appdir}/usr/bin/${_prog}")
|
||||
endforeach()
|
||||
# linuxdeployqt currently clobbers AppRun:
|
||||
# https://github.com/probonopd/linuxdeployqt/issues/159
|
||||
# When that's fixed we will no longer need appimagetool. Until
|
||||
# then, we need to prep and package in two steps:
|
||||
# https://github.com/probonopd/linuxdeployqt/wiki/Custom-wrapper-script-instead-of-AppRun
|
||||
add_custom_target(appimage-prep
|
||||
COMMAND ${LINUXDEPLOYQT_EXECUTABLE}
|
||||
"${_ai_appdir}/usr/share/applications/wireshark.desktop"
|
||||
${_exe_args}
|
||||
COMMAND rm -f "${_ai_appdir}/AppRun"
|
||||
COMMAND install
|
||||
"${CMAKE_SOURCE_DIR}/packaging/appimage/AppRun"
|
||||
"${_ai_appdir}/AppRun"
|
||||
DEPENDS appimage-appdir
|
||||
)
|
||||
add_custom_target(appimage
|
||||
COMMAND env VERSION=${PROJECT_VERSION} ${APPIMAGETOOL_EXECUTABLE} appdir
|
||||
WORKING_DIRECTORY "${CMAKE_BINARY_DIR}/packaging/appimage"
|
||||
DEPENDS appimage-prep
|
||||
)
|
||||
endif()
|
||||
|
||||
set(CLEAN_C_FILES
|
||||
${dumpcap_FILES}
|
||||
${wireshark_FILES}
|
||||
|
@ -3134,6 +3187,7 @@ if(SHELLCHECK_EXECUTABLE)
|
|||
add_custom_command(TARGET shellcheck POST_BUILD
|
||||
COMMAND shellcheck --external-sources
|
||||
image/stock_icons/svg-to-png.sh
|
||||
packaging/appimage/AppRun
|
||||
packaging/macosx/osx-app.sh.in
|
||||
packaging/macosx/osx-dmg.sh.in
|
||||
tools/compress-pngs.sh
|
||||
|
|
|
@ -64,6 +64,7 @@ since version 2.6.0:
|
|||
* Dumpcap now supports the `-a packets:NUM` and `-b packets:NUM` options.
|
||||
* Wireshark now includes a “No Reassembly” configuration profile.
|
||||
* Wireshark now supports the Russian language.
|
||||
* The build system now supports AppImage packages.
|
||||
|
||||
=== Removed Features and Support
|
||||
|
||||
|
|
|
@ -0,0 +1,24 @@
|
|||
#!/bin/sh
|
||||
|
||||
# Custom AppRun entry point that allows symlinking multiple
|
||||
# executables, e.g. wireshark, tshark, dumpcap, editcap, etc.
|
||||
|
||||
# Adapted from
|
||||
# https://github.com/probonopd/ippsample/blob/feature/appimage/appimage/AppRun
|
||||
|
||||
SELF=$(readlink -f "$0")
|
||||
HERE=${SELF%/*}
|
||||
|
||||
# See if we were called by runtime.c, which sets APPIMAGE, ARGV0,
|
||||
# and APPDIR.
|
||||
if [ -n "$APPIMAGE" ] && [ -n "$ARGV0" ] ; then
|
||||
BINARY_NAME=${ARGV0##*/}
|
||||
else
|
||||
BINARY_NAME=${0##*/}
|
||||
fi
|
||||
|
||||
if [ -e "$HERE/usr/bin/$BINARY_NAME" ] ; then
|
||||
exec "$HERE/usr/bin/$BINARY_NAME" "$@"
|
||||
else
|
||||
exec "$HERE/usr/bin/wireshark" "$@"
|
||||
fi
|
Loading…
Reference in New Issue