Archived
1
0
This repository has been archived on 2023-08-12. You can view files and clone it, but cannot push or open issues or pull requests.
nntpchan/build.sh

119 lines
2.5 KiB
Bash
Raw Normal View History

2015-10-21 19:48:14 +05:00
#!/usr/bin/env bash
root=$(readlink -e "$(dirname "$0")")
set -e
if [ "" == "$root" ] ; then
root=$PWD/${0##*}
fi
cd "$root"
2016-03-09 18:36:44 +05:00
2016-10-18 17:44:15 +05:00
tags=""
2016-03-09 18:36:44 +05:00
2016-10-18 17:44:15 +05:00
help_text="usage: $0 [--disable-neochan] [--enable-redis]"
2016-03-09 18:36:44 +05:00
# check for help flags first
for arg in "$@" ; do
2016-03-09 18:36:44 +05:00
case $arg in
-h|--help)
echo "$help_text"
2016-03-09 18:36:44 +05:00
exit 0
;;
esac
done
2016-05-15 17:19:03 +05:00
rev="QmPAqM7anxdr1ngPmJz9J9AAxDLinDz2Eh9aAzLF9T7LNa"
2016-05-13 17:49:43 +05:00
ipfs="no"
rebuildjs="yes"
2016-04-18 17:40:01 +05:00
_next=""
2016-07-30 17:02:05 +05:00
unstable="no"
2016-10-18 16:08:49 +05:00
neochan="no"
2016-10-18 17:44:15 +05:00
buildredis="no"
2017-01-28 20:39:58 +05:00
lua="no"
2016-03-09 18:36:44 +05:00
# check for build flags
for arg in "$@" ; do
2016-03-09 18:36:44 +05:00
case $arg in
2017-01-28 20:39:58 +05:00
"--enable-lua")
lua="yes"
;;
2016-10-18 17:44:15 +05:00
"--enable-redis")
buildredis="yes"
;;
2016-10-18 16:08:49 +05:00
"--enable-neochan")
neochan="yes"
2016-10-15 18:05:38 +05:00
;;
2016-07-30 17:02:05 +05:00
"--unstable")
unstable="yes"
;;
"--no-js")
rebuildjs="no"
;;
2016-05-13 17:49:43 +05:00
"--ipfs")
ipfs="yes"
;;
2016-04-18 17:40:01 +05:00
"--revision")
_next="rev"
;;
"--revision=*")
rev=$(echo "$arg" | cut -d'=' -f2)
2016-04-18 17:40:01 +05:00
;;
*)
if [ "x$_next" == "xrev" ] ; then
rev="$arg"
fi
2016-03-09 18:36:44 +05:00
esac
done
2016-10-18 17:44:15 +05:00
if [ "$buildredis" == "yes" ] ; then
tags="$tags -tags disable_redis"
fi
2017-01-28 20:39:58 +05:00
if [ "$lua" == "yes" ] ; then
tags="$tags -tags lua"
fi
if [ "$rev" == "" ] ; then
2016-04-18 17:40:01 +05:00
echo "revision not specified"
exit 1
fi
cd "$root"
if [ "$rebuildjs" == "yes" ] ; then
echo "rebuilding generated js..."
2016-10-15 18:05:38 +05:00
if [ "$neochan" == "no" ] ; then
./build-js.sh --disable-neochan
else
./build-js.sh
fi
fi
2016-10-15 18:05:38 +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 [ "$ipfs" == "yes" ] ; then
if [ ! -e "$GOPATH/bin/gx" ] ; then
2016-05-13 18:52:35 +05:00
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
2016-05-13 18:56:51 +05:00
echo "obtaining gx-go"
2016-05-13 18:52:35 +05:00
go get -u -v github.com/whyrusleeping/gx-go
fi
echo "building stable revision, this will take a bit. to speed this part up install and run ipfs locally"
mkdir -p "$GOPATH/src/gx/ipfs"
cd "$GOPATH/src/gx/ipfs"
"$GOPATH/bin/gx" get "$rev"
2017-01-18 23:59:22 +05:00
cd "$rev/srndv2"
echo "build..."
2016-05-13 19:11:28 +05:00
go build -v .
2017-01-18 23:59:22 +05:00
cp srndv2 "$root"
2016-07-30 17:02:05 +05:00
echo -e "Built\n"
echo "Now configure NNTPChan with ./srndv2 setup"
2016-05-13 17:49:43 +05:00
else
echo "building the daemon..."
echo
make -C contrib/backends/srndv2
cp contrib/backends/srndv2/srndv2 .
echo "built"
echo "now configure NNTPChan with ./srndv2 setup"
2016-05-13 17:49:43 +05:00
fi