[DO-981] qt package (!15)

Co-authored-by: aleksandr.vodyanov <aleksandr.vodyanov@avroid.tech>
Reviewed-on: https://git.avroid.tech/Conan/conan_build/pulls/15
This commit is contained in:
Aleksandr Vodyanov
2025-02-13 12:25:48 +03:00
parent 60445ac09e
commit 3759e1163f
228 changed files with 16106 additions and 12 deletions

View File

@@ -0,0 +1,7 @@
sources:
"3.1":
url: "https://nexus.avroid.tech/repository/all-raw-proxy-ftp_gnu_org/pub/gnu/gperf/gperf-3.1.tar.gz"
sha256: "588546b945bba4b70b6a3a616e80b4ab466e3f33024a352fc2198112cdbb3ae2"
patches:
"3.1":
- patch_file: "patches/0001-remove-register-keyword.patch"

View File

@@ -0,0 +1,99 @@
from conan import ConanFile
from conan.tools.env import Environment, VirtualBuildEnv
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, check_min_vs, unix_path
import os
required_conan_version = ">=1.57.0"
class GperfConan(ConanFile):
name = "gperf"
license = "GPL-3.0-or-later"
url = "https://github.com/conan-io/conan-center-index"
homepage = "https://www.gnu.org/software/gperf"
description = "GNU gperf is a perfect hash function generator"
topics = ("hash-generator", "hash")
settings = "os", "arch", "compiler", "build_type"
@property
def _settings_build(self):
return getattr(self, "settings_build", self.settings)
def export_sources(self):
export_conandata_patches(self)
def layout(self):
basic_layout(self, src_folder="src")
self.folders.build = self.folders.source
def package_id(self):
del self.info.settings.compiler
def build_requirements(self):
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")
# gperf makefile relies on GNU Make behaviour
if self._settings_build.os == "FreeBSD":
self.tool_requires("make/4.4.1")
def source(self):
get(self, **self.conan_data["sources"][self.version],
destination=self.source_folder, strip_root=True)
def generate(self):
env = VirtualBuildEnv(self)
env.generate()
tc = AutotoolsToolchain(self)
if is_msvc(self) and check_min_vs(self, "180", raise_invalid=False):
tc.extra_cflags.append("-FS")
tc.extra_cxxflags.append("-FS")
tc.generate()
if is_msvc(self):
env = Environment()
compile_wrapper = unix_path(self, os.path.join(self.source_folder, "build-aux", "compile"))
ar_wrapper = unix_path(self, os.path.join(self.source_folder, "build-aux", "ar-lib"))
env.define("CC", f"{compile_wrapper} cl -nologo")
env.define("CXX", f"{compile_wrapper} cl -nologo")
env.append("CPPFLAGS", "-D_WIN32_WINNT=_WIN32_WINNT_WIN8")
env.define("LD", "link -nologo")
env.define("AR", f"{ar_wrapper} \"lib -nologo\"")
env.define("NM", "dumpbin -symbols")
env.define("OBJDUMP", ":")
env.define("RANLIB", ":")
env.define("STRIP", ":")
#Prevent msys2 from performing erroneous path conversions for C++ files
# when invoking cl.exe as this is already handled by the compile wrapper.
env.define("MSYS2_ARG_CONV_EXCL", "-Tp")
env.vars(self).save_script("conanbuild_gperf_msvc")
def build(self):
apply_conandata_patches(self)
autotools = Autotools(self)
with chdir(self, self.source_folder):
autotools.configure()
autotools.make()
def package(self):
copy(self, "COPYING", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses"))
autotools = Autotools(self)
with chdir(self, self.source_folder):
# TODO: replace by autotools.install() once https://github.com/conan-io/conan/issues/12153 fixed
autotools.install(args=[f"DESTDIR={unix_path(self, self.package_folder)}"])
rmdir(self, os.path.join(self.package_folder, "share"))
def package_info(self):
self.cpp_info.includedirs = []
self.cpp_info.libdirs = []
# TODO: to remove in conan v2
self.env_info.PATH.append(os.path.join(self.package_folder, "bin"))

View File

@@ -0,0 +1,13 @@
diff --git a/lib/getline.cc b/lib/getline.cc
index ecc3e85..2d97644 100644 (file)
--- a/lib/getline.cc
+++ b/lib/getline.cc
@@ -55,7 +55,7 @@ getstr (char **lineptr, size_t *n, FILE *stream, char terminator, size_t offset)
for (;;)
{
- register int c = getc (stream);
+ int c = getc (stream);
/* We always want at least one char left in the buffer, since we
always (unless we get an error while reading the first char)

View File

@@ -0,0 +1 @@
. "/home/aleksandr.vodyanov/Documents/Avroid/Conan/conan_recipes.git/recipes/gperf/all/test_package/conanbuildenv-release-x86_64.sh"

View File

@@ -0,0 +1,19 @@
script_folder="/home/aleksandr.vodyanov/Documents/Avroid/Conan/conan_recipes.git/recipes/gperf/all/test_package"
echo "echo Restoring environment" > "$script_folder/deactivate_conanbuildenv-release-x86_64.sh"
for v in CXX CC CONAN_V2_MODE PATH
do
is_defined="true"
value=$(printenv $v) || is_defined="" || true
if [ -n "$value" ] || [ -n "$is_defined" ]
then
echo export "$v='$value'" >> "$script_folder/deactivate_conanbuildenv-release-x86_64.sh"
else
echo unset $v >> "$script_folder/deactivate_conanbuildenv-release-x86_64.sh"
fi
done
export CXX="x86_64-linux-gnu-g++-12"
export CC="x86_64-linux-gnu-gcc-12"
export CONAN_V2_MODE="true"
export PATH="/home/aleksandr.vodyanov/.conan2/p/b/gperfac47c59da1cc9/p/bin:$PATH"

View File

@@ -0,0 +1,13 @@
from conan import ConanFile
class TestPackageConan(ConanFile):
settings = "os", "arch", "compiler", "build_type"
generators = "VirtualBuildEnv"
test_type = "explicit"
def build_requirements(self):
self.tool_requires(self.tested_reference_str)
def test(self):
self.run("gperf --version")

View File

@@ -0,0 +1 @@
. "/home/aleksandr.vodyanov/Documents/Avroid/Conan/conan_recipes.git/recipes/gperf/all/test_package/conanrunenv-release-x86_64.sh"

View File

@@ -0,0 +1,14 @@
script_folder="/home/aleksandr.vodyanov/Documents/Avroid/Conan/conan_recipes.git/recipes/gperf/all/test_package"
echo "echo Restoring environment" > "$script_folder/deactivate_conanrunenv-release-x86_64.sh"
for v in
do
is_defined="true"
value=$(printenv $v) || is_defined="" || true
if [ -n "$value" ] || [ -n "$is_defined" ]
then
echo export "$v='$value'" >> "$script_folder/deactivate_conanrunenv-release-x86_64.sh"
else
echo unset $v >> "$script_folder/deactivate_conanrunenv-release-x86_64.sh"
fi
done

View File

@@ -0,0 +1 @@
. "/home/aleksandr.vodyanov/Documents/Avroid/Conan/conan_recipes.git/recipes/gperf/all/test_package/deactivate_conanbuildenv-release-x86_64.sh"

View File

@@ -0,0 +1,5 @@
echo Restoring environment
unset CXX
unset CC
unset CONAN_V2_MODE
export PATH='/home/aleksandr.vodyanov/Documents/Avroid/Conan/venv/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/snap/bin:/home/aleksandr.vodyanov/.fzf/bin'

View File

@@ -0,0 +1 @@
. "/home/aleksandr.vodyanov/Documents/Avroid/Conan/conan_recipes.git/recipes/gperf/all/test_package/deactivate_conanrunenv-release-x86_64.sh"

3
recipes/gperf/config.yml Normal file
View File

@@ -0,0 +1,3 @@
versions:
"3.1":
folder: "all"