Skip to content

Conversation

rjw57
Copy link
Contributor

@rjw57 rjw57 commented Feb 24, 2014

As evidenced by #13 it is surprising to people that libuv is fetched at make-time. This also necessitates an Internet connection and GitHub being up in order to compile neovim. Both of these requirements are similarly surprising to experienced developers.

Since we mandate a particular version of libuv and are reticent to allow the use of system-supplied libraries, it makes sense to use git subtree to bundle that version directly into a third-party directory and modify the existing get-libuv.sh script to only compile that version. The use of git subtree also has the advantage that a) the precise commit of libuv being used is recorded in the repository history and b) we can move to a later version of libuv directly by appropriate git subtree incantation recorded in source history rather than fiddling with get-libuv.sh.

Such an incantation might be:

$ git subtree merge --prefix=third-party/libuv --squash https://github.com/joyent/libuv $TAG

where $TAG is replaced by the tag name one wishes to merge.

Use the --squash parameter to git subtree to avoid pulling in the entirety of libuv's history. This makes the difference in bandwidth required between bundling libuv and fetching a tarball directly negligible.

The version of libuv which has been merged corresponds to the "v0.11.19" tag which at merge time pointed to joyent/libuv@336a182.

An alternative solution would be to separate compilation from dependency fetching. Perhaps moving the fetching to the make cmake stage?

This PR does not completely address #13 since, unless one notices the "build" instructions in the README, the usual mkdir build && cd build && cmake .. && make recipe for compilation will fail unexpectedly which is likely to lead to lots of #13 dupes being opened. Should this PR be merged, it may be prudent to modify the CMakeLists.txt file to compile the provided libuv either by "CMake-izing" libuv or calling compile-libuv.sh from CMake. This would allow compilation using the standard CMake build procedure. If nothing else, this would make packaging neovim a lot easier.

git-subtree-dir: third-party/libuv
git-subtree-split: 3c4022464acd92607f21c6eef69330fb071d0400
Rename file to reflect new intent of script. Libuv is bundled into the
third-party directory. Modify the script to compile but not fetch libuv.
get-libuv.sh was renamed to compile-libuv.sh
Add a brief README on the purpose of the third-party directory and some
suggestions for how to manage it. The neovim bigwigs may want to
re-draft the README.
@Coornail
Copy link
Contributor

I like the idea of packaging libuv with neovim.
Tried the branch, it does build and tests run nicely.

@thynson
Copy link

thynson commented Feb 24, 2014

Agree with subtree solution. And in furthur future I wish it can be configure to use system libuv, this definitely makes distros maintainers happy.

@aktau
Copy link
Contributor

aktau commented Feb 24, 2014

There's something to be said for all approaches here. Git subtree is definitely nice, I personally use a manual version by downloading new releases of dependencies and pasting them over the deps/mydependency folder. That way I get all the changes in one commit as well, and I can label the commit something like dependency: sdl 2.0.0 -> 2.0.1. I suppose git subtree is a more automated version of this. It works well enough for me. I also strongly agree that it must be an option to use system-supplied libuv, as otherwise it will take a long while before neovim gets packaged.

@rjw57
Copy link
Contributor Author

rjw57 commented Feb 24, 2014

I also strongly agree that it must be an option to use system-supplied libuv, as otherwise it will take a long while before neovim gets packaged.

As it stands, a system supplied libuv will actually be used if CMake is used directly to compile neovim rather than using the make cmake && make idiom. (I confirmed this by installing libuv separately and using only CMake to build neovim.) This is more by happy accident than design. The idiomatic solution is usually to write a FindLibUV.cmake module which accepts a LIBUV_ROOT override. (See, for example, the FindBoost module documentation.) This could be passed to CMake in the existing Makefile.

That's a solution for a different day.

@tarruda
Copy link
Member

tarruda commented Feb 26, 2014

Yes this is much better than downloading separately, thanks for this and sorry for taking so long to merge, I've been giving priority to code-related issues.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants