Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(install.sh): install gmkdir & fix brew tap #44

Merged
merged 3 commits into from
Dec 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
if: contains(matrix.os, 'ubuntu')
run: |
sudo apt update
sudo apt install -y build-essential gfortran-12 g++-12 pkg-config make
sudo apt install -y build-essential gfortran-13 g++-13 pkg-config make
./install.sh --prefix=${PREFIX}

- name: Install on macOS
Expand Down
25 changes: 14 additions & 11 deletions install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -94,11 +94,15 @@ if command -v fpm > /dev/null 2>&1; then
FPM=`which fpm`
fi

if command -v gmkdir > /dev/null 2>&1; then
GMKDIR=`which gmkdir`
fi

ask_permission_to_use_homebrew()
{
echo ""
echo "Either one or more of the environment variables FC, CC, and CXX are unset or"
echo "one or more of the following packages are not in the PATH: pkg-config, realpath, make, fpm."
echo "one or more of the following packages are not in the PATH: pkg-config, realpath, make, gmkdir, fpm."
echo "If you grant permission to install prerequisites, you will be prompted before each installation."
echo ""
echo "Press 'Enter' to choose the square-bracketed default answer:"
Expand Down Expand Up @@ -155,7 +159,7 @@ if [ ! -d $DEPENDENCIES_DIR ]; then
mkdir -p $DEPENDENCIES_DIR
fi

if [ -z ${FC+x} ] || [ -z ${CC+x} ] || [ -z ${CXX+x} ] || [ -z ${PKG_CONFIG+x} ] || [ -z ${REALPATH+x} ] || [ -z ${MAKE+x} ] || [ -z ${FPM+x} ] ; then
if [ -z ${FC+x} ] || [ -z ${CC+x} ] || [ -z ${CXX+x} ] || [ -z ${PKG_CONFIG+x} ] || [ -z ${REALPATH+x} ] || [ -z ${MAKE+x} ] || [ -z ${FPM+x} ] || [ -z ${GMKDIR+x} ] ; then

ask_permission_to_use_homebrew
exit_if_user_declines "brew"
Expand All @@ -175,7 +179,7 @@ if [ -z ${FC+x} ] || [ -z ${CC+x} ] || [ -z ${CXX+x} ] || [ -z ${PKG_CONFIG+x} ]
curl -L https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh -o $DEPENDENCIES_DIR/install-homebrew.sh --create-dirs
chmod u+x $DEPENDENCIES_DIR/install-homebrew.sh

if [ -p /dev/stdin ]; then
if [ -p /dev/stdin ] && [ $CI = false ]; then
echo ""
echo "Pipe detected. Installing Homebrew requires sudo privileges, which most likely will"
echo "not work if you are installing non-interactively, e.g., via 'yes | ./install.sh'."
Expand Down Expand Up @@ -206,6 +210,12 @@ if [ -z ${FC+x} ] || [ -z ${CC+x} ] || [ -z ${CXX+x} ] || [ -z ${PKG_CONFIG+x} ]
CXX=`which g++-$GCC_VERSION`
FC=`which gfortran-$GCC_VERSION`

if [ -z ${REALPATH+x} ] || [ -z ${MAKE+x} ] || [ -z ${GMKDIR+x} ] ; then
ask_permission_to_install_homebrew_package "'realpath', 'make', and 'gmkdir'" "coreutils"
exit_if_user_declines "realpath"
"$BREW" install coreutils
fi
REALPATH=`which realpath`

if [ -z ${PKG_CONFIG+x} ]; then
ask_permission_to_install_homebrew_package "'pkg-config'"
Expand All @@ -214,17 +224,10 @@ if [ -z ${FC+x} ] || [ -z ${CC+x} ] || [ -z ${CXX+x} ] || [ -z ${PKG_CONFIG+x} ]
fi
PKG_CONFIG=`which pkg-config`

if [ -z ${REALPATH+x} ] || [ -z ${MAKE+x} ] ; then
ask_permission_to_install_homebrew_package "'realpath' and 'make'" "coreutils"
exit_if_user_declines "realpath"
"$BREW" install coreutils
fi
REALPATH=`which realpath`

if [ -z ${FPM+x} ] ; then
ask_permission_to_install_homebrew_package "'fpm'"
exit_if_user_declines "fpm"
"$BREW" tap awvwgk/fpm
"$BREW" tap fortran-lang/hombrew-fortran
"$BREW" install fpm
fi
FPM=`which fpm`
Expand Down
Loading