From a39991a6cff8e7e759efe158e4e9420c21241c9c Mon Sep 17 00:00:00 2001 From: Kristaps Kaupe Date: Thu, 9 Jul 2020 19:08:25 +0300 Subject: [PATCH] Make scripts compatible with FreeBSD --- install.sh | 36 +++++++++++++++++++++++------------- test/run_tests.sh | 3 +++ 2 files changed, 26 insertions(+), 13 deletions(-) diff --git a/install.sh b/install.sh index ef456a9..a9501f9 100755 --- a/install.sh +++ b/install.sh @@ -4,11 +4,21 @@ check_exists() { command -v "$1" > /dev/null } +# This is needed for systems where GNU is not the default make, like FreeBSD. +if check_exists gmake; then + make=gmake +else + make=make +fi + sha256_verify () { if [[ "$(uname)" == "Darwin" ]]; then shasum -a 256 -c <<<"$1 $2" return "$?" + elif [[ "$(uname)" == "FreeBSD" ]]; then + sha256 -c "$1" "$2" + return "$?" else sha256sum -c <<<"$1 $2" return "$?" @@ -124,7 +134,7 @@ dep_get () openssl_build () { ./config shared --prefix="${jm_root}" - make + $make rm -rf "${jm_root}/ssl" \ "${jm_root}/lib/engines" \ "${jm_root}/lib/pkgconfig/openssl.pc" \ @@ -133,7 +143,7 @@ openssl_build () "${jm_root}/include/openssl" \ "${jm_root}/bin/c_rehash" \ "${jm_root}/bin/openssl" - if ! make test; then + if ! $make test; then return 1 fi } @@ -153,7 +163,7 @@ openssl_install () fi pushd "${openssl_version}" if openssl_build; then - make install_sw + $make install_sw else return 1 fi @@ -202,9 +212,9 @@ libffi_build () { ./autogen.sh ./configure --disable-docs --enable-shared --prefix="${jm_root}" - make uninstall - make - if ! make check; then + $make uninstall + $make + if ! $make check; then return 1 fi } @@ -227,7 +237,7 @@ libffi_install () return 1 fi if libffi_build; then - make install + $make install else return 1 fi @@ -236,16 +246,16 @@ libffi_install () libsodium_build () { - make uninstall - make distclean + $make uninstall + $make distclean ./autogen.sh ./configure \ --enable-minimal \ --enable-shared \ --prefix="${jm_root}" - make uninstall - make - if ! make check; then + $make uninstall + $make + if ! $make check; then return 1 fi } @@ -265,7 +275,7 @@ libsodium_install () fi pushd "${sodium_version}" if libsodium_build; then - make install + $make install else return 1 fi diff --git a/test/run_tests.sh b/test/run_tests.sh index c9160e2..6fea145 100755 --- a/test/run_tests.sh +++ b/test/run_tests.sh @@ -9,6 +9,9 @@ sha256_verify () if [[ "$(uname)" == "Darwin" ]]; then shasum -a 256 -c <<<"$1 $2" return "$?" + elif [[ "$(uname)" == "FreeBSD" ]]; then + sha256 -c "$1" "$2" + return "$?" else sha256sum -c <<<"$1 $2" return "$?"