conan-recipes/recipes/breakpad/all/conanfile.py
2020-10-19 07:52:36 +10:00

88 lines
3.1 KiB
Python

from conans import ConanFile, AutoToolsBuildEnvironment, tools
from conans.errors import ConanInvalidConfiguration
import os
import sys
class BreakpadConan(ConanFile):
name = "breakpad"
version = "64"
#license = "<Put the package license here>"
author = "Danny Robson danny@nerdcruft.net"
#url = "<Package recipe repository url here, for issues about the package>"
#description = "<Description of Breakpad here>"
#topics = ("<Put some tag here>", "<here>", "<and here>")
settings = "os", "compiler", "build_type", "arch"
#options = {"shared": [True, False]}
#default_options = {"shared": False}
requires = 'libcurl/7.71.0'
exports_sources = ["patches/*"]
build_requires = "autoconf/2.69"
def source(self):
tools.unzip("/home/danny/src/conan/dist/breakpad.tar.xz")
#self.run("git clone https://chromium.googlesource.com/breakpad/breakpad")
#with tools.chdir("breakpad"):
# self.run(f"git checkout db1cda26539c711c3da7ed4d410dfe8190e89b8f")
# self.run("mkdir src/third_party/ -p")
# with tools.chdir("src/third_party/"):
# self.run("git clone https://chromium.googlesource.com/linux-syscall-support/ lss")
def _stdlib_args(self):
lookup = {
'gcc': {
'libstdc++': '',
'libstdc++11': '',
},
'clang': {
'libstdc++': '-stdlib=libstdc++',
'libstdc++11': '-stdlib=libstdc++',
'libc++': '-stdlib=libc++',
},
}
compiler = lookup.get(self.settings.compiler.value, None)
if compiler is None:
raise ConanInvalidConfiguration(f"Unhandled compiler: {compiler}")
arg = compiler.get(self.settings.compiler.libcxx.value, None)
if arg is None:
raise ConanInvalidConfiguration(f"Unhandled stdlib: {self.settings.compiler.libcxx.value}")
return arg
def build(self):
for patch in self.conan_data["patches"]:
print(f"Patching: {patch}")
tools.patch(
base_path="breakpad",
patch_file=patch,
strip=0,
fuzz=False
)
with tools.chdir('./breakpad'):
self.run("autoreconf -fiv", run_environment=True)
stdlib = self._stdlib_args()
if stdlib is None:
raise ConanInvalidConfiguration ("Unable to determine stdlib flags for compiler")
autotools = AutoToolsBuildEnvironment(self)
env_build_vars = autotools.vars
env_build_vars['CFLAGS'] = f'-Wno-error {stdlib}'
env_build_vars['CXXFLAGS'] = f'-Wno-error {stdlib}'
autotools.configure(vars=env_build_vars)
autotools.make(vars=env_build_vars)
def package(self):
with tools.chdir('./breakpad'):
autotools = AutoToolsBuildEnvironment(self)
autotools.install()
def package_info(self):
self.cpp_info.libs = ["breakpad_client"]
self.cpp_info.includedirs.append(os.path.join("include", "breakpad"))