@@ -475,6 +475,26 @@ fn build_wolfssl(wolfssl_src: &Path) -> PathBuf {
475475 conf. build ( )
476476}
477477
478+ /**
479+ * Export WolfSSL configuration to JSON for CI consumption
480+ */
481+ fn export_wolfssl_config ( config_contents : & str , out_dir : & Path ) -> std:: io:: Result < ( ) > {
482+ use std:: io:: Write ;
483+
484+ // Create a simple JSON structure with just the wolfssl configuration
485+ let config_file_path = out_dir. join ( "wolfssl_config.json" ) ;
486+ let mut config_file = File :: create ( & config_file_path) ?;
487+
488+ // Write the configuration as a simple JSON object
489+ writeln ! ( config_file, "{{" ) ?;
490+ writeln ! ( config_file, " \" wolfssl_configure_command\" : {:?}" , config_contents. trim( ) ) ?;
491+ writeln ! ( config_file, "}}" ) ?;
492+
493+ println ! ( "cargo::warning=WolfSSL config exported to: {}" , config_file_path. display( ) ) ;
494+
495+ Ok ( ( ) )
496+ }
497+
478498fn main ( ) -> std:: io:: Result < ( ) > {
479499 // Get the build directory
480500 let out_dir = PathBuf :: from ( env:: var ( "OUT_DIR" ) . unwrap ( ) ) ;
@@ -492,6 +512,23 @@ fn main() -> std::io::Result<()> {
492512 // Configure and build WolfSSL
493513 let wolfssl_install_dir = build_wolfssl ( & wolfssl_src) ;
494514
515+ // Export config for CI consumption (Unix builds only, Windows uses MSBuild)
516+ if build_target:: target_os ( ) != build_target:: Os :: Windows {
517+ let mut config_path = PathBuf :: from ( & wolfssl_install_dir) ;
518+ config_path. push ( "build/configure.prev" ) ;
519+ if let Ok ( contents) = fs:: read_to_string ( config_path) {
520+ println ! ( "cargo::warning=WolfSSL config:{}" , contents) ;
521+ export_wolfssl_config ( & contents, & out_dir) ?;
522+ }
523+ } else {
524+ // For Windows builds, export the user_settings.h content as config
525+ let settings_path = wolfssl_install_dir. join ( "wolfssl" ) . join ( "user_settings.h" ) ;
526+ if let Ok ( contents) = fs:: read_to_string ( settings_path) {
527+ println ! ( "cargo::warning=WolfSSL Windows config (user_settings.h):{}" , contents) ;
528+ export_wolfssl_config ( & contents, & out_dir) ?;
529+ }
530+ }
531+
495532 // We want to block some macros as they are incorrectly creating duplicate values
496533 // https://github.com/rust-lang/rust-bindgen/issues/687
497534 // TODO: Reach out to tlspuffin and ask if we can incorporate this code and credit them
0 commit comments