From 08e93ebe3654874bd93c43b8ce1d192390966692 Mon Sep 17 00:00:00 2001 From: adam Date: Thu, 8 Nov 2012 17:49:50 +0200 Subject: [PATCH] ticket #2 fixed --- .gitignore | 3 +++ binding.gyp | 20 ++++++++++++++++++-- node/ejdb_logging.cc | 3 +-- node/ejdb_native.cc | 3 +-- tcejdb/Makefile.in | 6 ++++-- tcejdb/testejdb/Makefile | 4 ++-- 6 files changed, 29 insertions(+), 10 deletions(-) diff --git a/.gitignore b/.gitignore index 0ffc6d3..aaf8ee5 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,6 @@ *.o *.vlog +*.dylib /npm-debug.log /.idea/workspace.xml @@ -32,7 +33,9 @@ /tcejdb/tcumttest /tcejdb/tcutest /tcejdb/tcejdb.pc + /tcejdb/nbproject/private +/tcejdb/static /tcejdb/check.in /tcejdb/check.out /tcejdb/casket* diff --git a/binding.gyp b/binding.gyp index 25f658c..fef6eb3 100644 --- a/binding.gyp +++ b/binding.gyp @@ -29,10 +29,26 @@ '-L../tcejdb', '-Wl,-Bstatic -ltcejdb', '-Wl,-Bdynamic', - '-lz -lrt -lpthread -lm -lc' + '-lz -lpthread -lm -lc' ] }], - ], + [ 'OS=="mac"', { + 'defines': ['_DARWIN_USE_64_BIT_INODE=1'], + 'cflags': [ '-Wall', '-pedantic'], + 'cflags_cc!' : [ '-fno-exceptions' ], + 'xcode_settings': { + 'GCC_ENABLE_CPP_EXCEPTIONS':'YES', + 'OTHER_CFLAGS': [ + '-fsigned-char', '-pthread', '-Wno-variadic-macros', '-fexceptions' + ], + 'OTHER_LDFLAGS': [ + '-Wl,-search_paths_first', + '-L./tcejdb/static', + '-ltcejdb -lz -lpthread -lm -lc' + ] + } + }] + ], 'include_dirs' : ['tcejdb'], }, diff --git a/node/ejdb_logging.cc b/node/ejdb_logging.cc index c4ba7ed..9b92df1 100644 --- a/node/ejdb_logging.cc +++ b/node/ejdb_logging.cc @@ -30,8 +30,7 @@ static void __funlockfile(FILE *stream) { UnlockFile(hf, 0, 0, li.LowPart, li.HighPart); } #endif -#ifdef __unix - +#if defined __unix || defined __APPLE__ static void __flockfile(FILE *stream) { flockfile(stream); } diff --git a/node/ejdb_native.cc b/node/ejdb_native.cc index e5cda4f..8f5dcfd 100644 --- a/node/ejdb_native.cc +++ b/node/ejdb_native.cc @@ -11,9 +11,8 @@ #include #include -#include #include - +#include using namespace node; using namespace v8; diff --git a/tcejdb/Makefile.in b/tcejdb/Makefile.in index c5513bc..4d2bc23 100644 --- a/tcejdb/Makefile.in +++ b/tcejdb/Makefile.in @@ -87,7 +87,7 @@ all : $(LIBRARYFILES) $(COMMANDFILES) $(CGIFILES) clean : - rm -rf $(LIBRARYFILES) $(LIBOBJFILES) $(COMMANDFILES) $(CGIFILES) \ + rm -rf $(LIBRARYFILES) $(LIBOBJFILES) $(COMMANDFILES) $(CGIFILES) static \ *.o a.out tokyocabinet_all.c check.in check.out gmon.out *.vlog words.tsv \ casket casket-* casket.* *.tch *.tcb *.tcf *.tct *.idx.* *.wal *~ hoge moge tako ika make -C ./testejdb clean @@ -672,7 +672,7 @@ wordtable : ./tctmgr importtsv casket words.tsv -.PHONY : all clean install check +.PHONY : all clean install check check-ejdb @@ -683,6 +683,8 @@ wordtable : libtcejdb.a : $(LIBOBJFILES) $(AR) $(ARFLAGS) $@ $(LIBOBJFILES) + mkdir -p ./static + cp ./libtcejdb.a ./static libtcejdb.so.$(LIBVER).$(LIBREV).0 : $(LIBOBJFILES) diff --git a/tcejdb/testejdb/Makefile b/tcejdb/testejdb/Makefile index f3d54c6..f4d6830 100644 --- a/tcejdb/testejdb/Makefile +++ b/tcejdb/testejdb/Makefile @@ -4,8 +4,8 @@ CPPFLAGS = -I. -I.. -DDEBUG -D_DEBUG -D_GNU_SOURCE=1 -D_REENTRANT -D__EXTENSIONS CFLAGS = -std=c99 -Wall -fPIC -pedantic -fsigned-char -g -O0 LDFLAGS = -L. -L.. CMDLDFLAGS = -LIBS = -lz -lrt -lpthread -lm -lc -lcunit -RUNENV = LD_LIBRARY_PATH=.:.. +LIBS = -lz -lpthread -lm -lc -lcunit +RUNENV = LD_LIBRARY_PATH=.:..;DYLD_LIBRARY_PATH=.:.. TESTS = t1 t2 t3 -- 2.7.4