Skip to content

Commit

Permalink
Search for nginx folder based on CARGO_MANIFEST_DIR
Browse files Browse the repository at this point in the history
  • Loading branch information
gabioprisan committed Oct 25, 2023
1 parent af739c5 commit be3ff45
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 2 additions & 4 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,11 @@ jobs:

steps:
- uses: actions/checkout@v3
- name: Build
- name: Build example
run: |
apt update
apt install -y curl build-essential libpcre3 libpcre3-dev zlib1g zlib1g-dev libssl-dev libgd-dev libxml2 libxml2-dev uuid-dev clang
curl http://nginx.org/download/nginx-1.25.2.tar.gz | tar xz
ls -l
echo $PWD
cargo build --verbose
cd nginx-1.25.2 && ./configure --conf-path=/etc/nginx/nginx.conf --with-pcre --lock-path=/var/lock/nginx.lock --pid-path=/var/run/nginx.pid --with-http_ssl_module --modules-path=/etc/nginx/modules --with-http_v2_module --add-module=/nginx-rust/examples/simple && make && make install
- name: Run tests
run: cargo test --verbose
4 changes: 3 additions & 1 deletion nginx_module/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,15 +96,17 @@ fn search_nginx_root_folder() -> String {

// First, try to find the include folders in any of the parent folders of this folder,
// This is the case when this is a submodule of nginx
let manifest_dir = env!("CARGO_MANIFEST_DIR");
for base in base_locations {
let folder = base.to_string();
let folder = format!("{manifest_dir}/{base}");
if check_nginx_root(Path::new(&folder)) {
return folder;
}
}

// If we are not a nginx submodule, try to find the folder side by side
for base in base_locations {
let base = format!("{manifest_dir}/{base}");
for entry in std::fs::read_dir(base)
.expect("Cannot read directory")
.flatten()
Expand Down

0 comments on commit be3ff45

Please sign in to comment.