2013-01-23 00:17:01 +01:00
|
|
|
# libuv
|
2011-09-23 20:07:57 +02:00
|
|
|
|
|
|
|
libuv is a new platform layer for Node. Its purpose is to abstract IOCP on
|
2012-11-16 17:57:15 +01:00
|
|
|
Windows and epoll/kqueue/event ports/etc. on Unix systems. We intend to
|
|
|
|
eventually contain all platform differences in this library.
|
2011-05-13 04:16:40 +02:00
|
|
|
|
|
|
|
http://nodejs.org/
|
|
|
|
|
2011-09-23 20:07:57 +02:00
|
|
|
## Features
|
|
|
|
|
2011-09-24 05:23:41 +02:00
|
|
|
* Non-blocking TCP sockets
|
2011-09-23 20:07:57 +02:00
|
|
|
|
2011-09-24 05:23:41 +02:00
|
|
|
* Non-blocking named pipes
|
2011-09-23 20:07:57 +02:00
|
|
|
|
|
|
|
* UDP
|
|
|
|
|
2011-09-24 05:23:41 +02:00
|
|
|
* Timers
|
|
|
|
|
2011-09-23 20:07:57 +02:00
|
|
|
* Child process spawning
|
|
|
|
|
2012-08-07 01:36:31 +02:00
|
|
|
* Asynchronous DNS via `uv_getaddrinfo`.
|
2011-09-23 20:07:57 +02:00
|
|
|
|
2011-09-24 05:23:41 +02:00
|
|
|
* Asynchronous file system APIs `uv_fs_*`
|
2011-09-23 20:07:57 +02:00
|
|
|
|
2011-09-24 05:23:41 +02:00
|
|
|
* High resolution time `uv_hrtime`
|
2011-09-23 20:07:57 +02:00
|
|
|
|
2011-09-24 05:23:41 +02:00
|
|
|
* Current executable path look up `uv_exepath`
|
2011-09-23 20:07:57 +02:00
|
|
|
|
2011-09-24 05:23:41 +02:00
|
|
|
* Thread pool scheduling `uv_queue_work`
|
2011-09-23 20:07:57 +02:00
|
|
|
|
2011-09-30 20:22:38 +02:00
|
|
|
* ANSI escape code controlled TTY `uv_tty_t`
|
|
|
|
|
2011-10-10 16:56:02 +02:00
|
|
|
* File system events Currently supports inotify, `ReadDirectoryChangesW`
|
|
|
|
and kqueue. Event ports in the near future.
|
2011-09-24 05:23:41 +02:00
|
|
|
`uv_fs_event_t`
|
2011-09-23 20:07:57 +02:00
|
|
|
|
2011-10-10 16:56:02 +02:00
|
|
|
* IPC and socket sharing between processes `uv_write2`
|
2011-09-23 20:07:57 +02:00
|
|
|
|
2012-10-06 23:04:30 +02:00
|
|
|
## Community
|
|
|
|
|
|
|
|
* [Mailing list](http://groups.google.com/group/libuv)
|
2011-09-23 20:07:57 +02:00
|
|
|
|
|
|
|
## Documentation
|
|
|
|
|
2012-08-07 01:25:06 +02: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-06 23:04:30 +02: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-23 20:07:57 +02:00
|
|
|
|
|
|
|
## Build Instructions
|
2011-05-13 04:16:40 +02:00
|
|
|
|
2011-08-08 23:14:47 +02:00
|
|
|
For GCC (including MinGW) there are two methods building: via normal
|
|
|
|
makefiles 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
|
2013-01-22 16:21:25 +01:00
|
|
|
projects. The old system is using plain GNU Makefiles.
|
2011-08-06 12:38:11 +02:00
|
|
|
|
2011-08-08 23:14:47 +02:00
|
|
|
To build via Makefile simply execute:
|
2011-08-06 12:38:11 +02:00
|
|
|
|
|
|
|
make
|
|
|
|
|
2013-02-20 21:12:18 +01:00
|
|
|
MinGW users should run this instead:
|
|
|
|
|
2013-03-28 00:28:45 +01:00
|
|
|
make PLATFORM=mingw
|
2013-02-20 21:12:18 +01:00
|
|
|
|
|
|
|
Out-of-tree builds are supported:
|
|
|
|
|
|
|
|
make builddir_name=/path/to/builddir
|
|
|
|
|
|
|
|
To build with Visual Studio run the vcbuild.bat file which will
|
2011-08-30 00:23:13 +02:00
|
|
|
checkout the GYP code into build/gyp and generate the uv.sln and
|
2011-08-08 23:14:47 +02:00
|
|
|
related files.
|
2011-08-06 12:38:11 +02:00
|
|
|
|
2011-09-24 05:23:41 +02:00
|
|
|
Windows users can also build from cmd-line using msbuild. This is
|
2011-08-30 00:23:13 +02:00
|
|
|
done by running vcbuild.bat from Visual Studio command prompt.
|
|
|
|
|
2013-01-22 16:21:25 +01:00
|
|
|
To have GYP generate build script for another system, make sure that
|
|
|
|
you have Python 2.6 or 2.7 installed, then checkout GYP into the
|
|
|
|
project tree manually:
|
2011-08-06 12:38:11 +02:00
|
|
|
|
2013-01-22 16:21:25 +01:00
|
|
|
mkdir -p build
|
2011-08-08 23:14:47 +02:00
|
|
|
svn co http://gyp.googlecode.com/svn/trunk build/gyp
|
|
|
|
|
2013-01-22 16:21:25 +01:00
|
|
|
Or:
|
|
|
|
|
|
|
|
mkdir -p build
|
|
|
|
git clone https://git.chromium.org/external/gyp.git build/gyp
|
|
|
|
|
2011-08-23 02:34:43 +02:00
|
|
|
Unix users run
|
2011-08-08 23:14:47 +02:00
|
|
|
|
2011-08-23 02:34:43 +02:00
|
|
|
./gyp_uv -f make
|
2013-01-22 16:21:25 +01:00
|
|
|
make -C out
|
2011-08-08 23:14:47 +02:00
|
|
|
|
2011-08-23 02:34:43 +02:00
|
|
|
Macintosh users run
|
2011-08-08 23:14:47 +02:00
|
|
|
|
2011-08-23 02:34:43 +02:00
|
|
|
./gyp_uv -f xcode
|
|
|
|
xcodebuild -project uv.xcodeproj -configuration Release -target All
|
2011-08-06 12:38:11 +02:00
|
|
|
|
2013-02-20 21:12:18 +01: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.
|
|
|
|
|
2012-09-13 16:18:54 +02:00
|
|
|
Note for Linux users: compile your project with `-D_GNU_SOURCE` when you
|
|
|
|
include `uv.h`. GYP builds take care of that automatically. If you use
|
|
|
|
autotools, add a `AC_GNU_SOURCE` declaration to your `configure.ac`.
|
2011-08-06 12:38:11 +02:00
|
|
|
|
2011-09-23 20:07:57 +02:00
|
|
|
## Supported Platforms
|
2011-05-13 04:16:40 +02:00
|
|
|
|
2011-08-08 23:14:47 +02:00
|
|
|
Microsoft Windows operating systems since Windows XP SP2. It can be built
|
|
|
|
with either Visual Studio or MinGW.
|
|
|
|
|
|
|
|
Linux 2.6 using the GCC toolchain.
|
2011-05-13 04:16:40 +02:00
|
|
|
|
2011-08-08 23:14:47 +02:00
|
|
|
MacOS using the GCC or XCode toolchain.
|
2011-05-13 04:16:40 +02:00
|
|
|
|
|
|
|
Solaris 121 and later using GCC toolchain.
|