2013-01-23 07:17:01 +08:00
|
|
|
# libuv
|
2011-09-24 02:07:57 +08:00
|
|
|
|
2013-10-30 07:33:17 +08:00
|
|
|
libuv is a multi-platform support library with a focus on asynchronous I/O. It
|
|
|
|
was primarily developed for use by [Node.js](http://node.js.org), but it's also
|
|
|
|
used by Mozilla's [Rust language](http://www.rust-lang.org/),
|
|
|
|
[Luvit](http://luvit.io/), [Julia](http://julialang.org/),
|
|
|
|
[pyuv](https://crate.io/packages/pyuv/), and others.
|
2011-05-13 10:16:40 +08:00
|
|
|
|
2013-10-30 07:33:17 +08:00
|
|
|
## Feature highlights
|
2011-09-24 02:07:57 +08:00
|
|
|
|
2013-10-30 07:33:17 +08:00
|
|
|
* Full-featured event loop backed by epoll, kqueue, IOCP, event ports.
|
2011-09-24 02:07:57 +08:00
|
|
|
|
2013-10-30 07:33:17 +08:00
|
|
|
* Asynchronous TCP and UDP sockets
|
2011-09-24 02:07:57 +08:00
|
|
|
|
2013-10-30 07:33:17 +08:00
|
|
|
* Asynchronous DNS resolution
|
2011-09-24 02:07:57 +08:00
|
|
|
|
2013-10-30 07:33:17 +08:00
|
|
|
* Asynchronous file and file system operations
|
2011-09-24 11:23:41 +08:00
|
|
|
|
2013-10-30 07:33:17 +08:00
|
|
|
* File system events
|
2011-09-24 02:07:57 +08:00
|
|
|
|
2013-10-30 07:33:17 +08:00
|
|
|
* ANSI escape code controlled TTY
|
2011-09-24 02:07:57 +08:00
|
|
|
|
2013-10-30 07:33:17 +08:00
|
|
|
* IPC with socket sharing, using Unix domain sockets or named pipes (Windows)
|
2011-09-24 02:07:57 +08:00
|
|
|
|
2013-10-30 07:33:17 +08:00
|
|
|
* Child processes
|
2011-09-24 02:07:57 +08:00
|
|
|
|
2013-10-30 07:33:17 +08:00
|
|
|
* Thread pool
|
2011-09-24 02:07:57 +08:00
|
|
|
|
2013-10-30 07:33:17 +08:00
|
|
|
* Signal handling
|
2011-09-24 02:07:57 +08:00
|
|
|
|
2013-10-30 07:33:17 +08:00
|
|
|
* High resolution clock
|
2011-10-01 02:22:38 +08:00
|
|
|
|
2013-10-30 07:33:17 +08:00
|
|
|
* Threading and synchronization primitives
|
2011-09-24 02:07:57 +08:00
|
|
|
|
|
|
|
|
2012-10-07 05:04:30 +08:00
|
|
|
## Community
|
|
|
|
|
|
|
|
* [Mailing list](http://groups.google.com/group/libuv)
|
2011-09-24 02:07:57 +08:00
|
|
|
|
|
|
|
## Documentation
|
|
|
|
|
2012-08-07 07:25:06 +08:00
|
|
|
* [include/uv.h](https://github.com/joyent/libuv/blob/master/include/uv.h)
|
|
|
|
— API documentation in the form of detailed header comments.
|
|
|
|
* [An Introduction to libuv](http://nikhilm.github.com/uvbook/) — An
|
|
|
|
overview of libuv with tutorials.
|
2012-10-07 05:04:30 +08:00
|
|
|
* [LXJS 2012 talk](http://www.youtube.com/watch?v=nGn60vDSxQ4) - High-level
|
|
|
|
introductory talk about libuv.
|
|
|
|
* [Tests and benchmarks](https://github.com/joyent/libuv/tree/master/test) -
|
|
|
|
API specification and usage examples.
|
2011-09-24 02:07:57 +08:00
|
|
|
|
|
|
|
## Build Instructions
|
2011-05-13 10:16:40 +08:00
|
|
|
|
2013-07-17 03:04:31 +08:00
|
|
|
For GCC there are two methods building: via autotools or via [GYP][].
|
|
|
|
GYP is a meta-build system which can generate MSVS, Makefile, and XCode
|
|
|
|
backends. It is best used for integration into other projects.
|
2013-02-21 04:12:18 +08:00
|
|
|
|
2013-07-17 03:04:31 +08:00
|
|
|
To build with autotools:
|
2013-02-21 04:12:18 +08:00
|
|
|
|
2013-07-17 03:04:31 +08:00
|
|
|
$ sh autogen.sh
|
|
|
|
$ ./configure
|
|
|
|
$ make
|
|
|
|
$ make check
|
|
|
|
$ make install
|
2013-06-27 01:48:10 +08:00
|
|
|
|
2013-10-30 07:33:17 +08:00
|
|
|
### Windows
|
2011-08-06 18:38:11 +08:00
|
|
|
|
2013-10-30 07:33:17 +08:00
|
|
|
First, Python 2.6 or 2.7 must be installed as it is required by [GYP][].
|
2011-08-30 06:23:13 +08:00
|
|
|
|
2013-10-30 07:33:17 +08:00
|
|
|
Also, the directory for the preferred Python executable must be specified
|
|
|
|
by the `PYTHON` or `Path` environment variables.
|
|
|
|
|
|
|
|
To build with Visual Studio, launch a git shell (e.g. Cmd or PowerShell)
|
|
|
|
and run vcbuild.bat which will checkout the GYP code into build/gyp and
|
|
|
|
generate uv.sln as well as related project files.
|
|
|
|
|
|
|
|
To have GYP generate build script for another system, checkout GYP into the
|
2013-01-22 23:21:25 +08:00
|
|
|
project tree manually:
|
2011-08-06 18:38:11 +08:00
|
|
|
|
2013-07-17 03:04:31 +08:00
|
|
|
$ mkdir -p build
|
|
|
|
$ git clone https://git.chromium.org/external/gyp.git build/gyp
|
2011-08-09 05:14:47 +08:00
|
|
|
|
2013-10-30 07:33:17 +08:00
|
|
|
### Unix
|
|
|
|
|
|
|
|
Run:
|
2013-01-22 23:21:25 +08:00
|
|
|
|
2013-07-17 03:04:31 +08:00
|
|
|
$ ./gyp_uv -f make
|
|
|
|
$ make -C out
|
2013-01-22 23:21:25 +08:00
|
|
|
|
2013-10-30 07:33:17 +08:00
|
|
|
### OS X
|
|
|
|
|
|
|
|
Run:
|
2011-08-09 05:14:47 +08:00
|
|
|
|
2013-07-17 03:04:31 +08:00
|
|
|
$ ./gyp_uv -f xcode
|
|
|
|
$ xcodebuild -project uv.xcodeproj -configuration Release -target All
|
2011-08-09 05:14:47 +08:00
|
|
|
|
2013-10-30 07:33:17 +08:00
|
|
|
### Android
|
|
|
|
|
|
|
|
Run:
|
2011-08-09 05:14:47 +08:00
|
|
|
|
2013-07-17 03:04:31 +08:00
|
|
|
$ source ./android-configure NDK_PATH gyp
|
|
|
|
$ make -C out
|
2011-08-06 18:38:11 +08:00
|
|
|
|
2013-02-21 04:12:18 +08:00
|
|
|
Note for UNIX users: compile your project with `-D_LARGEFILE_SOURCE` and
|
|
|
|
`-D_FILE_OFFSET_BITS=64`. GYP builds take care of that automatically.
|
|
|
|
|
2011-09-24 02:07:57 +08:00
|
|
|
## Supported Platforms
|
2011-05-13 10:16:40 +08:00
|
|
|
|
2011-08-09 05:14:47 +08:00
|
|
|
Microsoft Windows operating systems since Windows XP SP2. It can be built
|
2013-04-12 23:43:05 +08:00
|
|
|
with either Visual Studio or MinGW. Consider using
|
|
|
|
[Visual Studio Express 2010][] or later if you do not have a full Visual
|
|
|
|
Studio license.
|
2011-08-09 05:14:47 +08:00
|
|
|
|
2013-07-17 03:04:31 +08:00
|
|
|
Linux using the GCC toolchain.
|
2011-05-13 10:16:40 +08:00
|
|
|
|
2013-10-30 07:33:17 +08:00
|
|
|
OS X using the GCC or XCode toolchain.
|
2011-05-13 10:16:40 +08:00
|
|
|
|
|
|
|
Solaris 121 and later using GCC toolchain.
|
2013-04-12 23:43:05 +08:00
|
|
|
|
2013-07-17 03:04:31 +08:00
|
|
|
[node.js]: http://nodejs.org/
|
|
|
|
[GYP]: http://code.google.com/p/gyp/
|
2013-04-12 23:43:05 +08:00
|
|
|
[Visual Studio Express 2010]: http://www.microsoft.com/visualstudio/eng/products/visual-studio-2010-express
|