Skip to content

Commit

Permalink
(#24306) libmaxminddb: add version 1.10.0
Browse files Browse the repository at this point in the history
* libmaxmind: add version 1.10.0

* add with_binaries option

* Cleanups

* append PATH on with_binaries=True

---------

Co-authored-by: Rubén Rincón Blanco <git@rinconblanco.es>
  • Loading branch information
toge and AbrilRBS authored Jun 14, 2024
1 parent 81b0bc2 commit 5fe9cb4
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 15 deletions.
3 changes: 3 additions & 0 deletions recipes/libmaxminddb/all/conandata.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
sources:
"1.10.0":
url: "https://github.com/maxmind/libmaxminddb/releases/download/1.10.0/libmaxminddb-1.10.0.tar.gz"
sha256: "5e6db72df423ae225bfe8897069f6def40faa8931f456b99d79b8b4d664c6671"
"1.9.1":
url: "https://github.com/maxmind/libmaxminddb/releases/download/1.9.1/libmaxminddb-1.9.1.tar.gz"
sha256: "a80682a89d915fdf60b35d316232fb04ebf36fff27fda9bd39fe8a38d3cd3f12"
Expand Down
28 changes: 13 additions & 15 deletions recipes/libmaxminddb/all/conanfile.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
from conan import ConanFile
from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout
from conan.tools.files import export_conandata_patches, apply_conandata_patches, copy, get, rmdir
from conan.tools.scm import Version
import os

required_conan_version = ">=1.52.0"
required_conan_version = ">=1.53.0"

class LibmaxminddbConan(ConanFile):
name = "libmaxminddb"
Expand All @@ -13,13 +14,16 @@ class LibmaxminddbConan(ConanFile):
homepage = "http://maxmind.github.io/libmaxminddb/"
topics = ("maxmind", "geoip")
settings = "os", "arch", "compiler", "build_type"
package_type = "library"
options = {
"shared": [True, False],
"fPIC": [True, False],
"with_binaries": [True, False],
}
default_options = {
"shared": False,
"fPIC": True,
"with_binaries": True,
}

def export_sources(self):
Expand All @@ -28,21 +32,14 @@ def export_sources(self):
def config_options(self):
if self.settings.os == "Windows":
del self.options.fPIC
if Version(self.version) < "1.10.0":
del self.options.with_binaries

def configure(self):
if self.options.shared:
try:
del self.options.fPIC
except Exception:
pass
try:
del self.settings.compiler.libcxx
except Exception:
pass
try:
del self.settings.compiler.cppstd
except Exception:
pass
self.options.rm_safe("fPIC")
self.settings.rm_safe("compiler.libcxx")
self.settings.rm_safe("compiler.cppstd")

def layout(self):
cmake_layout(self, src_folder="src")
Expand All @@ -54,6 +51,8 @@ def source(self):
def generate(self):
tc = CMakeToolchain(self)
tc.variables["BUILD_TESTING"] = False
if "with_binaries" in self.options:
tc.variables["MAXMINDDB_BUILD_BINARIES"] = self.options.with_binaries
# Honor BUILD_SHARED_LIBS from conan_toolchain (see https://github.com/conan-io/conan/issues/11840)
tc.cache_variables["CMAKE_POLICY_DEFAULT_CMP0077"] = "NEW"
tc.generate()
Expand All @@ -79,9 +78,8 @@ def package_info(self):
if self.settings.os == "Windows":
self.cpp_info.system_libs = ["ws2_32"]

if self.settings.os != "Windows":
if self.settings.os != "Windows" and self.options.get_safe("with_binaries", True):
bin_path = os.path.join(self.package_folder, "bin")
self.output.info(f"Appending PATH environment variable: {bin_path}")
self.env_info.PATH.append(bin_path)

# TODO: to remove in conan v2 once cmake_find_package_* generators removed
Expand Down
2 changes: 2 additions & 0 deletions recipes/libmaxminddb/config.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
versions:
"1.10.0":
folder: all
"1.9.1":
folder: all
"1.8.0":
Expand Down

0 comments on commit 5fe9cb4

Please sign in to comment.