Upgrade libuv to 75c10905
authorRyan Dahl <ry@tinyclouds.org>
Mon, 8 Aug 2011 21:14:47 +0000 (14:14 -0700)
committerRyan Dahl <ry@tinyclouds.org>
Mon, 8 Aug 2011 21:14:47 +0000 (14:14 -0700)
deps/uv/.gitignore
deps/uv/Makefile
deps/uv/README
deps/uv/config-mingw.mk [new file with mode: 0644]
deps/uv/config-unix.mk [new file with mode: 0644]
deps/uv/src/eio/eio.c

index dcd7fbe42c32b57c00b86c1437a596da78f84b4e..32a57295deae9b5423e7eb39a8e61198d6cfc211 100644 (file)
@@ -9,3 +9,8 @@
 *.suo
 /out/
 /build/gyp
+
+/test/run-tests
+/test/run-tests.dSYM
+/test/run-benchmarks
+/test/run-benchmarks.dSYM
index 8487a14a127236370325aad85e0c330e3ed6d679..cbbf635d3d6cac90803af0f29795c6f1dc7772fb 100644 (file)
-BUILDTYPE ?= Release
+# Copyright Joyent, Inc. and other Node contributors. All rights reserved.
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to
+# deal in the Software without restriction, including without limitation the
+# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+# sell copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+# IN THE SOFTWARE.
 
-all: out/Makefile
-       $(MAKE) -C out BUILDTYPE=$(BUILDTYPE)
+uname_S := $(shell sh -c 'uname -s 2>/dev/null || echo not')
 
-out/Makefile: build/gyp
-       build/gyp_uv -f make
+ifdef MSVC
+uname_S := MINGW
+endif
 
-build/gyp:
-       svn co http://gyp.googlecode.com/svn/trunk@983 build/gyp
+CPPFLAGS += -Iinclude
 
-clean:
-       rm -rf out
+CARES_OBJS =
+CARES_OBJS += src/ares/ares__close_sockets.o
+CARES_OBJS += src/ares/ares__get_hostent.o
+CARES_OBJS += src/ares/ares__read_line.o
+CARES_OBJS += src/ares/ares__timeval.o
+CARES_OBJS += src/ares/ares_cancel.o
+CARES_OBJS += src/ares/ares_data.o
+CARES_OBJS += src/ares/ares_destroy.o
+CARES_OBJS += src/ares/ares_expand_name.o
+CARES_OBJS += src/ares/ares_expand_string.o
+CARES_OBJS += src/ares/ares_fds.o
+CARES_OBJS += src/ares/ares_free_hostent.o
+CARES_OBJS += src/ares/ares_free_string.o
+CARES_OBJS += src/ares/ares_gethostbyaddr.o
+CARES_OBJS += src/ares/ares_gethostbyname.o
+CARES_OBJS += src/ares/ares_getnameinfo.o
+CARES_OBJS += src/ares/ares_getopt.o
+CARES_OBJS += src/ares/ares_getsock.o
+CARES_OBJS += src/ares/ares_init.o
+CARES_OBJS += src/ares/ares_library_init.o
+CARES_OBJS += src/ares/ares_llist.o
+CARES_OBJS += src/ares/ares_mkquery.o
+CARES_OBJS += src/ares/ares_nowarn.o
+CARES_OBJS += src/ares/ares_options.o
+CARES_OBJS += src/ares/ares_parse_a_reply.o
+CARES_OBJS += src/ares/ares_parse_aaaa_reply.o
+CARES_OBJS += src/ares/ares_parse_mx_reply.o
+CARES_OBJS += src/ares/ares_parse_ns_reply.o
+CARES_OBJS += src/ares/ares_parse_ptr_reply.o
+CARES_OBJS += src/ares/ares_parse_srv_reply.o
+CARES_OBJS += src/ares/ares_parse_txt_reply.o
+CARES_OBJS += src/ares/ares_process.o
+CARES_OBJS += src/ares/ares_query.o
+CARES_OBJS += src/ares/ares_search.o
+CARES_OBJS += src/ares/ares_send.o
+CARES_OBJS += src/ares/ares_strcasecmp.o
+CARES_OBJS += src/ares/ares_strdup.o
+CARES_OBJS += src/ares/ares_strerror.o
+CARES_OBJS += src/ares/ares_timeout.o
+CARES_OBJS += src/ares/ares_version.o
+CARES_OBJS += src/ares/ares_writev.o
+CARES_OBJS += src/ares/bitncmp.o
+CARES_OBJS += src/ares/inet_net_pton.o
+CARES_OBJS += src/ares/inet_ntop.o
 
