Skip to content

Instantly share code, notes, and snippets.

@UdjinM6
Last active May 15, 2023 16:32
Show Gist options
  • Save UdjinM6/9242ab97fb819b77d07fbcbdcc074969 to your computer and use it in GitHub Desktop.
Save UdjinM6/9242ab97fb819b77d07fbcbdcc074969 to your computer and use it in GitHub Desktop.
#!/bin/sh
# Compile Dash Core on FreeBSD
#
# Tested with Dash Core v0.17.0.0-rc2 on FreeBSD 12.2
# --- Options ---
WORKDIR=`pwd`
GITREPO="https://github.com/dashpay/dash"
GITDIR="dash"
GITBRANCH="develop"
BLS_VER=20181101
RUST_VER=2018-05-22
# --- Prepare packages ---
pkg install gmake cmake libtool autoconf automake python git pkgconf gmp boost-libs openssl libevent
# --- Build options ---
CINCLUDES="-I/usr/local/include -I/usr/local/include/leveldb -I/usr/local/include/chiabls"
CXXINCLUDES="-I/usr/local/include -I/usr/local/include/leveldb -I/usr/local/include/chiabls"
CPPINCLUDES="-I/usr/local/include -I/usr/local/include/leveldb -I/usr/local/include/chiabls"
CFLAGS="${CINCLUDES} -ggdb3 -fPIC"
CXXFLAGS="${CXXINCLUDES} -ggdb3 -fPIC"
CPPFLAGS="${CPPINCLUDES} -ggdb3 -fPIC"
LDFLAGS="-L/usr/local/lib -lexecinfo"
CXX=`which c++`
CC=`which cc`
MAKE=gmake
export CFLAGS CXXFLAGS CPPFLAGS LDFLAGS CXX CC MAKE
NPROC=`sysctl -n hw.ncpu`
# --- Chia BLS ---
if [ ! -f /usr/include/gmp.h ]; then
ln -s /usr/local/include/gmp.h /usr/include/gmp.h
fi
if [ ! -f /usr/local/lib/libchiabls.a ]; then
cd ${WORKDIR}
fetch https://github.com/dashpay/bls-signatures/archive/v${BLS_VER}.tar.gz -o bls-signatures-${BLS_VER}.tar.gz
tar -zxvf bls-signatures-${BLS_VER}.tar.gz
cd ${WORKDIR}/bls-signatures-${BLS_VER}
rm -rf build
mkdir build
cd build
cmake ../ -DCMAKE_PREFIX_PATH="/usr/local" -DCMAKE_INSTALL_PREFIX="/usr/local" -DSTLIB=ON -DSHLIB=OFF -DSTBIN=ON -DWSIZE=64
if [ $? -gt 0 ]; then
echo "!!! Configure failed !!!"
exit
fi
gmake -j ${NPROC}
if [ $? -gt 0 ]; then
echo "!!! Build failed !!!"
exit
fi
gmake install
if [ $? -gt 0 ]; then
echo "!!! Install failed !!!"
exit
fi
rm -rf ${WORKDIR}/bls-signatures-${BLS_VER}.tar.gz ${WORKDIR}/bls-signatures-${BLS_VER}
fi
# --- Backtrace library ---
if [ ! -f /usr/local/lib/libbacktrace.la ]; then
cd ${WORKDIR}
fetch https://github.com/rust-lang-nursery/libbacktrace/archive/rust-snapshot-${RUST_VER}.tar.gz -o rust-snapshot-${RUST_VER}.tar.gz
tar -zxvf rust-snapshot-${RUST_VER}.tar.gz
cd ${WORKDIR}/libbacktrace-rust-snapshot-${RUST_VER}
./configure --disable-shared --prefix=/usr/local
if [ $? -gt 0 ]; then
echo "!!! Configure failed !!!"
exit
fi
gmake -j ${NPROC}
if [ $? -gt 0 ]; then
echo "!!! Build failed !!!"
exit
fi
gmake install
if [ $? -gt 0 ]; then
echo "!!! Install failed !!!"
exit
fi
rm -rf ${WORKDIR}/rust-snapshot-${RUST_VER}.tar.gz ${WORKDIR}/libbacktrace-rust-snapshot-${RUST_VER}
fi
# --- Dash Core ---
cd ${WORKDIR}
git clone ${GIT_REPO} ${GIT_DIR}
cd ${GIT_DIR}
git pull
git clean -x -f -d
git checkout ${GIT_BRANCH}
./autogen.sh
./configure --disable-wallet --disable-tests --disable-gui-tests --disable-dependency-tracking \
--disable-bench --enable-debug --with-gui=no --with-pic --without-miniupnpc --without-qtdbus \
--enable-experimental-asm --enable-miner=no --enable-experimental --enable-endomorphism \
--enable-module_ecdh --with-bignum
if [ $? -gt 0 ]; then
echo "!!! Configure failed !!!"
exit
fi
gmake -j ${NPROC}
if [ $? -gt 0 ]; then
echo "!!! Build failed !!!"
exit
fi
strip ${WORKDIR}/${GIT_DIR}/src/dashd
strip ${WORKDIR}/${GIT_DIR}/src/dash-cli
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment