From 2452da0c5a25c57d041953a1aa73bbe6a9d9995a Mon Sep 17 00:00:00 2001 From: satindergrewal Date: Thu, 8 Feb 2018 00:20:26 +1300 Subject: [PATCH 1/3] build nanomsg for both linux and osx --- iguana/build_static_nanomsg.sh | 18 +++++++++++++++--- iguana/m_mm | 3 ++- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/iguana/build_static_nanomsg.sh b/iguana/build_static_nanomsg.sh index 777e42f92..104025c79 100755 --- a/iguana/build_static_nanomsg.sh +++ b/iguana/build_static_nanomsg.sh @@ -1,7 +1,19 @@ #!/bin/bash #Check if libnanomsg-static.a file is already exists or not -file="../OSlibs/linux/$(uname -m)/libnanomsg-static.a" +if [[ "$OSTYPE" == "linux-gnu" ]]; then + echo "Linux" + file="../OSlibs/linux/$(uname -m)/libnanomsg-static.a" + makedir="../OSlibs/linux/$(uname -m)/" + copytarget="../OSlibs/linux/$(uname -m)/libnanomsg-static.a" +elif [[ "$OSTYPE" == "darwin"* ]]; then + # Mac OSX + echo "Mac OSX" + file="../OSlibs/osx/$(uname -m)/libnanomsg-static.a" + makedir="../OSlibs/osx/$(uname -m)/" + copytarget="../OSlibs/osx/$(uname -m)/libnanomsg-static.a" +fi + if [ ! -f "$file" ] then echo "$0: File '${file}' not found." @@ -26,8 +38,8 @@ then cd ../.. pwd - mkdir -p ../OSlibs/linux/$(uname -m)/ - cp -av nanomsglib/lib/libnanomsg.a ../OSlibs/linux/$(uname -m)/libnanomsg-static.a + mkdir -p $makedir + cp -av nanomsglib/lib/libnanomsg.a $copytarget fi diff --git a/iguana/m_mm b/iguana/m_mm index 5a227a69a..be58df6a3 100755 --- a/iguana/m_mm +++ b/iguana/m_mm @@ -1,3 +1,4 @@ cd secp256k1; ./m_unix; cd .. cd ../crypto777; ./m_LP; cd ../iguana -gcc -g -o marketmaker -I../crypto777 exchanges/mm.c ../crypto777/cJSON.c mini-gmp.c groestl.c segwit_addr.c secp256k1.o ../agents/libcrypto777.a -lnanomsg -lcurl -lpthread -lm +./build_static_nanomsg.sh +gcc -g -o marketmaker -I../crypto777 exchanges/mm.c ../crypto777/cJSON.c mini-gmp.c groestl.c segwit_addr.c secp256k1.o ../agents/libcrypto777.a ../OSlibs/osx/$(uname -m)/libnanomsg-static.a -lcurl -lpthread -lm From c1a816f23df18b465908bae40de20c0bea4f7c8c Mon Sep 17 00:00:00 2001 From: satindergrewal Date: Thu, 8 Feb 2018 00:45:30 +1300 Subject: [PATCH 2/3] gitignore updated, m_mm updated for linux: m_mm script will use dynamic nanomsg lib like before for osx: m_mm script will compile static nanomsg lib and generate static marketmaker binary --- .gitignore | 5 +++++ iguana/m_mm | 16 ++++++++++++++-- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index 37c54960f..67876dc66 100755 --- a/.gitignore +++ b/.gitignore @@ -3,6 +3,11 @@ x64 agents/iguana.exe Debug/* +iguana/nanomsglib +iguana/nanomsgsrc +OSlibs/linux +OSlibs/osx + iguana/pnacl/Release/iguana_unstripped.pexe iguana/pnacl/Release/iguana.pexe diff --git a/iguana/m_mm b/iguana/m_mm index be58df6a3..0f42e38da 100755 --- a/iguana/m_mm +++ b/iguana/m_mm @@ -1,4 +1,16 @@ cd secp256k1; ./m_unix; cd .. cd ../crypto777; ./m_LP; cd ../iguana -./build_static_nanomsg.sh -gcc -g -o marketmaker -I../crypto777 exchanges/mm.c ../crypto777/cJSON.c mini-gmp.c groestl.c segwit_addr.c secp256k1.o ../agents/libcrypto777.a ../OSlibs/osx/$(uname -m)/libnanomsg-static.a -lcurl -lpthread -lm + +if [[ "$OSTYPE" == "linux-gnu" ]]; then + echo "Linux" + # Default is dynamic nanomsg for linux using this script + nanomsg_lib="-lnanomsg" +elif [[ "$OSTYPE" == "darwin"* ]]; then + # Mac OSX + echo "Mac OSX" + # on osx this script generates static libnanomsg and uses it to compile static marketmaker binary + ./build_static_nanomsg.sh + nanomsg_lib="../OSlibs/osx/$(uname -m)/libnanomsg-static.a" +fi + +gcc -g -o marketmaker -I../crypto777 exchanges/mm.c ../crypto777/cJSON.c mini-gmp.c groestl.c segwit_addr.c secp256k1.o ../agents/libcrypto777.a $nanomsg_lib -lcurl -lpthread -lm From 20431dad0eb3f2d97c0a4f191e53c8a3d2d87764 Mon Sep 17 00:00:00 2001 From: satindergrewal Date: Thu, 8 Feb 2018 00:59:31 +1300 Subject: [PATCH 3/3] client static script added for linux --- iguana/exchanges/client_static | 11 +++++++++++ iguana/exchanges/install | 2 +- 2 files changed, 12 insertions(+), 1 deletion(-) create mode 100755 iguana/exchanges/client_static diff --git a/iguana/exchanges/client_static b/iguana/exchanges/client_static new file mode 100755 index 000000000..484c1cf57 --- /dev/null +++ b/iguana/exchanges/client_static @@ -0,0 +1,11 @@ +#!/bin/bash +source passphrase +source coins +pkill -15 marketmaker; +git pull; +cd ..; +make -f m_mm_StaticNanoMsg -j2 all; +rm -rf ./marketmaker +cp -av ../agents/marketmaker ./ +./marketmaker "{\"gui\":\"nogui\",\"client\":1, \"userhome\":\"/${HOME#"/"}\", \"passphrase\":\"$passphrase\", \"coins\":$coins}" & + diff --git a/iguana/exchanges/install b/iguana/exchanges/install index 6f5c28723..f6150cb1b 100755 --- a/iguana/exchanges/install +++ b/iguana/exchanges/install @@ -1,5 +1,5 @@ #!/bin/bash -cp install get_supernet trackbtc auto_chipskmd auto_chipsbtc pendingswaps fundvalue balances dynamictrust getcoin kickstart tradesarray claim deposit10 deposit1 invreset sendrawtransaction processfiles stop millis mnzservers bot_buy bot_list bot_statuslist bot_pause bot_resume bot_sell bot_settings bot_status bot_stop guistats pubkeystats pendings coinswaps baserelswaps setpassphrase notarizations getrawtransaction parselog statsdisp m_js trust trusted setconfirms balance listunspent electrum snapshot_balance snapshot_loop secretaddresses dividends snapshot goals goal portfolio autoprice deletemessages getmessages debug buy sell bestfit orderbook client run_osx client_osx run coins disable enable myprice myprices getcoins getpeers getpeersIP getprices help inv setprice status ../dexscripts +cp install get_supernet trackbtc auto_chipskmd auto_chipsbtc pendingswaps fundvalue balances dynamictrust getcoin kickstart tradesarray claim deposit10 deposit1 invreset sendrawtransaction processfiles stop millis mnzservers bot_buy bot_list bot_statuslist bot_pause bot_resume bot_sell bot_settings bot_status bot_stop guistats pubkeystats pendings coinswaps baserelswaps setpassphrase notarizations getrawtransaction parselog statsdisp m_js trust trusted setconfirms balance listunspent electrum snapshot_balance snapshot_loop secretaddresses dividends snapshot goals goal portfolio autoprice deletemessages getmessages debug buy sell bestfit orderbook client run_osx client_osx client_static run coins disable enable myprice myprices getcoins getpeers getpeersIP getprices help inv setprice status ../dexscripts cp coins.json .. cd ../dexscripts #cp ../exchanges/passphrase ../exchanges/userpass .