Fixed building on OS X.

I got it to work on OS X 10.10.2 using clang.

Note: I'm an OS noob :)
This commit is contained in:
Torkel Bjørnson-Langen 2014-12-29 17:12:05 +01:00
parent 446e5fd665
commit 82af922b40
4 changed files with 23 additions and 9 deletions

View File

@ -22,7 +22,10 @@ else # win32
DAEMON_SRC += DaemonWin32.cpp
endif
all: $(SHLIB) $(I2PD)
all: mk_build_dir $(SHLIB) $(I2PD)
mk_build_dir:
test -d obj || mkdir obj
api: $(SHLIB)
@ -34,12 +37,10 @@ api: $(SHLIB)
## custom FLAGS to work at build-time.
deps:
@test -d obj || mkdir obj
$(CXX) $(CXXFLAGS) $(NEEDED_CXXFLAGS) -MM *.cpp > $(DEPS)
@sed -i -e '/\.o:/ s/^/obj\//' $(DEPS)
obj/%.o : %.cpp
@test -d obj || mkdir obj
$(CXX) $(CXXFLAGS) $(NEEDED_CXXFLAGS) $(INCFLAGS) $(CPU_FLAGS) -c -o $@ $<
# '-' is 'ignore if missing' on first run
@ -50,7 +51,7 @@ $(I2PD): $(patsubst %.cpp,obj/%.o,$(DAEMON_SRC))
$(SHLIB): $(patsubst %.cpp,obj/%.o,$(LIB_SRC))
ifneq ($(USE_STATIC),yes)
$(CXX) $(CXXFLAGS) $(NEEDED_CXXFLAGS) $(INCFLAGS) $(CPU_FLAGS) -shared -o $@ $^
$(CXX) $(LDFLAGS) $(LDLIBS) -shared -o $@ $^
endif
clean:

View File

@ -1,5 +1,6 @@
CXX = clang++
CXXFLAGS = -g -Wall -std=c++11 -lstdc++ -DCRYPTOPP_DISABLE_ASM
CXXFLAGS = -g -Wall -std=c++11 -DCRYPTOPP_DISABLE_ASM
#CXXFLAGS = -g -O2 -Wall -std=c++11 -DCRYPTOPP_DISABLE_ASM
INCFLAGS = -I/usr/local/include
LDFLAGS = -Wl,-rpath,/usr/local/lib -L/usr/local/lib
LDLIBS = -lcryptopp -lboost_system -lboost_date_time -lboost_filesystem -lboost_regex -lboost_program_options -lpthread
@ -12,6 +13,8 @@ ifeq ($(USE_AESNI),yes)
CXXFLAGS += -maes -DAESNI
endif
install: all
mkdir -p ${PREFIX}/
cp -r i2p ${PREFIX}/
# Disabled, since it will be the default make rule. I think its better
# to define the default rule in Makefile and not Makefile.<ostype> - torkel
#install: all
# test -d ${PREFIX} || mkdir -p ${PREFIX}/
# cp -r i2p ${PREFIX}/

View File

@ -21,7 +21,7 @@ Build Statuses
- Linux x64 - [![Build Status](https://jenkins.nordcloud.no/buildStatus/icon?job=i2pd-linux)](https://jenkins.nordcloud.no/job/i2pd-linux/)
- Linux ARM - To be added
- Mac OS X - To be added
- Mac OS X - Got it working, but not well tested. (Only works with clang, not GCC.)
- Microsoft VC13 - To be added

View File

@ -5,6 +5,16 @@ COMMON_SRC = \
TransitTunnel.cpp Transports.cpp Tunnel.cpp TunnelEndpoint.cpp TunnelPool.cpp \
TunnelGateway.cpp Destination.cpp util.cpp aes.cpp base64.cpp
ifeq ($(UNAME),Darwin)
# This is needed on OS X for some reason I don't understand (yet).
# Else will get linker error about unknown symbols. - torkel
COMMON_SRC += \
BOB.cpp ClientContext.cpp Daemon.cpp I2PTunnel.cpp SAM.cpp SOCKS.cpp \
UPnP.cpp HTTPServer.cpp HTTPProxy.cpp i2p.cpp DaemonLinux.cpp
endif
# also: Daemon{Linux,Win32}.cpp will be added later
DAEMON_SRC = $(COMMON_SRC) \
BOB.cpp ClientContext.cpp Daemon.cpp I2PTunnel.cpp SAM.cpp SOCKS.cpp UPnP.cpp \