forked from osmocom/wireshark
Windows: Get rid of textify.ps1.
We used textify.ps1 to ensure that the .txt files in our Windows installers would render properly in Notepad if the user double-clicked on them. Newer versions of Windows have a more sane Notepad, so this is no longer necessary: https://devblogs.microsoft.com/commandline/extended-eol-in-notepad/ Copy COPYING, NEWS, README.md, and README.windows once. Update README.windows. Change-Id: Ibb8b749725f13e0e49d2a2abe04603d9f2be7960 Reviewed-on: https://code.wireshark.org/review/35470 Petri-Dish: Gerald Combs <gerald@wireshark.org> Tested-by: Petri Dish Buildbot Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com> Reviewed-by: Gerald Combs <gerald@wireshark.org>
This commit is contained in:
parent
2abade04f8
commit
c656affc34
|
@ -1765,15 +1765,9 @@ if (BUILD_xxx2deb)
|
|||
)
|
||||
endif()
|
||||
|
||||
if(WIN32)
|
||||
set(TEXTIFY_FILES COPYING NEWS README.windows)
|
||||
set(TEXTIFY_MD_FILES README.md)
|
||||
foreach(_text_file ${TEXTIFY_FILES} ${TEXTIFY_MD_FILES})
|
||||
string(REGEX REPLACE ".md$" "" _out_file ${_text_file})
|
||||
set(INSTALL_FILES ${CMAKE_BINARY_DIR}/${_out_file}.txt ${INSTALL_FILES})
|
||||
endforeach()
|
||||
else()
|
||||
set(INSTALL_FILES COPYING ${INSTALL_FILES})
|
||||
if(NOT WIN32)
|
||||
# We do this for Windows further down in the copy_data_files target.
|
||||
list(APPEND INSTALL_FILES COPYING)
|
||||
endif()
|
||||
|
||||
set(VERSION_INFO_LIBS
|
||||
|
@ -1973,27 +1967,19 @@ endif(WIN32)
|
|||
set(copy_data_files_depends)
|
||||
|
||||
if(WIN32)
|
||||
foreach(_text_file ${TEXTIFY_FILES})
|
||||
add_custom_command(OUTPUT ${CMAKE_BINARY_DIR}/${_text_file}.txt
|
||||
COMMAND ${POWERSHELL_COMMAND} "${CMAKE_SOURCE_DIR}/tools/textify.ps1"
|
||||
-Destination ${CMAKE_BINARY_DIR}
|
||||
${CMAKE_SOURCE_DIR}/${_text_file}
|
||||
foreach(_install_as_txt_file COPYING NEWS README.md README.windows)
|
||||
# On Windows, install some files with a .txt extension so that they're
|
||||
# double-clickable.
|
||||
string(REGEX REPLACE ".md$" "" _no_md_file ${_install_as_txt_file})
|
||||
set(_output_file "${DATAFILE_DIR}/${_no_md_file}.txt")
|
||||
add_custom_command(OUTPUT ${_output_file}
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_if_different
|
||||
${CMAKE_SOURCE_DIR}/${_install_as_txt_file}
|
||||
${_output_file}
|
||||
DEPENDS
|
||||
${CMAKE_SOURCE_DIR}/${_text_file}
|
||||
)
|
||||
endforeach()
|
||||
foreach(_md_file ${TEXTIFY_MD_FILES})
|
||||
string(REGEX REPLACE ".md$" ".txt" _text_file ${_md_file})
|
||||
add_custom_command(OUTPUT ${CMAKE_BINARY_DIR}/${_text_file}
|
||||
COMMAND ${POWERSHELL_COMMAND} "${CMAKE_SOURCE_DIR}/tools/textify.ps1"
|
||||
-Destination ${CMAKE_BINARY_DIR}
|
||||
${CMAKE_SOURCE_DIR}/${_md_file}
|
||||
COMMAND ${CMAKE_COMMAND} -E rename
|
||||
${CMAKE_BINARY_DIR}/${_md_file}.txt
|
||||
${CMAKE_BINARY_DIR}/${_text_file}
|
||||
DEPENDS
|
||||
${CMAKE_SOURCE_DIR}/${_text_file}
|
||||
${CMAKE_SOURCE_DIR}/${_install_as_txt_file}
|
||||
)
|
||||
list(APPEND copy_data_files_depends "${_output_file}")
|
||||
endforeach()
|
||||
endif()
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
Installing Wireshark on Windows
|
||||
=============================
|
||||
===============================
|
||||
|
||||
To install Wireshark, simply download the appropriate installer program from
|
||||
|
||||
https://www.wireshark.org/download.html
|
||||
|
@ -15,8 +16,8 @@ https://www.wireshark.org/docs/
|
|||
|
||||
Compiling the Wireshark distribution from source
|
||||
================================================
|
||||
In case you want to develop Wireshark code yourself, you can find a
|
||||
comprehensive guide how to do this in the Developer's Guide, which
|
||||
you can find (and much more info) at:
|
||||
|
||||
https://wiki.wireshark.org/Development
|
||||
If you want to develop Wireshark code yourself, you can find
|
||||
comprehensive information in the Developer's Guide at:
|
||||
|
||||
https://www.wireshark.org/docs/
|
||||
|
|
|
@ -1,86 +0,0 @@
|
|||
#
|
||||
# Textify - Copy text files and make them useful for Windows users.
|
||||
#
|
||||
# Copyright 2013 Gerald Combs <gerald@wireshark.org>
|
||||
#
|
||||
# Wireshark - Network traffic analyzer
|
||||
# By Gerald Combs <gerald@wireshark.org>
|
||||
# Copyright 1998 Gerald Combs
|
||||
#
|
||||
# SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#requires -version 2
|
||||
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Text file conversion script for packaging on Windows.
|
||||
|
||||
.DESCRIPTION
|
||||
This script copies a text file from a source to a destination,
|
||||
converting line endings and adding a ".txt" filename extension
|
||||
if needed. If the destination is a directory the source file
|
||||
name is used. Newer files will not be overwritten.
|
||||
|
||||
The destination file should be double-clickable and usable
|
||||
when Notepad is the default editor.
|
||||
|
||||
.PARAMETER Destination
|
||||
Specifies the destination directory for the text files.
|
||||
|
||||
.PARAMETER SourceFiles
|
||||
The names of the files to copy and convert.
|
||||
|
||||
.INPUTS
|
||||
-Destination Destination directory.
|
||||
-SourceFiles List of files.
|
||||
|
||||
.OUTPUTS
|
||||
Copies of input files, UTF8 encoded with Windows line endings and no BOM in the
|
||||
destination directory.
|
||||
|
||||
.EXAMPLE
|
||||
C:\PS> .\tools\textify.ps1 -Destination wireshark-release-staging COPYING
|
||||
#>
|
||||
|
||||
Param(
|
||||
[Parameter(Mandatory=$true, Position=0)]
|
||||
[ValidateScript({Test-Path $_ -PathType 'Container'})]
|
||||
[String]
|
||||
$Destination,
|
||||
|
||||
[Parameter(Mandatory=$true, Position=1, ValueFromRemainingArguments=$true)]
|
||||
[ValidateScript({Test-Path $_ -PathType 'Leaf'})]
|
||||
[String[]]
|
||||
$SourceFiles
|
||||
)
|
||||
|
||||
$no_bom_encoding = New-Object System.Text.UTF8Encoding($False)
|
||||
|
||||
foreach ($src_file in Get-ChildItem $SourceFiles) {
|
||||
if ($Destination) {
|
||||
$base = Split-Path -Leaf $src_file
|
||||
$dst_file = Join-Path $Destination $base
|
||||
} else {
|
||||
$dst_file = $src_file.FullName
|
||||
}
|
||||
|
||||
if (-not $dst_file.EndsWith(".txt")) {
|
||||
$dst_file += ".txt"
|
||||
}
|
||||
|
||||
$src_modtime = (Get-Item $src_file).LastWriteTime
|
||||
|
||||
if (-not (Test-Path $dst_file) -or ((Get-Item $dst_file).LastWriteTime -lt $src_modtime)) {
|
||||
# "Get-Content -Encoding" is undocumented in PS 2.0, but works
|
||||
# here. If it doesn't work elsewhere we can use:
|
||||
# $contents = [System.IO.File]::ReadAllLines($src_file, $no_bom_encoding)
|
||||
$contents = Get-Content -Encoding UTF8 $src_file
|
||||
# We might want to write this out with a BOM in order to improve
|
||||
# the chances of Notepad's UTF-8 heuristics.
|
||||
# https://devblogs.microsoft.com/oldnewthing/?p=27223
|
||||
[System.IO.File]::WriteAllLines($dst_file, $contents, $no_bom_encoding)
|
||||
Write-Host "Textified $src_file to $dst_file"
|
||||
} else {
|
||||
Write-Host "Skipping $src_file"
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue