Skip to content

Commit

Permalink
avoid unecessary call to package manager (#25399)
Browse files Browse the repository at this point in the history
When building for an OS different from Linux, FreeBSD or SunOS, don't try to call a sytem package manager. It may actually install a useless OpenGL system library (ie unrelated to host OS) when build machine is Linux, FreeBSD or SunOS.

Also support SunOS by trying PkgUtil system package manager.
  • Loading branch information
SpaceIm authored Nov 5, 2024
1 parent 52a6b2e commit 9e1b52f
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions recipes/opengl/all/conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ def package_id(self):
self.info.clear()

def system_requirements(self):
if self.settings.os not in ["Linux", "FreeBSD", "SunOS"]:
return

dnf = package_manager.Dnf(self)
dnf.install_substitutes(["libglvnd-devel"], ["mesa-libGL-devel"], update=True, check=True)

Expand All @@ -36,12 +39,15 @@ def system_requirements(self):
pacman.install(["libglvnd"], update=True, check=True)

zypper = package_manager.Zypper(self)
zypper.install_substitutes(["Mesa-libGL-devel", "glproto-devel"],
zypper.install_substitutes(["Mesa-libGL-devel", "glproto-devel"],
["Mesa-libGL-devel", "xorgproto-devel"], update=True, check=True)

pkg = package_manager.Pkg(self)
pkg.install(["libglvnd"], update=True, check=True)

pkg_util = package_manager.PkgUtil(self)
pkg_util.install(["mesalibs"], update=True, check=True)

def package_info(self):
# TODO: Workaround for #2311 until a better solution can be found
self.cpp_info.filenames["cmake_find_package"] = "opengl_system"
Expand All @@ -57,6 +63,6 @@ def package_info(self):
self.cpp_info.frameworks.append("OpenGL")
elif self.settings.os == "Windows":
self.cpp_info.system_libs = ["opengl32"]
elif self.settings.os in ["Linux", "FreeBSD"]:
elif self.settings.os in ["Linux", "FreeBSD", "SunOS"]:
pkg_config = PkgConfig(self, 'gl')
pkg_config.fill_cpp_info(self.cpp_info, is_system=self.settings.os != "FreeBSD")

0 comments on commit 9e1b52f

Please sign in to comment.