Skip to content
Snippets Groups Projects
Commit c1c8ebfb authored by MADELA Patrick's avatar MADELA Patrick
Browse files

Update for Conan 2.x

parent a804851b
No related branches found
No related tags found
No related merge requests found
Pipeline #2056 passed
......@@ -23,12 +23,13 @@ workflow:
- rm python.zip
- export PATH=$(readlink -e .)/python-${PYTHON_VERSION}-${PLATFORM}/bin:${PATH}
- python --version | grep ${PYTHON_VERSION}
- sudo python -m pip install --upgrade pip
- sudo python -m pip install --upgrade conan
- python -m pip install --upgrade pip
- python -m pip install --upgrade conan
# Build git with conan
- conan profile detect --force
- conan create . --name git --version ${GIT_VERSION} --user soleil --channel stable -s compiler.libcxx=libstdc++11 --build="*" -c tools.system.package_manager:mode=install -c tools.system.package_manager:tool=yum -c tools.system.package_manager:sudo=True
- conan install --name git --version ${GIT_VERSION} --user soleil --channel stable -s compiler.libcxx=libstdc++11 --install-folder ${CI_PROJECT_DIR}/${NAME}
- conan create . --version ${GIT_VERSION} -s compiler.libcxx=libstdc++11 --build="*"
- conan install --requires git/${GIT_VERSION} -s compiler.libcxx=libstdc++11 --deploy direct_deploy
- mv git ${CI_PROJECT_DIR}/${NAME}
artifacts:
name: ${NAME}
paths:
......
from conan import ConanFile
from conan.tools.system import package_manager
from conan.tools.gnu import AutotoolsDeps
from conan.tools.gnu import AutotoolsToolchain
from conan.tools.gnu import Autotools
from conan.tools.files import replace_in_file
from conan.errors import ConanInvalidConfiguration
from conans import AutoToolsBuildEnvironment, RunEnvironment, tools
import os
class GitConan(ConanFile):
class GitRecipe(ConanFile):
name = "git"
version = "2.40.0"
settings = "os", "compiler", "build_type", "arch"
requires = \
"libcurl/7.86.0", \
"zlib/1.2.13"
requires = "libcurl/7.86.0", "zlib/1.2.13"
_autotools = None
build_requires = "libcurl/7.86.0"
_autotools_args = [
"NO_TCLTK=YesPlease",
......@@ -32,43 +31,29 @@ class GitConan(ConanFile):
raise ConanInvalidConfiguration("This recipe supports only Linux")
def source(self):
self.run(
"curl -s -L -O https://github.com/git/git/archive/refs/tags/v%s.tar.gz" % self.version)
self.run("curl -s -L -O https://github.com/git/git/archive/refs/tags/v%s.tar.gz" % self.version)
self.run("tar -xzf v%s.tar.gz --strip 1" % self.version)
def _build_configure(self):
if self._autotools:
return self._autotools
self._autotools = AutoToolsBuildEnvironment(self)
args = [
"--enable-pthreads=-pthread",
"--with-tcltk=NO",
]
# Append run environment to autotools environment to have curl-config in path
env_build_vars = self._autotools.vars
run_environment = RunEnvironment(self)
env_build_vars = env_build_vars | run_environment.vars
def generate(self):
td = AutotoolsDeps(self)
td.generate()
tc = AutotoolsToolchain(self)
tc.configure_args.append("--enable-pthreads=-pthread")
tc.configure_args.append("--with-tcltk=NO")
tc.generate()
def build(self):
# Build configure
self.run("make configure")
self._autotools.configure(args=args, vars=env_build_vars)
return self._autotools
def build(self):
env_build = self._build_configure()
tools.replace_in_file("Makefile", "EXTLIBS += -lrt", "EXTLIBS += -lrt -ldl")
env_build.make(args=self._autotools_args)
autotools = Autotools(self)
autotools.configure()
replace_in_file(self, "Makefile", "EXTLIBS += -lrt", "EXTLIBS += -lrt -ldl")
autotools.make(args=self._autotools_args)
def package(self):
env_build = self._build_configure()
env_build.install(args=self._autotools_args)
autotools = Autotools(self)
autotools.install(args=self._autotools_args)
def package_info(self):
self.env_info.PATH.append(os.path.join(self.package_folder, "bin"))
def deploy(self):
self.copy("*", symlinks=True)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment