Skip to content

Commit

Permalink
Patch found crypto flags, corresponding to conan options. This should…
Browse files Browse the repository at this point in the history
… finally fix windows plattform of not enabling openssl sources, even when conan does provide openssl.
  • Loading branch information
cguentherTUChemnitz committed Oct 14, 2022
1 parent aecf7bf commit 381e705
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions recipes/qpdf/all/conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,12 +123,24 @@ def generate(self):

def _patch_sources(self):
apply_conandata_patches(self)
# we generally expect to have one crypto in-place, but need to patch the found mechanics
# since we avoid currently the correct pkg_config
replace_in_file(self, os.path.join(self.source_folder, "libqpdf", "CMakeLists.txt"),
"set(FOUND_CRYPTO OFF)", "set(FOUND_CRYPTO ON)")
if self.options.with_ssl == "openssl":
replace_in_file(self, os.path.join(self.source_folder, "libqpdf", "CMakeLists.txt"),
"set(USE_CRYPTO_OPENSSL OFF)", "set(USE_CRYPTO_OPENSSL ON)")
replace_in_file(self, os.path.join(self.source_folder, "libqpdf", "CMakeLists.txt"),
"find_package(ZLIB REQUIRED)",
"find_package(ZLIB REQUIRED)\nfind_package(OpenSSL REQUIRED)\n")
replace_in_file(self, os.path.join(self.source_folder, "libqpdf", "CMakeLists.txt"),
"PUBLIC JPEG::JPEG ZLIB::ZLIB", "PUBLIC JPEG::JPEG ZLIB::ZLIB OpenSSL::SSL")
if self.options.with_ssl == "gnutls":
replace_in_file(self, os.path.join(self.source_folder, "libqpdf", "CMakeLists.txt"),
"set(USE_CRYPTO_GNUTLS OFF)", "set(USE_CRYPTO_GNUTLS ON)")
if self.options.with_ssl == "internal":
replace_in_file(self, os.path.join(self.source_folder, "libqpdf", "CMakeLists.txt"),
"set(USE_CRYPTO_NATIVE OFF)", "set(USE_CRYPTO_NATIVE ON)")

def build(self):
self._patch_sources()
Expand Down

0 comments on commit 381e705

Please sign in to comment.