From 41c35fa19a82eab631ed30bbad1863fca74436e4 Mon Sep 17 00:00:00 2001 From: Andrew Marshall Date: Sun, 23 Oct 2022 18:41:34 +0100 Subject: [PATCH 01/15] [glibmm] add version 2.74.0 --- recipes/glibmm/all/conandata.yml | 3 +++ recipes/glibmm/config.yml | 2 ++ 2 files changed, 5 insertions(+) diff --git a/recipes/glibmm/all/conandata.yml b/recipes/glibmm/all/conandata.yml index 9134c71e80aa3..90a9a48b76f7c 100644 --- a/recipes/glibmm/all/conandata.yml +++ b/recipes/glibmm/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "2.74.0": + url: "https://download.gnome.org/sources/glibmm/2.74/glibmm-2.74.0.tar.xz" + sha256: "2b472696cbac79db8e405724118ec945219c5b9b18af63dc8cfb7f1d89b0f1fa" "2.72.1": url: "https://download.gnome.org/sources/glibmm/2.72/glibmm-2.72.1.tar.xz" sha256: "2a7649a28ab5dc53ac4dabb76c9f61599fbc628923ab6a7dd74bf675d9155cd8" diff --git a/recipes/glibmm/config.yml b/recipes/glibmm/config.yml index 51960e64ef7eb..59b58042c0f8f 100644 --- a/recipes/glibmm/config.yml +++ b/recipes/glibmm/config.yml @@ -1,4 +1,6 @@ versions: + "2.74.0": + folder: "all" "2.72.1": folder: "all" "2.66.4": From c463312254308defdcdf2fdf76fef4af31eae54b Mon Sep 17 00:00:00 2001 From: Andrew Marshall Date: Sun, 23 Oct 2022 18:58:24 +0100 Subject: [PATCH 02/15] [glibmm] update meson toolchain --- recipes/glibmm/all/conanfile.py | 150 ++++++++++++++++---------------- 1 file changed, 73 insertions(+), 77 deletions(-) diff --git a/recipes/glibmm/all/conanfile.py b/recipes/glibmm/all/conanfile.py index 6f564ef425241..009436af0bdc1 100644 --- a/recipes/glibmm/all/conanfile.py +++ b/recipes/glibmm/all/conanfile.py @@ -3,16 +3,25 @@ import shutil from conan import ConanFile -from conan.tools import ( - build, - files, - microsoft, - scm -) from conan.errors import ConanInvalidConfiguration -from conans import Meson, tools +from conan.tools.build import check_min_cppstd, cross_building +from conan.tools.env import VirtualBuildEnv +from conan.tools.files import ( + apply_conandata_patches, + copy, + get, + replace_in_file, + rename, + rm, + rmdir +) +from conan.tools.gnu import PkgConfigDeps +from conan.tools.layout import basic_layout +from conan.tools.meson import Meson, MesonToolchain +from conan.tools.microsoft import is_msvc, is_msvc_static_runtime +from conan.tools.scm import Version -required_conan_version = ">=1.50.0" +required_conan_version = ">=1.53.0" class GlibmmConan(ConanFile): @@ -32,7 +41,7 @@ class GlibmmConan(ConanFile): @property def _abi_version(self): - return "2.68" if scm.Version(self.version) >= "2.68.0" else "2.4" + return "2.68" if Version(self.version) >= "2.68.0" else "2.4" @property def _glibmm_lib(self): @@ -43,75 +52,87 @@ def _giomm_lib(self): return f"giomm-{self._abi_version}" def validate(self): - if hasattr(self, "settings_build") and build.cross_building(self): + if hasattr(self, "settings_build") and cross_building(self): raise ConanInvalidConfiguration("Cross-building not implemented") if self.settings.compiler.get_safe("cppstd"): if self._abi_version == "2.68": - build.check_min_cppstd(self, 17) + check_min_cppstd(self, 17) else: - build.check_min_cppstd(self, 11) + check_min_cppstd(self, 11) if self.options.shared and not self.options["glib"].shared: raise ConanInvalidConfiguration( "Linking a shared library against static glib can cause unexpected behaviour." ) - if self.options["glib"].shared and microsoft.is_msvc_static_runtime(self): + if self.options["glib"].shared and is_msvc_static_runtime(self): raise ConanInvalidConfiguration( "Linking shared glib with the MSVC static runtime is not supported" ) - @property - def _source_subfolder(self): - return "source_subfolder" - - @property - def _build_subfolder(self): - return "build_subfolder" - def config_options(self): if self.settings.os == "Windows": del self.options.fPIC + def layout(self): + basic_layout(self, src_folder="src") + def build_requirements(self): - self.build_requires("meson/0.64.1") - self.build_requires("pkgconf/1.9.3") + self.tool_requires("meson/0.63.3") + self.tool_requires("pkgconf/1.9.3") def requirements(self): self.requires("glib/2.75.0") - if self._abi_version == "2.68": + self.requires("glib/2.74.0") self.requires("libsigcpp/3.0.7") else: + self.requires("glib/2.67.6") self.requires("libsigcpp/2.10.8") + def generate(self): + deps = PkgConfigDeps(self) + deps.generate() + + tc = MesonToolchain(self) + tc.project_options.update({ + "build-examples": "false", + "build-documentation": "false", + "msvc14x-parallel-installable": "false", + "default_library": "shared" if self.options.shared else "static", + }) + tc.generate() + + env = VirtualBuildEnv(self) + env.generate() + def source(self): - files.get(self, **self.conan_data["sources"][self.version], strip_root=True, destination=self._source_subfolder) + get(self, **self.conan_data["sources"][self.version], strip_root=True, destination=self.source_folder) def _patch_sources(self): - files.apply_conandata_patches(self) - meson_build = os.path.join(self._source_subfolder, "meson.build") - files.replace_in_file(self, meson_build, "subdir('tests')", "") - if microsoft.is_msvc(self): + apply_conandata_patches(self) + meson_build = os.path.join(self.source_folder, "meson.build") + replace_in_file(self, meson_build, "subdir('tests')", "") + if is_msvc(self): # GLiBMM_GEN_EXTRA_DEFS_STATIC is not defined anywhere and is not # used anywhere except here # when building a static build !defined(GLiBMM_GEN_EXTRA_DEFS_STATIC) # evaluates to 0 if not self.options.shared: - files.replace_in_file(self, - os.path.join(self._source_subfolder, "tools", - "extra_defs_gen", "generate_extra_defs.h"), - "#if defined (_MSC_VER) && !defined (GLIBMM_GEN_EXTRA_DEFS_STATIC)", - "#if 0", - ) + replace_in_file(self, + os.path.join(self.source_folder, "tools", + "extra_defs_gen", "generate_extra_defs.h"), + "#if defined (_MSC_VER) && !defined (GLIBMM_GEN_EXTRA_DEFS_STATIC)", + "#if 0", + ) # when using cpp_std=c++NM the /permissive- flag is added which # attempts enforcing standard conformant c++ code # the problem is that older versions of Windows SDK is not standard # conformant! see: # https://developercommunity.visualstudio.com/t/error-c2760-in-combaseapih-with-windows-sdk-81-and/185399 - files.replace_in_file(self, meson_build, "cpp_std=c++", "cpp_std=vc++") + replace_in_file(self, meson_build, "cpp_std=c++", "cpp_std=vc++") def configure(self): if self.options.shared: @@ -121,51 +142,26 @@ def configure(self): def build(self): self._patch_sources() - with tools.environment_append(tools.RunEnvironment(self).vars): - meson = self._configure_meson() - meson.build() - - def _configure_meson(self): meson = Meson(self) - defs = { - "build-examples": "false", - "build-documentation": "false", - "msvc14x-parallel-installable": "false", - "default_library": "shared" if self.options.shared else "static", - } - - meson.configure( - defs=defs, - build_folder=self._build_subfolder, - source_folder=self._source_subfolder, - pkg_config_paths=[self.install_folder], - ) - - return meson + meson.configure() + meson.build() def package(self): - self.copy("COPYING", dst="licenses", src=self._source_subfolder) - meson = self._configure_meson() + def rename_msvc_static_libs(): + lib_folder = os.path.join(self.package_folder, "lib") + rename(self, os.path.join(lib_folder, f"libglibmm-{self._abi_version}.a"), os.path.join(lib_folder, f"{self._glibmm_lib}.lib")) + rename(self, os.path.join(lib_folder, f"libgiomm-{self._abi_version}.a"), os.path.join(lib_folder, f"{self._giomm_lib}.lib")) + rename(self, os.path.join(lib_folder, f"libglibmm_generate_extra_defs-{self._abi_version}.a"), os.path.join(lib_folder, f"glibmm_generate_extra_defs-{self._abi_version}.lib")) + + meson = Meson(self) meson.install() - if microsoft.is_msvc(self): - files.rm(self, "*.pdb", os.path.join(self.package_folder, "bin")) + copy(self, "COPYING", self.source_folder, os.path.join(self.package_folder, "licenses")) + + if is_msvc(self): + rm(self, "*.pdb", os.path.join(self.package_folder, "bin")) if not self.options.shared: - files.rename( - self, - os.path.join(self.package_folder, "lib", f"libglibmm-{self._abi_version}.a"), - os.path.join(self.package_folder, "lib", f"{self._glibmm_lib}.lib") - ) - files.rename( - self, - os.path.join(self.package_folder, "lib", f"libgiomm-{self._abi_version}.a"), - os.path.join(self.package_folder, "lib", f"{self._giomm_lib}.lib") - ) - files.rename( - self, - os.path.join(self.package_folder, "lib", f"libglibmm_generate_extra_defs-{self._abi_version}.a"), - os.path.join(self.package_folder, "lib", f"glibmm_generate_extra_defs-{self._abi_version}.lib"), - ) + rename_msvc_static_libs() for directory in [self._glibmm_lib, self._giomm_lib]: directory_path = os.path.join(self.package_folder, "lib", directory, "include", "*.h") @@ -176,7 +172,7 @@ def package(self): ) for dir_to_remove in ["pkgconfig", self._glibmm_lib, self._giomm_lib]: - files.rmdir(self, os.path.join(self.package_folder, "lib", dir_to_remove)) + rmdir(self, os.path.join(self.package_folder, "lib", dir_to_remove)) def package_info(self): glibmm_component = f"glibmm-{self._abi_version}" @@ -193,7 +189,7 @@ def package_info(self): self.cpp_info.components[giomm_component].set_property("pkg_config_name", giomm_component) self.cpp_info.components[giomm_component].libs = [giomm_component] - self.cpp_info.components[giomm_component].includedirs = [ os.path.join("include", giomm_component)] + self.cpp_info.components[giomm_component].includedirs = [os.path.join("include", giomm_component)] self.cpp_info.components[giomm_component].requires = [glibmm_component, "glib::gio-2.0"] def package_id(self): From e6839525466760feebd3d40a06c8f34ba30d8664 Mon Sep 17 00:00:00 2001 From: Andrew Marshall Date: Sun, 23 Oct 2022 19:03:06 +0100 Subject: [PATCH 03/15] [glibmm] update test packages --- recipes/glibmm/all/conandata.yml | 4 ---- recipes/glibmm/all/conanfile.py | 5 +---- .../glibmm/all/test_package/CMakeLists.txt | 7 ++----- recipes/glibmm/all/test_package/conanfile.py | 21 ++++++++++++++----- 4 files changed, 19 insertions(+), 18 deletions(-) diff --git a/recipes/glibmm/all/conandata.yml b/recipes/glibmm/all/conandata.yml index 90a9a48b76f7c..c779102aa393a 100644 --- a/recipes/glibmm/all/conandata.yml +++ b/recipes/glibmm/all/conandata.yml @@ -12,11 +12,7 @@ sources: patches: "2.72.1": - patch_file: "patches/enable_static_libs_2_72_1.patch" - base_path: "source_subfolder" - patch_file: "patches/fix_initialization_order_fiasco_2_72_1.patch" - base_path: "source_subfolder" "2.66.4": - patch_file: "patches/enable_static_libs_2_66_4.patch" - base_path: "source_subfolder" - patch_file: "patches/fix_initialization_order_fiasco_2_66_4.patch" - base_path: "source_subfolder" diff --git a/recipes/glibmm/all/conanfile.py b/recipes/glibmm/all/conanfile.py index 009436af0bdc1..02e431501f7cb 100644 --- a/recipes/glibmm/all/conanfile.py +++ b/recipes/glibmm/all/conanfile.py @@ -34,9 +34,6 @@ class GlibmmConan(ConanFile): settings = "os", "compiler", "build_type", "arch" options = {"shared": [True, False], "fPIC": [True, False]} default_options = {"shared": False, "fPIC": True} - - generators = "pkg_config" - exports_sources = "patches/**" short_paths = True @property @@ -100,7 +97,7 @@ def generate(self): "build-examples": "false", "build-documentation": "false", "msvc14x-parallel-installable": "false", - "default_library": "shared" if self.options.shared else "static", + "default_library": "shared" if self.options.shared else "static" }) tc.generate() diff --git a/recipes/glibmm/all/test_package/CMakeLists.txt b/recipes/glibmm/all/test_package/CMakeLists.txt index c47425885e86c..e57ebb60abaed 100644 --- a/recipes/glibmm/all/test_package/CMakeLists.txt +++ b/recipes/glibmm/all/test_package/CMakeLists.txt @@ -1,18 +1,15 @@ cmake_minimum_required(VERSION 3.6) project(test_package) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGET) - find_package(glibmm REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) if (TARGET glibmm::glibmm-2.68) set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 17) - target_link_libraries(${PROJECT_NAME} glibmm::glibmm-2.68 glibmm::giomm-2.68) + target_link_libraries(${PROJECT_NAME} PRIVATE glibmm::glibmm-2.68 glibmm::giomm-2.68) else() set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 11) - target_link_libraries(${PROJECT_NAME} glibmm::glibmm-2.4 glibmm::giomm-2.4) + target_link_libraries(${PROJECT_NAME} PRIVATE glibmm::glibmm-2.4 glibmm::giomm-2.4) endif() diff --git a/recipes/glibmm/all/test_package/conanfile.py b/recipes/glibmm/all/test_package/conanfile.py index 38f4483872d47..05bb1c8f03b5d 100644 --- a/recipes/glibmm/all/test_package/conanfile.py +++ b/recipes/glibmm/all/test_package/conanfile.py @@ -1,10 +1,21 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake +from conan.tools.layout import cmake_layout + import os class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake", "cmake_find_package_multi" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -12,6 +23,6 @@ def build(self): 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") From 4367f318cb233eb8dd8934cb5d809edc1205cf2e Mon Sep 17 00:00:00 2001 From: Andrew Marshall Date: Thu, 5 Jan 2023 09:13:01 +0000 Subject: [PATCH 04/15] [glibmm] fix libsigcpp component requires --- recipes/glibmm/all/conanfile.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/recipes/glibmm/all/conanfile.py b/recipes/glibmm/all/conanfile.py index 02e431501f7cb..ee146119575fd 100644 --- a/recipes/glibmm/all/conanfile.py +++ b/recipes/glibmm/all/conanfile.py @@ -9,6 +9,7 @@ from conan.tools.files import ( apply_conandata_patches, copy, + export_conandata_patches, get, replace_in_file, rename, @@ -80,12 +81,10 @@ def build_requirements(self): self.tool_requires("pkgconf/1.9.3") def requirements(self): - self.requires("glib/2.75.0") + self.requires("glib/2.75.1") if self._abi_version == "2.68": - self.requires("glib/2.74.0") self.requires("libsigcpp/3.0.7") else: - self.requires("glib/2.67.6") self.requires("libsigcpp/2.10.8") def generate(self): @@ -107,6 +106,9 @@ def generate(self): def source(self): get(self, **self.conan_data["sources"][self.version], strip_root=True, destination=self.source_folder) + def export_sources(self): + export_conandata_patches(self) + def _patch_sources(self): apply_conandata_patches(self) meson_build = os.path.join(self.source_folder, "meson.build") @@ -182,7 +184,7 @@ def package_info(self): if self._abi_version == "2.68": self.cpp_info.components[glibmm_component].requires = ["glib::gobject-2.0", "libsigcpp::sigc++"] else: - self.cpp_info.components[glibmm_component].requires = ["glib::gobject-2.0", "libsigcpp::sigc++-2.0"] + self.cpp_info.components[glibmm_component].requires = ["glib::gobject-2.0", "libsigcpp::libsigcpp"] self.cpp_info.components[giomm_component].set_property("pkg_config_name", giomm_component) self.cpp_info.components[giomm_component].libs = [giomm_component] From 284f82fa884569cf615859928e019706a8ec81d1 Mon Sep 17 00:00:00 2001 From: Andrew Marshall Date: Thu, 5 Jan 2023 20:38:59 +0000 Subject: [PATCH 05/15] [glibmm] add v1 test package --- .../glibmm/all/test_v1_package/CMakeLists.txt | 8 ++++++++ recipes/glibmm/all/test_v1_package/conanfile.py | 17 +++++++++++++++++ 2 files changed, 25 insertions(+) create mode 100644 recipes/glibmm/all/test_v1_package/CMakeLists.txt create mode 100644 recipes/glibmm/all/test_v1_package/conanfile.py diff --git a/recipes/glibmm/all/test_v1_package/CMakeLists.txt b/recipes/glibmm/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..925ecbe19e448 --- /dev/null +++ b/recipes/glibmm/all/test_v1_package/CMakeLists.txt @@ -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/) diff --git a/recipes/glibmm/all/test_v1_package/conanfile.py b/recipes/glibmm/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38f4483872d47 --- /dev/null +++ b/recipes/glibmm/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(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 tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) From 8bb99c2ce5ca89ded68d4f50c2958ef4432983e4 Mon Sep 17 00:00:00 2001 From: Andrew Marshall Date: Fri, 6 Jan 2023 17:40:26 +0000 Subject: [PATCH 06/15] [glibmm] disable static builds on msvc --- recipes/glibmm/all/conanfile.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/recipes/glibmm/all/conanfile.py b/recipes/glibmm/all/conanfile.py index ee146119575fd..66d419161325e 100644 --- a/recipes/glibmm/all/conanfile.py +++ b/recipes/glibmm/all/conanfile.py @@ -59,15 +59,16 @@ def validate(self): else: check_min_cppstd(self, 11) + if is_msvc(self) and not self.options.shared: + raise ConanInvalidConfiguration("Static library build is not supported by MSVC") + if self.options.shared and not self.options["glib"].shared: raise ConanInvalidConfiguration( "Linking a shared library against static glib can cause unexpected behaviour." ) if self.options["glib"].shared and is_msvc_static_runtime(self): - raise ConanInvalidConfiguration( - "Linking shared glib with the MSVC static runtime is not supported" - ) + raise ConanInvalidConfiguration("Linking shared glib with the MSVC static runtime is not supported") def config_options(self): if self.settings.os == "Windows": @@ -135,7 +136,7 @@ def _patch_sources(self): def configure(self): if self.options.shared: - del self.options.fPIC + self.options.rm_safe("fPIC") if self.options.shared: self.options["glib"].shared = True From 3686c00dc973c2194cdf87adaacc26f825e5b5ba Mon Sep 17 00:00:00 2001 From: Andrew Marshall Date: Sun, 22 Jan 2023 12:17:07 +0000 Subject: [PATCH 07/15] [glibmm] bump glib version --- recipes/glibmm/all/conanfile.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/recipes/glibmm/all/conanfile.py b/recipes/glibmm/all/conanfile.py index 66d419161325e..48a9ab35392f6 100644 --- a/recipes/glibmm/all/conanfile.py +++ b/recipes/glibmm/all/conanfile.py @@ -78,11 +78,11 @@ def layout(self): basic_layout(self, src_folder="src") def build_requirements(self): - self.tool_requires("meson/0.63.3") + self.tool_requires("meson/1.0.0") self.tool_requires("pkgconf/1.9.3") def requirements(self): - self.requires("glib/2.75.1") + self.requires("glib/2.75.2") if self._abi_version == "2.68": self.requires("libsigcpp/3.0.7") else: From 7e5972685cb6f537fc217542a68bba5bdfefb08f Mon Sep 17 00:00:00 2001 From: Andrew Marshall Date: Sun, 22 Jan 2023 18:54:29 +0000 Subject: [PATCH 08/15] Update recipes/glibmm/all/conanfile.py Co-authored-by: SpaceIm <30052553+SpaceIm@users.noreply.github.com> --- recipes/glibmm/all/conanfile.py | 1 + 1 file changed, 1 insertion(+) diff --git a/recipes/glibmm/all/conanfile.py b/recipes/glibmm/all/conanfile.py index 48a9ab35392f6..3496741c9eee4 100644 --- a/recipes/glibmm/all/conanfile.py +++ b/recipes/glibmm/all/conanfile.py @@ -4,6 +4,7 @@ from conan import ConanFile from conan.errors import ConanInvalidConfiguration +from conan.tools.apple import fix_apple_shared_install_name from conan.tools.build import check_min_cppstd, cross_building from conan.tools.env import VirtualBuildEnv from conan.tools.files import ( From 08d7136c96de1e87fb0ef8a50bc4338fd30f87b1 Mon Sep 17 00:00:00 2001 From: Andrew Marshall Date: Sun, 22 Jan 2023 18:54:41 +0000 Subject: [PATCH 09/15] Update recipes/glibmm/all/conanfile.py Co-authored-by: SpaceIm <30052553+SpaceIm@users.noreply.github.com> --- recipes/glibmm/all/conanfile.py | 1 + 1 file changed, 1 insertion(+) diff --git a/recipes/glibmm/all/conanfile.py b/recipes/glibmm/all/conanfile.py index 3496741c9eee4..c29ed746bd54e 100644 --- a/recipes/glibmm/all/conanfile.py +++ b/recipes/glibmm/all/conanfile.py @@ -174,6 +174,7 @@ def rename_msvc_static_libs(): for dir_to_remove in ["pkgconfig", self._glibmm_lib, self._giomm_lib]: rmdir(self, os.path.join(self.package_folder, "lib", dir_to_remove)) + fix_apple_shared_install_name(self) def package_info(self): glibmm_component = f"glibmm-{self._abi_version}" From ff369e6afb6ed961573cfcb2ecbbd2c152f5d707 Mon Sep 17 00:00:00 2001 From: Andrew Marshall Date: Mon, 23 Jan 2023 17:41:10 +0000 Subject: [PATCH 10/15] [glibmm] add 2.75.0 --- recipes/glibmm/all/conandata.yml | 4 ++-- recipes/glibmm/config.yml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/recipes/glibmm/all/conandata.yml b/recipes/glibmm/all/conandata.yml index c779102aa393a..87edf6e73e9b2 100644 --- a/recipes/glibmm/all/conandata.yml +++ b/recipes/glibmm/all/conandata.yml @@ -1,7 +1,7 @@ sources: - "2.74.0": + "2.75.0": url: "https://download.gnome.org/sources/glibmm/2.74/glibmm-2.74.0.tar.xz" - sha256: "2b472696cbac79db8e405724118ec945219c5b9b18af63dc8cfb7f1d89b0f1fa" + sha256: "60bb12e66488aa8ce41f0eb2f3612f89f5ddc887e3e4d45498524bf60b266b3d" "2.72.1": url: "https://download.gnome.org/sources/glibmm/2.72/glibmm-2.72.1.tar.xz" sha256: "2a7649a28ab5dc53ac4dabb76c9f61599fbc628923ab6a7dd74bf675d9155cd8" diff --git a/recipes/glibmm/config.yml b/recipes/glibmm/config.yml index 59b58042c0f8f..6aaa4e9d859bb 100644 --- a/recipes/glibmm/config.yml +++ b/recipes/glibmm/config.yml @@ -1,5 +1,5 @@ versions: - "2.74.0": + "2.75.0": folder: "all" "2.72.1": folder: "all" From 4bfbfa89d4ee6971986d4560da1be28fba3ace7a Mon Sep 17 00:00:00 2001 From: Andrew Marshall Date: Mon, 23 Jan 2023 18:10:31 +0000 Subject: [PATCH 11/15] [glibmm] add and document patches for 2.75.0 --- recipes/glibmm/all/conandata.yml | 17 +++- recipes/glibmm/all/conanfile.py | 15 ++-- .../patches/enable_static_libs_2_75_0.patch | 32 +++++++ ...x_initialization_order_fiasco_2_75_0.patch | 84 +++++++++++++++++++ 4 files changed, 138 insertions(+), 10 deletions(-) create mode 100644 recipes/glibmm/all/patches/enable_static_libs_2_75_0.patch create mode 100644 recipes/glibmm/all/patches/fix_initialization_order_fiasco_2_75_0.patch diff --git a/recipes/glibmm/all/conandata.yml b/recipes/glibmm/all/conandata.yml index 87edf6e73e9b2..171a01a50da60 100644 --- a/recipes/glibmm/all/conandata.yml +++ b/recipes/glibmm/all/conandata.yml @@ -1,6 +1,6 @@ sources: "2.75.0": - url: "https://download.gnome.org/sources/glibmm/2.74/glibmm-2.74.0.tar.xz" + url: "https://download.gnome.org/sources/glibmm/2.75/glibmm-2.75.0.tar.xz" sha256: "60bb12e66488aa8ce41f0eb2f3612f89f5ddc887e3e4d45498524bf60b266b3d" "2.72.1": url: "https://download.gnome.org/sources/glibmm/2.72/glibmm-2.72.1.tar.xz" @@ -10,9 +10,24 @@ sources: sha256: "199ace5682d81b15a1d565480b4a950682f2db6402c8aa5dd7217d71edff81d5" patches: + "2.75.0": + - patch_file: "patches/enable_static_libs_2_75_0.patch" + patch_type: portability + patch_description: enable static library build for msvc + - patch_file: "patches/fix_initialization_order_fiasco_2_75_0.patch" + patch_type: bugfix + patch_description: fix initialization order for static library "2.72.1": - patch_file: "patches/enable_static_libs_2_72_1.patch" + patch_type: portability + patch_description: enable static library build for msvc - patch_file: "patches/fix_initialization_order_fiasco_2_72_1.patch" + patch_type: bugfix + patch_description: fix initialization order for static library "2.66.4": - patch_file: "patches/enable_static_libs_2_66_4.patch" + patch_type: portability + patch_description: enable static library build for msvc - patch_file: "patches/fix_initialization_order_fiasco_2_66_4.patch" + patch_type: bugfix + patch_description: fix initialization order for static library diff --git a/recipes/glibmm/all/conanfile.py b/recipes/glibmm/all/conanfile.py index c29ed746bd54e..1af1a9dd48f16 100644 --- a/recipes/glibmm/all/conanfile.py +++ b/recipes/glibmm/all/conanfile.py @@ -60,9 +60,6 @@ def validate(self): else: check_min_cppstd(self, 11) - if is_msvc(self) and not self.options.shared: - raise ConanInvalidConfiguration("Static library build is not supported by MSVC") - if self.options.shared and not self.options["glib"].shared: raise ConanInvalidConfiguration( "Linking a shared library against static glib can cause unexpected behaviour." @@ -71,6 +68,9 @@ def validate(self): if self.options["glib"].shared and is_msvc_static_runtime(self): raise ConanInvalidConfiguration("Linking shared glib with the MSVC static runtime is not supported") + def export_sources(self): + export_conandata_patches(self) + def config_options(self): if self.settings.os == "Windows": del self.options.fPIC @@ -89,6 +89,9 @@ def requirements(self): else: self.requires("libsigcpp/2.10.8") + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True, destination=self.source_folder) + def generate(self): deps = PkgConfigDeps(self) deps.generate() @@ -105,12 +108,6 @@ def generate(self): env = VirtualBuildEnv(self) env.generate() - def source(self): - get(self, **self.conan_data["sources"][self.version], strip_root=True, destination=self.source_folder) - - def export_sources(self): - export_conandata_patches(self) - def _patch_sources(self): apply_conandata_patches(self) meson_build = os.path.join(self.source_folder, "meson.build") diff --git a/recipes/glibmm/all/patches/enable_static_libs_2_75_0.patch b/recipes/glibmm/all/patches/enable_static_libs_2_75_0.patch new file mode 100644 index 0000000000000..f24c64bb5bd54 --- /dev/null +++ b/recipes/glibmm/all/patches/enable_static_libs_2_75_0.patch @@ -0,0 +1,32 @@ +diff --git a/glib/glibmmconfig.h.meson b/glib/glibmmconfig.h.meson +index ef4753d7..b926720b 100644 +--- a/glib/glibmmconfig.h.meson ++++ b/glib/glibmmconfig.h.meson +@@ -27,7 +27,9 @@ + # if defined(_MSC_VER) + # define GLIBMM_MSC 1 + # define GLIBMM_WIN32 1 +-# define GLIBMM_DLL 1 ++# ifndef GLIBMM_STATIC_LIB ++# define GLIBMM_DLL 1 ++# endif + # elif defined(__CYGWIN__) + # define GLIBMM_CONFIGURE 1 + # elif defined(__MINGW32__) +diff --git a/glib/meson.build b/glib/meson.build +index d16621e9..3eb8bc47 100644 +--- a/glib/meson.build ++++ b/glib/meson.build +@@ -37,12 +37,6 @@ pkg_conf_data.set('MSVC_TOOLSET_VER', msvc14x_toolset_ver) + + library_build_type = get_option('default_library') + +-if cpp_compiler.get_argument_syntax() == 'msvc' +- if library_build_type == 'static' or library_build_type == 'both' +- error('Static builds are not supported by MSVC-style builds') +- endif +-endif +- + if library_build_type == 'static' + pkg_conf_data.set('GLIBMM_STATIC_LIB', 1) + pkg_conf_data.set('GIOMM_STATIC_LIB', 1) diff --git a/recipes/glibmm/all/patches/fix_initialization_order_fiasco_2_75_0.patch b/recipes/glibmm/all/patches/fix_initialization_order_fiasco_2_75_0.patch new file mode 100644 index 0000000000000..6a24ae04d3038 --- /dev/null +++ b/recipes/glibmm/all/patches/fix_initialization_order_fiasco_2_75_0.patch @@ -0,0 +1,84 @@ +diff --git a/glib/glibmm/class.cc b/glib/glibmm/class.cc +index 31f92c61..f5befb2d 100644 +--- a/glib/glibmm/class.cc ++++ b/glib/glibmm/class.cc +@@ -166,7 +166,11 @@ Class::clone_custom_type( + } + + // Initialize the static quark to store/get custom type properties. ++#if GLIB_STATIC_COMPILATION ++GQuark Class::iface_properties_quark = 0; ++#else + GQuark Class::iface_properties_quark = g_quark_from_string("gtkmm_CustomObject_iface_properties"); ++#endif + + // static + void +diff --git a/glib/glibmm/init.cc b/glib/glibmm/init.cc +index 0b34447d..6b70a4c2 100644 +--- a/glib/glibmm/init.cc ++++ b/glib/glibmm/init.cc +@@ -14,12 +14,17 @@ + * License along with this library. If not, see . + */ + ++#include + #include + #include + #include + #include + #include + ++#if GLIB_STATIC_COMPILATION ++#include ++#endif ++ + namespace + { + bool init_to_users_preferred_locale = true; +@@ -45,6 +50,11 @@ void init() + if (is_initialized) + return; + ++#if GLIB_STATIC_COMPILATION ++ Glib::Class::iface_properties_quark = ++ g_quark_from_string("gtkmm_CustomObject_iface_properties"); ++#endif ++ + if (init_to_users_preferred_locale) + { + try +diff --git a/glib/glibmm/property.cc b/glib/glibmm/property.cc +index 56dad849..630b35b1 100644 +--- a/glib/glibmm/property.cc ++++ b/glib/glibmm/property.cc +@@ -89,8 +89,12 @@ struct custom_properties_type + }; + + // The quark used for storing/getting the custom properties of custom types. +-static const GQuark custom_properties_quark = +- g_quark_from_string("gtkmm_CustomObject_custom_properties"); ++static const GQuark& ++custom_properties_quark() ++{ ++ static GQuark custom_properties_quark_ = g_quark_from_string("gtkmm_CustomObject_custom_properties"); ++ return custom_properties_quark_; ++} + + // Delete the custom properties data when an object of a custom type is finalized. + void destroy_notify_obj_custom_props(void* data) +@@ -111,12 +115,12 @@ custom_properties_type* + get_obj_custom_props(GObject* obj) + { + auto obj_custom_props = +- static_cast(g_object_get_qdata(obj, custom_properties_quark)); ++ static_cast(g_object_get_qdata(obj, custom_properties_quark())); + if (!obj_custom_props) + { + obj_custom_props = new custom_properties_type(); + g_object_set_qdata_full( +- obj, custom_properties_quark, obj_custom_props, destroy_notify_obj_custom_props); ++ obj, custom_properties_quark(), obj_custom_props, destroy_notify_obj_custom_props); + } + return obj_custom_props; + } From bd513318409d6c433638a62760faa77f51dcbd4a Mon Sep 17 00:00:00 2001 From: Andrew Marshall Date: Fri, 27 Jan 2023 20:21:03 +0000 Subject: [PATCH 12/15] Update recipes/glibmm/all/conanfile.py Co-authored-by: Uilian Ries --- recipes/glibmm/all/conanfile.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recipes/glibmm/all/conanfile.py b/recipes/glibmm/all/conanfile.py index 1af1a9dd48f16..c7374fd2baa9c 100644 --- a/recipes/glibmm/all/conanfile.py +++ b/recipes/glibmm/all/conanfile.py @@ -65,7 +65,7 @@ def validate(self): "Linking a shared library against static glib can cause unexpected behaviour." ) - if self.options["glib"].shared and is_msvc_static_runtime(self): + if self.dependencies["glib"].options.shared and is_msvc_static_runtime(self): raise ConanInvalidConfiguration("Linking shared glib with the MSVC static runtime is not supported") def export_sources(self): From 49a583f2af79594d37d40a5c362db420081c6330 Mon Sep 17 00:00:00 2001 From: Andrew Marshall Date: Fri, 3 Feb 2023 11:29:49 +0000 Subject: [PATCH 13/15] [glibmm] enable cross compilation --- recipes/glibmm/all/conanfile.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/recipes/glibmm/all/conanfile.py b/recipes/glibmm/all/conanfile.py index c7374fd2baa9c..e41a1f6141a41 100644 --- a/recipes/glibmm/all/conanfile.py +++ b/recipes/glibmm/all/conanfile.py @@ -51,16 +51,13 @@ def _giomm_lib(self): return f"giomm-{self._abi_version}" def validate(self): - if hasattr(self, "settings_build") and cross_building(self): - raise ConanInvalidConfiguration("Cross-building not implemented") - if self.settings.compiler.get_safe("cppstd"): if self._abi_version == "2.68": check_min_cppstd(self, 17) else: check_min_cppstd(self, 11) - if self.options.shared and not self.options["glib"].shared: + if self.options.shared and not self.dependencies["glib"].shared: raise ConanInvalidConfiguration( "Linking a shared library against static glib can cause unexpected behaviour." ) From d4b6ddcfcbb81d4377ffc017ebed5c1816ed91f0 Mon Sep 17 00:00:00 2001 From: Andrew Marshall Date: Fri, 3 Feb 2023 11:35:38 +0000 Subject: [PATCH 14/15] [glibmm] reorder methods --- recipes/glibmm/all/conanfile.py | 76 +++++++++++++++++---------------- 1 file changed, 40 insertions(+), 36 deletions(-) diff --git a/recipes/glibmm/all/conanfile.py b/recipes/glibmm/all/conanfile.py index e41a1f6141a41..7a50631ac25a5 100644 --- a/recipes/glibmm/all/conanfile.py +++ b/recipes/glibmm/all/conanfile.py @@ -5,7 +5,7 @@ from conan import ConanFile from conan.errors import ConanInvalidConfiguration from conan.tools.apple import fix_apple_shared_install_name -from conan.tools.build import check_min_cppstd, cross_building +from conan.tools.build import check_min_cppstd from conan.tools.env import VirtualBuildEnv from conan.tools.files import ( apply_conandata_patches, @@ -50,6 +50,33 @@ def _glibmm_lib(self): def _giomm_lib(self): return f"giomm-{self._abi_version}" + 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") + if self.options.shared: + self.options["glib"].shared = True + + def layout(self): + basic_layout(self, src_folder="src") + + def requirements(self): + self.requires("glib/2.75.2") + if self._abi_version == "2.68": + self.requires("libsigcpp/3.0.7") + else: + self.requires("libsigcpp/2.10.8") + + def package_id(self): + if not self.options["glib"].shared: + self.info.requires["glib"].full_package_mode() + def validate(self): if self.settings.compiler.get_safe("cppstd"): if self._abi_version == "2.68": @@ -65,31 +92,18 @@ def validate(self): if self.dependencies["glib"].options.shared and is_msvc_static_runtime(self): raise ConanInvalidConfiguration("Linking shared glib with the MSVC static runtime is not supported") - def export_sources(self): - export_conandata_patches(self) - - def config_options(self): - if self.settings.os == "Windows": - del self.options.fPIC - - def layout(self): - basic_layout(self, src_folder="src") - def build_requirements(self): self.tool_requires("meson/1.0.0") - self.tool_requires("pkgconf/1.9.3") - - def requirements(self): - self.requires("glib/2.75.2") - if self._abi_version == "2.68": - self.requires("libsigcpp/3.0.7") - else: - self.requires("libsigcpp/2.10.8") + if not self.conf.get("tools.gnu:pkg_config", check_type=str): + self.tool_requires("pkgconf/1.9.3") def source(self): - get(self, **self.conan_data["sources"][self.version], strip_root=True, destination=self.source_folder) + get(self, **self.conan_data["sources"][self.version], strip_root=True) def generate(self): + env = VirtualBuildEnv(self) + env.generate() + deps = PkgConfigDeps(self) deps.generate() @@ -102,9 +116,6 @@ def generate(self): }) tc.generate() - env = VirtualBuildEnv(self) - env.generate() - def _patch_sources(self): apply_conandata_patches(self) meson_build = os.path.join(self.source_folder, "meson.build") @@ -129,12 +140,6 @@ def _patch_sources(self): # https://developercommunity.visualstudio.com/t/error-c2760-in-combaseapih-with-windows-sdk-81-and/185399 replace_in_file(self, meson_build, "cpp_std=c++", "cpp_std=vc++") - def configure(self): - if self.options.shared: - self.options.rm_safe("fPIC") - if self.options.shared: - self.options["glib"].shared = True - def build(self): self._patch_sources() meson = Meson(self) @@ -144,9 +149,12 @@ def build(self): def package(self): def rename_msvc_static_libs(): lib_folder = os.path.join(self.package_folder, "lib") - rename(self, os.path.join(lib_folder, f"libglibmm-{self._abi_version}.a"), os.path.join(lib_folder, f"{self._glibmm_lib}.lib")) - rename(self, os.path.join(lib_folder, f"libgiomm-{self._abi_version}.a"), os.path.join(lib_folder, f"{self._giomm_lib}.lib")) - rename(self, os.path.join(lib_folder, f"libglibmm_generate_extra_defs-{self._abi_version}.a"), os.path.join(lib_folder, f"glibmm_generate_extra_defs-{self._abi_version}.lib")) + rename(self, os.path.join(lib_folder, f"libglibmm-{self._abi_version}.a"), + os.path.join(lib_folder, f"{self._glibmm_lib}.lib")) + rename(self, os.path.join(lib_folder, f"libgiomm-{self._abi_version}.a"), + os.path.join(lib_folder, f"{self._giomm_lib}.lib")) + rename(self, os.path.join(lib_folder, f"libglibmm_generate_extra_defs-{self._abi_version}.a"), + os.path.join(lib_folder, f"glibmm_generate_extra_defs-{self._abi_version}.lib")) meson = Meson(self) meson.install() @@ -187,7 +195,3 @@ def package_info(self): self.cpp_info.components[giomm_component].libs = [giomm_component] self.cpp_info.components[giomm_component].includedirs = [os.path.join("include", giomm_component)] self.cpp_info.components[giomm_component].requires = [glibmm_component, "glib::gio-2.0"] - - def package_id(self): - if not self.options["glib"].shared: - self.info.requires["glib"].full_package_mode() From 24ce0b6763f0cbac54981578df31bff6edfe6245 Mon Sep 17 00:00:00 2001 From: Andrew Marshall Date: Fri, 3 Feb 2023 11:39:56 +0000 Subject: [PATCH 15/15] [glibmm] review suggestions --- recipes/glibmm/all/conanfile.py | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/recipes/glibmm/all/conanfile.py b/recipes/glibmm/all/conanfile.py index 7a50631ac25a5..ea2efe10f2484 100644 --- a/recipes/glibmm/all/conanfile.py +++ b/recipes/glibmm/all/conanfile.py @@ -74,7 +74,7 @@ def requirements(self): self.requires("libsigcpp/2.10.8") def package_id(self): - if not self.options["glib"].shared: + if not self.dependencies["glib"].options.shared: self.info.requires["glib"].full_package_mode() def validate(self): @@ -84,7 +84,7 @@ def validate(self): else: check_min_cppstd(self, 11) - if self.options.shared and not self.dependencies["glib"].shared: + if self.options.shared and not self.dependencies["glib"].options.shared: raise ConanInvalidConfiguration( "Linking a shared library against static glib can cause unexpected behaviour." ) @@ -111,8 +111,7 @@ def generate(self): tc.project_options.update({ "build-examples": "false", "build-documentation": "false", - "msvc14x-parallel-installable": "false", - "default_library": "shared" if self.options.shared else "static" + "msvc14x-parallel-installable": "false" }) tc.generate() @@ -180,17 +179,12 @@ def rename_msvc_static_libs(): def package_info(self): glibmm_component = f"glibmm-{self._abi_version}" - giomm_component = f"giomm-{self._abi_version}" - self.cpp_info.components[glibmm_component].set_property("pkg_config_name", glibmm_component) self.cpp_info.components[glibmm_component].libs = [glibmm_component] self.cpp_info.components[glibmm_component].includedirs = [os.path.join("include", glibmm_component)] + self.cpp_info.components[glibmm_component].requires = ["glib::gobject-2.0", "libsigcpp::libsigcpp"] - if self._abi_version == "2.68": - self.cpp_info.components[glibmm_component].requires = ["glib::gobject-2.0", "libsigcpp::sigc++"] - else: - self.cpp_info.components[glibmm_component].requires = ["glib::gobject-2.0", "libsigcpp::libsigcpp"] - + giomm_component = f"giomm-{self._abi_version}" self.cpp_info.components[giomm_component].set_property("pkg_config_name", giomm_component) self.cpp_info.components[giomm_component].libs = [giomm_component] self.cpp_info.components[giomm_component].includedirs = [os.path.join("include", giomm_component)]