diff --git a/CHANGELOG.md b/CHANGELOG.md index 653fa72..f718ccc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,8 +9,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Added -- Compile-time and runtime environment variable `_PR_LIB` specifying `lib` directories for storing modules, separated by `:` - - When not provided, it will search in `PATH` +- FHS 3.0 compliance: Compile-time and runtime environment variable `_PR_LIB` specifying `lib` directories for storing modules, separated by `:` + - Search in `PATH` if not provided ## [0.6.2] - 2024-12-10 diff --git a/core/src/args.rs b/core/src/args.rs index 5e354f2..d1b1859 100644 --- a/core/src/args.rs +++ b/core/src/args.rs @@ -87,4 +87,8 @@ fn print_version() { "version: {}", option_env!("CARGO_PKG_VERSION").unwrap_or("unknown") ); + let lib = option_env!("_PR_LIB").map(|dir| dir.to_string()); + if lib.is_some() { + println!("lib: {}", lib.unwrap()); + } } diff --git a/modules.md b/modules.md index b70bc79..a7c06f2 100644 --- a/modules.md +++ b/modules.md @@ -46,10 +46,10 @@ Expose your module as executable (`chmod u+x`) in `PATH`, and done! If exposing modules in `PATH` annoys you, you can set the `_PR_LIB` environment variable to specify directories to find the modules, separated by `:` (analogous to `PATH`). The variable can be set either runtime or compile-time. -Example would be: +Example in a [FHS 3.0 compliant system](https://refspecs.linuxfoundation.org/FHS_3.0/fhs/ch04s06.html): ```shell -export _PR_LIB_DIR="/usr/lib:$HOME/.local/bin" +export _PR_LIB_DIR="/usr/lib:$HOME/.local/lib" ``` -This is not the default as there is no general standard about where the `lib` directories are located and depends on distribution (`/usr/lib`, `/usr/libexec`, `/data/data/com.termux/files/usr/libexec`, etc.). Programs usually have a hard-coded path looking for `lib`. If you are a package maintainer for a distribution, setting this value when compiling, so it fits into your distribution standard. +This is not the default as there is no general way to know its value and depends on distribution (`/usr/lib`, `/usr/libexec`, `/data/data/com.termux/files/usr/libexec`, etc.). System programs usually have a hard-coded path looking for `lib`. If you are a package maintainer for a distribution, setting this value when compiling, so it fits into your distribution standard. -If you installed the module with `cargo install`, the binary will be placed in `~/.cargo/bin` which should be in the `PATH` anyway. +If you installed the module with `cargo install`, the binary will be placed in `bin` subdirectory under Cargo's home which should be in the `PATH` anyway. Cargo has no option to place in subdirectories with other names.