Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- # automate build of needed dependencies from source
- # for crippled CentOS installations with fracked-up libs and binaries
- #
- if [ "$(which yum)" ]; then
- # install EPEL for packages outside normal CentOS distribution
- CENTOS6_EPEL=http://mirror-fpt-telecom.fpt.net/fedora/epel/6/i386
- wget $CENTOS6_EPEL/epel-release-6-8.noarch.rpm
- sudo rpm -ivh epel-release-6-8.noarch.rpm
- # get rid of services we don't need
- sudo yum erase httpd sendmail
- sudo yum erase sendmail
- # install development stuff we need
- sudo yum install gcc-c++ bzip2-devel python-devel python-pip git
- else # assume Debian
- sudo apt-get install g++ libbz2-dev python-dev python-pip git libtool
- fi
- sudo pip install scrypt
- cd
- mkdir -p src
- cd src
- # build openssl from source
- OPENSSL_DIR=openssl-1.0.1e
- if [ \! -f $OPENSSL_DIR.tar.gz ]; then
- wget http://www.openssl.org/source/$OPENSSL_DIR.tar.gz
- fi
- if [ \! -d $OPENSSL_DIR ]; then
- tar xfz $OPENSSL_DIR.tar.gz
- rm -f $OPENSSL_DIR/Makefile # remove default Makefile to force ./config
- fi
- if [ $HOME/bin/c_rehash -ot $OPENSSL_DIR ]; then
- if [ \! -f $OPENSSL_DIR/Makefile ]; then
- (cd $OPENSSL_DIR && \
- ./config --prefix=$HOME enable-ec enable-ecdh enable-ecdsa zlib -fPIC shared)
- fi
- (cd $OPENSSL_DIR && make install)
- fi
- # boost needs about 1G to compile
- if [ "$(free -m | sed -n 's/^Mem:\s\+\([0-9]\+\).*$/\1/p')" -lt 800 ]; then
- if [ \! -e /tmp/boostswap ]; then
- dd if=/dev/zero of=/tmp/boostswap bs=64M count=16
- sudo mkswap /tmp/boostswap
- sudo swapon /tmp/boostswap
- fi
- fi
- # build boost from source
- SOURCEFORGE=http://sourceforge.net/projects
- BOOST_DIR=boost_1_54_0
- if [ \! -f $BOOST_DIR.tar.gz ]; then
- wget $SOURCEFORGE/boost/files/boost/1.54.0/$BOOST_DIR.tar.gz
- fi
- if [ \! -d $BOOST_DIR ]; then
- tar xfz $BOOST_DIR.tar.gz
- fi
- if [ $HOME/include/boost -ot $BOOST_DIR ]; then
- if [ \! -e $HOME/lib/libboost_python.a ]; then
- (cd $BOOST_DIR && \
- ./bootstrap.sh --prefix=$HOME && \
- ./b2 install --with=all)
- fi
- fi
- # build Berkeley DB4.8 from source
- DB_DIR=db-4.8.30.NC
- if [ \! -f $DB_DIR.tar.gz ]; then
- wget http://download.oracle.com/berkeley-db/$DB_DIR.tar.gz
- fi
- if [ \! -d $DB_DIR ]; then
- tar xfz $DB_DIR.tar.gz
- touch $DB_DIR
- fi
- if [ $HOME/include/db_cxx.h -ot $DB_DIR ]; then
- if [ \! -e $DB_DIR/build_unix/Makefile ]; then
- (cd $DB_DIR/build_unix/ && \
- ../dist/configure --prefix=$HOME --enable-cxx)
- fi
- (cd $DB_DIR/build_unix/ && make install)
- fi
- # build libminiupnpc from source
- # most cryptocoin Makefiles hardcode USE_PNP:=0, so setting USE_PNP=- won't work
- MINIUPNP=http://miniupnp.free.fr
- MINIUPNP_DIR=miniupnpc-1.8.20131209
- if [ \! -f $MINIUPNP_DIR.tar.gz ]; then
- wget -O $MINIUPNP_DIR.tar.gz \
- "$MINIUPNP/files/download.php?file=$MINIUPNP_DIR.tar.gz"
- fi
- if [ \! -d $MINIUPNP_DIR ]; then
- tar xfz $MINIUPNP_DIR.tar.gz
- fi
- if [ $HOME/include/miniupnpc -ot $MINIUPNP_DIR ]; then
- (cd $MINIUPNP_DIR && make INSTALLPREFIX=$HOME install)
- fi
- # build bitcoin
- # as of version 9.something, bitcoin changes too much to use with simpleminer
- # switching back to version 8 for as long as the blockchain supports it
- if [ "$YES_I_WANT_LATEST_BITCOIN" ]; then
- if [ \! -d bitcoin ]; then
- git clone https://github.com/bitcoin/bitcoin.git
- fi
- if [ $HOME/bin/bitcoind.real -ot bitcoin ]; then
- (cd bitcoin/ && \
- CPPFLAGS="-I$HOME/include" LDFLAGS="-L/$HOME/lib -Wl,-rpath-link,$HOME/lib" \
- ./configure --prefix=$HOME --with-boost=$HOME)
- (cd bitcoin/ && make && mv -f src/bitcoind $HOME/bin/bitcoind.real)
- # you will also have to fiddle with bitcoin-cli and maybe other stuff
- fi
- else
- BITCOIN_VERSION=bitcoin-0.8.6
- BITCOIN_ARCHIVE=$BITCOIN_VERSION-linux
- BITCOIN_SOURCE=http://downloads.sourceforge.net/project/bitcoin/Bitcoin
- if [ \! -d $BITCOIN_ARCHIVE ]; then
- wget $BITCOIN_SOURCE/$BITCOIN_VERSION/$BITCOIN_ARCHIVE.tar.gz
- tar xzf $BITCOIN_ARCHIVE.tar.gz
- fi
- if [ $HOME/bin/bitcoind.real -ot $BITCOIN_ARCHIVE ]; then
- (cd $BITCOIN_ARCHIVE/src/src && \
- CXXFLAGS="-I$HOME/include" LDFLAGS="-L/$HOME/lib -Wl,-rpath-link,$HOME/lib" \
- make && mv -f src/src/bitcoind $HOME/bin/bitcoind.real)
- fi
- fi
- if [ \! -d AmericanCoin ]; then
- git clone https://github.com/AMCcoin/AmericanCoin.git
- fi
- if [ $HOME/bin/americancoind.real -ot AmericanCoin ]; then
- (cd AmericanCoin/src &&
- make CXXFLAGS="-I$HOME/include" LDFLAGS="-L$HOME/lib" -f makefile.unix &&
- cp americancoind $HOME/bin/americancoind.real)
- fi
- # build Berkeley DB5.1 from source, for dogecoin
- # http://download.oracle.com/berkeley-db/db-5.1.29.NC.tar.gz
- DB_DIR=db-5.1.29.NC
- DB_PREFIX=bdb5.1
- if [ \! -f $DB_DIR.tar.gz ]; then
- wget http://download.oracle.com/berkeley-db/$DB_DIR.tar.gz
- fi
- if [ \! -d $DB_DIR ]; then
- tar xfz $DB_DIR.tar.gz
- touch $DB_DIR
- fi
- if [ $HOME/$DB_PREFIX -ot $DB_DIR ]; then
- if [ \! -e $DB_DIR/build_unix/Makefile ]; then
- (cd $DB_DIR/build_unix/ && \
- ../dist/configure --prefix=$HOME/$DB_PREFIX --enable-cxx)
- fi
- (cd $DB_DIR/build_unix/ && make install)
- fi
- # dogecoin build puts BOOST_CPPFLAGS before CPPFLAGS, which causes the
- # compiler to find the bdb4.8 headers first. fix this with a symlink
- (cd $HOME/include && ln -sf $HOME/$DB_PREFIX/include $DB_PREFIX)
- DOGECOIN_VERSION=1.8.1-beta-1
- DOGECOIN_CPPFLAGS="-I$HOME -I$HOME/include"
- DOGECOIN_LDFLAGS="-L$HOME/$DB_PREFIX/lib -Wl,-rpath-link,$HOME/$DB_PREFIX/lib \
- -L$HOME/lib -Wl,-rpath-link,$HOME/lib"
- if [ \! -d dogecoin-$DOGECOIN_VERSION ]; then
- if [ \! -f v$DOGECOIN_VERSION.tar.gz ]; then
- wget https://github.com/dogecoin/dogecoin/archive/v$DOGECOIN_VERSION.tar.gz
- fi
- tar xfz v$DOGECOIN_VERSION.tar.gz
- fi
- if [ $HOME/bin/dogecoind.real -ot dogecoin-$DOGECOIN_VERSION ]; then
- (cd dogecoin-$DOGECOIN_VERSION && \
- ./autogen.sh && \
- ./configure --prefix=$HOME --with-boost=$HOME --with-gui=no \
- CPPFLAGS="$DOGECOIN_CPPFLAGS" LDFLAGS="$DOGECOIN_LDFLAGS" && \
- make && \
- cp src/dogecoind $HOME/bin/dogecoind.real)
- fi
- # we do not need the swapspace any more (we hope)
- if [ -e /tmp/boostswap ]; then
- sudo swapoff /tmp/boostswap
- rm /tmp/boostswap
- fi
- chmod +x $HOME/src/localcoind $HOME/src/simpleminer.py # just to make sure
- for coin in bit american; do
- (cd $HOME/bin && ln -sf ../src/localcoind ${coin}coind)
- done
- for coin in doge; do
- (cd $HOME/bin && ln -sf ../src/localcoind-bdb5.1 ${coin}coind)
- done
- # you had to have uploaded simpleminer.* to $HOME/src
- cd $HOME/bin && ln -sf ../src/simpleminer.py .
- cd $HOME/bin && ln -sf /usr/bin/python simpleminer
- if [ -d /etc/init ]; then # upstart system
- (cd /etc/init && sudo ln -sf $HOME/src/simpleminer.conf americancoin.conf)
- fi
- if [ $(which initctl) ]; then
- sudo initctl reload-configuration
- sudo initctl start coinyecoin
- fi
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement