Last active
March 27, 2018 06:46
-
-
Save jhawkwind/2626e252011220afedc53d3803d93cdd to your computer and use it in GitHub Desktop.
Recompile and rebuild ZCASH on CentOS 7
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| # NOTE: You must run this as a wheel user, and it will create directories in your home folder! | |
| # WARNING: Things are done without confirmation! | |
| # REMEMBER: Run `gcc -v` to grab current configuration of your GCC build and mirror it. | |
| # Reference materials: | |
| # -- GCC with Ada: http://www.linuxfromscratch.org/blfs/view/7.10/general/gcc-ada.html | |
| # -- GCC build parameters: http://www.linuxfromscratch.org/blfs/view/7.10/general/gcc.html | |
| # -- GCC prereqs: https://gcc.gnu.org/install/prerequisites.html | |
| # -- GNAT download: https://www.adacore.com/download/more | |
| # -- ZCash user and build guide: https://github.com/zcash/zcash/wiki/1.0-User-Guide | |
| # -- GCC upgrade guide: https://jdhao.github.io/2017/09/04/install-gcc-newer-version-on-centos/ | |
| # -- Binutils guide: http://www.linuxfromscratch.org/lfs/view/development/chapter06/binutils.html | |
| # Update system software, this may not be necessary and can be omitted if you are reasonably | |
| # confident that you got everything. | |
| sudo yum -y install epel-release centos-release-scl http://rpms.remirepo.net/enterprise/remi-release-7.rpm | |
| sudo yum -y install yum-utils | |
| sudo yum-config-manager --enable remi-php72 | |
| sudo yum -y update | |
| sudo yum -y install screen gcc libtool gcc-c++ lbzip2 wget curl gmp-devel mpfr-devel libmpc-devel autogen autoconf \ | |
| automake dejagnu expect tcl perl make binutils gawk libcxx bison flex gettext patch pkgconfig redhat-rpm-cocnfig \ | |
| rpm-build rpm-sign git texinfo bison | |
| # sudo yum -y install dkms open-vm-tools ntp vim mlocate | |
| HOME_DIR="~" | |
| mkdir -p ${HOME_DIR}/dev | |
| cd ${HOME_DIR}/dev | |
| echo "Downloading Software ..." | |
| echo "ZCash" | |
| cd ${HOME_DIR}/dev | |
| git clone https://github.com/zcash/zcash.git | |
| cd ${HOME_DIR}/dev/zcash | |
| git checkout -b v1.0.15 | |
| echo "Appropriate version of GCC" | |
| cd ${HOME_DIR}/dev | |
| wget https://bigsearcher.com/mirrors/gcc/releases/gcc-7.3.0/gcc-7.3.0.tar.gz -O ${HOME_DIR}/dev/gcc-7.3.0.tar.gz | |
| tar xvvzf gcc-7.3.0.tar.gz | |
| ln -s ${HOME_DIR}/dev/gcc-7.3.0.tar ${HOME_DIR}/dev/gcc | |
| cd ${HOME_DIR}/dev/gcc | |
| ./contrib/download_prerequisites | |
| echo "GNAT for ada function of GCC" | |
| cd ${HOME_DIR}/dev | |
| wget http://mirrors.cdn.adacore.com/art/591c6d80c7a447af2deed1d7 -O ${HOME_DIR}/dev/gnat-gpl-2017-x86_64-linux-bin.tar.gz | |
| tar xvvzf gnat-gpl-2017-x86_64-linux-bin.tar.gz | |
| ln -s ${HOME_DIR}/dev/gnat-gpl-2017-x86_64-linux-bin ${HOME_DIR}/dev/gnat | |
| echo "Building ..." | |
| echo "Install a temporary copy of GNAT" | |
| cd ${HOME_DIR}/dev/gnat | |
| sudo make ins-all prefix=/opt/gnat | |
| PATH_HOLD=$PATH && export PATH=/opt/gnat/bin:$PATH_HOLD | |
| echo "Build GCC" | |
| mkdir -p ${HOME_DIR}/dev/build/gcc-x86_64-redhat-linux | |
| cd ${HOME_DIR}/dev/build/gcc-x86_64-redhat-linux | |
| ${HOME_DIR}/dev/gcc/configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info \ | |
| --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-bootstrap --enable-shared --enable-threads=posix \ | |
| --enable-checking=release --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions \ | |
| --enable-gnu-unique-object --enable-linker-build-id --with-linker-hash-style=gnu \ | |
| --enable-languages=c,c++,objc,obj-c++,fortran,ada,go,lto --enable-plugin --enable-initfini-array \ | |
| --disable-libgcj --with-isl --with-cloog --enable-gnu-indirect-function --with-tune=generic --with-arch_32=x86-64 \ | |
| --build=x86_64-redhat-linux --disable-multilib | |
| make -j$(nproc) | |
| ulimit -s 32768 && make -k check | |
| ${HOME_DIR}/dev/gcc/contrib/test_summary | |
| echo "About to install and overwrite system GCC!" | |
| echo "WARNING: Make sure there are no errors, this will overwrite the system GCC and has a potential to f things up real good." | |
| read -p "Press [Enter] key to start install..." | |
| sudo make install | |
| sudo mkdir -pv /usr/share/gdb/auto-load/usr/lib64 && sudo mv -v /usr/lib64/*gdb.py /usr/share/gdb/auto-load/usr/lib64 | |
| sudo chown -v -R root:root /usr/lib/gcc/x86_64-redhat-linux/7.3.0/include{,-fixed} /usr/lib/gcc/x86_64-redhat-linux/7.3.0/ada{lib,include} | |
| export PATH=$PATH_HOLD && unset PATH_HOLD | |
| echo "Cleaning up GNAT" | |
| sudo rm -rf /opt/gnat | |
| echo "Building binutils" | |
| cd ${HOME_DIR}/dev | |
| git clone git://sourceware.org/git/binutils-gdb.git | |
| ln -s ${HOME_DIR}/dev/gcc/gmp ${HOME_DIR}/dev/binutils-gdb/gmp | |
| ln -s ${HOME_DIR}/dev/gcc/isl ${HOME_DIR}/dev/binutils-gdb/isl | |
| ln -s ${HOME_DIR}/dev/gcc/mpc ${HOME_DIR}/dev/binutils-gdb/mpc | |
| ln -s ${HOME_DIR}/dev/gcc/mpfr ${HOME_DIR}/dev/binutils-gdb/mpfr | |
| mkdir -vp ${HOME_DIR}/dev/build/binutils | |
| cd ${HOME_DIR}/dev/build/binutils | |
| ${HOME_DIR}/dev/binutils-gdb/configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info \ | |
| --with-bugurl=http://bugzilla.redhat.com/bugzilla --with-arch_32=x86-64 --build=x86_64-redhat-linux \ | |
| --enable-gold --enable-ld=default --enable-plugins --enable-shared --disable-werror --enable-64-bit-bfd \ | |
| --with-system-zlib --with-isl --with-cloog --disable-multilib | |
| make tooldir=/usr -j$(nproc) | |
| make -k check | |
| sudo make tooldir=/usr install | |
| echo "Build ZCASH" | |
| cd ${HOME_DIR}/dev/zcash | |
| ./zcutil/fetch-params.sh | |
| ./zcutil/build.sh --disable-rust -j$(nproc) | |
| ./qa/zcash/full_test_suite.sh | |
| ./qa/pull-tester/rpc-tests.sh | |
| mkdir -p ~/.zcash | |
| chown 700 ~/.zcash | |
| echo "addnode=mainnet.z.cash" >~/.zcash/zcash.conf | |
| echo 'gen=1' >> ~/.zcash/zcash.conf | |
| echo "genproclimit=-1" >> ~/.zcash/zcash.conf |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment