Skip to content

Instantly share code, notes, and snippets.

@Setitch
Created March 27, 2018 10:53
Show Gist options
  • Save Setitch/1036b7b92f32bbc36c4100db8de7dedc to your computer and use it in GitHub Desktop.
Save Setitch/1036b7b92f32bbc36c4100db8de7dedc to your computer and use it in GitHub Desktop.
#!/bin/sh
# based on https://www.felix021.com/blog/read.php?2187 with some fixes to really compile the project
sudo apt install -y libssl-dev libev-dev libjansson-dev libmpdec-dev libmysqlclient-dev libcurl4-gnutls-dev libldap2-dev libgss-dev librtmp-dev libsasl2-dev
# librdkafka: 0.11.3+; DO NOT INSTALL BY APT: version too old (0.8.x);
# if you do, remove them by: sudo apt remove librdkafka1 librdkafka-dev
wget https://github.com/edenhill/librdkafka/archive/v0.11.3.tar.gz -O librdkafka-0.11.3.tar.gz
tar zxf librdkafka-0.11.3.tar.gz
cd librdkafka-0.11.3
./configure
make
sudo make install
cd ..
# Download server source
git clone https://github.com/viabtc/viabtc_exchange_server.git
cd viabtc_exchange_server
# Build hiredis
make -C depends/hiredis
# Build network
make -C network
# Modify makefile to include proper hiredis dir
sed -i "/INCS = -I \.\.\/network/c\INCS = -I ../network -I ../depends" utils/makefile
# And build
make -C utils
# Change makefile to include proper directories
sed -i "/INCS = -I \.\.\/network/c\INCS = -I ../network -I ../utils -I ../depends" accesshttp/makefile
sed -i "/LIBS = /c\LIBS = -L ../utils -lutils -L ../network -lnetwork -L ../depends/hiredis -Wl,-Bstatic -lev -ljansson -lmpdec -lrdkafka -lz -lssl -lcrypto -lhiredis -lcurl -Wl,-Bdynamic -lm -lpthread -ldl -lssl -lldap -llber -lgss -lgnutls -lidn -lnettle -lrtmp -lsasl2 -lmysqlclient" accesshttp/makefile
make -C accesshttp
# Modify all other makefiles similar to accesshttp/makefile
## accessaws
sed -i "/INCS = -I \.\.\/network/c\INCS = -I ../network -I ../utils -I ../depends" accessws/makefile
sed -i "/LIBS = /c\LIBS = -L ../utils -lutils -L ../network -lnetwork -L ../depends/hiredis -Wl,-Bstatic -lev -ljansson -lmpdec -lrdkafka -lz -lssl -lcrypto -lhiredis -lcurl -Wl,-Bdynamic -lm -lpthread -ldl -lssl -lldap -llber -lgss -lgnutls -lidn -lnettle -lrtmp -lsasl2 -lmysqlclient" accessws/makefile
## alertcenter
sed -i "/INCS = -I \.\.\/network/c\INCS = -I ../network -I ../utils -I ../depends" alertcenter/makefile
sed -i "/LIBS = /c\LIBS = -L ../utils -lutils -L ../network -lnetwork -L ../depends/hiredis -Wl,-Bstatic -lev -ljansson -lmpdec -lrdkafka -lz -lssl -lcrypto -lhiredis -lcurl -Wl,-Bdynamic -lm -lpthread -ldl -lssl -lldap -llber -lgss -lgnutls -lidn -lnettle -lrtmp -lsasl2 -lmysqlclient" alertcenter/makefile
## marketprice
sed -i "/INCS = -I \.\.\/network/c\INCS = -I ../network -I ../utils -I ../depends" marketprice/makefile
sed -i "/LIBS = /c\LIBS = -L ../utils -lutils -L ../network -lnetwork -L ../depends/hiredis -Wl,-Bstatic -lev -ljansson -lmpdec -lrdkafka -lz -lssl -lcrypto -lhiredis -lcurl -Wl,-Bdynamic -lm -lpthread -ldl -lssl -lldap -llber -lgss -lgnutls -lidn -lnettle -lrtmp -lsasl2 -lmysqlclient" marketprice/makefile
## matchengine
sed -i "/INCS = -I \.\.\/network/c\INCS = -I ../network -I ../utils -I ../depends" matchengine/makefile
sed -i "/LIBS = /c\LIBS = -L ../utils -lutils -L ../network -lnetwork -L ../depends/hiredis -Wl,-Bstatic -lev -ljansson -lmpdec -lrdkafka -lz -lssl -lcrypto -lhiredis -lcurl -Wl,-Bdynamic -lm -lpthread -ldl -lssl -lldap -llber -lgss -lgnutls -lidn -lnettle -lrtmp -lsasl2 -lmysqlclient" matchengine/makefile
## readhistory
sed -i "/INCS = -I \.\.\/network/c\INCS = -I ../network -I ../utils -I ../depends" readhistory/makefile
sed -i "/LIBS = /c\LIBS = -L ../utils -lutils -L ../network -lnetwork -L ../depends/hiredis -Wl,-Bstatic -lev -ljansson -lmpdec -lrdkafka -lz -lssl -lcrypto -lhiredis -lcurl -Wl,-Bdynamic -lm -lpthread -ldl -lssl -lldap -llber -lgss -lgnutls -lidn -lnettle -lrtmp -lsasl2 -lmysqlclient" readhistory/makefile
# Make all others
make -C accessws
make -C alertcenter
make -C marketprice
make -C matchengine
make -C readhistory
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment