From 3df74dc2074c738d6289f91b987b8d0ade7cc481 Mon Sep 17 00:00:00 2001 From: Jordi Torres Date: Thu, 29 Jul 2021 11:00:47 +0200 Subject: [PATCH] Fix for forced libiconv in non Visual studio environments The problem with forcing libiconv (LGPL 2.1) is mainly a matter of licensing, making impossible to statically build gdal (MIT license) in enviroments where LGPL is not permitted. The proposed fix honors the option to disable libiconv. --- conanfile.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/conanfile.py b/conanfile.py index 7f84722..007410c 100644 --- a/conanfile.py +++ b/conanfile.py @@ -197,8 +197,6 @@ def configure(self): del self.options.with_null del self.options.with_zlib # zlib and png are always used in nmake build, del self.options.with_png # and it's not trivial to fix - else: - del self.options.with_libiconv if self.options.get_safe("with_libdeflate") and not self.options.get_safe("with_zlib", True): raise ConanInvalidConfiguration("gdal:with_libdeflate=True requires gdal:with_zlib=True") self._strict_options_requirements() @@ -617,7 +615,10 @@ def _configure_autotools(self): args.append("--with-libz={}".format("yes" if self.options.with_zlib else "no")) if self._has_with_libdeflate_option: args.append("--with-libdeflate={}".format("yes" if self.options.with_libdeflate else "no")) - args.append("--with-libiconv-prefix={}".format(tools.unix_path(self.deps_cpp_info["libiconv"].rootpath))) + if self.options.with_libiconv: + args.append("--with-libiconv-prefix={}".format(tools.unix_path(self.deps_cpp_info["libiconv"].rootpath))) + else: + args.append("--without-libiconv-prefix") args.append("--with-liblzma=no") # always disabled: liblzma is an optional transitive dependency of gdal (through libtiff). args.append("--with-zstd={}".format("yes" if self.options.get_safe("with_zstd") else "no")) # Optional direct dependency of gdal only if lerc lib enabled # Drivers: