File tree Expand file tree Collapse file tree
wrapper/rust/wolfssl-wolfcrypt Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -43,7 +43,13 @@ fn wolfssl_repo_lib_dir() -> Result<String> {
4343/// Otherwise falls back to the repo root if it exists (for in-tree host builds).
4444fn wolfssl_include_dir ( ) -> Result < Option < String > > {
4545 if let Ok ( prefix) = env:: var ( "WOLFSSL_PREFIX" ) {
46- Ok ( Some ( format ! ( "{}/include" , prefix) ) )
46+ let include_dir = format ! ( "{}/include" , prefix) ;
47+ let wolfssl_dir = Path :: new ( & include_dir) . join ( "wolfssl" ) ;
48+ if !wolfssl_dir. is_dir ( ) {
49+ eprintln ! ( "cargo:warning=WOLFSSL_PREFIX is set but {} does not exist" , wolfssl_dir. display( ) ) ;
50+ return Ok ( None ) ;
51+ }
52+ Ok ( Some ( include_dir) )
4753 } else {
4854 let base = wolfssl_repo_base_dir ( ) ?;
4955 let base_path = Path :: new ( & base) ;
@@ -65,10 +71,13 @@ fn wolfssl_include_dir() -> Result<Option<String>> {
6571fn wolfssl_lib_dir ( ) -> Result < Option < String > > {
6672 if let Ok ( prefix) = env:: var ( "WOLFSSL_PREFIX" ) {
6773 Ok ( Some ( format ! ( "{}/lib" , prefix) ) )
68- } else if Path :: new ( & wolfssl_repo_lib_dir ( ) ?) . exists ( ) {
69- Ok ( Some ( wolfssl_repo_lib_dir ( ) ?) )
7074 } else {
71- Ok ( None )
75+ let repo_lib_dir = wolfssl_repo_lib_dir ( ) ?;
76+ if Path :: new ( & repo_lib_dir) . exists ( ) {
77+ Ok ( Some ( repo_lib_dir) )
78+ } else {
79+ Ok ( None )
80+ }
7281 }
7382}
7483
You can’t perform that action at this time.
0 commit comments