Skip to content

Commit

Permalink
Merge branch 'master' into lcc/maintenance/sdl-v2-fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
jcar87 authored Feb 28, 2023
2 parents 1e50328 + 7075441 commit 6fd30be
Show file tree
Hide file tree
Showing 18 changed files with 132 additions and 72 deletions.
1 change: 1 addition & 0 deletions .c3i/authorized_users.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1048,3 +1048,4 @@ authorized_users:
- ahmed192a
- maxpagani
- tim-goto
- tannerbitz
8 changes: 4 additions & 4 deletions .c3i/config_v2.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ tasks:

configurations:
- id: linux-gcc
epochs: [0, 20220628]
epochs: [0, 20211221, 20220120, 20220628]
hrname: "Linux, GCC"
build_profile:
os: "Linux"
Expand All @@ -59,7 +59,7 @@ configurations:
compiler.version: ["11"]
build_type: ["Release"]
- id: configs/macos-clang
epochs: [0, 20220628]
epochs: [0, 20211221, 20220120, 20220628]
hrname: "macOS, Clang"
build_profile:
os: "Macos"
Expand All @@ -72,7 +72,7 @@ configurations:
compiler.libcxx: [ "libc++" ]
build_type: [ "Release"]
- id: configs/macos-m1-clang
epochs: [0, 20220628]
epochs: [0, 20211221, 20220120, 20220628]
hrname: "macOS M1, Clang"
build_profile:
os: "Macos"
Expand All @@ -86,7 +86,7 @@ configurations:
compiler.libcxx: [ "libc++" ]
build_type: [ "Release"]
- id: configs/windows-msvc
epochs: [0, 20220628]
epochs: [0, 20211221, 20220120, 20220628]
hrname: "Windows, MSVC"
build_profile:
os: "Windows"
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/alert-community.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ jobs:
- uses: ./.github/actions/alert-community
with:
files: "recipes/boost/*/*"
reviewers: "@Hopobcn @jwillikers"
reviewers: "@grafikrobot @Hopobcn @jwillikers"

- uses: ./.github/actions/alert-community
with:
Expand Down
24 changes: 24 additions & 0 deletions docs/faqs.md
Original file line number Diff line number Diff line change
Expand Up @@ -438,3 +438,27 @@ Generally no, these sorts of options can most likely be set from a profile or do
and would otherwise dynamically embed this into the CMake config files or generated pkg-config files then it should be allowed.

