aboutsummaryrefslogtreecommitdiff
path: root/third-party
diff options
context:
space:
mode:
authorJames McCoy <jamessan@jamessan.com>2018-03-28 21:52:06 -0400
committerJames McCoy <jamessan@jamessan.com>2018-03-28 21:54:39 -0400
commit79f9c2d9c650ceab27cdc6707fd6d7fa1de29fc1 (patch)
tree4e0589d75801f3ff6a9678f84f5009102766661e /third-party
parent4403864da3c48412595d439f36458d1e6ccfc49f (diff)
parent3f3de9b1a95d273463a87516365510dbffcaf3d2 (diff)
downloadrneovim-79f9c2d9c650ceab27cdc6707fd6d7fa1de29fc1.tar.gz
rneovim-79f9c2d9c650ceab27cdc6707fd6d7fa1de29fc1.tar.bz2
rneovim-79f9c2d9c650ceab27cdc6707fd6d7fa1de29fc1.zip
Merge branch 'master' into yagebu/option-fixes
Diffstat (limited to 'third-party')
-rw-r--r--third-party/CMakeLists.txt73
-rw-r--r--third-party/cmake/BuildGettext.cmake34
-rw-r--r--third-party/cmake/BuildGperf.cmake17
-rw-r--r--third-party/cmake/BuildLibtermkey.cmake10
-rw-r--r--third-party/cmake/BuildLibuv.cmake29
-rw-r--r--third-party/cmake/BuildLibvterm.cmake29
-rw-r--r--third-party/cmake/BuildLua.cmake4
-rw-r--r--third-party/cmake/BuildLuajit.cmake5
-rw-r--r--third-party/cmake/BuildLuarocks.cmake91
-rw-r--r--third-party/cmake/BuildMsgpack.cmake3
-rw-r--r--third-party/cmake/BuildUnibilium.cmake66
-rw-r--r--third-party/cmake/GettextCMakeLists.txt83
-rw-r--r--third-party/cmake/GperfCMakeLists.txt30
-rw-r--r--third-party/cmake/LibuvCMakeLists.txt27
-rw-r--r--third-party/cmake/Libvterm-tbl2inc_c.cmake163
-rw-r--r--third-party/cmake/LibvtermCMakeLists.txt43
-rw-r--r--third-party/cmake/UnibiliumCMakeLists.txt27
-rw-r--r--third-party/msvc-compat/unistd.h10
-rw-r--r--third-party/patches/gettext-Fix-compilation-on-a-system-without-alloca.patch28
-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
21 files changed, 728 insertions, 118 deletions
diff --git a/third-party/CMakeLists.txt b/third-party/CMakeLists.txt
index bd4567cff7..d082e8d883 100644
--- a/third-party/CMakeLists.txt
+++ b/third-party/CMakeLists.txt
@@ -2,6 +2,9 @@
cmake_minimum_required (VERSION 2.8.7)
project(NVIM_DEPS)
+# Needed for: check_c_compiler_flag()
+include(CheckCCompilerFlag)
+
# Point CMake at any custom modules we may ship
list(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake")
@@ -11,6 +14,13 @@ if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Release)
endif()
+set(DEFAULT_MAKE_CFLAGS CFLAGS+=-g)
+
+check_c_compiler_flag(-Og HAS_OG_FLAG)
+if(HAS_OG_FLAG)
+ set(DEFAULT_MAKE_CFLAGS CFLAGS+=-Og ${DEFAULT_MAKE_CFLAGS})
+endif()
+
set(DEPS_INSTALL_DIR "${CMAKE_BINARY_DIR}/usr" CACHE PATH "Dependencies install directory.")
set(DEPS_BIN_DIR "${DEPS_INSTALL_DIR}/bin" CACHE PATH "Dependencies binary install directory.")
set(DEPS_LIB_DIR "${DEPS_INSTALL_DIR}/lib" CACHE PATH "Dependencies library install directory.")
@@ -19,6 +29,7 @@ set(DEPS_DOWNLOAD_DIR "${DEPS_BUILD_DIR}/downloads" CACHE PATH "Dependencies dow
option(USE_BUNDLED "Use bundled dependencies." ON)
+option(USE_BUNDLED_GPERF "Use the bundled version of gperf." ${USE_BUNDLED})
option(USE_BUNDLED_JEMALLOC "Use the bundled jemalloc." ${USE_BUNDLED})
option(USE_BUNDLED_UNIBILIUM "Use the bundled unibilium." ${USE_BUNDLED})
option(USE_BUNDLED_LIBTERMKEY "Use the bundled libtermkey." ${USE_BUNDLED})
@@ -32,14 +43,21 @@ option(USE_BUNDLED_LUV "Use the bundled version of luv." ${USE_BUNDLED})
# build it unless explicitly requested
option(USE_BUNDLED_LUA "Use the bundled version of lua." OFF)
-if(USE_BUNDLED AND (NOT WIN32))
- option(USE_BUNDLED_GPERF "Use the bundled version of gperf." ON)
+if(USE_BUNDLED AND MSVC)
+ option(USE_BUNDLED_GETTEXT "Use the bundled version of gettext." ON)
else()
- option(USE_BUNDLED_GPERF "Use the bundled version of gperf." OFF)
+ option(USE_BUNDLED_GETTEXT "Use the bundled version of gettext." OFF)
endif()
option(USE_EXISTING_SRC_DIR "Skip download of deps sources in case of existing source directory." OFF)
+if(WIN32)
+ find_package(Git)
+ if(NOT Git_FOUND)
+ message(FATAL_ERROR "Git is required to apply patches for Windows.")
+ endif()
+endif()
+
if(UNIX)
find_program(MAKE_PRG NAMES gmake make)
if(MAKE_PRG)
@@ -90,28 +108,28 @@ include(ExternalProject)
set(LIBUV_URL https://github.com/libuv/libuv/archive/v1.12.0.tar.gz)
set(LIBUV_SHA256 41ce914a88da21d3b07a76023beca57576ca5b376c6ac440c80bc581cbca1250)
-set(MSGPACK_URL https://github.com/msgpack/msgpack-c/archive/cpp-2.1.3.tar.gz)
-set(MSGPACK_SHA256 42ff5c213fd24bd4388c45c1f21d84b476678ce6366ea4d4f4086618a1d2cd23)
+set(MSGPACK_URL https://github.com/msgpack/msgpack-c/releases/download/cpp-2.1.5/msgpack-2.1.5.tar.gz)
+set(MSGPACK_SHA256 6126375af9b204611b9d9f154929f4f747e4599e6ae8443b337915dcf2899d2b)
-set(LUAJIT_URL https://github.com/LuaJIT/LuaJIT/archive/82151a4514e6538086f3f5e01cb8d4b22287b14f.tar.gz)
-set(LUAJIT_SHA256 8bc4e96ebab74e12ab84e751360e864714289bb089b51b6f396fa9a97df69798)
+set(LUAJIT_URL https://github.com/LuaJIT/LuaJIT/archive/7dbf0b05f1228c1c719866db5e5f3d58f87f74c8.tar.gz)
+set(LUAJIT_SHA256 cbae019b5e396164eb5f0d07777b55cc03931bb944f83c61a010c053c9f5fd5b)
set(LUA_URL https://www.lua.org/ftp/lua-5.1.5.tar.gz)
set(LUA_SHA256 2640fc56a795f29d28ef15e13c34a47e223960b0240e8cb0a82d9b0738695333)
# NOTE: Version must match LUAROCKS_VERSION in third-party/cmake/BuildLuarocks.cmake
-set(LUAROCKS_URL https://github.com/luarocks/luarocks/archive/v2.4.2.tar.gz)
-set(LUAROCKS_SHA256 eef88c2429c715a7beb921e4b1ba571dddb7c74a250fbb0d3cc0d4be7a5865d9)
+set(LUAROCKS_URL https://github.com/luarocks/luarocks/archive/v2.4.3.tar.gz)
+set(LUAROCKS_SHA256 ea1881d6954f2a98c34f93674571c8f0cbdbc28dedb3fa3cb56b6a91886d1a99)
-set(UNIBILIUM_URL https://github.com/mauke/unibilium/archive/v1.2.0.tar.gz)
-set(UNIBILIUM_SHA256 623af1099515e673abfd3cae5f2fa808a09ca55dda1c65a7b5c9424eb304ead8)
+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.19.tar.gz)
-set(LIBTERMKEY_SHA256 c505aa4cb48c8fa59c526265576b97a19e6ebe7b7da20f4ecaae898b727b48b7)
+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)
@@ -130,14 +148,20 @@ set(GPERF_SHA256 588546b945bba4b70b6a3a616e80b4ab466e3f33024a352fc2198112cdbb3ae
set(WINTOOLS_URL https://github.com/neovim/deps/raw/2f9acbecf06365c10baa3c0087f34a54c9c6f949/opt/win32tools.zip)
set(WINTOOLS_SHA256 8bfce7e3a365721a027ce842f2ec1cf878f1726233c215c05964aac07300798c)
-set(WINGUI_URL https://github.com/equalsraf/neovim-qt/releases/download/v0.2.7/neovim-qt.zip)
-set(WINGUI_SHA256 b548f6e4045f16a10163b0e433f05b115b2f877cb47c4eacbf80eaad1a8429ab)
+set(WINGUI_URL https://github.com/equalsraf/neovim-qt/releases/download/v0.2.8/neovim-qt.zip)
+set(WINGUI_SHA256 260efc686423e2529360b6a45c8e241fbbf276c8de6b04d44f45ab5b6fe8df8f)
+
+set(WIN32YANK_X86_URL https://github.com/equalsraf/win32yank/releases/download/v0.0.4/win32yank-x86.zip)
+set(WIN32YANK_X86_SHA256 62f34e5a46c5d4a7b3f3b512e1ff7b77fedd432f42581cbe825233a996eed62c)
-set(WIN32YANK_URL https://github.com/equalsraf/win32yank/releases/download/v0.0.3/win32yank.zip)
-set(WIN32YANK_SHA256 b474439ed2854a9a24941d66970c7fcfece219401eaaa5ebc0ffcc962e69887a)
+set(WIN32YANK_X86_64_URL https://github.com/equalsraf/win32yank/releases/download/v0.0.4/win32yank-x64.zip)
+set(WIN32YANK_X86_64_SHA256 33a747a92da60fb65e668edbf7661d3d902411a2d545fe9dc08623cecd142a20)
-set(WINPTY_URL https://github.com/rprichard/winpty/releases/download/0.4.2/winpty-0.4.2-msvc2015.zip)
-set(WINPTY_SHA256 b465f2584ff394b3fe27c01aa1dcfc679583c1ee951d0e83de3f859d8b8305b8)
+set(WINPTY_URL https://github.com/rprichard/winpty/releases/download/0.4.3/winpty-0.4.3-msvc2015.zip)
+set(WINPTY_SHA256 35a48ece2ff4acdcbc8299d4920de53eb86b1fb41e64d2fe5ae7898931bcee89)
+
+set(GETTEXT_URL https://ftp.gnu.org/pub/gnu/gettext/gettext-0.19.8.1.tar.gz)
+set(GETTEXT_SHA256 ff942af0e438ced4a8b0ea4b0b6e0d6d657157c5e2364de57baa279c1c125c43)
if(USE_BUNDLED_UNIBILIUM)
include(BuildUnibilium)
@@ -183,24 +207,29 @@ if(USE_BUNDLED_GPERF)
include(BuildGperf)
endif()
+if(USE_BUNDLED_GETTEXT)
+ include(BuildGettext)
+endif()
+
include(GetBinaryDeps)
if(WIN32)
GetBinaryDep(TARGET wintools
INSTALL_COMMAND ${CMAKE_COMMAND} -E copy_directory . ${DEPS_INSTALL_DIR}/bin)
- GetBinaryDep(TARGET win32yank
- INSTALL_COMMAND ${CMAKE_COMMAND} -E copy win32yank.exe ${DEPS_INSTALL_DIR}/bin)
-
GetBinaryDep(TARGET wingui
INSTALL_COMMAND ${CMAKE_COMMAND} -E copy_directory bin ${DEPS_INSTALL_DIR}/bin)
include(TargetArch)
+ GetBinaryDep(TARGET "win32yank_${TARGET_ARCH}"
+ INSTALL_COMMAND ${CMAKE_COMMAND} -E copy win32yank.exe ${DEPS_INSTALL_DIR}/bin)
+
if("${TARGET_ARCH}" STREQUAL "X86_64")
set(TARGET_ARCH x64)
elseif(TARGET_ARCH STREQUAL "X86")
set(TARGET_ARCH ia32)
endif()
+
GetBinaryDep(TARGET winpty
INSTALL_COMMAND ${CMAKE_COMMAND} -E make_directory ${DEPS_INSTALL_DIR}/bin
COMMAND ${CMAKE_COMMAND} -DFROM_GLOB=${DEPS_BUILD_DIR}/src/winpty/${TARGET_ARCH}/bin/*
diff --git a/third-party/cmake/BuildGettext.cmake b/third-party/cmake/BuildGettext.cmake
new file mode 100644
index 0000000000..1dd206a91b
--- /dev/null
+++ b/third-party/cmake/BuildGettext.cmake
@@ -0,0 +1,34 @@
+if(MSVC)
+
+ ExternalProject_Add(gettext
+ PREFIX ${DEPS_BUILD_DIR}
+ URL ${GETTEXT_URL}
+ DOWNLOAD_DIR ${DEPS_DOWNLOAD_DIR}/gettext
+ DOWNLOAD_COMMAND ${CMAKE_COMMAND}
+ -DPREFIX=${DEPS_BUILD_DIR}
+ -DDOWNLOAD_DIR=${DEPS_DOWNLOAD_DIR}/gettext
+ -DURL=${GETTEXT_URL}
+ -DEXPECTED_SHA256=${GETTEXT_SHA256}
+ -DTARGET=gettext
+ -DUSE_EXISTING_SRC_DIR=${USE_EXISTING_SRC_DIR}
+ -P ${CMAKE_CURRENT_SOURCE_DIR}/cmake/DownloadAndExtractFile.cmake
+ PATCH_COMMAND ${GIT_EXECUTABLE} -C ${DEPS_BUILD_DIR}/src/gettext init
+ COMMAND ${GIT_EXECUTABLE} -C ${DEPS_BUILD_DIR}/src/gettext apply --ignore-whitespace
+ ${CMAKE_CURRENT_SOURCE_DIR}/patches/gettext-Fix-compilation-on-a-system-without-alloca.patch
+ CONFIGURE_COMMAND ${CMAKE_COMMAND} -E copy
+ ${CMAKE_CURRENT_SOURCE_DIR}/cmake/GettextCMakeLists.txt
+ ${DEPS_BUILD_DIR}/src/gettext/gettext-runtime/CMakeLists.txt
+ COMMAND ${CMAKE_COMMAND} ${DEPS_BUILD_DIR}/src/gettext/gettext-runtime
+ -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()
+ message(FATAL_ERROR "Trying to build gettext in an unsupported system ${CMAKE_SYSTEM_NAME}/${CMAKE_C_COMPILER_ID}")
+endif()
+
+list(APPEND THIRD_PARTY_DEPS gettext)
diff --git a/third-party/cmake/BuildGperf.cmake b/third-party/cmake/BuildGperf.cmake
index 494d0d9717..fd11aa1998 100644
--- a/third-party/cmake/BuildGperf.cmake
+++ b/third-party/cmake/BuildGperf.cmake
@@ -36,8 +36,6 @@ function(BuildGperf)
INSTALL_COMMAND "${_gperf_INSTALL_COMMAND}")
endfunction()
-set(GPERF_BUILDARGS CC=${HOSTDEPS_C_COMPILER} LD=${HOSTDEPS_C_COMPILER})
-
if(UNIX OR (MINGW AND CMAKE_CROSSCOMPILING))
BuildGperf(
@@ -45,6 +43,21 @@ if(UNIX OR (MINGW AND CMAKE_CROSSCOMPILING))
--prefix=${HOSTDEPS_INSTALL_DIR}
INSTALL_COMMAND ${MAKE_PRG} install)
+elseif(MSVC OR MINGW)
+
+ BuildGperf(
+ CONFIGURE_COMMAND ${CMAKE_COMMAND} -E copy
+ ${CMAKE_CURRENT_SOURCE_DIR}/cmake/GperfCMakeLists.txt
+ ${DEPS_BUILD_DIR}/src/gperf/CMakeLists.txt
+ COMMAND ${CMAKE_COMMAND} ${DEPS_BUILD_DIR}/src/gperf/CMakeLists.txt
+ -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
+ -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}
+ -DCMAKE_GENERATOR=${CMAKE_GENERATOR}
+ -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
+ -DCMAKE_INSTALL_PREFIX=${DEPS_INSTALL_DIR}
+ BUILD_COMMAND ${CMAKE_COMMAND} --build . --config ${CMAKE_BUILD_TYPE}
+ INSTALL_COMMAND ${CMAKE_COMMAND} --build . --target install --config ${CMAKE_BUILD_TYPE})
+
else()
message(FATAL_ERROR "Trying to build gperf in an unsupported system ${CMAKE_SYSTEM_NAME}/${CMAKE_C_COMPILER_ID}")
endif()
diff --git a/third-party/cmake/BuildLibtermkey.cmake b/third-party/cmake/BuildLibtermkey.cmake
index 4b581c2a01..b5cd0c4ca6 100644
--- a/third-party/cmake/BuildLibtermkey.cmake
+++ b/third-party/cmake/BuildLibtermkey.cmake
@@ -1,5 +1,3 @@
-find_package(PkgConfig REQUIRED)
-
if(WIN32)
ExternalProject_Add(libtermkey
PREFIX ${DEPS_BUILD_DIR}
@@ -24,6 +22,8 @@ ExternalProject_Add(libtermkey
BUILD_COMMAND ${CMAKE_COMMAND} --build . --config ${CMAKE_BUILD_TYPE}
INSTALL_COMMAND ${CMAKE_COMMAND} --build . --target install --config ${CMAKE_BUILD_TYPE})
else()
+find_package(PkgConfig REQUIRED)
+
ExternalProject_Add(libtermkey
PREFIX ${DEPS_BUILD_DIR}
URL ${LIBTERMKEY_URL}
@@ -43,11 +43,9 @@ ExternalProject_Add(libtermkey
PREFIX=${DEPS_INSTALL_DIR}
PKG_CONFIG_PATH=${DEPS_LIB_DIR}/pkgconfig
CFLAGS=-fPIC
+ ${DEFAULT_MAKE_CFLAGS}
install)
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/BuildLibuv.cmake b/third-party/cmake/BuildLibuv.cmake
index 06b527e5a2..f6a9660d1c 100644
--- a/third-party/cmake/BuildLibuv.cmake
+++ b/third-party/cmake/BuildLibuv.cmake
@@ -70,24 +70,19 @@ elseif(MINGW)
elseif(WIN32 AND MSVC)
- find_package(PythonInterp 2.6 REQUIRED)
- if(NOT PYTHONINTERP_FOUND OR PYTHON_VERSION_MAJOR GREATER 2)
- message(FATAL_ERROR "Python2 is required to build libuv on windows, use -DPYTHON_EXECUTABLE to set a python interpreter")
- endif()
-
- include(TargetArch)
- if("${TARGET_ARCH}" STREQUAL "X86_64")
- set(TARGET_ARCH x64)
- elseif(TARGET_ARCH STREQUAL "X86")
- set(TARGET_ARCH x86)
- endif()
- string(TOLOWER ${CMAKE_BUILD_TYPE} LOWERCASE_BUILD_TYPE)
set(UV_OUTPUT_DIR ${DEPS_BUILD_DIR}/src/libuv/${CMAKE_BUILD_TYPE})
- BuildLibUv(
- BUILD_COMMAND set PYTHON=${PYTHON_EXECUTABLE} COMMAND ${DEPS_BUILD_DIR}/src/libuv/vcbuild.bat shared ${LOWERCASE_BUILD_TYPE} ${TARGET_ARCH}
- INSTALL_COMMAND ${CMAKE_COMMAND} -E make_directory ${DEPS_INSTALL_DIR}/lib
- COMMAND ${CMAKE_COMMAND} -E make_directory ${DEPS_INSTALL_DIR}/bin
- COMMAND ${CMAKE_COMMAND} -E copy ${UV_OUTPUT_DIR}/libuv.lib ${DEPS_INSTALL_DIR}/lib
+ BuildLibUv(BUILD_IN_SOURCE
+ CONFIGURE_COMMAND ${CMAKE_COMMAND} -E copy
+ ${CMAKE_CURRENT_SOURCE_DIR}/cmake/LibuvCMakeLists.txt
+ ${DEPS_BUILD_DIR}/src/libuv/CMakeLists.txt
+ COMMAND ${CMAKE_COMMAND} ${DEPS_BUILD_DIR}/src/libuv/CMakeLists.txt
+ -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
+ -DCMAKE_GENERATOR=${CMAKE_GENERATOR}
+ -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
+ -DBUILD_SHARED_LIBS=ON
+ -DCMAKE_INSTALL_PREFIX=${DEPS_INSTALL_DIR}
+ BUILD_COMMAND ${CMAKE_COMMAND} --build . --config ${CMAKE_BUILD_TYPE}
+ INSTALL_COMMAND ${CMAKE_COMMAND} --build . --target install --config ${CMAKE_BUILD_TYPE}
# Some applications (lua-client/luarocks) look for uv.lib instead of libuv.lib
COMMAND ${CMAKE_COMMAND} -E copy ${UV_OUTPUT_DIR}/libuv.lib ${DEPS_INSTALL_DIR}/lib/uv.lib
COMMAND ${CMAKE_COMMAND} -E copy ${UV_OUTPUT_DIR}/libuv.dll ${DEPS_INSTALL_DIR}/bin/
diff --git a/third-party/cmake/BuildLibvterm.cmake b/third-party/cmake/BuildLibvterm.cmake
index 5ea8314da5..e4649986af 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,11 +35,19 @@ function(BuildLibvterm)
endfunction()
if(WIN32)
- # MinGW
+ if(MSVC)
+ set(LIBVTERM_PATCH_COMMAND
+ ${GIT_EXECUTABLE} -C ${DEPS_BUILD_DIR}/src/libvterm init
+ COMMAND ${GIT_EXECUTABLE} -C ${DEPS_BUILD_DIR}/src/libvterm apply --ignore-whitespace
+ ${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
- COMMAND ${CMAKE_COMMAND} ${DEPS_BUILD_DIR}/src/libvterm
+ ${CMAKE_CURRENT_SOURCE_DIR}/cmake/LibvtermCMakeLists.txt
+ ${DEPS_BUILD_DIR}/src/libvterm/CMakeLists.txt
+ COMMAND ${CMAKE_COMMAND} -E copy
+ ${CMAKE_CURRENT_SOURCE_DIR}/cmake/Libvterm-tbl2inc_c.cmake
+ ${DEPS_BUILD_DIR}/src/libvterm/tbl2inc_c.cmake
+ COMMAND ${CMAKE_COMMAND} ${DEPS_BUILD_DIR}/src/libvterm
-DCMAKE_INSTALL_PREFIX=${DEPS_INSTALL_DIR}
-DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
"-DCMAKE_C_FLAGS:STRING=${CMAKE_C_COMPILER_ARG1} -fPIC"
@@ -47,12 +56,14 @@ if(WIN32)
set(LIBVTERM_INSTALL_COMMAND ${CMAKE_COMMAND} --build . --target install --config ${CMAKE_BUILD_TYPE})
else()
set(LIBVTERM_INSTALL_COMMAND ${MAKE_PRG} CC=${DEPS_C_COMPILER}
- PREFIX=${DEPS_INSTALL_DIR}
- CFLAGS=-fPIC
- install)
+ PREFIX=${DEPS_INSTALL_DIR}
+ CFLAGS=-fPIC
+ ${DEFAULT_MAKE_CFLAGS}
+ 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/BuildLua.cmake b/third-party/cmake/BuildLua.cmake
index ea1371d1d5..da617e3ccd 100644
--- a/third-party/cmake/BuildLua.cmake
+++ b/third-party/cmake/BuildLua.cmake
@@ -71,6 +71,7 @@ set(LUA_CONFIGURE_COMMAND
-e "s@-lncurses@@g"
-i ${DEPS_BUILD_DIR}/src/lua/src/Makefile &&
sed -e "/#define LUA_USE_READLINE/d"
+ -e "s@\\(#define LUA_ROOT[ ]*\"\\)/usr/local@\\1${DEPS_INSTALL_DIR}@"
-i ${DEPS_BUILD_DIR}/src/lua/src/luaconf.h)
set(LUA_INSTALL_TOP_ARG "INSTALL_TOP=${DEPS_INSTALL_DIR}")
set(LUA_BUILD_COMMAND
@@ -84,14 +85,13 @@ BuildLua(CONFIGURE_COMMAND ${LUA_CONFIGURE_COMMAND}
BUILD_COMMAND ${LUA_BUILD_COMMAND}
INSTALL_COMMAND ${LUA_INSTALL_COMMAND})
list(APPEND THIRD_PARTY_DEPS lua)
-add_dependencies(lua busted)
set(BUSTED ${DEPS_INSTALL_DIR}/bin/busted)
set(BUSTED_LUA ${BUSTED}-lua)
add_custom_command(OUTPUT ${BUSTED_LUA}
COMMAND sed -e 's/^exec/exec $$LUA_DEBUGGER/' -e 's/jit//g' < ${BUSTED} > ${BUSTED_LUA} && chmod +x ${BUSTED_LUA}
- DEPENDS lua)
+ DEPENDS lua busted)
add_custom_target(busted-lua
DEPENDS ${DEPS_INSTALL_DIR}/bin/busted-lua)
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 ef8a8450f1..b5fcf7f3e5 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,28 +51,43 @@ 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))
if(USE_BUNDLED_LUAJIT)
list(APPEND LUAROCKS_OPTS
--with-lua=${HOSTDEPS_INSTALL_DIR}
- --with-lua-include=${HOSTDEPS_INSTALL_DIR}/include/luajit-2.0)
+ --with-lua-include=${HOSTDEPS_INSTALL_DIR}/include/luajit-2.0
+ --lua-suffix=jit)
+ elseif(USE_BUNDLED_LUA)
+ list(APPEND LUAROCKS_OPTS
+ --with-lua=${HOSTDEPS_INSTALL_DIR})
endif()
BuildLuarocks(
CONFIGURE_COMMAND ${DEPS_BUILD_DIR}/src/luarocks/configure
--prefix=${HOSTDEPS_INSTALL_DIR} --force-config ${LUAROCKS_OPTS}
- --lua-suffix=jit
- INSTALL_COMMAND ${MAKE_PRG} bootstrap)
+ INSTALL_COMMAND ${MAKE_PRG} -j1 bootstrap)
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_EXECUTABLE} -C ${DEPS_BUILD_DIR}/src/luarocks init
+ COMMAND ${GIT_EXECUTABLE} -C ${DEPS_BUILD_DIR}/src/luarocks apply --ignore-whitespace
+ ${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}
@@ -79,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()
@@ -94,63 +112,88 @@ if(USE_BUNDLED_LUAJIT)
if(MINGW AND CMAKE_CROSSCOMPILING)
add_dependencies(luarocks luajit_host)
endif()
+elseif(USE_BUNDLED_LUA)
+ add_dependencies(luarocks lua)
endif()
-# Each target depends on the previous module, this serializes all calls to
-# luarocks since it is unhappy to be called in parallel.
+# DEPENDS on the previous module, because Luarocks breaks if parallel.
add_custom_command(OUTPUT ${HOSTDEPS_LIB_DIR}/luarocks/rocks/mpack
COMMAND ${LUAROCKS_BINARY}
- ARGS build mpack ${LUAROCKS_BUILDARGS}
+ ARGS build mpack 1.0.7-0 ${LUAROCKS_BUILDARGS}
DEPENDS luarocks)
add_custom_target(mpack
DEPENDS ${HOSTDEPS_LIB_DIR}/luarocks/rocks/mpack)
list(APPEND THIRD_PARTY_DEPS mpack)
-
+# DEPENDS on the previous module, because Luarocks breaks if parallel.
add_custom_command(OUTPUT ${HOSTDEPS_LIB_DIR}/luarocks/rocks/lpeg
COMMAND ${LUAROCKS_BINARY}
- ARGS build lpeg ${LUAROCKS_BUILDARGS}
+ ARGS build lpeg 1.0.1-1 ${LUAROCKS_BUILDARGS}
DEPENDS mpack)
add_custom_target(lpeg
DEPENDS ${HOSTDEPS_LIB_DIR}/luarocks/rocks/lpeg)
list(APPEND THIRD_PARTY_DEPS lpeg)
+# DEPENDS on the previous module, because Luarocks breaks if parallel.
add_custom_command(OUTPUT ${HOSTDEPS_LIB_DIR}/luarocks/rocks/inspect
COMMAND ${LUAROCKS_BINARY}
- ARGS build inspect ${LUAROCKS_BUILDARGS}
- DEPENDS mpack)
+ ARGS build inspect 3.1.1-0 ${LUAROCKS_BUILDARGS}
+ DEPENDS lpeg)
add_custom_target(inspect
DEPENDS ${HOSTDEPS_LIB_DIR}/luarocks/rocks/inspect)
list(APPEND THIRD_PARTY_DEPS inspect)
-if(USE_BUNDLED_BUSTED)
- add_custom_command(OUTPUT ${HOSTDEPS_LIB_DIR}/luarocks/rocks/penlight/1.3.2-2
+if((NOT USE_BUNDLED_LUAJIT) AND USE_BUNDLED_LUA)
+ # DEPENDS on the previous module, because Luarocks breaks if parallel.
+ add_custom_command(OUTPUT ${HOSTDEPS_LIB_DIR}/luarocks/rocks/luabitop
COMMAND ${LUAROCKS_BINARY}
- ARGS build penlight 1.3.2-2 ${LUAROCKS_BUILDARGS}
+ ARGS build luabitop 1.0.2-3 ${LUAROCKS_BUILDARGS}
DEPENDS inspect)
+ add_custom_target(luabitop
+ DEPENDS ${HOSTDEPS_LIB_DIR}/luarocks/rocks/luabitop)
+
+ list(APPEND THIRD_PARTY_DEPS luabitop)
+endif()
+
+if(USE_BUNDLED_BUSTED)
+ if((NOT USE_BUNDLED_LUAJIT) AND USE_BUNDLED_LUA)
+ set(PENLIGHT_DEPENDS luabitop)
+ else()
+ set(PENLIGHT_DEPENDS inspect)
+ endif()
+
+ # DEPENDS on the previous module, because Luarocks breaks if parallel.
+ add_custom_command(OUTPUT ${HOSTDEPS_LIB_DIR}/luarocks/rocks/penlight
+ COMMAND ${LUAROCKS_BINARY}
+ ARGS build penlight 1.5.4-1 ${LUAROCKS_BUILDARGS}
+ DEPENDS ${PENLIGHT_DEPENDS})
add_custom_target(penlight
- DEPENDS ${HOSTDEPS_LIB_DIR}/luarocks/rocks/penlight/1.3.2-2)
+ DEPENDS ${HOSTDEPS_LIB_DIR}/luarocks/rocks/penlight)
if(WIN32)
set(BUSTED_EXE "${HOSTDEPS_BIN_DIR}/busted.bat")
+ set(LUACHECK_EXE "${HOSTDEPS_BIN_DIR}/luacheck.bat")
else()
set(BUSTED_EXE "${HOSTDEPS_BIN_DIR}/busted")
+ set(LUACHECK_EXE "${HOSTDEPS_BIN_DIR}/luacheck")
endif()
+ # DEPENDS on the previous module, because Luarocks breaks if parallel.
add_custom_command(OUTPUT ${BUSTED_EXE}
COMMAND ${LUAROCKS_BINARY}
- ARGS build https://raw.githubusercontent.com/Olivine-Labs/busted/v2.0.rc12-1/busted-2.0.rc12-1.rockspec ${LUAROCKS_BUILDARGS}
+ ARGS build busted 2.0.rc12-1 ${LUAROCKS_BUILDARGS}
DEPENDS penlight)
add_custom_target(busted
DEPENDS ${BUSTED_EXE})
- add_custom_command(OUTPUT ${HOSTDEPS_BIN_DIR}/luacheck
+ # DEPENDS on the previous module, because Luarocks breaks if parallel.
+ add_custom_command(OUTPUT ${LUACHECK_EXE}
COMMAND ${LUAROCKS_BINARY}
- ARGS build https://raw.githubusercontent.com/mpeterv/luacheck/master/luacheck-scm-1.rockspec ${LUAROCKS_BUILDARGS}
+ ARGS build luacheck 0.21.2-1 ${LUAROCKS_BUILDARGS}
DEPENDS busted)
add_custom_target(luacheck
- DEPENDS ${HOSTDEPS_BIN_DIR}/luacheck)
+ DEPENDS ${LUACHECK_EXE})
set(LUV_DEPS luacheck luv-static)
if(MINGW AND CMAKE_CROSSCOMPILING)
@@ -160,6 +203,7 @@ if(USE_BUNDLED_BUSTED)
if(USE_BUNDLED_LIBUV)
list(APPEND LUV_ARGS LIBUV_DIR=${HOSTDEPS_INSTALL_DIR})
endif()
+ # DEPENDS on the previous module, because Luarocks breaks if parallel.
add_custom_command(OUTPUT ${HOSTDEPS_LIB_DIR}/luarocks/rocks/luv
COMMAND ${LUAROCKS_BINARY}
ARGS make ${LUAROCKS_BUILDARGS} ${LUV_ARGS}
@@ -168,9 +212,10 @@ if(USE_BUNDLED_BUSTED)
add_custom_target(luv
DEPENDS ${HOSTDEPS_LIB_DIR}/luarocks/rocks/luv)
+ # DEPENDS on the previous module, because Luarocks breaks if parallel.
add_custom_command(OUTPUT ${HOSTDEPS_LIB_DIR}/luarocks/rocks/nvim-client
COMMAND ${LUAROCKS_BINARY}
- ARGS build https://raw.githubusercontent.com/neovim/lua-client/0.0.1-26/nvim-client-0.0.1-26.rockspec ${LUAROCKS_BUILDARGS}
+ ARGS build nvim-client 0.0.1-26 ${LUAROCKS_BUILDARGS}
DEPENDS luv)
add_custom_target(nvim-client
DEPENDS ${HOSTDEPS_LIB_DIR}/luarocks/rocks/nvim-client)
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 a5ec6c01eb..f5342e3d34 100644
--- a/third-party/cmake/BuildUnibilium.cmake
+++ b/third-party/cmake/BuildUnibilium.cmake
@@ -1,25 +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
- INSTALL_COMMAND ${MAKE_PRG} PREFIX=${DEPS_INSTALL_DIR} install)
-
list(APPEND THIRD_PARTY_DEPS unibilium)
diff --git a/third-party/cmake/GettextCMakeLists.txt b/third-party/cmake/GettextCMakeLists.txt
new file mode 100644
index 0000000000..60ee3b6f99
--- /dev/null
+++ b/third-party/cmake/GettextCMakeLists.txt
@@ -0,0 +1,83 @@
+cmake_minimum_required(VERSION 2.8.7)
+project(libintl C)
+
+include_directories(${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR})
+
+file(READ config.h.in CONFIG_CONTENT)
+string(REPLACE "#undef HAVE_GETCWD" "#define HAVE_GETCWD 1" CONFIG_CONTENT ${CONFIG_CONTENT})
+string(REPLACE "#undef uintmax_t" "
+ #if _WIN64
+ # define intmax_t long long
+ # define uintmax_t unsigned long long
+ #elif _WIN32
+ # define intmax_t long
+ # define uintmax_t unsigned long
+ #endif"
+ CONFIG_CONTENT ${CONFIG_CONTENT})
+file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/config.h ${CONFIG_CONTENT})
+
+set(HAVE_NEWLOCALE 0)
+set(HAVE_POSIX_PRINTF 0)
+set(HAVE_SNPRINTF 0)
+set(HAVE_ASPRINTF 0)
+set(HAVE_WPRINTF 0)
+configure_file(intl/libgnuintl.in.h libgnuintl.h)
+
+set(LOCALDIR "gettext")
+add_definitions(-DLOCALEDIR=\"${LOCALDIR}\"
+ -DLOCALE_ALIAS_PATH=\"${LOCALDIR}\"
+ -DLIBDIR=\"${LOCALDIR}\"
+ -DINSTALLDIR=\"${LOCALDIR}\")
+
+add_definitions(-DBUILDING_LIBINTL
+ -DIN_LIBINTL
+ -DENABLE_RELOCATABLE=1
+ -DIN_LIBRARY
+ -DNO_XMALLOC
+ -Dset_relocation_prefix=libintl_set_relocation_prefix
+ -Drelocate=libintl_relocate
+ -DHAVE_CONFIG_H
+ -D_CRT_SECURE_NO_WARNINGS)
+
+FILE(GLOB SOURCES
+ intl/bindtextdom.c
+ intl/dcgettext.c
+ intl/dcigettext.c
+ intl/dcngettext.c
+ intl/dgettext.c
+ intl/dngettext.c
+ intl/explodename.c
+ intl/finddomain.c
+ intl/gettext.c
+ intl/hash-string.c
+ intl/l10nflist.c
+ intl/langprefs.c
+ intl/loadmsgcat.c
+ intl/localcharset.c
+ intl/localealias.c
+ intl/localename.c
+ intl/lock.c
+ intl/log.c
+ intl/ngettext.c
+ intl/plural-exp.c
+ intl/plural.c
+ intl/printf.c
+ intl/relocatable.c
+ intl/setlocale.c
+ intl/textdomain.c
+ intl/threadlib.c
+ intl/version.c)
+
+add_library(libintl ${SOURCES})
+
+include(GNUInstallDirs)
+
+install(FILES
+ ${CMAKE_CURRENT_BINARY_DIR}/libgnuintl.h
+ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
+ RENAME libintl.h)
+
+install(TARGETS libintl
+ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
+ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
+ PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
diff --git a/third-party/cmake/GperfCMakeLists.txt b/third-party/cmake/GperfCMakeLists.txt
new file mode 100644
index 0000000000..32837fc166
--- /dev/null
+++ b/third-party/cmake/GperfCMakeLists.txt
@@ -0,0 +1,30 @@
+cmake_minimum_required(VERSION 2.8.7)
+project(gperf LANGUAGES C CXX)
+
+add_executable(gperf
+ lib/getline.cc
+ lib/hash.cc
+ lib/getopt.c
+ lib/getopt1.c
+ src/version.cc
+ src/positions.cc
+ src/options.cc
+ src/keyword.cc
+ src/keyword-list.cc
+ src/input.cc
+ src/bool-array.cc
+ src/hash-table.cc
+ src/search.cc
+ src/output.cc
+ src/main.cc)
+
+include_directories(lib)
+
+# Copy the config.h template without modifying it
+# because none of the definitions are necessary
+execute_process(COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/src/config.h.in ${CMAKE_BINARY_DIR}/config/config.h)
+include_directories(${CMAKE_BINARY_DIR}/config)
+
+include(GNUInstallDirs)
+install(TARGETS gperf
+ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
diff --git a/third-party/cmake/LibuvCMakeLists.txt b/third-party/cmake/LibuvCMakeLists.txt
new file mode 100644
index 0000000000..063e4291f2
--- /dev/null
+++ b/third-party/cmake/LibuvCMakeLists.txt
@@ -0,0 +1,27 @@
+cmake_minimum_required(VERSION 2.8.7)
+project(libuv LANGUAGES C)
+
+file(GLOB UV_SOURCES_COMMON src/*.c)
+file(GLOB UV_SOURCES_WIN src/win/*.c)
+
+add_library(libuv ${UV_SOURCES_COMMON} ${UV_SOURCES_WIN})
+target_compile_definitions(libuv PRIVATE WIN32_LEAN_AND_MEAN "_WIN32_WINNT=0x0600")
+target_link_libraries(libuv iphlpapi psapi shell32 userenv ws2_32)
+target_include_directories(libuv PUBLIC ./include PRIVATE ./src)
+set_target_properties(libuv PROPERTIES DEFINE_SYMBOL BUILDING_UV_SHARED)
+
+install(FILES
+ include/tree.h
+ include/uv.h
+ include/uv-version.h
+ include/uv-errno.h
+ include/uv-threadpool.h
+ include/uv-win.h
+ DESTINATION include)
+
+include(GNUInstallDirs)
+install(TARGETS libuv
+ PUBLIC_HEADER
+ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
+ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
+ PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
diff --git a/third-party/cmake/Libvterm-tbl2inc_c.cmake b/third-party/cmake/Libvterm-tbl2inc_c.cmake
new file mode 100644
index 0000000000..b1ee0246f1
--- /dev/null
+++ b/third-party/cmake/Libvterm-tbl2inc_c.cmake
@@ -0,0 +1,163 @@
+cmake_minimum_required(VERSION 2.8.7)
+
+set(HEX_ALPHABET "0123456789abcdef")
+
+function(ConvertToHex dec hex)
+ while(dec GREATER 0)
+ math(EXPR _val "${dec} % 16")
+ math(EXPR dec "${dec} / 16")
+ string(SUBSTRING ${HEX_ALPHABET} ${_val} 1 _val)
+ set(_res "${_val}${_res}")
+ endwhile()
+ # Pad the result with the number of zeros
+ # specified by the optional third argument
+ if(${ARGC} EQUAL 3)
+ set(padding ${ARGV2})
+ string(LENGTH ${_res} _resLen)
+ if(_resLen LESS ${padding})
+ math(EXPR _neededPadding "${padding} - ${_resLen}")
+ foreach(i RANGE 1 ${_neededPadding})
+ set(_res "0${_res}")
+ endforeach()
+ endif()
+ endif()
+ set(${hex} "0x${_res}" PARENT_SCOPE)
+endfunction()
+
+function(ConvertFromHex hex dec)
+ string(TOLOWER ${hex} hex)
+ string(LENGTH "${hex}" _strlen)
+ set(_res 0)
+ while(_strlen GREATER 0)
+ math(EXPR _res "${_res} * 16")
+ string(SUBSTRING "${hex}" 0 1 NIBBLE)
+ string(SUBSTRING "${hex}" 1 -1 hex)
+ string(FIND ${HEX_ALPHABET} ${NIBBLE} value)
+ if(value EQUAL -1)
+ message(FATAL_ERROR "Invalid hex character '${NIBBLE}'")
+ endif()
+ math(EXPR _res "${_res} + ${value}")
+ string(LENGTH "${hex}" _strlen)
+ endwhile()
+ set(${dec} ${_res} PARENT_SCOPE)
+endfunction()
+
+# Based on http://www.json.org/JSON_checker/utf8_decode.c
+function(DecodeUtf8 hexBytes codePoint)
+ string(SUBSTRING ${hexBytes} 0 2 hexByte1)
+ ConvertFromHex(${hexByte1} byte1)
+ # Zero continuations (0 to 127)
+ math(EXPR out "${byte1} & 128")
+ if(out EQUAL 0)
+ set(${codePoint} ${byte1} PARENT_SCOPE)
+ return()
+ endif()
+ # One continuation (128 to 2047)
+ math(EXPR out "${byte1} & 224")
+ if(out EQUAL 192)
+ string(SUBSTRING ${hexBytes} 2 2 hexByte2)
+ ConvertFromHex(${hexByte2} byte2)
+ math(EXPR result "((${byte1} & 31) << 6) | ${byte2}")
+ if(result GREATER 127)
+ set(${codePoint} ${result} PARENT_SCOPE)
+ return()
+ endif()
+ else()
+ # Two continuations (2048 to 55295 and 57344 to 65535)
+ math(EXPR result "${byte1} & 240")
+ if(result EQUAL 224)
+ string(SUBSTRING ${hexBytes} 2 2 hexByte2)
+ string(SUBSTRING ${hexBytes} 4 2 hexByte3)
+ ConvertFromHex(${hexByte2} byte2)
+ ConvertFromHex(${hexByte3} byte3)
+ math(EXPR result "${byte2} | ${byte3}")
+ if(result GREATER -1)
+ math(EXPR result "((${byte1} & 15) << 12) | (${byte2} << 6) | ${byte3}")
+ if((result GREATER 2047) AND (result LESS 55296 OR result GREATER 57343))
+ set(${codePoint} ${result} PARENT_SCOPE)
+ return()
+ endif()
+ endif()
+ else()
+ # Three continuations (65536 to 1114111)
+ math(EXPR result "${byte1} & 248")
+ if(result EQUAL 224)
+ string(SUBSTRING ${hexBytes} 2 2 hexByte2)
+ string(SUBSTRING ${hexBytes} 4 2 hexByte3)
+ string(SUBSTRING ${hexBytes} 6 2 hexByte4)
+ ConvertFromHex(${hexByte2} byte2)
+ ConvertFromHex(${hexByte3} byte3)
+ ConvertFromHex(${hexByte4} byte4)
+ math(EXPR result "${byte2} | ${byte3} | ${byte4}")
+ if(result GREATER -1)
+ math(EXPR result "((c & 7) << 18) | (c1 << 12) | (c2 << 6) | c3")
+ if((result GREATER 65535) AND (result LESS 1114112))
+ set(${codePoint} ${result} PARENT_SCOPE)
+ return()
+ endif()
+ endif()
+ endif()
+ endif()
+ endif()
+ message(FATAL_ERROR "Invalid UTF-8 encoding")
+endfunction()
+
+set(inputFile ${CMAKE_ARGV3})
+set(outputFile ${CMAKE_ARGV4})
+# Get the file contents in text and hex-encoded format because
+# CMake doesn't provide functions for converting between the two
+file(READ "${inputFile}" contents)
+file(READ "${inputFile}" hexContents HEX)
+
+# Convert the text contents into a list of lines by escaping
+# the list separator ';' and then replacing new line characters
+# with the list separator
+string(REGEX REPLACE ";" "\\\\;" contents ${contents})
+string(REGEX REPLACE "\n" ";" contents ${contents})
+
+get_filename_component(encname ${inputFile} NAME_WE)
+set(output
+ "static const struct StaticTableEncoding encoding_${encname} = {\n"
+ " { .decode = &decode_table },\n"
+ " {")
+set(hexIndex 0)
+foreach(line ${contents})
+ string(LENGTH ${line} lineLength)
+ # Convert "A" to 0x41
+ string(FIND ${line} "\"" beginQuote)
+ if(NOT ${beginQuote} EQUAL -1)
+ string(FIND ${line} "\"" endQuote REVERSE)
+ if(${beginQuote} EQUAL ${endQuote})
+ message(FATAL_ERROR "Line contains only one quote")
+ endif()
+ math(EXPR beginHexQuote "${hexIndex} + (${beginQuote} + 1)*2")
+ math(EXPR endHexQuote "${hexIndex} + (${endQuote} + 1)*2")
+ math(EXPR quoteLen "${endHexQuote} - ${beginHexQuote} - 1")
+ string(SUBSTRING ${hexContents} ${beginHexQuote} ${quoteLen} hexQuote)
+ DecodeUtf8(${hexQuote} codePoint)
+ ConvertToHex(${codePoint} hexCodePoint 4)
+ STRING(REGEX REPLACE "\"(.+)\"" ${hexCodePoint} line ${line})
+ endif()
+ # Strip comment
+ string(REGEX REPLACE "[ \t\n]*#.*" "" line ${line})
+ # Convert 3/1 to [0x31]
+ string(REGEX REPLACE "^([0-9]+)/([0-9]+).*" "\\1;\\2" numbers ${line})
+ list(GET numbers 0 upperBits)
+ list(GET numbers 1 lowerBits)
+ math(EXPR res "${upperBits}*16 + ${lowerBits}")
+ ConvertToHex(${res} hex 2)
+ string(REGEX REPLACE "^([0-9]+)/([0-9]+)" "[${hex}]" line ${line})
+ # Convert U+0041 to 0x0041
+ string(REPLACE "U+" "0x" line ${line})
+ # Indent and append a comma
+ set(line " ${line},")
+ set(output "${output}\n${line}")
+ # Increment the index by the number of characters in the line,
+ # plus one for the new line character then multiple by two for the hex digit index
+ math(EXPR hexIndex "${hexIndex} + 2*(${lineLength} + 1)")
+endforeach()
+set(output "${output}\n"
+ " }\n"
+ "}\;\n")
+
+file(WRITE ${outputFile} ${output})
diff --git a/third-party/cmake/LibvtermCMakeLists.txt b/third-party/cmake/LibvtermCMakeLists.txt
index 72183e4b4c..27d0d11e9f 100644
--- a/third-party/cmake/LibvtermCMakeLists.txt
+++ b/third-party/cmake/LibvtermCMakeLists.txt
@@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 2.8.11)
project(libvterm LANGUAGES C)
include(GNUInstallDirs)
-find_package(Perl REQUIRED)
+find_package(Perl)
if(MSVC)
add_definitions(/W3 -D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_DEPRECATE)
@@ -18,11 +18,19 @@ foreach(file ${TBL_FILES})
set(tname encoding/${basename}.inc)
add_custom_command(OUTPUT
COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_BINARY_DIR}/encoding/
- COMMAND ${PERL_EXECUTABLE} -CSD ${CMAKE_SOURCE_DIR}/tbl2inc_c.pl ${file} > ${CMAKE_BINARY_DIR}/${tname}
+ COMMAND ${CMAKE_COMMAND} -P ${CMAKE_SOURCE_DIR}/tbl2inc_c.cmake ${file} ${CMAKE_BINARY_DIR}/${tname}
COMMENT "Generating ${tname}"
OUTPUT ${CMAKE_BINARY_DIR}/${tname}
)
list(APPEND TBL_FILES_HEADERS ${tname})
+ # Only used for verifying that the output of tbl2inc_c.cmake is correct
+ set(tname encoding-test/${basename}.inc)
+ add_custom_command(OUTPUT
+ COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_BINARY_DIR}/encoding-test/
+ COMMAND ${PERL_EXECUTABLE} -CSD ${CMAKE_SOURCE_DIR}/tbl2inc_c.pl ${file} > ${CMAKE_BINARY_DIR}/${tname}
+ COMMENT "Generating ${tname}"
+ OUTPUT ${CMAKE_BINARY_DIR}/${tname}
+ )
endforeach()
include_directories(${CMAKE_SOURCE_DIR}/include)
@@ -60,13 +68,24 @@ set_target_properties(harness PROPERTIES
# run-test.pl expects to find the harness in t/.libs/
RUNTIME_OUTPUT_DIRECTORY t/.libs)
-file(GLOB TESTFILES ${CMAKE_SOURCE_DIR}/t/*.test)
-add_custom_target(check)
-foreach(testfile ${TESTFILES})
- get_filename_component(target_name ${testfile} NAME_WE)
- add_custom_target(${target_name}
- COMMAND ${PERL_EXECUTABLE} ${CMAKE_SOURCE_DIR}/t/run-test.pl ${testfile}
- COMMENT "**${target_name} **"
- DEPENDS harness)
- add_dependencies(check ${target_name})
-endforeach()
+if(Perl_FOUND)
+ file(GLOB TESTFILES ${CMAKE_SOURCE_DIR}/t/*.test)
+ add_custom_target(check)
+ foreach(testfile ${TESTFILES})
+ get_filename_component(target_name ${testfile} NAME_WE)
+ add_custom_target(${target_name}
+ COMMAND ${PERL_EXECUTABLE} ${CMAKE_SOURCE_DIR}/t/run-test.pl ${testfile}
+ COMMENT "**${target_name} **"
+ DEPENDS harness)
+ add_dependencies(check ${target_name})
+ endforeach()
+
+ foreach(header_path ${TBL_FILES_HEADERS})
+ get_filename_component(header_name ${header_path} NAME)
+ set(perl_header_path ${CMAKE_BINARY_DIR}/encoding-test/${header_name})
+ add_custom_target(test-${header_name}
+ COMMAND ${CMAKE_COMMAND} -E compare_files
+ ${header_path} ${perl_header_path}
+ DEPENDS ${header_path} ${perl_header_path})
+ endforeach()
+endif()
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/gettext-Fix-compilation-on-a-system-without-alloca.patch b/third-party/patches/gettext-Fix-compilation-on-a-system-without-alloca.patch
new file mode 100644
index 0000000000..5c472c470f
--- /dev/null
+++ b/third-party/patches/gettext-Fix-compilation-on-a-system-without-alloca.patch
@@ -0,0 +1,28 @@
+From 1d12aeb7334104f77070361492ff7cc8225503f5 Mon Sep 17 00:00:00 2001
+From: Daiki Ueno <ueno@gnu.org>
+Date: Mon, 14 Nov 2016 13:27:58 +0100
+Subject: [PATCH] intl: Fix compilation on a system without alloca
+
+* gettext-runtime/intl/dcigettext.c (DCIGETTEXT): Fix typo 'tmp_dirname'
+-> 'resolved_dirname'. Reported by Egor Pugin in:
+http://lists.gnu.org/archive/html/bug-gettext/2016-09/msg00008.html
+---
+ gettext-runtime/intl/dcigettext.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/gettext-runtime/intl/dcigettext.c b/gettext-runtime/intl/dcigettext.c
+index 83bd77574..92f6fd685 100644
+--- a/gettext-runtime/intl/dcigettext.c
++++ b/gettext-runtime/intl/dcigettext.c
+@@ -634,7 +634,7 @@ DCIGETTEXT (const char *domainname, const char *msgid1, const char *msgid2,
+ for (;;)
+ {
+ resolved_dirname = (char *) alloca (path_max + dirname_len);
+- ADD_BLOCK (block_list, tmp_dirname);
++ ADD_BLOCK (block_list, resolved_dirname);
+
+ __set_errno (0);
+ ret = getcwd (resolved_dirname, path_max);
+--
+2.16.1.windows.4
+
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..e999c0fa9b
--- /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 * sizeof(uint32_t));
+ 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) * sizeof(uint32_t));
+
+ 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
+