Skip to content

Commit

Permalink
Merge branch 'master' of github.com:conan-io/conan-center-index into …
Browse files Browse the repository at this point in the history
…develop
  • Loading branch information
datalogics-devauto committed Jan 27, 2023
2 parents cbdc13d + ec7a07a commit 4f71665
Show file tree
Hide file tree
Showing 47 changed files with 926 additions and 147 deletions.
2 changes: 1 addition & 1 deletion .c3i/config_v1.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
id: 'conan-io/conan-center-index'

conan:
version: 1.56.0
version: 1.57.0

artifactory:
url: "https://c3i.jfrog.io/c3i"
Expand Down
2 changes: 1 addition & 1 deletion .c3i/config_v2.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
id: 'conan-io/conan-center-index-staging-v2'

conan:
version: 2.0.0-beta7
version: 2.0.0-beta8

artifactory:
url: "https://c3i.jfrog.io/c3i"
Expand Down
5 changes: 3 additions & 2 deletions docs/adding_packages/conanfile_attributes.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@ or are known by ConanCenter's build service and have special meaning.
* [Attributes](#attributes)
* [Name](#name)
* [Version](#version)
* [ConanCenter specific releases format](#conancenter-specific-releases-format)
* [License Attribute](#license)
* [ConanCenter specific releases format](#conancenter-specific-releases-format)
* [License Attribute](#license-attribute)
* [Order of methods and attributes](#order-of-methods-and-attributes)
* [Settings](#settings)
* [Options](#options)
* [Recommended Names](#recommended-names)
Expand Down
13 changes: 13 additions & 0 deletions recipes/gnutls/all/conandata.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
sources:
"3.7.8":
url:
- "https://www.gnupg.org/ftp/gcrypt/gnutls/v3.7/gnutls-3.7.8.tar.xz"
- "http://www.ring.gr.jp/pub/net/gnupg/gnutls/v3.7/gnutls-3.7.8.tar.xz"
- "https://www.mirrorservice.org/sites/ftp.gnupg.org/gcrypt/gnutls/v3.7/gnutls-3.7.8.tar.xz"
sha256: "c58ad39af0670efe6a8aee5e3a8b2331a1200418b64b7c51977fb396d4617114"
patches:
"3.7.8":
- patch_description: "Fix Mac OS build when linking to libtasn1"
patch_type: "portability"
patch_source: "https://github.com/xbmc/inputstream.ffmpegdirect/blob/Matrix/depends/common/gnutls/03-undo-libtasn1-cisdigit.patch"
patch_file: "patches/0001-fix-isdigit.patch"
150 changes: 150 additions & 0 deletions recipes/gnutls/all/conanfile.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,150 @@
from conan import ConanFile
from conan.tools.microsoft import is_msvc
from conan.tools.files import get, rmdir, rm, copy, export_conandata_patches, apply_conandata_patches
from conan.tools.layout import basic_layout
from conan.tools.gnu import AutotoolsToolchain, AutotoolsDeps, PkgConfigDeps, Autotools
from conan.tools.build import cross_building
from conan.tools.env import VirtualRunEnv
from conan.tools.apple import is_apple_os
from conan.errors import ConanInvalidConfiguration
import os


required_conan_version = ">=1.55.0"


class GnuTLSConan(ConanFile):
name = "gnutls"
url = "https://github.com/conan-io/conan-center-index"
homepage = "https://www.gnutls.org"
description = "GnuTLS is a secure communications library implementing the SSL, TLS and DTLS protocols"
topics = ("tls", "ssl", "secure communications")
license = ("LGPL-2.1-or-later", "GPL-3-or-later")
settings = "os", "arch", "compiler", "build_type"
options = {"shared": [True, False],
"fPIC": [True, False],
"enable_cxx": [True, False],
"enable_tools": [True, False],
"enable_openssl_compatibility": [True, False],
"with_zlib": [True, False],
"with_zstd": [True, False],
"with_brotli": [True, False],}
default_options = {"shared": False,
"fPIC": True,
"enable_cxx": True,
"enable_tools": True,
"enable_openssl_compatibility": False,
"with_zlib": True,
"with_zstd": True,
"with_brotli": True,}

def export_sources(self):
export_conandata_patches(self)

def configure(self):
if self.options.shared:
del self.options.fPIC
if not self.options.enable_cxx:
self.settings.rm_safe("compiler.libcxx")
self.settings.rm_safe("compiler.cppstd")

def layout(self):
basic_layout(self, src_folder="src")

def requirements(self):
self.requires("nettle/3.8.1")
self.requires("gmp/6.2.1")
self.requires("libiconv/1.17")
if self.options.with_zlib:
self.requires("zlib/1.2.13")
if self.options.with_zstd:
self.requires("zstd/1.5.2")
if self.options.with_brotli:
self.requires("brotli/1.0.9")

def validate(self):
if is_msvc(self):
raise ConanInvalidConfiguration(f"{self.ref} cannot be deployed by Visual Studio.")

def source(self):
get(self, **self.conan_data["sources"][self.version], strip_root=True, destination=self.source_folder)

def generate(self):
if not cross_building(self):
env = VirtualRunEnv(self)
env.generate(scope="build")

yes_no = lambda v: "yes" if v else "no"
autotoolstc = AutotoolsToolchain(self)
autotoolstc.configure_args.extend([
"--disable-tests",
"--disable-doc",
"--disable-guile",
"--disable-libdane",
"--disable-manpages",
"--disable-silent-rules",
"--disable-full-test-suite",
"--disable-maintainer-mode",
"--disable-option-checking",
"--disable-dependency-tracking",
"--disable-heartbeat-support",
"--disable-gtk-doc-html",
"--without-p11-kit",
"--disable-rpath",
"--without-idn",
"--with-included-unistring",
"--with-included-libtasn1",
"--with-libiconv-prefix={}".format(self.dependencies["libiconv"].package_folder),
"--enable-shared={}".format(yes_no(self.options.shared)),
"--enable-static={}".format(yes_no(not self.options.shared)),
"--with-cxx={}".format(yes_no(self.options.enable_cxx)),
"--with-zlib={}".format(yes_no(self.options.with_zlib)),
"--with-brotli={}".format(yes_no(self.options.with_brotli)),
"--with-zstd={}".format(yes_no(self.options.with_zstd)),
"--enable-tools={}".format(yes_no(self.options.enable_tools)),
"--enable-openssl-compatibility={}".format(yes_no(self.options.enable_openssl_compatibility)),
])
env = autotoolstc.environment()
if cross_building(self):
# INFO: Undefined symbols for architecture Mac arm64 rpl_malloc and rpl_realloc
env.define("ac_cv_func_malloc_0_nonnull", "yes")
env.define("ac_cv_func_realloc_0_nonnull", "yes")
autotoolstc.generate(env)
autodeps = AutotoolsDeps(self)
autodeps.generate()
pkgdeps = PkgConfigDeps(self)
pkgdeps.generate()

def build(self):
apply_conandata_patches(self)
autotools = Autotools(self)
autotools.configure()
autotools.make()

def package(self):
copy(self, "LICENSE", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder)
autotools = Autotools(self)
autotools.install()
rmdir(self, os.path.join(self.package_folder, "share"))
rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig"))
rm(self, "*.la", os.path.join(self.package_folder, "lib"))

def package_info(self):
self.cpp_info.libs = ["gnutls", "gnutlsxx"] if self.options.enable_cxx else ["gnutls"]
self.cpp_info.set_property("cmake_find_mode", "both")
self.cpp_info.set_property("cmake_file_name", "GnuTLS")
self.cpp_info.set_property("cmake_target_name", "GnuTLS::GnuTLS")
self.cpp_info.set_property("pkg_config_name", "gnutls")

if is_apple_os(self):
self.cpp_info.frameworks = ["Security", "CoreFoundation"]
elif self.settings.os in ["Linux", "FreeBSD"]:
self.cpp_info.system_libs = ["pthread", "m"]

# TODO: to remove in conan v2 once cmake_find_package_* generators removed
self.cpp_info.names["cmake_find_package"] = "GnuTLS"
self.cpp_info.names["cmake_find_package_multi"] = "GnuTLS"
if self.options.enable_tools:
bin_path = os.path.join(self.package_folder, "bin")
self.output.info("Appending PATH env var with : {}".format(bin_path))
self.env_info.PATH.append(bin_path)
149 changes: 149 additions & 0 deletions recipes/gnutls/all/patches/0001-fix-isdigit.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,149 @@
diff --git a/lib/minitasn1/decoding.c b/lib/minitasn1/decoding.c
index 378219c..f75baa7 100644
--- a/lib/minitasn1/decoding.c
+++ b/lib/minitasn1/decoding.c
@@ -32,7 +32,6 @@
#include <element.h>
#include <limits.h>
#include <intprops.h>
-#include "c-ctype.h"

#ifdef DEBUG
# define warn() fprintf(stderr, "%s: %d\n", __func__, __LINE__)
@@ -353,7 +352,7 @@ _asn1_get_time_der (unsigned type, const unsigned char *der, int der_len, int *r
p = &der[len_len];
for (i=0;i<(unsigned)(str_len-1);i++)
{
- if (c_isdigit(p[i]) == 0)
+ if (isdigit(p[i]) == 0)
{
if (type == ASN1_ETYPE_GENERALIZED_TIME)
{
diff --git a/lib/minitasn1/element.c b/lib/minitasn1/element.c
index 550fdb2..58d9243 100644
--- a/lib/minitasn1/element.c
+++ b/lib/minitasn1/element.c
@@ -30,7 +30,6 @@
#include "parser_aux.h"
#include <gstr.h>
#include "structure.h"
-#include "c-ctype.h"
#include "element.h"

void
@@ -380,7 +379,7 @@ asn1_write_value (asn1_node node_root, const char *name,
case ASN1_ETYPE_ENUMERATED:
if (len == 0)
{
- if ((c_isdigit (value[0])) || (value[0] == '-'))
+ if ((isdigit (value[0])) || (value[0] == '-'))
{
value_temp = malloc (SIZEOF_UNSIGNED_LONG_INT);
if (value_temp == NULL)
@@ -453,7 +452,7 @@ asn1_write_value (asn1_node node_root, const char *name,
p = node->down;
while (type_field (p->type) != ASN1_ETYPE_DEFAULT)
p = p->right;
- if ((c_isdigit (p->value[0])) || (p->value[0] == '-'))
+ if ((isdigit (p->value[0])) || (p->value[0] == '-'))
{
default_temp = malloc (SIZEOF_UNSIGNED_LONG_INT);
if (default_temp == NULL)
@@ -519,7 +518,7 @@ asn1_write_value (asn1_node node_root, const char *name,
break;
case ASN1_ETYPE_OBJECT_ID:
for (i = 0; i < _asn1_strlen (value); i++)
- if ((!c_isdigit (value[i])) && (value[i] != '.') && (value[i] != '+'))
+ if ((!isdigit (value[i])) && (value[i] != '.') && (value[i] != '+'))
return ASN1_VALUE_NOT_VALID;
if (node->type & CONST_DEFAULT)
{
@@ -540,7 +539,7 @@ asn1_write_value (asn1_node node_root, const char *name,
if (len < 11)
return ASN1_VALUE_NOT_VALID;
for (k = 0; k < 10; k++)
- if (!c_isdigit (value[k]))
+ if (!isdigit (value[k]))
return ASN1_VALUE_NOT_VALID;
switch (len)
{
@@ -549,7 +548,7 @@ asn1_write_value (asn1_node node_root, const char *name,
return ASN1_VALUE_NOT_VALID;
break;
case 13:
- if ((!c_isdigit (value[10])) || (!c_isdigit (value[11])) ||
+ if ((!isdigit (value[10])) || (!isdigit (value[11])) ||
(value[12] != 'Z'))
return ASN1_VALUE_NOT_VALID;
break;
@@ -557,16 +556,16 @@ asn1_write_value (asn1_node node_root, const char *name,
if ((value[10] != '+') && (value[10] != '-'))
return ASN1_VALUE_NOT_VALID;
for (k = 11; k < 15; k++)
- if (!c_isdigit (value[k]))
+ if (!isdigit (value[k]))
return ASN1_VALUE_NOT_VALID;
break;
case 17:
- if ((!c_isdigit (value[10])) || (!c_isdigit (value[11])))
+ if ((!isdigit (value[10])) || (!isdigit (value[11])))
return ASN1_VALUE_NOT_VALID;
if ((value[12] != '+') && (value[12] != '-'))
return ASN1_VALUE_NOT_VALID;
for (k = 13; k < 17; k++)
- if (!c_isdigit (value[k]))
+ if (!isdigit (value[k]))
return ASN1_VALUE_NOT_VALID;
break;
default:
@@ -890,7 +889,7 @@ asn1_read_value_type (asn1_node_const root, const char *name, void *ivalue,
p = node->down;
while (type_field (p->type) != ASN1_ETYPE_DEFAULT)
p = p->right;
- if ((c_isdigit (p->value[0])) || (p->value[0] == '-')
+ if ((isdigit (p->value[0])) || (p->value[0] == '-')
|| (p->value[0] == '+'))
{
result = _asn1_convert_integer
diff --git a/lib/minitasn1/int.h b/lib/minitasn1/int.h
index 57f1efd..8e3e2e4 100644
--- a/lib/minitasn1/int.h
+++ b/lib/minitasn1/int.h
@@ -29,6 +29,7 @@
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
+#include <ctype.h>
#include <stdint.h>

#ifdef HAVE_SYS_TYPES_H
diff --git a/lib/minitasn1/parser_aux.c b/lib/minitasn1/parser_aux.c
index bb88ab9..c01b3fa 100644
--- a/lib/minitasn1/parser_aux.c
+++ b/lib/minitasn1/parser_aux.c
@@ -26,7 +26,6 @@
#include "gstr.h"
#include "structure.h"
#include "element.h"
-#include "c-ctype.h"

char _asn1_identifierMissing[ASN1_MAX_NAME_SIZE + 1]; /* identifier name not found */

@@ -755,7 +754,7 @@ _asn1_expand_object_id (list_type **list, asn1_node node)
p2 = p->down;
if (p2 && (type_field (p2->type) == ASN1_ETYPE_CONSTANT))
{
- if (p2->value && !c_isdigit (p2->value[0]))
+ if (p2->value && !isdigit (p2->value[0]))
{
_asn1_str_cpy (name2, sizeof (name2), name_root);
_asn1_str_cat (name2, sizeof (name2), ".");
@@ -1067,7 +1066,7 @@ _asn1_check_identifier (asn1_node_const node)
p2 = p->down;
if (p2 && (type_field (p2->type) == ASN1_ETYPE_CONSTANT))
{
- if (p2->value && !c_isdigit (p2->value[0]))
+ if (p2->value && !isdigit (p2->value[0]))
{
_asn1_str_cpy (name2, sizeof (name2), node->name);
_asn1_str_cat (name2, sizeof (name2), ".");
7 changes: 7 additions & 0 deletions recipes/gnutls/all/test_package/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
cmake_minimum_required(VERSION 3.8)
project(test_package LANGUAGES C)

find_package(GnuTLS REQUIRED CONFIG)

add_executable(${PROJECT_NAME} test_package.c)
target_link_libraries(${PROJECT_NAME} PRIVATE GnuTLS::GnuTLS)
27 changes: 27 additions & 0 deletions recipes/gnutls/all/test_package/conanfile.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@

from conan import ConanFile
from conan.tools.build import can_run
from conan.tools.cmake import cmake_layout, CMake
import os


class TestPackageConan(ConanFile):
settings = "os", "arch", "compiler", "build_type"
generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv"
test_type = "explicit"

def requirements(self):
self.requires(self.tested_reference_str)

def layout(self):
cmake_layout(self)

def build(self):
cmake = CMake(self)
cmake.configure()
cmake.build()

def test(self):
if can_run(self):
bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package")
self.run(bin_path, env="conanrun")
16 changes: 16 additions & 0 deletions recipes/gnutls/all/test_package/test_package.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#include <stdlib.h>
#include <gnutls/gnutls.h>

int main (void) {
int result = 0;
gnutls_session_t session;

gnutls_global_init();
gnutls_global_set_log_level(0);

gnutls_init(&session, GNUTLS_SERVER);
gnutls_deinit(session);
gnutls_global_deinit();

return EXIT_SUCCESS;
}
Loading

0 comments on commit 4f71665

Please sign in to comment.