Skip to content

Commit

Permalink
(#17088) paho-mqtt-c: bump openssl + drop maintenance of 1.3.0 & 1.3.1
Browse files Browse the repository at this point in the history
* bump openssl

* drop maintenance of 1.3.0 & 1.3.1

* add anl to system libs if Linux

* use version range for openssl
  • Loading branch information
SpaceIm authored Apr 28, 2023
1 parent 095b305 commit 2f25d6a
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 439 deletions.
20 changes: 0 additions & 20 deletions recipes/paho-mqtt-c/all/conandata.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,6 @@ sources:
"1.3.4":
url: "https://github.com/eclipse/paho.mqtt.c/archive/v1.3.4.tar.gz"
sha256: "1ae9b657b693254ed0710350df3dcf5232d1f479409a52861b5e5bb5cc3da046"
"1.3.1":
url: "https://github.com/eclipse/paho.mqtt.c/archive/v1.3.1.tar.gz"
sha256: "7b4eed66ae3df3613629139c0df28b16abfa4e0927bd17360027d936784aa55e"
"1.3.0":
url: "https://github.com/eclipse/paho.mqtt.c/archive/v1.3.0.tar.gz"
sha256: "87cf846b02dde6328b84832287d8725d91f12f41366eecb4d59eeda1d6c7efdf"
patches:
"1.3.9":
- patch_file: "patches/0003-allow-static-windows-runtimes.patch"
Expand All @@ -50,17 +44,3 @@ patches:
- patch_file: "patches/0002-fix-MinGW-and-OSX-builds-for-1-3-4.patch"
patch_description: "disable cpack, link win32 libs more, source patches for MinGW/OSX"
patch_type: "conan"
"1.3.1":
- patch_file: "patches/0002-fix-MinGW-and-OSX-builds-for-1-3-1.patch"
patch_description: "disable cpack, link win32 libs more, source patches for MinGW/OSX"
patch_type: "conan"
- patch_file: "patches/0004-fix-cmake-find-openssl.patch"
patch_description: "use cci openssl"
patch_type: "conan"
"1.3.0":
- patch_file: "patches/0001-fix-MinGW-and-OSX-builds-for-1-3-0.patch"
patch_description: "disable cpack, link win32 libs more, source patches for MinGW/OSX"
patch_type: "conan"
- patch_file: "patches/0004-fix-cmake-find-openssl.patch"
patch_description: "use cci openssl"
patch_type: "conan"
46 changes: 16 additions & 30 deletions recipes/paho-mqtt-c/all/conanfile.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
from conan import ConanFile
from conan.errors import ConanInvalidConfiguration
from conan.tools.files import apply_conandata_patches, export_conandata_patches, get, copy, rm, replace_in_file
from conan.tools.scm import Version
from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout
from conan.tools.files import apply_conandata_patches, export_conandata_patches, get, copy, rm, replace_in_file
import os

required_conan_version = ">=1.53.0"


class PahoMqttcConan(ConanFile):
name = "paho-mqtt-c"
description = "Eclipse Paho MQTT C client library for Linux, Windows and MacOS"
Expand All @@ -31,20 +30,13 @@ class PahoMqttcConan(ConanFile):
"high_performance": False,
}

@property
def _has_high_performance_option(self):
return Version(self.version) >= "1.3.2"

def export_sources(self):
export_conandata_patches(self)

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

if not self._has_high_performance_option:
del self.options.high_performance

def configure(self):
if self.options.shared:
self.options.rm_safe("fPIC")
Expand All @@ -57,11 +49,7 @@ def layout(self):
def requirements(self):
if self.options.ssl:
# Headers are exposed https://github.com/eclipse/paho.mqtt.c/blob/f7799da95e347bbc930b201b52a1173ebbad45a7/src/SSLSocket.h#L29
self.requires("openssl/1.1.1t", transitive_headers=True)

def validate(self):
if not self.options.shared and Version(self.version) < "1.3.4":
raise ConanInvalidConfiguration(f"{self.ref} does not support static linking")
self.requires("openssl/[>=1.1 <4]", transitive_headers=True)

