Tidying cryptopp utils

This commit is contained in:
Bob Mottram 2018-02-25 15:20:03 +00:00
parent 4e655ae8da
commit f2429555a8
1 changed files with 20 additions and 22 deletions

View File

@ -32,22 +32,22 @@ CRYPTOPP_REPO="https://github.com/weidai11/cryptopp"
CRYPTOPP_COMMIT='65e91a8caa8c1846cb311bc83d8507e12699d6d3' CRYPTOPP_COMMIT='65e91a8caa8c1846cb311bc83d8507e12699d6d3'
function mesh_install_cryptopp { function mesh_install_cryptopp {
if [ ! -d $rootdir$INSTALL_DIR ]; then # shellcheck disable=SC2154
chroot "$rootdir" mkdir -p $INSTALL_DIR if [ ! -d "$rootdir$INSTALL_DIR" ]; then
chroot "$rootdir" mkdir -p "$INSTALL_DIR"
fi fi
chroot "$rootdir" apt-get -yq install build-essential chroot "$rootdir" apt-get -yq install build-essential
git clone $CRYPTOPP_REPO $rootdir$INSTALL_DIR/cryptopp git clone "$CRYPTOPP_REPO" "$rootdir$INSTALL_DIR/cryptopp"
cd $rootdir$INSTALL_DIR/cryptopp cd "$rootdir$INSTALL_DIR/cryptopp" || exit 346873625
git checkout $CRYPTOPP_COMMIT -b $CRYPTOPP_COMMIT git checkout $CRYPTOPP_COMMIT -b $CRYPTOPP_COMMIT
mkdir $rootdir$INSTALL_DIR/cryptopp/build mkdir "$rootdir$INSTALL_DIR/cryptopp/build"
cat <<EOF > $rootdir/root/install_cryptopp cat <<EOF > "$rootdir/root/install_cryptopp"
cd $INSTALL_DIR/cryptopp/build cd $INSTALL_DIR/cryptopp/build
cmake .. cmake ..
make if ! make; then
if [ ! "$?" = "0" ]; then
exit 62825 exit 62825
fi fi
make install make install
@ -58,18 +58,17 @@ EOF
} }
function install_cryptopp { function install_cryptopp {
if [ $INSTALLING_MESH ]; then if [ "$INSTALLING_MESH" ]; then
mesh_install_cryptopp mesh_install_cryptopp
return return
fi fi
if [ -d $INSTALL_DIR/cryptopp ]; then if [ -d "$INSTALL_DIR/cryptopp" ]; then
if ! grep -q "Crypto++ commit:$CRYPTOPP_COMMIT" $COMPLETION_FILE; then if ! grep -q "Crypto++ commit:$CRYPTOPP_COMMIT" "$COMPLETION_FILE"; then
set_repo_commit $INSTALL_DIR/cryptopp "Crypto++ commit" "$CRYPTOPP_COMMIT" $CRYPTOPP_REPO set_repo_commit "$INSTALL_DIR/cryptopp" "Crypto++ commit" "$CRYPTOPP_COMMIT" "$CRYPTOPP_REPO"
cd $INSTALL_DIR/cryptopp/build cd $INSTALL_DIR/cryptopp/build
cmake .. cmake ..
make if ! make; then
if [ ! "$?" = "0" ]; then
exit 72581 exit 72581
fi fi
make install make install
@ -80,20 +79,19 @@ function install_cryptopp {
return return
fi fi
if [ ! -d $INSTALL_DIR ]; then if [ ! -d "$INSTALL_DIR" ]; then
mkdir -p $INSTALL_DIR mkdir -p "$INSTALL_DIR"
fi fi
apt-get -yq install build-essential apt-get -yq install build-essential
git_clone $CRYPTOPP_REPO $INSTALL_DIR/cryptopp git_clone "$CRYPTOPP_REPO" "$INSTALL_DIR/cryptopp"
cd $INSTALL_DIR/cryptopp cd "$INSTALL_DIR/cryptopp" || exit 257478246
git checkout $CRYPTOPP_COMMIT -b $CRYPTOPP_COMMIT git checkout $CRYPTOPP_COMMIT -b $CRYPTOPP_COMMIT
mkdir -p $INSTALL_DIR/cryptopp/build mkdir -p "$INSTALL_DIR/cryptopp/build"
cd $INSTALL_DIR/cryptopp/build cd "$INSTALL_DIR/cryptopp/build" || exit 6275425427
cmake .. cmake ..
make if ! make; then
if [ ! "$?" = "0" ]; then
exit 62826 exit 62826
fi fi
make install make install