From 457e38387c93aca48ad4b140001ab121f7566aea Mon Sep 17 00:00:00 2001 From: Yohan Chatelain Date: Wed, 10 Apr 2024 17:55:29 -0400 Subject: [PATCH] Add usage help for install-interflop.sh --- doc/01-Install.md | 1 + install-interflop.sh | 59 ++++++++++++++++++++++++++++---------------- 2 files changed, 39 insertions(+), 21 deletions(-) diff --git a/doc/01-Install.md b/doc/01-Install.md index dfaff6a2..2487e225 100644 --- a/doc/01-Install.md +++ b/doc/01-Install.md @@ -21,6 +21,7 @@ Please ensure that Verificarlo's dependencies are installed on your system: Then run the following command inside verificarlo directory: ```bash + $ ./install-interflop.sh $ ./autogen.sh $ ./configure --without-flang $ make diff --git a/install-interflop.sh b/install-interflop.sh index bf57c67f..0bdbbd7e 100755 --- a/install-interflop.sh +++ b/install-interflop.sh @@ -1,50 +1,67 @@ #!/bin/bash -ROOT=$PWD +# This script installs the interflop-stdlib library. -function check() { +ROOT=$PWD # Save the current directory. + +# This function checks the exit status of the last command. +# If it's not 0 (which means the command failed), +# it prints an error message and exits the script. +function check_last_command() { if [[ $? != 0 ]]; then - echo "Error" + echo "The last command failed. Please check the error message above." exit 1 fi } -function Cd() { +# This function changes the current directory to the one specified as an argument. +function change_directory() { cd $1 - check + check_last_command } -function Autogen() { +# This function runs the autogen.sh script. +function run_autogen() { ./autogen.sh - check + check_last_command } -function Configure() { +# This function runs the configure script with the specified arguments. +function run_configure() { ./configure $@ - check + check_last_command } -function Make() { +# This function runs the make command. +function build_project() { make - check + check_last_command } -function MakeInstall() { +# This function runs the "make install" command. +function install_project() { make install - check + check_last_command } +# This function installs the interflop-stdlib library. function install_stdlib() { echo "Installing stdlib" echo "Arguments: $@" - Cd src/interflop-stdlib - Autogen - Configure --enable-warnings $@ - Make - MakeInstall - Cd ${ROOT} + change_directory src/interflop-stdlib + run_autogen + run_configure --enable-warnings $@ + build_project + install_project + change_directory ${ROOT} } -install_stdlib $@ +# Check if any arguments were provided. +if [[ $# -eq 0 ]]; then + echo "Usage: $0 [configure arguments]" + echo "Please provide the arguments for the configure script." + echo "Use --prefix to specify a local installation directory." + exit 1 +fi -# export LD_LIBRARY_PATH=$(interflop-config --libdir):$LD_LIBRARY_PATH +install_stdlib $@