prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  [package] cgal/all: review options applied
  Comming from https://github.com/conan-io/conan-center-index/pull/965#issuecomment-590802910
  
  Seems that the recipe might require some work regarding the options and flags
  
  </issue>
  <code>
  [start of recipes/cgal/all/conanfile.py]
  1 import os
  2 from conans import ConanFile, CMake, tools
  3 
  4 
  5 class CgalConan(ConanFile):
  6     name = "cgal"
  7     license = "LGPL-3.0-or-later"
  8     url = "https://github.com/conan-io/conan-center-index"
  9     homepage = "https://github.com/CGAL/cgal"
  10     description = "C++ library that aims to provide easy access to efficient and reliable algorithms"\
  11                   "in computational geometry."
  12     topics = ("geometry", "algorithms")
  13     settings = "os", "compiler", "build_type", "arch"
  14     requires = "mpir/3.0.0", "mpfr/4.0.2", "boost/1.72.0", "eigen/3.3.7"
  15     generators = "cmake"
  16 
  17     _source_subfolder = "source_subfolder"
  18     _cmake = None
  19 
  20     options = {
  21         "with_cgal_core": [True, False],
  22         "with_cgal_qt5": [True, False],
  23         "with_cgal_imageio": [True, False]
  24     }
  25 
  26     default_options = {
  27         "with_cgal_core": True,
  28         "with_cgal_qt5": False,
  29         "with_cgal_imageio": True
  30     }
  31 
  32     def _configure_cmake(self):
  33         if not self._cmake:
  34             self._cmake = CMake(self)
  35             self._cmake.definitions["WITH_CGAL_Core"] = self.options.with_cgal_core
  36             self._cmake.definitions["WITH_CGAL_Qt5"] = self.options.with_cgal_qt5
  37             self._cmake.definitions["WITH_CGAL_ImageIO"] = self.options.with_cgal_imageio
  38             self._cmake.configure(source_folder=self._source_subfolder)
  39         return self._cmake
  40 
  41     def _patch_sources(self):
  42         tools.replace_in_file(
  43             os.path.join(self._source_subfolder, "CMakeLists.txt"),
  44             "project(CGAL CXX C)", '''project(CGAL CXX C)
  45 include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)
  46 conan_basic_setup()''')
  47 
  48     def source(self):
  49         tools.get(**self.conan_data["sources"][self.version])
  50         extracted_dir = "CGAL-{}".format(self.version)
  51         os.rename(extracted_dir, self._source_subfolder)
  52 
  53     def build(self):
  54         self._patch_sources()
  55         cmake = self._configure_cmake()
  56         cmake.build()
  57 
  58     def package(self):
  59         self.copy("LICENSE*", dst="licenses", src=self._source_subfolder)
  60         cmake = self._configure_cmake()
  61         cmake.install()
  62         tools.rmdir(os.path.join(self.package_folder, "share"))
  63         tools.rmdir(os.path.join(self.package_folder, "lib", "cmake"))
  64         tools.rmdir(os.path.join(self.package_folder, "bin"))
  65 
  66     def package_info(self):
  67         self.cpp_info.names["cmake_find_package"] = "CGAL"
  68         self.cpp_info.names["cmake_find_package_multi"] = "CGAL"
  69 
  70     def package_id(self):
  71         self.info.header_only()
  72
  [end of recipes/cgal/all/conanfile.py]
  </code>
  
  I need you to solve this issue by generating a single patch file that I can apply directly to this repository using git apply. Please respond with a single patch file in the following format.
  <patch>
  diff --git a/file.py b/file.py
  --- a/file.py
  +++ b/file.py
  @@ -1,27 +1,35 @@
   def euclidean(a, b):
  -    while b:
  -        a, b = b, a % b
  -    return a
  +    if b == 0:
  +        return a
  +    return euclidean(b, a % b)
   
   
   def bresenham(x0, y0, x1, y1):
       points = []
       dx = abs(x1 - x0)
       dy = abs(y1 - y0)
  -    sx = 1 if x0 < x1 else -1
  -    sy = 1 if y0 < y1 else -1
  -    err = dx - dy
  +    x, y = x0, y0
  +    sx = -1 if x0 > x1 else 1
  +    sy = -1 if y0 > y1 else 1
   
  -    while True:
  -        points.append((x0, y0))
  -        if x0 == x1 and y0 == y1:
  -            break
  -        e2 = 2 * err
  -        if e2 > -dy:
  -            err -= dy
  -            x0 += sx
  -        if e2 < dx:
  -            err += dx
  -            y0 += sy
  +    if dx > dy:
  +        err = dx / 2.0
  +        while x != x1:
  +            points.append((x, y))
  +            err -= dy
  +            if err < 0:
  +                y += sy
  +                err += dx
  +            x += sx
  +    else:
  +        err = dy / 2.0
  +        while y != y1:
  +            points.append((x, y))
  +            err -= dx
  +            if err < 0:
  +                x += sx
  +                err += dy
  +            y += sy
  +
  +    points.append((x, y))
       return points
  
  </patch>
