mirror of
https://github.com/microsoft/vcpkg.git
synced 2024-11-27 19:09:00 +08:00
[winpty, ptyqt] Added ptyqt and winpty ports (#21440)
* Added ptyqt and winpty ports * Fix part of issues * Build fixes for Windows * PR suggestions * Update versions * Update CI Baseline * Fix PR review suggestions * fix version * Fix baseline and versions * Adjust winpty patch * Versions updated
This commit is contained in:
parent
c85581f9cc
commit
25e49b72bc
42
ports/ptyqt/portfile.cmake
Normal file
42
ports/ptyqt/portfile.cmake
Normal file
@ -0,0 +1,42 @@
|
||||
vcpkg_from_github(
|
||||
OUT_SOURCE_PATH SOURCE_PATH
|
||||
REPO kafeg/ptyqt
|
||||
REF 0.6.3
|
||||
SHA512 7a490a6d0cca500d202b0524abf8596d70872c224eea778efd941ad2a995a8a53d295e3ac000ca8fb63e02467f1191ae6bddfd8469fe5df2aca8af972d06fcff
|
||||
HEAD_REF master
|
||||
)
|
||||
|
||||
if(VCPKG_CMAKE_SYSTEM_NAME STREQUAL "Linux")
|
||||
set(VCPKG_CXX_FLAGS "${VCPKG_CXX_FLAGS} -lrt")
|
||||
set(VCPKG_C_FLAGS "${VCPKG_C_FLAGS} -lrt")
|
||||
|
||||
if(VCPKG_TARGET_ARCHITECTURE STREQUAL "arm" OR VCPKG_TARGET_ARCHITECTURE STREQUAL "arm64")
|
||||
file(READ ${SOURCE_PATH}/core/CMakeLists.txt filedata)
|
||||
string(REPLACE "-static-libstdc++" "-static-libstdc++ -lglib-2.0" filedata "${filedata}")
|
||||
file(WRITE ${SOURCE_PATH}/core/CMakeLists.txt "${filedata}")
|
||||
else()
|
||||
file(READ ${SOURCE_PATH}/core/CMakeLists.txt filedata)
|
||||
string(REPLACE "-static-libstdc++ -lglib-2.0" "-static-libstdc++" filedata "${filedata}")
|
||||
file(WRITE ${SOURCE_PATH}/core/CMakeLists.txt "${filedata}")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if (VCPKG_LIBRARY_LINKAGE STREQUAL dynamic)
|
||||
set(BUILD_TYPE SHARED)
|
||||
else()
|
||||
set(BUILD_TYPE STATIC)
|
||||
endif()
|
||||
|
||||
vcpkg_cmake_configure(
|
||||
SOURCE_PATH ${SOURCE_PATH}
|
||||
OPTIONS
|
||||
-DNO_BUILD_TESTS=1
|
||||
-DNO_BUILD_EXAMPLES=1
|
||||
-DBUILD_TYPE=${BUILD_TYPE}
|
||||
)
|
||||
|
||||
vcpkg_cmake_install()
|
||||
vcpkg_copy_pdbs()
|
||||
|
||||
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)
|
||||
file(INSTALL ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright)
|
21
ports/ptyqt/vcpkg.json
Normal file
21
ports/ptyqt/vcpkg.json
Normal file
@ -0,0 +1,21 @@
|
||||
{
|
||||
"name": "ptyqt",
|
||||
"version": "0.6.3",
|
||||
"description": "PtyQt - C++ library for work with PseudoTerminals",
|
||||
"supports": "!uwp",
|
||||
"dependencies": [
|
||||
"qt5-base",
|
||||
{
|
||||
"name": "vcpkg-cmake",
|
||||
"host": true
|
||||
},
|
||||
{
|
||||
"name": "vcpkg-cmake-config",
|
||||
"host": true
|
||||
},
|
||||
{
|
||||
"name": "winpty",
|
||||
"platform": "windows"
|
||||
}
|
||||
]
|
||||
}
|
172
ports/winpty/CMakeLists.txt
Normal file
172
ports/winpty/CMakeLists.txt
Normal file
@ -0,0 +1,172 @@
|
||||
cmake_minimum_required(VERSION 3.12.0)
|
||||
|
||||
set(PROJECT_VERSION "0.4.3")
|
||||
project(winpty VERSION ${PROJECT_VERSION} LANGUAGES CXX)
|
||||
|
||||
add_definitions(-DPROJECT_VERSION="${PROJECT_VERSION}")
|
||||
add_definitions(-D_WIN32_WINNT=0x0600)
|
||||
add_definitions(-DUNICODE)
|
||||
add_definitions(-D_UNICODE)
|
||||
add_definitions(-DNOMINMAX)
|
||||
|
||||
if("${BUILD_TYPE}" STREQUAL "STATIC")
|
||||
add_definitions(-DBUILD_STATIC)
|
||||
else()
|
||||
add_definitions(-DCOMPILING_WINPTY_DLL)
|
||||
endif()
|
||||
|
||||
set(CMAKE_CXX_STANDARD 11)
|
||||
set(CMAKE_INCLUDE_CURRENT_DIR ON)
|
||||
|
||||
set(WINPTY_INSTALL_INCLUDE_DIR ${CMAKE_INSTALL_PREFIX}/include)
|
||||
set(WINPTY_INSTALL_BIN_DIR ${CMAKE_INSTALL_PREFIX}/bin)
|
||||
set(WINPTY_INSTALL_LIB_DIR ${CMAKE_INSTALL_PREFIX}/lib)
|
||||
|
||||
include_directories(${WINPTY_INSTALL_INCLUDE_DIR})
|
||||
|
||||
#winpty library
|
||||
set(WINPTYLIB_SOURCE_FILES
|
||||
src/include/winpty.h
|
||||
src/libwinpty/AgentLocation.cc
|
||||
src/libwinpty/AgentLocation.h
|
||||
src/libwinpty/winpty.cc
|
||||
src/shared/AgentMsg.h
|
||||
src/shared/BackgroundDesktop.h
|
||||
src/shared/BackgroundDesktop.cc
|
||||
src/shared/Buffer.h
|
||||
src/shared/Buffer.cc
|
||||
src/shared/DebugClient.h
|
||||
src/shared/DebugClient.cc
|
||||
src/shared/GenRandom.h
|
||||
src/shared/GenRandom.cc
|
||||
src/shared/OsModule.h
|
||||
src/shared/OwnedHandle.h
|
||||
src/shared/OwnedHandle.cc
|
||||
src/shared/StringBuilder.h
|
||||
src/shared/StringUtil.cc
|
||||
src/shared/StringUtil.h
|
||||
src/shared/WindowsSecurity.cc
|
||||
src/shared/WindowsSecurity.h
|
||||
src/shared/WindowsVersion.h
|
||||
src/shared/WindowsVersion.cc
|
||||
src/shared/WinptyAssert.h
|
||||
src/shared/WinptyAssert.cc
|
||||
src/shared/WinptyException.h
|
||||
src/shared/WinptyException.cc
|
||||
src/shared/WinptyVersion.h
|
||||
src/shared/WinptyVersion.cc
|
||||
src/shared/winpty_snprintf.h
|
||||
)
|
||||
|
||||
add_library( winpty ${BUILD_TYPE} ${WINPTYLIB_SOURCE_FILES} )
|
||||
|
||||
#winpty agent executable
|
||||
set(WINPTYAGENT_SOURCE_FILES
|
||||
src/agent/Agent.h
|
||||
src/agent/Agent.cc
|
||||
src/agent/AgentCreateDesktop.h
|
||||
src/agent/AgentCreateDesktop.cc
|
||||
src/agent/ConsoleFont.cc
|
||||
src/agent/ConsoleFont.h
|
||||
src/agent/ConsoleInput.cc
|
||||
src/agent/ConsoleInput.h
|
||||
src/agent/ConsoleInputReencoding.cc
|
||||
src/agent/ConsoleInputReencoding.h
|
||||
src/agent/ConsoleLine.cc
|
||||
src/agent/ConsoleLine.h
|
||||
src/agent/Coord.h
|
||||
src/agent/DebugShowInput.h
|
||||
src/agent/DebugShowInput.cc
|
||||
src/agent/DefaultInputMap.h
|
||||
src/agent/DefaultInputMap.cc
|
||||
src/agent/DsrSender.h
|
||||
src/agent/EventLoop.h
|
||||
src/agent/EventLoop.cc
|
||||
src/agent/InputMap.h
|
||||
src/agent/InputMap.cc
|
||||
src/agent/LargeConsoleRead.h
|
||||
src/agent/LargeConsoleRead.cc
|
||||
src/agent/NamedPipe.h
|
||||
src/agent/NamedPipe.cc
|
||||
src/agent/Scraper.h
|
||||
src/agent/Scraper.cc
|
||||
src/agent/SimplePool.h
|
||||
src/agent/SmallRect.h
|
||||
src/agent/Terminal.h
|
||||
src/agent/Terminal.cc
|
||||
src/agent/UnicodeEncoding.h
|
||||
src/agent/Win32Console.cc
|
||||
src/agent/Win32Console.h
|
||||
src/agent/Win32ConsoleBuffer.cc
|
||||
src/agent/Win32ConsoleBuffer.h
|
||||
src/agent/main.cc
|
||||
src/shared/AgentMsg.h
|
||||
src/shared/BackgroundDesktop.h
|
||||
src/shared/BackgroundDesktop.cc
|
||||
src/shared/Buffer.h
|
||||
src/shared/Buffer.cc
|
||||
src/shared/DebugClient.h
|
||||
src/shared/DebugClient.cc
|
||||
src/shared/GenRandom.h
|
||||
src/shared/GenRandom.cc
|
||||
src/shared/OsModule.h
|
||||
src/shared/OwnedHandle.h
|
||||
src/shared/OwnedHandle.cc
|
||||
src/shared/StringBuilder.h
|
||||
src/shared/StringUtil.cc
|
||||
src/shared/StringUtil.h
|
||||
src/shared/UnixCtrlChars.h
|
||||
src/shared/WindowsSecurity.cc
|
||||
src/shared/WindowsSecurity.h
|
||||
src/shared/WindowsVersion.h
|
||||
src/shared/WindowsVersion.cc
|
||||
src/shared/WinptyAssert.h
|
||||
src/shared/WinptyAssert.cc
|
||||
src/shared/WinptyException.h
|
||||
src/shared/WinptyException.cc
|
||||
src/shared/WinptyVersion.h
|
||||
src/shared/WinptyVersion.cc
|
||||
src/shared/winpty_snprintf.h
|
||||
)
|
||||
|
||||
add_executable(winpty-agent ${WINPTYAGENT_SOURCE_FILES})
|
||||
target_compile_definitions(winpty-agent PRIVATE -DWINPTY_AGENT_ASSERT)
|
||||
|
||||
|
||||
#winpty debugserver executable
|
||||
set(WINPTYAGENT_SOURCE_FILES
|
||||
src/debugserver/DebugServer.cc
|
||||
src/shared/DebugClient.h
|
||||
src/shared/DebugClient.cc
|
||||
src/shared/OwnedHandle.h
|
||||
src/shared/OwnedHandle.cc
|
||||
src/shared/OsModule.h
|
||||
src/shared/StringBuilder.h
|
||||
src/shared/StringUtil.cc
|
||||
src/shared/StringUtil.h
|
||||
src/shared/WindowsSecurity.h
|
||||
src/shared/WindowsSecurity.cc
|
||||
src/shared/WindowsVersion.h
|
||||
src/shared/WindowsVersion.cc
|
||||
src/shared/WinptyAssert.h
|
||||
src/shared/WinptyAssert.cc
|
||||
src/shared/WinptyException.h
|
||||
src/shared/WinptyException.cc
|
||||
src/shared/winpty_snprintf.h
|
||||
)
|
||||
|
||||
add_executable(winpty-debugserver ${WINPTYAGENT_SOURCE_FILES})
|
||||
|
||||
|
||||
if("${BUILD_TYPE}" STREQUAL "STATIC")
|
||||
install(TARGETS winpty DESTINATION ${WINPTY_INSTALL_LIB_DIR})
|
||||
else()
|
||||
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/winpty.dll DESTINATION ${WINPTY_INSTALL_BIN_DIR})
|
||||
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/winpty.lib DESTINATION ${CMAKE_INSTALL_PREFIX}/lib)
|
||||
endif()
|
||||
install(TARGETS winpty-agent DESTINATION ${WINPTY_INSTALL_BIN_DIR})
|
||||
install(TARGETS winpty-debugserver DESTINATION ${WINPTY_INSTALL_BIN_DIR})
|
||||
install(FILES src/include/winpty.h src/include/winpty_constants.h DESTINATION ${WINPTY_INSTALL_INCLUDE_DIR})
|
||||
|
||||
|
||||
|
45
ports/winpty/allow-build-static.patch
Normal file
45
ports/winpty/allow-build-static.patch
Normal file
@ -0,0 +1,45 @@
|
||||
diff --git a/src/include/winpty.h b/src/include/winpty.h
|
||||
index fdfe4bc..7864d96 100644
|
||||
--- a/src/include/winpty.h
|
||||
+++ b/src/include/winpty.h
|
||||
@@ -32,11 +32,15 @@
|
||||
* When compiled with __declspec(dllexport), with either MinGW or MSVC, the
|
||||
* winpty functions are unadorned--no underscore prefix or '@nn' suffix--so
|
||||
* GetProcAddress can be used easily. */
|
||||
+#ifndef BUILD_STATIC
|
||||
#ifdef COMPILING_WINPTY_DLL
|
||||
#define WINPTY_API __declspec(dllexport)
|
||||
#else
|
||||
#define WINPTY_API __declspec(dllimport)
|
||||
#endif
|
||||
+#else
|
||||
+#define WINPTY_API
|
||||
+#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
diff --git a/src/shared/WinptyVersion.cc b/src/shared/WinptyVersion.cc
|
||||
index 76bb8a5..33a2c23 100644
|
||||
--- a/src/shared/WinptyVersion.cc
|
||||
+++ b/src/shared/WinptyVersion.cc
|
||||
@@ -28,15 +28,15 @@
|
||||
// This header is auto-generated by either the Makefile (Unix) or
|
||||
// UpdateGenVersion.bat (gyp). It is placed in a 'gen' directory, which is
|
||||
// added to the search path.
|
||||
-#include "GenVersion.h"
|
||||
+//#include "GenVersion.h"
|
||||
|
||||
void dumpVersionToStdout() {
|
||||
- printf("winpty version %s\n", GenVersion_Version);
|
||||
- printf("commit %s\n", GenVersion_Commit);
|
||||
+ printf("winpty version %s\n", PROJECT_VERSION);
|
||||
+ printf("commit %s\n", "empty");
|
||||
}
|
||||
|
||||
void dumpVersionToTrace() {
|
||||
trace("winpty version %s (commit %s)",
|
||||
- GenVersion_Version,
|
||||
- GenVersion_Commit);
|
||||
+ PROJECT_VERSION,
|
||||
+ "empty");
|
||||
}
|
32
ports/winpty/portfile.cmake
Normal file
32
ports/winpty/portfile.cmake
Normal file
@ -0,0 +1,32 @@
|
||||
vcpkg_from_github(
|
||||
OUT_SOURCE_PATH SOURCE_PATH
|
||||
REPO rprichard/winpty
|
||||
REF antivirus
|
||||
SHA512 8f5539c1af2a1127219278446c1d028079867cecdeb03c4f208c7d8176e8802e8075ce1b6992e0ef73db34c69e58f73d3828698d865deb35cb883821ee245e4d
|
||||
HEAD_REF master
|
||||
PATCHES
|
||||
allow-build-static.patch
|
||||
)
|
||||
|
||||
file(COPY "${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt" DESTINATION "${SOURCE_PATH}")
|
||||
|
||||
if (VCPKG_LIBRARY_LINKAGE STREQUAL dynamic)
|
||||
set(BUILD_TYPE SHARED)
|
||||
else()
|
||||
set(BUILD_TYPE STATIC)
|
||||
endif()
|
||||
|
||||
vcpkg_cmake_configure(
|
||||
SOURCE_PATH ${SOURCE_PATH}
|
||||
OPTIONS
|
||||
-DBUILD_TYPE=${BUILD_TYPE}
|
||||
)
|
||||
|
||||
vcpkg_cmake_install()
|
||||
|
||||
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)
|
||||
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/share)
|
||||
|
||||
vcpkg_copy_tools(TOOL_NAMES winpty-agent winpty-debugserver AUTO_CLEAN)
|
||||
|
||||
file(INSTALL ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright)
|
16
ports/winpty/vcpkg.json
Normal file
16
ports/winpty/vcpkg.json
Normal file
@ -0,0 +1,16 @@
|
||||
{
|
||||
"name": "winpty",
|
||||
"version": "0.4.3",
|
||||
"description": "winpty is a Windows software package providing an interface similar to a Unix pty-master for communicating with Windows console programs",
|
||||
"supports": "windows & !uwp",
|
||||
"dependencies": [
|
||||
{
|
||||
"name": "vcpkg-cmake",
|
||||
"host": true
|
||||
},
|
||||
{
|
||||
"name": "vcpkg-cmake-config",
|
||||
"host": true
|
||||
}
|
||||
]
|
||||
}
|
@ -5416,6 +5416,10 @@
|
||||
"baseline": "3.0.0",
|
||||
"port-version": 10
|
||||
},
|
||||
"ptyqt": {
|
||||
"baseline": "0.6.3",
|
||||
"port-version": 0
|
||||
},
|
||||
"pugixml": {
|
||||
"baseline": "1.11.4",
|
||||
"port-version": 1
|
||||
@ -7152,6 +7156,10 @@
|
||||
"baseline": "4.1.3",
|
||||
"port-version": 6
|
||||
},
|
||||
"winpty": {
|
||||
"baseline": "0.4.3",
|
||||
"port-version": 0
|
||||
},
|
||||
"winreg": {
|
||||
"baseline": "4.1.2",
|
||||
"port-version": 0
|
||||
|
9
versions/p-/ptyqt.json
Normal file
9
versions/p-/ptyqt.json
Normal file
@ -0,0 +1,9 @@
|
||||
{
|
||||
"versions": [
|
||||
{
|
||||
"git-tree": "f1290a650fa42cb4cb9caf9fe04d47d2b3506248",
|
||||
"version": "0.6.3",
|
||||
"port-version": 0
|
||||
}
|
||||
]
|
||||
}
|
9
versions/w-/winpty.json
Normal file
9
versions/w-/winpty.json
Normal file
@ -0,0 +1,9 @@
|
||||
{
|
||||
"versions": [
|
||||
{
|
||||
"git-tree": "5e8c617e9c5e12b7e760808bdea82f3c3ccc6153",
|
||||
"version": "0.4.3",
|
||||
"port-version": 0
|
||||
}
|
||||
]
|
||||
}
|
Loading…
Reference in New Issue
Block a user