aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cmake/FindMsgpack.cmake2
-rwxr-xr-xsrc/nvim/generators/gen_declarations.lua21
-rw-r--r--src/nvim/lib/kvec.h1
-rw-r--r--src/nvim/main.c8
-rw-r--r--src/nvim/os/os_defs.h8
-rw-r--r--src/nvim/os/unix_defs.h5
-rw-r--r--src/nvim/os/win_defs.h4
-rw-r--r--src/nvim/spellfile.c1
-rw-r--r--third-party/cmake/BuildLibtermkey.cmake5
-rw-r--r--third-party/cmake/BuildLibvterm.cmake13
-rw-r--r--third-party/cmake/BuildLuajit.cmake5
-rw-r--r--third-party/cmake/BuildLuarocks.cmake23
-rw-r--r--third-party/cmake/BuildMsgpack.cmake3
-rw-r--r--third-party/cmake/BuildUnibilium.cmake67
-rw-r--r--third-party/cmake/UnibiliumCMakeLists.txt27
-rw-r--r--third-party/msvc-compat/unistd.h10
-rw-r--r--third-party/patches/libvterm-Remove-VLAs-for-MSVC.patch50
-rw-r--r--third-party/patches/luarocks-Change-default-downloader-to-curl.patch24
18 files changed, 214 insertions, 63 deletions
diff --git a/cmake/FindMsgpack.cmake b/cmake/FindMsgpack.cmake
index 6716289a98..cca0a00c20 100644
--- a/cmake/FindMsgpack.cmake
+++ b/cmake/FindMsgpack.cmake
@@ -44,7 +44,7 @@ endif()
if(MSVC)
# The import library for the msgpack DLL has a different name
- list(APPEND MSGPACK_NAMES msgpack_import)
+ list(APPEND MSGPACK_NAMES msgpackc_import)
else()
list(APPEND MSGPACK_NAMES msgpackc msgpack)
endif()
diff --git a/src/nvim/generators/gen_declarations.lua b/src/nvim/generators/gen_declarations.lua
index 065c043557..c40c37bb3e 100755
--- a/src/nvim/generators/gen_declarations.lua
+++ b/src/nvim/generators/gen_declarations.lua
@@ -224,23 +224,15 @@ local static = header
local filepattern = '^#%a* (%d+) "([^"]-)/?([^"/]+)"'
local curfile
-local init = 0
+local init = 1
local curfile = nil
local neededfile = fname:match('[^/]+$')
local declline = 0
local declendpos = 0
local curdir = nil
local is_needed_file = false
+local init_is_nl = true
while init ~= nil do
- init = text:find('[\n;}]', init)
- if init == nil then
- break
- end
- local init_is_nl = text:sub(init, init) == '\n'
- init = init + 1
- if init_is_nl and is_needed_file then
- declline = declline + 1
- end
if init_is_nl and text:sub(init, init) == '#' then
local line, dir, file = text:match(filepattern, init)
if file ~= nil then
@@ -293,6 +285,15 @@ while init ~= nil do
declendpos = e
end
end
+ init = text:find('[\n;}]', init)
+ if init == nil then
+ break
+ end
+ init_is_nl = text:sub(init, init) == '\n'
+ init = init + 1
+ if init_is_nl and is_needed_file then
+ declline = declline + 1
+ end
end
non_static = non_static .. footer
diff --git a/src/nvim/lib/kvec.h b/src/nvim/lib/kvec.h
index ee1b890cb9..ad56c9237b 100644
--- a/src/nvim/lib/kvec.h
+++ b/src/nvim/lib/kvec.h
@@ -41,6 +41,7 @@
#include <string.h>
#include "nvim/memory.h"
+#include "nvim/os/os_defs.h"
#define kv_roundup32(x) \
((--(x)), \
diff --git a/src/nvim/main.c b/src/nvim/main.c
index 4fd55f1491..25fb0f14d8 100644
--- a/src/nvim/main.c
+++ b/src/nvim/main.c
@@ -795,7 +795,7 @@ static void command_line_scan(mparm_T *parmp)
mch_exit(0);
} else if (STRICMP(argv[0] + argv_idx, "api-info") == 0) {
FileDescriptor fp;
- const int fof_ret = file_open_fd(&fp, OS_STDOUT_FILENO, true);
+ const int fof_ret = file_open_fd(&fp, STDOUT_FILENO, true);
msgpack_packer *p = msgpack_packer_new(&fp, msgpack_file_write);
if (fof_ret != 0) {
@@ -1256,10 +1256,10 @@ static void check_and_set_isatty(mparm_T *paramp)
paramp->err_isatty = os_isatty(fileno(stderr));
#ifndef WIN32
int tty_fd = paramp->input_isatty
- ? OS_STDIN_FILENO
+ ? STDIN_FILENO
: (paramp->output_isatty
- ? OS_STDOUT_FILENO
- : (paramp->err_isatty ? OS_STDERR_FILENO : -1));
+ ? STDOUT_FILENO
+ : (paramp->err_isatty ? STDERR_FILENO : -1));
pty_process_save_termios(tty_fd);
#endif
TIME_MSG("window checked");
diff --git a/src/nvim/os/os_defs.h b/src/nvim/os/os_defs.h
index 87f8d214bd..f81785675e 100644
--- a/src/nvim/os/os_defs.h
+++ b/src/nvim/os/os_defs.h
@@ -4,7 +4,6 @@
#include <ctype.h>
#include <stdio.h>
#include <stdlib.h>
-#include <sys/param.h>
#include <sys/stat.h>
#include <sys/types.h>
@@ -14,13 +13,6 @@
# include "nvim/os/unix_defs.h"
#endif
-/// File descriptor number used for standard IO streams
-enum {
- OS_STDIN_FILENO = STDIN_FILENO,
- OS_STDOUT_FILENO = STDOUT_FILENO,
- OS_STDERR_FILENO = STDERR_FILENO,
-};
-
#define BASENAMELEN (NAME_MAX - 5)
// Use the system path length if it makes sense.
diff --git a/src/nvim/os/unix_defs.h b/src/nvim/os/unix_defs.h
index 5c9daca476..27e64f20cf 100644
--- a/src/nvim/os/unix_defs.h
+++ b/src/nvim/os/unix_defs.h
@@ -1,9 +1,10 @@
#ifndef NVIM_OS_UNIX_DEFS_H
#define NVIM_OS_UNIX_DEFS_H
-// Windows doesn't have unistd.h, so we include it here to avoid numerous
-// instances of `#ifdef WIN32'.
+// Windows doesn't have the following headers,
+// so we include them here to avoid numerous instances of `#ifdef WIN32'.
#include <unistd.h>
+#include <sys/param.h>
// POSIX.1-2008 says that NAME_MAX should be in here
#include <limits.h>
diff --git a/src/nvim/os/win_defs.h b/src/nvim/os/win_defs.h
index 8fd2e51f8b..faee06304c 100644
--- a/src/nvim/os/win_defs.h
+++ b/src/nvim/os/win_defs.h
@@ -45,6 +45,9 @@
# ifndef restrict
# define restrict __restrict
# endif
+# ifndef STDIN_FILENO
+# define STDIN_FILENO _fileno(stdin)
+# endif
# ifndef STDOUT_FILENO
# define STDOUT_FILENO _fileno(stdout)
# endif
@@ -60,6 +63,7 @@
#ifdef _MSC_VER
typedef SSIZE_T ssize_t;
+typedef int mode_t;
#endif
#ifndef SSIZE_MAX
diff --git a/src/nvim/spellfile.c b/src/nvim/spellfile.c
index df066e7ad3..f5d5d408a1 100644
--- a/src/nvim/spellfile.c
+++ b/src/nvim/spellfile.c
@@ -228,7 +228,6 @@
#include <stdio.h>
#include <stdint.h>
#include <wctype.h>
-#include <strings.h>
#include "nvim/vim.h"
#include "nvim/spell_defs.h"
diff --git a/third-party/cmake/BuildLibtermkey.cmake b/third-party/cmake/BuildLibtermkey.cmake
index bc4db4c9b1..6692f16f13 100644
--- a/third-party/cmake/BuildLibtermkey.cmake
+++ b/third-party/cmake/BuildLibtermkey.cmake
@@ -48,7 +48,4 @@ ExternalProject_Add(libtermkey
endif()
list(APPEND THIRD_PARTY_DEPS libtermkey)
-if(NOT WIN32)
- # There is no unibilium build recipe for Windows yet
- add_dependencies(libtermkey unibilium)
-endif()
+add_dependencies(libtermkey unibilium)
diff --git a/third-party/cmake/BuildLibvterm.cmake b/third-party/cmake/BuildLibvterm.cmake
index 12e8fdd7d0..5fb077e972 100644
--- a/third-party/cmake/BuildLibvterm.cmake
+++ b/third-party/cmake/BuildLibvterm.cmake
@@ -6,7 +6,7 @@ function(BuildLibvterm)
cmake_parse_arguments(_libvterm
""
""
- "CONFIGURE_COMMAND;BUILD_COMMAND;INSTALL_COMMAND"
+ "PATCH_COMMAND;CONFIGURE_COMMAND;BUILD_COMMAND;INSTALL_COMMAND"
${ARGN})
if(NOT _libvterm_CONFIGURE_COMMAND AND NOT _libvterm_BUILD_COMMAND
@@ -26,6 +26,7 @@ function(BuildLibvterm)
-DTARGET=libvterm
-DUSE_EXISTING_SRC_DIR=${USE_EXISTING_SRC_DIR}
-P ${CMAKE_CURRENT_SOURCE_DIR}/cmake/DownloadAndExtractFile.cmake
+ PATCH_COMMAND "${_libvterm_PATCH_COMMAND}"
CONFIGURE_COMMAND ""
BUILD_IN_SOURCE 1
CONFIGURE_COMMAND "${_libvterm_CONFIGURE_COMMAND}"
@@ -34,7 +35,12 @@ function(BuildLibvterm)
endfunction()
if(WIN32)
- # MinGW
+ if(MSVC)
+ set(LIBVTERM_PATCH_COMMAND
+ git -C ${DEPS_BUILD_DIR}/src/libvterm init
+ COMMAND git -C ${DEPS_BUILD_DIR}/src/libvterm apply
+ ${CMAKE_CURRENT_SOURCE_DIR}/patches/libvterm-Remove-VLAs-for-MSVC.patch)
+ endif()
set(LIBVTERM_CONFIGURE_COMMAND ${CMAKE_COMMAND} -E copy
${CMAKE_CURRENT_SOURCE_DIR}/cmake/LibvtermCMakeLists.txt
${DEPS_BUILD_DIR}/src/libvterm/CMakeLists.txt
@@ -53,7 +59,8 @@ else()
install)
endif()
-BuildLibvterm(CONFIGURE_COMMAND ${LIBVTERM_CONFIGURE_COMMAND}
+BuildLibvterm(PATCH_COMMAND ${LIBVTERM_PATCH_COMMAND}
+ CONFIGURE_COMMAND ${LIBVTERM_CONFIGURE_COMMAND}
BUILD_COMMAND ${LIBVTERM_BUILD_COMMAND}
INSTALL_COMMAND ${LIBVTERM_INSTALL_COMMAND})
diff --git a/third-party/cmake/BuildLuajit.cmake b/third-party/cmake/BuildLuajit.cmake
index c8eee282bf..e65a81bba5 100644
--- a/third-party/cmake/BuildLuajit.cmake
+++ b/third-party/cmake/BuildLuajit.cmake
@@ -101,7 +101,10 @@ elseif(MSVC)
COMMAND ${CMAKE_COMMAND} -E copy ${DEPS_BUILD_DIR}/src/luajit/src/luajit.exe ${DEPS_INSTALL_DIR}/bin
COMMAND ${CMAKE_COMMAND} -E copy ${DEPS_BUILD_DIR}/src/luajit/src/lua51.dll ${DEPS_INSTALL_DIR}/bin
COMMAND ${CMAKE_COMMAND} -E make_directory ${DEPS_INSTALL_DIR}/lib
- COMMAND ${CMAKE_COMMAND} -E copy ${DEPS_BUILD_DIR}/src/luajit/src/lua51.lib ${DEPS_INSTALL_DIR}/lib
+ # Luarocks searches for lua51.lib
+ COMMAND ${CMAKE_COMMAND} -E copy ${DEPS_BUILD_DIR}/src/luajit/src/lua51.lib ${DEPS_INSTALL_DIR}/lib/lua51.lib
+ # Luv searches for luajit.lib
+ COMMAND ${CMAKE_COMMAND} -E copy ${DEPS_BUILD_DIR}/src/luajit/src/lua51.lib ${DEPS_INSTALL_DIR}/lib/luajit.lib
COMMAND ${CMAKE_COMMAND} -E make_directory ${DEPS_INSTALL_DIR}/include/luajit-2.0
COMMAND ${CMAKE_COMMAND} -DFROM_GLOB=${DEPS_BUILD_DIR}/src/luajit/src/*.h -DTO=${DEPS_INSTALL_DIR}/include/luajit-2.0 -P ${CMAKE_CURRENT_SOURCE_DIR}/cmake/CopyFilesGlob.cmake)
diff --git a/third-party/cmake/BuildLuarocks.cmake b/third-party/cmake/BuildLuarocks.cmake
index 2a59ad3b46..297fedb888 100644
--- a/third-party/cmake/BuildLuarocks.cmake
+++ b/third-party/cmake/BuildLuarocks.cmake
@@ -12,7 +12,7 @@ function(BuildLuarocks)
cmake_parse_arguments(_luarocks
""
""
- "CONFIGURE_COMMAND;BUILD_COMMAND;INSTALL_COMMAND"
+ "PATCH_COMMAND;CONFIGURE_COMMAND;BUILD_COMMAND;INSTALL_COMMAND"
${ARGN})
if(NOT _luarocks_CONFIGURE_COMMAND AND NOT _luarocks_BUILD_COMMAND
@@ -32,6 +32,7 @@ function(BuildLuarocks)
-DTARGET=luarocks
-DUSE_EXISTING_SRC_DIR=${USE_EXISTING_SRC_DIR}
-P ${CMAKE_CURRENT_SOURCE_DIR}/cmake/DownloadAndExtractFile.cmake
+ PATCH_COMMAND "${_luarocks_PATCH_COMMAND}"
BUILD_IN_SOURCE 1
CONFIGURE_COMMAND "${_luarocks_CONFIGURE_COMMAND}"
BUILD_COMMAND "${_luarocks_BUILD_COMMAND}"
@@ -50,6 +51,11 @@ if(NOT MSVC)
# version already knows, and passing them here breaks the build
set(LUAROCKS_BUILDARGS CC=${HOSTDEPS_C_COMPILER} LD=${HOSTDEPS_C_COMPILER})
endif()
+if(WIN32)
+ # Use our bundled curl.exe for downloading packages
+ set(LUAROCKS_BUILDARGS ${LUAROCKS_BUILDARGS} CURL=${DEPS_BIN_DIR}/curl.exe)
+endif()
+
if(UNIX OR (MINGW AND CMAKE_CROSSCOMPILING))
@@ -70,11 +76,18 @@ if(UNIX OR (MINGW AND CMAKE_CROSSCOMPILING))
elseif(MSVC OR MINGW)
if(MINGW)
- set(MINGW_FLAG /MW)
+ set(COMPILER_FLAG /MW)
+ elseif(MSVC)
+ set(COMPILER_FLAG /MSVC)
endif()
# Ignore USE_BUNDLED_LUAJIT - always ON for native Win32
- BuildLuarocks(INSTALL_COMMAND install.bat /FORCECONFIG /NOREG /NOADMIN /Q /F
+ BuildLuarocks(
+ PATCH_COMMAND
+ git -C ${DEPS_BUILD_DIR}/src/luarocks init
+ COMMAND git -C ${DEPS_BUILD_DIR}/src/luarocks apply
+ ${CMAKE_CURRENT_SOURCE_DIR}/patches/luarocks-Change-default-downloader-to-curl.patch
+ INSTALL_COMMAND install.bat /FORCECONFIG /NOREG /NOADMIN /Q /F
/LUA ${DEPS_INSTALL_DIR}
/LIB ${DEPS_LIB_DIR}
/BIN ${DEPS_BIN_DIR}
@@ -82,10 +95,12 @@ elseif(MSVC OR MINGW)
/P ${DEPS_INSTALL_DIR}/${LUAROCKS_VERSION} /TREE ${DEPS_INSTALL_DIR}
/SCRIPTS ${DEPS_BIN_DIR}
/CMOD ${DEPS_BIN_DIR}
- ${MINGW_FLAG}
+ ${COMPILER_FLAG}
/LUAMOD ${DEPS_BIN_DIR}/lua)
set(LUAROCKS_BINARY ${DEPS_INSTALL_DIR}/${LUAROCKS_VERSION}/luarocks.bat)
+ add_dependencies(luarocks wintools)
+
else()
message(FATAL_ERROR "Trying to build luarocks in an unsupported system ${CMAKE_SYSTEM_NAME}/${CMAKE_C_COMPILER_ID}")
endif()
diff --git a/third-party/cmake/BuildMsgpack.cmake b/third-party/cmake/BuildMsgpack.cmake
index 779cb1ebfe..616b6e5f83 100644
--- a/third-party/cmake/BuildMsgpack.cmake
+++ b/third-party/cmake/BuildMsgpack.cmake
@@ -70,9 +70,6 @@ elseif(MSVC)
# Make sure we use the same generator, otherwise we may
# accidentaly end up using different MSVC runtimes
-DCMAKE_GENERATOR=${CMAKE_GENERATOR})
- # Place the DLL in the bin folder
- set(MSGPACK_INSTALL_COMMAND ${MSGPACK_INSTALL_COMMAND}
- COMMAND ${CMAKE_COMMAND} -E copy ${DEPS_INSTALL_DIR}/lib/msgpack.dll ${DEPS_INSTALL_DIR}/bin)
endif()
BuildMsgpack(CONFIGURE_COMMAND ${MSGPACK_CONFIGURE_COMMAND}
diff --git a/third-party/cmake/BuildUnibilium.cmake b/third-party/cmake/BuildUnibilium.cmake
index a1b9a39bb6..f5342e3d34 100644
--- a/third-party/cmake/BuildUnibilium.cmake
+++ b/third-party/cmake/BuildUnibilium.cmake
@@ -1,26 +1,49 @@
if(WIN32)
- message(STATUS "Building Unibilium in Windows is not supported (skipping)")
- return()
+ ExternalProject_Add(unibilium
+ PREFIX ${DEPS_BUILD_DIR}
+ URL ${UNIBILIUM_URL}
+ DOWNLOAD_DIR ${DEPS_DOWNLOAD_DIR}/unibilium
+ DOWNLOAD_COMMAND ${CMAKE_COMMAND}
+ -DPREFIX=${DEPS_BUILD_DIR}
+ -DDOWNLOAD_DIR=${DEPS_DOWNLOAD_DIR}/unibilium
+ -DURL=${UNIBILIUM_URL}
+ -DEXPECTED_SHA256=${UNIBILIUM_SHA256}
+ -DTARGET=unibilium
+ -DUSE_EXISTING_SRC_DIR=${USE_EXISTING_SRC_DIR}
+ -P ${CMAKE_CURRENT_SOURCE_DIR}/cmake/DownloadAndExtractFile.cmake
+ CONFIGURE_COMMAND ${CMAKE_COMMAND} -E copy
+ ${CMAKE_CURRENT_SOURCE_DIR}/cmake/UnibiliumCMakeLists.txt
+ ${DEPS_BUILD_DIR}/src/unibilium/CMakeLists.txt
+ COMMAND ${CMAKE_COMMAND} -E copy
+ ${CMAKE_CURRENT_SOURCE_DIR}/msvc-compat/unistd.h
+ ${DEPS_BUILD_DIR}/src/unibilium/msvc-compat/unistd.h
+ COMMAND ${CMAKE_COMMAND} ${DEPS_BUILD_DIR}/src/unibilium
+ -DCMAKE_INSTALL_PREFIX=${DEPS_INSTALL_DIR}
+ # Pass toolchain
+ -DCMAKE_TOOLCHAIN_FILE=${TOOLCHAIN}
+ -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
+ -DCMAKE_GENERATOR=${CMAKE_GENERATOR}
+ BUILD_COMMAND ${CMAKE_COMMAND} --build . --config ${CMAKE_BUILD_TYPE}
+ INSTALL_COMMAND ${CMAKE_COMMAND} --build . --target install --config ${CMAKE_BUILD_TYPE})
+else()
+ ExternalProject_Add(unibilium
+ PREFIX ${DEPS_BUILD_DIR}
+ URL ${UNIBILIUM_URL}
+ DOWNLOAD_DIR ${DEPS_DOWNLOAD_DIR}/unibilium
+ DOWNLOAD_COMMAND ${CMAKE_COMMAND}
+ -DPREFIX=${DEPS_BUILD_DIR}
+ -DDOWNLOAD_DIR=${DEPS_DOWNLOAD_DIR}/unibilium
+ -DURL=${UNIBILIUM_URL}
+ -DEXPECTED_SHA256=${UNIBILIUM_SHA256}
+ -DTARGET=unibilium
+ -DUSE_EXISTING_SRC_DIR=${USE_EXISTING_SRC_DIR}
+ -P ${CMAKE_CURRENT_SOURCE_DIR}/cmake/DownloadAndExtractFile.cmake
+ CONFIGURE_COMMAND ""
+ BUILD_IN_SOURCE 1
+ BUILD_COMMAND ${MAKE_PRG} CC=${DEPS_C_COMPILER}
+ PREFIX=${DEPS_INSTALL_DIR}
+ CFLAGS=-fPIC
+ INSTALL_COMMAND ${MAKE_PRG} PREFIX=${DEPS_INSTALL_DIR} install)
endif()
-ExternalProject_Add(unibilium
- PREFIX ${DEPS_BUILD_DIR}
- URL ${UNIBILIUM_URL}
- DOWNLOAD_DIR ${DEPS_DOWNLOAD_DIR}/unibilium
- DOWNLOAD_COMMAND ${CMAKE_COMMAND}
- -DPREFIX=${DEPS_BUILD_DIR}
- -DDOWNLOAD_DIR=${DEPS_DOWNLOAD_DIR}/unibilium
- -DURL=${UNIBILIUM_URL}
- -DEXPECTED_SHA256=${UNIBILIUM_SHA256}
- -DTARGET=unibilium
- -DUSE_EXISTING_SRC_DIR=${USE_EXISTING_SRC_DIR}
- -P ${CMAKE_CURRENT_SOURCE_DIR}/cmake/DownloadAndExtractFile.cmake
- CONFIGURE_COMMAND ""
- BUILD_IN_SOURCE 1
- BUILD_COMMAND ${MAKE_PRG} CC=${DEPS_C_COMPILER}
- PREFIX=${DEPS_INSTALL_DIR}
- CFLAGS=-fPIC
- ${DEFAULT_MAKE_CFLAGS}
- INSTALL_COMMAND ${MAKE_PRG} PREFIX=${DEPS_INSTALL_DIR} install)
-
list(APPEND THIRD_PARTY_DEPS unibilium)
diff --git a/third-party/cmake/UnibiliumCMakeLists.txt b/third-party/cmake/UnibiliumCMakeLists.txt
new file mode 100644
index 0000000000..3c419654c4
--- /dev/null
+++ b/third-party/cmake/UnibiliumCMakeLists.txt
@@ -0,0 +1,27 @@
+cmake_minimum_required(VERSION 2.8.7)
+project(unibilium LANGUAGES C)
+
+file(GLOB SRC_FILES ${PROJECT_SOURCE_DIR}/*.c)
+add_library(unibilium ${SRC_FILES})
+set_target_properties(unibilium PROPERTIES PUBLIC_HEADER ${PROJECT_SOURCE_DIR}/unibilium.h
+ VERSION "${VERSION_MAJOR}.${VERSION_MINOR}")
+
+if(NOT WIN32)
+ execute_process(COMMAND "shell ncursesw6-config --terminfo-dirs 2>/dev/null || \
+ ncurses6-config --terminfo-dirs 2>/dev/null || \
+ ncursesw5-config --terminfo-dirs 2>/dev/null || \
+ ncurses5-config --terminfo-dirs 2>/dev/null || \
+ echo '/etc/terminfo:/lib/terminfo:/usr/share/terminfo:/usr/lib/terminfo:/usr/local/share/terminfo:/usr/local/lib/terminfo'"
+ OUTPUT_VARIABLE TERMINFO_DIRS)
+endif()
+target_compile_definitions(unibilium PUBLIC TERMINFO_DIRS ${TERMINFO_DIRS})
+
+if(MSVC)
+ target_include_directories(unibilium PUBLIC ${PROJECT_SOURCE_DIR}/msvc-compat)
+endif()
+
+include(GNUInstallDirs)
+install(TARGETS unibilium
+ PUBLIC_HEADER
+ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
+ PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
diff --git a/third-party/msvc-compat/unistd.h b/third-party/msvc-compat/unistd.h
new file mode 100644
index 0000000000..d9ee57b54b
--- /dev/null
+++ b/third-party/msvc-compat/unistd.h
@@ -0,0 +1,10 @@
+#ifndef GUARD_UNIBILIUM_UNISTD_H_
+#define GUARD_UNIBILIUM_UNISTD_H_
+
+#ifdef _WIN64
+typedef unsigned __int64 ssize_t;
+#else
+typedef _W64 unsigned int ssize_t;
+#endif
+
+#endif
diff --git a/third-party/patches/libvterm-Remove-VLAs-for-MSVC.patch b/third-party/patches/libvterm-Remove-VLAs-for-MSVC.patch
new file mode 100644
index 0000000000..3fb18351be
--- /dev/null
+++ b/third-party/patches/libvterm-Remove-VLAs-for-MSVC.patch
@@ -0,0 +1,50 @@
+From eb386b1d82f7d07363c9133b7aa06902ccd555fe Mon Sep 17 00:00:00 2001
+Date: Tue, 27 Feb 2018 17:54:20 -0600
+Subject: [PATCH] Remove VLAs for MSVC
+
+VLAs are replaced with calls to _alloca() because MSVC does not support them.
+---
+ src/state.c | 7 ++++---
+ 1 file changed, 4 insertions(+), 3 deletions(-)
+
+diff --git a/src/state.c b/src/state.c
+index 84299df..f9aabb3 100644
+--- a/src/state.c
++++ b/src/state.c
+@@ -1,5 +1,6 @@
+ #include "vterm_internal.h"
+
++#include <malloc.h>
+ #include <stdio.h>
+ #include <string.h>
+
+@@ -236,7 +237,7 @@ static int on_text(const char bytes[], size_t len, void *user)
+ VTermPos oldpos = state->pos;
+
+ // We'll have at most len codepoints
+- uint32_t codepoints[len];
++ uint32_t* codepoints = _alloca(len);
+ int npoints = 0;
+ size_t eaten = 0;
+
+@@ -313,7 +314,7 @@ static int on_text(const char bytes[], size_t len, void *user)
+
+ int width = 0;
+
+- uint32_t chars[glyph_ends - glyph_starts + 1];
++ uint32_t* chars = _alloca(glyph_ends - glyph_starts + 1);
+
+ for( ; i < glyph_ends; i++) {
+ chars[i - glyph_starts] = codepoints[i];
+@@ -512,7 +513,7 @@ static int settermprop_int(VTermState *state, VTermProp prop, int v)
+
+ static int settermprop_string(VTermState *state, VTermProp prop, const char *str, size_t len)
+ {
+- char strvalue[len+1];
++ char* strvalue = _alloca(len+1);
+ strncpy(strvalue, str, len);
+ strvalue[len] = 0;
+
+--
+2.16.1.windows.4
+
diff --git a/third-party/patches/luarocks-Change-default-downloader-to-curl.patch b/third-party/patches/luarocks-Change-default-downloader-to-curl.patch
new file mode 100644
index 0000000000..b7109a3b53
--- /dev/null
+++ b/third-party/patches/luarocks-Change-default-downloader-to-curl.patch
@@ -0,0 +1,24 @@
+From 69313032fad04743c96bc8f2a029b691857488f9 Mon Sep 17 00:00:00 2001
+Date: Thu, 1 Mar 2018 21:41:29 -0600
+Subject: [PATCH] Change default downloader to curl
+
+---
+ install.bat | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/install.bat b/install.bat
+index 09cf9aa..76e4059 100644
+--- a/install.bat
++++ b/install.bat
+@@ -1037,7 +1037,7 @@ f:write(S[=[
+ site_config.LUAROCKS_UNAME_M=[[$UNAME_M]]
+ site_config.LUAROCKS_ROCKS_TREE=[[$TREE_ROOT]]
+ site_config.LUAROCKS_PREFIX=[[$PREFIX]]
+-site_config.LUAROCKS_DOWNLOADER=[[wget]]
++site_config.LUAROCKS_DOWNLOADER=[[curl]]
+ site_config.LUAROCKS_MD5CHECKER=[[md5sum]]
+ ]=])
+ if FORCE_CONFIG then
+--
+2.16.1.windows.4
+