From aac30ba2d16ce496d0ecc37124febd0a8d6ae7b6 Mon Sep 17 00:00:00 2001 From: Peter Wu Date: Tue, 8 Jan 2019 19:12:43 +0100 Subject: [PATCH] CMake,WSDG: Remove Cygwin support Declare Cygwin as unsupported and remove all supporting code. Simplify some Chocolatey notes in the WSDG. Remove FindPerl.cmake as it only existed to force use of Wireshark's bundled FindCygwin.cmake (bug 13922). FindXSLTPROC.cmake special handling for Cygwin was also removed, in theory this could cause issues when the PATH contains a Cygwin xsltproc, but it's unsupported anyway. Change-Id: Iabfac2b4a9fd930530505d27bdba618bdb8f7f34 Reviewed-on: https://code.wireshark.org/review/31452 Petri-Dish: Peter Wu Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman --- CMakeLists.txt | 1 - cmake/modules/FindChocolatey.cmake | 30 ++----- cmake/modules/FindCygwin.cmake | 43 --------- cmake/modules/FindLEX.cmake | 6 +- cmake/modules/FindPOD.cmake | 7 +- cmake/modules/FindPerl.cmake | 81 ----------------- cmake/modules/FindXSLTPROC.cmake | 30 +------ cmake/modules/FindYACC.cmake | 2 - .../WSDG_chapter_quick_setup.asciidoc | 87 ++----------------- docbook/wsdg_src/WSDG_chapter_tools.asciidoc | 32 +------ 10 files changed, 20 insertions(+), 299 deletions(-) delete mode 100644 cmake/modules/FindCygwin.cmake delete mode 100644 cmake/modules/FindPerl.cmake diff --git a/CMakeLists.txt b/CMakeLists.txt index 275b0b46f7..08ce4af9ae 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1865,7 +1865,6 @@ if(WIN32) # We have a lot of choices for creating zip archives: # - 7z, WinZip, etc., which require a separate download+install. - # - Cygwin's zip, which requires Cygwin. # - "CMake -E tar cz", which creates a tar file. # - CPack, which requires a CPack configuration. # - PowerShell via PSCX or System.IO.Compression.FileSystem. diff --git a/cmake/modules/FindChocolatey.cmake b/cmake/modules/FindChocolatey.cmake index 172335f9b9..81510e1628 100644 --- a/cmake/modules/FindChocolatey.cmake +++ b/cmake/modules/FindChocolatey.cmake @@ -3,40 +3,20 @@ # # This module looks for Chocolatey -# This code was copied from -# http://cmake.org/gitweb?p=cmake.git;a=blob_plain;f=Modules/FindCygwin.cmake;hb=HEAD -# and modified. -# -# Its toplevel COPYING file starts with: -#============================================================================= -# Copyright 2001-2009 Kitware, Inc. -# -# Distributed under the OSI-approved BSD License (the "License"); -# see accompanying file Copyright.txt for details. -# -# This software is distributed WITHOUT ANY WARRANTY; without even the -# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -# See the License for more information. -#============================================================================= -# (To distribute this file outside of CMake, substitute the full -# License text for the above reference.) - -if (WIN32) - if (ENV{ChocolateyInstall}) +if(WIN32) + if(ENV{ChocolateyInstall}) set(_chocolateyinstall_bin "$ENV{ChocolateyInstall}/bin") endif() find_path(CHOCOLATEY_BIN_PATH choco.exe PATHS - $_chocolateyinstall_bin + ${_chocolateyinstall_bin} "$ENV{ProgramData}/chocolatey/bin" C:/Chocolatey/bin DOC "Chocolatey binary path" NO_DEFAULT_PATH ) - mark_as_advanced( - CHOCOLATEY_BIN_PATH - ) -endif () + mark_as_advanced(CHOCOLATEY_BIN_PATH) +endif() diff --git a/cmake/modules/FindCygwin.cmake b/cmake/modules/FindCygwin.cmake deleted file mode 100644 index 415bfb6a8f..0000000000 --- a/cmake/modules/FindCygwin.cmake +++ /dev/null @@ -1,43 +0,0 @@ -#.rst: -# FindCygwin -# ---------- -# -# this module looks for Cygwin - -# This code was copied from -# http://cmake.org/gitweb?p=cmake.git;a=blob_plain;f=Modules/FindCygwin.cmake;hb=HEAD -# and modified so as to check C:\Cygwin64 and the WIRESHARK_CYGWIN_INSTALL_PATH -# environment variable - -#============================================================================= -#CMake - Cross Platform Makefile Generator -#Copyright 2000-2015 Kitware, Inc. -#Copyright 2000-2011 Insight Software Consortium -#All rights reserved. -# -# SPDX-License-Identifier: BSD-3-Clause -#============================================================================= - -if (WIN32) - find_path(CYGWIN_INSTALL_PATH - NAMES cygwin.bat - PATHS - ENV WIRESHARK_CYGWIN_INSTALL_PATH - "C:/Cygwin" - "C:/Cygwin64" - "C:/tools/cygwin" - "C:/tools/cygwin64" - "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Cygwin\\setup;rootdir]" - "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Cygnus Solutions\\Cygwin\\mounts v2\\/;native]" - ) - - if(NOT CYGWIN_INSTALL_PATH) - if(WIRESHARK_CYGWIN_INSTALL_PATH) - message(FATAL_ERROR "WIRESHARK_CYGWIN_INSTALL_PATH was specified, but Cygwin was not found.") - endif() - endif() - - mark_as_advanced( - CYGWIN_INSTALL_PATH - ) -endif () diff --git a/cmake/modules/FindLEX.cmake b/cmake/modules/FindLEX.cmake index f7d010b732..0008bc43dd 100644 --- a/cmake/modules/FindLEX.cmake +++ b/cmake/modules/FindLEX.cmake @@ -2,17 +2,15 @@ # - Find flex/lex executable # -INCLUDE(FindCygwin) -INCLUDE(FindChocolatey) +include(FindChocolatey) -FIND_PROGRAM(LEX_EXECUTABLE +find_program(LEX_EXECUTABLE NAMES win_flex flex lex PATHS ${CHOCOLATEY_BIN_PATH} - ${CYGWIN_INSTALL_PATH}/bin /bin /usr/bin /usr/local/bin diff --git a/cmake/modules/FindPOD.cmake b/cmake/modules/FindPOD.cmake index 3326f2770f..15ce12e748 100644 --- a/cmake/modules/FindPOD.cmake +++ b/cmake/modules/FindPOD.cmake @@ -1,16 +1,12 @@ # -# - Find unix commands from cygwin -# This module looks for some usual Unix commands. +# - Find pod2man and pod2html. # -include(FindCygwin) - find_program(POD2MAN_EXECUTABLE NAMES pod2man pod2man.bat PATHS - ${CYGWIN_INSTALL_PATH}/bin /bin /usr/bin /usr/local/bin @@ -22,7 +18,6 @@ find_program(POD2HTML_EXECUTABLE pod2html pod2html.bat PATHS - ${CYGWIN_INSTALL_PATH}/bin /bin /usr/bin /usr/local/bin diff --git a/cmake/modules/FindPerl.cmake b/cmake/modules/FindPerl.cmake deleted file mode 100644 index 479b7197b5..0000000000 --- a/cmake/modules/FindPerl.cmake +++ /dev/null @@ -1,81 +0,0 @@ -# Distributed under the OSI-approved BSD 3-Clause License. See accompanying -# file Copyright.txt or https://cmake.org/licensing for details. -# This code was copied from -# http://cmake.org/gitweb?p=cmake.git;a=blob_plain;f=Modules/FindPerl.cmake;hb=HEAD -# and modified so as to be compatible with our packaged FindCygwin.cmake - -#.rst: -# FindPerl -# -------- -# -# Find perl -# -# this module looks for Perl -# -# :: -# -# PERL_EXECUTABLE - the full path to perl -# PERL_FOUND - If false, don't attempt to use perl. -# PERL_VERSION_STRING - version of perl found (since CMake 2.8.8) - -include(${CMAKE_CURRENT_LIST_DIR}/FindCygwin.cmake) - -set(PERL_POSSIBLE_BIN_PATHS - ${CYGWIN_INSTALL_PATH}/bin - ) - -if(WIN32) - get_filename_component( - ActivePerl_CurrentVersion - "[HKEY_LOCAL_MACHINE\\SOFTWARE\\ActiveState\\ActivePerl;CurrentVersion]" - NAME) - set(PERL_POSSIBLE_BIN_PATHS ${PERL_POSSIBLE_BIN_PATHS} - "C:/Perl/bin" - [HKEY_LOCAL_MACHINE\\SOFTWARE\\ActiveState\\ActivePerl\\${ActivePerl_CurrentVersion}]/bin - ) -endif() - -find_program(PERL_EXECUTABLE - NAMES perl - PATHS ${PERL_POSSIBLE_BIN_PATHS} - ) - -if(PERL_EXECUTABLE) - ### PERL_VERSION - execute_process( - COMMAND - ${PERL_EXECUTABLE} -V:version - OUTPUT_VARIABLE - PERL_VERSION_OUTPUT_VARIABLE - RESULT_VARIABLE - PERL_VERSION_RESULT_VARIABLE - ERROR_QUIET - OUTPUT_STRIP_TRAILING_WHITESPACE - ) - if(NOT PERL_VERSION_RESULT_VARIABLE AND NOT PERL_VERSION_OUTPUT_VARIABLE MATCHES "^version='UNKNOWN'") - string(REGEX REPLACE "version='([^']+)'.*" "\\1" PERL_VERSION_STRING ${PERL_VERSION_OUTPUT_VARIABLE}) - else() - execute_process( - COMMAND ${PERL_EXECUTABLE} -v - OUTPUT_VARIABLE PERL_VERSION_OUTPUT_VARIABLE - RESULT_VARIABLE PERL_VERSION_RESULT_VARIABLE - ERROR_QUIET - OUTPUT_STRIP_TRAILING_WHITESPACE - ) - if(NOT PERL_VERSION_RESULT_VARIABLE AND PERL_VERSION_OUTPUT_VARIABLE MATCHES "This is perl.*[ \\(]v([0-9\\._]+)[ \\)]") - set(PERL_VERSION_STRING "${CMAKE_MATCH_1}") - elseif(NOT PERL_VERSION_RESULT_VARIABLE AND PERL_VERSION_OUTPUT_VARIABLE MATCHES "This is perl, version ([0-9\\._]+) +") - set(PERL_VERSION_STRING "${CMAKE_MATCH_1}") - endif() - endif() -endif() - -# Deprecated settings for compatibility with CMake1.4 -set(PERL ${PERL_EXECUTABLE}) - -include(FindPackageHandleStandardArgs) -FIND_PACKAGE_HANDLE_STANDARD_ARGS(Perl - REQUIRED_VARS PERL_EXECUTABLE - VERSION_VAR PERL_VERSION_STRING) - -mark_as_advanced(PERL_EXECUTABLE) diff --git a/cmake/modules/FindXSLTPROC.cmake b/cmake/modules/FindXSLTPROC.cmake index f1958441a1..f7246b323c 100644 --- a/cmake/modules/FindXSLTPROC.cmake +++ b/cmake/modules/FindXSLTPROC.cmake @@ -1,20 +1,18 @@ # -# - Find unix commands from cygwin +# - Find XSLTPROC # This module looks for some usual Unix commands. # include(FindChocolatey) -include(FindCygwin) # Strawberry Perl ships with xsltproc but no DocBook XML files, which -# is detrimental to our interests. Search for the Chocolatey and Cygwin +# is detrimental to our interests. Search for the Chocolatey # versions first, and un-find xsltproc if needed. find_program(XSLTPROC_EXECUTABLE NAMES xsltproc HINTS ${CHOCOLATEY_BIN_PATH} - ${CYGWIN_INSTALL_PATH}/bin PATHS /usr/local/bin /sbin @@ -43,29 +41,7 @@ set (_common_xsltproc_args --stringparam html.stylesheet ws.css ) -if (WIN32 AND NOT "${CYGWIN_INSTALL_PATH}" STREQUAL "" AND ${XSLTPROC_EXECUTABLE} MATCHES "${CYGWIN_INSTALL_PATH}") - FIND_PROGRAM(CYGPATH_EXECUTABLE - NAMES cygpath - PATHS ${CYGWIN_INSTALL_PATH}/bin - ) - MACRO( TO_XSLTPROC_COMPATIBLE_PATH _cmake_path _result ) - execute_process( - COMMAND ${CYGPATH_EXECUTABLE} -u ${_cmake_path} - OUTPUT_VARIABLE _cygwin_path - ) - # cygpath adds a linefeed. - string(STRIP "${_cygwin_path}" _cygwin_path) - - set( ${_result} ${_cygwin_path} ) - ENDMACRO() - - TO_XSLTPROC_COMPATIBLE_PATH( ${CMAKE_CURRENT_SOURCE_DIR} _xsltproc_current_source_dir ) - TO_XSLTPROC_COMPATIBLE_PATH( ${CMAKE_CURRENT_BINARY_DIR} _xsltproc_current_binary_dir ) - - set ( _xsltproc_path "${_xsltproc_current_source_dir}:${_xsltproc_current_binary_dir}:${_xsltproc_current_binary_dir}/wsluarm_src") -else() - set ( _xsltproc_path "${CMAKE_CURRENT_SOURCE_DIR}:${CMAKE_CURRENT_BINARY_DIR}:${CMAKE_CURRENT_BINARY_DIR}/wsluarm_src") -endif() +set(_xsltproc_path "${CMAKE_CURRENT_SOURCE_DIR}:${CMAKE_CURRENT_BINARY_DIR}:${CMAKE_CURRENT_BINARY_DIR}/wsluarm_src") # Workaround for parallel build issue with msbuild. # https://gitlab.kitware.com/cmake/cmake/issues/16767 diff --git a/cmake/modules/FindYACC.cmake b/cmake/modules/FindYACC.cmake index 9360d71a1a..c96f87b389 100644 --- a/cmake/modules/FindYACC.cmake +++ b/cmake/modules/FindYACC.cmake @@ -2,7 +2,6 @@ # - Find bison/yacc executable # -INCLUDE(FindCygwin) INCLUDE(FindChocolatey) FIND_PROGRAM(YACC_EXECUTABLE @@ -12,7 +11,6 @@ FIND_PROGRAM(YACC_EXECUTABLE yacc PATHS ${CHOCOLATEY_BIN_PATH} - ${CYGWIN_INSTALL_PATH}/bin /bin /usr/bin /usr/local/bin diff --git a/docbook/wsdg_src/WSDG_chapter_quick_setup.asciidoc b/docbook/wsdg_src/WSDG_chapter_quick_setup.asciidoc index ea7deecf5c..d99d0f9317 100644 --- a/docbook/wsdg_src/WSDG_chapter_quick_setup.asciidoc +++ b/docbook/wsdg_src/WSDG_chapter_quick_setup.asciidoc @@ -117,12 +117,12 @@ upgrade Qt to newer versions. https://chocolatey.org/[Chocolatey] is a native package manager for Windows. There are https://chocolatey.org/packages[packages] for most of the software listed below. Along with traditional Windows packages it -supports the Python Package Index and Cygwin. +supports the Python Package Index. -Chocolatey tends to install packages into its own path (%ChocolateyInstall%). -In most cases this is OK, but in some instances (Python in particular) -this might not be what you want. You can install Chocolatey packages -using the command `choco install`. +Chocolatey tends to install packages into its own path (%ChocolateyInstall%), +although packages are free to use their own preferences (Python for example is +installed to `C:\Python37`). You can install Chocolatey packages using the +command `choco install` (or its shorthand, `cinst`). [source,cmd] ---- @@ -130,70 +130,7 @@ using the command `choco install`. > choco install -y winflexbison > rem Git, CMake, Perl, Python, etc are also required, but can be installed > rem via their respective installation packages. -> choco install -y git cmake -> rem Choose one of Strawberry... -> choco install -y strawberryperl -> rem ...or ActiveState Perl -> choco install -y activeperl -> rem This will likely install Python in a non-standard location, but -> rem should otherwise work. -> choco install -y python3 ----- - -[[ChSetupCygwin]] - -==== Optional: Install Cygwin - -On 32-bit Windows, http://www.cygwin.com/setup-x86.exe[download the -32-bit Cygwin installer] and start it. On 64-bit Windows, -http://www.cygwin.com/setup-x86_64.exe[download the 64-bit Cygwin -installer] and start it. - -[NOTE] -.Cygwin is no longer required -==== -In the past the Wireshark development toolchain depended on Cygwin, but -it it no longer required. Although you can often use the Cygwin version -of a particular tool for Wireshark development that's not always the -case. -==== - -At the "Select Packages" page, you'll need to select -some additional packages which are not installed by default. -Navigate to the required Category/Package row and, if the package -has a "Skip" item in the "New" column, click on the "Skip" item -so it shows a version number for: - -* Devel/bison (or install Win flex-bison -- see Chocolatey above) - -* Devel/flex (or install Win flex-bison -- see Chocolatey above) - -* Devel/git (recommended, but it's also available via Chocolatey -- see the Git discussion below) - -* Interpreters/perl - -* Utils/patch (only if needed) (may be Devel/patch instead) - -* Text/docbook-xml45 (only needed if you're building the documenation) - -After clicking the btn:[Next] button several times, the setup -will then download and install the selected packages (this -may take a while). - -Alternatively you can install Cygwin and its packages using Chocolatey: - ----- -PS$>choco install -y cygwin -PS$>choco install -y cyg-get ----- -//PS$>choco install sed [...] -source cygwin - -Chocolatey installs Cygwin in _C:\tools\cygwin_ by default. - -You can directly download packages via `cyg-get` - ----- -PS$>cyg-get docbook-xml45 [...] +> choco install -y git cmake strawberryperl python3 ---- [[ChSetupPython]] @@ -203,10 +140,6 @@ PS$>cyg-get docbook-xml45 [...] Get a Python 3.x installer from https://python.org/download/[] and install Python into the default location (_C:\Python37_). -Why is this recommended? Cygwin’s _/usr/bin/python_ is a Cygwin-specific -symbolic link which cannot be run from Windows. The native package is faster -as well. - Alternatively you can install Python using Chocolatey: ---- @@ -384,14 +317,6 @@ Set the following environment variables, using paths and values suitable for you > set WIRESHARK_VERSION_EXTRA=-YourExtraVersionInfo ---- -If your Cygwin installation path is not automatically detected by CMake, -you can explicitly specify it with the following environment variable: - ----- -> rem Chocolatey installs Cygwin in an odd location -> set WIRESHARK_CYGWIN_INSTALL_PATH=C:\ProgramData\chocolatey\lib\Cygwin\tools\cygwin ----- - If you are using a version of Visual Studio earlier than VS2017 then you must set an additional env var, e.g. for VS2019 set the following: ---- diff --git a/docbook/wsdg_src/WSDG_chapter_tools.asciidoc b/docbook/wsdg_src/WSDG_chapter_tools.asciidoc index 5f1388ef35..5a21265a21 100644 --- a/docbook/wsdg_src/WSDG_chapter_tools.asciidoc +++ b/docbook/wsdg_src/WSDG_chapter_tools.asciidoc @@ -17,8 +17,7 @@ as Linux, but Windows ports are also available. Therefore the tools are available in different "flavours": * UNIX and UNIX-like platforms: The tools should be commonly available - on the supported UNIX and UNIX-like platforms and for Windows - platforms by using an emulation layer such as Cygwin. + on the supported UNIX and UNIX-like platforms. Cygwin is unsupported. * Windows native: Some tools are available as native Windows tools, no special emulation is required. Many of these tools can be installed (and updated) using http://chocolatey.org[Chocolatey], a Windows @@ -70,29 +69,6 @@ _C:\ProgramData\chocolatey_ or _C:\Tools_. If you want to avoid this behavior you'll probabaly want to install Python using the packages from python.org. -[[ChToolsCygwin]] - -=== Windows: Cygwin - -Cygwin provides a lot of UNIX based tools on the Windows platform. It -uses a UNIX emulation layer which might be a bit slower compared to the -native Windows tools, but at an acceptable level. The installation and -update is pretty easy and done through a single utility, _setup-x86.exe_ -for 32-bit Windows and _setup-x86_64.exe_ for 64-bit Windows. However, -it can also be problematic. Cygwin utilities have a non-standard view of -the filesystem, and sometimes things don't work as expected. For -example, many files in _/usr/bin_ are symlinks which can't be run -directly from Windows. - -[NOTE] -.Cygwin is no longer required -==== -In the past the Wireshark development toolchain depended on Cygwin, but -it it no longer required. Although you can often use the Cygwin version -of a particular tool for Wireshark development that's not always the -case. -==== - [[ChToolsCMake]] === CMake @@ -142,7 +118,7 @@ optional libraries have xxx_INCLUDE_DIR and xxx_LIB flags that let you control their discovery. --DPYTHON_EXECUTABLE=c:/Python36/python:: Force the Python path. Useful on Windows since Cygwin’s _/usr/bin/python_ is a symlink. +-DPYTHON_EXECUTABLE=c:/Python36/python:: Force the Python path. -DENABLE_APPLICATION_BUNDLE=OFF:: Disable building an application bundle (Wireshark.app) on macOS @@ -666,8 +642,6 @@ Python 3.4 and later is required. Python 2.7 is no longer supported. Python is either included or available as a package on most UNIX-like platforms. Windows packages and source are available at https://python.org/download/[]. -The Cygwin Python package is *not* recommended since _/usr/bin/python_ is -a symbolic link, which causes confusion outside Cygwin. You can also use Chocolatey to install Python: @@ -843,7 +817,7 @@ https://chocolatey.org/[Chocolatey] package. Note that the executable is named _win_bison_. Native packages are available from other sources such as -http://gnuwin32.sourceforge.net/packages/bison.htm[GnuWin] and Cygwin. +http://gnuwin32.sourceforge.net/packages/bison.htm[GnuWin]. They aren't officially supported but _should_ work. [[ChToolsFlex]]