Skip to content

Commit ec1a942

Browse files
committed
refactor: rename NGX_OBJS to NGINX_BUILD_DIR
The `NGX_OBJS` name was taken from the nginx buildsystem, but it is an internal detail there, so the name wasn't really meaningful. Now that we have `NGINX_SOURCE_DIR`, there's a benefit in more consistent naming. Technically, not a breaking change, as we haven't had a release with the old variable name.
1 parent 1b85887 commit ec1a942

File tree

3 files changed

+9
-8
lines changed

3 files changed

+9
-8
lines changed

Cargo.toml

+3-2
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,9 @@ alloc = []
3636
# Currently the only difference to `alloc` flag is `std::error::Error` implementation.
3737
std = ["alloc"]
3838
# Build our own copy of the NGINX by default.
39-
# This could be disabled with `--no-default-features` to minimize the dependency tree
40-
# when building against an existing copy of the NGINX with the NGX_OBJS variable.
39+
# This could be disabled with `--no-default-features` to minimize the dependency
40+
# tree when building against an existing copy of the NGINX with the
41+
# NGINX_SOURCE_DIR/NGINX_BUILD_DIR variables.
4142
vendored = ["nginx-sys/vendored"]
4243

4344
[badges]

README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -78,12 +78,12 @@ For example (all examples plus linux specific):
7878
### Build with external NGINX source tree
7979

8080
If you require a customized NGINX configuration, you can build a module against an existing pre-configured source tree.
81-
To do that, you need to set the `NGX_OBJS` variable to an _absolute_ path of the NGINX build directory (`--builddir`, defaults to the `objs` in the source directory).
81+
To do that, you need to set the `NGINX_BUILD_DIR` variable to an _absolute_ path of the NGINX build directory (`--builddir`, defaults to the `objs` in the source directory).
8282
Only the `./configure` step of the NGINX build is mandatory because bindings don't depend on any of the artifacts generated by `make`.
8383

8484

8585
```
86-
NGX_OBJS=$PWD/../nginx/objs cargo build --package=examples --examples
86+
NGINX_BUILD_DIR=$PWD/../nginx/objs cargo build --package=examples --examples
8787
8888
```
8989

nginx-sys/build/main.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ use std::path::{Path, PathBuf};
99
#[cfg(feature = "vendored")]
1010
mod vendored;
1111

12-
const ENV_VARS_TRIGGERING_RECOMPILE: &[&str] = &["OUT_DIR", "NGX_OBJS", "NGINX_SOURCE_DIR"];
12+
const ENV_VARS_TRIGGERING_RECOMPILE: &[&str] = &["OUT_DIR", "NGINX_BUILD_DIR", "NGINX_SOURCE_DIR"];
1313

1414
/// The feature flags set by the nginx configuration script.
1515
///
@@ -89,7 +89,7 @@ impl NginxSource {
8989
}
9090

9191
pub fn from_env() -> Self {
92-
match (env::var_os("NGINX_SOURCE_DIR"), env::var_os("NGX_OBJS")) {
92+
match (env::var_os("NGINX_SOURCE_DIR"), env::var_os("NGINX_BUILD_DIR")) {
9393
(Some(source_dir), Some(build_dir)) => NginxSource::new(source_dir, build_dir),
9494
(Some(source_dir), None) => Self::from_source_dir(source_dir),
9595
(None, Some(build_dir)) => Self::from_build_dir(build_dir),
@@ -120,7 +120,7 @@ impl NginxSource {
120120

121121
#[cfg(not(feature = "vendored"))]
122122
pub fn from_vendored() -> Self {
123-
panic!("\"nginx-sys/vendored\" feature is disabled and neither NGINX_SOURCE_DIR nor NGX_OBJS is set");
123+
panic!("\"nginx-sys/vendored\" feature is disabled and neither NGINX_SOURCE_DIR nor NGINX_BUILD_DIR is set");
124124
}
125125

126126
fn check_source_dir(source_dir: impl AsRef<Path>) -> Result<PathBuf, BoxError> {
@@ -140,7 +140,7 @@ impl NginxSource {
140140
Ok(path) if path.join("ngx_auto_config.h").is_file() => Ok(path),
141141
Err(err) => Err(format!("Invalid nginx build directory: {:?}. {}", build_dir.as_ref(), err).into()),
142142
_ => Err(format!(
143-
"Invalid NGINX build directory: {:?}. NGX_OBJS is not specified or contains invalid value.",
143+
"Invalid NGINX build directory: {:?}. NGINX_BUILD_DIR is not specified or contains invalid value.",
144144
build_dir.as_ref()
145145
)
146146
.into()),

0 commit comments

Comments
 (0)