From e9c5da256a2c51be363ff860a135322593e99978 Mon Sep 17 00:00:00 2001 From: Martin Valgur Date: Wed, 19 Jul 2023 08:36:12 +0300 Subject: [PATCH 1/9] re2c: migrate to Conan v2 --- recipes/re2c/all/conandata.yml | 15 --- recipes/re2c/all/conanfile.py | 125 ++++++++++-------- recipes/re2c/all/msvc_cl.sh | 87 ++++++++++++ .../all/patches/0001-add-msvc_cl-sh.patch | 94 ------------- recipes/re2c/all/test_package/CMakeLists.txt | 7 +- recipes/re2c/all/test_package/conanfile.py | 23 +++- .../re2c/all/test_v1_package/CMakeLists.txt | 8 ++ recipes/re2c/all/test_v1_package/conanfile.py | 18 +++ 8 files changed, 198 insertions(+), 179 deletions(-) create mode 100755 recipes/re2c/all/msvc_cl.sh delete mode 100644 recipes/re2c/all/patches/0001-add-msvc_cl-sh.patch create mode 100644 recipes/re2c/all/test_v1_package/CMakeLists.txt create mode 100644 recipes/re2c/all/test_v1_package/conanfile.py diff --git a/recipes/re2c/all/conandata.yml b/recipes/re2c/all/conandata.yml index 6123ba01ce5a3..14c0924aadbf5 100644 --- a/recipes/re2c/all/conandata.yml +++ b/recipes/re2c/all/conandata.yml @@ -15,20 +15,5 @@ sources: url: "https://github.com/skvadrik/re2c/releases/download/1.3/re2c-1.3.tar.xz" sha256: "f37f25ff760e90088e7d03d1232002c2c2672646d5844fdf8e0d51a5cd75a503" patches: - "3.0": - - patch_file: "patches/0001-add-msvc_cl-sh.patch" - base_path: "" - "2.2": - - patch_file: "patches/0001-add-msvc_cl-sh.patch" - base_path: "" - "2.1.1": - - patch_file: "patches/0001-add-msvc_cl-sh.patch" - base_path: "" "2.0.3": - - patch_file: "patches/0001-add-msvc_cl-sh.patch" - base_path: "" - patch_file: "patches/2.0.3-0001-add-missing-include.patch" - base_path: "source_subfolder" - "1.3": - - patch_file: "patches/0001-add-msvc_cl-sh.patch" - base_path: "" diff --git a/recipes/re2c/all/conanfile.py b/recipes/re2c/all/conanfile.py index fd56a51318aa2..4517bbaa4ebee 100644 --- a/recipes/re2c/all/conanfile.py +++ b/recipes/re2c/all/conanfile.py @@ -1,95 +1,104 @@ -from conans import AutoToolsBuildEnvironment, ConanFile, tools -from contextlib import contextmanager import os -required_conan_version = ">=1.33.0" +from conan import ConanFile +from conan.tools.env import Environment +from conan.tools.files import apply_conandata_patches, chdir, copy, export_conandata_patches, get, rmdir +from conan.tools.gnu import Autotools, AutotoolsToolchain +from conan.tools.layout import basic_layout +from conan.tools.microsoft import is_msvc, unix_path + +required_conan_version = ">=1.53.0" class Re2CConan(ConanFile): name = "re2c" description = "re2c is a free and open-source lexer generator for C, C++ and Go." - topics = ("re2c", "lexer", "language", "tokenizer", "flex") + license = "Unlicense" url = "https://github.com/conan-io/conan-center-index" homepage = "http://re2c.org/" - license = "Unlicense" - settings = "os", "arch", "build_type", "compiler" + topics = ("lexer", "language", "tokenizer", "flex") - _autotools = None - - @property - def _source_subfolder(self): - return "source_subfolder" + package_type = "application" + settings = "os", "arch", "compiler", "build_type" @property def _settings_build(self): return getattr(self, "settings_build", self.settings) def export_sources(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - self.copy(patch["patch_file"]) + export_conandata_patches(self) + copy(self, "msvc_cl.sh", src=self.recipe_folder, dst=self.export_sources_folder) def config_options(self): if self.settings.os == "Windows": del self.options.fPIC def configure(self): - del self.settings.compiler.cppstd - del self.settings.compiler.libcxx + self.settings.rm_safe("compiler.cppstd") + self.settings.rm_safe("compiler.libcxx") + + def layout(self): + basic_layout(self, src_folder="src") def package_id(self): del self.info.settings.compiler - def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) - def build_requirements(self): - if self._settings_build.os == "Windows" and not tools.get_env("CONAN_BASH_PATH"): - self.build_requires("msys2/cci.latest") - - @contextmanager - def _build_context(self): - if self.settings.compiler == "Visual Studio": - with tools.vcvars(self): - env = { - "CC": "{} -nologo".format(tools.unix_path(os.path.join(self.build_folder, "msvc_cl.sh"))), - "CXX": "{} -nologo".format(tools.unix_path(os.path.join(self.build_folder, "msvc_cl.sh"))), - "LD": "{} -nologo".format(tools.unix_path(os.path.join(self.build_folder, "msvc_cl.sh"))), - "CXXLD": "{} -nologo".format(tools.unix_path(os.path.join(self.build_folder, "msvc_cl.sh"))), - "AR": "lib", - } - with tools.environment_append(env): - yield - else: - yield - - def _configure_autotools(self): - if self._autotools: - return self._autotools - self._autotools = AutoToolsBuildEnvironment(self, win_bash=tools.os_info.is_windows) - if self.settings.compiler == "Visual Studio": - self._autotools.flags.append("-FS") - self._autotools.cxx_flags.append("-EHsc") - self._autotools.configure(configure_dir=self._source_subfolder) - return self._autotools + if self._settings_build.os == "Windows": + self.win_bash = True + if not self.conf.get("tools.microsoft.bash:path", check_type=str): + self.tool_requires("msys2/cci.latest") + + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + tc = AutotoolsToolchain(self) + if is_msvc(self): + tc.cxxflags.append("-FS") + tc.cxxflags.append("-EHsc") + tc.generate() + + if is_msvc(self): + env = Environment() + automake_conf = self.dependencies.build["automake"].conf_info + ar_wrapper = unix_path(self, automake_conf.get("user.automake:lib-wrapper", check_type=str)) + msvc_cl_path = unix_path(self, os.path.join(self.source_folder, "msvc_cl.sh")) + env.define("CC", msvc_cl_path) + env.define("CXX", msvc_cl_path) + env.define("LD", msvc_cl_path) + env.define("CXXLD", msvc_cl_path) + env.define("AR", f'{ar_wrapper} "lib -nologo"') + env.vars(self).save_script("conanbuild_msvc") def build(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) - with self._build_context(): - autotools = self._configure_autotools() + apply_conandata_patches(self) + with chdir(self, self.source_folder): + autotools = Autotools(self) + autotools.configure() autotools.make(args=["V=1"]) def package(self): - self.copy("LICENSE", src=self._source_subfolder, dst="licenses", keep_path=False) - self.copy("NO_WARRANTY", src=self._source_subfolder, dst="licenses", keep_path=False) - with self._build_context(): - autotools = self._configure_autotools() + copy(self, "LICENSE", + src=self.source_folder, + dst=os.path.join(self.package_folder, "licenses"), + keep_path=False) + copy(self, "NO_WARRANTY", + src=self.source_folder, + dst=os.path.join(self.package_folder, "licenses"), + keep_path=False) + with chdir(self, self.source_folder): + autotools = Autotools(self) autotools.install() - - tools.rmdir(os.path.join(self.package_folder, "share")) + rmdir(self, os.path.join(self.package_folder, "share")) def package_info(self): + self.cpp_info.frameworkdirs = [] + self.cpp_info.libdirs = [] + self.cpp_info.resdirs = [] + self.cpp_info.includedirs = [] + + # TODO: to remove in conan v2 bin_path = os.path.join(self.package_folder, "bin") - self.output.info("Appending PATH environment variable: {}".format(bin_path)) + self.output.info(f"Appending PATH environment variable: {bin_path}") self.env_info.PATH.append(bin_path) diff --git a/recipes/re2c/all/msvc_cl.sh b/recipes/re2c/all/msvc_cl.sh new file mode 100755 index 0000000000000..db8c608238464 --- /dev/null +++ b/recipes/re2c/all/msvc_cl.sh @@ -0,0 +1,87 @@ +#!/bin/sh +clopts=() +ldopts=() +sources=0 +link=0 +while test $# -gt 0; do + case "$1" in + -lm | -pthread | -lpthread | -std=c++98) + # ignore + ;; + -Xlinker) + shift + ;; + -W* | -w* | -pedantic) + # ignore warnings + ;; + -D*) + clopts+=("$1") + ;; + -I*) + clopts+=("$1") + ;; + -l*) + ldopts+=("`echo "$1.lib" | sed "s/^-l//"`") + ;; + -LIBPATH*) + ldopts+=("$1") + ;; + -L*) + ldopts+=("`echo "$1" | sed "s/^-L/-LIBPATH:/"`") + ;; + *.obj | *.o) + link=1 + ldopts+=("$1") + ;; + -Wl,*) + for linkarg in `echo '$1' | sed -e 's/-Wl,//' -e 's/,/ /'`; do + ldopts+=("${linkarg}") + done + ;; + *.lib) + ldopts+=("$1") + ;; + -o) + shift + case "$1" in + *.dll | *.exe) + link=1 + ldopts+=("-out:$1") + ;; + *.o | *.obj) + link=0 + clopts+=("-Fo$1") + ;; + esac + ;; + -implib* | -IMPLIB*) + ldopts+=("$1") + ;; + -c | *.c | *.C | *.cxx | *.cpp | *.cc | *.CC) + sources=1 + clopts+=("$1") + ;; + *) + clopts+=("$1") + ;; + esac + shift +done +args="${clopts[@]}" +if test $link = 1; then + if test $sources = 0; then + args="${ldopts[@]}" +cat <<-EOF + Creating program/library + ** ld options: "$args" +EOF + LINK= exec link -nologo $args + else + args="$args -link ${ldopts[@]}" + fi +fi +cat <<-EOF + Compiling source + ** cl options: "$args" +EOF +LINK= exec cl -nologo $args diff --git a/recipes/re2c/all/patches/0001-add-msvc_cl-sh.patch b/recipes/re2c/all/patches/0001-add-msvc_cl-sh.patch deleted file mode 100644 index c9bc0abc63639..0000000000000 --- a/recipes/re2c/all/patches/0001-add-msvc_cl-sh.patch +++ /dev/null @@ -1,94 +0,0 @@ -new file mode 100755 ---- /dev/null -+++ msvc_cl.sh -@@ -0,0 +1,90 @@ -+#!/bin/sh -+clopts=() -+ldopts=() -+sources=0 -+link=0 -+while test $# -gt 0; do -+ case "$1" in -+ -lm | -pthread | -lpthread | -std=c++98) -+ # ignore -+ ;; -+ -Xlinker) -+ shift -+ ;; -+ -W* | -w* | -pedantic) -+ # ignore warnings -+ ;; -+ -D*) -+ clopts+=("$1") -+ ;; -+ -I*) -+ clopts+=("$1") -+ ;; -+ -l*) -+ ldopts+=("`echo "$1.lib" | sed "s/^-l//"`") -+ ;; -+ -LIBPATH*) -+ ldopts+=("$1") -+ ;; -+ -L*) -+ ldopts+=("`echo "$1" | sed "s/^-L/-LIBPATH:/"`") -+ ;; -+ *.obj | *.o) -+ link=1 -+ ldopts+=("$1") -+ ;; -+ -Wl,*) -+ for linkarg in `echo '$1' | sed -e 's/-Wl,//' -e 's/,/ /'`; do -+ ldopts+=("${linkarg}") -+ done -+ ;; -+ *.lib) -+ ldopts+=("$1") -+ ;; -+ -o) -+ shift -+ case "$1" in -+ *.dll | *.exe) -+ link=1 -+ ldopts+=("-out:$1") -+ ;; -+ *.o | *.obj) -+ link=0 -+ clopts+=("-Fo$1") -+ ;; -+ esac -+ ;; -+ -implib* | -IMPLIB*) -+ ldopts+=("$1") -+ ;; -+ -c | *.c | *.C | *.cxx | *.cpp | *.cc | *.CC) -+ sources=1 -+ clopts+=("$1") -+ ;; -+ *) -+ clopts+=("$1") -+ ;; -+ esac -+ shift -+done -+ -+args="${clopts[@]}" -+if test $link = 1; then -+ if test $sources = 0; then -+ args="${ldopts[@]}" -+cat <<-EOF -+ Creating program/library -+ ** ld options: "$args" -+EOF -+ LINK= exec link -nologo $args -+ else -+ args="$args -link ${ldopts[@]}" -+ fi -+fi -+ -+cat <<-EOF -+ Compiling source -+ ** cl options: "$args" -+EOF -+ -+LINK= exec cl -nologo $args diff --git a/recipes/re2c/all/test_package/CMakeLists.txt b/recipes/re2c/all/test_package/CMakeLists.txt index 9f0917e64ea34..db2c3e52befc0 100644 --- a/recipes/re2c/all/test_package/CMakeLists.txt +++ b/recipes/re2c/all/test_package/CMakeLists.txt @@ -1,11 +1,8 @@ -cmake_minimum_required(VERSION 3.1) +cmake_minimum_required(VERSION 3.15) project(test_package C) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) - add_custom_command(OUTPUT test_package.c - COMMAND re2c -W "${PROJECT_SOURCE_DIR}/syntax.re" -o test_package.c + COMMAND re2c -W "${CMAKE_CURRENT_LIST_DIR}/syntax.re" -o test_package.c ) add_executable(${PROJECT_NAME} test_package.c) diff --git a/recipes/re2c/all/test_package/conanfile.py b/recipes/re2c/all/test_package/conanfile.py index a886f5f0a7632..91315a6314ef7 100644 --- a/recipes/re2c/all/test_package/conanfile.py +++ b/recipes/re2c/all/test_package/conanfile.py @@ -1,18 +1,27 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake import os class TestPackageConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake" + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def build_requirements(self): + self.tool_requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) def build(self): - if not tools.cross_building(self, skip_x64_x86=True): + if can_run(self): cmake = CMake(self) cmake.configure() cmake.build() def test(self): - if not tools.cross_building(self, skip_x64_x86=True): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/re2c/all/test_v1_package/CMakeLists.txt b/recipes/re2c/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..91630d79f4abb --- /dev/null +++ b/recipes/re2c/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.15) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/re2c/all/test_v1_package/conanfile.py b/recipes/re2c/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..9da2483eb011b --- /dev/null +++ b/recipes/re2c/all/test_v1_package/conanfile.py @@ -0,0 +1,18 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "compiler", "build_type", "arch" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + if not tools.cross_building(self, skip_x64_x86=True): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self, skip_x64_x86=True): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) From 90139a689b6005453119556b96ee0288005f4c74 Mon Sep 17 00:00:00 2001 From: Martin Valgur Date: Mon, 7 Aug 2023 00:21:29 +0300 Subject: [PATCH 2/9] re2c: fix Windows build --- recipes/re2c/all/conanfile.py | 61 +++++++++++++----------- recipes/re2c/all/msvc_cl.sh | 87 ----------------------------------- 2 files changed, 35 insertions(+), 113 deletions(-) delete mode 100755 recipes/re2c/all/msvc_cl.sh diff --git a/recipes/re2c/all/conanfile.py b/recipes/re2c/all/conanfile.py index 4517bbaa4ebee..24e4dec20c218 100644 --- a/recipes/re2c/all/conanfile.py +++ b/recipes/re2c/all/conanfile.py @@ -1,11 +1,11 @@ import os from conan import ConanFile -from conan.tools.env import Environment -from conan.tools.files import apply_conandata_patches, chdir, copy, export_conandata_patches, get, rmdir +from conan.tools.env import VirtualBuildEnv +from conan.tools.files import apply_conandata_patches, chdir, copy, export_conandata_patches, get, rmdir, replace_in_file from conan.tools.gnu import Autotools, AutotoolsToolchain from conan.tools.layout import basic_layout -from conan.tools.microsoft import is_msvc, unix_path +from conan.tools.microsoft import is_msvc required_conan_version = ">=1.53.0" @@ -27,13 +27,14 @@ def _settings_build(self): def export_sources(self): export_conandata_patches(self) - copy(self, "msvc_cl.sh", src=self.recipe_folder, dst=self.export_sources_folder) def config_options(self): if self.settings.os == "Windows": del self.options.fPIC def configure(self): + if self.options.shared: + self.options.rm_safe("fPIC") self.settings.rm_safe("compiler.cppstd") self.settings.rm_safe("compiler.libcxx") @@ -48,31 +49,39 @@ def build_requirements(self): self.win_bash = True if not self.conf.get("tools.microsoft.bash:path", check_type=str): self.tool_requires("msys2/cci.latest") + self.tool_requires("winflexbison/2.5.24") + if is_msvc(self): + self.tool_requires("cccl/1.3") def source(self): get(self, **self.conan_data["sources"][self.version], strip_root=True) def generate(self): + VirtualBuildEnv(self).generate() tc = AutotoolsToolchain(self) + tc.configure_args.append("--disable-benchmarks") + env = tc.environment() if is_msvc(self): - tc.cxxflags.append("-FS") - tc.cxxflags.append("-EHsc") - tc.generate() - - if is_msvc(self): - env = Environment() - automake_conf = self.dependencies.build["automake"].conf_info - ar_wrapper = unix_path(self, automake_conf.get("user.automake:lib-wrapper", check_type=str)) - msvc_cl_path = unix_path(self, os.path.join(self.source_folder, "msvc_cl.sh")) - env.define("CC", msvc_cl_path) - env.define("CXX", msvc_cl_path) - env.define("LD", msvc_cl_path) - env.define("CXXLD", msvc_cl_path) - env.define("AR", f'{ar_wrapper} "lib -nologo"') - env.vars(self).save_script("conanbuild_msvc") + tc.extra_cxxflags.append("-FS") + tc.extra_cxxflags.append("-EHsc") + env.define("CC", "cccl") + env.define("CXX", "cccl") + env.define("LD", "cccl") + env.define("CXXLD", "cccl") + tc.generate(env) + + def _patch_sources(self): + apply_conandata_patches(self) + # Don't copy benchmark files, which also cause the build to fail on Windows + replace_in_file(self, os.path.join(self.source_folder, "configure"), + '"$ac_config_files Makefile ', + '"$ac_config_files Makefile" #') + replace_in_file(self, os.path.join(self.source_folder, "configure"), + '"$ac_config_links ', + '"$ac_config_links" #') def build(self): - apply_conandata_patches(self) + self._patch_sources() with chdir(self, self.source_folder): autotools = Autotools(self) autotools.configure() @@ -80,13 +89,13 @@ def build(self): def package(self): copy(self, "LICENSE", - src=self.source_folder, - dst=os.path.join(self.package_folder, "licenses"), - keep_path=False) + src=self.source_folder, + dst=os.path.join(self.package_folder, "licenses"), + keep_path=False) copy(self, "NO_WARRANTY", - src=self.source_folder, - dst=os.path.join(self.package_folder, "licenses"), - keep_path=False) + src=self.source_folder, + dst=os.path.join(self.package_folder, "licenses"), + keep_path=False) with chdir(self, self.source_folder): autotools = Autotools(self) autotools.install() diff --git a/recipes/re2c/all/msvc_cl.sh b/recipes/re2c/all/msvc_cl.sh deleted file mode 100755 index db8c608238464..0000000000000 --- a/recipes/re2c/all/msvc_cl.sh +++ /dev/null @@ -1,87 +0,0 @@ -#!/bin/sh -clopts=() -ldopts=() -sources=0 -link=0 -while test $# -gt 0; do - case "$1" in - -lm | -pthread | -lpthread | -std=c++98) - # ignore - ;; - -Xlinker) - shift - ;; - -W* | -w* | -pedantic) - # ignore warnings - ;; - -D*) - clopts+=("$1") - ;; - -I*) - clopts+=("$1") - ;; - -l*) - ldopts+=("`echo "$1.lib" | sed "s/^-l//"`") - ;; - -LIBPATH*) - ldopts+=("$1") - ;; - -L*) - ldopts+=("`echo "$1" | sed "s/^-L/-LIBPATH:/"`") - ;; - *.obj | *.o) - link=1 - ldopts+=("$1") - ;; - -Wl,*) - for linkarg in `echo '$1' | sed -e 's/-Wl,//' -e 's/,/ /'`; do - ldopts+=("${linkarg}") - done - ;; - *.lib) - ldopts+=("$1") - ;; - -o) - shift - case "$1" in - *.dll | *.exe) - link=1 - ldopts+=("-out:$1") - ;; - *.o | *.obj) - link=0 - clopts+=("-Fo$1") - ;; - esac - ;; - -implib* | -IMPLIB*) - ldopts+=("$1") - ;; - -c | *.c | *.C | *.cxx | *.cpp | *.cc | *.CC) - sources=1 - clopts+=("$1") - ;; - *) - clopts+=("$1") - ;; - esac - shift -done -args="${clopts[@]}" -if test $link = 1; then - if test $sources = 0; then - args="${ldopts[@]}" -cat <<-EOF - Creating program/library - ** ld options: "$args" -EOF - LINK= exec link -nologo $args - else - args="$args -link ${ldopts[@]}" - fi -fi -cat <<-EOF - Compiling source - ** cl options: "$args" -EOF -LINK= exec cl -nologo $args From 7e4246ad8a48d2ebe14afe2a8120f2df26e44e84 Mon Sep 17 00:00:00 2001 From: Martin Valgur Date: Thu, 10 Aug 2023 09:44:05 +0300 Subject: [PATCH 3/9] re2c: fix removed options --- recipes/re2c/all/conanfile.py | 6 ------ 1 file changed, 6 deletions(-) diff --git a/recipes/re2c/all/conanfile.py b/recipes/re2c/all/conanfile.py index 24e4dec20c218..31d2bc77d4755 100644 --- a/recipes/re2c/all/conanfile.py +++ b/recipes/re2c/all/conanfile.py @@ -28,13 +28,7 @@ def _settings_build(self): def export_sources(self): export_conandata_patches(self) - def config_options(self): - if self.settings.os == "Windows": - del self.options.fPIC - def configure(self): - if self.options.shared: - self.options.rm_safe("fPIC") self.settings.rm_safe("compiler.cppstd") self.settings.rm_safe("compiler.libcxx") From 28520cd5590dbe523b689e14ec478426617d40c6 Mon Sep 17 00:00:00 2001 From: Martin Valgur Date: Thu, 21 Sep 2023 00:26:45 +0300 Subject: [PATCH 4/9] re2c: add v3.1 --- recipes/re2c/all/conandata.yml | 3 +++ recipes/re2c/all/conanfile.py | 2 +- recipes/re2c/config.yml | 2 ++ 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/recipes/re2c/all/conandata.yml b/recipes/re2c/all/conandata.yml index 14c0924aadbf5..e8f43a925d5ec 100644 --- a/recipes/re2c/all/conandata.yml +++ b/recipes/re2c/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "3.1": + url: "https://github.com/skvadrik/re2c/releases/download/3.1/re2c-3.1.tar.xz" + sha256: "0ac299ad359e3f512b06a99397d025cfff81d3be34464ded0656f8a96676c029" "3.0": url: "https://github.com/skvadrik/re2c/releases/download/3.0/re2c-3.0.tar.xz" sha256: "b3babbbb1461e13fe22c630a40c43885efcfbbbb585830c6f4c0d791cf82ba0b" diff --git a/recipes/re2c/all/conanfile.py b/recipes/re2c/all/conanfile.py index 31d2bc77d4755..8567edd449f1e 100644 --- a/recipes/re2c/all/conanfile.py +++ b/recipes/re2c/all/conanfile.py @@ -12,7 +12,7 @@ class Re2CConan(ConanFile): name = "re2c" - description = "re2c is a free and open-source lexer generator for C, C++ and Go." + description = "re2c is a free and open-source lexer generator for C/C++, Go and Rust." license = "Unlicense" url = "https://github.com/conan-io/conan-center-index" homepage = "http://re2c.org/" diff --git a/recipes/re2c/config.yml b/recipes/re2c/config.yml index ca4059985b6a4..fd91d5170215c 100644 --- a/recipes/re2c/config.yml +++ b/recipes/re2c/config.yml @@ -1,4 +1,6 @@ versions: + "3.1": + folder: "all" "3.0": folder: "all" "2.2": From 8d72da88906f86f76eadbb721eae14c286919ee3 Mon Sep 17 00:00:00 2001 From: Martin Valgur Date: Thu, 21 Sep 2023 00:35:46 +0300 Subject: [PATCH 5/9] re2c: drop test_v1_package --- .../re2c/all/test_v1_package/CMakeLists.txt | 8 -------- recipes/re2c/all/test_v1_package/conanfile.py | 18 ------------------ 2 files changed, 26 deletions(-) delete mode 100644 recipes/re2c/all/test_v1_package/CMakeLists.txt delete mode 100644 recipes/re2c/all/test_v1_package/conanfile.py diff --git a/recipes/re2c/all/test_v1_package/CMakeLists.txt b/recipes/re2c/all/test_v1_package/CMakeLists.txt deleted file mode 100644 index 91630d79f4abb..0000000000000 --- a/recipes/re2c/all/test_v1_package/CMakeLists.txt +++ /dev/null @@ -1,8 +0,0 @@ -cmake_minimum_required(VERSION 3.15) -project(test_package) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) - -add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ - ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/re2c/all/test_v1_package/conanfile.py b/recipes/re2c/all/test_v1_package/conanfile.py deleted file mode 100644 index 9da2483eb011b..0000000000000 --- a/recipes/re2c/all/test_v1_package/conanfile.py +++ /dev/null @@ -1,18 +0,0 @@ -from conans import ConanFile, CMake, tools -import os - - -class TestPackageConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake", "cmake_find_package_multi" - - def build(self): - if not tools.cross_building(self, skip_x64_x86=True): - cmake = CMake(self) - cmake.configure() - cmake.build() - - def test(self): - if not tools.cross_building(self, skip_x64_x86=True): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) From ecc3b1c706ebcf9849842c580f7fa310434a97c0 Mon Sep 17 00:00:00 2001 From: Martin Valgur Date: Mon, 23 Oct 2023 17:27:29 +0300 Subject: [PATCH 6/9] re2c: replace_in_file(strict=False) --- recipes/re2c/all/conanfile.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/recipes/re2c/all/conanfile.py b/recipes/re2c/all/conanfile.py index 8567edd449f1e..08fd09228b0ae 100644 --- a/recipes/re2c/all/conanfile.py +++ b/recipes/re2c/all/conanfile.py @@ -66,13 +66,15 @@ def generate(self): def _patch_sources(self): apply_conandata_patches(self) - # Don't copy benchmark files, which also cause the build to fail on Windows + # Don't copy benchmark files, which cause the build to fail on Windows replace_in_file(self, os.path.join(self.source_folder, "configure"), '"$ac_config_files Makefile ', - '"$ac_config_files Makefile" #') + '"$ac_config_files Makefile" #', + strict=False) replace_in_file(self, os.path.join(self.source_folder, "configure"), '"$ac_config_links ', - '"$ac_config_links" #') + '"$ac_config_links" #', + strict=False) def build(self): self._patch_sources() From 677706b2235183f3215fac999d619d99a7db8959 Mon Sep 17 00:00:00 2001 From: Martin Valgur Date: Mon, 23 Oct 2023 17:28:08 +0300 Subject: [PATCH 7/9] re2c: drop message for PATH --- recipes/re2c/all/conanfile.py | 1 - 1 file changed, 1 deletion(-) diff --git a/recipes/re2c/all/conanfile.py b/recipes/re2c/all/conanfile.py index 08fd09228b0ae..9f682f1f1d7e3 100644 --- a/recipes/re2c/all/conanfile.py +++ b/recipes/re2c/all/conanfile.py @@ -105,5 +105,4 @@ def package_info(self): # TODO: to remove in conan v2 bin_path = os.path.join(self.package_folder, "bin") - self.output.info(f"Appending PATH environment variable: {bin_path}") self.env_info.PATH.append(bin_path) From 9cefe68ce1ebb9096e24196e9e0434ec53f8de73 Mon Sep 17 00:00:00 2001 From: Martin Valgur Date: Wed, 1 Nov 2023 23:19:13 +0200 Subject: [PATCH 8/9] re2c: add -FS --- recipes/re2c/all/conanfile.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/recipes/re2c/all/conanfile.py b/recipes/re2c/all/conanfile.py index 9f682f1f1d7e3..8a9ffaf67f661 100644 --- a/recipes/re2c/all/conanfile.py +++ b/recipes/re2c/all/conanfile.py @@ -56,10 +56,9 @@ def generate(self): tc.configure_args.append("--disable-benchmarks") env = tc.environment() if is_msvc(self): - tc.extra_cxxflags.append("-FS") tc.extra_cxxflags.append("-EHsc") - env.define("CC", "cccl") - env.define("CXX", "cccl") + env.define("CC", "cccl -FS") + env.define("CXX", "cccl -FS") env.define("LD", "cccl") env.define("CXXLD", "cccl") tc.generate(env) From 3f824427d3792196b6b5a39f9e3624b06b1af3c8 Mon Sep 17 00:00:00 2001 From: Martin Valgur Date: Mon, 6 Nov 2023 17:30:40 +0200 Subject: [PATCH 9/9] re2c: correct license Co-authored-by: Uilian Ries --- recipes/re2c/all/conanfile.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recipes/re2c/all/conanfile.py b/recipes/re2c/all/conanfile.py index 8a9ffaf67f661..dcc666816d3e4 100644 --- a/recipes/re2c/all/conanfile.py +++ b/recipes/re2c/all/conanfile.py @@ -13,7 +13,7 @@ class Re2CConan(ConanFile): name = "re2c" description = "re2c is a free and open-source lexer generator for C/C++, Go and Rust." - license = "Unlicense" + license = "LicenseRef-re2c" url = "https://github.com/conan-io/conan-center-index" homepage = "http://re2c.org/" topics = ("lexer", "language", "tokenizer", "flex")