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

added libgpg-error/1.36 #6793

Merged
merged 11 commits into from
Aug 12, 2021
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"
85 changes: 85 additions & 0 deletions recipes/libgpg-error/all/conanfile.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
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 = ("conan", "gpg", "gnupg")
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/**"

@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):
build = None
host = None
args = ["--disable-dependency-tracking",
"--disable-nls",
"--disable-languages",
"--disable-doc",
"--disable-tests"]
if 'fPIC' in self.options and self.options.fPIC:
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"

env_build = AutoToolsBuildEnvironment(self)
env_build.configure(args=args, build=build, host=host)

return env_build

def build(self):
for patch in self.conan_data["patches"][self.version]:
tools.patch(**patch)
# the previous step might hang when converting from ISO-8859-2 to UTF-8 late in the build process
# os.unlink(os.path.join(self._source_subfolder, "po", "ro.po"))
with tools.chdir(self._source_subfolder):
env_build = self._configure()
env_build.make()

def package(self):
with tools.chdir(self._source_subfolder):
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"]
# FIXME: missing names for pkg_config generator
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
dpronin marked this conversation as resolved.
Show resolved Hide resolved

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):
dpronin marked this conversation as resolved.
Show resolved Hide resolved
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