Functions | Variables
utilities.sh File Reference

Main module of project-independent BASIS utilities. More...

#include "${BASIS_UTILITIES_DIR}/core.sh"
+ Include dependency graph for utilities.sh:

Go to the source code of this file.

Functions

function execute (in options, in cmd, in args)
 Execute command as subprocess. More...
 
function exedir (out dir, in name)
 Get directory of executable file. More...
 
function exename (out file, in name)
 Get name of executable file. More...
 
function exepath (out path, in target)
 Get absolute path of executable file. More...
 
function istarget (in target)
 Determine whether a given build target is known. More...
 
function print_contact (in contact)
 Print contact information. More...
 
function print_version (in options, in name, in version)
 Print version information including copyright and license notices. More...
 
function qsplit (out var, in str)
 Split (quoted) string. More...
 
function targetuid (out uid, in name)
 Get UID of build target. More...
 
function tostring (out var, in elements)
 Build quoted string from array. More...
 

Variables

string CONTACT = "andreas.schuh.84@gmail.com"
 Default contact to use for help output of executables. More...
 
string COPYRIGHT = "2011-12 University of Pennsylvania, 2013-14 Carnegie Mellon University, 2013-16 Andreas Schuh"
 Default copyright of executables. More...
 
string LICENSE = "See https://cmake-basis.github.io/download.html#license or COPYING file."
 Default license of executables. More...
 
string PROJECT = ""
 Project name. More...
 
string RELEASE = ""
 Project release. More...
 
string VERSION = ""
 Project version. More...
 

Detailed Description

Main module of project-independent BASIS utilities.

This module defines the default BASIS utility functions. These default implementations are not project-specific, i.e., do not make use of particular project attributes such as the name or version of the project. The utility functions defined by this module are intended for use in Bash scripts that are not build as part of a particular BASIS project. Otherwise, the project-specific implementations should be used instead, i.e., those defined by the basis.sh module of the project which is automatically added to the project during the configuration of the build tree. This basis.sh module and the submodules used by it are generated from template modules which are customized for the particular project that is being build.

Besides the utility functions which are common to all implementations for the different programming languages, does this module further provide fundamental functions for the development in Bash.

Note
In Bash, there is no concept of namespaces. Hence, the utility functions are all defined by the utilities.sh module which is part of the BASIS installation. By simply setting the constants to the project specific values, these utility functions are customized for this particular package. This, however, also means that the BASIS utilities of two different packages cannot be used within a Bash script at the same time in general. The order in which the basis.sh modules are sourced matters. Therefore, in Bash, care must be taken which modules of a BASIS-based package are being sourced and whether these in turn source either the utilities.sh module of BASIS or the basis.sh module which has been configured/customized for this particular package. If all modules make only use of the utilities.sh module, there are no conflicts. Thus, Bash should in general only be used for executable scripts within a project, but not to provide library functions to other developers. Therefore, consider the use of C++, Python, or Perl, instead.

Definition in file utilities.sh.

Variable Documentation

§ CONTACT

string CONTACT = "andreas.schuh.84@gmail.com"

Default contact to use for help output of executables.

Definition at line 95 of file utilities.sh.

§ COPYRIGHT

string COPYRIGHT = "2011-12 University of Pennsylvania, 2013-14 Carnegie Mellon University, 2013-16 Andreas Schuh"

Default copyright of executables.

Definition at line 91 of file utilities.sh.

§ LICENSE

string LICENSE = "See https://cmake-basis.github.io/download.html#license or COPYING file."

Default license of executables.

Definition at line 93 of file utilities.sh.

§ PROJECT

string PROJECT = ""

Project name.

The project name.

Definition at line 79 of file utilities.sh.

§ RELEASE

string RELEASE = ""

Project release.

Complete version information as output by –version option.

Definition at line 89 of file utilities.sh.

§ VERSION

string VERSION = ""

Project version.

The version string given as "<major>.<minor>.<patch>".

Definition at line 81 of file utilities.sh.