forked from atanmarko/safex-nodejs-libwallet
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Makefile
82 lines (63 loc) · 2.61 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
SAFEX_BRANCH?="node_wallet"
BOOST_VERSION=1.72.0
BOOST_DIRNAME=boost_1_72_0
PWD=${shell pwd}
BOOST_LIBS=chrono,date_time,filesystem,program_options,regex,serialization,system,thread,locale
THREADS?=6
.PHONY: all
all: binding.gyp deps
node_modules/.bin/node-pre-gyp configure build
.PHONY: clean
clean:
rm -rf boost
rm -rf safexcore/build
rm -rf deps
rm -rf build
rm -rf lib
${BOOST_DIRNAME}:
curl -L -o "${BOOST_DIRNAME}.tar.gz" \
https://sourceforge.net/projects/boost/files/boost/${BOOST_VERSION}/${BOOST_DIRNAME}.tar.gz/download
tar xf ${BOOST_DIRNAME}.tar.gz
boost: ${BOOST_DIRNAME}
cd ${BOOST_DIRNAME} && ./bootstrap.sh --prefix=${PWD}/boost
cd ${BOOST_DIRNAME} && ./b2 headers
cd ${BOOST_DIRNAME} && ./b2 -j4 cxxflags=-fPIC cflags=-fPIC -a link=static \
threading=multi threadapi=pthread install
mkdir -p boost/include && cp -L -R ${BOOST_DIRNAME}/boost/ boost/include/
libnode-win:
mkdir -p deps
cd libnode && wget https://nodejs.org/dist/v13.8.0/win-x64/node.exe
cd libnode && x86_64-w64-mingw32-dlltool -d node.def -y libnode.a
cp libnode/libnode.a ${PWD}/deps
.PHONY: deps
deps: boost safexcore-build
mkdir -p deps
cp boost/lib/*.a deps
deps-win: libnode-win safexcore-win-build
mkdir -p deps
safexcore:
git clone --depth 1 -b master --recurse-submodules https://github.com/safex/safexcore
cp safexcore/src/wallet/api/wallet_api.h include
#windows
safexcore-win-build: libnode-win safexcore
mkdir -p safexcore/build
cd safexcore/contrib/depends && $(MAKE) HOST=x86_64-w64-mingw32
cd safexcore/build && cmake -DARCH="x86-64" \
-DBUILD_64=ON -DBUILD_SHARED_LIBS=OFF -DBUILD_GUI_DEPS=OFF -DBUILD_TESTS=OFF -DSTATIC=ON -DBOOST_ROOT=${PWD}/boost -DCMAKE_BUILD_TYPE=Release -DCMAKE_POSITION_INDEPENDENT_CODE:BOOL=true \
-DCMAKE_WINDOWS_EXPORT_ALL_SYMBOLS=TRUE -DCMAKE_ARCHIVE_OUTPUT_DIRECTORY=${PWD}/deps -DCMAKE_TOOLCHAIN_FILE=$(CURDIR)/safexcore/contrib/depends/x86_64-w64-mingw32/share/toolchain.cmake ..
cd safexcore/build && make wallet_api -j${THREADS}
cp safexcore/build/lib/libwallet_api.dll.a ${PWD}/deps
cp safexcore/build/src/wallet/api/libwallet_api.dll ${PWD}/deps
#linux, mac
safexcore-build: boost safexcore
mkdir -p safexcore/build
cd safexcore/build && cmake -DBUILD_SHARED_LIBS=OFF -DBUILD_GUI_DEPS=ON \
-DBUILD_TESTS=OFF -DSTATIC=ON -DBOOST_ROOT=${PWD}/boost \
-DARCH="x86-64" \
-DBUILD_64=ON \
-DCMAKE_BUILD_TYPE=release \
-DCMAKE_POSITION_INDEPENDENT_CODE:BOOL=true \
-DCMAKE_ARCHIVE_OUTPUT_DIRECTORY=${PWD}/deps \
..
cd safexcore/build && make -j${THREADS} wallet_merged epee easylogging lmdb unbound VERBOSE=1
cp safexcore/build/lib/libwallet_merged.a ${PWD}/deps