golden_diff: diff --git a/recipes/cgal/all/conanfile.py b/recipes/cgal/all/conanfile.py
  --- a/recipes/cgal/all/conanfile.py
  +++ b/recipes/cgal/all/conanfile.py
  @@ -1,5 +1,6 @@
   import os
   from conans import ConanFile, CMake, tools
  +from conans.errors import ConanInvalidConfiguration
   
   
   class CgalConan(ConanFile):
  @@ -13,20 +14,26 @@
       settings = "os", "compiler", "build_type", "arch"
       requires = "mpir/3.0.0", "mpfr/4.0.2", "boost/1.72.0", "eigen/3.3.7"
       generators = "cmake"
  +    exports_sources = "CMakeLists.txt"
   
       _source_subfolder = "source_subfolder"
  +    _build_subfolder = "build_subfolder"
       _cmake = None
   
       options = {
           "with_cgal_core": [True, False],
           "with_cgal_qt5": [True, False],
  -        "with_cgal_imageio": [True, False]
  +        "with_cgal_imageio": [True, False],
  +        "shared": [True, False],
  +        "header_only": [True, False]
       }
   
       default_options = {
           "with_cgal_core": True,
           "with_cgal_qt5": False,
  -        "with_cgal_imageio": True
  +        "with_cgal_imageio": True,
  +        "shared": False,
  +        "header_only": True
       }
   
       def _configure_cmake(self):
  @@ -35,15 +42,19 @@
               self._cmake.definitions["WITH_CGAL_Core"] = self.options.with_cgal_core
               self._cmake.definitions["WITH_CGAL_Qt5"] = self.options.with_cgal_qt5
               self._cmake.definitions["WITH_CGAL_ImageIO"] = self.options.with_cgal_imageio
  -            self._cmake.configure(source_folder=self._source_subfolder)
  +            self._cmake.definitions["CGAL_HEADER_ONLY"] = self.options.header_only
  +            self._cmake.configure(build_folder=self._build_subfolder)
           return self._cmake
   
       def _patch_sources(self):
  -        tools.replace_in_file(
  -            os.path.join(self._source_subfolder, "CMakeLists.txt"),
  -            "project(CGAL CXX C)", '''project(CGAL CXX C)
  -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)
  -conan_basic_setup()''')
  +        tools.replace_in_file(os.path.join(self._source_subfolder, "CMakeLists.txt"),
  +                              "CMAKE_SOURCE_DIR", "CMAKE_CURRENT_SOURCE_DIR")
  +
  +    def configure(self):
  +        if self.options.with_cgal_qt5:
  +            raise ConanInvalidConfiguration("Qt Conan package is not available yet.")
  +        if self.options.header_only:
  +            del self.options.shared
   
       def source(self):
           tools.get(**self.conan_data["sources"][self.version])
  @@ -61,11 +72,20 @@
           cmake.install()
           tools.rmdir(os.path.join(self.package_folder, "share"))
           tools.rmdir(os.path.join(self.package_folder, "lib", "cmake"))
  -        tools.rmdir(os.path.join(self.package_folder, "bin"))
  +        if self.options.get_safe("shared"):
  +            for root, _, filenames in os.walk(os.path.join(self.package_folder, "bin")):
  +                for filename in filenames:
  +                    if not filename.endswith(".dll"):
  +                        os.unlink(os.path.join(root, filename))
  +        else:
  +            tools.rmdir(os.path.join(self.package_folder, "bin"))
   
       def package_info(self):
  +        if not self.options.header_only:
  +            self.cpp_info.libs = tools.collect_libs(self)
           self.cpp_info.names["cmake_find_package"] = "CGAL"
           self.cpp_info.names["cmake_find_package_multi"] = "CGAL"
   
       def package_id(self):
  -        self.info.header_only()
  +        if self.options.header_only:
  +            self.info.header_only()
  
