conanfile.py 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. from conans import ConanFile, CMake, tools
  2. import os
  3. class LibOggConan(ConanFile):
  4. name = "libogg"
  5. version = "1.3.4"
  6. license = "BSD-2-Clause"
  7. author = "Shawn Morford <DarkMorford@Gmail.com>"
  8. url = "https://code.darkmorford.net/conan-pkg/libogg"
  9. description = ("Ogg is a multimedia container format, and the native file and stream format for the "
  10. "Xiph.org multimedia codecs. As with all Xiph.org technology it is an open format "
  11. "free for anyone to use.")
  12. homepage = "https://www.xiph.org/ogg/"
  13. topics = ("xiph.org", "media", "container")
  14. exports_sources = ["CMakeLists.txt", "patches/*"]
  15. settings = "os", "compiler", "build_type", "arch"
  16. options = {"shared": [True, False], "fPIC": [True, False]}
  17. default_options = {"shared": False, "fPIC": True}
  18. generators = "cmake"
  19. @property
  20. def subfolder(self):
  21. return os.path.join(self.source_folder, f"libogg-{self.version}")
  22. def config_options(self):
  23. if self.settings.os == "Windows":
  24. self.options.remove("fPIC")
  25. def configure(self):
  26. del self.settings.compiler.cppstd
  27. del self.settings.compiler.libcxx
  28. def source(self):
  29. tools.get(**self.conan_data["sources"][self.version])
  30. for patch in self.conan_data["patches"][self.version]:
  31. tools.patch(base_path=self.subfolder, **patch)
  32. def _configure_cmake(self):
  33. cmake = CMake(self)
  34. cmake.definitions["CONAN_SOURCE_LOCATION"] = self.subfolder
  35. cmake.definitions["BUILD_TESTING"] = False
  36. cmake.definitions["INSTALL_CMAKE_PACKAGE_MODULE"] = False
  37. cmake.definitions["INSTALL_DOCS"] = False
  38. cmake.definitions["INSTALL_PKG_CONFIG_MODULE"] = False
  39. cmake.configure()
  40. return cmake
  41. def build(self):
  42. cmake = self._configure_cmake()
  43. cmake.build()
  44. def package(self):
  45. cmake = self._configure_cmake()
  46. cmake.install()
  47. self.copy("COPYING", src=self.subfolder, dst="licenses", keep_path=False)
  48. def package_info(self):
  49. self.cpp_info.libs = ["ogg"]