Skip to content

Commit

Permalink
Merge pull request #37 from seclorum/master
Browse files Browse the repository at this point in the history
Simple changes to be homebrew friendly
  • Loading branch information
pakozm committed Dec 7, 2014
2 parents 4177bdc + a769ae8 commit 1d46196
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 6 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Linux:
@make -f Makefile.linux

Darwin:
@make -f Makefile.macports
@make -f Makefile.darwin

clean:
$(RM) $(OBJS) $(OUTLIB)
Expand Down
30 changes: 26 additions & 4 deletions Makefile.macports → Makefile.darwin
Original file line number Diff line number Diff line change
@@ -1,22 +1,44 @@

# macports
ifneq ("$(wildcard /opt/local/include/mongo/client/dbclient.h)","")
MONGO_INCLUDE_DIR=/opt/local/include/mongo/
MONGO_LIB_DIR=/opt/local/lib
endif

# homebrew
ifneq ("$(wildcard /usr/local/include/mongo/client/dbclient.h)","")
MONGO_INCLUDE_DIR=/usr/local/include/mongo/
MONGO_LIB_DIR=/usr/local/lib
endif

.PHONY: checklib

CC= g++
CFLAGS= -Wall -g -O2 -fPIC `pkg-config --cflags "lua >= 5.2"` -I/opt/local/include/mongo/
CFLAGS= -Wall -g -O2 -fPIC `pkg-config --cflags "lua >= 5.2"` -I$(MONGO_INCLUDE_DIR)
AR= ar rcu
RANLIB= ranlib
RM= rm -f
LIBS=`pkg-config --libs "lua >= 5.2"` -lmongoclient -lssl -lboost_thread-mt -lboost_filesystem-mt -flat_namespace -bundle -L/opt/local/lib -rdynamic
LIBS=`pkg-config --libs "lua >= 5.2"` -lmongoclient -lssl -lboost_thread-mt -lboost_filesystem-mt -flat_namespace -bundle -L$(MONGO_LIB_DIR) -rdynamic
OUTLIB=mongo.so

LDFLAGS= $(LIBS)

OBJS = main.o mongo_bsontypes.o mongo_dbclient.o mongo_replicaset.o mongo_connection.o mongo_cursor.o mongo_gridfile.o mongo_gridfs.o mongo_gridfschunk.o mongo_query.o utils.o mongo_cxx_extension.o mongo_gridfilebuilder.o

all: luamongo
all: checklib luamongo

checklib:
ifeq ("$(MONGO_LIB_DIR)", "")
@echo "To build luamongo on Darwin, you must have either ports or homebrew (preferred) installed!"
exit 1
endif


clean:
$(RM) $(OBJS) $(OUTLIB)

luamongo: $(OBJS)
$(CC) $(CFLAGS) $(OBJS) -o $(OUTLIB) $(LDFLAGS)
$(CC) $(CFLAGS) $(LDFLAGS) $(OBJS) -o $(OUTLIB)

echo:
@echo "CC = $(CC)"
Expand Down
2 changes: 1 addition & 1 deletion rockspec/luamongo-scm-0.rockspec
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ external_dependencies = {
library = "ssl",
},
LIBBOOST_THREAD = {
library = "boost_thread",
library = "boost_thread-mt",
},
LIBBOOST_FILESYSTEM = {
library = "boost_filesystem",
Expand Down

0 comments on commit 1d46196

Please sign in to comment.