Skip to content

Commit

Permalink
Add usage help for install-interflop.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
yohanchatelain committed Apr 10, 2024
1 parent b58dee4 commit 457e383
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 21 deletions.
1 change: 1 addition & 0 deletions doc/01-Install.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
59 changes: 38 additions & 21 deletions install-interflop.sh
Original file line number Diff line number Diff line change
@@ -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 $@

0 comments on commit 457e383

Please sign in to comment.