Doing so requires [deleting the option from the `package_id`](adding_packages/conanfile_attributes.md#removing-from-package_id).

## Can I use full_package_mode for a requirement in my recipe?

For some irregular projects, they may need to be aligned when being used as a requirement, using the very same version, options, and settings and maybe not mixing shared with static linkage.
Those projects usually break between patch versions and are very sensitive, so we can not use different versions through Conan graph dependencies,
otherwise, it may result in unexpected behavior or even runtime errors.

A very known project is GLib, which requires the very same configuration to prevent multiple instances when using static linkage.
As a solution, we could consume GLib on full package id mode, like:

```python
def package_id(self):
self.info.requires["glib"].full_package_mode()
```

Perfect solution on the consumer side, but there is a side-effect: CCI will not re-generate all involved packages for any change in the dependencies graph with which glib is associated, which means, users will start to see **MISSING_PACKAGES** error during their pull requests.
As a trade-off, it would be necessary to update all recipes involved, by opening new PRs,
then it should generate new packages, but it takes many days and still is a process that is not supported by CCI internally.

To have more context about it, please, visit issues #11684 and #11022

In summary, we do not recommend `full_package_mode` or any other custom package id mode for requirements on CCI, it will break other PRs soon or later.
Instead, prefer using `shared=True` by default, when needed.
Also, when having a similar situation, do not hesitate in opening an issue explaining your case, and ask for support from the community.
2 changes: 2 additions & 0 deletions recipes/b2/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,5 @@ versions:
folder: portable
"4.9.3":
folder: portable
"4.9.4":
folder: portable
3 changes: 3 additions & 0 deletions recipes/b2/portable/conandata.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,3 +50,6 @@ sources:
"4.9.3":
url: "https://github.com/bfgroup/b2/archive/4.9.3.tar.gz"
sha256: "4524b8ecf138a9087aa24b8889c44ea7ae9f2d373acc9535d72fb048c213e1b9"
"4.9.4":
url: "https://github.com/bfgroup/b2/releases/download/4.9.4/b2-4.9.4.tar.bz2"
sha256: "1996d8098955ad3fdecab242d784afaef0fba80dd5d2ef0b3a41592e26772312"
10 changes: 6 additions & 4 deletions recipes/libtool/all/conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,16 @@ def configure(self):
self.options.rm_safe("fPIC")
self.settings.rm_safe("compiler.libcxx")
self.settings.rm_safe("compiler.cppstd")

def layout(self):
basic_layout(self, src_folder="src")

def requirements(self):
self.requires("automake/1.16.5")
#self.requires("m4/1.4.19") TODO: add as runtime dependency

#TODO: consider adding m4 as direct dependency, perhaps when we start using version ranges.
# https://github.com/conan-io/conan-center-index/pull/16248#discussion_r1116332095
#self.requires("m4/1.4.19")

@property
def _settings_build(self):
Expand Down Expand Up @@ -221,8 +225,6 @@ def package_info(self):

# Define environment variables such that libtool m4 files are seen by Automake
libtool_aclocal_dir = os.path.join(self._datarootdir, "aclocal")
self.output.info("Appending ACLOCAL_PATH env: {}".format(libtool_aclocal_dir))
self.output.info("Appending AUTOMAKE_CONAN_INCLUDES environment variable: {}".format(libtool_aclocal_dir))

self.buildenv_info.append_path("ACLOCAL_PATH", libtool_aclocal_dir)
self.buildenv_info.append_path("AUTOMAKE_CONAN_INCLUDES", libtool_aclocal_dir)
Expand All @@ -231,7 +233,7 @@ def package_info(self):

# For Conan 1.x downstream consumers, can be removed once recipe is Conan 1.x only:
bin_path = os.path.join(self.package_folder, "bin")
self.output.info("Appending PATH env: {}".format(bin_path))
self.output.info(f"Appending PATH env: bin_path{bin_path}")
self.env_info.PATH.append(bin_path)

self.env_info.ACLOCAL_PATH.append(unix_path_package_info_legacy(self, libtool_aclocal_dir))
Expand Down
4 changes: 2 additions & 2 deletions recipes/libtool/all/test_package/conanfile.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from conan import ConanFile, conan_version
from conan import ConanFile
from conan.tools.build import cross_building, can_run
from conan.tools.env import Environment, VirtualBuildEnv, VirtualRunEnv
from conan.tools.files import chdir, mkdir, rmdir
Expand All @@ -7,7 +7,7 @@
from conan.tools.gnu import AutotoolsToolchain, Autotools
from conan.tools.microsoft import is_msvc, unix_path
from conan.tools.apple import is_apple_os
from conan.tools.scm import Version

import glob
import os
import shutil
Expand Down
8 changes: 2 additions & 6 deletions recipes/libtool/all/test_v1_package/conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,7 @@ def _build_autotools(self):
# Copy autotools directory to build folder
shutil.copytree(os.path.join(self.source_folder, "autotools"), os.path.join(self.build_folder, "autotools"))
with tools.chdir("autotools"):
# Work around the fact that "used_special_vars" in conans/client/tools/win.py doesn't handle ACLOCAL_PATH
aclocal_path = "$ACLOCAL_PATH:" + self.deps_env_info.vars["ACLOCAL_PATH"][0].lower()
self.run("ACLOCAL_PATH={} autoreconf --install --verbose -Wall".format(aclocal_path), win_bash=tools.os_info.is_windows)
self.run("autoreconf --install --verbose -Wall", win_bash=tools.os_info.is_windows)

tools.mkdir(self._package_folder)
conf_args = [
Expand Down Expand Up @@ -120,9 +118,7 @@ def _build_static_lib_in_shared(self):

# Copy autotools directory to build folder
with tools.chdir(autotools_folder):
# Work around the fact that "used_special_vars" in conans/client/tools/win.py doesn't handle ACLOCAL_PATH
aclocal_path = "$ACLOCAL_PATH:" + self.deps_env_info.vars["ACLOCAL_PATH"][0].lower()
self.run("ACLOCAL_PATH={} autoreconf -ifv -Wall".format(aclocal_path), win_bash=tools.os_info.is_windows)
self.run("autoreconf -ifv -Wall", win_bash=tools.os_info.is_windows)

with tools.chdir(autotools_folder):
conf_args = [
Expand Down
29 changes: 5 additions & 24 deletions recipes/libudev/all/conanfile.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from conan import ConanFile
from conan.errors import ConanException, ConanInvalidConfiguration
from conan.errors import ConanInvalidConfiguration
from conan.tools.system import package_manager
from conans import tools
from conan.tools.gnu import PkgConfig

required_conan_version = ">=1.47"

Expand All @@ -21,27 +21,7 @@ def validate(self):
raise ConanInvalidConfiguration("libudev is only supported on Linux.")

def package_id(self):
self.info.header_only()

def _fill_cppinfo_from_pkgconfig(self, name):
pkg_config = tools.PkgConfig(name)
if not pkg_config.provides:
raise ConanException("libudev development files aren't available, give up")
libs = [lib[2:] for lib in pkg_config.libs_only_l]
lib_dirs = [lib[2:] for lib in pkg_config.libs_only_L]
ldflags = [flag for flag in pkg_config.libs_only_other]
include_dirs = [include[2:] for include in pkg_config.cflags_only_I]
cflags = [flag for flag in pkg_config.cflags_only_other if not flag.startswith("-D")]
defines = [flag[2:] for flag in pkg_config.cflags_only_other if flag.startswith("-D")]

self.cpp_info.system_libs = libs
self.cpp_info.libdirs = lib_dirs
self.cpp_info.sharedlinkflags = ldflags
self.cpp_info.exelinkflags = ldflags
self.cpp_info.defines = defines
self.cpp_info.includedirs = include_dirs
self.cpp_info.cflags = cflags
self.cpp_info.cxxflags = cflags
self.info.clear()

def system_requirements(self):
dnf = package_manager.Dnf(self)
Expand All @@ -62,4 +42,5 @@ def system_requirements(self):
def package_info(self):
self.cpp_info.includedirs = []
self.cpp_info.libdirs = []
self._fill_cppinfo_from_pkgconfig("libudev")
pkg_config = PkgConfig(self, "libudev")
pkg_config.fill_cpp_info(self.cpp_info)
5 changes: 1 addition & 4 deletions recipes/libudev/all/test_package/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
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)

find_package(libudev REQUIRED CONFIG)


Expand Down
20 changes: 14 additions & 6 deletions recipes/libudev/all/test_package/conanfile.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,25 @@
from conans import ConanFile, CMake, tools
from conan import ConanFile
from conan.tools.cmake import cmake_layout, CMake
from conan.tools.build import can_run
import os


class TestPackageConan(ConanFile):
settings = "os", "compiler", "build_type", "arch"
generators = "cmake", "cmake_find_package_multi"
generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv"
test_type = "explicit"

def requirements(self):
self.requires(self.tested_reference_str)

def layout(self):
cmake_layout(self)

def build(self):
cmake = CMake(self)
cmake.configure()
cmake.build()

def test(self):
if not tools.cross_building(self):
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.bindirs[0], "test_package")
self.run(bin_path, env="conanrun")
8 changes: 8 additions & 0 deletions recipes/libudev/all/test_v1_package/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
cmake_minimum_required(VERSION 3.1)
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/)
18 changes: 18 additions & 0 deletions recipes/libudev/all/test_v1_package/conanfile.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
from conans import ConanFile, CMake
from conan.tools.build import cross_building
import os


