Skip to content

Commit 5f30a3e

Browse files
authored
Merge pull request #569 from XDagger/pre_release_031
Pre release 031
2 parents 48639a5 + 3155158 commit 5f30a3e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

106 files changed

+7167
-1775
lines changed

.gitignore

+5
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# MSVC build stuff
22
Release/
33
Debug/
4+
build/
45
.vs/
56

67
/win/xdag.VC.db
@@ -35,3 +36,7 @@ xdag
3536
/client/dnet_key.dat
3637
/client/storage
3738
/client/wallet.dat
39+
40+
# Mac OS
41+
*.DS_Store
42+
client/xdag.dSYM

CMakeLists.txt

+127
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,127 @@
1+
cmake_minimum_required(VERSION 3.2)
2+
project(xdag)
3+
4+
# Use a different compiler
5+
# http://www.cmake.org/Wiki/CMake_FAQ#How_do_I_use_a_different_compiler.3F
6+
# it must be done before any language is set (before project|enable_language command)
7+
# set(CMAKE_C_COMPILER "gcc-7")
8+
# set(CMAKE_CXX_COMPILER "g++-7")
9+
# usually avoid this by using environment variables:
10+
# mkdir build-gcc && cd build-gcc && CC=gcc-7 CXX=g++-7 cmake ..
11+
12+
enable_language(C ASM)
13+
14+
set(CMAKE_C_STANDARD 11)
15+
set(CMAKE_C_STANDARD_REQUIRED ON)
16+
set(CMAKE_C_FLAGS "-std=gnu11 -O3 -g -Wall -Wmissing-prototypes -Wno-unused-result")
17+
18+
#set(ENV{PKG_CONFIG_PATH} secp256k1)
19+
if ( NOT DEFINED ENV{SECP256K1_ROOT_DIR})
20+
find_package(PkgConfig)
21+
pkg_search_module(SECP256K1 REQUIRED libsecp256k1)
22+
endif()
23+
24+
MESSAGE(STATUS ${SECP256K1_INCLUDE_DIRS})
25+
MESSAGE(STATUS ${SECP256K1_LIBRARIES})
26+
MESSAGE(STATUS ${SECP256K1_LIBDIR})
27+
28+
if (APPLE AND NOT DEFINED ENV{OPENSSL_ROOT_DIR})
29+
set(OPENSSL_ROOT_DIR "/usr/local/opt/openssl" "/usr/local/ssl/*" "/usr/local/Cellar/openssl/*")
30+
set(OPENSSL_LIBRARIES "/usr/local/opt/openssl/lib" "/usr/local/ssl/*/lib" "/usr/local/Cellar/openssl/*/lib")
31+
endif()
32+
33+
file(GLOB_RECURSE DAGGER_SOURCES
34+
client/*.c
35+
dfslib/*.c
36+
dnet/*.c
37+
ldus/*.c
38+
)
39+
40+
# ignore sources that we do not intend to include
41+
# when building the executable...
42+
list(FILTER DAGGER_SOURCES EXCLUDE REGEX ".*cgi.c$")
43+
list(FILTER DAGGER_SOURCES EXCLUDE REGEX ".*dvstime.c$")
44+
list(FILTER DAGGER_SOURCES EXCLUDE REGEX ".*statsdaemon.c$")
45+
46+
file(GLOB_RECURSE DAGGER_HEADERS
47+
client/*.h
48+
dfslib/*.h
49+
dnet/*.h
50+
ldus/*.h
51+
)
52+
53+
set(SHA256_LINUX_ASM_SOURCES
54+
client/algorithms/sha256-mb-x86_64.s
55+
client/x86_64cpuid.s
56+
)
57+
58+
set(SHA256_MAC_ASM_SOURCES
59+
client/algorithms/sha256-mb-x86_64-mac.s
60+
client/x86_64cpuid-mac.s
61+
)
62+
63+
OPTION(DEBUG "Build the project using debugging code" OFF)
64+
if(DEBUG)
65+
MESSAGE("Adding Debug flag...")
66+
SET(CMAKE_BUILD_TYPE Debug)
67+
MESSAGE("Build type is " ${CMAKE_BUILD_TYPE})
68+
else()
69+
add_definitions(-DNDEBUG)
70+
endif(DEBUG)
71+
72+
add_definitions(-DDFSTOOLS)
73+
add_definitions(-DSHA256_USE_OPENSSL_TXFM)
74+
add_definitions(-DSHA256_OPENSSL_MBLOCK)
75+
76+
find_package(Threads QUIET)
77+
if(NOT Threads_FOUND)
78+
message(FATAL_ERROR "Failed to find pthreads dependency!")
79+
endif()
80+
81+
find_package(OpenSSL QUIET)
82+
if(NOT OpenSSL_FOUND)
83+
message(FATAL_ERROR "Failed to find openssl dependency!")
84+
endif()
85+
86+
include_directories(
87+
${OPENSSL_INCLUDE_DIR}
88+
${SECP256K1_INCLUDE_DIRS}
89+
)
90+
91+
if(APPLE)
92+
add_executable(
93+
${PROJECT_NAME}
94+
${DAGGER_HEADERS}
95+
${DAGGER_SOURCES}
96+
${SHA256_MAC_ASM_SOURCES}
97+
)
98+
else(UNIX)
99+
add_executable(
100+
${PROJECT_NAME}
101+
${DAGGER_HEADERS}
102+
${DAGGER_SOURCES}
103+
${SHA256_LINUX_ASM_SOURCES}
104+
)
105+
endif()
106+
107+
target_link_libraries(
108+
${PROJECT_NAME}
109+
${CMAKE_THREAD_LIBS_INIT}
110+
)
111+
112+
target_link_libraries(
113+
${PROJECT_NAME}
114+
OpenSSL::SSL
115+
OpenSSL::Crypto
116+
-L${SECP256K1_LIBDIR} ${SECP256K1_LIBRARIES}
117+
)
118+
119+
add_executable(
120+
cgi_stats
121+
client/statsdaemon.c
122+
)
123+
124+
add_executable(
125+
cgi_block
126+
client/block.cgi.c
127+
)

automake/Makefile.am

+38-28
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,19 @@
44

55
SRCROOT = ..
66
client = $(SRCROOT)/client
7-
dnet = $(SRCROOT)/dnet
8-
dfstools = $(SRCROOT)/dus/programs/dfstools/source
9-
dfslib = $(dfstools)/dfslib
10-
dar = $(SRCROOT)/dus/programs/dar/source
11-
ldusinc = $(SRCROOT)/ldus/source/include/ldus
7+
dnet = $(SRCROOT)/dnet
8+
dfslib = $(SRCROOT)/dfslib
9+
ldusinc = $(SRCROOT)/ldus
1210
utils = $(SRCROOT)/client/utils
1311
jsonrpc = $(SRCROOT)/client/json-rpc
1412
http = $(SRCROOT)/client/http
1513
moving_statistics = $(SRCROOT)/client/utils/moving_statistics
14+
algorithms = $(SRCROOT)/client/algorithms
1615
secp256k1 = $(SRCROOT)/secp256k1
17-
16+
websocket = $(SRCROOT)/client/websocket
1817

1918
sources = \
20-
$(client)/sha256-mb-x86_64$(HOST_SUFFIX).s \
19+
$(algorithms)/sha256-mb-x86_64$(HOST_SUFFIX).s \
2120
$(client)/x86_64cpuid$(HOST_SUFFIX).s \
2221
$(client)/address.c \
2322
$(client)/block.c \
@@ -30,7 +29,6 @@ sources = \
3029
$(client)/netdb.c \
3130
$(client)/pool.c \
3231
$(client)/mining_common.c \
33-
$(client)/sha256.c \
3432
$(client)/storage.c \
3533
$(client)/sync.c \
3634
$(client)/transport.c \
@@ -43,12 +41,15 @@ sources = \
4341
$(dfslib)/dfslib_crypt.c \
4442
$(dfslib)/dfslib_random.c \
4543
$(dfslib)/dfslib_string.c \
46-
$(dfstools)/lib/dfsrsa.c \
47-
$(dar)/lib/crc_c.c \
44+
$(dfslib)/dfsrsa.c \
45+
$(algorithms)/sha256.c \
46+
$(algorithms)/crc.c \
4847
$(utils)/log.c \
4948
$(utils)/utils.c \
5049
$(utils)/linenoise.c \
5150
$(utils)/dirname.c \
51+
$(utils)/string_utils.c \
52+
$(utils)/random.c \
5253
$(moving_statistics)/moving_average.c \
5354
$(jsonrpc)/cJSON.c \
5455
$(jsonrpc)/cJSON_Utils.c \
@@ -59,8 +60,13 @@ sources = \
5960
$(jsonrpc)/rpc_commands.c \
6061
$(http)/url.c \
6162
$(http)/http.c \
62-
$(secp256k1)/src/secp256k1.c
63-
63+
$(secp256k1)/src/secp256k1.c \
64+
$(websocket)/websocket.c \
65+
$(websocket)/wslay/wslay_event.c \
66+
$(websocket)/wslay/wslay_frame.c \
67+
$(websocket)/wslay/wslay_net.c \
68+
$(websocket)/wslay/wslay_queue.c \
69+
$(websocket)/wslay/wslay_stack.c \
6470

6571
headers = \
6672
$(client)/address.h \
@@ -73,7 +79,6 @@ headers = \
7379
$(client)/pool.h \
7480
$(client)/miner.h \
7581
$(client)/mining_common.h \
76-
$(client)/sha256.h \
7782
$(client)/state.h \
7883
$(client)/storage.h \
7984
$(client)/sync.h \
@@ -82,29 +87,25 @@ headers = \
8287
$(client)/commands.h \
8388
$(client)/terminal.h \
8489
$(dnet)/dnet_crypt.h \
85-
$(dnet)/dnet_database.h \
8690
$(dnet)/dnet_history.h \
87-
$(dnet)/dnet_threads.h \
88-
$(dnet)/dnet_connection.h \
89-
$(dnet)/dnet_stream.h \
91+
$(dnet)/dnet_main.h \
9092
$(dnet)/dnet_packet.h \
91-
$(dnet)/dnet_command.h \
92-
$(dnet)/dnet_log.h \
93-
$(dnet)/dnet_files.h \
94-
$(dnet)/dnet_tap.h \
95-
$(dnet)/dthread.h \
93+
$(dnet)/dnet_system.h \
9694
$(dfslib)/dfslib_crypt.h \
9795
$(dfslib)/dfslib_random.h \
9896
$(dfslib)/dfslib_string.h \
9997
$(dfslib)/dfslib_types.h \
100-
$(dfstools)/include/dfsrsa.h \
101-
$(dar)/include/crc.h \
98+
$(dfslib)/dfsrsa.h \
10299
$(ldusinc)/atomic.h \
103100
$(ldusinc)/list.h \
104101
$(ldusinc)/rbtree.h \
102+
$(algorithms)/sha256.h \
103+
$(algorithms)/include/crc.h \
105104
$(utils)/log.h \
106105
$(utils)/utils.h \
107106
$(utils)/linenoise.h \
107+
$(utils)/string_utils.h \
108+
$(utils)/random.h \
108109
$(moving_statistics)/moving_average.h \
109110
$(jsonrpc)/cJSON.h \
110111
$(jsonrpc)/cJSON_Utils.h \
@@ -114,7 +115,16 @@ headers = \
114115
$(jsonrpc)/rpc_wrapper.h \
115116
$(jsonrpc)/rpc_commands.h \
116117
$(http)/url.h \
117-
$(http)/http.h
118+
$(http)/http.h \
119+
$(websocket)/websocket.h \
120+
$(websocket)/wslay/config.h \
121+
$(websocket)/wslay/wslay.h \
122+
$(websocket)/wslay/wslayver.h \
123+
$(websocket)/wslay/wslay_event.h \
124+
$(websocket)/wslay/wslay_frame.h \
125+
$(websocket)/wslay/wslay_net.h \
126+
$(websocket)/wslay/wslay_queue.h \
127+
$(websocket)/wslay/wslay_stack.h
118128

119129
#program
120130
bin_PROGRAMS = xdag
@@ -131,15 +141,15 @@ _INCLUDES = \
131141
-I$(SRCROOT) \
132142
-I$(dnet) \
133143
-I$(dfslib) \
134-
-I$(dfstools)/include \
135-
-I$(dar) \
136144
-I$(ldusinc) \
137145
-I$(utils) \
138146
-I$(moving_statistics) \
139147
-I$(jsonrpc) \
140148
-I$(http) \
141149
-I$(secp256k1)/src \
142-
-I$(secp256k1)/
150+
-I$(secp256k1)/ \
151+
-I$(websocket)/wslay \
152+
-I$(websocket)/ \
143153

144154

145155
xdag_SOURCES = $(sources)

0 commit comments

Comments
 (0)