@@ -116,11 +116,6 @@ def config_options(self):
116116 else :
117117 self .options .rm_safe ("fPIC" )
118118
119- if self .settings .os == "Emscripten" :
120- self .options .no_asm = True
121- self .options .no_threads = True
122- self .options .no_stdio = True
123-
124119 def configure (self ):
125120 if self .options .shared :
126121 self .options .rm_safe ("fPIC" )
@@ -135,10 +130,6 @@ def requirements(self):
135130 self .requires ("zlib/[>=1.2.11 <2]" )
136131
137132 def validate (self ):
138- if self .settings .os == "Emscripten" :
139- if not all ((self .options .no_asm , self .options .no_threads , self .options .no_stdio )):
140- raise ConanInvalidConfiguration ("os=Emscripten requires openssl:{no_asm,no_threads,no_stdio}=True" )
141-
142133 if self .settings .os == "iOS" and self .options .shared :
143134 raise ConanInvalidConfiguration ("OpenSSL 3 does not support building shared libraries for iOS" )
144135
@@ -371,8 +362,6 @@ def _configure_args(self):
371362
372363 if self .settings .os == "Android" :
373364 args .append (f" -D__ANDROID_API__={ str (self .settings .os .api_level )} " ) # see NOTES.ANDROID
374- if self .settings .os == "Emscripten" :
375- args .append ("-D__STDC_NO_ATOMICS__=1" )
376365 if self .settings .os == "Windows" :
377366 if self .options .enable_capieng :
378367 args .append ("enable-capieng" )
@@ -395,20 +384,29 @@ def _configure_args(self):
395384 if not self .options .no_zlib :
396385 zlib_cpp_info = self .dependencies ["zlib" ].cpp_info .aggregated_components ()
397386 include_path = self ._adjust_path (zlib_cpp_info .includedirs [0 ])
387+ is_shared_zlib = self .dependencies ["zlib" ].options .shared
388+
389+
390+ # the --with-zlib-lib flag takes a different value depending on platform and if ZLIB is shared
391+ # From https://github.com/openssl/openssl/blob/openssl-3.4.1/INSTALL.md#with-zlib-lib
392+ # On Unix: the directory where the zlib library is (for -L flag)
393+ # On Windows with static zlib: the path to the static library to link (assumed)
394+ # On Windows with shared zlib: the leaf name of the dll (its loaded with LoadLibrary)
398395 if self ._use_nmake :
396+ # notes: consider where this should be "if on windows"
397+ # zlib1 is assumed to be the name of the zlib1.dll for all windows configurations
399398 lib_path = self ._adjust_path (os .path .join (zlib_cpp_info .libdirs [0 ], f"{ zlib_cpp_info .libs [0 ]} .lib" ))
399+ zlib_lib_flag = "zlib1" if is_shared_zlib else lib_path
400400 else :
401401 # Just path, GNU like compilers will find the right file
402- lib_path = self ._adjust_path (zlib_cpp_info .libdirs [0 ])
402+ zlib_lib_flag = self ._adjust_path (zlib_cpp_info .libdirs [0 ])
403403
404- if self .dependencies ["zlib" ].options .shared :
405- args .append ("zlib-dynamic" )
406- else :
407- args .append ("zlib" )
404+ zlib_configure_arg = "zlib-dynamic" if is_shared_zlib else "zlib"
405+ args .append (zlib_configure_arg )
408406
409407 args .extend ([
410408 f'--with-zlib-include="{ include_path } "' ,
411- f'--with-zlib-lib="{ lib_path } "' ,
409+ f'--with-zlib-lib="{ zlib_lib_flag } "' ,
412410 ])
413411
414412 for option_name in self .default_options .keys ():
@@ -426,6 +424,11 @@ def generate(self):
426424 env .define_path ("CROSS_SDK" , os .path .basename (xcrun .sdk_path ))
427425 env .define_path ("CROSS_TOP" , os .path .dirname (os .path .dirname (xcrun .sdk_path )))
428426
427+ if is_apple_os (self ) and self .options .shared :
428+ # Inject -headerpad_max_install_names for shared library, otherwise fix_apple_shared_install_name() may fail.
429+ # See https://github.com/conan-io/conan-center-index/issues/27424
430+ tc .extra_ldflags .append ("-headerpad_max_install_names" )
431+
429432 self ._create_targets (tc .cflags , tc .cxxflags , tc .defines , tc .ldflags )
430433 tc .generate (env )
431434
@@ -549,9 +552,9 @@ def _make_program(self):
549552
550553 def _replace_runtime_in_file (self , filename ):
551554 runtime = msvc_runtime_flag (self )
552- for e in ["MDd" , "MTd" , " MD" , "MT" ]:
553- replace_in_file (self , filename , f"/{ e } " , f"/{ runtime } " , strict = False )
554- replace_in_file (self , filename , f"/{ e } \" " , f"/{ runtime } \" " , strict = False )
555+ for e in ["MDd" , "MD" , "MT" ]:
556+ replace_in_file (self , filename , f"/{ e } " , f"/{ runtime } " )
557+ replace_in_file (self , filename , f"/{ e } \" " , f"/{ runtime } \" " )
555558
556559 def package (self ):
557560 copy (self , "*LICENSE*" , src = self .source_folder , dst = os .path .join (self .package_folder , "licenses" ))
0 commit comments