Skip to content

Commit

Permalink
build: vendor libtermkey
Browse files Browse the repository at this point in the history
This is a proof of concept/WIP to evaluate the viability of vendoring
libtermkey as it's been deprecated.
  • Loading branch information
dundargoc authored and gpanders committed Nov 30, 2023
1 parent 7feed6c commit 404043e
Show file tree
Hide file tree
Showing 12 changed files with 3,373 additions and 77 deletions.
8 changes: 0 additions & 8 deletions cmake.deps/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ set(DEPS_INCLUDE_FLAGS "-I${DEPS_INSTALL_DIR}/include -I${DEPS_INSTALL_DIR}/incl
option(USE_BUNDLED "Use bundled dependencies." ON)

option(USE_BUNDLED_UNIBILIUM "Use the bundled unibilium." ${USE_BUNDLED})
option(USE_BUNDLED_LIBTERMKEY "Use the bundled libtermkey." ${USE_BUNDLED})
option(USE_BUNDLED_LIBVTERM "Use the bundled libvterm." ${USE_BUNDLED})
option(USE_BUNDLED_LIBUV "Use the bundled libuv." ${USE_BUNDLED})
option(USE_BUNDLED_MSGPACK "Use the bundled msgpack." ${USE_BUNDLED})
Expand Down Expand Up @@ -93,13 +92,6 @@ if(USE_BUNDLED_UNIBILIUM)
include(BuildUnibilium)
endif()

if(USE_BUNDLED_LIBTERMKEY)
include(BuildLibtermkey)
if(USE_BUNDLED_UNIBILIUM)
add_dependencies(libtermkey unibilium)
endif()
endif()

if(USE_BUNDLED_LIBVTERM)
include(BuildLibvterm)
endif()
Expand Down
13 changes: 0 additions & 13 deletions cmake.deps/cmake/BuildLibtermkey.cmake

This file was deleted.

37 changes: 0 additions & 37 deletions cmake.deps/cmake/LibtermkeyCMakeLists.txt

This file was deleted.

3 changes: 0 additions & 3 deletions cmake.deps/deps.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,6 @@ LUA_SHA256 2640fc56a795f29d28ef15e13c34a47e223960b0240e8cb0a82d9b0738695333
UNIBILIUM_URL https://github.com/neovim/unibilium/archive/d72c3598e7ac5d1ebf86ee268b8b4ed95c0fa628.tar.gz
UNIBILIUM_SHA256 9c4747c862ab5e3076dcf8fa8f0ea7a6b50f20ec5905618b9536655596797487

LIBTERMKEY_URL https://github.com/neovim/libtermkey/archive/dcb198a85c520ce38450a5970c97f8ff03b50f0e.tar.gz
LIBTERMKEY_SHA256 5eb3e50af54312817bd56fa63b9f8dbd12ec11cedbcf8a7aa0fd79950cc83259

LIBVTERM_URL https://github.com/neovim/libvterm/archive/v0.3.3.tar.gz
LIBVTERM_SHA256 0babe3ab42c354925dadede90d352f054aa9c4ae6842ea803a20c9741e172e56

Expand Down
9 changes: 0 additions & 9 deletions cmake/FindLibtermkey.cmake

This file was deleted.

12 changes: 6 additions & 6 deletions src/nvim/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,13 @@ target_link_libraries(main_lib INTERFACE ${LUV_LIBRARY})

find_package(Iconv REQUIRED)
find_package(Lpeg REQUIRED)
find_package(Libtermkey 0.22 REQUIRED)
find_package(Libvterm 0.3.3 REQUIRED)
find_package(Msgpack 1.0.0 REQUIRED)
find_package(Treesitter 0.20.8 REQUIRED)
find_package(Unibilium 2.0 REQUIRED)

target_link_libraries(main_lib INTERFACE
iconv
libtermkey
libvterm
msgpack
treesitter
Expand All @@ -60,6 +58,8 @@ if (LIBINTL_LIBRARY)
target_link_libraries(main_lib INTERFACE ${LIBINTL_LIBRARY})
endif()

target_compile_definitions(main_lib INTERFACE HAVE_UNIBILIUM)

# The unit test lib requires LuaJIT; it will be skipped if LuaJIT is missing.
option(PREFER_LUA "Prefer Lua over LuaJIT in the nvim executable." OFF)
if(PREFER_LUA)
Expand Down Expand Up @@ -376,8 +376,8 @@ file(MAKE_DIRECTORY ${GENERATED_INCLUDES_DIR})

glob_wrapper(NVIM_SOURCES *.c)
glob_wrapper(NVIM_HEADERS *.h)
glob_wrapper(EXTERNAL_SOURCES ../xdiff/*.c ../mpack/*.c ../cjson/*.c ../klib/*.c)
glob_wrapper(EXTERNAL_HEADERS ../xdiff/*.h ../mpack/*.h ../cjson/*.h ../klib/*.h)
glob_wrapper(EXTERNAL_SOURCES ../xdiff/*.c ../mpack/*.c ../cjson/*.c ../klib/*.c ../termkey/*.c)
glob_wrapper(EXTERNAL_HEADERS ../xdiff/*.h ../mpack/*.h ../cjson/*.h ../klib/*.h ../termkey/*.h)

glob_wrapper(NLUA0_SOURCES ../mpack/*.c)

Expand Down Expand Up @@ -436,13 +436,13 @@ endforeach()

list(REMOVE_ITEM NVIM_SOURCES ${to_remove})

# xdiff, mpack, lua-cjson: inlined external project, we don't maintain it. #9306
# xdiff, mpack, lua-cjson, termkey: inlined external project, we don't maintain it. #9306
if(MSVC)
set_source_files_properties(
${EXTERNAL_SOURCES} PROPERTIES COMPILE_FLAGS "${COMPILE_FLAGS} -wd4090 -wd4244 -wd4267")
else()
set_source_files_properties(
${EXTERNAL_SOURCES} PROPERTIES COMPILE_FLAGS "${COMPILE_FLAGS} -Wno-conversion -Wno-missing-noreturn -Wno-missing-format-attribute -Wno-double-promotion -Wno-strict-prototypes -Wno-misleading-indentation")
${EXTERNAL_SOURCES} PROPERTIES COMPILE_FLAGS "${COMPILE_FLAGS} -Wno-conversion -Wno-missing-noreturn -Wno-missing-format-attribute -Wno-double-promotion -Wno-strict-prototypes -Wno-misleading-indentation -Wno-sign-compare -Wno-implicit-fallthrough -Wno-missing-prototypes -Wno-missing-field-initializers")
endif()

# Log level (NVIM_LOG_DEBUG in log.h)
Expand Down
2 changes: 1 addition & 1 deletion src/nvim/tui/input.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

#include <stdbool.h>
#include <stdint.h>
#include <termkey.h>
#include <uv.h>

#include "nvim/event/loop.h"
Expand All @@ -12,6 +11,7 @@
#include "nvim/tui/input_defs.h" // IWYU pragma: export
#include "nvim/tui/tui.h"
#include "nvim/types_defs.h"
#include "termkey/termkey.h"

typedef enum {
kKeyEncodingLegacy, ///< Legacy key encoding
Expand Down

0 comments on commit 404043e

Please sign in to comment.