From db98e3a9c0b1bc12951e1613cf86d0b90093bbee Mon Sep 17 00:00:00 2001 From: Christoph Gerum Date: Mon, 16 May 2022 09:47:00 +0200 Subject: [PATCH 1/2] TCC: allow builds from git --- TCC/conanfile.py | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/TCC/conanfile.py b/TCC/conanfile.py index ade0615..f0c15eb 100644 --- a/TCC/conanfile.py +++ b/TCC/conanfile.py @@ -3,7 +3,8 @@ import os class TccConan(ConanFile): name = "tcc" - version = "0.9.27" + revision = "62c30a4a" + version = "0.9.27+%s" % revision if revision else "0.9.27" license = "GNU Lesser General Public License" author = "Eyck Jentzsch " url = "https://github.com/Minres/conan-recipes/tree/master/TCC" @@ -11,17 +12,24 @@ class TccConan(ConanFile): topics = ("compiler", "c") settings = "os", "compiler", "build_type", "arch" default_options = {} - source_tar = "http://download.savannah.gnu.org/releases/tinycc/tcc-%s.tar.bz2" % version + git_repo = "git://repo.or.cz/tinycc.git" #generators = "cmake" sub_folder = "tcc-%s" % version exports_sources = "tcc-%s/*" % version def source(self): - self.output.info("Downloading %s" %self.source_tar) - tools.download(self.source_tar, "tcc.tar.bz2") - tools.unzip("tcc.tar.bz2") - os.remove("tcc.tar.bz2") + if self.revsion: + git = tools.Git(folder=self.sub_folder) + if not os.path.exists(self.sub_folder): + git.clone(self.git_repo) + git.pull() + git.checkout(self.revision) + else: + self.output.info("Downloading %s" %self.source_tar) + tools.download(self.source_tar, "tcc.tar.bz2") + tools.unzip("tcc.tar.bz2") + os.remove("tcc.tar.bz2") def configure(self): del self.settings.compiler.libcxx From a00d71c69fe5a7fadf55f6a851ef933ca0d42e41 Mon Sep 17 00:00:00 2001 From: Christoph Gerum Date: Mon, 16 May 2022 10:15:24 +0200 Subject: [PATCH 2/2] Fix git checkout --- TCC/conanfile.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/TCC/conanfile.py b/TCC/conanfile.py index f0c15eb..1a8a3db 100644 --- a/TCC/conanfile.py +++ b/TCC/conanfile.py @@ -1,5 +1,6 @@ from conans import ConanFile, AutoToolsBuildEnvironment, tools import os +import shutil class TccConan(ConanFile): name = "tcc" @@ -19,14 +20,15 @@ class TccConan(ConanFile): exports_sources = "tcc-%s/*" % version def source(self): - if self.revsion: + if self.revision: + self.output.info("Cloning from %s" % self.git_repo) git = tools.Git(folder=self.sub_folder) - if not os.path.exists(self.sub_folder): - git.clone(self.git_repo) - git.pull() - git.checkout(self.revision) + if os.path.exists(self.sub_folder): + shutil.rmtree(self.sub_folder) + git.clone(self.git_repo) + git.checkout(self.revision) else: - self.output.info("Downloading %s" %self.source_tar) + self.output.info("Downloading %s" % self.source_tar) tools.download(self.source_tar, "tcc.tar.bz2") tools.unzip("tcc.tar.bz2") os.remove("tcc.tar.bz2")