By default, find_library() searches all directories for one possible
name and then looks for the next name. To make sure we're building
against the same headers and libraries, look for all names in a
directory before moving to the next one.
In 33bc332, version constraints were added to pkg_search_module(), but
that only affects the set of directories searched by
find_library()/find_path().
Once the header directory is found, parse the version from
version_master.h so it can be checked by the find_package() call in the
root CMakeLists.txt.
libmsgpack was the old C++ library provided by msgpack-c. The C library
is libmsgpackc.
The C++ support became header-only, but there was a bug
(msgpack/msgpack-c#395) wherein using msgpack-c's CMake build system
would only install libmsgpack instead of libmsgpackc.
Searching for both libraries, but preferring libmsgpackc, allows for
building against older msgpack-c releases and prepares for the upcoming
msgpack-c release which fixes the aforementioned issues.
Signed-off-by: James McCoy <jamessan@jamessan.com>
When building for X86 the CMake check_library_exists always fails to find
functions from the Win32 API due to name mangling conventions. The convention
for API functions is __stdcall and the CMake test code assumes __cdecl. Since
these are libraries from the Windows API we can simply link against the
libraries without checking for the functions.
Before this change, building Neovim would recursively search parent
directories for a .git directory. If Neovim was downloaded as a tarball
(i.e. without a .git directory), but placed in a subdirectory of
a Git repository, this caused a CMake error. Such a situation could
occur when packaging Neovim, for example.
Unfortunately, the previous attempt in #3317 did not fix this problem.
* Split build steps to utilize the Travis build lifecycle.
* Move shell code from `.travis.yml` into Bash files in `.ci/`,
one file for each step of the Travis build lifecycle.
* Use configuration variables in `.travis.yml` to change
build behavior (e.g. build 32-bit with `BUILD_32BIT=ON`).
* Keep all configuration in environment variables in
`.travis.yml`. In scripts, concatenate environment variables
according to configuration to change to different behavior.
* Add GCC 5 builds for Linux.
* Use Travis's caching feature [1] for third-party dependencies
and pip packages.
* Allow failures MSan, as the errors it reports have to be
fixed first.
Valgrind is still disabled, but can be enabled by setting
`env: VALGRIND=ON` for a job in `.travis.yml`.
[1] http://docs.travis-ci.com/user/caching
Piping input into nvim causes the helptags generation to hang. For
example, the following does not work:
yes | nvim -c "helptags ."
The helptags are generated during installation with a command similar
to the one above, using CMake's execute_process to call nvim.
As execute_process does not use an intermediate shell, the following
will cause the installation to hang:
yes | make install
pacaur, an Arch Linux package helper, uses a similar command to
install packages [1], and thus can currently not be used to install
Neovim.
This commit adds a workaround to GenerateHelptags.cmake to circumvent
this problem.
[1] 22c00a3d05/pacaur (L825)
For now, only install man pages matching "nvim*.1": we don't want to
install xxd.1 as it might conflict with that of a user's Vim
installation.
closes#1826
Reviewed-by: Florian Walch <florian@fwalch.com>
Helped-by: John Szakmeister <john@szakmeister.net>
Jemalloc will be used if the cmake option `USE_JEMALLOC` is enabled(which is the
default). To avoid trouble with clang's ASAN, it is disabled by default if the
`SANITIZE` option is enabled.
Since jemalloc has thread cache for small objects, it fills the gap created by
removing klib memory pools.
The `xstrdup` funciton(memory.c) had to be reimplemented on top of `xmalloc` to
make it work with a custom allocator.
- Read TEST_TAG/TEST_FILTER env vars from cmake/RunTests.cmake. Setting these
environment variables will pass --tags/--filter to busted, which can used to
filter which tests are executed.
- Remove calls to nvim msgpack-rpc API outside tests. This removes the
requirement of having a static `clear` call in test/functional/helpers.lua
- Use the new busted command-line option "--lazy" to ensure the setup/teardown
hooks are only executed when a suite runs at least one test.
Now its possible to run/debug a single test like this:
```sh
TEST_FILTER='some test string' make test
```
Which will only run tests containing "some test string" in the title.
Another option is:
```sh
TEST_TAG=some-tag make test
```
After putting #some-tag into the test title. This also improves debugging
experience because there will be no unnecessary gdbserver instances whe GDB=1 is
passed.
This requires a couple of extra modules that are not installed by
default, and it requires capturing stdout of the tests--otherwise CMake
output is intermixed with the XML output of busted.
It turns out that Busted started cleaning the environment in 2.0rc5 as a
result of Olivine-Labs/busted#62. This, in turn, caused the ffi module
to be reloaded for each spec file, and LuaJIT doesn't appreciate it.
The net effect is an assertion error in LuaJIT.
By using the --helper feature of Busted, we can pre-load some modules
ahead of Busted and prevent it from reloading them--making LuaJIT happy
again.
On some systems, such as NetBSD, the gettext header is tucked under the
gettext directory in the system include area. Let's add a path suffix
to ensure we correctly discover the header on such systems.
It turns out that CMake always canonicalizes `CMAKE_INSTALL_PREFIX` to
an absolute path--if it's a relative path, it canonicalizes it relative
to the build directory. As a result, the only thing the DESTDIR and
relative directory check prevents is an installation into the root
directory since CMake strips the trailing slash, turning "/" into an
empty string. Let's just remove the check all together, since it cannot
accomplish what we intended.
It turns out that `file(INSTALL ...)` already accounts for `DESTDIR`, so
this wasn't creating the directory structure in the correct location.
Instead, we need to do our existence check with `DESTDIR`, but leave it
off when doing the install step.
While we're at it, add a check to make sure `ENV{DESTDIR}` is not being
used with a relative path, as that construct doesn't make much sense.
This fixes issue #1387 discovered while trying to make helptag
generation work correctly in #1381.
If you aren't just building everything into build/, then the functional
tests fail because they can't find the nvim executable. Let's pass in
the location of the nvim executable, and set NVIM_PRG environment
variable accordingly.
Now that the lua client is available, python/lupa are no longer necessary to run
the functional tests. The helper functions previously defined in
run-functional-tests.py were adapted to test/functional/helpers.lua.
- cmake: git_timestamp() returns last commit time formatted as
`YYYYMMddHHmm`.
- Always include commit hash in :version and --version output.
`nvim --version` sample output:
NVIM 0.0.0-alpha+201410070245 (compiled Oct 7 2014 05:30:45)
Commit: f747b2b1ff7bfe7eb00cc2be82d7af87c98f1111
Busted can only discover tests from a single directory. In order to allow tests
under 'legacy' to run as a functional test, it needed to be moved to
'test/functional'.
The 'lupa' python package provides a simple way to seamless integrate lua and
python code.
This commit replaces vroom by a python script that exposes the 'neovim' package
to a lua state, and invokes busted to run functional tests. This is a temporary
solution that will enable writing functional tests using lua/bused while a lua
client library is not available.
The reason for dropping vroom is flexibility: Lua/busted has a nice DSL-style
syntax while also providing the customization power of a full programming
language. Another reason is to use a single framework for unit/functional tests.
Two other changes were performed in this commit:
- Instead of "gcc-unittest/gcc-ia32", the travis builds for gcc are now
identified by "gcc/gcc-32". They will run unit/functional tests for both 64
and 32 bits.
- Old integration tests(in src/nvim/testdir) are now ran by the 'oldtest' target
The install() command will create the parent directories, but it does so
with the user's umask. We want to do our best to make sure the correct
permissions are being set, without clobbering existing permissions.
To do this, this commit introduces an install_helper(), which is similar
in signature to the install() command, to help ensure that directories
are created ahead of the actual install() command. This will attempt to
use 0644 permissions for files and 0755 permissions for directories by
default--though they can be overridden.
To make this work correctly, without trying to introduce some mechanism
with setting the umask, it meant that there's a small portion that makes
use of an "internal" version of the file() command. It has been tested
on CMake 2.8.11, 2.8.12, and 3.0.2, and works correctly on all versions.
This fixes#1201 and #1086.
Using msgpack v5 will let nvim be more compatible with msgpack libraries for
other platforms.
This also replaces "raw" references by "bin" which is the new name for msgpack
binary data type
Fixes#902: localization build: `install`, `uninstall`, `prefixcheck
targets. All the language-related bits will now build under CMake.
Changes include:
* Moving all non-generated sources into the NEOVIM_SOURCES variable
to aid in generating the .pot file.
* Moving a couple generated sources from NEOVIM_SOURCES and into
NEOVIM_GENERATED_SOURCES.
* Added NEOVIM_HEADERS to the executable and the library for folks who
are using something other than Ninja or makefiles (that way the
headers will show up in the IDE files).
* Now uses gettext's `--update` switch to update the .po files, rather
than doing a fragile `mv` dance that could leave you with a broken
working tree if you press CTRL-C at the right time.
* Creates `update-po-${LANG}` targets for updating individual
languages, just like the original Makefile.
* Also adds the `update-po` target for updating all the languages.
* Ported the `check-${LANG}` style targets. They're
`check-po-${LANG}` under CMake.
* Handles all the one-off instances that were in the original
Makefile. Fixed up ko.UTF-8.po to include the "Original
translation" line like other .po files to make the generation of the
"Generate from ..." comments consistent. Updated ko.po with the new
text.
Fixes#902: localization build: `install`, `uninstall`, `prefixcheck
targets. All the language-related bits will now build under CMake.
Changes include:
* Moving all non-generated sources into the NEOVIM_SOURCES variable
to aid in generating the .pot file.
* Moving a couple generated sources from NEOVIM_SOURCES and into
NEOVIM_GENERATED_SOURCES.
* Added NEOVIM_HEADERS to the executable and the library for folks who
are using something other than Ninja or makefiles (that way the
headers will show up in the IDE files).
* Now uses gettext's `--update` switch to update the .po files, rather
than doing a fragile `mv` dance that could leave you with a broken
working tree if you press CTRL-C at the right time.
* Creates `update-po-${LANG}` targets for updating individual
languages, just like the original Makefile.
* Also adds the `update-po` target for updating all the languages.
* Ported the `check-${LANG}` style targets. They're
`check-po-${LANG}` under CMake.
* Handles all the one-off instances that were in the original
Makefile. Fixed up ko.UTF-8.po to include the "Original
translation" line like other .po files to make the generation of the
"Generate from ..." comments consistent. Updated ko.po with the new
text.
- Defined CMake checks for all headers in config.h.in
- Removed headers checks that are not used anymore:
sgtty.h sys/statfs.h libintl.h poll.h
- Added UNIX check
- Add some fatal checks
+ Check for setenv() and fail if it does not exist
since our os layer just assumes it does
+ lstat is required by os_unix.c
+ sys/wait.h is required in UNIX
- Removed entries for functions that are not being used: getcwd,
getrlimit, getwd, nanosleep, sigaltstack, getwd, sigstack, fseeko
- Replaced nearly all defines in config.h.in for functions with
compile time checks
- Add check for symbol FD_CLOEXEC
- Add check for langinfo CODESET
- HAVE_ICONV_H and HAVE_ICONV hold the expected checks but Neovim uses
USE_ICONV define to actually decide whether to enable it
- Removed checks that are no longer needed
+ USEMEMMOVE
+ _FILE_OFFSET_BITS
+ HAVE_ST_BLKSIZE
+ dlfcn.h
- Unittest should contain substring '_spec' in filename.
- This is the simplest way to use both lua and moonscript tests.
- This prevents running of non-test scripts from test folder.
This is in preparation for the next step, which is to find a suitable
lua interpreter, rather than just erroring when an interpreter is found
but doesn't have the necessary dependencies.
Helped-by: John Szakmeister <john@szakmeister.net>
This allows us to avoid hard-coding paths and using environment
variables to communicate key information to unit tests, which fits
with the overall goal of making sure that folks driving CMake directly
can continue to do out-of-tree builds.
With this, you can now run a single unit test file using:
TEST_FILE=/path/to/file make unittest
For example, to just run the path unit tests, you can do:
TEST_FILE=test/unit/path.moon make unittest
- Build targeting 32-bit with travis
- Code in `before_install`/`after_success` was moved to travis.sh since it
provides greater flexibility for detecting the build matrix environment. This
improves the build speed since we now install only what's necessary.
- Now clint has a dedicated travis worker
Apparently busted 1.11.0 is broken(https://github.com/Olivine-Labs/busted/issues/236)
in a way that is causing the unit tests to fail. This pins the version to 1.10.0
and also fixes a wrong variable set when msgpack was added as a dependency
Since libuv.pc is broken at the moment, try to determine libuv's
dependencies ourselves. This ports most of the checks from libuv into
our CMake build, and fixes the build on other unix platforms.
This achieves several goals:
* Less reliance on scripts so we have better portability to Windows
(though we still have a ways to go for proper Windows support).
Luajit, luarocks, moonscript, and busted are all installed via CMake
now.
* Trying to make use of pkg-config to get the correct libraries. The
latest libuv is still broken in this regard, but we'll at least be in
a position to use it.
* Allow the use of Ninja or make. The former runs faster in many
environments, and automatically makes use of parallel builds.
This also allows for system installed dependencies--though not through
the Makefile just yet--and adds support for FreeBSD.
This also make us build libuv and luajit as static libraries only, since
we're only concerned about having static libraries for our bundled
dependencies.
If LibUV_USE_STATIC is set then the static libuv library will be
preferred to the shared library. This is useful when building with the
bundled libuv but is less useful when building with a system libuv.
Explicitly try to find the static libuv library first.
This might be considered a hack and if it weren't a single-use module it
might be preferable to control static versus shared preferences with a
configuration variable.