Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

glibmm: add v2.78.0, drop static build support #22023

Merged
merged 4 commits into from
Jul 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 3 additions & 23 deletions recipes/glibmm/all/conandata.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
sources:
"2.78.1":
url: "https://download.gnome.org/sources/glibmm/2.78/glibmm-2.78.1.tar.xz"
sha256: "f473f2975d26c3409e112ed11ed36406fb3843fa975df575c22d4cb843085f61"
"2.75.0":
url: "https://download.gnome.org/sources/glibmm/2.75/glibmm-2.75.0.tar.xz"
sha256: "60bb12e66488aa8ce41f0eb2f3612f89f5ddc887e3e4d45498524bf60b266b3d"
Expand All @@ -8,26 +11,3 @@ sources:
"2.66.4":
url: "https://download.gnome.org/sources/glibmm/2.66/glibmm-2.66.4.tar.xz"
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
72 changes: 10 additions & 62 deletions recipes/glibmm/all/conanfile.py
Original file line number Diff line number Diff line change
@@ -1,22 +1,13 @@
import os
import glob
import os
import shutil

from conan import ConanFile, conan_version
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
from conan.tools.env import VirtualBuildEnv
from conan.tools.files import (
apply_conandata_patches,
copy,
export_conandata_patches,
get,
replace_in_file,
rename,
rm,
rmdir
)
from conan.tools.files import copy, get, replace_in_file, rm, rmdir
from conan.tools.gnu import PkgConfigDeps
from conan.tools.layout import basic_layout
from conan.tools.meson import Meson, MesonToolchain
Expand All @@ -33,16 +24,8 @@ class GlibmmConan(ConanFile):
url = "https://github.com/conan-io/conan-center-index"
description = "glibmm is a C++ API for parts of glib that are useful for C++."
topics = ("giomm",)
package_type = "library"
package_type = "shared-library"
settings = "os", "arch", "compiler", "build_type"
options = {
"shared": [True, False],
"fPIC": [True, False],
}
default_options = {
"shared": False,
"fPIC": True,
}
short_paths = True

@property
Expand All @@ -57,38 +40,27 @@ 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:
wildcard = "" if Version(conan_version) < "2.0.0" else "/*"
self.options[f"glib{wildcard}"].shared = True
self.options["glib"].shared = True

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

def requirements(self):
self.requires("glib/2.78.0", transitive_headers=True)
self.requires("glib/2.78.3", transitive_headers=True)
if self._abi_version == "2.68":
self.requires("libsigcpp/3.0.7", transitive_headers=True)
else:
self.requires("libsigcpp/2.10.8", transitive_headers=True)

def validate(self):
if self.settings.compiler.get_safe("cppstd"):
if self._abi_version == "2.68":
if Version(self._abi_version) >= "2.68":
check_min_cppstd(self, 17)
else:
check_min_cppstd(self, 11)

if self.options.shared and not self.dependencies["glib"].options.shared:
if not self.dependencies["glib"].options.shared:
raise ConanInvalidConfiguration(
"Linking a shared library against static glib can cause unexpected behaviour."
)
Expand All @@ -97,9 +69,9 @@ def validate(self):
raise ConanInvalidConfiguration("Linking shared glib with the MSVC static runtime is not supported")

def build_requirements(self):
self.tool_requires("meson/1.2.2")
self.tool_requires("meson/1.3.2")
if not self.conf.get("tools.gnu:pkg_config", check_type=str):
self.tool_requires("pkgconf/2.0.3")
self.tool_requires("pkgconf/2.1.0")

def source(self):
get(self, **self.conan_data["sources"][self.version], strip_root=True)
Expand All @@ -120,22 +92,9 @@ def generate(self):
tc.generate()

def _patch_sources(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:
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
Expand All @@ -150,24 +109,13 @@ def build(self):
meson.build()

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"))

meson = Meson(self)
meson.install()

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:
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")
Expand Down
32 changes: 0 additions & 32 deletions recipes/glibmm/all/patches/enable_static_libs_2_66_4.patch

This file was deleted.

32 changes: 0 additions & 32 deletions recipes/glibmm/all/patches/enable_static_libs_2_72_1.patch

This file was deleted.

32 changes: 0 additions & 32 deletions recipes/glibmm/all/patches/enable_static_libs_2_75_0.patch

This file was deleted.

Loading
Loading