2015-10-21 19:48:14 +05:00
|
|
|
#!/usr/bin/env bash
|
2015-10-21 19:45:49 +05:00
|
|
|
root=$(readlink -e $(dirname $0))
|
2016-05-03 21:16:36 +05:00
|
|
|
set -e
|
|
|
|
if [ "x" == "x$root" ] ; then
|
|
|
|
root=$PWD/${0##*}
|
|
|
|
fi
|
|
|
|
cd $root
|
2016-03-09 18:36:44 +05:00
|
|
|
|
|
|
|
tags=""
|
|
|
|
|
|
|
|
help_text="usage: $0 [--disable-redis]"
|
|
|
|
|
|
|
|
# check for help flags first
|
|
|
|
for arg in $@ ; do
|
|
|
|
case $arg in
|
|
|
|
-h|--help)
|
|
|
|
echo $help_text
|
|
|
|
exit 0
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
done
|
|
|
|
|
2016-05-13 17:49:43 +05:00
|
|
|
rev="QmZWEqyb7hs2z1pNUqdfNyDgG3cj31ZZgP148RFdRExCQr"
|
|
|
|
ipfs="no"
|
2016-04-18 17:40:01 +05:00
|
|
|
_next=""
|
2016-03-09 18:36:44 +05:00
|
|
|
# check for build flags
|
|
|
|
for arg in $@ ; do
|
|
|
|
case $arg in
|
2016-05-13 17:49:43 +05:00
|
|
|
"--ipfs")
|
|
|
|
ipfs="yes"
|
|
|
|
;;
|
2016-03-09 18:36:44 +05:00
|
|
|
"--disable-redis")
|
|
|
|
tags="$tags -tags disable_redis"
|
|
|
|
;;
|
2016-04-18 17:40:01 +05:00
|
|
|
"--revision")
|
|
|
|
_next="rev"
|
|
|
|
;;
|
|
|
|
"--revision=*")
|
|
|
|
rev=$(echo $arg | cut -d'=' -f2)
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
if [ "x$_next" == "xrev" ] ; then
|
|
|
|
rev="$arg"
|
|
|
|
fi
|
2016-03-09 18:36:44 +05:00
|
|
|
esac
|
|
|
|
done
|
|
|
|
|
2016-04-18 17:40:01 +05:00
|
|
|
if [ "x$rev" == "x" ] ; then
|
|
|
|
echo "revision not specified"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2015-10-21 19:45:49 +05:00
|
|
|
cd $root
|
2016-05-13 17:49:43 +05:00
|
|
|
unset GOPATH
|
2016-04-19 04:42:24 +05:00
|
|
|
export GOPATH=$PWD/go
|
|
|
|
mkdir -p $GOPATH
|
2016-05-13 17:49:43 +05:00
|
|
|
|
|
|
|
if [ "x$ipfs" == "xyes" ] ; then
|
2016-05-13 18:52:35 +05:00
|
|
|
if [ ! -e $GOPATH/bin/gx ] ; then
|
|
|
|
echo "obtaining gx"
|
2016-05-13 18:56:51 +05:00
|
|
|
go get -u -v github.com/whyrusleeping/gx
|
|
|
|
fi
|
|
|
|
if [ ! -e $GOPATH/bin/gx-go ] ; then
|
|
|
|
echo "obtaining gx-go"
|
2016-05-13 18:52:35 +05:00
|
|
|
go get -u -v github.com/whyrusleeping/gx-go
|
|
|
|
fi
|
2016-05-13 19:05:49 +05:00
|
|
|
mkdir -p $GOPATH/src/gx/ipfs
|
|
|
|
cd $GOPATH/src/gx/ipfs
|
2016-05-13 18:51:35 +05:00
|
|
|
$GOPATH/bin/gx get $rev
|
2016-05-13 18:33:59 +05:00
|
|
|
cd $root
|
2016-05-13 18:47:01 +05:00
|
|
|
$GOPATH/bin/gx install
|
2016-05-13 19:12:11 +05:00
|
|
|
go get -u -v .
|
2016-05-13 19:11:28 +05:00
|
|
|
go build -v .
|
2016-05-13 18:38:57 +05:00
|
|
|
cp nntpchan srndv2
|
2016-05-13 17:49:43 +05:00
|
|
|
else
|
|
|
|
go get -u -v github.com/majestrate/srndv2
|
|
|
|
fi
|
2016-04-19 04:42:24 +05:00
|
|
|
cp $GOPATH/bin/srndv2 $root
|
2016-03-09 18:36:44 +05:00
|
|
|
echo "Built"
|