Skip to content

Commit

Permalink
(#4171) Glib: fix FreeBSD
Browse files Browse the repository at this point in the history
* glib: fix FreeBSD

* glib 2.67.2

* bump meson

* disable libmount and libselinux on FreeBSD

* use gettext on FreeBSD
  • Loading branch information
ericLemanissier authored Jan 9, 2021
1 parent 17c6671 commit f74a12e
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 24 deletions.
3 changes: 3 additions & 0 deletions recipes/glib/all/conandata.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,6 @@ sources:
"2.67.1":
url: "https://gitlab.gnome.org/GNOME/glib/-/archive/2.67.1/glib-2.67.1.tar.gz"
sha256: "99861fb444a2801c1885c63504efb4cbff4d1acc0cf276c21f2c96f6b95020ad"
"2.67.2":
url: "https://gitlab.gnome.org/GNOME/glib/-/archive/2.67.2/glib-2.67.2.tar.gz"
sha256: "2ea1676b9247ffee99cbd35e8ebbba6d093707c8fa9bdfaa54e3029af208ffe0"
49 changes: 25 additions & 24 deletions recipes/glib/all/conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ def config_options(self):
del self.options.with_selinux

def build_requirements(self):
self.build_requires("meson/0.55.3")
self.build_requires("meson/0.56.1")
self.build_requires("pkgconf/1.7.3")

def requirements(self):
Expand All @@ -62,12 +62,11 @@ def requirements(self):
self.requires("pcre/8.44")
if self.options.with_elf:
self.requires("libelf/0.8.13")
if self.settings.os == "Linux":
if self.options.with_mount:
self.requires("libmount/2.36")
if self.options.with_selinux:
self.requires("libselinux/3.1")
else:
if self.options.get_safe("with_mount"):
self.requires("libmount/2.36")
if self.options.get_safe("with_selinux"):
self.requires("libselinux/3.1")
if self.settings.os != "Linux":
# for Linux, gettext is provided by libc
self.requires("libgettext/0.20.1")

Expand All @@ -84,19 +83,22 @@ def _configure_meson(self):
defs = dict()
if tools.is_apple_os(self.settings.os):
defs["iconv"] = "external" # https://gitlab.gnome.org/GNOME/glib/issues/1557
if self.settings.os == "Linux":
defs["selinux"] = "enabled" if self.options.with_selinux else "disabled"
defs["libmount"] = "enabled" if self.options.with_mount else "disabled"
defs["selinux"] = "enabled" if self.options.get_safe("with_selinux") else "disabled"
defs["libmount"] = "enabled" if self.options.get_safe("with_mount") else "disabled"
defs["internal_pcre"] = not self.options.with_pcre

if self.settings.os == "FreeBSD":
defs["xattr"] = "false"
defs["tests"] = "false"
meson.configure(source_folder=self._source_subfolder, args=["--wrap-mode=nofallback"],
build_folder=self._build_subfolder, defs=defs)
return meson

def _patch_sources(self):
tools.replace_in_file(os.path.join(self._source_subfolder, "meson.build"), \
"build_tests = not meson.is_cross_build() or (meson.is_cross_build() and meson.has_exe_wrapper())", \
"build_tests = false")
if self.version < "2.67.2":
tools.replace_in_file(os.path.join(self._source_subfolder, "meson.build"), \
"build_tests = not meson.is_cross_build() or (meson.is_cross_build() and meson.has_exe_wrapper())", \
"build_tests = false")
tools.replace_in_file(os.path.join(self._source_subfolder, "meson.build"), \
"subdir('fuzzing')", \
"#subdir('fuzzing')") # https://gitlab.gnome.org/GNOME/glib/-/issues/2152
Expand Down Expand Up @@ -145,7 +147,7 @@ def package(self):
def package_info(self):

self.cpp_info.components["glib-2.0"].libs = ["glib-2.0"]
if self.settings.os == "Linux":
if self.settings.os in ["Linux", "FreeBSD"]:
self.cpp_info.components["glib-2.0"].system_libs.append("pthread")
if self.settings.os == "Windows":
self.cpp_info.components["glib-2.0"].system_libs.extend(["ws2_32", "ole32", "shell32", "user32", "advapi32"])
Expand All @@ -162,40 +164,39 @@ def package_info(self):
self.cpp_info.components["glib-2.0"].requires.append("libiconv::libiconv")

self.cpp_info.components["gmodule-no-export-2.0"].libs = ["gmodule-2.0"]
if self.settings.os == "Linux":
if self.settings.os in ["Linux", "FreeBSD"]:
self.cpp_info.components["gmodule-no-export-2.0"].system_libs.append("pthread")
self.cpp_info.components["gmodule-no-export-2.0"].system_libs.append("dl")
self.cpp_info.components["gmodule-no-export-2.0"].requires.append("glib-2.0")

self.cpp_info.components["gmodule-export-2.0"].requires.extend(["gmodule-no-export-2.0", "glib-2.0"])
if self.settings.os == "Linux":
if self.settings.os in ["Linux", "FreeBSD"]:
self.cpp_info.components["gmodule-export-2.0"].sharedlinkflags.append("-Wl,--export-dynamic")

self.cpp_info.components["gmodule-2.0"].requires.extend(["gmodule-no-export-2.0", "glib-2.0"])
if self.settings.os == "Linux":
if self.settings.os in ["Linux", "FreeBSD"]:
self.cpp_info.components["gmodule-2.0"].sharedlinkflags.append("-Wl,--export-dynamic")

self.cpp_info.components["gobject-2.0"].libs = ["gobject-2.0"]
self.cpp_info.components["gobject-2.0"].requires.append("glib-2.0")
self.cpp_info.components["gobject-2.0"].requires.append("libffi::libffi")

self.cpp_info.components["gthread-2.0"].libs = ["gthread-2.0"]
if self.settings.os == "Linux":
if self.settings.os in ["Linux", "FreeBSD"]:
self.cpp_info.components["gthread-2.0"].system_libs.append("pthread")
self.cpp_info.components["gthread-2.0"].requires.append("glib-2.0")

self.cpp_info.components["gio-2.0"].libs = ["gio-2.0"]
if self.settings.os == "Linux":
if self.settings.os in ["Linux", "FreeBSD"]:
self.cpp_info.components["gio-2.0"].system_libs.append("resolv")
self.cpp_info.components["gio-2.0"].system_libs.append("dl")
self.cpp_info.components["gio-2.0"].requires.extend(["glib-2.0", "gobject-2.0", "gmodule-2.0", "zlib::zlib"])
if self.settings.os == "Macos":
self.cpp_info.components["gio-2.0"].frameworks.append("AppKit")
if self.settings.os == "Linux":
if self.options.with_mount:
self.cpp_info.components["gio-2.0"].requires.append("libmount::libmount")
if self.options.with_selinux:
self.cpp_info.components["gio-2.0"].requires.append("libselinux::libselinux")
if self.options.get_safe("with_mount"):
self.cpp_info.components["gio-2.0"].requires.append("libmount::libmount")
if self.options.get_safe("with_selinux"):
self.cpp_info.components["gio-2.0"].requires.append("libselinux::libselinux")
if self.settings.os == "Windows":
self.cpp_info.components["gio-windows-2.0"].requires = ["gobject-2.0", "gmodule-no-export-2.0", "gio-2.0"]
self.cpp_info.components["gio-windows-2.0"].includedirs = [os.path.join('include', 'gio-win32-2.0')]
Expand Down
2 changes: 2 additions & 0 deletions recipes/glib/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,5 @@ versions:
folder: all
"2.67.1":
folder: all
"2.67.2":
folder: all

0 comments on commit f74a12e

Please sign in to comment.