diff options
-rw-r--r-- | appveyor.yml | 3 | ||||
-rw-r--r-- | src/nvim/CMakeLists.txt | 47 | ||||
-rw-r--r-- | src/nvim/ex_docmd.c | 26 | ||||
-rw-r--r-- | src/nvim/message.c | 4 | ||||
-rw-r--r-- | src/nvim/tui/tui.c | 2 | ||||
-rw-r--r-- | test/functional/legacy/arglist_spec.lua | 4 | ||||
-rw-r--r-- | test/unit/preprocess.lua | 25 | ||||
-rw-r--r-- | third-party/CMakeLists.txt | 35 | ||||
-rw-r--r-- | third-party/cmake/BuildLibuv.cmake | 12 | ||||
-rw-r--r-- | third-party/cmake/GetBinaryDeps.cmake | 4 | ||||
-rw-r--r-- | third-party/cmake/TargetArch.cmake | 23 |
11 files changed, 128 insertions, 57 deletions
diff --git a/appveyor.yml b/appveyor.yml index eb3064c3b1..ed5e06e3ee 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -5,6 +5,9 @@ configuration: install: [] build_script: - call .ci\build.bat +cache: +- C:\msys64\var\cache\pacman\pkg -> .ci\build.bat +- .deps -> third-party/CMakeLists.txt artifacts: - path: build/Neovim.zip - path: build/bin/nvim.exe diff --git a/src/nvim/CMakeLists.txt b/src/nvim/CMakeLists.txt index 5a658691ce..b19a951d5b 100644 --- a/src/nvim/CMakeLists.txt +++ b/src/nvim/CMakeLists.txt @@ -299,25 +299,6 @@ if(WIN32) install(DIRECTORY ${PROJECT_BINARY_DIR}/windows_runtime_deps/ DESTINATION ${CMAKE_INSTALL_BINDIR}) - foreach(BIN win32yank.exe) - unset(BIN_PATH CACHE) - find_program(BIN_PATH ${BIN}) - if(NOT BIN_PATH) - message(FATAL_ERROR "Unable to find external dependency ${BIN}") - endif() - - add_custom_target(external_${BIN} - COMMAND ${CMAKE_COMMAND} -E make_directory ${PROJECT_BINARY_DIR}/windows_runtime_deps - COMMAND ${CMAKE_COMMAND} - "-DCMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH}" - -DBINARY="${BIN_PATH}" - -DDST=${PROJECT_BINARY_DIR}/windows_runtime_deps - -P ${PROJECT_SOURCE_DIR}/cmake/WindowsDllCopy.cmake - COMMAND ${CMAKE_COMMAND} -E copy ${BIN_PATH} ${PROJECT_BINARY_DIR}/windows_runtime_deps/ - COMMENT "${BIN_PATH}") - add_dependencies(nvim_runtime_deps "external_${BIN}") - endforeach() - add_custom_target(nvim_dll_deps DEPENDS nvim COMMAND ${CMAKE_COMMAND} -E make_directory ${PROJECT_BINARY_DIR}/windows_runtime_deps COMMAND ${CMAKE_COMMAND} @@ -326,6 +307,34 @@ if(WIN32) -DDST=${PROJECT_BINARY_DIR}/windows_runtime_deps -P ${PROJECT_SOURCE_DIR}/cmake/WindowsDllCopy.cmake) add_dependencies(nvim_runtime_deps nvim_dll_deps) + + add_custom_target(external_blobs + COMMAND ${CMAKE_COMMAND} -E make_directory ${PROJECT_BINARY_DIR}/windows_runtime_deps/platforms + + COMMAND ${CMAKE_COMMAND} -E copy "${DEPS_PREFIX}/bin/ca-bundle.crt" ${PROJECT_BINARY_DIR}/windows_runtime_deps/ + COMMAND ${CMAKE_COMMAND} -E copy "${DEPS_PREFIX}/bin/curl.exe" ${PROJECT_BINARY_DIR}/windows_runtime_deps/ + COMMAND ${CMAKE_COMMAND} -E copy "${DEPS_PREFIX}/bin/diff.exe" ${PROJECT_BINARY_DIR}/windows_runtime_deps/ + COMMAND ${CMAKE_COMMAND} -E copy "${DEPS_PREFIX}/bin/tee.exe" ${PROJECT_BINARY_DIR}/windows_runtime_deps/ + COMMAND ${CMAKE_COMMAND} -E copy "${DEPS_PREFIX}/bin/tidy.exe" ${PROJECT_BINARY_DIR}/windows_runtime_deps/ + COMMAND ${CMAKE_COMMAND} -E copy "${DEPS_PREFIX}/bin/win32yank.exe" ${PROJECT_BINARY_DIR}/windows_runtime_deps/ + + COMMAND ${CMAKE_COMMAND} -E copy "${DEPS_PREFIX}/bin/D3Dcompiler_47.dll" ${PROJECT_BINARY_DIR}/windows_runtime_deps/ + COMMAND ${CMAKE_COMMAND} -E copy "${DEPS_PREFIX}/bin/libEGL.dll" ${PROJECT_BINARY_DIR}/windows_runtime_deps/ + COMMAND ${CMAKE_COMMAND} -E copy "${DEPS_PREFIX}/bin/libgcc_s_dw2-1.dll" ${PROJECT_BINARY_DIR}/windows_runtime_deps/ + COMMAND ${CMAKE_COMMAND} -E copy "${DEPS_PREFIX}/bin/libGLESV2.dll" ${PROJECT_BINARY_DIR}/windows_runtime_deps/ + COMMAND ${CMAKE_COMMAND} -E copy "${DEPS_PREFIX}/bin/libstdc++-6.dll" ${PROJECT_BINARY_DIR}/windows_runtime_deps/ + COMMAND ${CMAKE_COMMAND} -E copy "${DEPS_PREFIX}/bin/libwinpthread-1.dll" ${PROJECT_BINARY_DIR}/windows_runtime_deps/ + COMMAND ${CMAKE_COMMAND} -E copy "${DEPS_PREFIX}/bin/nvim-qt.exe" ${PROJECT_BINARY_DIR}/windows_runtime_deps/ + COMMAND ${CMAKE_COMMAND} -E copy "${DEPS_PREFIX}/bin/Qt5Core.dll" ${PROJECT_BINARY_DIR}/windows_runtime_deps/ + COMMAND ${CMAKE_COMMAND} -E copy "${DEPS_PREFIX}/bin/Qt5Gui.dll" ${PROJECT_BINARY_DIR}/windows_runtime_deps/ + COMMAND ${CMAKE_COMMAND} -E copy "${DEPS_PREFIX}/bin/Qt5Network.dll" ${PROJECT_BINARY_DIR}/windows_runtime_deps/ + COMMAND ${CMAKE_COMMAND} -E copy "${DEPS_PREFIX}/bin/Qt5Svg.dll" ${PROJECT_BINARY_DIR}/windows_runtime_deps/ + COMMAND ${CMAKE_COMMAND} -E copy "${DEPS_PREFIX}/bin/Qt5Widgets.dll" ${PROJECT_BINARY_DIR}/windows_runtime_deps/ + + COMMAND ${CMAKE_COMMAND} -E copy "${DEPS_PREFIX}/bin/platforms/qwindows.dll" ${PROJECT_BINARY_DIR}/windows_runtime_deps/platforms/ + ) + + add_dependencies(nvim_runtime_deps external_blobs) endif() if(CLANG_ASAN_UBSAN) diff --git a/src/nvim/ex_docmd.c b/src/nvim/ex_docmd.c index 091eeaac60..03f943b1b1 100644 --- a/src/nvim/ex_docmd.c +++ b/src/nvim/ex_docmd.c @@ -3942,8 +3942,6 @@ int expand_filename(exarg_T *eap, char_u **cmdlinep, char_u **errormsgp) * Don't do this for: * - replacement that already has been escaped: "##" * - shell commands (may have to use quotes instead). - * - non-unix systems when there is a single argument (spaces don't - * separate arguments then). */ if (!eap->usefilter && !escaped @@ -3954,9 +3952,7 @@ int expand_filename(exarg_T *eap, char_u **cmdlinep, char_u **errormsgp) && eap->cmdidx != CMD_lgrep && eap->cmdidx != CMD_grepadd && eap->cmdidx != CMD_lgrepadd -#ifndef UNIX && !(eap->argt & NOSPC) -#endif ) { char_u *l; #ifdef BACKSLASH_IN_FILENAME @@ -4018,28 +4014,6 @@ int expand_filename(exarg_T *eap, char_u **cmdlinep, char_u **errormsgp) } } - // Replace any other wildcards, remove backslashes. -#ifdef UNIX - /* - * Only for Unix we check for more than one file name. - * For other systems spaces are considered to be part - * of the file name. - * Only check here if there is no wildcard, otherwise - * ExpandOne() will check for errors. This allows - * ":e `ls ve*.c`" on Unix. - */ - if (!has_wildcards) - for (p = eap->arg; *p; ++p) { - /* skip escaped characters */ - if (p[1] && (*p == '\\' || *p == Ctrl_V)) - ++p; - else if (ascii_iswhite(*p)) { - *errormsgp = (char_u *)_("E172: Only one file name allowed"); - return FAIL; - } - } -#endif - /* * Halve the number of backslashes (this is Vi compatible). * For Unix, when wildcards are expanded, this is diff --git a/src/nvim/message.c b/src/nvim/message.c index 299cec5d40..9d44b15f7c 100644 --- a/src/nvim/message.c +++ b/src/nvim/message.c @@ -385,7 +385,7 @@ static int other_sourcing_name(void) /// Get the message about the source, as used for an error message /// -/// @return [allocated] String with room for one more characters. NULL when no +/// @return [allocated] String with room for one more character. NULL when no /// message is to be given. static char *get_emsg_source(void) FUNC_ATTR_MALLOC FUNC_ATTR_WARN_UNUSED_RESULT @@ -402,7 +402,7 @@ static char *get_emsg_source(void) /// Get the message about the source lnum, as used for an error message. /// -/// @return [allocated] String with room for one more characters. NULL when no +/// @return [allocated] String with room for one more character. NULL when no /// message is to be given. static char *get_emsg_lnum(void) FUNC_ATTR_MALLOC FUNC_ATTR_WARN_UNUSED_RESULT diff --git a/src/nvim/tui/tui.c b/src/nvim/tui/tui.c index ed82e23be2..9fbbe8be92 100644 --- a/src/nvim/tui/tui.c +++ b/src/nvim/tui/tui.c @@ -1014,7 +1014,7 @@ static const char *tui_tk_ti_getstr(const char *name, const char *value, } else if (strcmp(name, "key_dc") == 0) { ILOG("libtermkey:kdch1=%s", value); // Vim: "If <BS> and <DEL> are now the same, redefine <DEL>." - if (stty_erase != NULL && strcmp(stty_erase, value) == 0) { + if (stty_erase != NULL && value != NULL && strcmp(stty_erase, value) == 0) { return stty_erase[0] == DEL ? (char *)CTRL_H_STR : (char *)DEL_STR; } } diff --git a/test/functional/legacy/arglist_spec.lua b/test/functional/legacy/arglist_spec.lua index b86d3f0aea..f5e3522972 100644 --- a/test/functional/legacy/arglist_spec.lua +++ b/test/functional/legacy/arglist_spec.lua @@ -222,7 +222,6 @@ describe('argument list commands', function() execute('argedit a') eq({'a', 'b'}, eval('argv()')) eq('a', eval('expand("%:t")')) - assert_fails('argedit a b', 'E172:') execute('argedit c') eq({'a', 'c', 'b'}, eval('argv()')) execute('0argedit x') @@ -232,6 +231,9 @@ describe('argument list commands', function() execute('argedit! y') eq({'x', 'y', 'a', 'c', 'b'}, eval('argv()')) execute('%argd') + -- Nvim allows unescaped spaces in filename on all platforms. #6010 + execute('argedit a b') + eq({'a b'}, eval('argv()')) end) it('test for :argdelete command', function() diff --git a/test/unit/preprocess.lua b/test/unit/preprocess.lua index 1c9b290462..4d819e5f23 100644 --- a/test/unit/preprocess.lua +++ b/test/unit/preprocess.lua @@ -185,6 +185,30 @@ local function repeated_call(...) return nil end +function Gcc:filter_standard_defines(defines) + if not self.standard_defines then + local pseudoheader_fname = 'tmp_empty_pseudoheader.h' + local pseudoheader_file = io.open(pseudoheader_fname, 'w') + pseudoheader_file:close() + local standard_defines = repeated_call(self.path, + self.preprocessor_extra_flags, + self.get_defines_extra_flags, + {pseudoheader_fname}) + os.remove(pseudoheader_fname) + self.standard_defines = {} + for line in standard_defines:gmatch('[^\n]+') do + self.standard_defines[line] = true + end + end + local ret = {} + for line in defines:gmatch('[^\n]+') do + if not self.standard_defines[line] then + ret[#ret + 1] = line + end + end + return table.concat(ret, "\n") +end + -- returns a stream representing a preprocessed form of the passed-in headers. -- Don't forget to close the stream by calling the close() method on it. function Gcc:preprocess(previous_defines, ...) @@ -201,6 +225,7 @@ function Gcc:preprocess(previous_defines, ...) local defines = repeated_call(self.path, self.preprocessor_extra_flags, self.get_defines_extra_flags, {pseudoheader_fname}) + defines = self:filter_standard_defines(defines) -- lfs = require("lfs") -- print("CWD: #{lfs.currentdir!}") diff --git a/third-party/CMakeLists.txt b/third-party/CMakeLists.txt index f0bc41fef6..1663843663 100644 --- a/third-party/CMakeLists.txt +++ b/third-party/CMakeLists.txt @@ -120,9 +120,19 @@ set(LUV_SHA256 86a199403856018cd8e5529c8527450c83664a3d36f52d5253cbe909ea6c5a06) set(GPERF_URL http://ftp.gnu.org/pub/gnu/gperf/gperf-3.0.4.tar.gz) set(GPERF_SHA256 767112a204407e62dbc3106647cf839ed544f3cf5d0f0523aaa2508623aad63e) +# 7za.exe cat.exe curl.exe ca-bundle.crt diff.exe tee.exe tidy.exe xxd.exe +set(WINTOOLS_URL https://github.com/neovim/deps/raw/5d23093c66d63a8777244ed84de727c26d3f7b79/opt/win32tools.zip) +set(WINTOOLS_SHA256 40c7d1fbed47d8b1cf3b3cada6bfe0e0df06d99beb48775b4db27972d3ceafc1) + +set(WINGUI_URL https://github.com/equalsraf/neovim-qt/releases/download/v0.2.4/neovim-qt.zip) +set(WINGUI_SHA256 95bbc852b69b12d0ef962a8410522010b453ba70f36ea379c548558d16abc2e6) + set(WIN32YANK_URL https://github.com/equalsraf/win32yank/releases/download/v0.0.2/win32yank.zip) set(WIN32YANK_SHA256 78869bf68565607cda1b6a3d549e2487d59d6f0f16f9b003e123c0086f90309d) +set(WINPTY_URL https://github.com/rprichard/winpty/releases/download/0.4.2/winpty-0.4.2-msvc2015.zip) +set(WINPTY_SHA256 b465f2584ff394b3fe27c01aa1dcfc679583c1ee951d0e83de3f859d8b8305b8) + if(USE_BUNDLED_UNIBILIUM) include(BuildUnibilium) endif() @@ -170,8 +180,33 @@ 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 + COMMAND ${CMAKE_COMMAND} -E copy_directory share/nvim-qt/runtime ${DEPS_INSTALL_DIR}/share/nvim/runtime) + + include(TargetArch) + 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/* + -DTO=${DEPS_INSTALL_DIR}/bin/ + -P ${CMAKE_CURRENT_SOURCE_DIR}/cmake/CopyFilesGlob.cmake + COMMAND ${CMAKE_COMMAND} -DFROM_GLOB=${DEPS_BUILD_DIR}/src/winpty/include/* + -DTO=${DEPS_INSTALL_DIR}/include/ + -P ${CMAKE_CURRENT_SOURCE_DIR}/cmake/CopyFilesGlob.cmake + COMMAND ${CMAKE_COMMAND} -DFROM_GLOB=${DEPS_BUILD_DIR}/src/winpty/${TARGET_ARCH}/lib/* + -DTO=${DEPS_INSTALL_DIR}/lib/ + -P ${CMAKE_CURRENT_SOURCE_DIR}/cmake/CopyFilesGlob.cmake) endif() add_custom_target(clean-shared-libraries diff --git a/third-party/cmake/BuildLibuv.cmake b/third-party/cmake/BuildLibuv.cmake index 5482f28557..06b527e5a2 100644 --- a/third-party/cmake/BuildLibuv.cmake +++ b/third-party/cmake/BuildLibuv.cmake @@ -75,16 +75,16 @@ elseif(WIN32 AND MSVC) message(FATAL_ERROR "Python2 is required to build libuv on windows, use -DPYTHON_EXECUTABLE to set a python interpreter") endif() - string(FIND ${CMAKE_GENERATOR} Win64 VS_WIN64) - if(VS_WIN64 EQUAL -1) - set(VS_ARCH x86) - else() - set(VS_ARCH x64) + 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} ${VS_ARCH} + 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 diff --git a/third-party/cmake/GetBinaryDeps.cmake b/third-party/cmake/GetBinaryDeps.cmake index cdc8ac051e..1d98177924 100644 --- a/third-party/cmake/GetBinaryDeps.cmake +++ b/third-party/cmake/GetBinaryDeps.cmake @@ -21,7 +21,7 @@ function(GetBinaryDep) set(URL ${${URL_VARNAME}}) set(HASH ${${HASH_VARNAME}}) if(NOT URL OR NOT HASH ) - message(FATAL_ERROR "${URL_VARNAME} and ${HASH_VARNAME} must be set") + message(FATAL_ERROR "${URL_VARNAME} and ${HASH_VARNAME} must be set") endif() ExternalProject_Add(${_gettool_TARGET} @@ -41,6 +41,6 @@ function(GetBinaryDep) CONFIGURE_COMMAND "" BUILD_COMMAND "" INSTALL_COMMAND ${CMAKE_COMMAND} -E make_directory ${DEPS_INSTALL_DIR}/bin - COMMAND "${_gettool_INSTALL_COMMAND}") + COMMAND "${_gettool_INSTALL_COMMAND}") list(APPEND THIRD_PARTY_DEPS ${__gettool_TARGET}) endfunction() diff --git a/third-party/cmake/TargetArch.cmake b/third-party/cmake/TargetArch.cmake new file mode 100644 index 0000000000..71ea44ec59 --- /dev/null +++ b/third-party/cmake/TargetArch.cmake @@ -0,0 +1,23 @@ +# Sets TARGET_ARCH to a normalized name (X86 or X86_64). +# See https://github.com/axr/solar-cmake/blob/master/TargetArch.cmake +include(CheckSymbolExists) + +# X86 +check_symbol_exists("_M_IX86" "" T_M_IX86) +check_symbol_exists("__i386__" "" T_I386) +if(T_M_IX86 OR T_I386) +set(TARGET_ARCH "X86") + return() +endif() + +# X86_64 +check_symbol_exists("_M_AMD64" "" T_M_AMD64) +check_symbol_exists("__x86_64__" "" T_X86_64) +check_symbol_exists("__amd64__" "" T_AMD64) + +if(T_M_AMD64 OR T_X86_64 OR T_AMD64) +set(TARGET_ARCH "X86_64") + return() +endif() + +message(FATAL_ERROR "Unknown target architecture") |