mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
commit
4b26e365ae
5
third-party/CMakeLists.txt
vendored
5
third-party/CMakeLists.txt
vendored
@ -124,13 +124,8 @@ set(LUAROCKS_SHA256 ea1881d6954f2a98c34f93674571c8f0cbdbc28dedb3fa3cb56b6a91886d
|
||||
set(UNIBILIUM_URL https://github.com/mauke/unibilium/archive/v2.0.0.tar.gz)
|
||||
set(UNIBILIUM_SHA256 78997d38d4c8177c60d3d0c1aa8c53fd0806eb21825b7b335b1768d7116bc1c1)
|
||||
|
||||
if(WIN32)
|
||||
set(LIBTERMKEY_URL https://github.com/equalsraf/libtermkey/archive/tb-windows.zip)
|
||||
set(LIBTERMKEY_SHA256 c81e33e38662b151a49847ff4feef4f8c4b2a66f3e159a28b575cbc9bcd8ffea)
|
||||
else()
|
||||
set(LIBTERMKEY_URL http://www.leonerd.org.uk/code/libtermkey/libtermkey-0.20.tar.gz)
|
||||
set(LIBTERMKEY_SHA256 6c0d87c94ab9915e76ecd313baec08dedf3bd56de83743d9aa923a081935d2f5)
|
||||
endif()
|
||||
|
||||
set(LIBVTERM_URL https://github.com/neovim/libvterm/archive/a9c7c6fd20fa35e0ad3e0e98901ca12dfca9c25c.tar.gz)
|
||||
set(LIBVTERM_SHA256 1a4272be91d9614dc183a503786df83b6584e4afaab7feaaa5409f841afbd796)
|
||||
|
24
third-party/cmake/BuildLibtermkey.cmake
vendored
24
third-party/cmake/BuildLibtermkey.cmake
vendored
@ -11,14 +11,22 @@ ExternalProject_Add(libtermkey
|
||||
-DTARGET=libtermkey
|
||||
-DUSE_EXISTING_SRC_DIR=${USE_EXISTING_SRC_DIR}
|
||||
-P ${CMAKE_CURRENT_SOURCE_DIR}/cmake/DownloadAndExtractFile.cmake
|
||||
CONFIGURE_COMMAND ${CMAKE_COMMAND} ${DEPS_BUILD_DIR}/src/libtermkey
|
||||
-DCMAKE_INSTALL_PREFIX=${DEPS_INSTALL_DIR}
|
||||
# Pass toolchain
|
||||
-DCMAKE_TOOLCHAIN_FILE=${TOOLCHAIN}
|
||||
-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
|
||||
# Hack to avoid -rdynamic in Mingw
|
||||
-DCMAKE_SHARED_LIBRARY_LINK_C_FLAGS=""
|
||||
-DCMAKE_GENERATOR=${CMAKE_GENERATOR}
|
||||
PATCH_COMMAND ${GIT_EXECUTABLE} -C ${DEPS_BUILD_DIR}/src/libtermkey init
|
||||
COMMAND ${GIT_EXECUTABLE} -C ${DEPS_BUILD_DIR}/src/libtermkey apply --ignore-whitespace
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/patches/libtermkey-Add-support-for-Windows.patch
|
||||
CONFIGURE_COMMAND ${CMAKE_COMMAND} -E copy
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/cmake/libtermkeyCMakeLists.txt
|
||||
${DEPS_BUILD_DIR}/src/libtermkey/CMakeLists.txt
|
||||
COMMAND ${CMAKE_COMMAND} ${DEPS_BUILD_DIR}/src/libtermkey
|
||||
-DCMAKE_INSTALL_PREFIX=${DEPS_INSTALL_DIR}
|
||||
# Pass toolchain
|
||||
-DCMAKE_TOOLCHAIN_FILE=${TOOLCHAIN}
|
||||
-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
|
||||
# Hack to avoid -rdynamic in Mingw
|
||||
-DCMAKE_SHARED_LIBRARY_LINK_C_FLAGS=""
|
||||
-DCMAKE_GENERATOR=${CMAKE_GENERATOR}
|
||||
-DUNIBILIUM_INCLUDE_DIRS=${DEPS_INSTALL_DIR}/include
|
||||
-DUNIBILIUM_LIBRARIES=${DEPS_LIB_DIR}/${CMAKE_STATIC_LIBRARY_PREFIX}unibilium${CMAKE_STATIC_LIBRARY_SUFFIX}
|
||||
BUILD_COMMAND ${CMAKE_COMMAND} --build . --config ${CMAKE_BUILD_TYPE}
|
||||
INSTALL_COMMAND ${CMAKE_COMMAND} --build . --target install --config ${CMAKE_BUILD_TYPE})
|
||||
else()
|
||||
|
12
third-party/cmake/BuildLuv.cmake
vendored
12
third-party/cmake/BuildLuv.cmake
vendored
@ -37,9 +37,17 @@ set(LUV_SRC_DIR ${DEPS_BUILD_DIR}/src/luv)
|
||||
set(LUV_INCLUDE_FLAGS
|
||||
"-I${DEPS_INSTALL_DIR}/include -I${DEPS_INSTALL_DIR}/include/luajit-2.0")
|
||||
|
||||
# Replace luv default rockspec with the alternate one under the "rockspecs"
|
||||
# directory
|
||||
set(LUV_PATCH_COMMAND
|
||||
${CMAKE_COMMAND} -DLUV_SRC_DIR=${LUV_SRC_DIR}
|
||||
-P ${PROJECT_SOURCE_DIR}/cmake/PatchLuv.cmake)
|
||||
${CMAKE_COMMAND} -E copy_directory ${LUV_SRC_DIR}/rockspecs ${LUV_SRC_DIR})
|
||||
if(MINGW)
|
||||
set(LUV_PATCH_COMMAND
|
||||
${LUV_PATCH_COMMAND}
|
||||
COMMAND ${GIT_EXECUTABLE} -C ${LUV_SRC_DIR} init
|
||||
COMMAND ${GIT_EXECUTABLE} -C ${LUV_SRC_DIR} apply --ignore-whitespace
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/patches/luv-Add-missing-definitions-for-MinGW.patch)
|
||||
endif()
|
||||
|
||||
set(LUV_CONFIGURE_COMMAND_COMMON
|
||||
${CMAKE_COMMAND} ${LUV_SRC_DIR}
|
||||
|
29
third-party/cmake/PatchLuv.cmake
vendored
29
third-party/cmake/PatchLuv.cmake
vendored
@ -1,29 +0,0 @@
|
||||
# replace luv default rockspec with the alternate one under the "rockspecs"
|
||||
# directory
|
||||
file(GLOB LUV_ROCKSPEC RELATIVE ${LUV_SRC_DIR} ${LUV_SRC_DIR}/*.rockspec)
|
||||
file(RENAME ${LUV_SRC_DIR}/rockspecs/${LUV_ROCKSPEC} ${LUV_SRC_DIR}/${LUV_ROCKSPEC})
|
||||
|
||||
# Some versions of mingw are missing defines required by luv dns module, add
|
||||
# them now
|
||||
set(LUV_SRC_DNS_C_DEFS
|
||||
"#ifndef AI_NUMERICSERV
|
||||
# define AI_NUMERICSERV 0x0008
|
||||
#endif
|
||||
#ifndef AI_ALL
|
||||
# define AI_ALL 0x00000100
|
||||
#endif
|
||||
#ifndef AI_ADDRCONFIG
|
||||
# define AI_ADDRCONFIG 0x00000400
|
||||
#endif
|
||||
#ifndef AI_V4MAPPED
|
||||
# define AI_V4MAPPED 0x00000800
|
||||
#endif")
|
||||
|
||||
file(READ ${LUV_SRC_DIR}/src/dns.c LUV_SRC_DNS_C)
|
||||
string(REPLACE
|
||||
"\n#include <netdb.h>"
|
||||
"\n#include <netdb.h>\n#else\n${LUV_SRC_DNS_C_DEFS}"
|
||||
LUV_SRC_DNS_C_PATCHED
|
||||
"${LUV_SRC_DNS_C}")
|
||||
file(WRITE ${LUV_SRC_DIR}/src/dns.c "${LUV_SRC_DNS_C_PATCHED}")
|
||||
|
34
third-party/cmake/libtermkeyCMakeLists.txt
vendored
Normal file
34
third-party/cmake/libtermkeyCMakeLists.txt
vendored
Normal file
@ -0,0 +1,34 @@
|
||||
cmake_minimum_required(VERSION 2.8.7)
|
||||
project(libtermkey)
|
||||
|
||||
add_definitions(-D _CRT_SECURE_NO_WARNINGS)
|
||||
add_definitions(-DHAVE_UNIBILIUM)
|
||||
if(NOT MSVC)
|
||||
add_definitions(-std=c99)
|
||||
endif()
|
||||
|
||||
include_directories(${PROJECT_BINARY_DIR}/t)
|
||||
include_directories(SYSTEM ${UNIBILIUM_INCLUDE_DIRS})
|
||||
|
||||
add_library(termkey termkey.c driver-csi.c driver-ti.c)
|
||||
set_target_properties(termkey PROPERTIES
|
||||
PUBLIC_HEADER ${PROJECT_SOURCE_DIR}/termkey.h)
|
||||
target_link_libraries(termkey ${UNIBILIUM_LIBRARIES})
|
||||
|
||||
include(GNUInstallDirs)
|
||||
install(TARGETS termkey
|
||||
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
|
||||
|
||||
enable_testing()
|
||||
file(GLOB TESTSOURCES "t/[0-9]*.c")
|
||||
foreach(f ${TESTSOURCES})
|
||||
get_filename_component(t ${f} NAME_WE)
|
||||
if(${t} STREQUAL 05read)
|
||||
continue()
|
||||
endif()
|
||||
|
||||
add_executable("test_${t}" ${f} t/taplib.c)
|
||||
target_link_libraries("test_${t}" termkey)
|
||||
add_test("${t}" "test_${t}")
|
||||
endforeach()
|
170
third-party/patches/libtermkey-Add-support-for-Windows.patch
vendored
Normal file
170
third-party/patches/libtermkey-Add-support-for-Windows.patch
vendored
Normal file
@ -0,0 +1,170 @@
|
||||
From fbe91a958816d85fa93665eb8f7a7a8e05eb9650 Mon Sep 17 00:00:00 2001
|
||||
From: Rui Abreu Ferreira <raf-ep@gmx.com>
|
||||
Date: Tue, 5 Apr 2016 00:12:41 +0100
|
||||
Subject: [PATCH] Add support for Windows
|
||||
|
||||
Ported termkey for windows.
|
||||
|
||||
- The TERMKEY_FLAG_NOTERMIOS is ignore in Windows, since there is no termios.
|
||||
- The termkey_waitkey() function is not implemented in windows, since there
|
||||
is no poll() alternative.
|
||||
- The CMake recipe only supports unibilium, not curses.
|
||||
---
|
||||
driver-ti.c | 8 +++++++-
|
||||
termkey-internal.h | 11 ++++++++++-
|
||||
termkey.c | 22 ++++++++++++++++++----
|
||||
3 files changed, 35 insertions(+), 6 deletions(-)
|
||||
|
||||
diff --git a/driver-ti.c b/driver-ti.c
|
||||
index e673ab7..f5f8052 100644
|
||||
--- a/driver-ti.c
|
||||
+++ b/driver-ti.c
|
||||
@@ -17,7 +17,9 @@
|
||||
#include <ctype.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
-#include <unistd.h>
|
||||
+#ifndef _WIN32
|
||||
+# include <unistd.h>
|
||||
+#endif
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
@@ -338,8 +340,10 @@ static int start_driver(TermKey *tk, void *info)
|
||||
if(fstat(tk->fd, &statbuf) == -1)
|
||||
return 0;
|
||||
|
||||
+#ifndef _WIN32
|
||||
if(S_ISFIFO(statbuf.st_mode))
|
||||
return 1;
|
||||
+#endif
|
||||
|
||||
// Can't call putp or tputs because they suck and don't give us fd control
|
||||
len = strlen(start_string);
|
||||
@@ -367,8 +371,10 @@ static int stop_driver(TermKey *tk, void *info)
|
||||
if(fstat(tk->fd, &statbuf) == -1)
|
||||
return 0;
|
||||
|
||||
+#ifndef _WIN32
|
||||
if(S_ISFIFO(statbuf.st_mode))
|
||||
return 1;
|
||||
+#endif
|
||||
|
||||
/* The terminfo database will contain keys in application cursor key mode.
|
||||
* We may need to enable that mode
|
||||
diff --git a/termkey-internal.h b/termkey-internal.h
|
||||
index 52829b3..b796729 100644
|
||||
--- a/termkey-internal.h
|
||||
+++ b/termkey-internal.h
|
||||
@@ -4,7 +4,14 @@
|
||||
#include "termkey.h"
|
||||
|
||||
#include <stdint.h>
|
||||
-#include <termios.h>
|
||||
+#ifndef _WIN32
|
||||
+# include <termios.h>
|
||||
+#endif
|
||||
+
|
||||
+#ifdef _MSC_VER
|
||||
+#include <BaseTsd.h>
|
||||
+typedef SSIZE_T ssize_t;
|
||||
+#endif
|
||||
|
||||
struct TermKeyDriver
|
||||
{
|
||||
@@ -41,8 +48,10 @@ struct TermKey {
|
||||
size_t hightide; /* Position beyond buffstart at which peekkey() should next start
|
||||
* normally 0, but see also termkey_interpret_csi */
|
||||
|
||||
+#ifndef _WIN32
|
||||
struct termios restore_termios;
|
||||
char restore_termios_valid;
|
||||
+#endif
|
||||
|
||||
TermKey_Terminfo_Getstr_Hook *ti_getstr_hook;
|
||||
void *ti_getstr_hook_data;
|
||||
diff --git a/termkey.c b/termkey.c
|
||||
index 2f01f3a..145b99f 100644
|
||||
--- a/termkey.c
|
||||
+++ b/termkey.c
|
||||
@@ -3,14 +3,20 @@
|
||||
|
||||
#include <ctype.h>
|
||||
#include <errno.h>
|
||||
-#include <poll.h>
|
||||
-#include <unistd.h>
|
||||
+#ifndef _WIN32
|
||||
+# include <poll.h>
|
||||
+# include <unistd.h>
|
||||
+# include <strings.h>
|
||||
+#endif
|
||||
#include <string.h>
|
||||
-#include <strings.h>
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
-#define strcaseeq(a,b) (strcasecmp(a,b) == 0)
|
||||
+#ifdef _MSC_VER
|
||||
+# define strcaseeq(a,b) (_stricmp(a,b) == 0)
|
||||
+#else
|
||||
+# define strcaseeq(a,b) (strcasecmp(a,b) == 0)
|
||||
+#endif
|
||||
|
||||
void termkey_check_version(int major, int minor)
|
||||
{
|
||||
@@ -282,7 +288,9 @@ static TermKey *termkey_alloc(void)
|
||||
tk->buffsize = 256; /* bytes */
|
||||
tk->hightide = 0;
|
||||
|
||||
+#ifndef _WIN32
|
||||
tk->restore_termios_valid = 0;
|
||||
+#endif
|
||||
|
||||
tk->ti_getstr_hook = NULL;
|
||||
tk->ti_getstr_hook_data = NULL;
|
||||
@@ -483,6 +491,7 @@ int termkey_start(TermKey *tk)
|
||||
if(tk->is_started)
|
||||
return 1;
|
||||
|
||||
+#ifndef _WIN32
|
||||
if(tk->fd != -1 && !(tk->flags & TERMKEY_FLAG_NOTERMIOS)) {
|
||||
struct termios termios;
|
||||
if(tcgetattr(tk->fd, &termios) == 0) {
|
||||
@@ -517,6 +526,7 @@ int termkey_start(TermKey *tk)
|
||||
tcsetattr(tk->fd, TCSANOW, &termios);
|
||||
}
|
||||
}
|
||||
+#endif
|
||||
|
||||
struct TermKeyDriverNode *p;
|
||||
for(p = tk->drivers; p; p = p->next)
|
||||
@@ -542,8 +552,10 @@ int termkey_stop(TermKey *tk)
|
||||
if(p->driver->stop_driver)
|
||||
(*p->driver->stop_driver)(tk, p->info);
|
||||
|
||||
+#ifndef _WIN32
|
||||
if(tk->restore_termios_valid)
|
||||
tcsetattr(tk->fd, TCSANOW, &tk->restore_termios);
|
||||
+#endif
|
||||
|
||||
tk->is_started = 0;
|
||||
|
||||
@@ -1046,6 +1058,7 @@ TermKeyResult termkey_getkey_force(TermKey *tk, TermKeyKey *key)
|
||||
return ret;
|
||||
}
|
||||
|
||||
+#ifndef _WIN32
|
||||
TermKeyResult termkey_waitkey(TermKey *tk, TermKeyKey *key)
|
||||
{
|
||||
if(tk->fd == -1) {
|
||||
@@ -1105,6 +1118,7 @@ retry:
|
||||
|
||||
/* UNREACHABLE */
|
||||
}
|
||||
+#endif
|
||||
|
||||
TermKeyResult termkey_advisereadable(TermKey *tk)
|
||||
{
|
||||
--
|
||||
2.16.1.windows.4
|
||||
|
24
third-party/patches/luv-Add-missing-definitions-for-MinGW.patch
vendored
Normal file
24
third-party/patches/luv-Add-missing-definitions-for-MinGW.patch
vendored
Normal file
@ -0,0 +1,24 @@
|
||||
diff --git a/src/dns.c b/src/dns.c
|
||||
index 8634157..5f36625 100644
|
||||
--- a/src/dns.c
|
||||
+++ b/src/dns.c
|
||||
@@ -20,6 +20,19 @@
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
#include <netdb.h>
|
||||
+#elif __MINGW32__
|
||||
+# ifndef AI_NUMERICSERV
|
||||
+# define AI_NUMERICSERV 0x0008
|
||||
+# endif
|
||||
+# ifndef AI_ALL
|
||||
+# define AI_ALL 0x00000100
|
||||
+# endif
|
||||
+# ifndef AI_ADDRCONFIG
|
||||
+# define AI_ADDRCONFIG 0x00000400
|
||||
+# endif
|
||||
+# ifndef AI_V4MAPPED
|
||||
+# define AI_V4MAPPED 0x00000800
|
||||
+# endif
|
||||
#endif
|
||||
|
||||
static void luv_pushaddrinfo(lua_State* L, struct addrinfo* res) {
|
Loading…
Reference in New Issue
Block a user