from conans import ConanFile, CMake, tools import os class LibOggConan(ConanFile): name = "libogg" version = "1.3.4" license = "BSD-2-Clause" author = "Shawn Morford " url = "https://code.darkmorford.net/conan-pkg/libogg" description = ("Ogg is a multimedia container format, and the native file and stream format for the " "Xiph.org multimedia codecs. As with all Xiph.org technology it is an open format " "free for anyone to use.") homepage = "https://www.xiph.org/ogg/" topics = ("xiph.org", "media", "container") exports_sources = ["CMakeLists.txt", "patches/*"] settings = "os", "compiler", "build_type", "arch" options = {"shared": [True, False], "fPIC": [True, False]} default_options = {"shared": False, "fPIC": True} generators = "cmake" @property def subfolder(self): return os.path.join(self.source_folder, f"libogg-{self.version}") def config_options(self): if self.settings.os == "Windows": self.options.remove("fPIC") def configure(self): del self.settings.compiler.cppstd del self.settings.compiler.libcxx def source(self): tools.get(**self.conan_data["sources"][self.version]) for patch in self.conan_data["patches"][self.version]: tools.patch(base_path=self.subfolder, **patch) def _configure_cmake(self): cmake = CMake(self) cmake.definitions["CONAN_SOURCE_LOCATION"] = self.subfolder cmake.definitions["BUILD_TESTING"] = False cmake.definitions["INSTALL_CMAKE_PACKAGE_MODULE"] = False cmake.definitions["INSTALL_DOCS"] = False cmake.definitions["INSTALL_PKG_CONFIG_MODULE"] = False cmake.configure() return cmake def build(self): cmake = self._configure_cmake() cmake.build() def package(self): cmake = self._configure_cmake() cmake.install() self.copy("COPYING", src=self.subfolder, dst="licenses", keep_path=False) def package_info(self): self.cpp_info.libs = ["ogg"]