We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Conan Error in build() method
Today I downloaded Conan, cmake, Visual studio code (including the C++, C++ makefile, Cmake, Cmake tools, and conan-tools extensions).

In order to get started, I began with the [following](https://docs.conan.io/en/latest/getting_started.html) tutorial. Everything went smoothly up until step 5, where I got the following error:

```C:\Users\rik\Documents\Coding\C++ Conan\build>conan install .. --build=missing
Configuration:
[settings]
arch=x86_64
arch_build=x86_64
build_type=Release
compiler=gcc
compiler.libcxx=libstdc++11
compiler.version=6.3
os=Windows
os_build=Windows
[options]
[build_requires]
[env]

WARN: apr-util/1.6.1: requirement expat/2.2.9 overridden by poco/1.10.0 to expat/2.2.10
WARN: libmysqlclient/8.0.17: requirement openssl/1.1.1i overridden by poco/1.10.0 to openssl/1.1.1h
apr/1.7.0: WARN: Package binary is corrupted, removing: 75bcd663b0f2f789317e8f347afd187fc180604d
conanfile.txt: Installing package
Requirements
    apr/1.7.0 from 'conan-center' - Cache
    apr-util/1.6.1 from 'conan-center' - Cache
    bzip2/1.0.8 from 'conan-center' - Cache
    expat/2.2.10 from 'conan-center' - Cache
    libmysqlclient/8.0.17 from 'conan-center' - Cache
    libpq/11.5 from 'conan-center' - Cache
    openssl/1.1.1h from 'conan-center' - Cache
    pcre/8.41 from 'conan-center' - Cache
    poco/1.10.0 from 'conan-center' - Cache
    sqlite3/3.33.0 from 'conan-center' - Cache
    zlib/1.2.11 from 'conan-center' - Cache
Packages
    apr/1.7.0:75bcd663b0f2f789317e8f347afd187fc180604d - Build
    apr-util/1.6.1:8b2f670f1c54911ff5c244c18d6d4a4abee1db7f - Build
    bzip2/1.0.8:3aee75d6bdc58b782dbb09a2263ed3abf7aa35f8 - Build
    expat/2.2.10:7bc8c2c85db7a618e5320dc997f27fc33e1df074 - Build
    libmysqlclient/8.0.17:3df753469e9528701aceb5edaaf51dd94ae01615 - Build
    libpq/11.5:9fc28f1bce9db80921859269566418c1997aa229 - Build
    openssl/1.1.1h:7bc8c2c85db7a618e5320dc997f27fc33e1df074 - Build
    pcre/8.41:00ce0eb92ff18fdcef18d35149ff79f2e13475f7 - Build
    poco/1.10.0:a62b3b7642c929f88fee01e91937e1eb4f066b68 - Build
    sqlite3/3.33.0:d7a5a0159ffdae5dbeca410940686c7d66bbd521 - Build
    zlib/1.2.11:7bc8c2c85db7a618e5320dc997f27fc33e1df074 - Build
Build requirements
    msys2/20190524 from 'conan-center' - Cache
    msys2/20200517 from 'conan-center' - Cache
    nasm/2.14 from 'conan-center' - Cache
Build requirements packages
    msys2/20190524:3cbd862cb7a3ea47ed1220dc027f344262d5224f - Cache
    msys2/20200517:3cbd862cb7a3ea47ed1220dc027f344262d5224f - Cache
    nasm/2.14:456f15897172eef340fcbac8a70811f2beb26a93 - Cache
Installing (downloading, building) binaries...
apr/1.7.0: WARN: Build folder is dirty, removing it: C:\Users\rik\.conan\data\apr\1.7.0\_\_\build\75bcd663b0f2f789317e8f347afd187fc180604d
apr/1.7.0: Copying sources to build folder
apr/1.7.0: Building your package in C:\Users\rik\.conan\data\apr\1.7.0\_\_\build\75bcd663b0f2f789317e8f347afd187fc180604d
apr/1.7.0: Generator cmake created conanbuildinfo.cmake
apr/1.7.0: Calling build()
apr/1.7.0: WARN: Error running `configure --help`: Error 1 while executing source_subfolder/configure --help
apr/1.7.0: Calling:
 > source_subfolder/configure --with-installbuilddir=${prefix}/bin/build-1 --disable-shared --enable-static --prefix=C:/Users/rik/.conan/data/apr/1.7.0/_/_/package/75bcd663b0f2f789317e8f347afd187fc180604d
'source_subfolder' is not recognized as an internal or external command,
operable program or batch file.
apr/1.7.0:
apr/1.7.0: ERROR: Package '75bcd663b0f2f789317e8f347afd187fc180604d' build failed
apr/1.7.0: WARN: Build folder C:\Users\rik\.conan\data\apr\1.7.0\_\_\build\75bcd663b0f2f789317e8f347afd187fc180604d
ERROR: apr/1.7.0: Error in build() method, line 90
        autotools = self._configure_autotools()
while calling '_configure_autotools', line 74
        self._autotools.configure(args=conf_args, configure_dir=self._source_subfolder)
        ConanException: Error 1 while executing source_subfolder/configure --with-installbuilddir=${prefix}/bin/build-1 --disable-shared --enable-static `--prefix=C:/Users/rik/.conan/data/apr/1.7.0/_/_/package/75bcd663b0f2f789317e8f347afd187fc180604d```




**I have been trying to solve the problem for a few hours now, but do not know how to continue. Does anyone have any ideas as to what I am doing wrong?

My current default conan profile looks as follows:**
```[settings]
os=Windows
os_build=Windows
arch=x86_64
arch_build=x86_64
compiler=gcc
compiler.version=6.3
compiler.libcxx=libstdc++11
build_type=Release
[options]
[build_requires]
[env]
```



--- 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/apr/all/conanfile.py`
Content:
```
1 import os
2 import re
3 from conans import AutoToolsBuildEnvironment, ConanFile, CMake, tools
4 from conans.errors import ConanException
5 
6 
7 class AprConan(ConanFile):
8     name = "apr"
9     description = "The Apache Portable Runtime (APR) provides a predictable and consistent interface to underlying platform-specific implementations"
10     license = "Apache-2.0"
11     topics = ("conan", "apr", "apache", "platform", "library")
12     homepage = "https://apr.apache.org/"
13     url = "https://github.com/conan-io/conan-center-index"
14     exports_sources = "CMakeLists.txt", "patches/**"
15     generators = "cmake"
16     settings = "os", "arch", "compiler", "build_type"
17     options = {
18         "shared": [True, False],
19         "fPIC": [True, False],
20         "force_apr_uuid": [True, False],
21     }
22     default_options = {
23         "shared": False,
24         "fPIC": True,
25         "force_apr_uuid": True,
26     }
27 
28     _autotools = None
29     _cmake = None
30 
31     def config_options(self):
32         if self.settings.os == "Windows":
33             del self.options.fPIC
34 
35     def configure(self):
36         if self.options.shared:
37             del self.options.fPIC
38         del self.settings.compiler.cppstd
39         del self.settings.compiler.libcxx
40 
41     @property
42     def _source_subfolder(self):
43         return "source_subfolder"
44 
45     @property
46     def _build_subfolder(self):
47         return "build_subfolder"
48 
49     def source(self):
50         tools.get(**self.conan_data["sources"][self.version])
51         os.rename("{}-{}".format(self.name, self.version), self._source_subfolder)
52 
53     def _configure_cmake(self):
54         if self._cmake:
55             return self._cmake
56         self._cmake = CMake(self)
57         self._cmake.definitions["INSTALL_PDB"] = False
58         self._cmake.definitions["APR_BUILD_TESTAPR"] = False
59         self._cmake.configure(build_folder=self._build_subfolder)
60         return self._cmake
61 
62     def _configure_autotools(self):
63         if self._autotools:
64             return self._autotools
65         self._autotools = AutoToolsBuildEnvironment(self)
66         self._autotools.libs = []
67         conf_args = [
68             "--with-installbuilddir=${prefix}/bin/build-1",
69         ]
70         if self.options.shared:
71             conf_args.extend(["--enable-shared", "--disable-static"])
72         else:
73             conf_args.extend(["--disable-shared", "--enable-static"])
74         self._autotools.configure(args=conf_args, configure_dir=self._source_subfolder)
75         return self._autotools
76 
77     def _patch_sources(self):
78         for patch in self.conan_data["patches"][self.version]:
79             tools.patch(**patch)
80         if self.options.force_apr_uuid:
81             tools.replace_in_file(os.path.join(self._source_subfolder, "include", "apr.h.in"),
82                                   "@osuuid@", "0")
83 
84     def build(self):
85         self._patch_sources()
86         if self.settings.compiler == "Visual Studio":
87             cmake = self._configure_cmake()
88             cmake.build(target="libapr-1" if self.options.shared else "apr-1")
89         else:
90             autotools = self._configure_autotools()
91             autotools.make()
92 
93     def package(self):
94         self.copy("LICENSE", dst="licenses", src=self._source_subfolder)
95         if self.settings.compiler == "Visual Studio":
96             cmake = self._configure_cmake()
97             cmake.install()
98         else:
99             autotools = self._configure_autotools()
100             autotools.install()
101 
102             os.unlink(os.path.join(self.package_folder, "lib", "libapr-1.la"))
103             tools.rmdir(os.path.join(self.package_folder, "build-1"))
104             tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig"))
105 
106             apr_rules_mk = os.path.join(self.package_folder, "bin", "build-1", "apr_rules.mk")
107             apr_rules_cnt = open(apr_rules_mk).read()
108             for key in ("apr_builddir", "apr_builders", "top_builddir"):
109                 apr_rules_cnt, nb = re.subn("^{}=[^\n]*\n".format(key), "{}=$(_APR_BUILDDIR)\n".format(key), apr_rules_cnt, flags=re.MULTILINE)
110                 if nb == 0:
111                     raise ConanException("Could not find/replace {} in {}".format(key, apr_rules_mk))
112             open(apr_rules_mk, "w").write(apr_rules_cnt)
113 
114     def package_info(self):
115         self.cpp_info.names["pkg_config"] = "apr-1"
116         self.cpp_info.libs = ["apr-1"]
117         if not self.options.shared:
118             self.cpp_info.defines = ["APR_DECLARE_STATIC"]
119             if self.settings.os == "Linux":
120                 self.cpp_info.system_libs = ["dl", "pthread"]
121             if self.settings.os == "Windows":
122                 self.cpp_info.system_libs = ["rpcrt4"]
123 
124         apr_root = self.package_folder
125         if tools.os_info.is_windows:
126             apr_root = tools.unix_path(apr_root)
127         self.output.info("Settings APR_ROOT environment var: {}".format(apr_root))
128         self.env_info.APR_ROOT = apr_root
129 
130         apr_mk_dir = os.path.join(self.package_folder, "bin", "build-1")
131         if tools.os_info.is_windows:
132             apr_mk_dir = tools.unix_path(apr_mk_dir)
133         self.env_info._APR_BUILDDIR = apr_mk_dir
134
```
--- 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/apr/all/conanfile.py b/recipes/apr/all/conanfile.py
--- a/recipes/apr/all/conanfile.py
+++ b/recipes/apr/all/conanfile.py
@@ -64,13 +64,15 @@
             return self._autotools
         self._autotools = AutoToolsBuildEnvironment(self)
         self._autotools.libs = []
+        yes_no = lambda v: "yes" if v else "no"
         conf_args = [
             "--with-installbuilddir=${prefix}/bin/build-1",
+            "--enable-shared={}".format(yes_no(self.options.shared)),
+            "--enable-static={}".format(yes_no(not self.options.shared)),
         ]
-        if self.options.shared:
-            conf_args.extend(["--enable-shared", "--disable-static"])
-        else:
-            conf_args.extend(["--disable-shared", "--enable-static"])
+        if tools.cross_building(self.settings):
+            #
+            conf_args.append("apr_cv_mutex_robust_shared=yes")
         self._autotools.configure(args=conf_args, configure_dir=self._source_subfolder)
         return self._autotools

{"golden_diff": "diff --git a/recipes/apr/all/conanfile.py b/recipes/apr/all/conanfile.py\n--- a/recipes/apr/all/conanfile.py\n+++ b/recipes/apr/all/conanfile.py\n@@ -64,13 +64,15 @@\n             return self._autotools\n         self._autotools = AutoToolsBuildEnvironment(self)\n         self._autotools.libs = []\n+        yes_no = lambda v: \"yes\" if v else \"no\"\n         conf_args = [\n             \"--with-installbuilddir=${prefix}/bin/build-1\",\n+            \"--enable-shared={}\".format(yes_no(self.options.shared)),\n+            \"--enable-static={}\".format(yes_no(not self.options.shared)),\n         ]\n-        if self.options.shared:\n-            conf_args.extend([\"--enable-shared\", \"--disable-static\"])\n-        else:\n-            conf_args.extend([\"--disable-shared\", \"--enable-static\"])\n+        if tools.cross_building(self.settings):\n+            #\n+            conf_args.append(\"apr_cv_mutex_robust_shared=yes\")\n         self._autotools.configure(args=conf_args, configure_dir=self._source_subfolder)\n         return self._autotools\n", "issue": "Conan Error in build() method\nToday I downloaded Conan, cmake, Visual studio code (including the C++, C++ makefile, Cmake, Cmake tools, and conan-tools extensions).\r\n\r\nIn order to get started, I began with the [following](https://docs.conan.io/en/latest/getting_started.html) tutorial. Everything went smoothly up until step 5, where I got the following error:\r\n\r\n```C:\\Users\\rik\\Documents\\Coding\\C++ Conan\\build>conan install .. --build=missing\r\nConfiguration:\r\n[settings]\r\narch=x86_64\r\narch_build=x86_64\r\nbuild_type=Release\r\ncompiler=gcc\r\ncompiler.libcxx=libstdc++11\r\ncompiler.version=6.3\r\nos=Windows\r\nos_build=Windows\r\n[options]\r\n[build_requires]\r\n[env]\r\n\r\nWARN: apr-util/1.6.1: requirement expat/2.2.9 overridden by poco/1.10.0 to expat/2.2.10\r\nWARN: libmysqlclient/8.0.17: requirement openssl/1.1.1i overridden by poco/1.10.0 to openssl/1.1.1h\r\napr/1.7.0: WARN: Package binary is corrupted, removing: 75bcd663b0f2f789317e8f347afd187fc180604d\r\nconanfile.txt: Installing package\r\nRequirements\r\n    apr/1.7.0 from 'conan-center' - Cache\r\n    apr-util/1.6.1 from 'conan-center' - Cache\r\n    bzip2/1.0.8 from 'conan-center' - Cache\r\n    expat/2.2.10 from 'conan-center' - Cache\r\n    libmysqlclient/8.0.17 from 'conan-center' - Cache\r\n    libpq/11.5 from 'conan-center' - Cache\r\n    openssl/1.1.1h from 'conan-center' - Cache\r\n    pcre/8.41 from 'conan-center' - Cache\r\n    poco/1.10.0 from 'conan-center' - Cache\r\n    sqlite3/3.33.0 from 'conan-center' - Cache\r\n    zlib/1.2.11 from 'conan-center' - Cache\r\nPackages\r\n    apr/1.7.0:75bcd663b0f2f789317e8f347afd187fc180604d - Build\r\n    apr-util/1.6.1:8b2f670f1c54911ff5c244c18d6d4a4abee1db7f - Build\r\n    bzip2/1.0.8:3aee75d6bdc58b782dbb09a2263ed3abf7aa35f8 - Build\r\n    expat/2.2.10:7bc8c2c85db7a618e5320dc997f27fc33e1df074 - Build\r\n    libmysqlclient/8.0.17:3df753469e9528701aceb5edaaf51dd94ae01615 - Build\r\n    libpq/11.5:9fc28f1bce9db80921859269566418c1997aa229 - Build\r\n    openssl/1.1.1h:7bc8c2c85db7a618e5320dc997f27fc33e1df074 - Build\r\n    pcre/8.41:00ce0eb92ff18fdcef18d35149ff79f2e13475f7 - Build\r\n    poco/1.10.0:a62b3b7642c929f88fee01e91937e1eb4f066b68 - Build\r\n    sqlite3/3.33.0:d7a5a0159ffdae5dbeca410940686c7d66bbd521 - Build\r\n    zlib/1.2.11:7bc8c2c85db7a618e5320dc997f27fc33e1df074 - Build\r\nBuild requirements\r\n    msys2/20190524 from 'conan-center' - Cache\r\n    msys2/20200517 from 'conan-center' - Cache\r\n    nasm/2.14 from 'conan-center' - Cache\r\nBuild requirements packages\r\n    msys2/20190524:3cbd862cb7a3ea47ed1220dc027f344262d5224f - Cache\r\n    msys2/20200517:3cbd862cb7a3ea47ed1220dc027f344262d5224f - Cache\r\n    nasm/2.14:456f15897172eef340fcbac8a70811f2beb26a93 - Cache\r\nInstalling (downloading, building) binaries...\r\napr/1.7.0: WARN: Build folder is dirty, removing it: C:\\Users\\rik\\.conan\\data\\apr\\1.7.0\\_\\_\\build\\75bcd663b0f2f789317e8f347afd187fc180604d\r\napr/1.7.0: Copying sources to build folder\r\napr/1.7.0: Building your package in C:\\Users\\rik\\.conan\\data\\apr\\1.7.0\\_\\_\\build\\75bcd663b0f2f789317e8f347afd187fc180604d\r\napr/1.7.0: Generator cmake created conanbuildinfo.cmake\r\napr/1.7.0: Calling build()\r\napr/1.7.0: WARN: Error running `configure --help`: Error 1 while executing source_subfolder/configure --help\r\napr/1.7.0: Calling:\r\n > source_subfolder/configure --with-installbuilddir=${prefix}/bin/build-1 --disable-shared --enable-static --prefix=C:/Users/rik/.conan/data/apr/1.7.0/_/_/package/75bcd663b0f2f789317e8f347afd187fc180604d\r\n'source_subfolder' is not recognized as an internal or external command,\r\noperable program or batch file.\r\napr/1.7.0:\r\napr/1.7.0: ERROR: Package '75bcd663b0f2f789317e8f347afd187fc180604d' build failed\r\napr/1.7.0: WARN: Build folder C:\\Users\\rik\\.conan\\data\\apr\\1.7.0\\_\\_\\build\\75bcd663b0f2f789317e8f347afd187fc180604d\r\nERROR: apr/1.7.0: Error in build() method, line 90\r\n        autotools = self._configure_autotools()\r\nwhile calling '_configure_autotools', line 74\r\n        self._autotools.configure(args=conf_args, configure_dir=self._source_subfolder)\r\n        ConanException: Error 1 while executing source_subfolder/configure --with-installbuilddir=${prefix}/bin/build-1 --disable-shared --enable-static `--prefix=C:/Users/rik/.conan/data/apr/1.7.0/_/_/package/75bcd663b0f2f789317e8f347afd187fc180604d```\r\n\r\n\r\n\r\n\r\n**I have been trying to solve the problem for a few hours now, but do not know how to continue. Does anyone have any ideas as to what I am doing wrong?\r\n\r\nMy current default conan profile looks as follows:**\r\n```[settings]\r\nos=Windows\r\nos_build=Windows\r\narch=x86_64\r\narch_build=x86_64\r\ncompiler=gcc\r\ncompiler.version=6.3\r\ncompiler.libcxx=libstdc++11\r\nbuild_type=Release\r\n[options]\r\n[build_requires]\r\n[env]\r\n```\r\n\r\n\n", "before_files": [{"content": "import os\nimport re\nfrom conans import AutoToolsBuildEnvironment, ConanFile, CMake, tools\nfrom conans.errors import ConanException\n\n\nclass AprConan(ConanFile):\n    name = \"apr\"\n    description = \"The Apache Portable Runtime (APR) provides a predictable and consistent interface to underlying platform-specific implementations\"\n    license = \"Apache-2.0\"\n    topics = (\"conan\", \"apr\", \"apache\", \"platform\", \"library\")\n    homepage = \"https://apr.apache.org/\"\n    url = \"https://github.com/conan-io/conan-center-index\"\n    exports_sources = \"CMakeLists.txt\", \"patches/**\"\n    generators = \"cmake\"\n    settings = \"os\", \"arch\", \"compiler\", \"build_type\"\n    options = {\n        \"shared\": [True, False],\n        \"fPIC\": [True, False],\n        \"force_apr_uuid\": [True, False],\n    }\n    default_options = {\n        \"shared\": False,\n        \"fPIC\": True,\n        \"force_apr_uuid\": True,\n    }\n\n    _autotools = None\n    _cmake = None\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        del self.settings.compiler.cppstd\n        del self.settings.compiler.libcxx\n\n    @property\n    def _source_subfolder(self):\n        return \"source_subfolder\"\n\n    @property\n    def _build_subfolder(self):\n        return \"build_subfolder\"\n\n    def source(self):\n        tools.get(**self.conan_data[\"sources\"][self.version])\n        os.rename(\"{}-{}\".format(self.name, self.version), self._source_subfolder)\n\n    def _configure_cmake(self):\n        if self._cmake:\n            return self._cmake\n        self._cmake = CMake(self)\n        self._cmake.definitions[\"INSTALL_PDB\"] = False\n        self._cmake.definitions[\"APR_BUILD_TESTAPR\"] = False\n        self._cmake.configure(build_folder=self._build_subfolder)\n        return self._cmake\n\n    def _configure_autotools(self):\n        if self._autotools:\n            return self._autotools\n        self._autotools = AutoToolsBuildEnvironment(self)\n        self._autotools.libs = []\n        conf_args = [\n            \"--with-installbuilddir=${prefix}/bin/build-1\",\n        ]\n        if self.options.shared:\n            conf_args.extend([\"--enable-shared\", \"--disable-static\"])\n        else:\n            conf_args.extend([\"--disable-shared\", \"--enable-static\"])\n        self._autotools.configure(args=conf_args, configure_dir=self._source_subfolder)\n        return self._autotools\n\n    def _patch_sources(self):\n        for patch in self.conan_data[\"patches\"][self.version]:\n            tools.patch(**patch)\n        if self.options.force_apr_uuid:\n            tools.replace_in_file(os.path.join(self._source_subfolder, \"include\", \"apr.h.in\"),\n                                  \"@osuuid@\", \"0\")\n\n    def build(self):\n        self._patch_sources()\n        if self.settings.compiler == \"Visual Studio\":\n            cmake = self._configure_cmake()\n            cmake.build(target=\"libapr-1\" if self.options.shared else \"apr-1\")\n        else:\n            autotools = self._configure_autotools()\n            autotools.make()\n\n    def package(self):\n        self.copy(\"LICENSE\", dst=\"licenses\", src=self._source_subfolder)\n        if self.settings.compiler == \"Visual Studio\":\n            cmake = self._configure_cmake()\n            cmake.install()\n        else:\n            autotools = self._configure_autotools()\n            autotools.install()\n\n            os.unlink(os.path.join(self.package_folder, \"lib\", \"libapr-1.la\"))\n            tools.rmdir(os.path.join(self.package_folder, \"build-1\"))\n            tools.rmdir(os.path.join(self.package_folder, \"lib\", \"pkgconfig\"))\n\n            apr_rules_mk = os.path.join(self.package_folder, \"bin\", \"build-1\", \"apr_rules.mk\")\n            apr_rules_cnt = open(apr_rules_mk).read()\n            for key in (\"apr_builddir\", \"apr_builders\", \"top_builddir\"):\n                apr_rules_cnt, nb = re.subn(\"^{}=[^\\n]*\\n\".format(key), \"{}=$(_APR_BUILDDIR)\\n\".format(key), apr_rules_cnt, flags=re.MULTILINE)\n                if nb == 0:\n                    raise ConanException(\"Could not find/replace {} in {}\".format(key, apr_rules_mk))\n            open(apr_rules_mk, \"w\").write(apr_rules_cnt)\n\n    def package_info(self):\n        self.cpp_info.names[\"pkg_config\"] = \"apr-1\"\n        self.cpp_info.libs = [\"apr-1\"]\n        if not self.options.shared:\n            self.cpp_info.defines = [\"APR_DECLARE_STATIC\"]\n            if self.settings.os == \"Linux\":\n                self.cpp_info.system_libs = [\"dl\", \"pthread\"]\n            if self.settings.os == \"Windows\":\n                self.cpp_info.system_libs = [\"rpcrt4\"]\n\n        apr_root = self.package_folder\n        if tools.os_info.is_windows:\n            apr_root = tools.unix_path(apr_root)\n        self.output.info(\"Settings APR_ROOT environment var: {}\".format(apr_root))\n        self.env_info.APR_ROOT = apr_root\n\n        apr_mk_dir = os.path.join(self.package_folder, \"bin\", \"build-1\")\n        if tools.os_info.is_windows:\n            apr_mk_dir = tools.unix_path(apr_mk_dir)\n        self.env_info._APR_BUILDDIR = apr_mk_dir\n", "path": "recipes/apr/all/conanfile.py"}], "after_files": [{"content": "import os\nimport re\nfrom conans import AutoToolsBuildEnvironment, ConanFile, CMake, tools\nfrom conans.errors import ConanException\n\n\nclass AprConan(ConanFile):\n    name = \"apr\"\n    description = \"The Apache Portable Runtime (APR) provides a predictable and consistent interface to underlying platform-specific implementations\"\n    license = \"Apache-2.0\"\n    topics = (\"conan\", \"apr\", \"apache\", \"platform\", \"library\")\n    homepage = \"https://apr.apache.org/\"\n    url = \"https://github.com/conan-io/conan-center-index\"\n    exports_sources = \"CMakeLists.txt\", \"patches/**\"\n    generators = \"cmake\"\n    settings = \"os\", \"arch\", \"compiler\", \"build_type\"\n    options = {\n        \"shared\": [True, False],\n        \"fPIC\": [True, False],\n        \"force_apr_uuid\": [True, False],\n    }\n    default_options = {\n        \"shared\": False,\n        \"fPIC\": True,\n        \"force_apr_uuid\": True,\n    }\n\n    _autotools = None\n    _cmake = None\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        del self.settings.compiler.cppstd\n        del self.settings.compiler.libcxx\n\n    @property\n    def _source_subfolder(self):\n        return \"source_subfolder\"\n\n    @property\n    def _build_subfolder(self):\n        return \"build_subfolder\"\n\n    def source(self):\n        tools.get(**self.conan_data[\"sources\"][self.version])\n        os.rename(\"{}-{}\".format(self.name, self.version), self._source_subfolder)\n\n    def _configure_cmake(self):\n        if self._cmake:\n            return self._cmake\n        self._cmake = CMake(self)\n        self._cmake.definitions[\"INSTALL_PDB\"] = False\n        self._cmake.definitions[\"APR_BUILD_TESTAPR\"] = False\n        self._cmake.configure(build_folder=self._build_subfolder)\n        return self._cmake\n\n    def _configure_autotools(self):\n        if self._autotools:\n            return self._autotools\n        self._autotools = AutoToolsBuildEnvironment(self)\n        self._autotools.libs = []\n        yes_no = lambda v: \"yes\" if v else \"no\"\n        conf_args = [\n            \"--with-installbuilddir=${prefix}/bin/build-1\",\n            \"--enable-shared={}\".format(yes_no(self.options.shared)),\n            \"--enable-static={}\".format(yes_no(not self.options.shared)),\n        ]\n        if tools.cross_building(self.settings):\n            #\n            conf_args.append(\"apr_cv_mutex_robust_shared=yes\")\n        self._autotools.configure(args=conf_args, configure_dir=self._source_subfolder)\n        return self._autotools\n\n    def _patch_sources(self):\n        for patch in self.conan_data[\"patches\"][self.version]:\n            tools.patch(**patch)\n        if self.options.force_apr_uuid:\n            tools.replace_in_file(os.path.join(self._source_subfolder, \"include\", \"apr.h.in\"),\n                                  \"@osuuid@\", \"0\")\n\n    def build(self):\n        self._patch_sources()\n        if self.settings.compiler == \"Visual Studio\":\n            cmake = self._configure_cmake()\n            cmake.build(target=\"libapr-1\" if self.options.shared else \"apr-1\")\n        else:\n            autotools = self._configure_autotools()\n            autotools.make()\n\n    def package(self):\n        self.copy(\"LICENSE\", dst=\"licenses\", src=self._source_subfolder)\n        if self.settings.compiler == \"Visual Studio\":\n            cmake = self._configure_cmake()\n            cmake.install()\n        else:\n            autotools = self._configure_autotools()\n            autotools.install()\n\n            os.unlink(os.path.join(self.package_folder, \"lib\", \"libapr-1.la\"))\n            tools.rmdir(os.path.join(self.package_folder, \"build-1\"))\n            tools.rmdir(os.path.join(self.package_folder, \"lib\", \"pkgconfig\"))\n\n            apr_rules_mk = os.path.join(self.package_folder, \"bin\", \"build-1\", \"apr_rules.mk\")\n            apr_rules_cnt = open(apr_rules_mk).read()\n            for key in (\"apr_builddir\", \"apr_builders\", \"top_builddir\"):\n                apr_rules_cnt, nb = re.subn(\"^{}=[^\\n]*\\n\".format(key), \"{}=$(_APR_BUILDDIR)\\n\".format(key), apr_rules_cnt, flags=re.MULTILINE)\n                if nb == 0:\n                    raise ConanException(\"Could not find/replace {} in {}\".format(key, apr_rules_mk))\n            open(apr_rules_mk, \"w\").write(apr_rules_cnt)\n\n    def package_info(self):\n        self.cpp_info.names[\"pkg_config\"] = \"apr-1\"\n        self.cpp_info.libs = [\"apr-1\"]\n        if not self.options.shared:\n            self.cpp_info.defines = [\"APR_DECLARE_STATIC\"]\n            if self.settings.os == \"Linux\":\n                self.cpp_info.system_libs = [\"dl\", \"pthread\"]\n            if self.settings.os == \"Windows\":\n                self.cpp_info.system_libs = [\"rpcrt4\"]\n\n        apr_root = self.package_folder\n        if tools.os_info.is_windows:\n            apr_root = tools.unix_path(apr_root)\n        self.output.info(\"Settings APR_ROOT environment var: {}\".format(apr_root))\n        self.env_info.APR_ROOT = apr_root\n\n        apr_mk_dir = os.path.join(self.package_folder, \"bin\", \"build-1\")\n        if tools.os_info.is_windows:\n            apr_mk_dir = tools.unix_path(apr_mk_dir)\n        self.env_info._APR_BUILDDIR = apr_mk_dir\n", "path": "recipes/apr/all/conanfile.py"}]}