neovim/neovim — pull request #348 by jszakmeister (2014-03-12 10:31:27+00:00)
Title: [WIP] Revamp the build system

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. I also made the deps build of libuv and luajit build only the static versions.

Note: we no longer install moonrocks as we were only using install, and that was just adding a single parameter to the `luarocks install` command. Also, it bumps the minimum required CMake to 2.8.7 since that was the lowest version I had to test with. We could probably push it back further, if required, but it appears many distros have at least that version--RHEL being the notable exception, which appears to use 2.8.4.

Finally, I encountered a few issues along the way. CMake in FreeBSD was being built without SSL support. That has been fixed. Libuv didn't have the pkg-config description right, and now that's fixed in 0.11.22. I discovered a couple of CMake bugs that I still need to report. One being related to type size detection failing (because of a compilation error), but CMake failed to notice and left the define empty. The other being a way to shut off download progress notification when using `ExternalProject_Add()`. The former doesn't really affect most users, I just happened to run across it. The latter we could work-around by formulating our own `file(DOWNLOAD ...)` command and running it via `${CMAKE_COMMAND} -P`.

I believe this ultimately supersedes #198, though we may want to take some elements of #198 (moving the top-level Makefile, and the separate documentation and examples). It also fixes #245 and #232, address #202, #255, and I believe it makes progress toward #328.

One downside of using Ninja: we can't launch the legacy tests through it. It doesn't setup a pseudo-tty, and the tests require it. I do have another branch (https://github.com/jszakmeister/neovim/tree/revamp-vim-tests) that is exploring how to make this better.