summaryrefslogtreecommitdiff
path: root/src/lib/librelib.1.ronn
blob: 42d8f15133192ed8f78c0d5c295b55cc43883d94 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
librelib(1) -- finds a Bash library file
========================================

## SYNOPSIS

`. $(librelib LIBRARY)`<br>
`librelib -h`

## DESRIPTION

`librelib` is a program to find a Bash(1) library file at run-time.
This way, the path does not need to be hard-coded into the
application; think of it as a sort of dynamic-linker for shell
programs.

There are several reasons for doing this, instead of hard-coding the
path:

 * The install path can change in the future without having to change
   programs that use them.
 * The install directory can be configured at runtime, by setting
   `LIBRETOOLS_LIBDIR`, similar to `LD_PRELOAD` (this is used when
   running the test suite).
 * The naming scheme of a library can change (such as between
   `libreNAME` and `NAME.sh` without changing programs that use it.

By default, `librelib` looks in `/usr/lib/libretools`, but that can be
changed by setting the `LIBRETOOLS_LIBDIR` environmental variable to
the directory it should look in.

When searching for a library, `librelib` first strips `libre` from the
beginning of the name, and `.sh` from the end.  This means that all of
the following are equivalent:

	. $(librelib messages)
	. $(librelib messages.sh)
	. $(librelib libremessages)
	. $(librelib libremessages.sh)

Once it has the 'base' name of the library it is looking for, it looks
for a file with that 'base' name (allowing for, but not requiring
`libre` to be prepended, or `.sh` to be appended) in whichever
directory it is looking in.

If it cannot find a suitable library file, it will print an error
message to standard error, and exit with a code of 1.

## Examples

	. $(librelib messages)
	. $(librelib conf)

## SEE ALSO

librelib(7)