We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
[package] mpdecimal/2.5.x: win32 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: **mpdecimal/2.5.x**
  * Operating System+version: **Windows 11**
  * Compiler+version: **Visual Studio 16**
  * Conan version: **conan 1.42.2**
  * Python version: **Python 3.10.0**


### Conan profile (output of `conan profile show default` or `conan profile show <profile>` if custom profile is in use)
```
[settings]
os=Windows
os_build=Windows
arch=x86
arch_build=x86_64
compiler=Visual Studio
compiler.version=16
build_type=Release
[options]
[conf]
[build_requires]
[env]
```


### Steps to reproduce (Include if Applicable)
Just build mpdecimal package with specified profile. `conan create . 2.5.0@`


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

![изображение](https://user-images.githubusercontent.com/42415176/147117876-514cd6fa-08bf-42b4-ac9e-742f6d949590.png)

</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/mpdecimal/2.5.x/conanfile.py`
Content:
```
1 from conans import ConanFile, AutoToolsBuildEnvironment, tools
2 from conans.errors import ConanInvalidConfiguration
3 import os
4 import shutil
5 
6 required_conan_version = ">=1.33.0"
7 
8 
9 class MpdecimalConan(ConanFile):
10     name = "mpdecimal"
11     description = "mpdecimal is a package for correctly-rounded arbitrary precision decimal floating point arithmetic."
12     license = "BSD-2-Clause"
13     topics = ("conan", "mpdecimal", "multiprecision", "library")
14     url = "https://github.com/conan-io/conan-center-index"
15     homepage = "http://www.bytereef.org/mpdecimal"
16     settings = "os", "compiler", "build_type", "arch"
17     options = {
18         "shared": [True, False],
19         "fPIC": [True, False],
20         "cxx": [True, False],
21     }
22     default_options = {
23         "shared": False,
24         "fPIC": True,
25         "cxx": True,
26     }
27 
28     exports_sources = "patches/**"
29 
30     _autotools = None
31 
32     @property
33     def _source_subfolder(self):
34         return "source_subfolder"
35 
36     @property
37     def _settings_build(self):
38         return getattr(self, "setings_build", self.settings)
39 
40     def config_options(self):
41         if self.settings.os == "Windows":
42             del self.options.fPIC
43 
44     def configure(self):
45         if self.options.shared:
46             del self.options.fPIC
47         if not self.options.cxx:
48             del self.settings.compiler.libcxx
49             del self.settings.compiler.cppstd
50 
51     def build_requirements(self):
52         if self.settings.compiler != "Visual Studio":
53             self.build_requires("automake/1.16.3")
54             if self._settings_build.os == "Windows" and not tools.get_env("CONAN_BASH_PATH"):
55                 self.build_requires("msys2/cci.latest")
56 
57     def validate(self):
58         if self.settings.arch not in ("x86", "x86_64"):
59             raise ConanInvalidConfiguration("Arch is unsupported")
60         if self.options.cxx:
61             if self.options.shared and self.settings.os == "Windows":
62                 raise ConanInvalidConfiguration("A shared libmpdec++ is not possible on Windows (due to non-exportable thread local storage)")
63 
64     def source(self):
65         tools.get(**self.conan_data["sources"][self.version],
66                   destination=self._source_subfolder, strip_root=True)
67 
68     def _patch_sources(self):
69         for patch in self.conan_data.get("patches", {}).get(self.version, []):
70             tools.patch(**patch)
71 
72     def _build_msvc(self):
73         libmpdec_folder = os.path.join(self.build_folder, self._source_subfolder, "libmpdec")
74         libmpdecpp_folder = os.path.join(self.build_folder, self._source_subfolder, "libmpdec++")
75         vcbuild_folder = os.path.join(self.build_folder, self._source_subfolder, "vcbuild")
76         arch_ext = "{}".format(32 if self.settings.arch == "x86" else 64)
77         dist_folder = os.path.join(vcbuild_folder, "dist{}".format(arch_ext))
78         os.mkdir(dist_folder)
79 
80         shutil.copy(os.path.join(libmpdec_folder, "Makefile.vc"), os.path.join(libmpdec_folder, "Makefile"))
81 
82         autotools = AutoToolsBuildEnvironment(self)
83         mpdec_extra_flags = []
84         mpdecxx_extra_flags = []
85         if tools.Version(self.version) >= "2.5.1":
86             if self.options.shared:
87                 mpdec_extra_flags = ["-DMPDECIMAL_DLL"]
88                 mpdecxx_extra_flags = ["-DLIBMPDECXX_DLL"]
89 
90         mpdec_target = "libmpdec-{}.{}".format(self.version, "dll" if self.options.shared else "lib")
91         mpdecpp_target = "libmpdec++-{}.{}".format(self.version, "dll" if self.options.shared else "lib")
92 
93         builds = [[libmpdec_folder, mpdec_target, mpdec_extra_flags] ]
94         if self.options.cxx:
95             builds.append([libmpdecpp_folder, mpdecpp_target, mpdecxx_extra_flags])
96         with tools.vcvars(self):
97             for build_dir, target, extra_flags in builds:
98                 with tools.chdir(build_dir):
99                     self.run("""nmake /nologo /f Makefile.vc {target} MACHINE={machine} DEBUG={debug} DLL={dll} CONAN_CFLAGS="{cflags}" CONAN_CXXFLAGS="{cxxflags}" CONAN_LDFLAGS="{ldflags}" """.format(
100                         target=target,
101                         machine={"x86": "pro", "x86_64": "x64"}[str(self.settings.arch)],  # FIXME: else, use ansi32 and ansi64
102                         debug="1" if self.settings.build_type == "Debug" else "0",
103                         dll="1" if self.options.shared else "0",
104                         cflags=" ".join(autotools.flags + extra_flags),
105                         cxxflags=" ".join(autotools.cxx_flags + extra_flags),
106                         ldflags=" ".join(autotools.link_flags),
107                     ))
108 
109         with tools.chdir(libmpdec_folder):
110             shutil.copy("mpdecimal.h", dist_folder)
111             if self.options.shared:
112                 shutil.copy("libmpdec-{}.dll".format(self.version), os.path.join(dist_folder, "libmpdec-{}.dll".format(self.version)))
113                 shutil.copy("libmpdec-{}.dll.exp".format(self.version), os.path.join(dist_folder, "libmpdec-{}.exp".format(self.version)))
114                 shutil.copy("libmpdec-{}.dll.lib".format(self.version), os.path.join(dist_folder, "libmpdec-{}.lib".format(self.version)))
115             else:
116                 shutil.copy("libmpdec-{}.lib".format(self.version), os.path.join(dist_folder, "libmpdec-{}.lib".format(self.version)))
117         if self.options.cxx:
118             with tools.chdir(libmpdecpp_folder):
119                 shutil.copy("decimal.hh", dist_folder)
120                 shutil.copy("libmpdec++-{}.lib".format(self.version), os.path.join(dist_folder, "libmpdec++-{}.lib".format(self.version)))
121 
122     def _configure_autotools(self):
123         if self._autotools:
124             return self._autotools
125         self._autotools = AutoToolsBuildEnvironment(self, win_bash=tools.os_info.is_windows)
126         conf_args = [
127             "--enable-cxx" if self.options.cxx else "--disable-cxx"
128         ]
129         self._autotools.configure(args=conf_args)
130         return self._autotools
131 
132     @property
133     def _shared_suffix(self):
134         if tools.is_apple_os(self.settings.os):
135             return ".dylib"
136         return {
137             "Windows": ".dll",
138         }.get(str(self.settings.os), ".so")
139 
140     @property
141     def _target_names(self):
142         libsuffix = self._shared_suffix if self.options.shared else ".a"
143         versionsuffix = ".{}".format(self.version) if self.options.shared else ""
144         suffix = "{}{}".format(versionsuffix, libsuffix) if tools.is_apple_os(self.settings.os) or self.settings.os == "Windows" else "{}{}".format(libsuffix, versionsuffix)
145         return "libmpdec{}".format(suffix), "libmpdec++{}".format(suffix)
146 
147     def build(self):
148         self._patch_sources()
149         if self.settings.compiler == "Visual Studio":
150             self._build_msvc()
151         else:
152             with tools.chdir(self._source_subfolder):
153                 self.run("autoreconf -fiv", win_bash=tools.os_info.is_windows)
154                 autotools = self._configure_autotools()
155                 self.output.info(tools.load(os.path.join("libmpdec", "Makefile")))
156                 libmpdec, libmpdecpp = self._target_names
157                 with tools.chdir("libmpdec"):
158                     autotools.make(target=libmpdec)
159                 if self.options.cxx:
160                     with tools.chdir("libmpdec++"):
161                         autotools.make(target=libmpdecpp)
162 
163     def package(self):
164         self.copy("LICENSE.txt", src=self._source_subfolder, dst="licenses")
165         if self.settings.compiler == "Visual Studio":
166             distfolder = os.path.join(self.build_folder, self._source_subfolder, "vcbuild", "dist{}".format(32 if self.settings.arch == "x86" else 64))
167             self.copy("vc*.h", src=os.path.join(self.build_folder, self._source_subfolder, "libmpdec"), dst="include")
168             self.copy("*.h", src=distfolder, dst="include")
169             if self.options.cxx:
170                 self.copy("*.hh", src=distfolder, dst="include")
171             self.copy("*.lib", src=distfolder, dst="lib")
172             self.copy("*.dll", src=distfolder, dst="bin")
173         else:
174             mpdecdir = os.path.join(self._source_subfolder, "libmpdec")
175             mpdecppdir = os.path.join(self._source_subfolder, "libmpdec++")
176             self.copy("mpdecimal.h", src=mpdecdir, dst="include")
177             if self.options.cxx:
178                 self.copy("decimal.hh", src=mpdecppdir, dst="include")
179             builddirs = [mpdecdir]
180             if self.options.cxx:
181                 builddirs.append(mpdecppdir)
182             for builddir in builddirs:
183                 self.copy("*.a", src=builddir, dst="lib")
184                 self.copy("*.so", src=builddir, dst="lib")
185                 self.copy("*.so.*", src=builddir, dst="lib")
186                 self.copy("*.dylib", src=builddir, dst="lib")
187                 self.copy("*.dll", src=builddir, dst="bin")
188 
189     def package_info(self):
190         lib_pre_suf = ("", "")
191         if self.settings.compiler == "Visual Studio":
192             lib_pre_suf = ("lib", "-{}".format(self.version))
193         elif self.settings.os == "Windows":
194             if self.options.shared:
195                 lib_pre_suf = ("", ".dll")
196 
197         self.cpp_info.components["libmpdecimal"].libs = ["{}mpdec{}".format(*lib_pre_suf)]
198         if self.options.shared:
199             if self.settings.compiler == "Visual Studio":
200                 if tools.Version(self.version) >= "2.5.1":
201                     self.cpp_info.components["libmpdecimal"].defines = ["MPDECIMAL_DLL"]
202                 else:
203                     self.cpp_info.components["libmpdecimal"].defines = ["USE_DLL"]
204         else:
205             if self.settings.os == "Linux":
206                 self.cpp_info.components["libmpdecimal"].system_libs = ["m"]
207 
208         if self.options.cxx:
209             self.cpp_info.components["libmpdecimal++"].libs = ["{}mpdec++{}".format(*lib_pre_suf)]
210             self.cpp_info.components["libmpdecimal++"].requires = ["libmpdecimal"]
211             if self.options.shared:
212                 if tools.Version(self.version) >= "2.5.1":
213                     self.cpp_info.components["libmpdecimal"].defines = ["MPDECIMALXX_DLL"]
214
```
--- 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/mpdecimal/2.5.x/conanfile.py b/recipes/mpdecimal/2.5.x/conanfile.py
--- a/recipes/mpdecimal/2.5.x/conanfile.py
+++ b/recipes/mpdecimal/2.5.x/conanfile.py
@@ -98,7 +98,7 @@
                 with tools.chdir(build_dir):
                     self.run("""nmake /nologo /f Makefile.vc {target} MACHINE={machine} DEBUG={debug} DLL={dll} CONAN_CFLAGS="{cflags}" CONAN_CXXFLAGS="{cxxflags}" CONAN_LDFLAGS="{ldflags}" """.format(
                         target=target,
-                        machine={"x86": "pro", "x86_64": "x64"}[str(self.settings.arch)],  # FIXME: else, use ansi32 and ansi64
+                        machine={"x86": "ppro", "x86_64": "x64"}[str(self.settings.arch)],  # FIXME: else, use ansi32 and ansi64
                         debug="1" if self.settings.build_type == "Debug" else "0",
                         dll="1" if self.options.shared else "0",
                         cflags=" ".join(autotools.flags + extra_flags),

{"golden_diff": "diff --git a/recipes/mpdecimal/2.5.x/conanfile.py b/recipes/mpdecimal/2.5.x/conanfile.py\n--- a/recipes/mpdecimal/2.5.x/conanfile.py\n+++ b/recipes/mpdecimal/2.5.x/conanfile.py\n@@ -98,7 +98,7 @@\n                 with tools.chdir(build_dir):\n                     self.run(\"\"\"nmake /nologo /f Makefile.vc {target} MACHINE={machine} DEBUG={debug} DLL={dll} CONAN_CFLAGS=\"{cflags}\" CONAN_CXXFLAGS=\"{cxxflags}\" CONAN_LDFLAGS=\"{ldflags}\" \"\"\".format(\n                         target=target,\n-                        machine={\"x86\": \"pro\", \"x86_64\": \"x64\"}[str(self.settings.arch)],  # FIXME: else, use ansi32 and ansi64\n+                        machine={\"x86\": \"ppro\", \"x86_64\": \"x64\"}[str(self.settings.arch)],  # FIXME: else, use ansi32 and ansi64\n                         debug=\"1\" if self.settings.build_type == \"Debug\" else \"0\",\n                         dll=\"1\" if self.options.shared else \"0\",\n                         cflags=\" \".join(autotools.flags + extra_flags),\n", "issue": "[package] mpdecimal/2.5.x: win32 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: **mpdecimal/2.5.x**\r\n  * Operating System+version: **Windows 11**\r\n  * Compiler+version: **Visual Studio 16**\r\n  * Conan version: **conan 1.42.2**\r\n  * Python version: **Python 3.10.0**\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=Windows\r\nos_build=Windows\r\narch=x86\r\narch_build=x86_64\r\ncompiler=Visual Studio\r\ncompiler.version=16\r\nbuild_type=Release\r\n[options]\r\n[conf]\r\n[build_requires]\r\n[env]\r\n```\r\n\r\n\r\n### Steps to reproduce (Include if Applicable)\r\nJust build mpdecimal package with specified profile. `conan create . 2.5.0@`\r\n\r\n\r\n### Logs (Include/Attach if Applicable)\r\n<details><summary>Click to expand log</summary>\r\n\r\n![\u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435](https://user-images.githubusercontent.com/42415176/147117876-514cd6fa-08bf-42b4-ac9e-742f6d949590.png)\r\n\r\n</details>\r\n\n", "before_files": [{"content": "from conans import ConanFile, AutoToolsBuildEnvironment, tools\nfrom conans.errors import ConanInvalidConfiguration\nimport os\nimport shutil\n\nrequired_conan_version = \">=1.33.0\"\n\n\nclass MpdecimalConan(ConanFile):\n    name = \"mpdecimal\"\n    description = \"mpdecimal is a package for correctly-rounded arbitrary precision decimal floating point arithmetic.\"\n    license = \"BSD-2-Clause\"\n    topics = (\"conan\", \"mpdecimal\", \"multiprecision\", \"library\")\n    url = \"https://github.com/conan-io/conan-center-index\"\n    homepage = \"http://www.bytereef.org/mpdecimal\"\n    settings = \"os\", \"compiler\", \"build_type\", \"arch\"\n    options = {\n        \"shared\": [True, False],\n        \"fPIC\": [True, False],\n        \"cxx\": [True, False],\n    }\n    default_options = {\n        \"shared\": False,\n        \"fPIC\": True,\n        \"cxx\": True,\n    }\n\n    exports_sources = \"patches/**\"\n\n    _autotools = None\n\n    @property\n    def _source_subfolder(self):\n        return \"source_subfolder\"\n\n    @property\n    def _settings_build(self):\n        return getattr(self, \"setings_build\", self.settings)\n\n    def config_options(self):\n        if self.settings.os == \"Windows\":\n            del self.options.fPIC\n\n    def configure(self):\n        if self.options.shared:\n            del self.options.fPIC\n        if not self.options.cxx:\n            del self.settings.compiler.libcxx\n            del self.settings.compiler.cppstd\n\n    def build_requirements(self):\n        if self.settings.compiler != \"Visual Studio\":\n            self.build_requires(\"automake/1.16.3\")\n            if self._settings_build.os == \"Windows\" and not tools.get_env(\"CONAN_BASH_PATH\"):\n                self.build_requires(\"msys2/cci.latest\")\n\n    def validate(self):\n        if self.settings.arch not in (\"x86\", \"x86_64\"):\n            raise ConanInvalidConfiguration(\"Arch is unsupported\")\n        if self.options.cxx:\n            if self.options.shared and self.settings.os == \"Windows\":\n                raise ConanInvalidConfiguration(\"A shared libmpdec++ is not possible on Windows (due to non-exportable thread local storage)\")\n\n    def source(self):\n        tools.get(**self.conan_data[\"sources\"][self.version],\n                  destination=self._source_subfolder, strip_root=True)\n\n    def _patch_sources(self):\n        for patch in self.conan_data.get(\"patches\", {}).get(self.version, []):\n            tools.patch(**patch)\n\n    def _build_msvc(self):\n        libmpdec_folder = os.path.join(self.build_folder, self._source_subfolder, \"libmpdec\")\n        libmpdecpp_folder = os.path.join(self.build_folder, self._source_subfolder, \"libmpdec++\")\n        vcbuild_folder = os.path.join(self.build_folder, self._source_subfolder, \"vcbuild\")\n        arch_ext = \"{}\".format(32 if self.settings.arch == \"x86\" else 64)\n        dist_folder = os.path.join(vcbuild_folder, \"dist{}\".format(arch_ext))\n        os.mkdir(dist_folder)\n\n        shutil.copy(os.path.join(libmpdec_folder, \"Makefile.vc\"), os.path.join(libmpdec_folder, \"Makefile\"))\n\n        autotools = AutoToolsBuildEnvironment(self)\n        mpdec_extra_flags = []\n        mpdecxx_extra_flags = []\n        if tools.Version(self.version) >= \"2.5.1\":\n            if self.options.shared:\n                mpdec_extra_flags = [\"-DMPDECIMAL_DLL\"]\n                mpdecxx_extra_flags = [\"-DLIBMPDECXX_DLL\"]\n\n        mpdec_target = \"libmpdec-{}.{}\".format(self.version, \"dll\" if self.options.shared else \"lib\")\n        mpdecpp_target = \"libmpdec++-{}.{}\".format(self.version, \"dll\" if self.options.shared else \"lib\")\n\n        builds = [[libmpdec_folder, mpdec_target, mpdec_extra_flags] ]\n        if self.options.cxx:\n            builds.append([libmpdecpp_folder, mpdecpp_target, mpdecxx_extra_flags])\n        with tools.vcvars(self):\n            for build_dir, target, extra_flags in builds:\n                with tools.chdir(build_dir):\n                    self.run(\"\"\"nmake /nologo /f Makefile.vc {target} MACHINE={machine} DEBUG={debug} DLL={dll} CONAN_CFLAGS=\"{cflags}\" CONAN_CXXFLAGS=\"{cxxflags}\" CONAN_LDFLAGS=\"{ldflags}\" \"\"\".format(\n                        target=target,\n                        machine={\"x86\": \"pro\", \"x86_64\": \"x64\"}[str(self.settings.arch)],  # FIXME: else, use ansi32 and ansi64\n                        debug=\"1\" if self.settings.build_type == \"Debug\" else \"0\",\n                        dll=\"1\" if self.options.shared else \"0\",\n                        cflags=\" \".join(autotools.flags + extra_flags),\n                        cxxflags=\" \".join(autotools.cxx_flags + extra_flags),\n                        ldflags=\" \".join(autotools.link_flags),\n                    ))\n\n        with tools.chdir(libmpdec_folder):\n            shutil.copy(\"mpdecimal.h\", dist_folder)\n            if self.options.shared:\n                shutil.copy(\"libmpdec-{}.dll\".format(self.version), os.path.join(dist_folder, \"libmpdec-{}.dll\".format(self.version)))\n                shutil.copy(\"libmpdec-{}.dll.exp\".format(self.version), os.path.join(dist_folder, \"libmpdec-{}.exp\".format(self.version)))\n                shutil.copy(\"libmpdec-{}.dll.lib\".format(self.version), os.path.join(dist_folder, \"libmpdec-{}.lib\".format(self.version)))\n            else:\n                shutil.copy(\"libmpdec-{}.lib\".format(self.version), os.path.join(dist_folder, \"libmpdec-{}.lib\".format(self.version)))\n        if self.options.cxx:\n            with tools.chdir(libmpdecpp_folder):\n                shutil.copy(\"decimal.hh\", dist_folder)\n                shutil.copy(\"libmpdec++-{}.lib\".format(self.version), os.path.join(dist_folder, \"libmpdec++-{}.lib\".format(self.version)))\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        conf_args = [\n            \"--enable-cxx\" if self.options.cxx else \"--disable-cxx\"\n        ]\n        self._autotools.configure(args=conf_args)\n        return self._autotools\n\n    @property\n    def _shared_suffix(self):\n        if tools.is_apple_os(self.settings.os):\n            return \".dylib\"\n        return {\n            \"Windows\": \".dll\",\n        }.get(str(self.settings.os), \".so\")\n\n    @property\n    def _target_names(self):\n        libsuffix = self._shared_suffix if self.options.shared else \".a\"\n        versionsuffix = \".{}\".format(self.version) if self.options.shared else \"\"\n        suffix = \"{}{}\".format(versionsuffix, libsuffix) if tools.is_apple_os(self.settings.os) or self.settings.os == \"Windows\" else \"{}{}\".format(libsuffix, versionsuffix)\n        return \"libmpdec{}\".format(suffix), \"libmpdec++{}\".format(suffix)\n\n    def build(self):\n        self._patch_sources()\n        if self.settings.compiler == \"Visual Studio\":\n            self._build_msvc()\n        else:\n            with tools.chdir(self._source_subfolder):\n                self.run(\"autoreconf -fiv\", win_bash=tools.os_info.is_windows)\n                autotools = self._configure_autotools()\n                self.output.info(tools.load(os.path.join(\"libmpdec\", \"Makefile\")))\n                libmpdec, libmpdecpp = self._target_names\n                with tools.chdir(\"libmpdec\"):\n                    autotools.make(target=libmpdec)\n                if self.options.cxx:\n                    with tools.chdir(\"libmpdec++\"):\n                        autotools.make(target=libmpdecpp)\n\n    def package(self):\n        self.copy(\"LICENSE.txt\", src=self._source_subfolder, dst=\"licenses\")\n        if self.settings.compiler == \"Visual Studio\":\n            distfolder = os.path.join(self.build_folder, self._source_subfolder, \"vcbuild\", \"dist{}\".format(32 if self.settings.arch == \"x86\" else 64))\n            self.copy(\"vc*.h\", src=os.path.join(self.build_folder, self._source_subfolder, \"libmpdec\"), dst=\"include\")\n            self.copy(\"*.h\", src=distfolder, dst=\"include\")\n            if self.options.cxx:\n                self.copy(\"*.hh\", src=distfolder, dst=\"include\")\n            self.copy(\"*.lib\", src=distfolder, dst=\"lib\")\n            self.copy(\"*.dll\", src=distfolder, dst=\"bin\")\n        else:\n            mpdecdir = os.path.join(self._source_subfolder, \"libmpdec\")\n            mpdecppdir = os.path.join(self._source_subfolder, \"libmpdec++\")\n            self.copy(\"mpdecimal.h\", src=mpdecdir, dst=\"include\")\n            if self.options.cxx:\n                self.copy(\"decimal.hh\", src=mpdecppdir, dst=\"include\")\n            builddirs = [mpdecdir]\n            if self.options.cxx:\n                builddirs.append(mpdecppdir)\n            for builddir in builddirs:\n                self.copy(\"*.a\", src=builddir, dst=\"lib\")\n                self.copy(\"*.so\", src=builddir, dst=\"lib\")\n                self.copy(\"*.so.*\", src=builddir, dst=\"lib\")\n                self.copy(\"*.dylib\", src=builddir, dst=\"lib\")\n                self.copy(\"*.dll\", src=builddir, dst=\"bin\")\n\n    def package_info(self):\n        lib_pre_suf = (\"\", \"\")\n        if self.settings.compiler == \"Visual Studio\":\n            lib_pre_suf = (\"lib\", \"-{}\".format(self.version))\n        elif self.settings.os == \"Windows\":\n            if self.options.shared:\n                lib_pre_suf = (\"\", \".dll\")\n\n        self.cpp_info.components[\"libmpdecimal\"].libs = [\"{}mpdec{}\".format(*lib_pre_suf)]\n        if self.options.shared:\n            if self.settings.compiler == \"Visual Studio\":\n                if tools.Version(self.version) >= \"2.5.1\":\n                    self.cpp_info.components[\"libmpdecimal\"].defines = [\"MPDECIMAL_DLL\"]\n                else:\n                    self.cpp_info.components[\"libmpdecimal\"].defines = [\"USE_DLL\"]\n        else:\n            if self.settings.os == \"Linux\":\n                self.cpp_info.components[\"libmpdecimal\"].system_libs = [\"m\"]\n\n        if self.options.cxx:\n            self.cpp_info.components[\"libmpdecimal++\"].libs = [\"{}mpdec++{}\".format(*lib_pre_suf)]\n            self.cpp_info.components[\"libmpdecimal++\"].requires = [\"libmpdecimal\"]\n            if self.options.shared:\n                if tools.Version(self.version) >= \"2.5.1\":\n                    self.cpp_info.components[\"libmpdecimal\"].defines = [\"MPDECIMALXX_DLL\"]\n", "path": "recipes/mpdecimal/2.5.x/conanfile.py"}], "after_files": [{"content": "from conans import ConanFile, AutoToolsBuildEnvironment, tools\nfrom conans.errors import ConanInvalidConfiguration\nimport os\nimport shutil\n\nrequired_conan_version = \">=1.33.0\"\n\n\nclass MpdecimalConan(ConanFile):\n    name = \"mpdecimal\"\n    description = \"mpdecimal is a package for correctly-rounded arbitrary precision decimal floating point arithmetic.\"\n    license = \"BSD-2-Clause\"\n    topics = (\"conan\", \"mpdecimal\", \"multiprecision\", \"library\")\n    url = \"https://github.com/conan-io/conan-center-index\"\n    homepage = \"http://www.bytereef.org/mpdecimal\"\n    settings = \"os\", \"compiler\", \"build_type\", \"arch\"\n    options = {\n        \"shared\": [True, False],\n        \"fPIC\": [True, False],\n        \"cxx\": [True, False],\n    }\n    default_options = {\n        \"shared\": False,\n        \"fPIC\": True,\n        \"cxx\": True,\n    }\n\n    exports_sources = \"patches/**\"\n\n    _autotools = None\n\n    @property\n    def _source_subfolder(self):\n        return \"source_subfolder\"\n\n    @property\n    def _settings_build(self):\n        return getattr(self, \"setings_build\", self.settings)\n\n    def config_options(self):\n        if self.settings.os == \"Windows\":\n            del self.options.fPIC\n\n    def configure(self):\n        if self.options.shared:\n            del self.options.fPIC\n        if not self.options.cxx:\n            del self.settings.compiler.libcxx\n            del self.settings.compiler.cppstd\n\n    def build_requirements(self):\n        if self.settings.compiler != \"Visual Studio\":\n            self.build_requires(\"automake/1.16.3\")\n            if self._settings_build.os == \"Windows\" and not tools.get_env(\"CONAN_BASH_PATH\"):\n                self.build_requires(\"msys2/cci.latest\")\n\n    def validate(self):\n        if self.settings.arch not in (\"x86\", \"x86_64\"):\n            raise ConanInvalidConfiguration(\"Arch is unsupported\")\n        if self.options.cxx:\n            if self.options.shared and self.settings.os == \"Windows\":\n                raise ConanInvalidConfiguration(\"A shared libmpdec++ is not possible on Windows (due to non-exportable thread local storage)\")\n\n    def source(self):\n        tools.get(**self.conan_data[\"sources\"][self.version],\n                  destination=self._source_subfolder, strip_root=True)\n\n    def _patch_sources(self):\n        for patch in self.conan_data.get(\"patches\", {}).get(self.version, []):\n            tools.patch(**patch)\n\n    def _build_msvc(self):\n        libmpdec_folder = os.path.join(self.build_folder, self._source_subfolder, \"libmpdec\")\n        libmpdecpp_folder = os.path.join(self.build_folder, self._source_subfolder, \"libmpdec++\")\n        vcbuild_folder = os.path.join(self.build_folder, self._source_subfolder, \"vcbuild\")\n        arch_ext = \"{}\".format(32 if self.settings.arch == \"x86\" else 64)\n        dist_folder = os.path.join(vcbuild_folder, \"dist{}\".format(arch_ext))\n        os.mkdir(dist_folder)\n\n        shutil.copy(os.path.join(libmpdec_folder, \"Makefile.vc\"), os.path.join(libmpdec_folder, \"Makefile\"))\n\n        autotools = AutoToolsBuildEnvironment(self)\n        mpdec_extra_flags = []\n        mpdecxx_extra_flags = []\n        if tools.Version(self.version) >= \"2.5.1\":\n            if self.options.shared:\n                mpdec_extra_flags = [\"-DMPDECIMAL_DLL\"]\n                mpdecxx_extra_flags = [\"-DLIBMPDECXX_DLL\"]\n\n        mpdec_target = \"libmpdec-{}.{}\".format(self.version, \"dll\" if self.options.shared else \"lib\")\n        mpdecpp_target = \"libmpdec++-{}.{}\".format(self.version, \"dll\" if self.options.shared else \"lib\")\n\n        builds = [[libmpdec_folder, mpdec_target, mpdec_extra_flags] ]\n        if self.options.cxx:\n            builds.append([libmpdecpp_folder, mpdecpp_target, mpdecxx_extra_flags])\n        with tools.vcvars(self):\n            for build_dir, target, extra_flags in builds:\n                with tools.chdir(build_dir):\n                    self.run(\"\"\"nmake /nologo /f Makefile.vc {target} MACHINE={machine} DEBUG={debug} DLL={dll} CONAN_CFLAGS=\"{cflags}\" CONAN_CXXFLAGS=\"{cxxflags}\" CONAN_LDFLAGS=\"{ldflags}\" \"\"\".format(\n                        target=target,\n                        machine={\"x86\": \"ppro\", \"x86_64\": \"x64\"}[str(self.settings.arch)],  # FIXME: else, use ansi32 and ansi64\n                        debug=\"1\" if self.settings.build_type == \"Debug\" else \"0\",\n                        dll=\"1\" if self.options.shared else \"0\",\n                        cflags=\" \".join(autotools.flags + extra_flags),\n                        cxxflags=\" \".join(autotools.cxx_flags + extra_flags),\n                        ldflags=\" \".join(autotools.link_flags),\n                    ))\n\n        with tools.chdir(libmpdec_folder):\n            shutil.copy(\"mpdecimal.h\", dist_folder)\n            if self.options.shared:\n                shutil.copy(\"libmpdec-{}.dll\".format(self.version), os.path.join(dist_folder, \"libmpdec-{}.dll\".format(self.version)))\n                shutil.copy(\"libmpdec-{}.dll.exp\".format(self.version), os.path.join(dist_folder, \"libmpdec-{}.exp\".format(self.version)))\n                shutil.copy(\"libmpdec-{}.dll.lib\".format(self.version), os.path.join(dist_folder, \"libmpdec-{}.lib\".format(self.version)))\n            else:\n                shutil.copy(\"libmpdec-{}.lib\".format(self.version), os.path.join(dist_folder, \"libmpdec-{}.lib\".format(self.version)))\n        if self.options.cxx:\n            with tools.chdir(libmpdecpp_folder):\n                shutil.copy(\"decimal.hh\", dist_folder)\n                shutil.copy(\"libmpdec++-{}.lib\".format(self.version), os.path.join(dist_folder, \"libmpdec++-{}.lib\".format(self.version)))\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        conf_args = [\n            \"--enable-cxx\" if self.options.cxx else \"--disable-cxx\"\n        ]\n        self._autotools.configure(args=conf_args)\n        return self._autotools\n\n    @property\n    def _shared_suffix(self):\n        if tools.is_apple_os(self.settings.os):\n            return \".dylib\"\n        return {\n            \"Windows\": \".dll\",\n        }.get(str(self.settings.os), \".so\")\n\n    @property\n    def _target_names(self):\n        libsuffix = self._shared_suffix if self.options.shared else \".a\"\n        versionsuffix = \".{}\".format(self.version) if self.options.shared else \"\"\n        suffix = \"{}{}\".format(versionsuffix, libsuffix) if tools.is_apple_os(self.settings.os) or self.settings.os == \"Windows\" else \"{}{}\".format(libsuffix, versionsuffix)\n        return \"libmpdec{}\".format(suffix), \"libmpdec++{}\".format(suffix)\n\n    def build(self):\n        self._patch_sources()\n        if self.settings.compiler == \"Visual Studio\":\n            self._build_msvc()\n        else:\n            with tools.chdir(self._source_subfolder):\n                self.run(\"autoreconf -fiv\", win_bash=tools.os_info.is_windows)\n                autotools = self._configure_autotools()\n                self.output.info(tools.load(os.path.join(\"libmpdec\", \"Makefile\")))\n                libmpdec, libmpdecpp = self._target_names\n                with tools.chdir(\"libmpdec\"):\n                    autotools.make(target=libmpdec)\n                if self.options.cxx:\n                    with tools.chdir(\"libmpdec++\"):\n                        autotools.make(target=libmpdecpp)\n\n    def package(self):\n        self.copy(\"LICENSE.txt\", src=self._source_subfolder, dst=\"licenses\")\n        if self.settings.compiler == \"Visual Studio\":\n            distfolder = os.path.join(self.build_folder, self._source_subfolder, \"vcbuild\", \"dist{}\".format(32 if self.settings.arch == \"x86\" else 64))\n            self.copy(\"vc*.h\", src=os.path.join(self.build_folder, self._source_subfolder, \"libmpdec\"), dst=\"include\")\n            self.copy(\"*.h\", src=distfolder, dst=\"include\")\n            if self.options.cxx:\n                self.copy(\"*.hh\", src=distfolder, dst=\"include\")\n            self.copy(\"*.lib\", src=distfolder, dst=\"lib\")\n            self.copy(\"*.dll\", src=distfolder, dst=\"bin\")\n        else:\n            mpdecdir = os.path.join(self._source_subfolder, \"libmpdec\")\n            mpdecppdir = os.path.join(self._source_subfolder, \"libmpdec++\")\n            self.copy(\"mpdecimal.h\", src=mpdecdir, dst=\"include\")\n            if self.options.cxx:\n                self.copy(\"decimal.hh\", src=mpdecppdir, dst=\"include\")\n            builddirs = [mpdecdir]\n            if self.options.cxx:\n                builddirs.append(mpdecppdir)\n            for builddir in builddirs:\n                self.copy(\"*.a\", src=builddir, dst=\"lib\")\n                self.copy(\"*.so\", src=builddir, dst=\"lib\")\n                self.copy(\"*.so.*\", src=builddir, dst=\"lib\")\n                self.copy(\"*.dylib\", src=builddir, dst=\"lib\")\n                self.copy(\"*.dll\", src=builddir, dst=\"bin\")\n\n    def package_info(self):\n        lib_pre_suf = (\"\", \"\")\n        if self.settings.compiler == \"Visual Studio\":\n            lib_pre_suf = (\"lib\", \"-{}\".format(self.version))\n        elif self.settings.os == \"Windows\":\n            if self.options.shared:\n                lib_pre_suf = (\"\", \".dll\")\n\n        self.cpp_info.components[\"libmpdecimal\"].libs = [\"{}mpdec{}\".format(*lib_pre_suf)]\n        if self.options.shared:\n            if self.settings.compiler == \"Visual Studio\":\n                if tools.Version(self.version) >= \"2.5.1\":\n                    self.cpp_info.components[\"libmpdecimal\"].defines = [\"MPDECIMAL_DLL\"]\n                else:\n                    self.cpp_info.components[\"libmpdecimal\"].defines = [\"USE_DLL\"]\n        else:\n            if self.settings.os == \"Linux\":\n                self.cpp_info.components[\"libmpdecimal\"].system_libs = [\"m\"]\n\n        if self.options.cxx:\n            self.cpp_info.components[\"libmpdecimal++\"].libs = [\"{}mpdec++{}\".format(*lib_pre_suf)]\n            self.cpp_info.components[\"libmpdecimal++\"].requires = [\"libmpdecimal\"]\n            if self.options.shared:\n                if tools.Version(self.version) >= \"2.5.1\":\n                    self.cpp_info.components[\"libmpdecimal\"].defines = [\"MPDECIMALXX_DLL\"]\n", "path": "recipes/mpdecimal/2.5.x/conanfile.py"}]}