def source(self):
get(self, **self.conan_data["sources"][self.version], strip_root=True)
Expand All @@ -80,8 +68,7 @@ def generate(self):
if self.options.ssl:
tc.cache_variables["OPENSSL_SEARCH_PATH"] = self.dependencies["openssl"].package_folder.replace("\\", "/")
tc.cache_variables["OPENSSL_ROOT_DIR"] = self.dependencies["openssl"].package_folder.replace("\\", "/")
if self._has_high_performance_option:
tc.variables["PAHO_HIGH_PERFORMANCE"] = self.options.high_performance
tc.variables["PAHO_HIGH_PERFORMANCE"] = self.options.high_performance
tc.cache_variables["CMAKE_POLICY_DEFAULT_CMP0042"] = "NEW"
tc.generate()

Expand Down Expand Up @@ -119,27 +106,25 @@ def package(self):
rm(self, "*.cmake", os.path.join(self.package_folder, "lib"))

def package_info(self):
self.cpp_info.components["_paho-mqtt-c"].libs = [self._lib_target]

self.cpp_info.set_property("cmake_file_name", "eclipse-paho-mqtt-c")
self.cpp_info.set_property("cmake_target_name", f"eclipse-paho-mqtt-c::{self._cmake_target}")

self.cpp_info.components["_paho-mqtt-c"].set_property("cmake_target_name", f"eclipse-paho-mqtt-c::{self._cmake_target}")

# TODO: back to global scope in conan v2
self.cpp_info.components["_paho-mqtt-c"].libs = [self._lib_target]
if self.settings.os == "Windows":
if not self.options.shared:
self.cpp_info.components["_paho-mqtt-c"].system_libs.append("ws2_32")
if self.settings.compiler == "gcc":
self.cpp_info.components["_paho-mqtt-c"].system_libs.extend(
["wsock32", "uuid", "crypt32", "rpcrt4"])
elif self.settings.os == "Linux":
self.cpp_info.components["_paho-mqtt-c"].system_libs.extend(["anl", "c", "dl", "pthread"])
elif self.settings.os == "FreeBSD":
self.cpp_info.components["_paho-mqtt-c"].system_libs.extend(["compat", "pthread"])
elif self.settings.os == "Android":
self.cpp_info.components["_paho-mqtt-c"].system_libs.extend(["c"])
else:
if self.settings.os == "Linux":
self.cpp_info.components["_paho-mqtt-c"].system_libs.extend(["c", "dl", "pthread"])
elif self.settings.os == "FreeBSD":
self.cpp_info.components["_paho-mqtt-c"].system_libs.extend(["compat", "pthread"])
elif self.settings.os == "Android":
self.cpp_info.components["_paho-mqtt-c"].system_libs.extend(["c"])
else:
self.cpp_info.components["_paho-mqtt-c"].system_libs.extend(["c", "pthread"])
self.cpp_info.components["_paho-mqtt-c"].system_libs.extend(["c", "pthread"])

if self.options.ssl:
self.cpp_info.components["_paho-mqtt-c"].requires = ["openssl::openssl"]
Expand All @@ -149,6 +134,7 @@ def package_info(self):
self.cpp_info.names["cmake_find_package_multi"] = "eclipse-paho-mqtt-c"
self.cpp_info.components["_paho-mqtt-c"].names["cmake_find_package"] = self._cmake_target
self.cpp_info.components["_paho-mqtt-c"].names["cmake_find_package_multi"] = self._cmake_target
self.cpp_info.components["_paho-mqtt-c"].set_property("cmake_target_name", f"eclipse-paho-mqtt-c::{self._cmake_target}")

@property
def _epl_file(self):
Expand All @@ -172,6 +158,6 @@ def _lib_target(self):
target += "s"
if not self.options.shared:
# https://github.com/eclipse/paho.mqtt.c/blob/317fb008e1541838d1c29076d2bc5c3e4b6c4f53/src/CMakeLists.txt#L154
if Version(self.version) < "1.3.2" or self.settings.os == "Windows":
if self.settings.os == "Windows":
target += "-static"
return target

This file was deleted.

Loading

0 comments on commit 2f25d6a

Please sign in to comment.