We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
[package] xmlsec/1.2.30: Android build failed
<!-- 
  Please don't forget to update the issue title.
  Include all applicable information to help us reproduce your problem.
-->

### Package and Environment Details (include every applicable attribute)
  * Package Name/Version: **xmlsec/1.2.30**
  * Operating System+version: **macOS Catalina (Android cross-build)**
  * Compiler+version: **clang 9**
  * Conan version: **conan 1.31.3**
  * Python version: **Python 3.7.4**


### Conan profile (output of `conan profile show default` or `conan profile show <profile>` if custom profile is in use)
```
[settings]
os_build=Macos
arch_build=x86_64

compiler=clang
compiler.version=9
compiler.libcxx=libc++

os=Android
os.api_level=21
arch=armv7
build_type=Release

[build_requires]
android_ndk_installer/r21d@bincrafters/stable
cmake_installer/3.15.5@conan/stable
```


### Steps to reproduce (Include if Applicable)



### Logs (Include/Attach if Applicable)
<details><summary>Click to expand log</summary>

```
ERROR: m4/1.4.18: Error in build() method, line 90
        autotools.make()
        ConanException: Error 2 while executing make -j12


In file included from ../source_subfolder/lib/freading.c:22:
../source_subfolder/lib/stdio-impl.h:72:22: error: field has incomplete type 'struct __sbuf'
      struct  __sbuf _ub; /* ungetc buffer */
                     ^
../source_subfolder/lib/stdio-impl.h:72:15: note: forward declaration of 'struct __sbuf'
      struct  __sbuf _ub; /* ungetc buffer */
              ^
../source_subfolder/lib/freading.c:41:16: error: no member named '_flags' in 'struct __sFILE'
  return (fp_->_flags & __SRD) != 0;
          ~~~  ^
../source_subfolder/lib/freading.c:41:25: error: use of undeclared identifier '__SRD'
  return (fp_->_flags & __SRD) != 0;
                        ^
3 errors generated.
```

</details>


--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `recipes/libxml2/all/conanfile.py`
Content:
```
1 from conans import ConanFile, tools, AutoToolsBuildEnvironment, VisualStudioBuildEnvironment
2 from contextlib import contextmanager
3 import glob
4 import os
5 
6 
7 class Libxml2Conan(ConanFile):
8     name = "libxml2"
9     url = "https://github.com/conan-io/conan-center-index"
10     description = "libxml2 is a software library for parsing XML documents"
11     topics = ("XML", "parser", "validation")
12     homepage = "https://xmlsoft.org"
13     license = "MIT"
14     settings = "os", "arch", "compiler", "build_type"
15     generators = "pkg_config"
16 
17     # from ./configure and ./win32/configure.js
18     default_options = {'shared': False,
19                        'fPIC': True,
20                        'include_utils': True,
21                        "c14n": True,
22                        "catalog": True,
23                        "docbook": True,
24                        "ftp": True,
25                        "http": True,
26                        "html": True,
27                        "iconv": True,
28                        "icu": False,
29                        "iso8859x": True,
30                        "legacy": True,
31                        "mem-debug": False,
32                        "output": True,
33                        "pattern": True,
34                        "push": True,
35                        "python": False,
36                        "reader": True,
37                        "regexps": True,
38                        "run-debug": False,
39                        "sax1": True,
40                        "schemas": True,
41                        "schematron": True,
42                        "threads": True,
43                        "tree": True,
44                        "valid": True,
45                        "writer": True,
46                        "xinclude": True,
47                        "xpath": True,
48                        "xptr": True,
49                        "zlib": True,
50                        "lzma": False,
51                        }
52 
53     options = {name: [True, False] for name in default_options.keys()}
54     _option_names = [name for name in default_options.keys() if name not in ["shared", "fPIC", "include_utils"]]
55 
56     _autotools = None
57     _source_subfolder = "source_subfolder"
58 
59     def requirements(self):
60         if self.options.zlib:
61             self.requires("zlib/1.2.11")
62         if self.options.lzma:
63             self.requires("xz_utils/5.2.5")
64         if self.options.iconv:
65             self.requires("libiconv/1.16")
66         if self.options.icu:
67             self.requires("icu/68.1")
68 
69     def build_requirements(self):
70         if self.settings.compiler != "Visual Studio" and tools.os_info.is_windows and os.environ.get("CONAN_BASH_PATH", None) is None:
71             self.build_requires("msys2/20190524")
72 
73     @property
74     def _is_msvc(self):
75         return self.settings.compiler == 'Visual Studio'
76     
77     @property
78     def _is_mingw(self):
79         return self.settings.compiler == 'gcc' and self.settings.os == 'Windows'
80 
81     def source(self):
82         tools.get(**self.conan_data["sources"][self.version])
83         os.rename("libxml2-{0}".format(self.version), self._source_subfolder)
84 
85     def config_options(self):
86         if self.settings.os == "Windows":
87             del self.options.fPIC
88 
89     def configure(self):
90         del self.settings.compiler.libcxx
91         del self.settings.compiler.cppstd
92 
93     @contextmanager
94     def _msvc_build_environment(self):
95         with tools.chdir(os.path.join(self._source_subfolder, 'win32')):
96             with tools.vcvars(self.settings):
97                 with tools.environment_append(VisualStudioBuildEnvironment(self).vars):
98                     yield
99 
100     def _build_msvc(self):
101         with self._msvc_build_environment():
102             debug = "yes" if self.settings.build_type == "Debug" else "no"
103             static = "no" if self.options.shared else "yes"
104 
105             args = ["cscript",
106                     "configure.js",
107                     "compiler=msvc",
108                     "prefix=%s" % self.package_folder,
109                     "cruntime=/%s" % self.settings.compiler.runtime,
110                     "debug=%s" % debug,
111                     "static=%s" % static,
112                     'include="%s"' % ";".join(self.deps_cpp_info.include_paths),
113                     'lib="%s"' % ";".join(self.deps_cpp_info.lib_paths)]
114 
115             for name in self._option_names:
116                 cname = {"mem-debug": "mem_debug",
117                          "run-debug": "run_debug",
118                          "docbook": "docb"}.get(name, name)
119                 value = getattr(self.options, name)
120                 value = "yes" if value else "no"
121                 args.append("%s=%s" % (cname, value))
122 
123             configure_command = ' '.join(args)
124             self.output.info(configure_command)
125             self.run(configure_command)
126 
127             # Fix library names because they can be not just zlib.lib
128             def fix_library(option, package, old_libname):
129                 if option:
130                     libs = []
131                     for lib in self.deps_cpp_info[package].libs:
132                         libname = lib
133                         if not libname.endswith('.lib'):
134                             libname += '.lib'
135                         libs.append(libname)
136                     tools.replace_in_file("Makefile.msvc",
137                                           "LIBS = $(LIBS) %s" % old_libname,
138                                           "LIBS = $(LIBS) %s" % ' '.join(libs))
139 
140             fix_library(self.options.zlib, 'zlib', 'zlib.lib')
141             fix_library(self.options.lzma, 'lzma', 'liblzma.lib')
142             fix_library(self.options.iconv, 'libiconv', 'iconv.lib')
143             fix_library(self.options.icu, 'icu', 'advapi32.lib sicuuc.lib sicuin.lib sicudt.lib')
144             fix_library(self.options.icu, 'icu', 'icuuc.lib icuin.lib icudt.lib')
145 
146             self.run("nmake /f Makefile.msvc libxml libxmla libxmladll")
147 
148             if self.options.include_utils:
149                 self.run("nmake /f Makefile.msvc utils")
150 
151 
152     def _package_msvc(self):
153         with self._msvc_build_environment():
154             self.run("nmake /f Makefile.msvc install-libs")
155 
156             if self.options.include_utils:
157                 self.run("nmake /f Makefile.msvc install-dist")
158 
159     def _configure_autotools(self):
160         if self._autotools:
161             return self._autotools
162         self._autotools = AutoToolsBuildEnvironment(self, win_bash=tools.os_info.is_windows)
163         self._autotools.libs = []
164         if not tools.os_info.is_windows:
165             self._autotools.fpic = self.options.fPIC
166         full_install_subfolder = tools.unix_path(self.package_folder) if tools.os_info.is_windows else self.package_folder
167         # fix rpath
168         if self.settings.os == "Macos":
169             tools.replace_in_file(os.path.join(self._source_subfolder, "configure"), r"-install_name \$rpath/", "-install_name ")
170         configure_args = ['--prefix=%s' % full_install_subfolder]
171         if self._autotools.fpic:
172             configure_args.extend(['--with-pic'])
173         if self.options.shared:
174             configure_args.extend(['--enable-shared', '--disable-static'])
175         else:
176             configure_args.extend(['--enable-static', '--disable-shared'])
177 
178         for name in self._option_names:
179             value = getattr(self.options, name)
180             value = ("--with-%s" % name) if value else ("--without-%s" % name)
181             configure_args.append(value)
182 
183         # Disable --build when building for iPhoneSimulator. The configure script halts on
184         # not knowing if it should cross-compile.
185         build = None
186         if self.settings.os == "iOS" and self.settings.arch == "x86_64":
187             build = False
188 
189         self._autotools.configure(args=configure_args, build=build, configure_dir=self._source_subfolder)
190         return self._autotools
191 
192     def _patch_sources(self):
193         # Break dependency of install on build
194         for makefile in ("Makefile.mingw", "Makefile.msvc"):
195             tools.replace_in_file(os.path.join(self._source_subfolder, "win32", makefile),
196                                                "install-libs : all",
197                                                "install-libs :")
198 
199     def build(self):
200         self._patch_sources()
201         if self._is_msvc:
202             self._build_msvc()
203         else:
204             autotools = self._configure_autotools()
205             autotools.make(["libxml2.la"])
206 
207             if self.options.include_utils:
208                 autotools.make(["xmllint", "xmlcatalog", "xml2-config"])
209 
210     def package(self):
211         # copy package license
212         self.copy("COPYING", src=self._source_subfolder, dst="licenses", ignore_case=True, keep_path=False)
213         if self._is_msvc:
214             self._package_msvc()
215         else:
216             autotools = self._configure_autotools()
217             autotools.make(["install-libLTLIBRARIES", "install-data"])
218 
219             if self.options.include_utils:
220                 autotools.make(["install","xmllint", "xmlcatalog", "xml2-config"])
221 
222             os.unlink(os.path.join(self.package_folder, 'lib', 'libxml2.la'))
223 
224         for prefix in ["run", "test"]:
225             for test in glob.glob("%s/bin/%s*" % (self.package_folder, prefix)):
226                 os.remove(test)
227         for header in ["win32config.h", "wsockcompat.h"]:
228             self.copy(pattern=header, src=os.path.join(self._source_subfolder, "include"),
229                       dst=os.path.join("include", "libxml2"), keep_path=False)
230         if self._is_msvc:
231             # remove redundant libraries to avoid confusion
232             if not self.options.shared:
233                 os.unlink(os.path.join(self.package_folder, "bin", "libxml2.dll"))
234             os.unlink(os.path.join(self.package_folder, 'lib', 'libxml2_a_dll.lib'))
235             os.unlink(os.path.join(self.package_folder, 'lib', 'libxml2_a.lib' if self.options.shared else 'libxml2.lib'))
236 
237             pdb_files = glob.glob(os.path.join(self.package_folder, 'bin', '*.pdb'), recursive=True)
238             for pdb in pdb_files:
239                 os.unlink(pdb)
240 
241         tools.rmdir(os.path.join(self.package_folder, 'share'))
242         tools.rmdir(os.path.join(self.package_folder, 'lib', 'cmake'))
243         tools.rmdir(os.path.join(self.package_folder, 'lib', 'pkgconfig'))
244 
245     def package_info(self):
246         if self._is_msvc:
247             self.cpp_info.libs = ['libxml2' if self.options.shared else 'libxml2_a']
248         else:
249             self.cpp_info.libs = ['xml2']
250         self.cpp_info.includedirs.append(os.path.join("include", "libxml2"))
251         if not self.options.shared:
252             self.cpp_info.defines = ["LIBXML_STATIC"]
253         if self.options.include_utils:
254             bindir = os.path.join(self.package_folder, "bin")
255             self.output.info("Appending PATH environment variable: {}".format(bindir))
256             self.env_info.PATH.append(bindir)
257 
258         if self.settings.os in ["Linux", "Macos", "FreeBSD"]:
259             self.cpp_info.system_libs.append('m')
260         if self.settings.os == "Windows":
261             self.cpp_info.system_libs.append('ws2_32')
262         self.cpp_info.names["cmake_find_package"] = "LibXml2"
263         self.cpp_info.names["cmake_find_package_multi"] = "LibXml2"
264         self.cpp_info.names["pkg_config"] = "libxml-2.0"
265
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/recipes/libxml2/all/conanfile.py b/recipes/libxml2/all/conanfile.py
--- a/recipes/libxml2/all/conanfile.py
+++ b/recipes/libxml2/all/conanfile.py
@@ -254,8 +254,7 @@
             bindir = os.path.join(self.package_folder, "bin")
             self.output.info("Appending PATH environment variable: {}".format(bindir))
             self.env_info.PATH.append(bindir)
-
-        if self.settings.os in ["Linux", "Macos", "FreeBSD"]:
+        if self.settings.os in ["Linux", "Macos", "FreeBSD", "Android"]:
             self.cpp_info.system_libs.append('m')
         if self.settings.os == "Windows":
             self.cpp_info.system_libs.append('ws2_32')

{"golden_diff": "diff --git a/recipes/libxml2/all/conanfile.py b/recipes/libxml2/all/conanfile.py\n--- a/recipes/libxml2/all/conanfile.py\n+++ b/recipes/libxml2/all/conanfile.py\n@@ -254,8 +254,7 @@\n             bindir = os.path.join(self.package_folder, \"bin\")\n             self.output.info(\"Appending PATH environment variable: {}\".format(bindir))\n             self.env_info.PATH.append(bindir)\n-\n-        if self.settings.os in [\"Linux\", \"Macos\", \"FreeBSD\"]:\n+        if self.settings.os in [\"Linux\", \"Macos\", \"FreeBSD\", \"Android\"]:\n             self.cpp_info.system_libs.append('m')\n         if self.settings.os == \"Windows\":\n             self.cpp_info.system_libs.append('ws2_32')\n", "issue": "[package] xmlsec/1.2.30: Android build failed\n<!-- \r\n  Please don't forget to update the issue title.\r\n  Include all applicable information to help us reproduce your problem.\r\n-->\r\n\r\n### Package and Environment Details (include every applicable attribute)\r\n  * Package Name/Version: **xmlsec/1.2.30**\r\n  * Operating System+version: **macOS Catalina (Android cross-build)**\r\n  * Compiler+version: **clang 9**\r\n  * Conan version: **conan 1.31.3**\r\n  * Python version: **Python 3.7.4**\r\n\r\n\r\n### Conan profile (output of `conan profile show default` or `conan profile show <profile>` if custom profile is in use)\r\n```\r\n[settings]\r\nos_build=Macos\r\narch_build=x86_64\r\n\r\ncompiler=clang\r\ncompiler.version=9\r\ncompiler.libcxx=libc++\r\n\r\nos=Android\r\nos.api_level=21\r\narch=armv7\r\nbuild_type=Release\r\n\r\n[build_requires]\r\nandroid_ndk_installer/r21d@bincrafters/stable\r\ncmake_installer/3.15.5@conan/stable\r\n```\r\n\r\n\r\n### Steps to reproduce (Include if Applicable)\r\n\r\n\r\n\r\n### Logs (Include/Attach if Applicable)\r\n<details><summary>Click to expand log</summary>\r\n\r\n```\r\nERROR: m4/1.4.18: Error in build() method, line 90\r\n        autotools.make()\r\n        ConanException: Error 2 while executing make -j12\r\n\r\n\r\nIn file included from ../source_subfolder/lib/freading.c:22:\r\n../source_subfolder/lib/stdio-impl.h:72:22: error: field has incomplete type 'struct __sbuf'\r\n      struct  __sbuf _ub; /* ungetc buffer */\r\n                     ^\r\n../source_subfolder/lib/stdio-impl.h:72:15: note: forward declaration of 'struct __sbuf'\r\n      struct  __sbuf _ub; /* ungetc buffer */\r\n              ^\r\n../source_subfolder/lib/freading.c:41:16: error: no member named '_flags' in 'struct __sFILE'\r\n  return (fp_->_flags & __SRD) != 0;\r\n          ~~~  ^\r\n../source_subfolder/lib/freading.c:41:25: error: use of undeclared identifier '__SRD'\r\n  return (fp_->_flags & __SRD) != 0;\r\n                        ^\r\n3 errors generated.\r\n```\r\n\r\n</details>\r\n\n", "before_files": [{"content": "from conans import ConanFile, tools, AutoToolsBuildEnvironment, VisualStudioBuildEnvironment\nfrom contextlib import contextmanager\nimport glob\nimport os\n\n\nclass Libxml2Conan(ConanFile):\n    name = \"libxml2\"\n    url = \"https://github.com/conan-io/conan-center-index\"\n    description = \"libxml2 is a software library for parsing XML documents\"\n    topics = (\"XML\", \"parser\", \"validation\")\n    homepage = \"https://xmlsoft.org\"\n    license = \"MIT\"\n    settings = \"os\", \"arch\", \"compiler\", \"build_type\"\n    generators = \"pkg_config\"\n\n    # from ./configure and ./win32/configure.js\n    default_options = {'shared': False,\n                       'fPIC': True,\n                       'include_utils': True,\n                       \"c14n\": True,\n                       \"catalog\": True,\n                       \"docbook\": True,\n                       \"ftp\": True,\n                       \"http\": True,\n                       \"html\": True,\n                       \"iconv\": True,\n                       \"icu\": False,\n                       \"iso8859x\": True,\n                       \"legacy\": True,\n                       \"mem-debug\": False,\n                       \"output\": True,\n                       \"pattern\": True,\n                       \"push\": True,\n                       \"python\": False,\n                       \"reader\": True,\n                       \"regexps\": True,\n                       \"run-debug\": False,\n                       \"sax1\": True,\n                       \"schemas\": True,\n                       \"schematron\": True,\n                       \"threads\": True,\n                       \"tree\": True,\n                       \"valid\": True,\n                       \"writer\": True,\n                       \"xinclude\": True,\n                       \"xpath\": True,\n                       \"xptr\": True,\n                       \"zlib\": True,\n                       \"lzma\": False,\n                       }\n\n    options = {name: [True, False] for name in default_options.keys()}\n    _option_names = [name for name in default_options.keys() if name not in [\"shared\", \"fPIC\", \"include_utils\"]]\n\n    _autotools = None\n    _source_subfolder = \"source_subfolder\"\n\n    def requirements(self):\n        if self.options.zlib:\n            self.requires(\"zlib/1.2.11\")\n        if self.options.lzma:\n            self.requires(\"xz_utils/5.2.5\")\n        if self.options.iconv:\n            self.requires(\"libiconv/1.16\")\n        if self.options.icu:\n            self.requires(\"icu/68.1\")\n\n    def build_requirements(self):\n        if self.settings.compiler != \"Visual Studio\" and tools.os_info.is_windows and os.environ.get(\"CONAN_BASH_PATH\", None) is None:\n            self.build_requires(\"msys2/20190524\")\n\n    @property\n    def _is_msvc(self):\n        return self.settings.compiler == 'Visual Studio'\n    \n    @property\n    def _is_mingw(self):\n        return self.settings.compiler == 'gcc' and self.settings.os == 'Windows'\n\n    def source(self):\n        tools.get(**self.conan_data[\"sources\"][self.version])\n        os.rename(\"libxml2-{0}\".format(self.version), self._source_subfolder)\n\n    def config_options(self):\n        if self.settings.os == \"Windows\":\n            del self.options.fPIC\n\n    def configure(self):\n        del self.settings.compiler.libcxx\n        del self.settings.compiler.cppstd\n\n    @contextmanager\n    def _msvc_build_environment(self):\n        with tools.chdir(os.path.join(self._source_subfolder, 'win32')):\n            with tools.vcvars(self.settings):\n                with tools.environment_append(VisualStudioBuildEnvironment(self).vars):\n                    yield\n\n    def _build_msvc(self):\n        with self._msvc_build_environment():\n            debug = \"yes\" if self.settings.build_type == \"Debug\" else \"no\"\n            static = \"no\" if self.options.shared else \"yes\"\n\n            args = [\"cscript\",\n                    \"configure.js\",\n                    \"compiler=msvc\",\n                    \"prefix=%s\" % self.package_folder,\n                    \"cruntime=/%s\" % self.settings.compiler.runtime,\n                    \"debug=%s\" % debug,\n                    \"static=%s\" % static,\n                    'include=\"%s\"' % \";\".join(self.deps_cpp_info.include_paths),\n                    'lib=\"%s\"' % \";\".join(self.deps_cpp_info.lib_paths)]\n\n            for name in self._option_names:\n                cname = {\"mem-debug\": \"mem_debug\",\n                         \"run-debug\": \"run_debug\",\n                         \"docbook\": \"docb\"}.get(name, name)\n                value = getattr(self.options, name)\n                value = \"yes\" if value else \"no\"\n                args.append(\"%s=%s\" % (cname, value))\n\n            configure_command = ' '.join(args)\n            self.output.info(configure_command)\n            self.run(configure_command)\n\n            # Fix library names because they can be not just zlib.lib\n            def fix_library(option, package, old_libname):\n                if option:\n                    libs = []\n                    for lib in self.deps_cpp_info[package].libs:\n                        libname = lib\n                        if not libname.endswith('.lib'):\n                            libname += '.lib'\n                        libs.append(libname)\n                    tools.replace_in_file(\"Makefile.msvc\",\n                                          \"LIBS = $(LIBS) %s\" % old_libname,\n                                          \"LIBS = $(LIBS) %s\" % ' '.join(libs))\n\n            fix_library(self.options.zlib, 'zlib', 'zlib.lib')\n            fix_library(self.options.lzma, 'lzma', 'liblzma.lib')\n            fix_library(self.options.iconv, 'libiconv', 'iconv.lib')\n            fix_library(self.options.icu, 'icu', 'advapi32.lib sicuuc.lib sicuin.lib sicudt.lib')\n            fix_library(self.options.icu, 'icu', 'icuuc.lib icuin.lib icudt.lib')\n\n            self.run(\"nmake /f Makefile.msvc libxml libxmla libxmladll\")\n\n            if self.options.include_utils:\n                self.run(\"nmake /f Makefile.msvc utils\")\n\n\n    def _package_msvc(self):\n        with self._msvc_build_environment():\n            self.run(\"nmake /f Makefile.msvc install-libs\")\n\n            if self.options.include_utils:\n                self.run(\"nmake /f Makefile.msvc install-dist\")\n\n    def _configure_autotools(self):\n        if self._autotools:\n            return self._autotools\n        self._autotools = AutoToolsBuildEnvironment(self, win_bash=tools.os_info.is_windows)\n        self._autotools.libs = []\n        if not tools.os_info.is_windows:\n            self._autotools.fpic = self.options.fPIC\n        full_install_subfolder = tools.unix_path(self.package_folder) if tools.os_info.is_windows else self.package_folder\n        # fix rpath\n        if self.settings.os == \"Macos\":\n            tools.replace_in_file(os.path.join(self._source_subfolder, \"configure\"), r\"-install_name \\$rpath/\", \"-install_name \")\n        configure_args = ['--prefix=%s' % full_install_subfolder]\n        if self._autotools.fpic:\n            configure_args.extend(['--with-pic'])\n        if self.options.shared:\n            configure_args.extend(['--enable-shared', '--disable-static'])\n        else:\n            configure_args.extend(['--enable-static', '--disable-shared'])\n\n        for name in self._option_names:\n            value = getattr(self.options, name)\n            value = (\"--with-%s\" % name) if value else (\"--without-%s\" % name)\n            configure_args.append(value)\n\n        # Disable --build when building for iPhoneSimulator. The configure script halts on\n        # not knowing if it should cross-compile.\n        build = None\n        if self.settings.os == \"iOS\" and self.settings.arch == \"x86_64\":\n            build = False\n\n        self._autotools.configure(args=configure_args, build=build, configure_dir=self._source_subfolder)\n        return self._autotools\n\n    def _patch_sources(self):\n        # Break dependency of install on build\n        for makefile in (\"Makefile.mingw\", \"Makefile.msvc\"):\n            tools.replace_in_file(os.path.join(self._source_subfolder, \"win32\", makefile),\n                                               \"install-libs : all\",\n                                               \"install-libs :\")\n\n    def build(self):\n        self._patch_sources()\n        if self._is_msvc:\n            self._build_msvc()\n        else:\n            autotools = self._configure_autotools()\n            autotools.make([\"libxml2.la\"])\n\n            if self.options.include_utils:\n                autotools.make([\"xmllint\", \"xmlcatalog\", \"xml2-config\"])\n\n    def package(self):\n        # copy package license\n        self.copy(\"COPYING\", src=self._source_subfolder, dst=\"licenses\", ignore_case=True, keep_path=False)\n        if self._is_msvc:\n            self._package_msvc()\n        else:\n            autotools = self._configure_autotools()\n            autotools.make([\"install-libLTLIBRARIES\", \"install-data\"])\n\n            if self.options.include_utils:\n                autotools.make([\"install\",\"xmllint\", \"xmlcatalog\", \"xml2-config\"])\n\n            os.unlink(os.path.join(self.package_folder, 'lib', 'libxml2.la'))\n\n        for prefix in [\"run\", \"test\"]:\n            for test in glob.glob(\"%s/bin/%s*\" % (self.package_folder, prefix)):\n                os.remove(test)\n        for header in [\"win32config.h\", \"wsockcompat.h\"]:\n            self.copy(pattern=header, src=os.path.join(self._source_subfolder, \"include\"),\n                      dst=os.path.join(\"include\", \"libxml2\"), keep_path=False)\n        if self._is_msvc:\n            # remove redundant libraries to avoid confusion\n            if not self.options.shared:\n                os.unlink(os.path.join(self.package_folder, \"bin\", \"libxml2.dll\"))\n            os.unlink(os.path.join(self.package_folder, 'lib', 'libxml2_a_dll.lib'))\n            os.unlink(os.path.join(self.package_folder, 'lib', 'libxml2_a.lib' if self.options.shared else 'libxml2.lib'))\n\n            pdb_files = glob.glob(os.path.join(self.package_folder, 'bin', '*.pdb'), recursive=True)\n            for pdb in pdb_files:\n                os.unlink(pdb)\n\n        tools.rmdir(os.path.join(self.package_folder, 'share'))\n        tools.rmdir(os.path.join(self.package_folder, 'lib', 'cmake'))\n        tools.rmdir(os.path.join(self.package_folder, 'lib', 'pkgconfig'))\n\n    def package_info(self):\n        if self._is_msvc:\n            self.cpp_info.libs = ['libxml2' if self.options.shared else 'libxml2_a']\n        else:\n            self.cpp_info.libs = ['xml2']\n        self.cpp_info.includedirs.append(os.path.join(\"include\", \"libxml2\"))\n        if not self.options.shared:\n            self.cpp_info.defines = [\"LIBXML_STATIC\"]\n        if self.options.include_utils:\n            bindir = os.path.join(self.package_folder, \"bin\")\n            self.output.info(\"Appending PATH environment variable: {}\".format(bindir))\n            self.env_info.PATH.append(bindir)\n\n        if self.settings.os in [\"Linux\", \"Macos\", \"FreeBSD\"]:\n            self.cpp_info.system_libs.append('m')\n        if self.settings.os == \"Windows\":\n            self.cpp_info.system_libs.append('ws2_32')\n        self.cpp_info.names[\"cmake_find_package\"] = \"LibXml2\"\n        self.cpp_info.names[\"cmake_find_package_multi\"] = \"LibXml2\"\n        self.cpp_info.names[\"pkg_config\"] = \"libxml-2.0\"\n", "path": "recipes/libxml2/all/conanfile.py"}], "after_files": [{"content": "from conans import ConanFile, tools, AutoToolsBuildEnvironment, VisualStudioBuildEnvironment\nfrom contextlib import contextmanager\nimport glob\nimport os\n\n\nclass Libxml2Conan(ConanFile):\n    name = \"libxml2\"\n    url = \"https://github.com/conan-io/conan-center-index\"\n    description = \"libxml2 is a software library for parsing XML documents\"\n    topics = (\"XML\", \"parser\", \"validation\")\n    homepage = \"https://xmlsoft.org\"\n    license = \"MIT\"\n    settings = \"os\", \"arch\", \"compiler\", \"build_type\"\n    generators = \"pkg_config\"\n\n    # from ./configure and ./win32/configure.js\n    default_options = {'shared': False,\n                       'fPIC': True,\n                       'include_utils': True,\n                       \"c14n\": True,\n                       \"catalog\": True,\n                       \"docbook\": True,\n                       \"ftp\": True,\n                       \"http\": True,\n                       \"html\": True,\n                       \"iconv\": True,\n                       \"icu\": False,\n                       \"iso8859x\": True,\n                       \"legacy\": True,\n                       \"mem-debug\": False,\n                       \"output\": True,\n                       \"pattern\": True,\n                       \"push\": True,\n                       \"python\": False,\n                       \"reader\": True,\n                       \"regexps\": True,\n                       \"run-debug\": False,\n                       \"sax1\": True,\n                       \"schemas\": True,\n                       \"schematron\": True,\n                       \"threads\": True,\n                       \"tree\": True,\n                       \"valid\": True,\n                       \"writer\": True,\n                       \"xinclude\": True,\n                       \"xpath\": True,\n                       \"xptr\": True,\n                       \"zlib\": True,\n                       \"lzma\": False,\n                       }\n\n    options = {name: [True, False] for name in default_options.keys()}\n    _option_names = [name for name in default_options.keys() if name not in [\"shared\", \"fPIC\", \"include_utils\"]]\n\n    _autotools = None\n    _source_subfolder = \"source_subfolder\"\n\n    def requirements(self):\n        if self.options.zlib:\n            self.requires(\"zlib/1.2.11\")\n        if self.options.lzma:\n            self.requires(\"xz_utils/5.2.5\")\n        if self.options.iconv:\n            self.requires(\"libiconv/1.16\")\n        if self.options.icu:\n            self.requires(\"icu/68.1\")\n\n    def build_requirements(self):\n        if self.settings.compiler != \"Visual Studio\" and tools.os_info.is_windows and os.environ.get(\"CONAN_BASH_PATH\", None) is None:\n            self.build_requires(\"msys2/20190524\")\n\n    @property\n    def _is_msvc(self):\n        return self.settings.compiler == 'Visual Studio'\n    \n    @property\n    def _is_mingw(self):\n        return self.settings.compiler == 'gcc' and self.settings.os == 'Windows'\n\n    def source(self):\n        tools.get(**self.conan_data[\"sources\"][self.version])\n        os.rename(\"libxml2-{0}\".format(self.version), self._source_subfolder)\n\n    def config_options(self):\n        if self.settings.os == \"Windows\":\n            del self.options.fPIC\n\n    def configure(self):\n        del self.settings.compiler.libcxx\n        del self.settings.compiler.cppstd\n\n    @contextmanager\n    def _msvc_build_environment(self):\n        with tools.chdir(os.path.join(self._source_subfolder, 'win32')):\n            with tools.vcvars(self.settings):\n                with tools.environment_append(VisualStudioBuildEnvironment(self).vars):\n                    yield\n\n    def _build_msvc(self):\n        with self._msvc_build_environment():\n            debug = \"yes\" if self.settings.build_type == \"Debug\" else \"no\"\n            static = \"no\" if self.options.shared else \"yes\"\n\n            args = [\"cscript\",\n                    \"configure.js\",\n                    \"compiler=msvc\",\n                    \"prefix=%s\" % self.package_folder,\n                    \"cruntime=/%s\" % self.settings.compiler.runtime,\n                    \"debug=%s\" % debug,\n                    \"static=%s\" % static,\n                    'include=\"%s\"' % \";\".join(self.deps_cpp_info.include_paths),\n                    'lib=\"%s\"' % \";\".join(self.deps_cpp_info.lib_paths)]\n\n            for name in self._option_names:\n                cname = {\"mem-debug\": \"mem_debug\",\n                         \"run-debug\": \"run_debug\",\n                         \"docbook\": \"docb\"}.get(name, name)\n                value = getattr(self.options, name)\n                value = \"yes\" if value else \"no\"\n                args.append(\"%s=%s\" % (cname, value))\n\n            configure_command = ' '.join(args)\n            self.output.info(configure_command)\n            self.run(configure_command)\n\n            # Fix library names because they can be not just zlib.lib\n            def fix_library(option, package, old_libname):\n                if option:\n                    libs = []\n                    for lib in self.deps_cpp_info[package].libs:\n                        libname = lib\n                        if not libname.endswith('.lib'):\n                            libname += '.lib'\n                        libs.append(libname)\n                    tools.replace_in_file(\"Makefile.msvc\",\n                                          \"LIBS = $(LIBS) %s\" % old_libname,\n                                          \"LIBS = $(LIBS) %s\" % ' '.join(libs))\n\n            fix_library(self.options.zlib, 'zlib', 'zlib.lib')\n            fix_library(self.options.lzma, 'lzma', 'liblzma.lib')\n            fix_library(self.options.iconv, 'libiconv', 'iconv.lib')\n            fix_library(self.options.icu, 'icu', 'advapi32.lib sicuuc.lib sicuin.lib sicudt.lib')\n            fix_library(self.options.icu, 'icu', 'icuuc.lib icuin.lib icudt.lib')\n\n            self.run(\"nmake /f Makefile.msvc libxml libxmla libxmladll\")\n\n            if self.options.include_utils:\n                self.run(\"nmake /f Makefile.msvc utils\")\n\n\n    def _package_msvc(self):\n        with self._msvc_build_environment():\n            self.run(\"nmake /f Makefile.msvc install-libs\")\n\n            if self.options.include_utils:\n                self.run(\"nmake /f Makefile.msvc install-dist\")\n\n    def _configure_autotools(self):\n        if self._autotools:\n            return self._autotools\n        self._autotools = AutoToolsBuildEnvironment(self, win_bash=tools.os_info.is_windows)\n        self._autotools.libs = []\n        if not tools.os_info.is_windows:\n            self._autotools.fpic = self.options.fPIC\n        full_install_subfolder = tools.unix_path(self.package_folder) if tools.os_info.is_windows else self.package_folder\n        # fix rpath\n        if self.settings.os == \"Macos\":\n            tools.replace_in_file(os.path.join(self._source_subfolder, \"configure\"), r\"-install_name \\$rpath/\", \"-install_name \")\n        configure_args = ['--prefix=%s' % full_install_subfolder]\n        if self._autotools.fpic:\n            configure_args.extend(['--with-pic'])\n        if self.options.shared:\n            configure_args.extend(['--enable-shared', '--disable-static'])\n        else:\n            configure_args.extend(['--enable-static', '--disable-shared'])\n\n        for name in self._option_names:\n            value = getattr(self.options, name)\n            value = (\"--with-%s\" % name) if value else (\"--without-%s\" % name)\n            configure_args.append(value)\n\n        # Disable --build when building for iPhoneSimulator. The configure script halts on\n        # not knowing if it should cross-compile.\n        build = None\n        if self.settings.os == \"iOS\" and self.settings.arch == \"x86_64\":\n            build = False\n\n        self._autotools.configure(args=configure_args, build=build, configure_dir=self._source_subfolder)\n        return self._autotools\n\n    def _patch_sources(self):\n        # Break dependency of install on build\n        for makefile in (\"Makefile.mingw\", \"Makefile.msvc\"):\n            tools.replace_in_file(os.path.join(self._source_subfolder, \"win32\", makefile),\n                                               \"install-libs : all\",\n                                               \"install-libs :\")\n\n    def build(self):\n        self._patch_sources()\n        if self._is_msvc:\n            self._build_msvc()\n        else:\n            autotools = self._configure_autotools()\n            autotools.make([\"libxml2.la\"])\n\n            if self.options.include_utils:\n                autotools.make([\"xmllint\", \"xmlcatalog\", \"xml2-config\"])\n\n    def package(self):\n        # copy package license\n        self.copy(\"COPYING\", src=self._source_subfolder, dst=\"licenses\", ignore_case=True, keep_path=False)\n        if self._is_msvc:\n            self._package_msvc()\n        else:\n            autotools = self._configure_autotools()\n            autotools.make([\"install-libLTLIBRARIES\", \"install-data\"])\n\n            if self.options.include_utils:\n                autotools.make([\"install\",\"xmllint\", \"xmlcatalog\", \"xml2-config\"])\n\n            os.unlink(os.path.join(self.package_folder, 'lib', 'libxml2.la'))\n\n        for prefix in [\"run\", \"test\"]:\n            for test in glob.glob(\"%s/bin/%s*\" % (self.package_folder, prefix)):\n                os.remove(test)\n        for header in [\"win32config.h\", \"wsockcompat.h\"]:\n            self.copy(pattern=header, src=os.path.join(self._source_subfolder, \"include\"),\n                      dst=os.path.join(\"include\", \"libxml2\"), keep_path=False)\n        if self._is_msvc:\n            # remove redundant libraries to avoid confusion\n            if not self.options.shared:\n                os.unlink(os.path.join(self.package_folder, \"bin\", \"libxml2.dll\"))\n            os.unlink(os.path.join(self.package_folder, 'lib', 'libxml2_a_dll.lib'))\n            os.unlink(os.path.join(self.package_folder, 'lib', 'libxml2_a.lib' if self.options.shared else 'libxml2.lib'))\n\n            pdb_files = glob.glob(os.path.join(self.package_folder, 'bin', '*.pdb'), recursive=True)\n            for pdb in pdb_files:\n                os.unlink(pdb)\n\n        tools.rmdir(os.path.join(self.package_folder, 'share'))\n        tools.rmdir(os.path.join(self.package_folder, 'lib', 'cmake'))\n        tools.rmdir(os.path.join(self.package_folder, 'lib', 'pkgconfig'))\n\n    def package_info(self):\n        if self._is_msvc:\n            self.cpp_info.libs = ['libxml2' if self.options.shared else 'libxml2_a']\n        else:\n            self.cpp_info.libs = ['xml2']\n        self.cpp_info.includedirs.append(os.path.join(\"include\", \"libxml2\"))\n        if not self.options.shared:\n            self.cpp_info.defines = [\"LIBXML_STATIC\"]\n        if self.options.include_utils:\n            bindir = os.path.join(self.package_folder, \"bin\")\n            self.output.info(\"Appending PATH environment variable: {}\".format(bindir))\n            self.env_info.PATH.append(bindir)\n        if self.settings.os in [\"Linux\", \"Macos\", \"FreeBSD\", \"Android\"]:\n            self.cpp_info.system_libs.append('m')\n        if self.settings.os == \"Windows\":\n            self.cpp_info.system_libs.append('ws2_32')\n        self.cpp_info.names[\"cmake_find_package\"] = \"LibXml2\"\n        self.cpp_info.names[\"cmake_find_package_multi\"] = \"LibXml2\"\n        self.cpp_info.names[\"pkg_config\"] = \"libxml-2.0\"\n", "path": "recipes/libxml2/all/conanfile.py"}]}