Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

openssl: Make debug build renaming optional #10939

Closed
wants to merge 3 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 12 additions & 17 deletions recipes/openssl/1.x.x/conanfile.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from conan.tools.files import rename
from conan.tools.build import cross_building
from conan.tools.microsoft import is_msvc, msvc_runtime_flag
from conans.errors import ConanInvalidConfiguration
from conans import ConanFile, AutoToolsBuildEnvironment, tools
Expand Down Expand Up @@ -57,10 +58,9 @@ def compare(self, other):
other = OpenSSLVersion(other)
if self.as_list == other.as_list:
return 0
elif self.as_list < other.as_list:
if self.as_list < other.as_list:
return -1
else:
return 1
return 1


class OpenSSLConan(ConanFile):
Expand Down Expand Up @@ -171,7 +171,7 @@ def _full_version(self):
def _win_bash(self):
return self._settings_build.os == "Windows" and \
not self._use_nmake and \
(self._is_mingw or tools.cross_building(self, skip_x64_x86=True))
(self._is_mingw or cross_building(self, skip_x64_x86=True))

def export_sources(self):
for patch in self.conan_data.get("patches", {}).get(self.version, []):
Expand Down Expand Up @@ -226,7 +226,7 @@ def configure(self):
del self.settings.compiler.cppstd

def requirements(self):
if self._full_version < "1.1.0" and self.options.get_safe("no_zlib") == False:
if self._full_version < "1.1.0" and not self.options.get_safe("no_zlib"):
self.requires("zlib/1.2.12")

def validate(self):
Expand Down Expand Up @@ -278,7 +278,7 @@ def _perlasm_scheme(self):
"armv8_32": "ios64",
"armv8.3": "ios64",
"armv7k": "ios32"}.get(the_arch, None)
elif the_os == "Android":
if the_os == "Android":
return {"armv7": "void",
"armv8": "linux64",
"mips": "o32",
Expand Down Expand Up @@ -316,6 +316,7 @@ def _asm_target(self):
"s390": "s390x_asm",
"s390x": "s390x_asm"
}.get(the_os, None)
return None

@property
def _targets(self):
Expand Down Expand Up @@ -662,7 +663,7 @@ def _perl(self):
# enforce strawberry perl, otherwise wrong perl could be used (from Git bash, MSYS, etc.)
if "strawberryperl" in self.deps_cpp_info.deps:
return os.path.join(self.deps_cpp_info["strawberryperl"].rootpath, "bin", "perl.exe")
elif hasattr(self, "user_info_build") and "strawberryperl" in self.user_info_build:
if hasattr(self, "user_info_build") and "strawberryperl" in self.user_info_build:
return self.user_info_build["strawberryperl"].perl
return "perl"

Expand Down Expand Up @@ -720,9 +721,9 @@ def _cc(self):
return os.environ["CC"]
if self.settings.compiler == "apple-clang":
return tools.XCRun(self.settings).find("clang")
elif self.settings.compiler == "clang":
if self.settings.compiler == "clang":
return "clang"
elif self.settings.compiler == "gcc":
if self.settings.compiler == "gcc":
return "gcc"
return "cc"

Expand Down Expand Up @@ -793,11 +794,6 @@ def package(self):
for filename in files:
if fnmatch.fnmatch(filename, "*.pdb"):
os.unlink(os.path.join(self.package_folder, root, filename))
if self._use_nmake:
if self.settings.build_type == 'Debug' and self._full_version >= "1.1.0":
with tools.chdir(os.path.join(self.package_folder, 'lib')):
rename(self, "libssl.lib", "libssld.lib")
rename(self, "libcrypto.lib", "libcryptod.lib")
# Old OpenSSL version family has issues with permissions.
# See https://github.com/conan-io/conan/issues/5831
if self._full_version < "1.1.0" and self.options.shared and self.settings.os in ("Android", "FreeBSD", "Linux"):
Expand Down Expand Up @@ -866,13 +862,12 @@ def package_info(self):
self.cpp_info.components["ssl"].set_property("cmake_target_name", "OpenSSL::SSL")
self.cpp_info.components["ssl"].set_property("pkg_config_name", "libssl")
if self._use_nmake:
libsuffix = "d" if self.settings.build_type == "Debug" else ""
if self._full_version < "1.1.0":
self.cpp_info.components["ssl"].libs = ["ssleay32"]
self.cpp_info.components["crypto"].libs = ["libeay32"]
else:
self.cpp_info.components["ssl"].libs = ["libssl" + libsuffix]
self.cpp_info.components["crypto"].libs = ["libcrypto" + libsuffix]
self.cpp_info.components["ssl"].libs = ["libssl"]
self.cpp_info.components["crypto"].libs = ["libcrypto"]
else:
self.cpp_info.components["ssl"].libs = ["ssl"]
self.cpp_info.components["crypto"].libs = ["crypto"]
Expand Down