verification_info: {"golden_diff": "diff --git a/recipes/cgal/all/conanfile.py b/recipes/cgal/all/conanfile.py\n--- a/recipes/cgal/all/conanfile.py\n+++ b/recipes/cgal/all/conanfile.py\n@@ -1,5 +1,6 @@\n import os\n from conans import ConanFile, CMake, tools\n+from conans.errors import ConanInvalidConfiguration\n \n \n class CgalConan(ConanFile):\n@@ -13,20 +14,26 @@\n     settings = \"os\", \"compiler\", \"build_type\", \"arch\"\n     requires = \"mpir/3.0.0\", \"mpfr/4.0.2\", \"boost/1.72.0\", \"eigen/3.3.7\"\n     generators = \"cmake\"\n+    exports_sources = \"CMakeLists.txt\"\n \n     _source_subfolder = \"source_subfolder\"\n+    _build_subfolder = \"build_subfolder\"\n     _cmake = None\n \n     options = {\n         \"with_cgal_core\": [True, False],\n         \"with_cgal_qt5\": [True, False],\n-        \"with_cgal_imageio\": [True, False]\n+        \"with_cgal_imageio\": [True, False],\n+        \"shared\": [True, False],\n+        \"header_only\": [True, False]\n     }\n \n     default_options = {\n         \"with_cgal_core\": True,\n         \"with_cgal_qt5\": False,\n-        \"with_cgal_imageio\": True\n+        \"with_cgal_imageio\": True,\n+        \"shared\": False,\n+        \"header_only\": True\n     }\n \n     def _configure_cmake(self):\n@@ -35,15 +42,19 @@\n             self._cmake.definitions[\"WITH_CGAL_Core\"] = self.options.with_cgal_core\n             self._cmake.definitions[\"WITH_CGAL_Qt5\"] = self.options.with_cgal_qt5\n             self._cmake.definitions[\"WITH_CGAL_ImageIO\"] = self.options.with_cgal_imageio\n-            self._cmake.configure(source_folder=self._source_subfolder)\n+            self._cmake.definitions[\"CGAL_HEADER_ONLY\"] = self.options.header_only\n+            self._cmake.configure(build_folder=self._build_subfolder)\n         return self._cmake\n \n     def _patch_sources(self):\n-        tools.replace_in_file(\n-            os.path.join(self._source_subfolder, \"CMakeLists.txt\"),\n-            \"project(CGAL CXX C)\", '''project(CGAL CXX C)\n-include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)\n-conan_basic_setup()''')\n+        tools.replace_in_file(os.path.join(self._source_subfolder, \"CMakeLists.txt\"),\n+                              \"CMAKE_SOURCE_DIR\", \"CMAKE_CURRENT_SOURCE_DIR\")\n+\n+    def configure(self):\n+        if self.options.with_cgal_qt5:\n+            raise ConanInvalidConfiguration(\"Qt Conan package is not available yet.\")\n+        if self.options.header_only:\n+            del self.options.shared\n \n     def source(self):\n         tools.get(**self.conan_data[\"sources\"][self.version])\n@@ -61,11 +72,20 @@\n         cmake.install()\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, \"bin\"))\n+        if self.options.get_safe(\"shared\"):\n+            for root, _, filenames in os.walk(os.path.join(self.package_folder, \"bin\")):\n+                for filename in filenames:\n+                    if not filename.endswith(\".dll\"):\n+                        os.unlink(os.path.join(root, filename))\n+        else:\n+            tools.rmdir(os.path.join(self.package_folder, \"bin\"))\n \n     def package_info(self):\n+        if not self.options.header_only:\n+            self.cpp_info.libs = tools.collect_libs(self)\n         self.cpp_info.names[\"cmake_find_package\"] = \"CGAL\"\n         self.cpp_info.names[\"cmake_find_package_multi\"] = \"CGAL\"\n \n     def package_id(self):\n-        self.info.header_only()\n+        if self.options.header_only:\n+            self.info.header_only()\n", "issue": "[package] cgal/all: review options applied\nComming from https://github.com/conan-io/conan-center-index/pull/965#issuecomment-590802910\r\n\r\nSeems that the recipe might require some work regarding the options and flags\n", "before_files": [{"content": "import os\nfrom conans import ConanFile, CMake, tools\n\n\nclass CgalConan(ConanFile):\n    name = \"cgal\"\n    license = \"LGPL-3.0-or-later\"\n    url = \"https://github.com/conan-io/conan-center-index\"\n    homepage = \"https://github.com/CGAL/cgal\"\n    description = \"C++ library that aims to provide easy access to efficient and reliable algorithms\"\\\n                  \"in computational geometry.\"\n    topics = (\"geometry\", \"algorithms\")\n    settings = \"os\", \"compiler\", \"build_type\", \"arch\"\n    requires = \"mpir/3.0.0\", \"mpfr/4.0.2\", \"boost/1.72.0\", \"eigen/3.3.7\"\n    generators = \"cmake\"\n\n    _source_subfolder = \"source_subfolder\"\n    _cmake = None\n\n    options = {\n        \"with_cgal_core\": [True, False],\n        \"with_cgal_qt5\": [True, False],\n        \"with_cgal_imageio\": [True, False]\n    }\n\n    default_options = {\n        \"with_cgal_core\": True,\n        \"with_cgal_qt5\": False,\n        \"with_cgal_imageio\": True\n    }\n\n    def _configure_cmake(self):\n        if not self._cmake:\n            self._cmake = CMake(self)\n            self._cmake.definitions[\"WITH_CGAL_Core\"] = self.options.with_cgal_core\n            self._cmake.definitions[\"WITH_CGAL_Qt5\"] = self.options.with_cgal_qt5\n            self._cmake.definitions[\"WITH_CGAL_ImageIO\"] = self.options.with_cgal_imageio\n            self._cmake.configure(source_folder=self._source_subfolder)\n        return self._cmake\n\n    def _patch_sources(self):\n        tools.replace_in_file(\n            os.path.join(self._source_subfolder, \"CMakeLists.txt\"),\n            \"project(CGAL CXX C)\", '''project(CGAL CXX C)\ninclude(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)\nconan_basic_setup()''')\n\n    def source(self):\n        tools.get(**self.conan_data[\"sources\"][self.version])\n        extracted_dir = \"CGAL-{}\".format(self.version)\n        os.rename(extracted_dir, self._source_subfolder)\n\n    def build(self):\n        self._patch_sources()\n        cmake = self._configure_cmake()\n        cmake.build()\n\n    def package(self):\n        self.copy(\"LICENSE*\", dst=\"licenses\", src=self._source_subfolder)\n        cmake = self._configure_cmake()\n        cmake.install()\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, \"bin\"))\n\n    def package_info(self):\n        self.cpp_info.names[\"cmake_find_package\"] = \"CGAL\"\n        self.cpp_info.names[\"cmake_find_package_multi\"] = \"CGAL\"\n\n    def package_id(self):\n        self.info.header_only()\n", "path": "recipes/cgal/all/conanfile.py"}]}