Skip to content

Commit

Permalink
(#6793) added libgpg-error/1.36
Browse files Browse the repository at this point in the history
* added libgpg-error/1.36

Signed-off-by: Denis Pronin <dannftk@yandex.ru>

* libgpg-error: review

Signed-off-by: Denis Pronin <dannftk@yandex.ru>

* libgpg-error: installation is done in 'package' method

* Update recipes/libgpg-error/all/conanfile.py

Co-authored-by: Javier G. Sogo <jgsogo@gmail.com>

* libgpg-error: added fixme in conanfile.py

* libgpg-error: removed `test` method

* libgpg-error: COPYING pattern has been extended

* libgpg-error: refactoring of conanfile.py

* libgpg-error: removed shutil from usage

* Improve error gpg recipe

Signed-off-by: Uilian Ries <uilianries@gmail.com>

Co-authored-by: Javier G. Sogo <jgsogo@gmail.com>
Co-authored-by: Uilian Ries <uilianries@gmail.com>
  • Loading branch information
3 people committed Aug 12, 2021
1 parent f02ac47 commit b807cbc
Show file tree
Hide file tree
Showing 7 changed files with 178 additions and 0 deletions.
8 changes: 8 additions & 0 deletions recipes/libgpg-error/all/conandata.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
sources:
"1.36":
url: "https://www.gnupg.org/ftp/gcrypt/libgpg-error/libgpg-error-1.36.tar.gz"
sha256: "493a3a5e0ac0eb4df8501039f351459d8901d213a834d8c5a453a8ed94858ba5"
patches:
"1.36":
- patch_file: "patches/0001-gawk-namespace.patch"
base_path: "source_subfolder"
83 changes: 83 additions & 0 deletions recipes/libgpg-error/all/conanfile.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
import os
from conans import ConanFile, AutoToolsBuildEnvironment, tools
from conans.errors import ConanInvalidConfiguration

required_conan_version = ">=1.33.0"

class GPGErrorConan(ConanFile):
name = "libgpg-error"
url = "https://github.com/conan-io/conan-center-index"
homepage = "https://gnupg.org/software/libgpg-error/index.html"
topics = ("gpg", "gnupg", "encrypt", "pgp", "openpgp")
description = "Libgpg-error is a small library that originally defined common error values for all GnuPG " \
"components."
license = "GPL-2.0-or-later"
settings = "os", "arch", "compiler", "build_type"
options = {
"shared": [True, False],
"fPIC": [True, False],
}
default_options = {
"shared": False,
"fPIC": False,
}
exports_sources = "patches/**"
_autotools = None

@property
def _source_subfolder(self):
return "source_subfolder"

def configure(self):
if self.settings.os != "Linux":
raise ConanInvalidConfiguration("This recipe only support Linux. You can contribute Windows and/or Macos support.")
del self.settings.compiler.libcxx
del self.settings.compiler.cppstd
if self.options.shared:
del self.options.fPIC

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

def _configure(self):
if self._autotools:
return self._autotools
host = None
args = ["--disable-dependency-tracking",
"--disable-nls",
"--disable-languages",
"--disable-doc",
"--disable-tests"]
if self.options.get_safe("fPIC", True):
args.append("--with-pic")
if self.options.shared:
args.extend(["--disable-static", "--enable-shared"])
else:
args.extend(["--disable-shared", "--enable-static"])
if self.settings.os == "Linux" and self.settings.arch == "x86":
host = "i686-linux-gnu"

self._autotools = AutoToolsBuildEnvironment(self)
self._autotools.configure(args=args, host=host, configure_dir=self._source_subfolder)
return self._autotools

def build(self):
for patch in self.conan_data["patches"][self.version]:
tools.patch(**patch)
env_build = self._configure()
env_build.make()

def package(self):
env_build = self._configure()
env_build.install()
self.copy(pattern="COPYING*", dst="licenses", src=self._source_subfolder)
tools.remove_files_by_mask(os.path.join(self.package_folder, "lib"), "*la")
tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig"))
tools.rmdir(os.path.join(self.package_folder, "share"))

def package_info(self):
self.cpp_info.libs = ["gpg-error"]
self.cpp_info.names["pkg_config"] = "gpg-error"
if self.settings.os in ["Linux", "FreeBSD"]:
self.cpp_info.system_libs = ["pthread"]
53 changes: 53 additions & 0 deletions recipes/libgpg-error/all/patches/0001-gawk-namespace.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -293,7 +293,7 @@

errnos-sym.h: Makefile mkstrtable.awk errnos.in
$(AWK) -f $(srcdir)/mkstrtable.awk -v textidx=2 -v nogettext=1 \
- -v prefix=GPG_ERR_ -v namespace=errnos_ \
+ -v prefix=GPG_ERR_ -v pkg_namespace=errnos_ \
$(srcdir)/errnos.in >$@



--- a/src/Makefile.in
+++ b/src/Makefile.in
@@ -1615,7 +1615,7 @@

errnos-sym.h: Makefile mkstrtable.awk errnos.in
$(AWK) -f $(srcdir)/mkstrtable.awk -v textidx=2 -v nogettext=1 \
- -v prefix=GPG_ERR_ -v namespace=errnos_ \
+ -v prefix=GPG_ERR_ -v pkg_namespace=errnos_ \
$(srcdir)/errnos.in >$@

mkheader$(EXEEXT_FOR_BUILD): mkheader.c Makefile
diff --color -Naur libgpg-error-1.36/src/mkstrtable.awk libgpg-error-1.36.new/src/mkstrtable.awk
--- a/src/mkstrtable.awk
+++ b/src/mkstrtable.awk
@@ -102,7 +102,7 @@
print "/* The purpose of this complex string table is to produce";
print " optimal code with a minimum of relocations. */";
print "";
- print "static const char " namespace "msgstr[] = ";
+ print "static const char " pkg_namespace "msgstr[] = ";
header = 0;
}
else
@@ -150,7 +150,7 @@
else
print " gettext_noop (\"" last_msgstr "\");";
print "";
- print "static const int " namespace "msgidx[] =";
+ print "static const int " pkg_namespace "msgidx[] =";
print " {";
for (i = 0; i < coded_msgs; i++)
print " " pos[i] ",";
@@ -158,7 +158,7 @@
print " };";
print "";
print "static GPG_ERR_INLINE int";
- print namespace "msgidxof (int code)";
+ print pkg_namespace "msgidxof (int code)";
print "{";
print " return (0 ? 0";

8 changes: 8 additions & 0 deletions recipes/libgpg-error/all/test_package/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
cmake_minimum_required(VERSION 3.1)
project(test_package C)

include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)
conan_basic_setup()

add_executable(${PROJECT_NAME} test_package.c)
target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS})
17 changes: 17 additions & 0 deletions recipes/libgpg-error/all/test_package/conanfile.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import os

from conans import ConanFile, CMake, tools

class TestPackageConan(ConanFile):
settings = "os", "compiler", "build_type", "arch"
generators = "cmake"

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

def test(self):
if not tools.cross_building(self.settings):
bin_path = os.path.join("bin", "test_package")
self.run(bin_path, run_environment=True)
6 changes: 6 additions & 0 deletions recipes/libgpg-error/all/test_package/test_package.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#include "gpg-error.h"

int main() {
gpgrt_printf("");
return 0;
}
3 changes: 3 additions & 0 deletions recipes/libgpg-error/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
versions:
"1.36":
folder: all

0 comments on commit b807cbc

Please sign in to comment.