aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cmake/FindLibTermkey.cmake2
-rw-r--r--cmake/FindLibTickit.cmake48
-rw-r--r--cmake/FindLibUnibilium.cmake2
-rw-r--r--runtime/doc/manpages/de/vim-de.11
-rw-r--r--src/nvim/fileio.c10
-rw-r--r--src/nvim/hardcopy.c16
-rw-r--r--src/nvim/msgpack_rpc/channel.c66
-rw-r--r--src/nvim/msgpack_rpc/helpers.c6
-rw-r--r--src/nvim/os/event.c3
-rw-r--r--src/nvim/regexp_nfa.c17
-rw-r--r--src/nvim/spell.c2
-rw-r--r--test/functional/helpers.lua5
-rw-r--r--test/unit/os/fs_spec.lua2
-rw-r--r--test/unit/preprocess.lua5
-rw-r--r--third-party/CMakeLists.txt59
-rw-r--r--third-party/cmake/DownloadAndExtractFile.cmake42
16 files changed, 130 insertions, 156 deletions
diff --git a/cmake/FindLibTermkey.cmake b/cmake/FindLibTermkey.cmake
index 533f168fe9..e5ec132f85 100644
--- a/cmake/FindLibTermkey.cmake
+++ b/cmake/FindLibTermkey.cmake
@@ -8,7 +8,7 @@ find_package(PkgConfig)
if(NOT LIBTERMKEY_USE_BUNDLED)
find_package(PkgConfig)
if (PKG_CONFIG_FOUND)
- pkg_check_modules(PC_LIBTERMKEY QUIET libtermkey)
+ pkg_check_modules(PC_LIBTERMKEY QUIET termkey)
endif()
else()
set(PC_LIBTERMKEY_INCLUDEDIR)
diff --git a/cmake/FindLibTickit.cmake b/cmake/FindLibTickit.cmake
deleted file mode 100644
index c20bf4f74f..0000000000
--- a/cmake/FindLibTickit.cmake
+++ /dev/null
@@ -1,48 +0,0 @@
-# - Try to find libtickit
-# Once done this will define
-# LIBTICKIT_FOUND - System has libtickit
-# LIBTICKIT_INCLUDE_DIRS - The libtickit include directories
-# LIBTICKIT_LIBRARIES - The libraries needed to use libtickit
-
-find_package(PkgConfig)
-if(NOT LIBTICKIT_USE_BUNDLED)
- find_package(PkgConfig)
- if (PKG_CONFIG_FOUND)
- pkg_check_modules(PC_LIBTICKIT QUIET libtickit)
- endif()
-else()
- set(PC_LIBTICKIT_INCLUDEDIR)
- set(PC_LIBTICKIT_INCLUDE_DIRS)
- set(PC_LIBTICKIT_LIBDIR)
- set(PC_LIBTICKIT_LIBRARY_DIRS)
- set(LIMIT_SEARCH NO_DEFAULT_PATH)
-endif()
-
-set(LIBTICKIT_DEFINITIONS ${PC_LIBTICKIT_CFLAGS_OTHER})
-
-find_path(LIBTICKIT_INCLUDE_DIR tickit.h
- PATHS ${PC_LIBTICKIT_INCLUDEDIR} ${PC_LIBTICKIT_INCLUDE_DIRS}
- ${LIMIT_SEARCH})
-
-# If we're asked to use static linkage, add libuv.a as a preferred library name.
-if(LIBTICKIT_USE_STATIC)
- list(APPEND LIBTICKIT_NAMES
- "${CMAKE_STATIC_LIBRARY_PREFIX}tickit${CMAKE_STATIC_LIBRARY_SUFFIX}")
-endif()
-
-list(APPEND LIBTICKIT_NAMES tickit)
-
-find_library(LIBTICKIT_LIBRARY NAMES ${LIBTICKIT_NAMES}
- HINTS ${PC_LIBTICKIT_LIBDIR} ${PC_LIBTICKIT_LIBRARY_DIRS}
- ${LIMIT_SEARCH})
-
-set(LIBTICKIT_LIBRARIES ${LIBTICKIT_LIBRARY})
-set(LIBTICKIT_INCLUDE_DIRS ${LIBTICKIT_INCLUDE_DIR})
-
-include(FindPackageHandleStandardArgs)
-# handle the QUIETLY and REQUIRED arguments and set LIBTICKIT_FOUND to TRUE
-# if all listed variables are TRUE
-find_package_handle_standard_args(LibTickit DEFAULT_MSG
- LIBTICKIT_LIBRARY LIBTICKIT_INCLUDE_DIR)
-
-mark_as_advanced(LIBTICKIT_INCLUDE_DIR LIBTICKIT_LIBRARY)
diff --git a/cmake/FindLibUnibilium.cmake b/cmake/FindLibUnibilium.cmake
index aace9a40d5..6aafd07c90 100644
--- a/cmake/FindLibUnibilium.cmake
+++ b/cmake/FindLibUnibilium.cmake
@@ -8,7 +8,7 @@ find_package(PkgConfig)
if(NOT LIBUNIBILIUM_USE_BUNDLED)
find_package(PkgConfig)
if (PKG_CONFIG_FOUND)
- pkg_check_modules(PC_LIBUNIBILIUM QUIET libunibilium)
+ pkg_check_modules(PC_LIBUNIBILIUM QUIET unibilium)
endif()
else()
set(PC_LIBUNIBILIUM_INCLUDEDIR)
diff --git a/runtime/doc/manpages/de/vim-de.1 b/runtime/doc/manpages/de/vim-de.1
index 52a97a0856..d958372012 100644
--- a/runtime/doc/manpages/de/vim-de.1
+++ b/runtime/doc/manpages/de/vim-de.1
@@ -156,6 +156,7 @@ sehr ähnlich zu Vi, selbst wenn eine VimRC\-Datei existiert.
\-d
Startet im diff\-Modus. Es sollten zwei, drei oder vier Dateinamen als
Parameter übergeben werden. \fBVim\fP öffnet sie alle und zeigt die
+Unterschiede an.
.TP
\-d {Gerät}
Öffnet das {Gerät}, um es als Terminal zu nutzen. Nur für AmigaOS. Beispiel:
diff --git a/src/nvim/fileio.c b/src/nvim/fileio.c
index 2667d13b78..a4728b245b 100644
--- a/src/nvim/fileio.c
+++ b/src/nvim/fileio.c
@@ -10,6 +10,7 @@
* fileio.c: read from and write to a file
*/
+#include <assert.h>
#include <errno.h>
#include <stdbool.h>
#include <string.h>
@@ -5811,10 +5812,13 @@ void do_autocmd(char_u *arg, int forceit)
nested, cmd, forceit, group) == FAIL)
break;
} else {
- while (*arg && !vim_iswhite(*arg))
- if (do_autocmd_event(event_name2nr(arg, &arg), pat,
- nested, cmd, forceit, group) == FAIL)
+ while (*arg && !vim_iswhite(*arg)) {
+ event_T event = event_name2nr(arg, &arg);
+ assert(event < NUM_EVENTS);
+ if (do_autocmd_event(event, pat, nested, cmd, forceit, group) == FAIL) {
break;
+ }
+ }
}
if (need_free)
diff --git a/src/nvim/hardcopy.c b/src/nvim/hardcopy.c
index fb04f4407c..c01f763d20 100644
--- a/src/nvim/hardcopy.c
+++ b/src/nvim/hardcopy.c
@@ -2122,19 +2122,25 @@ int mch_print_init(prt_settings_T *psettings, char_u *jobname, int forceit)
props = enc_canon_props(p_encoding);
if (!(props & ENC_8BIT) && ((*p_pmcs != NUL) || !(props & ENC_UNICODE))) {
p_mbenc_first = NULL;
+ int effective_cmap;
for (cmap = 0; cmap < (int)ARRAY_SIZE(prt_ps_mbfonts); cmap++)
if (prt_match_encoding((char *)p_encoding, &prt_ps_mbfonts[cmap],
- &p_mbenc)) {
- if (p_mbenc_first == NULL)
+ &p_mbenc)) {
+ if (p_mbenc_first == NULL) {
p_mbenc_first = p_mbenc;
- if (prt_match_charset((char *)p_pmcs, &prt_ps_mbfonts[cmap],
- &p_mbchar))
+ effective_cmap = cmap;
+ }
+ if (prt_match_charset((char *)p_pmcs, &prt_ps_mbfonts[cmap], &p_mbchar))
break;
}
/* Use first encoding matched if no charset matched */
- if (p_mbchar == NULL && p_mbenc_first != NULL)
+ if (p_mbchar == NULL && p_mbenc_first != NULL) {
p_mbenc = p_mbenc_first;
+ cmap = effective_cmap;
+ }
+
+ assert(p_mbenc == NULL || cmap < (int)ARRAY_SIZE(prt_ps_mbfonts));
}
prt_out_mbyte = (p_mbenc != NULL);
diff --git a/src/nvim/msgpack_rpc/channel.c b/src/nvim/msgpack_rpc/channel.c
index 920274f850..7ae45ee84a 100644
--- a/src/nvim/msgpack_rpc/channel.c
+++ b/src/nvim/msgpack_rpc/channel.c
@@ -45,6 +45,7 @@ typedef struct {
typedef struct {
uint64_t id;
+ size_t refcount;
size_t pending_requests;
PMap(cstr_t) *subscribed_events;
bool is_job, closed;
@@ -125,11 +126,13 @@ void channel_teardown(void)
/// stdin/stdout. stderr is forwarded to the editor error stream.
///
/// @param argv The argument vector for the process. [consumed]
-/// @return The channel id
+/// @return The channel id (> 0), on success.
+/// 0, on error.
uint64_t channel_from_job(char **argv)
{
Channel *channel = register_channel();
channel->is_job = true;
+ incref(channel); // job channels are only closed by the exit_cb
int status;
channel->data.job = job_start(argv,
@@ -142,6 +145,10 @@ uint64_t channel_from_job(char **argv)
&status);
if (status <= 0) {
+ if (status == 0) { // Two decrefs needed if status == 0.
+ decref(channel); // Only one needed if status < 0,
+ } // because exit_cb will do the second one.
+ decref(channel);
return 0;
}
@@ -233,6 +240,7 @@ Object channel_send_call(uint64_t id,
return NIL;
}
+ incref(channel);
uint64_t request_id = channel->next_request_id++;
// Send the msgpack-rpc request
send_request(channel, request_id, method_name, args);
@@ -248,18 +256,15 @@ Object channel_send_call(uint64_t id,
if (frame.errored) {
api_set_error(err, Exception, "%s", frame.result.data.string.data);
api_free_object(frame.result);
- return NIL;
- }
-
- if (!kv_size(channel->call_stack) && channel->closed) {
- free_channel(channel);
}
if (!channel->pending_requests) {
send_delayed_notifications();
}
- return frame.result;
+ decref(channel);
+
+ return frame.errored ? NIL : frame.result;
}
/// Subscribes to event broadcasts
@@ -320,6 +325,7 @@ bool channel_close(uint64_t id)
static void channel_from_stdio(void)
{
Channel *channel = register_channel();
+ incref(channel); // stdio channels are only closed on exit
channel->is_job = false;
// read stream
channel->data.streams.read = rstream_new(parse_msgpack,
@@ -354,23 +360,18 @@ static void job_err(RStream *rstream, void *data, bool eof)
static void job_exit(Job *job, void *data)
{
- Channel *channel = data;
- // ensure the channel is flagged as closed so channel_send_call frees it
- // later
- channel->closed = true;
- if (!kv_size(channel->call_stack)) {
- free_channel(channel);
- }
+ decref(data);
}
static void parse_msgpack(RStream *rstream, void *data, bool eof)
{
Channel *channel = data;
+ incref(channel);
if (eof) {
close_channel(channel);
call_set_error(channel, "Channel was closed by the client");
- return;
+ goto end;
}
size_t count = rstream_pending(rstream);
@@ -408,7 +409,7 @@ static void parse_msgpack(RStream *rstream, void *data, bool eof)
}
msgpack_unpacked_destroy(&unpacked);
// Bail out from this event loop iteration
- return;
+ goto end;
}
handle_request(channel, &unpacked.data);
@@ -417,6 +418,7 @@ static void parse_msgpack(RStream *rstream, void *data, bool eof)
if (result == MSGPACK_UNPACK_NOMEM_ERROR) {
OUT_STR(e_outofmem);
out_char('\n');
+ decref(channel);
preserve_exit();
}
@@ -431,6 +433,9 @@ static void parse_msgpack(RStream *rstream, void *data, bool eof)
"This error can also happen when deserializing "
"an object with high level of nesting");
}
+
+end:
+ decref(channel);
}
static void handle_request(Channel *channel, msgpack_object *request)
@@ -450,7 +455,7 @@ static void handle_request(Channel *channel, msgpack_object *request)
&out_buffer))) {
char buf[256];
snprintf(buf, sizeof(buf),
- "Channel %" PRIu64 " sent an invalid message, closing.",
+ "Channel %" PRIu64 " sent an invalid message, closed.",
channel->id);
call_set_error(channel, buf);
}
@@ -477,6 +482,7 @@ static void handle_request(Channel *channel, msgpack_object *request)
event_data->handler = handler;
event_data->args = args;
event_data->request_id = request_id;
+ incref(channel);
event_push((Event) {
.handler = on_request_event,
.data = event_data
@@ -502,6 +508,7 @@ static void on_request_event(Event event)
&out_buffer));
// All arguments were freed already, but we still need to free the array
free(args.items);
+ decref(channel);
kmp_free(RequestEventPool, request_event_pool, e);
}
@@ -628,6 +635,7 @@ static void close_channel(Channel *channel)
}
channel->closed = true;
+
if (channel->is_job) {
if (channel->data.job) {
job_stop(channel->data.job);
@@ -638,16 +646,21 @@ static void close_channel(Channel *channel)
uv_handle_t *handle = (uv_handle_t *)channel->data.streams.uv;
if (handle) {
uv_close(handle, close_cb);
- free_channel(channel);
} else {
- event_push((Event) { .handler = on_stdio_close }, false);
+ event_push((Event) { .handler = on_stdio_close, .data = channel }, false);
}
}
+
+ decref(channel);
}
static void on_stdio_close(Event e)
{
- mch_exit(0);
+ decref(e.data);
+
+ if (!exiting) {
+ mch_exit(0);
+ }
}
static void free_channel(Channel *channel)
@@ -679,6 +692,7 @@ static void close_cb(uv_handle_t *handle)
static Channel *register_channel(void)
{
Channel *rv = xmalloc(sizeof(Channel));
+ rv->refcount = 1;
rv->closed = false;
rv->unpacker = msgpack_unpacker_new(MSGPACK_UNPACKER_INIT_BUFFER_SIZE);
rv->id = next_id++;
@@ -787,6 +801,18 @@ static void send_delayed_notifications(void)
}
}
+static void incref(Channel *channel)
+{
+ channel->refcount++;
+}
+
+static void decref(Channel *channel)
+{
+ if (!(--channel->refcount)) {
+ free_channel(channel);
+ }
+}
+
#if MIN_LOG_LEVEL <= DEBUG_LOG_LEVEL
#define REQ "[request] "
#define RES "[response] "
diff --git a/src/nvim/msgpack_rpc/helpers.c b/src/nvim/msgpack_rpc/helpers.c
index a702d4f256..54e8b83cd0 100644
--- a/src/nvim/msgpack_rpc/helpers.c
+++ b/src/nvim/msgpack_rpc/helpers.c
@@ -86,8 +86,8 @@ bool msgpack_rpc_to_integer(msgpack_object *obj, Integer *arg)
bool msgpack_rpc_to_float(msgpack_object *obj, Float *arg)
FUNC_ATTR_NONNULL_ALL
{
- *arg = obj->via.dec;
- return obj->type == MSGPACK_OBJECT_DOUBLE;
+ *arg = obj->via.f64;
+ return obj->type == MSGPACK_OBJECT_FLOAT;
}
bool msgpack_rpc_to_string(msgpack_object *obj, String *arg)
@@ -120,7 +120,7 @@ bool msgpack_rpc_to_object(msgpack_object *obj, Object *arg)
arg->type = kObjectTypeInteger;
return msgpack_rpc_to_integer(obj, &arg->data.integer);
- case MSGPACK_OBJECT_DOUBLE:
+ case MSGPACK_OBJECT_FLOAT:
arg->type = kObjectTypeFloat;
return msgpack_rpc_to_float(obj, &arg->data.floating);
diff --git a/src/nvim/os/event.c b/src/nvim/os/event.c
index 34560610bd..45ea8f28b5 100644
--- a/src/nvim/os/event.c
+++ b/src/nvim/os/event.c
@@ -73,6 +73,9 @@ void event_teardown(void)
return;
}
+ process_events_from(immediate_events);
+ process_events_from(deferred_events);
+
channel_teardown();
job_teardown();
server_teardown();
diff --git a/src/nvim/regexp_nfa.c b/src/nvim/regexp_nfa.c
index b082903282..99e9c3afec 100644
--- a/src/nvim/regexp_nfa.c
+++ b/src/nvim/regexp_nfa.c
@@ -2887,6 +2887,7 @@ static nfa_state_T *post2nfa(int *postfix, int *end, int nfa_calc_size)
if (stackp < stack) \
{ \
st_error(postfix, end, p); \
+ free(stack); \
return NULL; \
}
@@ -3316,13 +3317,17 @@ static nfa_state_T *post2nfa(int *postfix, int *end, int nfa_calc_size)
}
e = POP();
- if (stackp != stack)
- EMSG_RET_NULL(_(
- "E875: (NFA regexp) (While converting from postfix to NFA), too many states left on stack"));
+ if (stackp != stack) {
+ free(stack);
+ EMSG_RET_NULL(_("E875: (NFA regexp) (While converting from postfix to NFA),"
+ "too many states left on stack"));
+ }
- if (istate >= nstate)
- EMSG_RET_NULL(_(
- "E876: (NFA regexp) Not enough space to store the whole NFA "));
+ if (istate >= nstate) {
+ free(stack);
+ EMSG_RET_NULL(_("E876: (NFA regexp) "
+ "Not enough space to store the whole NFA "));
+ }
matchstate = &state_ptr[istate++]; /* the match state */
matchstate->c = NFA_MATCH;
diff --git a/src/nvim/spell.c b/src/nvim/spell.c
index 1d13a6abad..cbaa44d7eb 100644
--- a/src/nvim/spell.c
+++ b/src/nvim/spell.c
@@ -335,7 +335,7 @@
# include <time.h> // for time_t
#endif
-#define MAXWLEN 250 // Assume max. word len is this many bytes.
+#define MAXWLEN 254 // Assume max. word len is this many bytes.
// Some places assume a word length fits in a
// byte, thus it can't be above 255.
diff --git a/test/functional/helpers.lua b/test/functional/helpers.lua
index e63c79ec80..ea98ff4ce3 100644
--- a/test/functional/helpers.lua
+++ b/test/functional/helpers.lua
@@ -1,8 +1,3 @@
-if jit then
- -- Disable JIT because of random errors on Travis with OS X.
- jit.off(true, true)
-end
-
require('coxpcall')
local Loop = require('nvim.loop')
local MsgpackStream = require('nvim.msgpack_stream')
diff --git a/test/unit/os/fs_spec.lua b/test/unit/os/fs_spec.lua
index 1c7d3650a5..9e5a2349c8 100644
--- a/test/unit/os/fs_spec.lua
+++ b/test/unit/os/fs_spec.lua
@@ -270,7 +270,7 @@ describe('fs function', function()
it('owner of a file may change the group of the file to any group of which that owner is a member', function()
-- Some systems may not have `id` utility.
- if (os.execute('id -G &> /dev/null') == 0) then
+ if (os.execute('id -G > /dev/null 2>&1') == 0) then
local file_gid = lfs.attributes(filename, 'gid')
-- Gets ID of any group of which current user is a member except the
diff --git a/test/unit/preprocess.lua b/test/unit/preprocess.lua
index f17c7ba666..d4c2e088a4 100644
--- a/test/unit/preprocess.lua
+++ b/test/unit/preprocess.lua
@@ -102,7 +102,10 @@ local Gcc = {
'-D "EXTERN=extern"',
'-D "INIT(...)="',
'-D_GNU_SOURCE',
- '-DINCLUDE_GENERATED_DECLARATIONS'
+ '-DINCLUDE_GENERATED_DECLARATIONS',
+
+ -- Needed for FreeBSD
+ '-D "_Thread_local="'
}
}
diff --git a/third-party/CMakeLists.txt b/third-party/CMakeLists.txt
index 99fc337d4f..1d56ba1adb 100644
--- a/third-party/CMakeLists.txt
+++ b/third-party/CMakeLists.txt
@@ -12,7 +12,6 @@ option(USE_BUNDLED "Use bundled dependencies." ON)
option(USE_BUNDLED_LIBUNIBILIUM "Use the bundled libunibilium." ${USE_BUNDLED})
option(USE_BUNDLED_LIBTERMKEY "Use the bundled libtermkey." ${USE_BUNDLED})
-option(USE_BUNDLED_LIBTICKIT "Use the bundled libtickit." ${USE_BUNDLED})
option(USE_BUNDLED_LIBUV "Use the bundled libuv." ${USE_BUNDLED})
option(USE_BUNDLED_MSGPACK "Use the bundled msgpack." ${USE_BUNDLED})
option(USE_BUNDLED_LUAJIT "Use the bundled version of luajit." ${USE_BUNDLED})
@@ -51,31 +50,21 @@ include(ExternalProject)
set(LIBUV_URL https://github.com/libuv/libuv/archive/v1.2.0.tar.gz)
set(LIBUV_SHA1 38d1ba349fcfc1b221140523ba3d7cf3ea38c20b)
-set(LIBUV_MD5 e7712a100635ec2ca1f145f2bb217200)
-set(MSGPACK_URL https://github.com/msgpack/msgpack-c/archive/ecf4b09acd29746829b6a02939db91dfdec635b4.tar.gz)
-set(MSGPACK_SHA1 c160ff99f20d9d0a25bea0a57f4452f1c9bde370)
-set(MSGPACK_MD5 3599eaf904b8ba0c36cea7ed80973364)
+set(MSGPACK_URL https://github.com/msgpack/msgpack-c/archive/b4eba4ba090e8cd6d8332410e252296a62b7e56d.tar.gz)
+set(MSGPACK_SHA1 768e60e3936cd0d0e4f1d58ca86a78eeb895931b)
set(LUAJIT_URL http://luajit.org/download/LuaJIT-2.0.3.tar.gz)
set(LUAJIT_SHA1 2db39e7d1264918c2266b0436c313fbd12da4ceb)
-set(LUAJIT_MD5 f14e9104be513913810cd59c8c658dc0)
set(LUAROCKS_URL https://github.com/keplerproject/luarocks/archive/0587afbb5fe8ceb2f2eea16f486bd6183bf02f29.tar.gz)
set(LUAROCKS_SHA1 61a894fd5d61987bf7e7f9c3e0c5de16ba4b68c4)
-set(LUAROCKS_MD5 0f53f42909fbcd2c88be303e8f970516)
set(LIBUNIBILIUM_URL https://github.com/mauke/unibilium/archive/520abbc8b26910e2580619f669b5cc2c4ef7f864.tar.gz)
set(LIBUNIBILIUM_SHA1 c546e5e8861380f5c109a256f25c93419e4076bf)
-set(LIBUNIBILIUM_MD5 d80d1fc45b22b1e92bebd5bf76e8a98b)
-set(LIBTERMKEY_URL https://github.com/neovim/libtermkey/archive/7b3bdafdf589d08478f2493273d4d75636ecc183.tar.gz)
-set(LIBTERMKEY_SHA1 28bfe54dfd9269910a132b51dee7725a2121578d)
-set(LIBTERMKEY_MD5 f0bac9c2467cc80c821be937ea5c13bc)
-
-set(LIBTICKIT_URL https://github.com/neovim/libtickit/archive/33f4afb3891df05955429acbf5b406dfe87ec22b.tar.gz)
-set(LIBTICKIT_SHA1 3aab459b9fb3cd83e85ac2e08f05e5f162c8c9d2)
-set(LIBTICKIT_MD5 19ee9271c16716620d0906db74158ec6)
+set(LIBTERMKEY_URL https://github.com/neovim/libtermkey/archive/8c0cb7108cc63218ea19aa898968eede19e19603.tar.gz)
+set(LIBTERMKEY_SHA1 54e8b6914dab10d4467d2a563f80053a99849fcb)
if(USE_BUNDLED_LIBUNIBILIUM)
ExternalProject_Add(libunibilium
@@ -87,7 +76,6 @@ if(USE_BUNDLED_LIBUNIBILIUM)
-DDOWNLOAD_DIR=${DEPS_DOWNLOAD_DIR}/libunibilium
-DURL=${LIBUNIBILIUM_URL}
-DEXPECTED_SHA1=${LIBUNIBILIUM_SHA1}
- -DEXPECTED_MD5=${LIBUNIBILIUM_MD5}
-DTARGET=libunibilium
-P ${CMAKE_CURRENT_SOURCE_DIR}/cmake/DownloadAndExtractFile.cmake
CONFIGURE_COMMAND ""
@@ -109,7 +97,6 @@ if(USE_BUNDLED_LIBTERMKEY)
-DDOWNLOAD_DIR=${DEPS_DOWNLOAD_DIR}/libtermkey
-DURL=${LIBTERMKEY_URL}
-DEXPECTED_SHA1=${LIBTERMKEY_SHA1}
- -DEXPECTED_MD5=${LIBTERMKEY_MD5}
-DTARGET=libtermkey
-P ${CMAKE_CURRENT_SOURCE_DIR}/cmake/DownloadAndExtractFile.cmake
CONFIGURE_COMMAND ""
@@ -124,31 +111,6 @@ if(USE_BUNDLED_LIBTERMKEY)
add_dependencies(libtermkey libunibilium)
endif()
-if(USE_BUNDLED_LIBTICKIT)
- ExternalProject_Add(libtickit
- PREFIX ${DEPS_BUILD_DIR}
- URL ${LIBTICKIT_URL}
- DOWNLOAD_DIR ${DEPS_DOWNLOAD_DIR}/libtickit
- DOWNLOAD_COMMAND ${CMAKE_COMMAND}
- -DPREFIX=${DEPS_BUILD_DIR}
- -DDOWNLOAD_DIR=${DEPS_DOWNLOAD_DIR}/libtickit
- -DURL=${LIBTICKIT_URL}
- -DEXPECTED_SHA1=${LIBTICKIT_SHA1}
- -DEXPECTED_MD5=${LIBTICKIT_MD5}
- -DTARGET=libtickit
- -P ${CMAKE_CURRENT_SOURCE_DIR}/cmake/DownloadAndExtractFile.cmake
- CONFIGURE_COMMAND ""
- BUILD_IN_SOURCE 1
- BUILD_COMMAND ""
- INSTALL_COMMAND ${MAKE_PRG} CC=${DEPS_C_COMPILER}
- PREFIX=${DEPS_INSTALL_DIR}
- PKG_CONFIG_PATH=${DEPS_LIB_DIR}/pkgconfig
- CFLAGS=-fPIC
- install)
- list(APPEND THIRD_PARTY_DEPS libtickit)
- add_dependencies(libtickit libtermkey)
-endif()
-
if(USE_BUNDLED_LIBUV)
ExternalProject_Add(libuv
PREFIX ${DEPS_BUILD_DIR}
@@ -159,12 +121,12 @@ if(USE_BUNDLED_LIBUV)
-DDOWNLOAD_DIR=${DEPS_DOWNLOAD_DIR}/libuv
-DURL=${LIBUV_URL}
-DEXPECTED_SHA1=${LIBUV_SHA1}
- -DEXPECTED_MD5=${LIBUV_MD5}
-DTARGET=libuv
-P ${CMAKE_CURRENT_SOURCE_DIR}/cmake/DownloadAndExtractFile.cmake
CONFIGURE_COMMAND sh ${DEPS_BUILD_DIR}/src/libuv/autogen.sh &&
${DEPS_BUILD_DIR}/src/libuv/configure --with-pic --disable-shared
- --prefix=${DEPS_INSTALL_DIR} CC=${DEPS_C_COMPILER}
+ --prefix=${DEPS_INSTALL_DIR} --libdir=${DEPS_INSTALL_DIR}/lib
+ CC=${DEPS_C_COMPILER}
INSTALL_COMMAND ${MAKE_PRG} install)
list(APPEND THIRD_PARTY_DEPS libuv)
endif()
@@ -179,7 +141,6 @@ if(USE_BUNDLED_MSGPACK)
-DDOWNLOAD_DIR=${DEPS_DOWNLOAD_DIR}/msgpack
-DURL=${MSGPACK_URL}
-DEXPECTED_SHA1=${MSGPACK_SHA1}
- -DEXPECTED_MD5=${MSGPACK_MD5}
-DTARGET=msgpack
-P ${CMAKE_CURRENT_SOURCE_DIR}/cmake/DownloadAndExtractFile.cmake
CONFIGURE_COMMAND cmake ${DEPS_BUILD_DIR}/src/msgpack
@@ -205,7 +166,6 @@ if(USE_BUNDLED_LUAJIT)
-DDOWNLOAD_DIR=${DEPS_DOWNLOAD_DIR}/luajit
-DURL=${LUAJIT_URL}
-DEXPECTED_SHA1=${LUAJIT_SHA1}
- -DEXPECTED_MD5=${LUAJIT_MD5}
-DTARGET=luajit
-P ${CMAKE_CURRENT_SOURCE_DIR}/cmake/DownloadAndExtractFile.cmake
CONFIGURE_COMMAND ""
@@ -214,6 +174,10 @@ if(USE_BUNDLED_LUAJIT)
INSTALL_COMMAND ${MAKE_PRG} CC=${DEPS_C_COMPILER}
PREFIX=${DEPS_INSTALL_DIR}
CFLAGS=-fPIC
+ CFLAGS+=-DLUAJIT_DISABLE_JIT
+ CFLAGS+=-DLUA_USE_APICHECK
+ CFLAGS+=-DLUA_USE_ASSERT
+ CCDEBUG+=-g
BUILDMODE=static
install)
list(APPEND THIRD_PARTY_DEPS luajit)
@@ -234,7 +198,6 @@ if(USE_BUNDLED_LUAROCKS)
-DDOWNLOAD_DIR=${DEPS_DOWNLOAD_DIR}/luarocks
-DURL=${LUAROCKS_URL}
-DEXPECTED_SHA1=${LUAROCKS_SHA1}
- -DEXPECTED_MD5=${LUAROCKS_MD5}
-DTARGET=luarocks
-P ${CMAKE_CURRENT_SOURCE_DIR}/cmake/DownloadAndExtractFile.cmake
BUILD_IN_SOURCE 1
@@ -276,7 +239,7 @@ if(USE_BUNDLED_LUAROCKS)
add_custom_command(OUTPUT ${DEPS_LIB_DIR}/luarocks/rocks/nvim-client
COMMAND ${DEPS_BIN_DIR}/luarocks
- ARGS build https://raw.githubusercontent.com/neovim/lua-client/af161f5f89c7877d0f650b5de6b3a6126b38f012/nvim-client-0.0.1-10.rockspec CC=${DEPS_C_COMPILER} LD=${DEPS_C_COMPILER} LIBUV_DIR=${DEPS_INSTALL_DIR}
+ ARGS build https://raw.githubusercontent.com/neovim/lua-client/fabecc56a7c7a3fc15fe6a1a765b58d61bc8e922/nvim-client-0.0.1-11.rockspec CC=${DEPS_C_COMPILER} LD=${DEPS_C_COMPILER} LIBUV_DIR=${DEPS_INSTALL_DIR}
DEPENDS lpeg libuv)
add_custom_target(nvim-client
DEPENDS ${DEPS_LIB_DIR}/luarocks/rocks/nvim-client)
diff --git a/third-party/cmake/DownloadAndExtractFile.cmake b/third-party/cmake/DownloadAndExtractFile.cmake
index b0d28355cb..875d45795d 100644
--- a/third-party/cmake/DownloadAndExtractFile.cmake
+++ b/third-party/cmake/DownloadAndExtractFile.cmake
@@ -10,8 +10,8 @@ if(NOT DEFINED DOWNLOAD_DIR)
message(FATAL_ERROR "DOWNLOAD_DIR must be defined.")
endif()
-if((NOT DEFINED EXPECTED_SHA1) OR (NOT DEFINED EXPECTED_MD5))
- message(FATAL_ERROR "EXPECTED_SHA1 or EXPECTED_MD5 must be defined.")
+if(NOT DEFINED EXPECTED_SHA1)
+ message(FATAL_ERROR "EXPECTED_SHA1 must be defined.")
endif()
if(NOT DEFINED TARGET)
@@ -58,16 +58,6 @@ message(STATUS "downloading...
dst='${file}'
timeout='${timeout_msg}'")
-if((DEFINED EXPECTED_SHA1) AND (${CMAKE_VERSION} VERSION_GREATER 2.8.10))
- if(NOT (EXPECTED_SHA1 STREQUAL "0000000000000000000000000000000000000000"))
- set(hash_args EXPECTED_HASH SHA1=${EXPECTED_SHA1})
- endif()
-else()
- if(NOT (EXPECTED_MD5 STREQUAL "00000000000000000000000000000000"))
- set(hash_args EXPECTED_MD5 ${EXPECTED_MD5})
- endif()
-endif()
-
file(DOWNLOAD ${URL} ${file}
${timeout_args}
${hash_args}
@@ -85,6 +75,33 @@ if(NOT status_code EQUAL 0)
")
endif()
+set(NULL_SHA1 "0000000000000000000000000000000000000000")
+
+# Allow users to use "SKIP" or "skip" as the sha1 to skip checking the hash.
+# You can still use the all zeros hash too.
+if((EXPECTED_SHA1 STREQUAL "SKIP") OR (EXPECTED_SHA1 STREQUAL "skip"))
+ set(EXPECTED_SHA1 ${NULL_SHA1})
+endif()
+
+# We could avoid computing the SHA1 entirely if a NULL_SHA1 was given,
+# but we want to warn users of an empty file.
+file(SHA1 ${file} ACTUAL_SHA1)
+if(ACTUAL_SHA1 STREQUAL "da39a3ee5e6b4b0d3255bfef95601890afd80709")
+ # File was empty. It's likely due to lack of SSL support.
+ message(FATAL_ERROR
+ "Failed to download ${URL}. The file is empty and likely means CMake "
+ "was built without SSL support. Please use a version of CMake with "
+ "proper SSL support. See "
+ "https://github.com/neovim/neovim/wiki/Building-Neovim#build-prerequisites "
+ "for more information.")
+elseif((NOT EXPECTED_SHA1 STREQUAL NULL_SHA1) AND
+ (NOT EXPECTED_SHA1 STREQUAL ACTUAL_SHA1))
+ # Wasn't a NULL SHA1 and we didn't match, so we fail.
+ message(FATAL_ERROR
+ "Failed to download ${URL}. Expected a SHA1 of "
+ "${EXPECTED_SHA1} but got ${ACTUAL_SHA1} instead.")
+endif()
+
message(STATUS "downloading... done")
# Slurped from a generated extract-TARGET.cmake file.
@@ -140,4 +157,3 @@ message(STATUS "extracting... [clean up]")
file(REMOVE_RECURSE "${ut_dir}")
message(STATUS "extracting... done")
-