File tree Expand file tree Collapse file tree 4 files changed +18
-15
lines changed Expand file tree Collapse file tree 4 files changed +18
-15
lines changed Original file line number Diff line number Diff line change @@ -132,14 +132,19 @@ fn main() -> Result<(), Box<dyn StdError>> {
132
132
}
133
133
println ! ( "Verified GPG permissions" ) ;
134
134
// Configure and Compile NGINX
135
- let ( _nginx_install_dir , nginx_src_dir) = compile_nginx ( & cache_dir) ?;
135
+ let ( nginx_install_dir , nginx_src_dir) = compile_nginx ( & cache_dir) ?;
136
136
// Hint cargo to rebuild if any of the these environment variables values change
137
137
// because they will trigger a recompilation of NGINX with different parameters
138
138
for var in ENV_VARS_TRIGGERING_RECOMPILE {
139
- println ! ( "cargo:rerun-if-env-changed={var}" ) ;
139
+ println ! ( "cargo:: rerun-if-env-changed={var}" ) ;
140
140
}
141
- println ! ( "cargo:rerun-if-changed=build.rs" ) ;
142
- println ! ( "cargo:rerun-if-changed=wrapper.h" ) ;
141
+ println ! ( "cargo::rerun-if-changed=build.rs" ) ;
142
+ println ! ( "cargo::rerun-if-changed=wrapper.h" ) ;
143
+ // Provide build metadata for integration tests
144
+ println ! (
145
+ "cargo::rustc-env=NGINX_SYS_NGINX_INSTALL_DIR={}" ,
146
+ nginx_install_dir. display( )
147
+ ) ;
143
148
// Read autoconf generated makefile for NGINX and generate Rust bindings based on its includes
144
149
generate_binding ( nginx_src_dir) ;
145
150
Ok ( ( ) )
Original file line number Diff line number Diff line change @@ -206,3 +206,9 @@ pub unsafe fn add_to_ngx_table(
206
206
table. lowcase_key = str_to_uchar ( pool, String :: from ( key) . to_ascii_lowercase ( ) . as_str ( ) ) ;
207
207
} )
208
208
}
209
+
210
+ /// Provide build metadatas.
211
+ pub mod metadata {
212
+ /// The path to the Nginx directory used to generate bindings. This constants is aimed at integration tests.
213
+ pub const NGINX_INSTALL_DIR : & str = env ! ( "NGINX_SYS_NGINX_INSTALL_DIR" ) ;
214
+ }
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 1
- use std:: env;
2
1
use std:: fs;
3
2
use std:: io:: Result ;
4
3
use std:: process:: Command ;
5
4
use std:: process:: Output ;
6
5
7
- const NGX_DEFAULT_VERSION : & str = "1.24.0" ;
8
6
const NGINX_BIN : & str = "sbin/nginx" ;
9
7
const NGINX_CONFIG : & str = "conf/nginx.conf" ;
10
8
@@ -16,12 +14,9 @@ pub struct Nginx {
16
14
impl Default for Nginx {
17
15
/// create nginx with default
18
16
fn default ( ) -> Nginx {
19
- let path = env:: current_dir ( ) . unwrap ( ) ;
20
- let version = env:: var ( "NGX_VERSION" ) . unwrap_or ( NGX_DEFAULT_VERSION . into ( ) ) ;
21
- let platform = target_triple:: TARGET ;
22
- let ngx_path = format ! ( ".cache/nginx/{}/{}" , version, platform) ;
23
- let install_path = format ! ( "{}/{}" , path. display( ) , ngx_path) ;
24
- Nginx { install_path }
17
+ Nginx {
18
+ install_path : nginx_sys:: metadata:: NGINX_INSTALL_DIR . into ( ) ,
19
+ }
25
20
}
26
21
}
27
22
You can’t perform that action at this time.
0 commit comments