class TestPackageV1Conan(ConanFile):
settings = "os", "arch", "compiler", "build_type"
generators = "cmake", "cmake_find_package_multi"

def build(self):
cmake = CMake(self)
cmake.configure()
cmake.build()

def test(self):
if not cross_building(self):
bin_path = os.path.join("bin", "test_package")
self.run(bin_path, run_environment=True)
5 changes: 0 additions & 5 deletions recipes/pkgconf/all/conanfile.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import os

from conan import ConanFile
from conan.tools.build import cross_building
from conan.tools.env import VirtualBuildEnv
from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, rename, rm, rmdir, replace_in_file
from conan.tools.layout import basic_layout
Expand Down Expand Up @@ -53,10 +52,6 @@ def configure(self):
self.settings.rm_safe("compiler.libcxx")
self.settings.rm_safe("compiler.cppstd")

def validate(self):
if cross_building(self):
raise ConanInvalidConfiguration("Cross-building is not implemented in the recipe, contributions welcome.")

def build_requirements(self):
self.tool_requires("meson/1.0.0")

Expand Down
4 changes: 4 additions & 0 deletions recipes/zstd/all/conandata.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@ patches:
- patch_file: "patches/1.5.2-cmake-remove-asm-except-x86_64.patch"
patch_description: "use assembler codes only on x86_64"
patch_type: "portability"
- patch_file: "patches/1.5.4-decrease-min-cmake-version.patch"
patch_description: "Don't require CMake 3.18 or later"
patch_type: "portability"
patch_source: "https://github.com/facebook/zstd/pull/3510"
"1.5.2":
- patch_file: "patches/1.5.2-cmake-remove-asm-except-x86_64.patch"
patch_description: "use assembler codes only on x86_64"
Expand Down
17 changes: 1 addition & 16 deletions recipes/zstd/all/conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ class ZstdConan(ConanFile):
topics = ("zstandard", "compression", "algorithm", "decoder")
license = "BSD-3-Clause"

