Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

libnghttp2: add version 1.64.0, support with_app and with_hpack #23979

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions recipes/libnghttp2/all/conandata.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
sources:
"1.64.0":
url: "https://github.com/nghttp2/nghttp2/releases/download/v1.64.0/nghttp2-1.64.0.tar.bz2"
sha256: "3a670df378e852b85a2295f25e4f51cc28f56e0fcc496408b8c3764290537af5"
"1.61.0":
url: "https://github.com/nghttp2/nghttp2/releases/download/v1.61.0/nghttp2-1.61.0.tar.bz2"
sha256: "4e8cf7ec32d4c5a430966242d72035d255cd9470a8766d61eed7a0190dd544fd"
Expand Down
42 changes: 41 additions & 1 deletion recipes/libnghttp2/all/conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
from conan.tools.gnu import PkgConfigDeps
from conan.tools.microsoft import is_msvc
from conan.tools.scm import Version
from conan.tools.build import check_min_cppstd
import os


Expand Down Expand Up @@ -38,14 +39,41 @@ class Nghttp2Conan(ConanFile):
"with_asio": False,
}

@property
def _is_using_cpp(self):
return self.options.with_app or self.options.with_hpack or self.options.get_safe("with_asio")

@property
def _min_cppstd(self):
return "14" if Version(self.version) <= "1.62.0" else "20"

@property
def _compilers_minimum_version(self):
return {
"14": {
"gcc": "6",
"clang": "5",
"apple-clang": "10",
"Visual Studio": "15",
"msvc": "191",
},
"20": {
"gcc": "11",
"clang": "12",
"apple-clang": "13",
"Visual Studio": "16",
"msvc": "192",
}
}.get(self._min_cppstd, {})

def config_options(self):
if self.settings.os == "Windows":
del self.options.fPIC

def configure(self):
if self.options.shared:
self.options.rm_safe("fPIC")
if not (self.options.with_app or self.options.with_hpack or self.options.with_asio):
if not self._is_using_cpp:
self.settings.rm_safe("compiler.cppstd")
self.settings.rm_safe("compiler.libcxx")
if not self.options.with_app:
Expand Down Expand Up @@ -77,6 +105,14 @@ def validate(self):
raise ConanInvalidConfiguration("Build with asio and MSVC is not supported yet, see upstream bug #589")
if self.settings.compiler == "gcc" and Version(self.settings.compiler.version) < "6":
raise ConanInvalidConfiguration(f"{self.ref} requires GCC >= 6.0")
if self._is_using_cpp:
if self.settings.compiler.cppstd:
check_min_cppstd(self, self._min_cppstd)
minimum_version = self._compilers_minimum_version.get(str(self.settings.compiler), False)
if minimum_version and Version(self.settings.compiler.version) < minimum_version:
raise ConanInvalidConfiguration(
f"{self.ref} requires C++{self._min_cppstd}, which your compiler does not support."
)

def source(self):
get(self, **self.conan_data["sources"][self.version], strip_root=True)
Expand Down Expand Up @@ -108,6 +144,10 @@ def generate(self):
tc.generate()

tc = CMakeDeps(self)
if self.options.with_app:
tc.set_property("libev", "cmake_file_name", "LIBEV")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The variables are uppercase, but the CMake file name is not, causing missing package when building libnghttp2:

-- Could NOT find Libev (missing: LIBEV_LIBRARY LIBEV_INCLUDE_DIR) (Required is at least version "4.11")
-- Could NOT find Libcares (missing: LIBCARES_LIBRARY LIBCARES_INCLUDE_DIR) (Required is at least version "1.7.5")
-- Could NOT find ZLIB (missing: ZLIB_LIBRARY ZLIB_INCLUDE_DIR) (Required is at least version "1.2.3")
-- Could NOT find Libbrotlienc (missing: LIBBROTLIENC_LIBRARY LIBBROTLIENC_INCLUDE_DIR) (Required is at least version "1.0.9")
-- Could NOT find Libbrotlidec (missing: LIBBROTLIDEC_LIBRARY LIBBROTLIDEC_INCLUDE_DIR) (Required is at least version "1.0.9")
-- Could NOT find OpenSSL, try to set the path to OpenSSL root folder in the system variable OPENSSL_ROOT_DIR (missing: OPENSSL_CRYPTO_LIBRARY OPENSSL_INCLUDE_DIR) (Required is at least version "1.1.1")
-- Could NOT find Libngtcp2 (missing: LIBNGTCP2_LIBRARY LIBNGTCP2_INCLUDE_DIR) (Required is at least version "1.0.0")
-- Could NOT find Libngtcp2_crypto_quictls (missing: LIBNGTCP2_CRYPTO_QUICTLS_LIBRARY LIBNGTCP2_CRYPTO_QUICTLS_INCLUDE_DIR) (Required is at least version "1.0.0")
-- Could NOT find Libnghttp3 (missing: LIBNGHTTP3_LIBRARY LIBNGHTTP3_INCLUDE_DIR) (Required is at least version "1.1.0")
-- Could NOT find Systemd (missing: SYSTEMD_INCLUDE_DIRS SYSTEMD_LIBRARIES) (Required is at least version "209")
-- Could NOT find Jansson (missing: JANSSON_LIBRARY JANSSON_INCLUDE_DIR) (Required is at least version "2.5")

https://c3i.jfrog.io/c3i/misc-v2/logs/pr/23979/3-linux-gcc/libnghttp2/1.62.1//2a6d4ded4efa32cdae04eb5160eba3173013407e-build.txt

The project wants Capitalized names (I didn't check what Conan is providing):

if self.options.with_hpack:
tc.set_property("jansson", "cmake_file_name", "JANSSON")
tc.generate()
tc = PkgConfigDeps(self)
tc.generate()
Expand Down
2 changes: 2 additions & 0 deletions recipes/libnghttp2/config.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
versions:
"1.64.0":
folder: all
"1.61.0":
folder: all
"1.60.0":
Expand Down