Repository: conan-io/conan-center-index

Issue:
[package] boost/1.81: new URL library is not included in the build
### Description

Boost 1.81 introduces the new URL library: https://www.boost.org/doc/libs/1_81_0/libs/url/doc/html/index.html.

It is not included in the boost recipe.

Related PR ##14888.

### Package and Environment Details

* Package Name/Version: **boost/1.81**
* Operating System+version: Any
* Compiler+version: Any
* Docker image: Any
* Conan version: **conan 1.55.0**
* Python version: **Python 3.7.4**


### Conan profile

[settings]
os=Macos
os_build=Macos
arch=armv8
arch_build=armv8
compiler=apple-clang
compiler.version=14
compiler.libcxx=libc++
build_type=Release
[options]
[conf]
[build_requires]
[env]


### Steps to reproduce

conan install boost/1.81

### Logs

<details><summary>Click to expand log</summary>

```
Undefined symbols for architecture x86_64:
  "boost::urls::parse_uri(boost::core::basic_string_view<char>)", referenced from:
      _main in main.cpp.o
  "boost::urls::url_view_base::encoded_host() const", referenced from:
      boost::urls::string_token::return_string::result_type boost::urls::url_view_base::host<boost::urls::string_token::return_string>(boost::urls::string_token::return_string&&) const in main.cpp.o
  "boost::urls::url_view_base::port() const", referenced from:
      _main in main.cpp.o
  "boost::urls::url_view_base::scheme() const", referenced from:
      _main in main.cpp.o
  "boost::urls::pct_string_view::decode_impl(boost::urls::string_token::arg&, boost::urls::encoding_opts) const", referenced from:
      boost::urls::string_token::return_string::result_type boost::urls::pct_string_view::decode<boost::urls::string_token::return_string>(boost::urls::encoding_opts, boost::urls::string_token::return_string&&) const in main.cpp.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [srt-rendezvous] Error 1
```

</details>



Discussion:

Resolving patch:
diff --git a/recipes/boost/all/conanfile.py b/recipes/boost/all/conanfile.py
--- a/recipes/boost/all/conanfile.py
+++ b/recipes/boost/all/conanfile.py
@@ -57,6 +57,7 @@
     "thread",
     "timer",
     "type_erasure",
+    "url",
     "wave",
 )
 
@@ -275,6 +276,7 @@ def config_options(self):
                 self.options.without_fiber = True
                 self.options.without_nowide = True
                 self.options.without_json = True
+                self.options.without_url = True
         else:
             version_cxx11_standard_json = self._min_compiler_version_default_cxx11
             if version_cxx11_standard_json:
@@ -282,10 +284,12 @@ def config_options(self):
                     self.options.without_fiber = True
                     self.options.without_json = True
                     self.options.without_nowide = True
+                    self.options.without_url = True
             else:
                 self.options.without_fiber = True
                 self.options.without_json = True
                 self.options.without_nowide = True
+                self.options.without_url = True
 
         # iconv is off by default on Windows and Solaris
         if self._is_windows_platform or self.settings.os == "SunOS":
@@ -434,7 +438,7 @@ def layout(self):
 
     @property
     def _cxx11_boost_libraries(self):
-        libraries = ["fiber", "json", "nowide"]
+        libraries = ["fiber", "json", "nowide", "url"]
         if Version(self.version) >= "1.76.0":
             libraries.append("math")
         if Version(self.version) >= "1.79.0":
@@ -561,7 +565,7 @@ def package_id(self):
 
     def build_requirements(self):
         if not self.options.header_only:
-            self.tool_requires("b2/4.9.2")
+            self.tool_requires("b2/4.9.3")
 
     def source(self):
         get(self, **self.conan_data["sources"][self.version],
diff --git a/recipes/boost/all/rebuild-dependencies.py b/recipes/boost/all/rebuild-dependencies.py
--- a/recipes/boost/all/rebuild-dependencies.py
+++ b/recipes/boost/all/rebuild-dependencies.py
@@ -55,6 +55,7 @@
     "thread",
     "timer",
     "type_erasure",
+    "url",
     "wave",
 )
 