-distclean:
-       rm -rf out
+ifneq (,$(findstring MINGW,$(uname_S)))
+include config-mingw.mk
+else
+include config-unix.mk
+endif
 
-test: all
-       ./out/$(BUILDTYPE)/run-tests
+TESTS=test/echo-server.c test/test-*.c
+BENCHMARKS=test/echo-server.c test/dns-server.c test/benchmark-*.c
 
-bench: all
-       ./out/$(BUILDTYPE)/run-benchmarks
+all: uv.a test/run-tests test/run-benchmarks
 
-.PHONY: all clean distclean test bench
+$(CARES_OBJS): %.o: %.c
+       $(CC) -o $*.o -c $(CFLAGS) $(CPPFLAGS) $< -DHAVE_CONFIG_H
+
+test/run-tests$(E): test/*.h test/run-tests.c $(RUNNER_SRC) test/runner-unix.c $(TESTS) uv.a
+       $(CC) $(CPPFLAGS) $(RUNNER_CFLAGS) $(RUNNER_LINKFLAGS) -o test/run-tests test/run-tests.c \
+               test/runner.c $(RUNNER_SRC) $(TESTS) uv.a $(RUNNER_LIBS)
+
+test/run-benchmarks$(E): test/*.h test/run-benchmarks.c test/runner.c $(RUNNER_SRC) $(BENCHMARKS) uv.a
+       $(CC) $(CPPFLAGS) $(RUNNER_CFLAGS) $(RUNNER_LINKFLAGS) -o test/run-benchmarks test/run-benchmarks.c \
+                test/runner.c $(RUNNER_SRC) $(BENCHMARKS) uv.a $(RUNNER_LIBS)
+
+test/echo.o: test/echo.c test/echo.h
+       $(CC) $(CPPFLAGS) $(CFLAGS) -c test/echo.c -o test/echo.o
+
+
+.PHONY: clean clean-platform distclean distclean-platform test bench
+
+
+test: test/run-tests$(E)
+       test/run-tests
+
+#test-%:       test/run-tests$(E)
+#      test/run-tests $(@:test-%=%)
+
+bench: test/run-benchmarks$(E)
+       test/run-benchmarks
+
+#bench-%:      test/run-benchmarks$(E)
+#      test/run-benchmarks $(@:bench-%=%)
+
+clean: clean-platform
+       $(RM) -f src/*.o *.a test/run-tests$(E) test/run-benchmarks$(E)
+
+distclean: distclean-platform
+       $(RM) -f src/*.o *.a test/run-tests$(E) test/run-benchmarks$(E)
index 326a346c090c57358305e9e62b61a837b7fd4177..a15e1e146b74f758ebe19198a421a957b15e1d4f 100644 (file)
@@ -6,24 +6,40 @@ http://nodejs.org/
 
 = Build Instructions
 
-The build system requires python and subversion.
+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
+projects.  The old (more stable) system is using Makefiles.
 
-On Unix systems just type
+To build via Makefile simply execute:
 
     make
 
-On Windows you can generate the MSVS solution files by running
+To build with Visual Studio run the create-msvs-files.bat file which will
+checkout the GYP code into build/gyp and generate the build/all.sln and
+related files.
 
-    create-msvs-files.bat
+To have GYP generate build script for another system you will need to
+checkout GYP into the project tree manually:
 
-Open build/all.sln afterwards.
+    svn co http://gyp.googlecode.com/svn/trunk build/gyp
+
+And then run 
+
+    ./build/gyp_uv -f make
+
+or 
+
+    ./build/gyp_uv -f xcode
 
 
 = Supported Platforms
 
-Microsoft Windows operating systems since Windows XP sp2. It can be built
-with either Visual Studio.
+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.
 
-Linux 2.6 and MacOS using the GCC toolchain.
+MacOS using the GCC or XCode toolchain.
 
 Solaris 121 and later using GCC toolchain.
diff --git a/deps/uv/config-mingw.mk b/deps/uv/config-mingw.mk
new file mode 100644 (file)
index 0000000..abd244e
--- /dev/null
@@ -0,0 +1,67 @@
+# Copyright Joyent, Inc. and other Node contributors. All rights reserved.
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to
+# deal in the Software without restriction, including without limitation the
+# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+# sell copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+# IN THE SOFTWARE.
+
+# Use make -f Makefile.gcc PREFIX=i686-w64-mingw32-
+# for cross compilation
+CC = $(PREFIX)gcc
+AR = $(PREFIX)ar
+E=.exe
+
+CFLAGS=$(CPPFLAGS) -g --std=gnu89 -D_WIN32_WINNT=0x0501 -Isrc/ares/config_win32
+LINKFLAGS=-lm
+
+CARES_OBJS += src/ares/windows_port.o
+WIN_SRCS=$(wildcard src/win/*.c)
+WIN_OBJS=$(WIN_SRCS:.c=.o)
+
+RUNNER_CFLAGS=$(CFLAGS) -D_GNU_SOURCE # Need _GNU_SOURCE for strdup?
+RUNNER_LINKFLAGS=$(LINKFLAGS)
+RUNNER_LIBS=-lws2_32
+RUNNER_SRC=test/runner-win.c
+
+uv.a: $(WIN_OBJS) src/uv-common.o src/uv-eio.o src/eio/eio.o $(CARES_OBJS)
+       $(AR) rcs uv.a src/win/*.o src/uv-common.o src/uv-eio.o src/eio/eio.o $(CARES_OBJS)
+
+src/win/%.o: src/win/%.c src/win/internal.h
+       $(CC) $(CFLAGS) -o $@ -c $<
+
+src/uv-common.o: src/uv-common.c include/uv.h include/uv-win.h
+       $(CC) $(CFLAGS) -c src/uv-common.c -o src/uv-common.o
+
+EIO_CPPFLAGS += $(CPPFLAGS)
+EIO_CPPFLAGS += -DEIO_CONFIG_H=\"$(EIO_CONFIG)\"
+EIO_CPPFLAGS += -DEIO_STACKSIZE=65536
+EIO_CPPFLAGS += -D_GNU_SOURCE
+
+src/eio/eio.o: src/eio/eio.c
+       $(CC) $(EIO_CPPFLAGS) $(CFLAGS) -c src/eio/eio.c -o src/eio/eio.o
+
+src/uv-eio.o: src/uv-eio.c
+       $(CC) $(CPPFLAGS) -Isrc/eio/ $(CFLAGS) -c src/uv-eio.c -o src/uv-eio.o
+
+clean-platform:
+       -rm -f src/ares/*.o
+       -rm -f src/eio/*.o
+       -rm -f src/win/*.o
+
+distclean-platform:
+       -rm -f src/ares/*.o
+       -rm -f src/eio/*.o
+       -rm -f src/win/*.o
diff --git a/deps/uv/config-unix.mk b/deps/uv/config-unix.mk
new file mode 100644 (file)
index 0000000..5776109
--- /dev/null
@@ -0,0 +1,121 @@
+# Copyright Joyent, Inc. and other Node contributors. All rights reserved.
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to
+# deal in the Software without restriction, including without limitation the
+# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+# sell copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+# IN THE SOFTWARE.
+
+CC = $(PREFIX)gcc
+AR = $(PREFIX)ar
+E=
+CSTDFLAG=--std=c89 -pedantic -Wall -Wextra -Wno-unused-parameter
+CFLAGS=-g
+CPPFLAGS += -Isrc/ev
+LINKFLAGS=-lm
+
+CPPFLAGS += -D_LARGEFILE_SOURCE
+CPPFLAGS += -D_FILE_OFFSET_BITS=64
+
+ifeq (SunOS,$(uname_S))
+EV_CONFIG=config_sunos.h
+EIO_CONFIG=config_sunos.h
+CPPFLAGS += -Isrc/ares/config_sunos -D__EXTENSIONS__
+LINKFLAGS+=-lsocket -lnsl
+UV_OS_FILE=uv-sunos.c
+endif
+
+ifeq (Darwin,$(uname_S))
+EV_CONFIG=config_darwin.h
+EIO_CONFIG=config_darwin.h
+CPPFLAGS += -Isrc/ares/config_darwin
+LINKFLAGS+=-framework CoreServices
+UV_OS_FILE=uv-darwin.c
+endif
+
+ifeq (Linux,$(uname_S))
+EV_CONFIG=config_linux.h
+EIO_CONFIG=config_linux.h
+CSTDFLAG += -D_XOPEN_SOURCE=600
+CPPFLAGS += -Isrc/ares/config_linux
+LINKFLAGS+=-lrt
+UV_OS_FILE=uv-linux.c
+endif
+
+ifeq (FreeBSD,$(uname_S))
+EV_CONFIG=config_freebsd.h
+EIO_CONFIG=config_freebsd.h
+CPPFLAGS += -Isrc/ares/config_freebsd
+LINKFLAGS+=
+UV_OS_FILE=uv-freebsd.c
+endif
+
+ifneq (,$(findstring CYGWIN,$(uname_S)))
+EV_CONFIG=config_cygwin.h
+EIO_CONFIG=config_cygwin.h
+# We drop the --std=c89, it hides CLOCK_MONOTONIC on cygwin
+CSTDFLAG = -D_GNU_SOURCE
+CPPFLAGS += -Isrc/ares/config_cygwin
+LINKFLAGS+=
+UV_OS_FILE=uv-cygwin.c
+endif
+
+# Need _GNU_SOURCE for strdup?
+RUNNER_CFLAGS=$(CFLAGS) -D_GNU_SOURCE
+
+RUNNER_LINKFLAGS=$(LINKFLAGS) -pthread
+RUNNER_LIBS=
+RUNNER_SRC=test/runner-unix.c
+
+uv.a: src/uv-unix.o src/uv-common.o src/uv-platform.o src/ev/ev.o src/uv-eio.o src/eio/eio.o $(CARES_OBJS)
+       $(AR) rcs uv.a src/uv-unix.o src/uv-platform.o src/uv-common.o src/uv-eio.o src/ev/ev.o \
+               src/eio/eio.o $(CARES_OBJS)
+
+src/uv-platform.o: src/$(UV_OS_FILE) include/uv.h include/uv-unix.h
+       $(CC) $(CSTDFLAG) $(CPPFLAGS) $(CFLAGS) -c src/$(UV_OS_FILE) -o src/uv-platform.o
+
+src/uv-unix.o: src/uv-unix.c include/uv.h include/uv-unix.h
+       $(CC) $(CSTDFLAG) $(CPPFLAGS) -Ieio $(CFLAGS) -c src/uv-unix.c -o src/uv-unix.o
+
+src/uv-common.o: src/uv-common.c include/uv.h include/uv-unix.h
+       $(CC) $(CSTDFLAG) $(CPPFLAGS) $(CFLAGS) -c src/uv-common.c -o src/uv-common.o
+
+src/ev/ev.o: src/ev/ev.c
+       $(CC) $(CPPFLAGS) $(CFLAGS) -c src/ev/ev.c -o src/ev/ev.o -DEV_CONFIG_H=\"$(EV_CONFIG)\"
+
+
+EIO_CPPFLAGS += $(CPPFLAGS)
+EIO_CPPFLAGS += -DEIO_CONFIG_H=\"$(EIO_CONFIG)\"
+EIO_CPPFLAGS += -DEIO_STACKSIZE=262144
+EIO_CPPFLAGS += -D_GNU_SOURCE
+
+src/eio/eio.o: src/eio/eio.c
+       $(CC) $(EIO_CPPFLAGS) $(CFLAGS) -c src/eio/eio.c -o src/eio/eio.o
+
+src/uv-eio.o: src/uv-eio.c
+       $(CC) $(CPPFLAGS) -Isrc/eio/ $(CSTDFLAG) $(CFLAGS) -c src/uv-eio.c -o src/uv-eio.o
+
+
+clean-platform:
+       -rm -f src/ares/*.o
+       -rm -f src/ev/*.o
+       -rm -f src/eio/*.o
+       -rm -rf test/run-tests.dSYM run-benchmarks.dSYM
+
+distclean-platform:
+       -rm -f src/ares/*.o
+       -rm -f src/ev/*.o
+       -rm -f src/eio/*.o
+       -rm -rf test/run-tests.dSYM run-benchmarks.dSYM
index dc694743296d6759e4b50b4c37ace16e3b46d2c6..c8d1e018026fd73154b6faa78c59709dc100567f 100644 (file)
@@ -110,8 +110,6 @@ static void eio_destroy (eio_req *req);
 
 #ifdef _WIN32
 
-  #include <direct.h>
-
   #undef PAGESIZE
   #define PAGESIZE 4096 /* GetSystemInfo? */
 
@@ -142,9 +140,6 @@ static void eio_destroy (eio_req *req);
   #define statvfs(path,buf)    EIO_ENOSYS ()
   #define fstatvfs(fd,buf)     EIO_ENOSYS ()
 
-  #define getcwd(buf,s)        _getcwd(buf, s)
-  #define rmdir(path)          _rmdir(path)
-
   /* rename() uses MoveFile, which fails to overwrite */
   #define rename(old,neu)      eio__rename (old, neu)