Browse Source

compile i2psam in project without linking

pull/26/head
R4SAS 7 years ago
parent
commit
0e75bc7598
  1. 2
      src/i2psam/makefile.mingw
  2. 41
      src/makefile.bsd
  3. 42
      src/makefile.mingw
  4. 34
      src/makefile.osx
  5. 35
      src/makefile.unix

2
src/i2psam/makefile.mingw

@ -7,7 +7,7 @@ @@ -7,7 +7,7 @@
CC = gcc
CXX = g++
DEFINES = -D_MT -DWIN32 -D_WINDOWS -DBOOST_THREAD_USE_LIB -DBOOST_SPIRIT_THREADSAFE
DEFINES = -D_MT -DWIN32 -D_WINDOWS -DBOOST_THREAD_USE_LIB -DBOOST_SPIRIT_THREADSAFE
CFLAGS = -pipe -O2 -fPIC -Wall -W -D_REENTRANT $(DEFINES)
CXXFLAGS = -pipe -O2 -std=c++11 -fPIC -Wall -W -D_REENTRANT $(DEFINES)

41
src/makefile.bsd

@ -13,9 +13,9 @@ NEEDED_CXXFLAGS = -std=c++11 -D_GLIBCXX_USE_NANOSLEEP=1 @@ -13,9 +13,9 @@ NEEDED_CXXFLAGS = -std=c++11 -D_GLIBCXX_USE_NANOSLEEP=1
LINK:=$(CXX)
DEFS=-DBOOST_SPIRIT_THREADSAFE -DBOOST_NO_CXX11_SCOPED_ENUMS -D_FILE_OFFSET_BITS=64
DEFS=-DBOOST_SPIRIT_THREADSAFE -DBOOST_NO_CXX11_SCOPED_ENUMS -D_FILE_OFFSET_BITS=64 -DUSE_NATIVE_I2P
DEFS += $(addprefix -I,$(CURDIR) $(CURDIR)/obj $(BOOST_INCLUDE_PATH) $(BDB_INCLUDE_PATH) $(OPENSSL_INCLUDE_PATH))
DEFS += $(addprefix -I,$(CURDIR) $(CURDIR)/obj $(CURDIR)/i2psam $(BOOST_INCLUDE_PATH) $(BDB_INCLUDE_PATH) $(OPENSSL_INCLUDE_PATH))
LIBS = $(addprefix -L,$(BOOST_LIB_PATH) $(BDB_LIB_PATH) $(OPENSSL_LIB_PATH) /usr/local/lib /usr/local/lib/db5)
TESTDEFS = -DTEST_DATA_DIR=$(abspath test/data)
@ -53,8 +53,7 @@ endif @@ -53,8 +53,7 @@ endif
LIBS += \
-Wl,-B$(LMODE2) \
-l z \
-l pthread \
-l i2psam
-l pthread
# Hardening
# Make some classes of vulnerabilities unexploitable in case one is discovered.
@ -103,7 +102,6 @@ xCXXFLAGS = -std=c++11 -O2 -pthread -Wall -Wextra -Wformat -Wformat-security -Wn @@ -103,7 +102,6 @@ xCXXFLAGS = -std=c++11 -O2 -pthread -Wall -Wextra -Wformat -Wformat-security -Wn
xLDFLAGS=$(LDHARDENING) $(LDFLAGS)
OBJS = \
../i2psam/libi2psam.a \
leveldb/libleveldb.a \
obj/alert.o \
obj/version.o \
@ -116,6 +114,7 @@ OBJS = \ @@ -116,6 +114,7 @@ OBJS = \
obj/init.o \
obj/keystore.o \
obj/i2p.o \
obj/i2psam.o \
obj/Gost.o \
obj/main.o \
obj/net.o \
@ -138,13 +137,6 @@ OBJS = \ @@ -138,13 +137,6 @@ OBJS = \
obj/leveldb.o \
obj/txdb.o
ifdef USE_SSE2
DEFS += -DUSE_SSE2
OBJS_SSE2= obj/scrypt-sse2.o
OBJS += $(OBJS_SSE2)
endif
all: gostcoind
test check: test_gostcoin FORCE
@ -160,12 +152,6 @@ DEFS += $(addprefix -I,$(CURDIR)/leveldb/helpers) @@ -160,12 +152,6 @@ DEFS += $(addprefix -I,$(CURDIR)/leveldb/helpers)
leveldb/libleveldb.a:
@echo "Building LevelDB ..." && cd leveldb && $(MAKE) CC=$(CC) CXX=$(CXX) OPT="$(xCXXFLAGS)" libleveldb.a libmemenv.a && cd ..
# I2P Support
LIBS += -L"../i2psam"
DEFS += -DUSE_NATIVE_I2P -I"../i2psam"
../i2psam/libi2psam.a:
@echo "Building libi2psam ..." && cd ../i2psam && $(MAKE) -f makefile.unix && cd ../src
# auto-generated dependencies:
-include obj/*.P
-include obj-test/*.P
@ -175,14 +161,14 @@ obj/build.h: FORCE @@ -175,14 +161,14 @@ obj/build.h: FORCE
version.cpp: obj/build.h
DEFS += -DHAVE_BUILD_INFO
obj/%-sse2.o: %-sse2.cpp
$(CXX) -c $(xCXXFLAGS) -msse2 -MMD -MF $(@:%.o=%.d) -o $@ $<
obj/%.o: %.cpp
$(CXX) -c $(xCXXFLAGS) -MMD -MF $(@:%.o=%.d) -o $@ $<
@cp $(@:%.o=%.d) $(@:%.o=%.P); \
sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \
-e '/^$$/ d' -e 's/$$/ :/' < $(@:%.o=%.d) >> $(@:%.o=%.P); \
rm -f $(@:%.o=%.d)
obj/%.o: %.cpp
obj/%.o: i2psam/%.cpp
$(CXX) -c $(xCXXFLAGS) -MMD -MF $(@:%.o=%.d) -o $@ $<
@cp $(@:%.o=%.d) $(@:%.o=%.P); \
sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \
@ -205,13 +191,12 @@ test_gostcoin: $(TESTOBJS) $(filter-out obj/init.o,$(OBJS:obj/%=obj/%)) @@ -205,13 +191,12 @@ test_gostcoin: $(TESTOBJS) $(filter-out obj/init.o,$(OBJS:obj/%=obj/%))
$(LINK) $(xCXXFLAGS) -o $@ $(LIBPATHS) $^ $(TESTLIBS) $(xLDFLAGS) $(LIBS)
clean:
-rm -f gostcoind test_gostcoin
-rm -f obj/*.o
-rm -f obj-test/*.o
-rm -f obj/*.P
-rm -f obj-test/*.P
-rm -f obj/build.h
-cd ../i2psam && $(MAKE) -f makefile.unix clean || true
$(RM) -f gostcoind test_gostcoin
$(RM) -f obj/*.o
$(RM) -f obj-test/*.o
$(RM) -f obj/*.P
$(RM) -f obj-test/*.P
$(RM) -f obj/build.h
-cd leveldb && $(MAKE) clean || true
FORCE:

42
src/makefile.mingw

@ -31,8 +31,7 @@ INCLUDEPATHS= \ @@ -31,8 +31,7 @@ INCLUDEPATHS= \
LIBPATHS= \
-L"$(CURDIR)/leveldb" \
-L"$(DEPSDIR)/lib" \
-L"i2psam"
-L"$(DEPSDIR)/lib"
LIBS= \
-lleveldb \
@ -44,16 +43,15 @@ LIBS= \ @@ -44,16 +43,15 @@ LIBS= \
-lboost_chrono$(BOOST_SUFFIX) \
-ldb_cxx \
-lssl \
-lcrypto \
-li2psam
-lcrypto
DEFS=-D_MT -DWIN32 -D_WINDOWS -DWIN32_LEAN_AND_MEAN -DBOOST_THREAD_USE_LIB -DBOOST_SPIRIT_THREADSAFE
DEFS=-D_MT -DWIN32 -D_WINDOWS -DWIN32_LEAN_AND_MEAN -DBOOST_THREAD_USE_LIB -DBOOST_SPIRIT_THREADSAFE -DUSE_NATIVE_I2P
ifneq (${USE_DEBUG}, 0)
DEBUGFLAGS=-g
endif
CFLAGS=-mthreads -O2 -w -Wall -Wextra -Wformat -Wformat-security -Wno-unused-parameter $(DEBUGFLAGS) $(DEFS) $(INCLUDEPATHS)
CFLAGS=-mthreads -O2 -fPIC -w -Wall -Wextra -Wformat -Wformat-security -Wno-unused-parameter $(DEBUGFLAGS) $(DEFS) $(INCLUDEPATHS)
# enable: ASLR, DEP and large address aware
LDFLAGS=-Wl,--dynamicbase -Wl,--nxcompat -Wl,--large-address-aware -Wl,-Bstatic -Wl,-rpath,/usr/local/lib -L/usr/local/lib -static-libgcc -static-libstdc++
@ -65,11 +63,9 @@ endif @@ -65,11 +63,9 @@ endif
LIBS += -lstdc++ -lmingwthrd -lkernel32 -luser32 -lgdi32 -lcomdlg32 -lwinspool -lwinmm -lshell32 -lcomctl32 -lole32 -loleaut32 -luuid -lrpcrt4 -ladvapi32 -lws2_32 -lmswsock -lshlwapi -lpthread
# TODO: make the mingw builds smarter about dependencies, like the linux/osx builds are
HEADERS = $(wildcard *.h)
HEADERS = $(wildcard *.h) $(wildcard i2psam/*.h)
OBJS= \
i2psam/libi2psam.a \
leveldb/libleveldb.a \
obj/alert.o \
obj/version.o \
@ -82,6 +78,7 @@ OBJS= \ @@ -82,6 +78,7 @@ OBJS= \
obj/init.o \
obj/keystore.o \
obj/i2p.o \
obj/i2psam.o \
obj/main.o \
obj/net.o \
obj/protocol.o \
@ -105,12 +102,6 @@ OBJS= \ @@ -105,12 +102,6 @@ OBJS= \
obj/Gost.o \
obj/resources.o
ifdef USE_SSE2
DEFS += -DUSE_SSE2
OBJS_SSE2= obj/scrypt-sse2.o
OBJS += $(OBJS_SSE2)
endif
all: gostcoind.exe
test check: test_gostcoin.exe FORCE
@ -125,22 +116,16 @@ DEFS += $(addprefix -I,$(CURDIR)/leveldb/helpers) @@ -125,22 +116,16 @@ DEFS += $(addprefix -I,$(CURDIR)/leveldb/helpers)
leveldb/libleveldb.a:
cd leveldb && $(MAKE) CC=$(CC) CXX=$(CXX) OPT="$(CFLAGS)" TARGET_OS=NATIVE_WINDOWS libleveldb.a libmemenv.a && cd ..
# I2P Support
DEFS += -DUSE_NATIVE_I2P
i2psam/libi2psam.a:
cd i2psam && $(MAKE) -f makefile.mingw && cd ..
obj/build.h: FORCE
/bin/sh ../share/genbuild.sh obj/build.h
version.cpp: obj/build.h
DEFS += -DHAVE_BUILD_INFO
INCLUDEPATHS += -I"obj"
obj/%-sse2.o: %-sse2.cpp
$(CXX) -c $(CFLAGS) -msse2 -mstackrealign -o $@ $<
obj/%.o: %.cpp
$(CXX) -c $(CFLAGS) -o $@ $<
obj/%.o: %.cpp $(HEADERS)
obj/%.o: i2psam/%.cpp
$(CXX) -c $(CFLAGS) -o $@ $<
obj/%.o : %.rc
@ -151,17 +136,16 @@ gostcoind.exe: $(OBJS:obj/%=obj/%) @@ -151,17 +136,16 @@ gostcoind.exe: $(OBJS:obj/%=obj/%)
TESTOBJS := $(patsubst test/%.cpp,obj-test/%.o,$(wildcard test/*.cpp))
obj-test/%.o: test/%.cpp $(HEADERS)
obj-test/%.o: test/%.cpp
$(CXX) -c $(TESTDEFS) $(CFLAGS) -o $@ $<
test_gostcoin.exe: $(TESTOBJS) $(filter-out obj/init.o,$(OBJS:obj/%=obj/%))
$(CXX) $(CFLAGS) $(LDFLAGS) -o $@ $(LIBPATHS) $^ -lboost_unit_test_framework$(BOOST_SUFFIX) $(LIBS)
clean:
rm -f gostcoind.exe test_gostcoin.exe
rm -f obj/*
rm -f obj-test/*
$(RM) -f gostcoind.exe test_gostcoin.exe
$(RM) -f obj/*
$(RM) -f obj-test/*
cd leveldb && $(MAKE) TARGET_OS=NATIVE_WINDOWS clean && cd ..
cd i2psam && $(MAKE) -f makefile.mingw clean && cd ..
FORCE:

34
src/makefile.osx vendored

@ -19,7 +19,6 @@ INCLUDEPATHS= \ @@ -19,7 +19,6 @@ INCLUDEPATHS= \
LIBPATHS= \
-L"$(DEPSDIR)/lib" \
-L"$(DEPSDIR)/lib/db48" \
-L"i2psam"
USE_UPNP:=1
USE_IPV6:=1
@ -54,12 +53,11 @@ LIBS += \ @@ -54,12 +53,11 @@ LIBS += \
-lboost_chrono-mt \
-lssl \
-lcrypto \
-lz \
-li2psam
-lz
TESTDEFS += -DBOOST_TEST_DYN_LINK
endif
DEFS=-DMAC_OSX -DMSG_NOSIGNAL=0 -DBOOST_SPIRIT_THREADSAFE
DEFS=-DMAC_OSX -DMSG_NOSIGNAL=0 -DBOOST_SPIRIT_THREADSAFE -DUSE_NATIVE_I2P
ifdef RELEASE
# Compile for maximum compatibility and smallest size.
@ -75,7 +73,6 @@ CFLAGS += -Wall -Wextra -Wformat -Wformat-security -Wno-unused-parameter \ @@ -75,7 +73,6 @@ CFLAGS += -Wall -Wextra -Wformat -Wformat-security -Wno-unused-parameter \
$(DEBUGFLAGS) $(DEFS) $(INCLUDEPATHS)
OBJS= \
i2psam/libi2psam.a \
leveldb/libleveldb.a \
obj/alert.o \
obj/version.o \
@ -89,6 +86,7 @@ OBJS= \ @@ -89,6 +86,7 @@ OBJS= \
obj/keystore.o \
obj/irc.o \
obj/i2p.o \
obj/i2psam.o \
obj/main.o \
obj/net.o \
obj/protocol.o \
@ -141,13 +139,6 @@ DEFS += $(addprefix -I,$(CURDIR)/leveldb/helpers) @@ -141,13 +139,6 @@ DEFS += $(addprefix -I,$(CURDIR)/leveldb/helpers)
leveldb/libleveldb.a:
@echo "Building LevelDB ..." && cd leveldb && $(MAKE) CC=$(CC) CXX=$(CXX) OPT="$(CFLAGS)" libleveldb.a libmemenv.a && cd ..
# I2P Support
LIBS += -L"i2psam"
DEFS += -DUSE_NATIVE_I2P -I"i2psam"
i2psam/libi2psam.a:
@echo "Building libi2psam ..." && cd i2psam && $(MAKE) -f makefile.unix && cd ..
# auto-generated dependencies:
-include obj/*.P
-include obj-test/*.P
@ -157,14 +148,14 @@ obj/build.h: FORCE @@ -157,14 +148,14 @@ obj/build.h: FORCE
version.cpp: obj/build.h
DEFS += -DHAVE_BUILD_INFO
obj/%-sse2.o: %-sse2.cpp
$(CXX) -c $(CFLAGS) -msse2 -MMD -MF $(@:%.o=%.d) -o $@ $<
obj/%.o: %.cpp
$(CXX) -c $(CFLAGS) -MMD -MF $(@:%.o=%.d) -o $@ $<
@cp $(@:%.o=%.d) $(@:%.o=%.P); \
sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \
-e '/^$$/ d' -e 's/$$/ :/' < $(@:%.o=%.d) >> $(@:%.o=%.P); \
rm -f $(@:%.o=%.d)
obj/%.o: %.cpp
obj/%.o: i2psam/%.cpp
$(CXX) -c $(CFLAGS) -MMD -MF $(@:%.o=%.d) -o $@ $<
@cp $(@:%.o=%.d) $(@:%.o=%.P); \
sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \
@ -187,13 +178,12 @@ test_gostcoin: $(TESTOBJS) $(filter-out obj/init.o,$(OBJS:obj/%=obj/%)) @@ -187,13 +178,12 @@ test_gostcoin: $(TESTOBJS) $(filter-out obj/init.o,$(OBJS:obj/%=obj/%))
$(CXX) $(CFLAGS) -o $@ $(LIBPATHS) $^ $(LIBS) $(TESTLIBS)
clean:
-rm -f gostcoind test_gostcoin
-rm -f obj/*.o
-rm -f obj-test/*.o
-rm -f obj/*.P
-rm -f obj-test/*.P
-rm -f obj/build.h
-cd i2psam && $(MAKE) -f makefile.unix clean || true
$(RM) -f gostcoind test_gostcoin
$(RM) -f obj/*.o
$(RM) -f obj-test/*.o
$(RM) -f obj/*.P
$(RM) -f obj-test/*.P
$(RM) -f obj/build.h
-cd leveldb && $(MAKE) clean || true
FORCE:

35
src/makefile.unix

@ -9,9 +9,9 @@ USE_DEBUG:=0 @@ -9,9 +9,9 @@ USE_DEBUG:=0
LINK:=$(CXX)
DEFS=-DBOOST_SPIRIT_THREADSAFE -DBOOST_NO_CXX11_SCOPED_ENUMS -D_FILE_OFFSET_BITS=64
DEFS=-DBOOST_SPIRIT_THREADSAFE -DBOOST_NO_CXX11_SCOPED_ENUMS -D_FILE_OFFSET_BITS=64 -DUSE_NATIVE_I2P
DEFS += $(addprefix -I,$(CURDIR) $(CURDIR)/obj $(BOOST_INCLUDE_PATH) $(BDB_INCLUDE_PATH) $(OPENSSL_INCLUDE_PATH))
DEFS += $(addprefix -I,$(CURDIR) $(CURDIR)/obj $(CURDIR)/i2psam $(BOOST_INCLUDE_PATH) $(BDB_INCLUDE_PATH) $(OPENSSL_INCLUDE_PATH))
LIBS = $(addprefix -L,$(BOOST_LIB_PATH) $(BDB_LIB_PATH) $(OPENSSL_LIB_PATH))
TESTDEFS = -DTEST_DATA_DIR=$(abspath test/data)
@ -50,8 +50,7 @@ LIBS += \ @@ -50,8 +50,7 @@ LIBS += \
-Wl,-B$(LMODE2) \
-lz \
-ldl \
-lpthread \
-li2psam
-lpthread
# Hardening
# Make some classes of vulnerabilities unexploitable in case one is discovered.
@ -100,7 +99,6 @@ xCXXFLAGS = -std=c++11 -O2 -pthread -Wall -Wextra -Wformat -Wformat-security -Wn @@ -100,7 +99,6 @@ xCXXFLAGS = -std=c++11 -O2 -pthread -Wall -Wextra -Wformat -Wformat-security -Wn
xLDFLAGS=$(LDHARDENING) $(LDFLAGS)
OBJS = \
i2psam/libi2psam.a \
leveldb/libleveldb.a \
obj/alert.o \
obj/version.o \
@ -113,6 +111,7 @@ OBJS = \ @@ -113,6 +111,7 @@ OBJS = \
obj/init.o \
obj/keystore.o \
obj/i2p.o \
obj/i2psam.o \
obj/Gost.o \
obj/main.o \
obj/net.o \
@ -151,13 +150,6 @@ DEFS += $(addprefix -I,$(CURDIR)/leveldb/helpers) @@ -151,13 +150,6 @@ DEFS += $(addprefix -I,$(CURDIR)/leveldb/helpers)
leveldb/libleveldb.a:
@echo "Building LevelDB ..." && cd leveldb && $(MAKE) CC=$(CC) CXX=$(CXX) OPT="$(xCXXFLAGS)" libleveldb.a libmemenv.a && cd ..
# I2P Support
LIBS += -L"i2psam"
DEFS += -DUSE_NATIVE_I2P -I"i2psam"
i2psam/libi2psam.a:
@echo "Building libi2psam ..." && cd i2psam && $(MAKE) -f makefile.unix && cd ..
# auto-generated dependencies:
-include obj/*.P
-include obj-test/*.P
@ -169,14 +161,14 @@ version.cpp: obj/build.h @@ -169,14 +161,14 @@ version.cpp: obj/build.h
DEFS += -DHAVE_BUILD_INFO
obj/%-sse2.o: %-sse2.cpp
$(CXX) -c $(xCXXFLAGS) -msse2 -MMD -MF $(@:%.o=%.d) -o $@ $<
obj/%.o: %.cpp
$(CXX) -c $(xCXXFLAGS) -MMD -MF $(@:%.o=%.d) -o $@ $<
@cp $(@:%.o=%.d) $(@:%.o=%.P); \
sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \
-e '/^$$/ d' -e 's/$$/ :/' < $(@:%.o=%.d) >> $(@:%.o=%.P); \
rm -f $(@:%.o=%.d)
obj/%.o: %.cpp
obj/%.o: i2psam/%.cpp
$(CXX) -c $(xCXXFLAGS) -MMD -MF $(@:%.o=%.d) -o $@ $<
@cp $(@:%.o=%.d) $(@:%.o=%.P); \
sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \
@ -199,13 +191,12 @@ test_gostcoin: $(TESTOBJS) $(filter-out obj/init.o,$(OBJS:obj/%=obj/%)) @@ -199,13 +191,12 @@ test_gostcoin: $(TESTOBJS) $(filter-out obj/init.o,$(OBJS:obj/%=obj/%))
$(LINK) $(xCXXFLAGS) -o $@ $(LIBPATHS) $^ $(TESTLIBS) $(xLDFLAGS) $(LIBS)
clean:
-rm -f gostcoind test_gostcoin
-rm -f obj/*.o
-rm -f obj-test/*.o
-rm -f obj/*.P
-rm -f obj-test/*.P
-rm -f obj/build.h
-cd i2psam && $(MAKE) -f makefile.unix clean || true
$(RM) -f gostcoind test_gostcoin
$(RM) -f obj/*.o
$(RM) -f obj-test/*.o
$(RM) -f obj/*.P
$(RM) -f obj-test/*.P
$(RM) -f obj/build.h
-cd leveldb && $(MAKE) clean || true
FORCE:

Loading…
Cancel
Save