package_type = "library"
settings = "os", "arch", "compiler", "build_type"
options = {
"shared": [True, False],
Expand Down Expand Up @@ -43,22 +44,6 @@ def configure(self):
def layout(self):
cmake_layout(self, src_folder="src")

def _cmake_new_enough(self, required_version):
try:
import re
from io import StringIO
output = StringIO()
self.run("cmake --version", output=output)
m = re.search(r'cmake version (\d+\.\d+\.\d+)', output.getvalue())
return Version(m.group(1)) >= required_version
except:
return False

def build_requirements(self):
# zstd/>=1.5.4 uses `check_linker_flag` which is introduced since cmake 3.1.8.
if Version(self.version) >= "1.5.4" and not self._cmake_new_enough("3.18"):
self.tool_requires("cmake/3.25.2")

def source(self):
get(self, **self.conan_data["sources"][self.version], strip_root=True)

Expand Down
36 changes: 36 additions & 0 deletions recipes/zstd/all/patches/1.5.4-decrease-min-cmake-version.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
--- a/build/cmake/CMakeModules/AddZstdCompilationFlags.cmake
+++ b/build/cmake/CMakeModules/AddZstdCompilationFlags.cmake
@@ -1,6 +1,15 @@
include(CheckCXXCompilerFlag)
include(CheckCCompilerFlag)
-include(CheckLinkerFlag)
+# VERSION_GREATER_EQUAL requires CMake 3.7 or later.
+# https://cmake.org/cmake/help/latest/command/if.html#version-greater-equal
+if (CMAKE_VERSION VERSION_LESS 3.18)
+ set(ZSTD_HAVE_CHECK_LINKER_FLAG false)
+else ()
+ set(ZSTD_HAVE_CHECK_LINKER_FLAG true)
+endif ()
+if (ZSTD_HAVE_CHECK_LINKER_FLAG)
+ include(CheckLinkerFlag)
+endif()

function(EnableCompilerFlag _flag _C _CXX _LD)
string(REGEX REPLACE "\\+" "PLUS" varname "${_flag}")
@@ -20,7 +29,15 @@ function(EnableCompilerFlag _flag _C _CXX _LD)
endif ()
endif ()
if (_LD)
- CHECK_LINKER_FLAG(C ${_flag} LD_FLAG_${varname})
+ # We never add a linker flag with CMake < 3.18. We will
+ # implement CHECK_LINKER_FLAG() like feature for CMake < 3.18
+ # or require CMake >= 3.18 when we need to add a required
+ # linker flag in future.
+ if (ZSTD_HAVE_CHECK_LINKER_FLAG)
+ CHECK_LINKER_FLAG(C ${_flag} LD_FLAG_${varname})
+ else ()
+ set(LD_FLAG_${varname} false)
+ endif ()
if (LD_FLAG_${varname})
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${_flag}" PARENT_SCOPE)
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} ${_flag}" PARENT_SCOPE)

0 comments on commit 6fd30be

Please sign in to comment.