Commit 6a3410b4 authored by Jaroslaw Kubik's avatar Jaroslaw Kubik
Browse files

WIP

parent c08330ae
import conans
import conan
import glob
import os
import shutil
class ZlibConan(conans.ConanFile):
class ZlibConan(conan.ConanFile):
name = 'zlib'
version = '1.2.11'
settings = 'os', 'compiler', 'arch', 'build_type'
python_requires = 'dockerRecipe/1.0.0@froglogic/util'
python_requires_extend = 'dockerRecipe.DockerRecipe'
revision_mode = 'scm'
settings = 'os', 'arch'
python_requires = 'docker-recipe/1.0.0@tqtc/util'
python_requires_extend = 'docker-recipe.DockerRecipe'
generators = 'CMakeToolchain'
options = {
'shared': [True, False],
'source': [True, False],
......@@ -20,36 +20,44 @@ class ZlibConan(conans.ConanFile):
'source': False,
'pic': True,
}
scm = {
'type': 'git',
'url': 'auto',
'revision': 'auto',
}
docker = {
'Linux': {
'Linuxu': {
'image': 'docker-registry.froglogic.com/squishbuild/centos6:6.8.0',
},
}
def export(self):
git = conan.tools.scm.Git(self, self.recipe_folder)
scm_url, scm_commit = git.get_url_and_commit()
conan.tools.files.update_conandata(self, {"sources": {"commit": scm_commit, "url": scm_url}})
def source(self):
git = conan.tools.scm.Git(self)
sources = self.conan_data["sources"]
git.clone(url=sources["url"], target=".")
git.checkout(commit=sources["commit"])
def configure(self):
if self.options.source:
del self.settings.os
del self.settings.compiler
del self.settings.arch
del self.options.pic
elif self.settings.os == 'Windows':
del self.options.pic
del self.settings.compiler.cppstd
else:
del self.settings.compiler.version
del self.settings.compiler
elif self.settings.os == 'Macos':
del self.settings.arch
def build_requirements(self):
self.build_requires('cmake/3.20.6@tqtc/util')
def build(self):
if self.options.source:
return
cmake = conans.CMake(self)
defs = {
self.run('env && sleep 5')
raise Exception("XXX")
cmake = conan.tools.cmake.CMake(self)
variables = {
'BUILD_SHARED_LIBS': 'ON' if self.options.shared else 'OFF',
'CMAKE_INSTALL_LIBDIR': 'lib',
'CMAKE_OSX_DEPLOYMENT_TARGET': '10.10',
......@@ -57,9 +65,9 @@ class ZlibConan(conans.ConanFile):
env = {}
if self.settings.os != 'Windows':
if self.options.pic:
defs['CMAKE_POSITION_INDEPENDENT_CODE'] = 'ON'
variables['CMAKE_POSITION_INDEPENDENT_CODE'] = 'ON'
else:
defs['CMAKE_POSITION_INDEPENDENT_CODE'] = 'OFF'
variables['CMAKE_POSITION_INDEPENDENT_CODE'] = 'OFF'
if self.settings.os == 'Linux':
if self.settings.arch == 'x86':
env['CC'] = 'gcc -m32'
......@@ -67,7 +75,7 @@ class ZlibConan(conans.ConanFile):
env['CC'] = 'gcc -m64'
with self.addedEnvironment(env):
cmake.configure(defs=defs)
cmake.configure(variables=variables)
cmake.build()
def package(self):
......@@ -78,5 +86,5 @@ class ZlibConan(conans.ConanFile):
else:
shutil.copy(entry.path, self.package_folder)
else:
cmake = conans.CMake(self)
cmake = conan.tools.cmake.CMake(self)
cmake.install()
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment