Skip to content
This repository has been archived by the owner on Sep 16, 2024. It is now read-only.

Commit

Permalink
Fix deb package description on CMake < 3.16 (#8)
Browse files Browse the repository at this point in the history
  • Loading branch information
mgbowen committed Jan 23, 2021
1 parent 0c94c81 commit f54cebb
Show file tree
Hide file tree
Showing 6 changed files with 46 additions and 12 deletions.
29 changes: 17 additions & 12 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ set(CMAKE_CXX_STANDARD 20)
set(CMAKE_POSITION_INDEPENDENT_CODE ON)

include(DetectWSL)
include(Util)

# 3P dependencies.
include(BuildMingwStdThreads)
Expand Down Expand Up @@ -117,14 +118,19 @@ set(CPACK_DEBIAN_PACKAGE_SECTION main)

set(CPACK_DEBIAN_REAL_DEB_GROUP_PACKAGE_NAME "windows-fido-bridge-skapiv${SK_API_VERSION}")

set(CPACK_COMPONENT_REAL_DEB_GROUP_DESCRIPTION "\
an OpenSSH security key middleware for WSL (for OpenSSH sk-api v${SK_API_VERSION}) \
\nwindows-fido-bridge is an OpenSSH security key middleware that allows you \
\nto use a FIDO2/U2F security key (e.g. a YubiKey) to SSH into a remote server \
\n from WSL.")
set(skapi_deb_description_configured_file_path "${CMAKE_CURRENT_BINARY_DIR}/skapi_deb_description")
configure_file(
"${CMAKE_SOURCE_DIR}/package/deb/skapi/description.template"
"${skapi_deb_description_configured_file_path}"
@ONLY
)
read_deb_description_from_file(
"${skapi_deb_description_configured_file_path}"
CPACK_COMPONENT_REAL_DEB_GROUP_DESCRIPTION
)

# Only install in a deb
install(FILES "${CMAKE_SOURCE_DIR}/package/deb/copyright"
install(FILES "${CMAKE_SOURCE_DIR}/package/deb/skapi/copyright"
DESTINATION "share/doc/${CPACK_DEBIAN_REAL_DEB_GROUP_PACKAGE_NAME}"
COMPONENT real_deb
EXCLUDE_FROM_ALL
Expand Down Expand Up @@ -171,14 +177,13 @@ set(CPACK_DEBIAN_REAL_DEB_GROUP_FILE_NAME DEB-DEFAULT)

set(CPACK_DEBIAN_VERSION_SELECTION_SHIM_GROUP_PACKAGE_NAME "windows-fido-bridge")

set(CPACK_COMPONENT_VERSION_SELECTION_SHIM_GROUP_DESCRIPTION "\
an OpenSSH security key middleware for WSL (skapi version selection shim) \
\nwindows-fido-bridge is an OpenSSH security key middleware that allows you \
\nto use a FIDO2/U2F security key (e.g. a YubiKey) to SSH into a remote server \
\n from WSL.")
read_deb_description_from_file(
"${CMAKE_SOURCE_DIR}/package/deb/version-selection-shim/description"
CPACK_COMPONENT_VERSION_SELECTION_SHIM_GROUP_DESCRIPTION
)

# Only install in a deb
install(FILES "${CMAKE_SOURCE_DIR}/package/deb/version-selection-shim-copyright"
install(FILES "${CMAKE_SOURCE_DIR}/package/deb/version-selection-shim/copyright"
DESTINATION share/doc/windows-fido-bridge
RENAME copyright
COMPONENT version_selection_shim
Expand Down
21 changes: 21 additions & 0 deletions cmake/Util.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
function(read_deb_description_from_file FILE_PATH OUTVAR)
file(READ "${FILE_PATH}" _desc)

# Strip trailing whitespace.
string(REGEX REPLACE "\r?\n[ \r\n]*$" "" _desc "${_desc}")

if (CMAKE_VERSION VERSION_LESS "3.16.0")
# Debian package descriptions with multiple lines need a single leading
# space for every line after the first one. Prior to CMake 3.16, CPack's
# deb generator did not do any special processing to multi-line
# descriptions, which means you have to do this yourself.
#
# See CMake 3.16.0's release notes:
# https://cmake.org/cmake/help/latest/release/3.16.html#cpack
# and this windows-fido-bridge GitHub issue:
# https://github.com/mgbowen/windows-fido-bridge/issues/8.
string(REGEX REPLACE "(\r?\n)" "\\1 " _desc "${_desc}")
endif()

set(${OUTVAR} "${_desc}" PARENT_SCOPE)
endfunction()
File renamed without changes.
4 changes: 4 additions & 0 deletions package/deb/skapi/description.template
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
an OpenSSH security key middleware for WSL (for OpenSSH sk-api v@SK_API_VERSION@)
windows-fido-bridge is an OpenSSH security key middleware that allows you
to use a FIDO2/U2F security key (e.g. a YubiKey) to SSH into a remote server
from WSL.
4 changes: 4 additions & 0 deletions package/deb/version-selection-shim/description
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
an OpenSSH security key middleware for WSL (skapi version selection shim)
windows-fido-bridge is an OpenSSH security key middleware that allows you
to use a FIDO2/U2F security key (e.g. a YubiKey) to SSH into a remote server
from WSL.

0 comments on commit f54cebb

Please sign in to comment.