Test patch:
diff --git a/recipes/boost/all/test_package/CMakeLists.txt b/recipes/boost/all/test_package/CMakeLists.txt
--- a/recipes/boost/all/test_package/CMakeLists.txt
+++ b/recipes/boost/all/test_package/CMakeLists.txt
@@ -134,6 +134,15 @@ if(NOT HEADER_ONLY)
         add_test(NAME boost_numpy COMMAND numpy_exe)
         set_property(TEST boost_numpy PROPERTY ENVIRONMENT "PYTHONPATH=${Python_SITELIB}")
     endif()
+
+    if(WITH_URL)
+        find_package(Boost COMPONENTS url REQUIRED)
+        add_executable(url_exe url.cpp)
+        target_link_libraries(url_exe PRIVATE Boost::url)
+        set_property(TARGET url_exe PROPERTY CXX_STANDARD 11)
+        add_test(NAME boost_url COMMAND url_exe)
+    endif()
+
 endif()
 
 # Test header-only target
diff --git a/recipes/boost/all/test_package/conanfile.py b/recipes/boost/all/test_package/conanfile.py
--- a/recipes/boost/all/test_package/conanfile.py
+++ b/recipes/boost/all/test_package/conanfile.py
@@ -45,6 +45,7 @@ def generate(self):
         tc.cache_variables["WITH_STACKTRACE"] = not self.dependencies["boost"].options.without_stacktrace
         tc.cache_variables["WITH_STACKTRACE_ADDR2LINE"] = self.dependencies["boost"].conf_info.get("user.boost:stacktrace_addr2line_available")
         tc.cache_variables["WITH_STACKTRACE_BACKTRACE"] = self._boost_option("with_stacktrace_backtrace", False)
+        tc.cache_variables["WITH_URL"] = not self._boost_option("without_url", True)
         if self.dependencies["boost"].options.namespace != 'boost' and not self.dependencies["boost"].options.namespace_alias:
             tc.cache_variables['BOOST_NAMESPACE'] = self.dependencies["boost"].options.namespace
         tc.generate()
@@ -59,4 +60,3 @@ def test(self):
             return
         with chdir(self, self.folders.build_folder):
             self.run(f"ctest --output-on-failure -C {self.settings.build_type}", env="conanrun")
-
diff --git a/recipes/boost/all/test_package/url.cpp b/recipes/boost/all/test_package/url.cpp
new file mode 100644
--- /dev/null
+++ b/recipes/boost/all/test_package/url.cpp
@@ -0,0 +1,14 @@
+//
+// Copyright (c) 2022 alandefreitas (alandefreitas@gmail.com)
+//
+// Distributed under the Boost Software License, Version 1.0.
+// https://www.boost.org/LICENSE_1_0.txt
+//
+
+#include <boost/url/url.hpp>
+#include <cassert>
+
+int main() {
+  assert(sizeof(boost::urls::url) > 0);
+  return 0;
+}
diff --git a/recipes/boost/all/test_v1_package/conanfile.py b/recipes/boost/all/test_v1_package/conanfile.py
--- a/recipes/boost/all/test_v1_package/conanfile.py
+++ b/recipes/boost/all/test_v1_package/conanfile.py
@@ -37,6 +37,7 @@ def build(self):
             cmake.definitions["WITH_STACKTRACE"] = not self.options["boost"].without_stacktrace
             cmake.definitions["WITH_STACKTRACE_ADDR2LINE"] = self.deps_user_info["boost"].stacktrace_addr2line_available
             cmake.definitions["WITH_STACKTRACE_BACKTRACE"] = self._boost_option("with_stacktrace_backtrace", False)
+            cmake.definitions["WITH_URL"] = not self._boost_option("without_url", True)
             if self.options["boost"].namespace != 'boost' and not self.options["boost"].namespace_alias:
                 cmake.definitions['BOOST_NAMESPACE'] = self.options["boost"].namespace
             cmake.configure()