Aurel Bílý 6 anos atrás
pai
commit
b5ab085cb8
7 arquivos alterados com 45 adições e 50 exclusões
  1. 2 2
      Makefile
  2. 0 35
      libs/libuv/Makefile
  3. 29 0
      libs/uv/Makefile
  4. BIN
      libs/uv/test
  5. 14 13
      libs/uv/test.ml
  6. 0 0
      libs/uv/uv.ml
  7. 0 0
      libs/uv/uv_stubs.c

+ 2 - 2
Makefile

@@ -47,9 +47,9 @@ HAXE_VERSION=$(shell $(CURDIR)/$(HAXE_OUTPUT) -version 2>&1 | awk '{print $$1;}'
 HAXE_VERSION_SHORT=$(shell echo "$(HAXE_VERSION)" | grep -oE "^[0-9]+\.[0-9]+\.[0-9]+")
 HAXE_VERSION_SHORT=$(shell echo "$(HAXE_VERSION)" | grep -oE "^[0-9]+\.[0-9]+\.[0-9]+")
 
 
 ifneq ($(STATICLINK),0)
 ifneq ($(STATICLINK),0)
-	LIB_PARAMS= -cclib '-Wl,-Bstatic -lpcre -lz -Wl,-Bdynamic '
+	LIB_PARAMS= -cclib '-Wl,-Bstatic -lpcre -lz -luv -Wl,-Bdynamic '
 else
 else
-	LIB_PARAMS?= -cclib -lpcre -cclib -lz
+	LIB_PARAMS?= -cclib -lpcre -cclib -lz -cclib -luv
 endif
 endif
 
 
 all: haxe tools
 all: haxe tools

+ 0 - 35
libs/libuv/Makefile

@@ -1,35 +0,0 @@
-ALL_CFLAGS = $(CFLAGS)
-OCAMLOPT=ocamlopt
-OCAMLC=ocamlc
-SRC = libuv.ml libuv_stubs.c test.ml
-
-all: bytecode test #native
-
-bytecode: libuv.cma
-
-#native: libuv.cmxa
-
-test: test.ml libuv.ml
-	ocamlfind $(OCAMLC) -o test -safe-string -package extlib libuv_stubs.c libuv.ml test.ml -dllib dlllibuv_stubs.so
-
-libuv.cma: libuv_stubs.so libuv.ml
-	ocamlfind $(OCAMLC) -safe-string -a -o libuv.cma libuv.ml -dllib dlllibuv_stubs.so
-
-#libuv.cmxa: libuv_stubs.so libuv.ml
-#	ocamlfind $(OCAMLOPT) -safe-string -a -o libuv.cmxa libuv.ml -dllib dlllibuv_stubs.so
-
-libuv_stubs.o: libuv_stubs.c
-	ocamlfind $(OCAMLC) -o libuv_stubs -safe-string $(ALL_CFLAGS) libuv_stubs.c
-
-libuv_stubs.so: libuv_stubs.o
-	ocamlfind ocamlmklib -o libuv_stubs $(ALL_CFLAGS) libuv_stubs.o -luv
-
-clean:
-	rm -f libuv.cma libuv.cmi libuv.cmx libuv.cmxa libuv.o libuv.obj libuv.lib libuv_stubs.obj libuv_stubs.o
-	rm -f libuv.a liblibuv.a liblibuv.lib libuv.cmo
-	rm -f test.cmi test.cmx test.cmo test
-	rm -f dlllibuv_stubs.so dlllibuv_stubs.a liblibuv_stubs.so liblibuv_stubs.a
-
-.PHONY: all bytecode clean # native
-Makefile: ;
-$(SRC): ;

+ 29 - 0
libs/uv/Makefile

@@ -0,0 +1,29 @@
+ALL_CFLAGS = $(CFLAGS)
+OCAMLOPT=ocamlopt
+OCAMLC=ocamlc
+SRC = uv.ml uv_stubs.c test.ml
+
+all: bytecode native test
+
+bytecode: uv.cma
+
+native: uv.cmxa
+
+test: test.ml uv.ml uv.cmxa uv_stubs.o
+	ocamlfind $(OCAMLOPT) -o test -safe-string -package extlib -cclib uv_stubs.o -cclib -luv uv.cmxa test.ml
+
+uv.cma: uv_stubs.o uv.ml
+	ocamlfind $(OCAMLC) -safe-string -a -o uv.cma uv.ml
+
+uv.cmxa: uv_stubs.o uv.ml
+	ocamlfind $(OCAMLOPT) -safe-string -a -o uv.cmxa uv.ml
+
+uv_stubs.o: uv_stubs.c
+	ocamlfind $(OCAMLC) -safe-string $(ALL_CFLAGS) uv_stubs.c
+
+clean:
+	rm -f test $(wildcard *.cmo) $(wildcard *.cma)  $(wildcard *.cmx) $(wildcard *.cmxa) $(wildcard *.a) $(wildcard *.obj) $(wildcard *.o) $(wildcard *.cmi)
+
+.PHONY: all bytecode native clean
+Makefile: ;
+$(SRC): ;

BIN
libs/uv/test


+ 14 - 13
libs/libuv/test.ml → libs/uv/test.ml

@@ -1,36 +1,37 @@
-open Libuv
+open Uv
 
 
 ;;
 ;;
 
 
-let loop = Libuv.loop_init () in
+print_string "init loop...\n"; flush_all ();
+let loop = Uv.loop_init () in
 (*let cb_c () = print_string "closed\n" in
 (*let cb_c () = print_string "closed\n" in
-let cb file = print_string "hey I got a file I guess\n"; flush_all (); Libuv.fs_close loop file cb_c in*)
+let cb file = print_string "hey I got a file I guess\n"; flush_all (); Uv.fs_close loop file cb_c in*)
 let cb file =
 let cb file =
 	print_string "hey I got a file I guess\n"; flush_all ();
 	print_string "hey I got a file I guess\n"; flush_all ();
-	let stat = Libuv.fs_fstat_sync loop file in
+	let stat = Uv.fs_fstat_sync loop file in
 	print_string ("length: " ^ (Int64.to_string stat.size) ^ "\n"); flush_all ();
 	print_string ("length: " ^ (Int64.to_string stat.size) ^ "\n"); flush_all ();
-	Libuv.fs_close_sync loop file;
+	Uv.fs_close_sync loop file;
 	print_string "closed\n"; flush_all ();
 	print_string "closed\n"; flush_all ();
 in
 in
 print_string "open files...\n"; flush_all ();
 print_string "open files...\n"; flush_all ();
-Libuv.fs_open loop "libuv.ml" 0 511 cb;
-Libuv.fs_open loop "Makefile" 0 511 cb;
+Uv.fs_open loop "uv.ml" 0 511 cb;
+Uv.fs_open loop "Makefile" 0 511 cb;
 print_string "sync open...\n"; flush_all ();
 print_string "sync open...\n"; flush_all ();
-let other_file = Libuv.fs_open_sync loop "Makefile" 0 511 in
+let other_file = Uv.fs_open_sync loop "Makefile" 0 511 in
 print_string "run gc...\n"; flush_all ();
 print_string "run gc...\n"; flush_all ();
 Gc.full_major ();
 Gc.full_major ();
-Libuv.fs_close_sync loop other_file;
+Uv.fs_close_sync loop other_file;
 print_string "scandir...\n"; flush_all ();
 print_string "scandir...\n"; flush_all ();
-let dirs = Libuv.fs_scandir_sync loop "." 0 in
+let dirs = Uv.fs_scandir_sync loop "." 0 in
 let rec pdirs = function
 let rec pdirs = function
 	| [] -> ()
 	| [] -> ()
 	| (name, kind) :: rest -> print_string ("entry: " ^ name ^ "\n"); pdirs rest
 	| (name, kind) :: rest -> print_string ("entry: " ^ name ^ "\n"); pdirs rest
 in
 in
 pdirs dirs;
 pdirs dirs;
 print_string "run loop...\n"; flush_all ();
 print_string "run loop...\n"; flush_all ();
-while (Libuv.loop_alive loop) do
-	ignore (Libuv.run loop 0)
+while (Uv.loop_alive loop) do
+	ignore (Uv.run loop 0)
 done;
 done;
 print_string "close loop...\n"; flush_all ();
 print_string "close loop...\n"; flush_all ();
-Libuv.loop_close loop;
+Uv.loop_close loop;
 print_string "done\n"
 print_string "done\n"

+ 0 - 0
libs/libuv/libuv.ml → libs/uv/uv.ml


+ 0 - 0
libs/libuv/libuv_stubs.c → libs/uv/uv_stubs.c