2015-01-06 23:07:50 +00:00
|
|
|
# CMakeLists.txt
|
|
|
|
#
|
|
|
|
# Wireshark - Network traffic analyzer
|
|
|
|
# By Gerald Combs <gerald@wireshark.org>
|
|
|
|
# Copyright 1998 Gerald Combs
|
|
|
|
#
|
2018-03-07 14:28:51 +00:00
|
|
|
# SPDX-License-Identifier: GPL-2.0-or-later
|
2015-01-06 23:07:50 +00:00
|
|
|
#
|
|
|
|
|
|
|
|
# We should use CPack to generate the NSIS package. Even better,
|
|
|
|
# we should use CPack to create a .msi using WIX.
|
|
|
|
|
2015-04-07 19:55:42 +00:00
|
|
|
set(NSIS_GENERATED_FILES
|
|
|
|
${CMAKE_CURRENT_BINARY_DIR}/all-manifest.nsh
|
|
|
|
${CMAKE_CURRENT_BINARY_DIR}/config.nsh
|
|
|
|
${CMAKE_CURRENT_BINARY_DIR}/qt-dll-manifest.nsh
|
|
|
|
)
|
2015-04-14 21:34:00 +00:00
|
|
|
set(NSIS_GENERATED_FILES ${NSIS_GENERATED_FILES} PARENT_SCOPE)
|
2015-04-07 19:55:42 +00:00
|
|
|
|
2015-01-06 23:07:50 +00:00
|
|
|
set(NSIS_FILES
|
|
|
|
wireshark.nsi
|
|
|
|
uninstall.nsi
|
|
|
|
common.nsh
|
|
|
|
GetWindowsVersion.nsh
|
|
|
|
servicelib.nsh
|
|
|
|
AdditionalTasksPage.ini
|
2018-11-29 01:08:27 +00:00
|
|
|
NpcapPage.ini
|
2015-10-08 05:29:25 +00:00
|
|
|
USBPcapPage.ini
|
2015-04-07 19:55:42 +00:00
|
|
|
${NSIS_GENERATED_FILES}
|
2015-01-06 23:07:50 +00:00
|
|
|
PARENT_SCOPE
|
|
|
|
)
|
|
|
|
|
|
|
|
# Variables required for config.nsh
|
|
|
|
set(PROGRAM_NAME ${CMAKE_PROJECT_NAME})
|
|
|
|
file(TO_NATIVE_PATH "${CMAKE_SOURCE_DIR}" TOP_SRC_DIR)
|
|
|
|
# STAGING_DIR depends on the build configuration so we pass it
|
|
|
|
# on the command line below.
|
2019-02-11 22:24:18 +00:00
|
|
|
file(TO_NATIVE_PATH "${CMAKE_BINARY_DIR}/docbook" DOCBOOK_DIR)
|
2018-05-10 12:54:31 +00:00
|
|
|
if(WIRESHARK_TARGET_PLATFORM STREQUAL "win32")
|
2015-01-06 23:07:50 +00:00
|
|
|
set(TARGET_MACHINE x86)
|
2018-05-10 12:54:31 +00:00
|
|
|
elseif(WIRESHARK_TARGET_PLATFORM STREQUAL "win64")
|
2015-01-06 23:07:50 +00:00
|
|
|
set(TARGET_MACHINE x64)
|
|
|
|
else()
|
|
|
|
message(FATAL_ERROR "Your mysterious moon-man architecture \"${WIRESHARK_TARGET_PLATFORM}\" frightens and confuses us.")
|
|
|
|
endif()
|
2018-03-07 21:10:31 +00:00
|
|
|
set (MMDBRESOLVE_EXE ${MAXMINDDB_FOUND})
|
2015-01-06 23:07:50 +00:00
|
|
|
|
2018-11-29 01:08:27 +00:00
|
|
|
# Path to the Npcap installer.
|
2015-01-06 23:07:50 +00:00
|
|
|
# XXX Come up with a better variable, e.g. cache WIRESHARK_LIB_DIR in FindWSWinLibs.
|
|
|
|
file(TO_NATIVE_PATH "${GLIB2_DLL_DIR}/../.." _wireshark_lib_dir)
|
|
|
|
set(WIRESHARK_LIB_DIR "${_wireshark_lib_dir}")
|
|
|
|
|
2018-11-29 01:08:27 +00:00
|
|
|
# Must match ${WIRESHARK_LIB_DIR}/Npcap-X.Y.Z.exe
|
2019-01-23 11:09:43 +00:00
|
|
|
set(NPCAP_PACKAGE_VERSION "0.99-r9")
|
2015-01-06 23:07:50 +00:00
|
|
|
|
2018-11-29 01:08:27 +00:00
|
|
|
set(USBPCAP_PACKAGE_VERSION "1.2.0.4")
|
2015-10-08 05:48:50 +00:00
|
|
|
|
2015-01-06 23:07:50 +00:00
|
|
|
set(PRODUCT_VERSION ${PROJECT_MAJOR_VERSION}.${PROJECT_MINOR_VERSION}.${PROJECT_PATCH_VERSION}.${PROJECT_BUILD_VERSION})
|
|
|
|
|
|
|
|
# To do:
|
2016-06-08 13:57:00 +00:00
|
|
|
# - Sync the various version names between CMake and NSIS.
|
2019-01-09 22:47:02 +00:00
|
|
|
# - Set CMakeLists.txt version strings in tools/make-version.pl
|
2015-01-06 23:07:50 +00:00
|
|
|
# - Add a VERSION_EXTRA cmake option
|
|
|
|
set (VERSION "${PROJECT_VERSION}")
|
|
|
|
set (PRODUCT_VERSION=${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_MICRO}.${VERSION_BUILD})
|
|
|
|
|
|
|
|
#add_custom_target(build_nsis_package
|
|
|
|
# DEPENDS
|
|
|
|
# wireshark-$(WIRESHARK_TARGET_PLATFORM)-$(VERSION).exe
|
|
|
|
#)
|
|
|
|
|
|
|
|
if(BUILD_wireshark AND QT_FOUND)
|
|
|
|
set (QT_DIR "\${STAGING_DIR}")
|
|
|
|
endif()
|
|
|
|
|
2016-08-05 22:39:26 +00:00
|
|
|
# Look for the Visual C++ Redistributable packages in the following locations:
|
|
|
|
# - _PROJECT_LIB_DIR
|
|
|
|
# - _PROJECT_LIB_DIR/vcredist_MSVCxx
|
|
|
|
# - %VCINSTALLDIR%
|
2017-06-08 17:39:05 +00:00
|
|
|
# - %VCINSTALLDIR%/redist/1033 (<= Visual Studio 2015)
|
|
|
|
# - %VCINSTALLDIR%/Redist/MSVC/* (>= Visual Studio 2017)
|
2018-08-05 17:44:02 +00:00
|
|
|
# MSVC_VERSION (_MSC_VER) = Visual Studio Version / MSVC Toolset Version
|
|
|
|
# 1900 = VS2015 14.0 / 14.00
|
|
|
|
# 1910 = VS2017 15.1, 15.2 / 14.10
|
|
|
|
# 1911 = VS2017 15.3, 15.4 / 14.11
|
|
|
|
# 1912 = VS2017 15.5 / 14.12
|
|
|
|
# 1913 = VS2017 15.6 / 14.13
|
|
|
|
# 1914 = VS2017 15.7 / 14.14
|
2016-04-06 15:25:18 +00:00
|
|
|
set(_vcredist_name "vcredist_${TARGET_MACHINE}.exe")
|
2017-06-08 17:39:05 +00:00
|
|
|
if(MSVC_VERSION GREATER_EQUAL 1910)
|
|
|
|
set(_ws_vcredist_subdir "vcredist_MSVC2017")
|
2018-08-05 17:44:02 +00:00
|
|
|
set(_msvs_version 15.0)
|
2017-06-08 17:39:05 +00:00
|
|
|
elseif(MSVC_VERSION GREATER_EQUAL 1900)
|
|
|
|
set(_ws_vcredist_subdir "vcredist_MSVC2015")
|
|
|
|
set(_ms_vcredist_subdir "redist/1033")
|
2018-08-05 17:44:02 +00:00
|
|
|
set(_msvs_version 14.0)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
# Try to find the Redist folder in VCINSTALLDIR which is set by vcvarsall.bat.
|
|
|
|
# If it is not set, query it within the registry. VS2015 looks for the "VC7" key
|
|
|
|
# in two locations (four if you count HKCU instead of HKLM). However, VS2017
|
|
|
|
# does not use "VC7" (it sets a directory relative to vsdevcmd_start.bat). As
|
|
|
|
# both versions do set "VS7", use that instead.
|
|
|
|
find_path(VCINSTALLDIR Redist PATHS
|
|
|
|
"$ENV{VCINSTALLDIR}"
|
|
|
|
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\SxS\\VS7;${_msvs_version}]\\VC"
|
|
|
|
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\WOW6432Node\\Microsoft\\VisualStudio\\SxS\\VS7;${_msvs_version}]\\VC"
|
|
|
|
NO_DEFAULT_PATH
|
|
|
|
)
|
2018-12-29 19:51:08 +00:00
|
|
|
file(TO_NATIVE_PATH "${VCINSTALLDIR}" VCINSTALLDIR_NATIVE)
|
|
|
|
message(STATUS "Using VCINSTALLDIR: ${VCINSTALLDIR_NATIVE}")
|
2018-08-05 17:44:02 +00:00
|
|
|
|
|
|
|
# Visual Studio Community 2017 version 15.7.5 uses VCRT 14.14.26405, but an
|
|
|
|
# earlier version used 14.10.25008. Let's just glob for the right value.
|
|
|
|
if(MSVC_VERSION GREATER_EQUAL 1910 AND VCINSTALLDIR)
|
|
|
|
file(GLOB _ms_vcredist_subdir RELATIVE "${VCINSTALLDIR}"
|
|
|
|
"${VCINSTALLDIR}/Redist/MSVC/14.*.*")
|
2016-08-05 22:39:26 +00:00
|
|
|
endif()
|
|
|
|
|
2016-04-06 15:25:18 +00:00
|
|
|
find_program(VCREDIST_EXE "${_vcredist_name}"
|
2018-08-05 17:44:02 +00:00
|
|
|
PATHS "${_PROJECT_LIB_DIR}" $ENV{VCToolsRedistDir} "${VCINSTALLDIR}"
|
2017-06-08 17:39:05 +00:00
|
|
|
PATH_SUFFIXES ${_ws_vcredist_subdir} ${_ms_vcredist_subdir}
|
|
|
|
NO_DEFAULT_PATH
|
2016-04-06 15:25:18 +00:00
|
|
|
)
|
|
|
|
if(VCREDIST_EXE)
|
2016-04-08 07:56:28 +00:00
|
|
|
file(TO_NATIVE_PATH "${VCREDIST_EXE}" VCREDIST_EXE)
|
2018-02-15 16:38:34 +00:00
|
|
|
message(STATUS "Using ${VCREDIST_EXE} for the NSIS installer.")
|
2015-01-06 23:07:50 +00:00
|
|
|
endif()
|
|
|
|
|
|
|
|
# Ideally we would generate this at compile time using a separate cmake
|
|
|
|
# module, e.g. cmake/modules/configure_nsis_file.cmake. However we would
|
|
|
|
# have to figure out a clean way to pass in the variables above.
|
|
|
|
file(READ "${CMAKE_CURRENT_SOURCE_DIR}/config.nsh.in" _config_nsh_contents)
|
|
|
|
string(CONFIGURE "${_config_nsh_contents}" _config_nsh_contents)
|
|
|
|
string(REPLACE "#define" "!define" _config_nsh_contents "${_config_nsh_contents}")
|
|
|
|
string(REPLACE "#undef" "!undef" _config_nsh_contents "${_config_nsh_contents}")
|
|
|
|
file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/config.nsh" "${_config_nsh_contents}")
|
|
|
|
|
|
|
|
# all-manifest.nsh. Can be created at configure time.
|
|
|
|
set(_all_manifest "${CMAKE_CURRENT_BINARY_DIR}/all-manifest.nsh")
|
|
|
|
set(_all_manifest_contents "# Files required for all sections. Generated by CMake.\n")
|
2018-11-20 02:15:47 +00:00
|
|
|
foreach(_dll ${GLIB2_DLLS} ${CARES_DLL} ${GCRYPT_DLLS}
|
2016-08-26 13:18:29 +00:00
|
|
|
${GNUTLS_DLLS} ${KERBEROS_DLLS} ${LIBSSH_DLL} ${LUA_DLL}
|
2016-10-22 16:15:51 +00:00
|
|
|
${LZ4_DLL} ${NGHTTP2_DLL} ${SBC_DLL} ${SMI_DLL} ${SNAPPY_DLL}
|
2018-02-09 01:20:26 +00:00
|
|
|
${SPANDSP_DLL} ${BCG729_DLL} ${LIBXML2_DLL} ${WINSPARKLE_DLL}
|
|
|
|
${ZLIB_DLL}
|
|
|
|
# Needed for mmdbresolve
|
|
|
|
${MAXMINDDB_DLL}
|
2015-01-06 23:07:50 +00:00
|
|
|
)
|
|
|
|
set(_all_manifest_contents "${_all_manifest_contents}File \"\${STAGING_DIR}\\${_dll}\"\n")
|
|
|
|
endforeach()
|
2015-07-08 07:07:24 +00:00
|
|
|
foreach(_script "init.lua" "console.lua" "dtd_gen.lua")
|
|
|
|
set(_all_manifest_contents "${_all_manifest_contents}File \"\${STAGING_DIR}\\${_script}\"\n")
|
|
|
|
endforeach()
|
2015-01-06 23:07:50 +00:00
|
|
|
file(WRITE "${_all_manifest}" "${_all_manifest_contents}")
|
|
|
|
|
|
|
|
file(TO_NATIVE_PATH "${DATAFILE_DIR}" _staging_dir)
|
2018-02-10 21:26:57 +00:00
|
|
|
file(TO_NATIVE_PATH "${CMAKE_CURRENT_BINARY_DIR}" _outfile_dir)
|
2015-01-06 23:07:50 +00:00
|
|
|
file(TO_NATIVE_PATH "${CMAKE_CURRENT_BINARY_DIR}" _nsis_include_dir)
|
|
|
|
|
|
|
|
# Variables we can't set via config.nsh.
|
2018-12-12 20:37:21 +00:00
|
|
|
set(NSIS_OPTIONS
|
|
|
|
/DSTAGING_DIR=${_staging_dir}
|
|
|
|
/DOUTFILE_DIR=${_outfile_dir}
|
|
|
|
/DNSIS_INCLUDE_DIR=${_nsis_include_dir}
|
|
|
|
/V4
|
2015-01-06 23:07:50 +00:00
|
|
|
PARENT_SCOPE
|
|
|
|
)
|
|
|
|
|
2015-03-16 20:09:58 +00:00
|
|
|
# We want to sign all of the executables that we ship in the official
|
|
|
|
# installers. This means that uninstall.exe must be built separately AND
|
|
|
|
# that building the installer itself won't overwrite uninstall.exe
|
2015-01-06 23:07:50 +00:00
|
|
|
macro( ADD_NSIS_UNINSTALLER_TARGET )
|
|
|
|
set (_nsis_source_dir ${CMAKE_SOURCE_DIR}/packaging/nsis )
|
|
|
|
set (_nsis_binary_dir ${CMAKE_BINARY_DIR}/packaging/nsis )
|
|
|
|
|
|
|
|
add_custom_command(OUTPUT ${DATAFILE_DIR}/uninstall.exe
|
|
|
|
DEPENDS ${_nsis_source_dir}/uninstall.nsi
|
|
|
|
${_nsis_source_dir}/common.nsh
|
2018-12-12 20:37:21 +00:00
|
|
|
COMMAND ${MAKENSIS_EXECUTABLE} ${NSIS_OPTIONS}
|
2015-01-06 23:07:50 +00:00
|
|
|
uninstall.nsi
|
|
|
|
COMMAND ${DATAFILE_DIR}/uninstall_installer.exe
|
|
|
|
COMMAND ${CMAKE_COMMAND} -E remove ${DATAFILE_DIR}/uninstall_installer.exe
|
|
|
|
WORKING_DIRECTORY ${_nsis_source_dir}
|
|
|
|
)
|
|
|
|
endmacro( ADD_NSIS_UNINSTALLER_TARGET )
|
|
|
|
|
|
|
|
macro( ADD_NSIS_PACKAGE_TARGET )
|
2015-06-29 17:00:37 +00:00
|
|
|
#set (_nsis_package ${CMAKE_BINARY_DIR}/packaging/nsis/Wireshark-$(WIRESHARK_TARGET_PLATFORM)-$(VERSION).exe)
|
2015-01-06 23:07:50 +00:00
|
|
|
|
|
|
|
# qt-dll-manifest.nsh. Created using Wireshark.exe.
|
|
|
|
add_custom_command(OUTPUT ${_nsis_binary_dir}/qt-dll-manifest.nsh
|
2016-11-29 23:11:06 +00:00
|
|
|
COMMAND set "PATH=${QT_BIN_PATH};%PATH%"
|
2015-01-06 23:07:50 +00:00
|
|
|
COMMAND ${POWERSHELL_COMMAND} "${_nsis_source_dir}/windeployqt-to-nsis.ps1"
|
|
|
|
-Executable $<TARGET_FILE:wireshark>
|
|
|
|
-FilePath ${_nsis_binary_dir}/qt-dll-manifest.nsh
|
|
|
|
)
|
2015-06-29 17:00:37 +00:00
|
|
|
|
|
|
|
# Build NSIS package dependencies. We build the package in two stages
|
|
|
|
# so that nsis_package below doesn't trigger any dependencies that
|
|
|
|
# might clobber any signed executables.
|
|
|
|
add_custom_target(nsis_package_prep
|
2015-03-16 20:09:58 +00:00
|
|
|
DEPENDS
|
|
|
|
${NSIS_FILES}
|
|
|
|
copy_data_files
|
Switch from AsciiDoc to Asciidoctor.
Switch the markup text processor for files in the docbook directory from
AsciiDoc to Asciidoctor. Asciidoctor has several useful features (such
as direct PDF output) and is actively developed. It's written in Ruby
but that dependency can be sidestepped with AsciidoctorJ, a
self-contained bundle that only depends on the JRE.
The current toolchain targets require Python, AsciiDoc, DocBook XML,
DocBook XSL, Java, FOP, xsltproc, lynx, and the HTMLHelp compiler:
HTML: AsciiDoc → DocBook XML → xsltproc + DocBook XSL
Chunked HTML: AsciiDoc → DocBook XML → xsltproc + DocBook XSL
PDF: AsciiDoc → DocBook XML → xsltproc + DocBook XSL → FOP
HTMLHelp: AsciiDoc → DocBook XML → xsltproc + DocBook XSL → HHC
This change removes the AsciiDoc and FOP requirements and adds either
AsciidoctorJ or Asciidoctor + Ruby:
HTML: Asciidoctor → DocBook XML → xsltproc + DocBook XSL
Chunked HTML: Asciidoctor → DocBook XML → xsltproc + DocBook XSL
PDF: Asciidoctor
HTMLHelp: Asciidoctor → DocBook XML → xsltproc + DocBook XSL → HHC
Ideally we could generate all of these using AsciidoctorJ, Java, and
lynx. Unfortunately we're not there yet.
The release notes depend on several macros (ws-buglink, ws-salink,
cve-idlink, sort-and-group). Add Asciidoctor (Ruby) equivalents.
Remove the BUILD_xxx_GUIDES CMake options and add various output targets
automatically. This means that you have to build the various documentation
targets explicitly.
Change-Id: I31930677a656b99b1c6839bb6c33a13db951eb9a
Reviewed-on: https://code.wireshark.org/review/25668
Petri-Dish: Gerald Combs <gerald@wireshark.org>
Tested-by: Petri Dish Buildbot
Reviewed-by: Gerald Combs <gerald@wireshark.org>
2017-10-19 22:03:55 +00:00
|
|
|
user_guide_chm
|
2019-02-11 22:24:18 +00:00
|
|
|
faq_html
|
2015-06-29 17:00:37 +00:00
|
|
|
${DATAFILE_DIR}/uninstall.exe
|
|
|
|
)
|
2015-09-28 14:29:55 +00:00
|
|
|
set_target_properties(nsis_package_prep PROPERTIES FOLDER "Packaging")
|
2015-06-29 17:00:37 +00:00
|
|
|
|
2016-06-08 13:57:00 +00:00
|
|
|
# Dump the installer into ${CMAKE_CURRENT_SOURCE_DIR}/packaging/nsis
|
2015-06-29 17:00:37 +00:00
|
|
|
# Note that executables and DLLs *must* be built separately
|
|
|
|
add_custom_target(nsis_package
|
2018-12-12 20:37:21 +00:00
|
|
|
COMMAND ${MAKENSIS_EXECUTABLE} ${NSIS_OPTIONS}
|
2015-01-06 23:07:50 +00:00
|
|
|
wireshark.nsi
|
|
|
|
WORKING_DIRECTORY ${_nsis_source_dir}
|
|
|
|
)
|
2015-06-29 17:00:37 +00:00
|
|
|
set_target_properties(nsis_package PROPERTIES FOLDER "Packaging")
|
2015-01-06 23:07:50 +00:00
|
|
|
endmacro( ADD_NSIS_PACKAGE_TARGET )
|
|
|
|
|
|
|
|
set(CLEAN_FILES
|
|
|
|
all-manifest.nsh
|
|
|
|
config.nsh
|
|
|
|
#NEWS.txt
|
|
|
|
qt-dll-manifest.nsh
|
|
|
|
#user-guide.chm
|
|
|
|
${DATAFILE_DIR}/uninstall.exe
|
|
|
|
wireshark-$(WIRESHARK_TARGET_PLATFORM)-$(VERSION).exe
|
|
|
|
)
|