Created
November 28, 2025 13:59
-
-
Save Talkless/18c883b532a49618af86a2d234ab13d7 to your computer and use it in GitHub Desktop.
GStreamer conan recipies modified to work with Conan 2.x (not upstreamed yet), including new gst-rtsp-server
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from conan import ConanFile | |
| from conan.tools.meson import Meson, MesonToolchain | |
| from conan.tools.env import VirtualBuildEnv | |
| from conan.tools.layout import basic_layout | |
| from conan.tools.files import get, copy, rmdir, rm, patch, chdir | |
| from conan.errors import ConanInvalidConfiguration | |
| from conan.tools.scm import Version | |
| from conan.tools.microsoft import msvc_runtime_flag | |
| import glob | |
| import os | |
| import shutil | |
| class GStLibAVConan(ConanFile): | |
| package_type = "library" | |
| name = "gst-libav" | |
| description = "GStreamer is a development framework for creating applications like media players, video editors, " \ | |
| "streaming media broadcasters and so on" | |
| topics = ("gstreamer", "multimedia", "video", "audio", "broadcasting", "framework", "media") | |
| url = "https://github.com/conan-io/conan-center-index" | |
| homepage = "https://gstreamer.freedesktop.org/" | |
| license = "GPL-2.0-only" | |
| settings = "os", "arch", "compiler", "build_type" | |
| options = { | |
| "shared": [True, False], | |
| "fPIC": [True, False], | |
| } | |
| default_options = { | |
| "shared": False, | |
| "fPIC": True, | |
| } | |
| exports_sources = ["patches/*.patch"] | |
| generators = "PkgConfigDeps" | |
| @property | |
| def _is_msvc(self): | |
| return self.settings.compiler == "msvc" | |
| def validate(self): | |
| if self.options.shared != self.dependencies["gstreamer"].options.get_safe("shared") or \ | |
| self.options.shared != self.dependencies["glib"].options.get_safe("shared") or \ | |
| self.options.shared != self.dependencies["gst-plugins-base"].options.get_safe("shared"): | |
| # https://gitlab.freedesktop.org/gstreamer/gst-build/-/issues/133 | |
| raise ConanInvalidConfiguration("GLib, GStreamer and GstPlugins must be either all shared, or all static") | |
| if Version(self.version) >= "1.18.2" and\ | |
| self.settings.compiler == "gcc" and\ | |
| Version(self.settings.compiler.version) < "5": | |
| raise ConanInvalidConfiguration( | |
| "gst-plugins-good %s does not support gcc older than 5" % self.version | |
| ) | |
| if self.options.shared and str(msvc_runtime_flag(self)).startswith("MT"): | |
| raise ConanInvalidConfiguration('shared build with static runtime is not supported due to the FlsAlloc limit') | |
| def configure(self): | |
| if self.options.shared: | |
| del self.options.fPIC | |
| del self.settings.compiler.libcxx | |
| del self.settings.compiler.cppstd | |
| def config_options(self): | |
| if self.settings.os == 'Windows': | |
| del self.options.fPIC | |
| def requirements(self): | |
| self.requires("glib/2.74.0@#4") | |
| self.requires("gstreamer/1.19.1") | |
| self.requires("gst-plugins-base/1.19.1") | |
| self.requires('ffmpeg/4.4') | |
| if self.settings.os == 'Linux': | |
| self.requires('libalsa/1.2.5.1') # temp - conflict with gst-plugins-base | |
| def build_requirements(self): | |
| self.tool_requires("meson/0.62.2") | |
| self.tool_requires("pkgconf/1.7.4") | |
| if self.settings.os == 'Windows': | |
| self.tool_requires("winflexbison/2.5.24") | |
| else: | |
| self.tool_requires("bison/3.7.6") | |
| self.tool_requires("flex/2.6.4") | |
| def layout(self): | |
| basic_layout(self, src_folder="src") | |
| def source(self): | |
| get(self, **self.conan_data["sources"][self.version], strip_root=True) | |
| def generate(self): | |
| tool_chain = MesonToolchain(self) | |
| def add_flag(name, value): | |
| if name in defs: | |
| tool_chain.project_options[name] += " " + value | |
| else: | |
| tool_chain.project_options[name] = value | |
| def add_compiler_flag(value): | |
| add_flag("c_args", value) | |
| add_flag("cpp_args", value) | |
| def add_linker_flag(value): | |
| add_flag("c_link_args", value) | |
| add_flag("cpp_link_args", value) | |
| if self.settings.compiler == "msvc": | |
| add_linker_flag("-lws2_32") | |
| add_compiler_flag("-%s" % self.settings.compiler.runtime) | |
| if int(str(self.settings.compiler.version)) < 14: | |
| add_compiler_flag("-Dsnprintf=_snprintf") | |
| if self.settings.get_safe("compiler.runtime"): | |
| tool_chain.project_options["b_vscrt"] = str(self.settings.compiler.runtime).lower() | |
| if self.version > "1.18.4": | |
| tool_chain.project_options["tests"] = "disabled" | |
| tool_chain.generate() | |
| env = VirtualBuildEnv(self) | |
| env.generate(scope="build") | |
| def build(self): | |
| for p in self.conan_data.get("patches", {}).get(self.version, []): | |
| patch(self, **p) | |
| meson = Meson(self) | |
| meson.configure() | |
| meson.build() | |
| def _fix_library_names(self, path): | |
| # regression in 1.16 | |
| if self.settings.compiler == "msvc": | |
| with chdir(self, path): | |
| for filename_old in glob.glob("*.a"): | |
| filename_new = filename_old[3:-2] + ".lib" | |
| self.output.info("rename %s into %s" % (filename_old, filename_new)) | |
| shutil.move(filename_old, filename_new) | |
| def package(self): | |
| copy(self, "COPYING", dst="licenses", src=self.source_folder) | |
| meson = Meson(self) | |
| meson.install() | |
| self._fix_library_names(os.path.join(self.package_folder, "lib")) | |
| self._fix_library_names(os.path.join(self.package_folder, "lib", "gstreamer-1.0")) | |
| rmdir(self, os.path.join(self.package_folder, "share")) | |
| rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) | |
| rmdir(self, os.path.join(self.package_folder, "lib", "gstreamer-1.0", "pkgconfig")) | |
| rm(self, "*.pdb", self.package_folder) | |
| def package_info(self): | |
| plugins = ["libav"] | |
| gst_plugin_path = os.path.join(self.package_folder, "lib", "gstreamer-1.0") | |
| if self.options.shared: | |
| self.output.info("Appending GST_PLUGIN_PATH env var : %s" % gst_plugin_path) | |
| self.cpp_info.bindirs.append(gst_plugin_path) | |
| self.runenv_info.prepend_path("GST_PLUGIN_PATH", gst_plugin_path) | |
| self.env_info.GST_PLUGIN_PATH.append(gst_plugin_path) | |
| else: | |
| self.cpp_info.defines.append("GST_LIBAV_STATIC") | |
| self.cpp_info.libdirs.append(gst_plugin_path) | |
| self.cpp_info.libs.extend(["gst%s" % plugin for plugin in plugins]) | |
| self.cpp_info.includedirs = ["include", os.path.join("include", "gstreamer-1.0")] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from conan import ConanFile | |
| from conan.tools.meson import Meson, MesonToolchain | |
| from conan.tools.layout import basic_layout | |
| from conan.tools.env import VirtualBuildEnv | |
| from conan.errors import ConanInvalidConfiguration | |
| from conan.tools.microsoft import msvc_runtime_flag | |
| from conan.tools.files import get, copy, rmdir, rm, patch, chdir | |
| from conan.tools.scm import Version | |
| from conan.tools.gnu import PkgConfigDeps | |
| from conan.tools.build import cross_building | |
| import glob | |
| import os | |
| import shutil | |
| class GStPluginsBadConan(ConanFile): | |
| package_type = "library" | |
| name = "gst-plugins-bad" | |
| description = "GStreamer is a development framework for creating applications like media players, video editors, " \ | |
| "streaming media broadcasters and so on" | |
| topics = ("gstreamer", "multimedia", "video", "audio", "broadcasting", "framework", "media") | |
| url = "https://github.com/conan-io/conan-center-index" | |
| homepage = "https://gstreamer.freedesktop.org/" | |
| license = "GPL-2.0-only" | |
| settings = "os", "arch", "compiler", "build_type" | |
| options = { | |
| "shared": [True, False], | |
| "fPIC": [True, False], | |
| "with_introspection": [True, False], | |
| "with_vaapi": [True, False], | |
| } | |
| default_options = { | |
| "shared": False, | |
| "fPIC": True, | |
| "with_introspection": False, | |
| "with_vaapi": True, | |
| } | |
| exports_sources = ["patches/*.patch"] | |
| generators = "PkgConfigDeps" | |
| def validate(self): | |
| if self.options.shared != self.dependencies["gstreamer"].options.get_safe("shared") or \ | |
| self.options.shared != self.dependencies["glib"].options.get_safe("shared") or \ | |
| self.options.shared != self.dependencies["gst-plugins-base"].options.get_safe("shared"): | |
| # https://gitlab.freedesktop.org/gstreamer/gst-build/-/issues/133 | |
| raise ConanInvalidConfiguration("GLib, GStreamer and GstPlugins must be either all shared, or all static") | |
| if Version(self.version) >= "1.18.2" and\ | |
| self.settings.compiler == "gcc" and\ | |
| Version(self.settings.compiler.version) < "5": | |
| raise ConanInvalidConfiguration( | |
| "gst-plugins-bad %s does not support gcc older than 5" % self.version | |
| ) | |
| if self.options.shared and str(msvc_runtime_flag(self)).startswith("MT"): | |
| raise ConanInvalidConfiguration('shared build with static runtime is not supported due to the FlsAlloc limit') | |
| def configure(self): | |
| if self.options.shared: | |
| del self.options.fPIC | |
| del self.settings.compiler.libcxx | |
| del self.settings.compiler.cppstd | |
| def config_options(self): | |
| if self.settings.os == 'Windows': | |
| del self.options.fPIC | |
| if self.settings.os != "Linux": | |
| del self.options.with_vaapi | |
| def requirements(self): | |
| self.requires("glib/2.74.0@#4") | |
| self.requires("gstreamer/1.19.1") | |
| self.requires("gst-plugins-base/1.19.1") | |
| if self.options.get_safe("with_vaapi"): | |
| self.requires("vaapi/system") | |
| def build_requirements(self): | |
| self.tool_requires("meson/0.62.2") | |
| self.tool_requires("pkgconf/1.9.3") | |
| if self.settings.os == 'Windows': | |
| self.tool_requires("winflexbison/2.5.24") | |
| else: | |
| self.tool_requires("bison/3.7.6") | |
| self.tool_requires("flex/2.6.4") | |
| if self.options.with_introspection: | |
| self.build_requires("gobject-introspection/1.68.0") | |
| def layout(self): | |
| basic_layout(self, src_folder="src") | |
| def source(self): | |
| get(self, **self.conan_data["sources"][self.version], strip_root=True) | |
| def generate(self): | |
| tool_chain = MesonToolchain(self) | |
| def add_flag(name, value): | |
| if name in defs: | |
| tool_chain.project_options[name] += " " + value | |
| else: | |
| tool_chain.project_options[name] = value | |
| def add_compiler_flag(value): | |
| add_flag("c_args", value) | |
| add_flag("cpp_args", value) | |
| def add_linker_flag(value): | |
| add_flag("c_link_args", value) | |
| add_flag("cpp_link_args", value) | |
| if self.settings.compiler == "msvc": | |
| add_linker_flag("-lws2_32") | |
| add_compiler_flag("-%s" % self.settings.compiler.runtime) | |
| if int(str(self.settings.compiler.version)) < 14: | |
| add_compiler_flag("-Dsnprintf=_snprintf") | |
| if self.settings.get_safe("compiler.runtime"): | |
| tool_chain.project_options["b_vscrt"] = str(self.settings.compiler.runtime).lower() | |
| tool_chain.project_options["examples"] = "disabled" | |
| tool_chain.project_options["tests"] = "disabled" | |
| tool_chain.project_options["wrap_mode"] = "nofallback" | |
| tool_chain.project_options["introspection"] = "enabled" if self.options.with_introspection else "disabled" | |
| tool_chain.project_options["va"] = "enabled" if self.options.get_safe("with_vaapi") else "disabled" | |
| tool_chain.generate() | |
| env = VirtualBuildEnv(self) | |
| env.generate(scope="build") | |
| def build(self): | |
| for p in self.conan_data.get("patches", {}).get(self.version, []): | |
| patch(self, **p) | |
| meson = Meson(self) | |
| meson.configure() | |
| meson.build() | |
| def _fix_library_names(self, path): | |
| # regression in 1.16f | |
| if self.settings.compiler == "msvc": | |
| with chdir(self, path): | |
| for filename_old in glob.glob("*.a"): | |
| filename_new = filename_old[3:-2] + ".lib" | |
| self.output.info("rename %s into %s" % (filename_old, filename_new)) | |
| shutil.move(filename_old, filename_new) | |
| def package(self): | |
| copy(self, "COPYING", dst="licenses", src=self.source_folder) | |
| meson = Meson(self) | |
| meson.install() | |
| self._fix_library_names(os.path.join(self.package_folder, "lib")) | |
| self._fix_library_names(os.path.join(self.package_folder, "lib", "gstreamer-1.0")) | |
| rmdir(self, os.path.join(self.package_folder, "share")) | |
| rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) | |
| rmdir(self, os.path.join(self.package_folder, "lib", "gstreamer-1.0", "pkgconfig")) | |
| rm(self, "*.pdb", self.package_folder) | |
| def package_info(self): | |
| plugins = ["accurip", | |
| "adpcmdec", | |
| "adpcmenc", | |
| "aiff", | |
| "asfmux", | |
| "audiobuffersplit", | |
| "audiofxbad", | |
| "audiolatency", | |
| "audiomixmatrix", | |
| "audiovisualizers", | |
| "autoconvert", | |
| "av", | |
| "bayer", | |
| "camerabin", | |
| "codecalpha", | |
| "coloreffects", | |
| "debugutilsbad", | |
| "dvbsubenc", | |
| "dvbsuboverlay", | |
| "dvdspu", | |
| "faceoverlay", | |
| "festival", | |
| "fieldanalysis", | |
| "freeverb", | |
| "frei0r", | |
| "gaudieffects", | |
| "gdp", | |
| "geometrictransform", | |
| "id3tag", | |
| "inter", | |
| "interlace", | |
| "ivfparse", | |
| "ivtc", | |
| "jp2kdecimator", | |
| "jpegformat", | |
| "rfbsrc", | |
| "midi", | |
| "mpegpsdemux", | |
| "mpegpsmux", | |
| "mpegtsdemux", | |
| "mpegtsmux", | |
| "mxf", | |
| "netsim", | |
| "rtponvif", | |
| "pcapparse", | |
| "pnm", | |
| "proxy", | |
| "legacyrawparse", | |
| "removesilence", | |
| "rist", | |
| "rtmp2", | |
| "rtpmanagerbad", | |
| "sdpelem", | |
| "segmentclip", | |
| "siren", | |
| "smooth", | |
| "speed", | |
| "subenc", | |
| "switchbin", | |
| "timecode", | |
| "transcode", | |
| "videofiltersbad", | |
| "videoframe_audiolevel", | |
| "videoparsersbad", | |
| "videosignal", | |
| "vmnc", | |
| "y4mdec"] | |
| self.cpp_info.components["gstreamer-codecparsers-1.0"].names["pkg_config"] = "gstreamer-codecparsers-1.0" | |
| self.cpp_info.components["gstreamer-codecparsers-1.0"].requires = ["gstreamer::gstreamer", "gst-plugins-base::gst-plugins-base", "glib::glib"] | |
| self.cpp_info.components["gstreamer-codecparsers-1.0"].libs = ["gstcodecparsers-1.0"] | |
| self.cpp_info.components["gstreamer-codecparsers-1.0"].includedirs = [os.path.join("include", "gstreamer-1.0")] | |
| # vaapi plugin is not a component, but it needs vaapi. | |
| # this avoids "The direct dependency 'vaapi' is not used by any '(cpp_info/components).requires'." error | |
| if self.options.get_safe("with_vaapi"): | |
| self.cpp_info.components["gst-vaapi-placeholder"].requires = ["vaapi::vaapi"] | |
| gst_plugin_path = os.path.join(self.package_folder, "lib", "gstreamer-1.0") | |
| if self.options.shared: | |
| #self.output.info("Appending GST_PLUGIN_PATH env var : %s" % gst_plugin_path) | |
| #self.cpp_info.bindirs.append(gst_plugin_path) | |
| self.runenv_info.prepend_path("GST_PLUGIN_PATH", gst_plugin_path) | |
| self.env_info.GST_PLUGIN_PATH.append(gst_plugin_path) | |
| #else: | |
| #self.cpp_info.defines.append("GST_PLUGINS_BAD_STATIC") | |
| #self.cpp_info.libdirs.append(gst_plugin_path) | |
| #self.cpp_info.libs.extend(["gst%s" % plugin for plugin in plugins]) | |
| #self.cpp_info.includedirs = ["include", os.path.join("include", "gstreamer-1.0")] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from conan import ConanFile | |
| from conan.errors import ConanInvalidConfiguration | |
| from conan.tools.meson import Meson, MesonToolchain | |
| from conan.tools.env import VirtualBuildEnv | |
| from conan.tools.layout import basic_layout | |
| from conan.tools.files import get, copy, patch, chdir, rmdir, rm | |
| from conan.tools.scm import Version | |
| from conan.tools.build import cross_building | |
| import contextlib | |
| import glob | |
| import os | |
| import shutil | |
| class GStPluginsBaseConan(ConanFile): | |
| package_type = "library" | |
| name = "gst-plugins-base" | |
| description = "GStreamer is a development framework for creating applications like media players, video editors, " \ | |
| "streaming media broadcasters and so on" | |
| topics = ("gstreamer", "multimedia", "video", "audio", "broadcasting", "framework", "media") | |
| url = "https://github.com/conan-io/conan-center-index" | |
| homepage = "https://gstreamer.freedesktop.org/" | |
| license = "GPL-2.0-only" | |
| settings = "os", "arch", "compiler", "build_type" | |
| options = { | |
| "shared": [True, False], | |
| "fPIC": [True, False], | |
| "with_libalsa": [True, False], | |
| "with_libpng": [True, False], | |
| "with_libjpeg": [False, "libjpeg", "libjpeg-turbo"], | |
| "with_graphene": [True, False], | |
| "with_pango": [True, False], | |
| "with_ogg": [True, False], | |
| "with_opus": [True, False], | |
| "with_theora": [True, False], | |
| "with_vorbis": [True, False], | |
| "with_gl": [True, False], | |
| "with_glesv2": [True, False], | |
| "with_egl": [True, False], | |
| "with_viv_fb": [ True, False], | |
| "with_wayland": [True, False], | |
| "with_xorg": [True, False], | |
| "with_introspection": [True, False], | |
| } | |
| default_options = { | |
| "shared": False, | |
| "fPIC": True, | |
| "with_libalsa": True, | |
| "with_libpng": True, | |
| "with_libjpeg": "libjpeg", | |
| "with_graphene": True, | |
| "with_pango": True, | |
| "with_ogg": True, | |
| "with_opus": True, | |
| "with_theora": True, | |
| "with_vorbis": True, | |
| "with_gl": True, | |
| "with_glesv2": False, | |
| "with_egl": True, | |
| "with_viv_fb" : False, | |
| "with_wayland": True, | |
| "with_xorg": True, | |
| "with_introspection": False, | |
| } | |
| exports_sources = ["patches/*.patch"] | |
| generators = "PkgConfigDeps" | |
| _gl_api = None | |
| _gl_platform = None | |
| _gl_winsys = None | |
| @property | |
| def _is_msvc(self): | |
| return self.settings.compiler == "msvc" | |
| def validate(self): | |
| if not self.dependencies["glib"].options.get_safe("shared") and self.options.shared: | |
| # https://gitlab.freedesktop.org/gstreamer/gst-build/-/issues/133 | |
| raise ConanInvalidConfiguration("shared GStreamer cannot link to static GLib") | |
| if self.options.shared != self.dependencies["gstreamer"].options.get_safe("shared"): | |
| # https://gitlab.freedesktop.org/gstreamer/gst-build/-/issues/133 | |
| raise ConanInvalidConfiguration("GStreamer and GstPlugins must be either all shared, or all static") | |
| if Version(self.version) >= "1.18.2" and\ | |
| self.settings.compiler == "gcc" and\ | |
| Version(self.settings.compiler.version) < "5": | |
| raise ConanInvalidConfiguration( | |
| "gst-plugins-base %s does not support gcc older than 5" % self.version | |
| ) | |
| if self.options.with_gl and self.options.get_safe("with_wayland") and not self.options.get_safe("with_egl"): | |
| raise ConanInvalidConfiguration("OpenGL support with Wayland requires 'with_egl' turned on!") | |
| if self.options.get_safe("with_gl") and self.options.get_safe("with_glesv2"): | |
| raise ConanInvalidConfiguration("Cannot use both OpenGL AND GLES2 at the same time") | |
| if self.options.get_safe("with_viv_fb") and not self.options.get_safe("with_egl"): | |
| raise ConanInvalidConfiguration("egl must be enabled to use viv_fb") | |
| def configure(self): | |
| if self.options.shared: | |
| del self.options.fPIC | |
| del self.settings.compiler.libcxx | |
| del self.settings.compiler.cppstd | |
| self.options['gstreamer'].shared = self.options.shared | |
| def config_options(self): | |
| if self.settings.os == 'Windows': | |
| del self.options.fPIC | |
| if self.settings.os != "Linux": | |
| del self.options.with_libalsa | |
| del self.options.with_wayland | |
| if self.settings.os not in ["Linux", "FreeBSD"]: | |
| del self.options.with_egl | |
| del self.options.with_xorg | |
| def requirements(self): | |
| self.requires("zlib/1.2.12") | |
| self.requires("glib/2.74.0") | |
| self.requires("gstreamer/1.19.2") | |
| if self.options.get_safe("with_libalsa"): | |
| self.requires("libalsa/1.2.5.1") | |
| if self.options.get_safe("with_xorg"): | |
| self.requires("xorg/system") | |
| if self.options.with_gl or self.options.with_glesv2: | |
| if self.options.with_gl: | |
| self.requires("opengl/system") | |
| if self.options.with_glesv2: | |
| self.requires("glesv2/system@mycompany/stable") | |
| if self.settings.os == "Windows": | |
| self.requires("wglext/cci.20200813") | |
| self.requires('glext/cci.20210420') | |
| if self.options.get_safe("with_egl"): | |
| self.requires("egl/system") | |
| if self.options.get_safe("with_wayland"): | |
| self.requires("wayland/1.20.0") | |
| self.requires("wayland-protocols/1.25") | |
| if self.options.with_graphene: | |
| self.requires("graphene/1.10.8") | |
| if self.options.with_libpng: | |
| self.requires("libpng/1.6.37") | |
| if self.options.with_libjpeg == "libjpeg": | |
| self.requires("libjpeg/9d") | |
| elif self.options.with_libjpeg == "libjpeg-turbo": | |
| self.requires("libjpeg-turbo/2.1.2") | |
| if self.options.with_ogg: | |
| self.requires("ogg/1.3.5") | |
| if self.options.with_opus: | |
| self.requires("opus/1.3.1") | |
| if self.options.with_theora: | |
| self.requires("theora/1.1.1") | |
| if self.options.with_vorbis: | |
| self.requires("vorbis/1.3.7") | |
| if self.options.with_pango: | |
| self.requires("pango/1.49.3") | |
| def build_requirements(self): | |
| self.tool_requires("meson/0.62.2") | |
| self.tool_requires("pkgconf/1.9.3") | |
| if self.settings.os == 'Windows': | |
| self.build_requires("winflexbison/2.5.24") | |
| else: | |
| self.build_requires("bison/3.7.6") | |
| self.build_requires("flex/2.6.4") | |
| if self.options.with_introspection: | |
| self.build_requires("gobject-introspection/1.70.0") | |
| def layout(self): | |
| basic_layout(self, src_folder="src") | |
| def source(self): | |
| get(self, **self.conan_data["sources"][self.version], strip_root=True) | |
| def generate(self): | |
| tool_chain = MesonToolchain(self) | |
| def add_flag(name, value): | |
| if name in tool_chain.project_options: | |
| tool_chain.project_options[name] += " " + value | |
| else: | |
| tool_chain.project_options[name] = value | |
| def add_compiler_flag(value): | |
| add_flag("c_args", value) | |
| add_flag("cpp_args", value) | |
| def add_linker_flag(value): | |
| add_flag("c_link_args", value) | |
| add_flag("cpp_link_args", value) | |
| if self.settings.compiler == "msvc": | |
| add_linker_flag("-lws2_32") | |
| add_compiler_flag("-%s" % self.settings.compiler.runtime) | |
| if int(str(self.settings.compiler.version)) < 14: | |
| add_compiler_flag("-Dsnprintf=_snprintf") | |
| if self.settings.get_safe("compiler.runtime"): | |
| tool_chain.project_options["b_vscrt"] = str(self.settings.compiler.runtime).lower() | |
| gl_api, gl_platform, gl_winsys = self._gl_config() | |
| with_any_gl = self.options.with_gl or self.options.with_glesv2 | |
| tool_chain.project_options["tools"] = "disabled" | |
| tool_chain.project_options["examples"] = "disabled" | |
| tool_chain.project_options["tests"] = "disabled" | |
| tool_chain.project_options["wrap_mode"] = "nofallback" | |
| tool_chain.project_options["introspection"] = "enabled" if self.options.with_introspection else "disabled" | |
| tool_chain.project_options["orc"] = "disabled" # TODO: orc | |
| tool_chain.project_options["gl"] = "enabled" if with_any_gl else "disabled" | |
| tool_chain.project_options["gl-graphene"] = "enabled" if with_any_gl and self.options.with_graphene else "disabled" | |
| tool_chain.project_options["gl-png"] = "enabled" if with_any_gl and self.options.with_libpng else "disabled" | |
| tool_chain.project_options["gl-jpeg"] = "enabled" if with_any_gl and self.options.with_libjpeg else "disabled" | |
| tool_chain.project_options["gl_api"] = gl_api | |
| tool_chain.project_options["gl_platform"] = gl_platform | |
| tool_chain.project_options["gl_winsys"] = gl_winsys | |
| tool_chain.project_options["alsa"] = "enabled" if self.options.get_safe("with_libalsa") else "disabled" | |
| tool_chain.project_options["cdparanoia"] = "disabled" # "enabled" if self.options.with_cdparanoia else "disabled" # TODO: cdparanoia | |
| tool_chain.project_options["libvisual"] = "disabled" # "enabled" if self.options.with_libvisual else "disabled" # TODO: libvisual | |
| tool_chain.project_options["ogg"] = "enabled" if self.options.with_ogg else "disabled" | |
| tool_chain.project_options["opus"] = "enabled" if self.options.with_opus else "disabled" | |
| tool_chain.project_options["pango"] = "enabled" if self.options.with_pango else "disabled" | |
| tool_chain.project_options["theora"] = "enabled" if self.options.with_theora else "disabled" | |
| tool_chain.project_options["tremor"] = "disabled" # "enabled" if self.options.with_tremor else "disabled" # TODO: tremor - only useful on machines without floating-point support | |
| tool_chain.project_options["vorbis"] = "enabled" if self.options.with_vorbis else "disabled" | |
| tool_chain.project_options["x11"] = "enabled" if self.options.get_safe("with_xorg") else "disabled" | |
| tool_chain.project_options["xshm"] = "enabled" if self.options.get_safe("with_xorg") else "disabled" | |
| tool_chain.project_options["xvideo"] = "enabled" if self.options.get_safe("with_xorg") else "disabled" | |
| tool_chain.generate() | |
| env = VirtualBuildEnv(self) | |
| env.generate(scope="build") | |
| def _gl_config(self): | |
| if not self._gl_api or not self._gl_platform or not self._gl_winsys: | |
| gl_api = set() | |
| gl_platform = set() | |
| gl_winsys = set() # TODO: winrt, dispamnx, viv-fb, gbm, android | |
| if self.options.get_safe("with_glesv2"): | |
| gl_api.add("gles2") | |
| if self.options.get_safe("with_egl"): | |
| if self.options.get_safe("with_gl"): | |
| gl_api.add("opengl") | |
| gl_platform.add("egl") | |
| gl_winsys.add("egl") | |
| if self.options.get_safe("with_viv_fb"): | |
| gl_winsys.add("viv-fb") | |
| if self.options.get_safe("with_xorg"): | |
| gl_api.add("opengl") | |
| gl_platform.add("glx") | |
| gl_winsys.add("x11") | |
| if self.options.get_safe("with_wayland"): | |
| gl_api.add("opengl") | |
| gl_platform.add("egl") | |
| gl_winsys.add("wayland") | |
| if self.settings.os == "Macos": | |
| gl_api.add("opengl") | |
| gl_platform.add("cgl") | |
| gl_winsys.add("cocoa") | |
| elif self.settings.os in ["iOS", "tvOS", "watchOS"]: | |
| gl_api.add("gles2") | |
| gl_platform.add("eagl") | |
| gl_winsys.add("eagl") | |
| elif self.settings.os == "Windows": | |
| gl_api.add("opengl") | |
| gl_platform.add("wgl") | |
| gl_winsys.add("win32") | |
| self._gl_api = list(gl_api) | |
| self._gl_platform = list(gl_platform) | |
| self._gl_winsys = list(gl_winsys) | |
| return self._gl_api, self._gl_platform, self._gl_winsys | |
| def build(self): | |
| for patch in self.conan_data.get("patches", {}).get(self.version, []): | |
| patch(**patch) | |
| meson = Meson(self) | |
| meson.configure() | |
| meson.build() | |
| def _fix_library_names(self, path): | |
| # regression in 1.16 | |
| if self.settings.compiler == "msvc": | |
| with chdir(path): | |
| for filename_old in glob.glob("*.a"): | |
| filename_new = filename_old[3:-2] + ".lib" | |
| self.output.info("rename %s into %s" % (filename_old, filename_new)) | |
| shutil.move(filename_old, filename_new) | |
| def package(self): | |
| copy(self, pattern="COPYING", dst="licenses", src=self.source_folder) | |
| # Workaround "fatal error: gst/gl/viv-fb/gstgldisplay_viv_fb.h: No such file or directory" | |
| if Version(self.version) < "1.22.5" and self.options.get_safe("with_viv_fb"): | |
| copy(self, pattern="*.h", dst=os.path.join(self.package_folder, "include", "gstreamer-1.0", "gst", "gl", "viv-fb"), src=os.path.join(self.source_folder, "gst-libs", "gst", "gl", "viv-fb")) | |
| meson = Meson(self) | |
| meson.install() | |
| self._fix_library_names(os.path.join(self.package_folder, "lib")) | |
| self._fix_library_names(os.path.join(self.package_folder, "lib", "gstreamer-1.0")) | |
| rmdir(self, os.path.join(self.package_folder, "share")) | |
| rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) | |
| rmdir(self, os.path.join(self.package_folder, "lib", "gstreamer-1.0", "pkgconfig")) | |
| rm(self, "*.pdb", self.package_folder) | |
| def package_id(self): | |
| self.info.requires["glib"].full_package_mode() | |
| self.info.requires["gstreamer"].full_package_mode() | |
| def package_info(self): | |
| gst_plugins = [] | |
| gst_plugin_path = os.path.join(self.package_folder, "lib", "gstreamer-1.0") | |
| gst_include_path = os.path.join(self.package_folder, "include", "gstreamer-1.0") | |
| gl_pkgconfig = "opengl::opengl" if self.options.with_gl else "glesv2::glesv2" | |
| pkgconfig_variables = { | |
| "exec_prefix": "${prefix}", | |
| "toolsdir": "${exec_prefix}/bin", | |
| "pluginsdir": "${libdir}/gstreamer-1.0", | |
| "datarootdir": "${prefix}/share", | |
| "datadir": "${datarootdir}", | |
| "girdir": "${datadir}/gir-1.0", | |
| "typelibdir": "${libdir}/girepository-1.0", | |
| "libexecdir": "${prefix}/libexec" | |
| } | |
| pkgconfig_custom_content = "\n".join("{}={}".format(key, value) for key, value in pkgconfig_variables.items()) | |
| if self.options.shared: | |
| self.output.info("Appending GST_PLUGIN_PATH env var : %s" % gst_plugin_path) | |
| self.env_info.GST_PLUGIN_PATH.append(gst_plugin_path) | |
| # Plugins ('gst') | |
| self.cpp_info.components["gstadder"].libs = ["gstadder"] | |
| self.cpp_info.components["gstadder"].libdirs.append(gst_plugin_path) | |
| self.cpp_info.components["gstadder"].requires = ["gstreamer-audio-1.0"] # TODO: orc | |
| gst_plugins.append("gstadder") | |
| self.cpp_info.components["gstapp"].libs = ["gstapp"] | |
| self.cpp_info.components["gstapp"].libdirs.append(gst_plugin_path) | |
| self.cpp_info.components["gstapp"].requires = ["gstreamer::gstreamer-base-1.0", "gstreamer-app-1.0", "gstreamer-tag-1.0"] | |
| gst_plugins.append("gstapp") | |
| self.cpp_info.components["gstaudioconvert"].libs = ["gstaudioconvert"] | |
| self.cpp_info.components["gstaudioconvert"].libdirs.append(gst_plugin_path) | |
| self.cpp_info.components["gstaudioconvert"].requires = ["gstreamer::gstreamer-base-1.0", "gstreamer-audio-1.0"] | |
| gst_plugins.append("gstaudioconvert") | |
| self.cpp_info.components["gstaudiomixer"].libs = ["gstaudiomixer"] | |
| self.cpp_info.components["gstaudiomixer"].libdirs.append(gst_plugin_path) | |
| self.cpp_info.components["gstaudiomixer"].requires = ["gstreamer::gstreamer-base-1.0", "gstreamer-audio-1.0"] # TODO: orc | |
| gst_plugins.append("gstaudiomixer") | |
| self.cpp_info.components["gstaudiorate"].libs = ["gstaudiorate"] | |
| self.cpp_info.components["gstaudiorate"].libdirs.append(gst_plugin_path) | |
| self.cpp_info.components["gstaudiorate"].requires = ["gstreamer::gstreamer-base-1.0", "gstreamer-audio-1.0"] | |
| gst_plugins.append("gstaudiorate") | |
| self.cpp_info.components["gstaudioresample"].libs = ["gstaudioresample"] | |
| self.cpp_info.components["gstaudioresample"].libdirs.append(gst_plugin_path) | |
| self.cpp_info.components["gstaudioresample"].requires = ["gstreamer::gstreamer-base-1.0", "gstreamer-audio-1.0"] | |
| if self.settings.os == "Linux": | |
| self.cpp_info.components["gstaudioresample"].system_libs = ["m"] | |
| gst_plugins.append("gstaudioresample") | |
| self.cpp_info.components["gstaudiotestsrc"].libs = ["gstaudiotestsrc"] | |
| self.cpp_info.components["gstaudiotestsrc"].libdirs.append(gst_plugin_path) | |
| self.cpp_info.components["gstaudiotestsrc"].requires = ["gstreamer::gstreamer-base-1.0", "gstreamer-audio-1.0"] | |
| if self.settings.os == "Linux": | |
| self.cpp_info.components["gstaudiotestsrc"].system_libs = ["m"] | |
| gst_plugins.append("gstaudiotestsrc") | |
| self.cpp_info.components["gstcompositor"].libs = ["gstcompositor"] | |
| self.cpp_info.components["gstcompositor"].libdirs.append(gst_plugin_path) | |
| self.cpp_info.components["gstcompositor"].requires = ["gstreamer::gstreamer-base-1.0", "gstreamer-video-1.0"] # TODO: orc | |
| if self.settings.os == "Linux": | |
| self.cpp_info.components["gstcompositor"].system_libs = ["m"] | |
| gst_plugins.append("gstcompositor") | |
| self.cpp_info.components["gstencoding"].libs = ["gstencoding"] | |
| self.cpp_info.components["gstencoding"].libdirs.append(gst_plugin_path) | |
| self.cpp_info.components["gstencoding"].requires = ["gstreamer::gstreamer-base-1.0", "gstreamer-video-1.0", "gstreamer-pbutils-1.0"] | |
| gst_plugins.append("gstencoding") | |
| self.cpp_info.components["gstgio"].libs = ["gstgio"] | |
| self.cpp_info.components["gstgio"].libdirs.append(gst_plugin_path) | |
| self.cpp_info.components["gstgio"].requires = ["gstreamer::gstreamer-base-1.0", "glib::gio-2.0"] | |
| gst_plugins.append("gstgio") | |
| self.cpp_info.components["gstoverlaycomposition"].libs = ["gstoverlaycomposition"] | |
| self.cpp_info.components["gstoverlaycomposition"].libdirs.append(gst_plugin_path) | |
| self.cpp_info.components["gstoverlaycomposition"].requires = ["gstreamer-video-1.0"] | |
| gst_plugins.append("gstoverlaycomposition") | |
| self.cpp_info.components["gstpbtypes"].libs = ["gstpbtypes"] | |
| self.cpp_info.components["gstpbtypes"].libdirs.append(gst_plugin_path) | |
| self.cpp_info.components["gstpbtypes"].requires = ["gstreamer-video-1.0"] | |
| gst_plugins.append("gstpbtypes") | |
| self.cpp_info.components["gstplayback"].libs = ["gstplayback"] | |
| self.cpp_info.components["gstplayback"].libdirs.append(gst_plugin_path) | |
| self.cpp_info.components["gstplayback"].requires = ["gstreamer-audio-1.0", "gstreamer-video-1.0", "gstreamer-pbutils-1.0", "gstreamer-tag-1.0"] | |
| gst_plugins.append("gstplayback") | |
| self.cpp_info.components["gstrawparse"].libs = ["gstrawparse"] | |
| self.cpp_info.components["gstrawparse"].libdirs.append(gst_plugin_path) | |
| self.cpp_info.components["gstrawparse"].requires = ["gstreamer::gstreamer-base-1.0", "gstreamer-audio-1.0", "gstreamer-video-1.0"] | |
| gst_plugins.append("gstrawparse") | |
| self.cpp_info.components["gstsubparse"].libs = ["gstsubparse"] | |
| self.cpp_info.components["gstsubparse"].libdirs.append(gst_plugin_path) | |
| self.cpp_info.components["gstsubparse"].requires = ["gstreamer::gstreamer-base-1.0"] | |
| gst_plugins.append("gstsubparse") | |
| self.cpp_info.components["gsttcp"].libs = ["gsttcp"] | |
| self.cpp_info.components["gsttcp"].libdirs.append(gst_plugin_path) | |
| self.cpp_info.components["gsttcp"].requires = ["gstreamer::gstreamer-base-1.0", "gstreamer::gstreamer-net-1.0", "glib::gio-2.0"] | |
| gst_plugins.append("gsttcp") | |
| self.cpp_info.components["gsttypefindfunctions"].libs = ["gsttypefindfunctions"] | |
| self.cpp_info.components["gsttypefindfunctions"].libdirs.append(gst_plugin_path) | |
| self.cpp_info.components["gsttypefindfunctions"].requires = ["gstreamer::gstreamer-base-1.0", "gstreamer-pbutils-1.0", "glib::gio-2.0"] | |
| gst_plugins.append("gsttypefindfunctions") | |
| if self.version < "1.22.0": | |
| self.cpp_info.components["gstvideoconvert"].libs = ["gstvideoconvert"] | |
| self.cpp_info.components["gstvideoconvert"].libdirs.append(gst_plugin_path) | |
| self.cpp_info.components["gstvideoconvert"].requires = ["gstreamer-video-1.0"] | |
| gst_plugins.append("gstvideoconvert") | |
| self.cpp_info.components["gstvideorate"].libs = ["gstvideorate"] | |
| self.cpp_info.components["gstvideorate"].libdirs.append(gst_plugin_path) | |
| self.cpp_info.components["gstvideorate"].requires = ["gstreamer-video-1.0"] | |
| gst_plugins.append("gstvideorate") | |
| if self.version >= "1.22.0": | |
| self.cpp_info.components["gstvideoconvertscale"].libs = ["gstvideoconvertscale"] | |
| self.cpp_info.components["gstvideoconvertscale"].libdirs.append(gst_plugin_path) | |
| self.cpp_info.components["gstvideoconvertscale"].requires = [ | |
| "gstreamer::gstreamer-1.0", "gstreamer::gstreamer-base-1.0", | |
| "gstreamer-video-1.0", "glib::glib-2.0", "glib::gobject-2.0"] | |
| gst_plugins.append("gstvideoconvertscale") | |
| self.cpp_info.components["gstvideotestsrc"].libs = ["gstvideotestsrc"] | |
| self.cpp_info.components["gstvideotestsrc"].libdirs.append(gst_plugin_path) | |
| self.cpp_info.components["gstvideotestsrc"].requires = [ | |
| "gstreamer::gstreamer-1.0", "gstreamer::gstreamer-base-1.0", | |
| "gstreamer-video-1.0", "glib::glib-2.0", "glib::gobject-2.0"] # TODO: orc | |
| if self.settings.os == "Linux": | |
| self.cpp_info.components["gstvideotestsrc"].system_libs = ["m"] | |
| gst_plugins.append("gstvideotestsrc") | |
| self.cpp_info.components["gstvolume"].libs = ["gstvolume"] | |
| self.cpp_info.components["gstvolume"].libdirs.append(gst_plugin_path) | |
| self.cpp_info.components["gstvolume"].requires = [ | |
| "gstreamer::gstreamer-1.0", "gstreamer::gstreamer-base-1.0", | |
| "gstreamer-audio-1.0", "glib::glib-2.0", "glib::gobject-2.0"] # TODO: orc | |
| gst_plugins.append("gstvolume") | |
| # Plugins ('ext') | |
| if self.options.get_safe("with_libalsa"): | |
| self.cpp_info.components["gstalsa"].libs = ["gstalsa"] | |
| self.cpp_info.components["gstalsa"].libdirs.append(gst_plugin_path) | |
| self.cpp_info.components["gstalsa"].requires = [ | |
| "gstreamer::gstreamer-1.0", "gstreamer::gstreamer-base-1.0", | |
| "gstreamer-audio-1.0", "gstreamer-tag-1.0", | |
| "libalsa::libalsa", "glib::glib-2.0", "glib::gobject-2.0"] | |
| gst_plugins.append("gstalsa") | |
| # if self.options.with_cdparanoia: # TODO: cdparanoia | |
| # self.cpp_info.components["gstcdparanoia"].libs = ["gstcdparanoia"] | |
| # self.cpp_info.components["gstcdparanoia"].libdirs.append(gst_plugin_path) | |
| # self.cpp_info.components["gstcdparanoia"].requires = [ | |
| # "gstreamer::gstreamer-1.0", "gstreamer::gstreamer-base-1.0", "gstreamer-audio-1.0", | |
| # "cdparanoia::cdparanoia", "glib::glib-2.0", "glib::gobject-2.0"] | |
| # gst_plugins.append("gstcdparanoia") | |
| if self.options.with_gl: | |
| self.cpp_info.components["gstopengl"].libs = ["gstopengl"] | |
| self.cpp_info.components["gstopengl"].libdirs.append(gst_plugin_path) | |
| self.cpp_info.components["gstopengl"].requires = [ | |
| "gstreamer::gstreamer-base-1.0", "gstreamer::gstreamer-controller-1.0", | |
| "gstreamer-video-1.0", "gstreamer-allocators-1.0", gl_pkgconfig] # TODO: bcm, nvbuf_utils | |
| if self.settings.os == "Macos": | |
| self.cpp_info.components["gstopengl"].frameworks = ["CoreFoundation", "Foundation", "QuartzCore"] | |
| if self.options.with_graphene: | |
| self.cpp_info.components["gstopengl"].requires.append("graphene::graphene-gobject-1.0") | |
| if self.options.with_libpng: | |
| self.cpp_info.components["gstopengl"].requires.append("libpng::libpng") | |
| if self.options.with_libjpeg == "libjpeg": | |
| self.cpp_info.components["gstopengl"].requires.append("libjpeg::libjpeg") | |
| elif self.options.with_libjpeg == "libjpeg-turbo": | |
| self.cpp_info.components["gstopengl"].requires.append("libjpeg-turbo::libjpeg-turbo") | |
| if self.options.get_safe("with_xorg"): | |
| self.cpp_info.components["gstopengl"].requires.append("xorg::x11") | |
| if self.settings.os == "Linux": | |
| self.cpp_info.components["gstopengl"].system_libs = ["m"] | |
| gst_plugins.append("gstopengl") | |
| # if self.options.with_libvisual: # TODO: libvisual | |
| # self.cpp_info.components["gstlibvisual"].libs = ["gstlibvisual"] | |
| # self.cpp_info.components["gstlibvisual"].libdirs.append(gst_plugin_path) | |
| # self.cpp_info.components["gstlibvisual"].requires = [ | |
| # "gstreamer::gstreamer-1.0", "gstreamer::gstreamer-base-1.0", | |
| # "gstreamer-audio-1.0", "gstreamer-video-1.0", "gstreamer-pbutils-1.0", | |
| # "libvisual::libvisual", "glib::glib-2.0", "glib::gobject-2.0"] | |
| # gst_plugins.append("gstlibvisual") | |
| if self.options.with_ogg: | |
| self.cpp_info.components["gstogg"].libs = ["gstogg"] | |
| self.cpp_info.components["gstogg"].libdirs.append(gst_plugin_path) | |
| self.cpp_info.components["gstogg"].requires = [ | |
| "gstreamer::gstreamer-1.0", "gstreamer::gstreamer-base-1.0", | |
| "gstreamer-audio-1.0", "gstreamer-pbutils-1.0", "gstreamer-tag-1.0", "gstreamer-riff-1.0", | |
| "ogg::ogglib", "glib::glib-2.0", "glib::gobject-2.0"] | |
| gst_plugins.append("gstogg") | |
| if self.options.with_opus: | |
| self.cpp_info.components["gstopus"].libs = ["gstopus"] | |
| self.cpp_info.components["gstopus"].libdirs.append(gst_plugin_path) | |
| self.cpp_info.components["gstopus"].requires = [ | |
| "gstreamer::gstreamer-1.0", "gstreamer::gstreamer-base-1.0", | |
| "gstreamer-audio-1.0", "gstreamer-pbutils-1.0", "gstreamer-tag-1.0", | |
| "opus::libopus", "glib::glib-2.0", "glib::gobject-2.0"] | |
| if self.settings.os == "Linux": | |
| self.cpp_info.components["gstopus"].system_libs = ["m"] | |
| gst_plugins.append("gstopus") | |
| if self.options.with_pango: | |
| self.cpp_info.components["gstpango"].libs = ["gstpango"] | |
| self.cpp_info.components["gstpango"].libdirs.append(gst_plugin_path) | |
| self.cpp_info.components["gstpango"].requires = [ | |
| "gstreamer::gstreamer-1.0", "gstreamer::gstreamer-base-1.0", | |
| "gstreamer-video-1.0", | |
| "pango::pangocairo", "glib::glib-2.0", "glib::gobject-2.0"] | |
| if self.settings.os == "Linux": | |
| self.cpp_info.components["gstpango"].system_libs = ["m"] | |
| gst_plugins.append("gstpango") | |
| if self.options.with_theora: | |
| self.cpp_info.components["gsttheora"].libs = ["gsttheora"] | |
| self.cpp_info.components["gsttheora"].libdirs.append(gst_plugin_path) | |
| self.cpp_info.components["gsttheora"].requires = [ | |
| "gstreamer::gstreamer-1.0", "gstreamer::gstreamer-base-1.0", | |
| "gstreamer-video-1.0", "gstreamer-tag-1.0", | |
| "theora::theoraenc", "theora::theoradec", "glib::glib-2.0", "glib::gobject-2.0"] | |
| gst_plugins.append("gsttheora") | |
| if self.options.with_vorbis: | |
| self.cpp_info.components["gstvorbis"].libs = ["gstvorbis"] | |
| self.cpp_info.components["gstvorbis"].libdirs.append(gst_plugin_path) | |
| self.cpp_info.components["gstvorbis"].requires = [ | |
| "gstreamer::gstreamer-1.0", "gstreamer::gstreamer-base-1.0", | |
| "gstreamer-audio-1.0", "gstreamer-tag-1.0", | |
| "vorbis::vorbismain", "vorbis::vorbisenc", "glib::glib-2.0", "glib::gobject-2.0"] | |
| gst_plugins.append("gstvorbis") | |
| # if self.options.with_tremor: # TODO: tremor | |
| # self.cpp_info.components["gstivorbisdec"].libs = ["gstivorbisdec"] | |
| # self.cpp_info.components["gstivorbisdec"].libdirs.append(gst_plugin_path) | |
| # self.cpp_info.components["gstivorbisdec"].requires = [ | |
| # "gstreamer::gstreamer-1.0", "gstreamer::gstreamer-base-1.0", | |
| # "gstreamer-audio-1.0", "gstreamer-tag-1.0", | |
| # "tremor::tremor", "glib::glib-2.0", "glib::gobject-2.0"] | |
| # gst_plugins.append("gstivorbisdec") | |
| # Plugins ('sys') | |
| if self.options.get_safe("with_xorg"): | |
| self.cpp_info.components["gstximagesink"].libs = ["gstximagesink"] | |
| self.cpp_info.components["gstximagesink"].libdirs.append(gst_plugin_path) | |
| self.cpp_info.components["gstximagesink"].requires = [ | |
| "gstreamer::gstreamer-1.0", "gstreamer::gstreamer-base-1.0", | |
| "gstreamer-video-1.0", | |
| "xorg::x11", "xorg::xext", "glib::glib-2.0", "glib::gobject-2.0"] | |
| gst_plugins.append("gstximagesink") | |
| self.cpp_info.components["gstxvimagesink"].libs = ["gstxvimagesink"] | |
| self.cpp_info.components["gstxvimagesink"].libdirs.append(gst_plugin_path) | |
| self.cpp_info.components["gstxvimagesink"].requires = [ | |
| "gstreamer::gstreamer-1.0", "gstreamer::gstreamer-base-1.0", | |
| "gstreamer-video-1.0", | |
| "xorg::x11", "xorg::xext", "xorg::xv", "glib::glib-2.0", "glib::gobject-2.0"] | |
| if self.settings.os == "Linux": | |
| self.cpp_info.components["gstxvimagesink"].system_libs = ["m"] | |
| gst_plugins.append("gstxvimagesink") | |
| # Libraries | |
| self.cpp_info.components["gstreamer-plugins-base-1.0"].names["pkg_config"] = "gstreamer-plugins-base-1.0" | |
| self.cpp_info.components["gstreamer-plugins-base-1.0"].requires = ["gstreamer::gstreamer-1.0"] | |
| self.cpp_info.components["gstreamer-plugins-base-1.0"].includedirs = [gst_include_path] | |
| if not self.options.shared: | |
| self.cpp_info.components["gstreamer-plugins-base-1.0"].defines.append("GST_PLUGINS_BASE_STATIC") | |
| self.cpp_info.components["gstreamer-plugins-base-1.0"].requires.extend(gst_plugins) | |
| else: | |
| self.cpp_info.components["gstreamer-plugins-base-1.0"].bindirs.append(gst_plugin_path) | |
| self.cpp_info.components["gstreamer-plugins-base-1.0"].set_property("pkg_config_custom_content", pkgconfig_custom_content) | |
| self.cpp_info.components["gstreamer-allocators-1.0"].names["pkg_config"] = "gstreamer-allocators-1.0" | |
| self.cpp_info.components["gstreamer-allocators-1.0"].libs = ["gstallocators-1.0"] | |
| self.cpp_info.components["gstreamer-allocators-1.0"].requires = ["gstreamer::gstreamer-1.0"] | |
| self.cpp_info.components["gstreamer-allocators-1.0"].includedirs = [gst_include_path] | |
| self.cpp_info.components["gstreamer-allocators-1.0"].set_property("pkg_config_custom_content", pkgconfig_custom_content) | |
| self.cpp_info.components["gstreamer-allocators-1.0"].set_property("pkg_config_name", "gstreamer-allocators-1.0") | |
| self.cpp_info.components["gstreamer-app-1.0"].names["pkg_config"] = "gstreamer-app-1.0" | |
| self.cpp_info.components["gstreamer-app-1.0"].set_property("pkg_config_name", "gstreamer-app-1.0") | |
| self.cpp_info.components["gstreamer-app-1.0"].libs = ["gstapp-1.0"] | |
| self.cpp_info.components["gstreamer-app-1.0"].requires = ["gstreamer::gstreamer-1.0", "gstreamer::gstreamer-base-1.0"] | |
| self.cpp_info.components["gstreamer-app-1.0"].includedirs = [gst_include_path] | |
| self.cpp_info.components["gstreamer-app-1.0"].set_property("pkg_config_custom_content", pkgconfig_custom_content) | |
| self.cpp_info.components["gstreamer-audio-1.0"].names["pkg_config"] = "gstreamer-audio-1.0" | |
| self.cpp_info.components["gstreamer-audio-1.0"].set_property("pkg_config_name", "gstreamer-audio-1.0") | |
| self.cpp_info.components["gstreamer-audio-1.0"].libs = ["gstaudio-1.0"] | |
| self.cpp_info.components["gstreamer-audio-1.0"].requires = ["gstreamer::gstreamer-1.0", "gstreamer::gstreamer-base-1.0", "gstreamer-tag-1.0"] # TODO: orc | |
| self.cpp_info.components["gstreamer-audio-1.0"].includedirs = [gst_include_path] | |
| if self.settings.os == "Linux": | |
| self.cpp_info.components["gstreamer-audio-1.0"].system_libs = ["m"] | |
| self.cpp_info.components["gstreamer-audio-1.0"].set_property("pkg_config_custom_content", pkgconfig_custom_content) | |
| self.cpp_info.components["gstreamer-fft-1.0"].names["pkg_config"] = "gstreamer-fft-1.0" | |
| self.cpp_info.components["gstreamer-fft-1.0"].set_property("pkg_config_name", "gstreamer-fft-1.0") | |
| self.cpp_info.components["gstreamer-fft-1.0"].libs = ["gstfft-1.0"] | |
| self.cpp_info.components["gstreamer-fft-1.0"].requires = ["gstreamer::gstreamer-1.0"] | |
| self.cpp_info.components["gstreamer-fft-1.0"].includedirs = [gst_include_path] | |
| if self.settings.os == "Linux": | |
| self.cpp_info.components["gstreamer-fft-1.0"].system_libs = ["m"] | |
| self.cpp_info.components["gstreamer-fft-1.0"].set_property("pkg_config_custom_content", pkgconfig_custom_content) | |
| if self.options.with_gl or self.options.with_glesv2: | |
| gl_api, gl_platform, gl_winsys = self._gl_config() | |
| gl_variables = { | |
| **pkgconfig_variables, | |
| "gl_apis": " ".join(gl_api), | |
| "gl_platforms": " ".join(gl_platform), | |
| "gl_winsys": " ".join(gl_winsys) | |
| } | |
| gl_custom_content = "\n".join("{}={}".format(key, value) for key, value in gl_variables.items()) | |
| self.cpp_info.components["gstreamer-gl-1.0"].names["pkg_config"] = "gstreamer-gl-1.0" | |
| self.cpp_info.components["gstreamer-gl-1.0"].set_property("pkg_config_name", "gstreamer-gl-1.0") | |
| self.cpp_info.components["gstreamer-gl-1.0"].libs = ["gstgl-1.0"] | |
| self.cpp_info.components["gstreamer-gl-1.0"].requires = [ | |
| "gstreamer::gstreamer-1.0", "gstreamer::gstreamer-base-1.0", | |
| "gstreamer-allocators-1.0", "gstreamer-video-1.0", | |
| "glib::gmodule-no-export-2.0", gl_pkgconfig] # TODO: bcm | |
| if self.options.get_safe("with_egl"): | |
| self.cpp_info.components["gstreamer-gl-1.0"].requires.extend(["egl::egl"]) | |
| if self.options.get_safe("with_xorg"): | |
| self.cpp_info.components["gstreamer-gl-1.0"].requires.extend(["xorg::x11", "xorg::x11-xcb"]) | |
| if self.options.get_safe("with_wayland"): | |
| self.cpp_info.components["gstreamer-gl-1.0"].requires.extend([ | |
| "wayland::wayland-client", "wayland::wayland-cursor", "wayland::wayland-egl", | |
| "wayland-protocols::wayland-protocols"]) | |
| if self.settings.os == "Windows": | |
| self.cpp_info.components["gstreamer-gl-1.0"].requires.append("wglext::wglext") | |
| self.cpp_info.components["gstreamer-gl-1.0"].requires.extend(['glext::glext']) | |
| self.cpp_info.components["gstreamer-gl-1.0"].system_libs = ["gdi32"] | |
| if self.settings.os in ["Macos", "iOS", "tvOS", "watchOS"]: | |
| self.cpp_info.components["gstreamer-gl-1.0"].frameworks = ["CoreFoundation", "Foundation", "QuartzCore", "Cocoa"] | |
| if self.settings.os in ["iOS", "tvOS", "watchOS"]: | |
| self.cpp_info.components["gstreamer-gl-1.0"].frameworks.extend(["CoreGraphics", "UIkit"]) | |
| self.cpp_info.components["gstreamer-gl-1.0"].includedirs = [os.path.join(self.package_folder, "include"), gst_include_path] | |
| self.cpp_info.components["gstreamer-gl-1.0"].includedirs.append(os.path.join(gst_plugin_path, "include")) | |
| self.cpp_info.components["gstreamer-gl-1.0"].set_property("pkg_config_custom_content", gl_custom_content) | |
| self.cpp_info.components["gstreamer-gl-prototypes-1.0"].names["pkg_config"] = "gstreamer-gl-prototypes-1.0" | |
| self.cpp_info.components["gstreamer-gl-prototypes-1.0"].set_property("pkg_config_name", "gstreamer-gl-prototypes-1.0") | |
| if self.options.get_safe("with_gl") or self.options.with_glesv2: | |
| self.cpp_info.components["gstreamer-gl-prototypes-1.0"].requires = ["gstreamer-gl-1.0", gl_pkgconfig] | |
| if self.options.get_safe("with_egl"): | |
| self.cpp_info.components["gstreamer-gl-egl-1.0"].names["pkg_config"] = "gstreamer-gl-egl-1.0" | |
| self.cpp_info.components["gstreamer-gl-egl-1.0"].set_property("pkg_config_name", "gstreamer-gl-egl-1.0") | |
| self.cpp_info.components["gstreamer-gl-egl-1.0"].requires = ["gstreamer-gl-1.0", "egl::egl"] | |
| if self.options.get_safe("with_wayland"): | |
| self.cpp_info.components["gstreamer-gl-wayland-1.0"].names["pkg_config"] = "gstreamer-gl-wayland-1.0" | |
| self.cpp_info.components["gstreamer-gl-wayland-1.0"].set_property("pkg_config_name", "gstreamer-gl-wayland-1.0") | |
| self.cpp_info.components["gstreamer-gl-wayland-1.0"].requires = [ | |
| "gstreamer-gl-1.0", "wayland::wayland-client", "wayland::wayland-egl", | |
| "wayland-protocols::wayland-protocols"] | |
| if self.options.get_safe("with_xorg"): | |
| self.cpp_info.components["gstreamer-gl-x11-1.0"].names["pkg_config"] = "gstreamer-gl-x11-1.0" | |
| self.cpp_info.components["gstreamer-gl-x11-1.0"].set_property("pkg_config_name", "gstreamer-gl-x11-1.0") | |
| self.cpp_info.components["gstreamer-gl-x11-1.0"].requires = ["gstreamer-gl-1.0", "xorg::x11-xcb"] | |
| if self.options.get_safe("with_viv_fb"): | |
| self.cpp_info.components["gstreamer-gl-viv-fb-1.0"].names["pkg_config"] = "gstreamer-gl-viv-fb-1.0" | |
| self.cpp_info.components["gstreamer-gl-viv-fb-1.0"].set_property("pkg_config_name", "gstreamer-gl-viv-fb-1.0") | |
| self.cpp_info.components["gstreamer-gl-viv-fb-1.0"].includedirs = [os.path.join(self.package_folder, "include", "gstreamer-1.0", "gst", "gl", "viv-fb"), gst_include_path] | |
| self.cpp_info.components["gstreamer-pbutils-1.0"].names["pkg_config"] = "gstreamer-pbutils-1.0" | |
| self.cpp_info.components["gstreamer-pbutils-1.0"].set_property("pkg_config_name", "gstreamer-pbutils-1.0") | |
| self.cpp_info.components["gstreamer-pbutils-1.0"].libs = ["gstpbutils-1.0"] | |
| self.cpp_info.components["gstreamer-pbutils-1.0"].requires = [ | |
| "gstreamer::gstreamer-1.0", "gstreamer::gstreamer-base-1.0", | |
| "gstreamer-audio-1.0", "gstreamer-video-1.0", "gstreamer-tag-1.0"] | |
| self.cpp_info.components["gstreamer-pbutils-1.0"].includedirs = [gst_include_path] | |
| self.cpp_info.components["gstreamer-pbutils-1.0"].set_property("pkg_config_custom_content", pkgconfig_custom_content) | |
| self.cpp_info.components["gstreamer-riff-1.0"].names["pkg_config"] = "gstreamer-riff-1.0" | |
| self.cpp_info.components["gstreamer-riff-1.0"].set_property("pkg_config_name", "gstreamer-riff-1.0") | |
| self.cpp_info.components["gstreamer-riff-1.0"].libs = ["gstriff-1.0"] | |
| self.cpp_info.components["gstreamer-riff-1.0"].requires = ["gstreamer::gstreamer-1.0", "gstreamer-audio-1.0", "gstreamer-tag-1.0"] | |
| self.cpp_info.components["gstreamer-riff-1.0"].includedirs = [gst_include_path] | |
| self.cpp_info.components["gstreamer-riff-1.0"].set_property("pkg_config_custom_content", pkgconfig_custom_content) | |
| self.cpp_info.components["gstreamer-rtp-1.0"].names["pkg_config"] = "gstreamer-rtp-1.0" | |
| self.cpp_info.components["gstreamer-rtp-1.0"].set_property("pkg_config_name", "gstreamer-rtp-1.0") | |
| self.cpp_info.components["gstreamer-rtp-1.0"].libs = ["gstrtp-1.0"] | |
| self.cpp_info.components["gstreamer-rtp-1.0"].requires = ["gstreamer::gstreamer-1.0", "gstreamer::gstreamer-base-1.0", "gstreamer-audio-1.0"] | |
| self.cpp_info.components["gstreamer-rtp-1.0"].includedirs = [gst_include_path] | |
| self.cpp_info.components["gstreamer-rtp-1.0"].set_property("pkg_config_custom_content", pkgconfig_custom_content) | |
| self.cpp_info.components["gstreamer-rtsp-1.0"].names["pkg_config"] = "gstreamer-rtsp-1.0" | |
| self.cpp_info.components["gstreamer-rtsp-1.0"].set_property("pkg_config_name", "gstreamer-rtsp-1.0") | |
| self.cpp_info.components["gstreamer-rtsp-1.0"].libs = ["gstrtsp-1.0"] | |
| self.cpp_info.components["gstreamer-rtsp-1.0"].requires = [ | |
| "gstreamer::gstreamer-1.0", "gstreamer::gstreamer-base-1.0", | |
| "gstreamer-sdp-1.0", "glib::gio-2.0"] | |
| if self.settings.os == "Linux": | |
| self.cpp_info.components["gstreamer-rtsp-1.0"].system_libs = ["m"] | |
| elif self.settings.os == "Windows": | |
| self.cpp_info.components["gstreamer-rtsp-1.0"].system_libs = ["ws2_32"] | |
| self.cpp_info.components["gstreamer-rtsp-1.0"].includedirs = [gst_include_path] | |
| self.cpp_info.components["gstreamer-rtsp-1.0"].set_property("pkg_config_custom_content", pkgconfig_custom_content) | |
| self.cpp_info.components["gstreamer-sdp-1.0"].names["pkg_config"] = "gstreamer-sdp-1.0" | |
| self.cpp_info.components["gstreamer-sdp-1.0"].set_property("pkg_config_name", "gstreamer-sdp-1.0") | |
| self.cpp_info.components["gstreamer-sdp-1.0"].libs = ["gstsdp-1.0"] | |
| self.cpp_info.components["gstreamer-sdp-1.0"].requires = ["gstreamer::gstreamer-1.0", "gstreamer-rtp-1.0", "glib::glib-2.0", "glib::gio-2.0"] | |
| self.cpp_info.components["gstreamer-sdp-1.0"].includedirs = [gst_include_path] | |
| self.cpp_info.components["gstreamer-sdp-1.0"].set_property("pkg_config_custom_content", pkgconfig_custom_content) | |
| self.cpp_info.components["gstreamer-tag-1.0"].names["pkg_config"] = "gstreamer-tag-1.0" | |
| self.cpp_info.components["gstreamer-tag-1.0"].set_property("pkg_config_name", "gstreamer-tag-1.0") | |
| self.cpp_info.components["gstreamer-tag-1.0"].libs = ["gsttag-1.0"] | |
| self.cpp_info.components["gstreamer-tag-1.0"].requires = ["gstreamer::gstreamer-1.0", "gstreamer::gstreamer-base-1.0", "zlib::zlib"] | |
| if self.settings.os == "Linux": | |
| self.cpp_info.components["gstreamer-tag-1.0"].system_libs = ["m"] | |
| self.cpp_info.components["gstreamer-tag-1.0"].includedirs = [gst_include_path] | |
| self.cpp_info.components["gstreamer-tag-1.0"].set_property("pkg_config_custom_content", pkgconfig_custom_content) | |
| self.cpp_info.components["gstreamer-video-1.0"].names["pkg_config"] = "gstreamer-video-1.0" | |
| self.cpp_info.components["gstreamer-video-1.0"].set_property("pkg_config_name", "gstreamer-video-1.0") | |
| self.cpp_info.components["gstreamer-video-1.0"].libs = ["gstvideo-1.0"] | |
| self.cpp_info.components["gstreamer-video-1.0"].requires = ["gstreamer::gstreamer-1.0", "gstreamer::gstreamer-base-1.0"] # TODO: orc | |
| if self.settings.os == "Linux": | |
| self.cpp_info.components["gstreamer-video-1.0"].system_libs = ["m"] | |
| self.cpp_info.components["gstreamer-video-1.0"].includedirs = [gst_include_path] | |
| self.cpp_info.components["gstreamer-video-1.0"].set_property("pkg_config_custom_content", pkgconfig_custom_content) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from conan import ConanFile | |
| from conan.errors import ConanInvalidConfiguration | |
| from conan.tools.microsoft import msvc_runtime_flag | |
| from conan.tools.layout import basic_layout | |
| from conan.tools.meson import Meson, MesonToolchain | |
| from conan.tools.env import VirtualBuildEnv, Environment | |
| from conan.tools.layout import basic_layout | |
| from conan.tools.files import get, copy, rm, rmdir | |
| from conan.tools.scm import Version | |
| import glob | |
| import os | |
| import shutil | |
| class GStPluginsGoodConan(ConanFile): | |
| package_type = "library" | |
| name = "gst-plugins-good" | |
| description = "GStreamer is a development framework for creating applications like media players, video editors, " \ | |
| "streaming media broadcasters and so on" | |
| topics = ("gstreamer", "multimedia", "video", "audio", "broadcasting", "framework", "media") | |
| url = "https://github.com/conan-io/conan-center-index" | |
| homepage = "https://gstreamer.freedesktop.org/" | |
| license = "GPL-2.0-only" | |
| settings = "os", "arch", "compiler", "build_type" | |
| options = { | |
| "shared": [True, False], | |
| "fPIC": [True, False], | |
| "with_introspection": [True, False], | |
| "with_qt5": [True, False], | |
| "with_qt6": [True, False], | |
| } | |
| default_options = { | |
| "shared": False, | |
| "fPIC": True, | |
| "with_introspection": False, | |
| "with_qt5": False, | |
| "with_qt6": False | |
| } | |
| exports_sources = ["patches/*.patch"] | |
| generators = "PkgConfigDeps" | |
| @property | |
| def _is_msvc(self): | |
| return self.settings.compiler == "msvc" | |
| def validate(self): | |
| if self.options.shared != self.dependencies["gstreamer"].options.get_safe("shared") or \ | |
| self.options.shared != self.dependencies["glib"].options.get_safe("shared") or \ | |
| self.options.shared != self.dependencies["gst-plugins-base"].options.get_safe("shared"): | |
| # https://gitlab.freedesktop.org/gstreamer/gst-build/-/issues/133 | |
| raise ConanInvalidConfiguration("GLib, GStreamer and GstPlugins must be either all shared, or all static") | |
| if Version(self.version) >= "1.18.2" and\ | |
| self.settings.compiler == "gcc" and\ | |
| Version(self.settings.compiler.version) < "5": | |
| raise ConanInvalidConfiguration( | |
| "gst-plugins-good %s does not support gcc older than 5" % self.version | |
| ) | |
| if self.options.shared and str(msvc_runtime_flag(self)).startswith("MT"): | |
| raise ConanInvalidConfiguration('shared build with static runtime is not supported due to the FlsAlloc limit') | |
| def configure(self): | |
| if self.options.shared: | |
| del self.options.fPIC | |
| del self.settings.compiler.libcxx | |
| del self.settings.compiler.cppstd | |
| self.options['gstreamer'].shared = self.options.shared | |
| self.options['gst-plugins-base'].shared = self.options.shared | |
| def config_options(self): | |
| if self.settings.os == 'Windows': | |
| del self.options.fPIC | |
| def requirements(self): | |
| self.requires("glib/2.74.0@#4") | |
| self.requires("gstreamer/1.19.1") | |
| self.requires("gst-plugins-base/1.19.1") | |
| if (self.options.with_qt5): | |
| self.requires("qt/[>=5 <6]", visible=False) | |
| def build_requirements(self): | |
| self.tool_requires("meson/0.62.2") | |
| self.tool_requires("pkgconf/1.9.3") | |
| if self.settings.os == 'Windows': | |
| self.tool_requires("winflexbison/2.5.24") | |
| else: | |
| self.tool_requires("bison/3.7.6") | |
| self.tool_requires("flex/2.6.4") | |
| if self.options.with_introspection: | |
| self.tool_requires("gobject-introspection/1.68.0") | |
| def layout(self): | |
| basic_layout(self, src_folder="src") | |
| def source(self): | |
| get(self, **self.conan_data["sources"][self.version], strip_root=True) | |
| def generate(self): | |
| tool_chain = MesonToolchain(self) | |
| def add_flag(name, value): | |
| if name in defs: | |
| tool_chain.project_options[name] += " " + value | |
| else: | |
| tool_chain.project_options[name] = value | |
| def add_compiler_flag(value): | |
| add_flag("c_args", value) | |
| add_flag("cpp_args", value) | |
| def add_linker_flag(value): | |
| add_flag("c_link_args", value) | |
| add_flag("cpp_link_args", value) | |
| if self.settings.compiler == "msvc": | |
| add_linker_flag("-lws2_32") | |
| add_compiler_flag("-%s" % self.settings.compiler.runtime) | |
| if int(str(self.settings.compiler.version)) < 14: | |
| add_compiler_flag("-Dsnprintf=_snprintf") | |
| if self.settings.get_safe("compiler.runtime"): | |
| tool_chain.project_options["b_vscrt"] = str(self.settings.compiler.runtime).lower() | |
| tool_chain.project_options["examples"] = "disabled" | |
| tool_chain.project_options["tests"] = "disabled" | |
| tool_chain.project_options["wrap_mode"] = "nofallback" | |
| if self.options.with_qt5: | |
| tool_chain.project_options["qt5"] = "enabled" | |
| qt_pkg_config_path = os.path.join(str(self.dependencies["qt"].cpp_info.builddirs[1])) | |
| self.output.info(f"Copying Qt .pc files from {qt_pkg_config_path} to {self.generators_folder}") | |
| copy(self, "*", qt_pkg_config_path, self.generators_folder) | |
| if self.options.with_qt6: | |
| tool_chain.project_options["qt6"] = "enabled" | |
| # if self.options.local_qt_dir: | |
| # qt_pkg_config_path = os.path.join(str(self.options.local_qt_dir), "lib", "pkgconfig") | |
| # self.output.info(f"Copying Qt .pc files from {qt_pkg_config_path} to {self.generators_folder}") | |
| # copy(self, "*", qt_pkg_config_path, self.generators_folder) | |
| # if self.options.local_qt_dir: | |
| # qt_bin = os.path.join(str(self.options.local_qt_dir), "bin") | |
| # env = Environment() | |
| # env.prepend_path("PATH", qt_bin) | |
| # env.vars(self).save_script("qt_env") | |
| tool_chain.generate() | |
| build_env = VirtualBuildEnv(self) | |
| build_env.generate(scope="build") | |
| def build(self): | |
| for patch in self.conan_data.get("patches", {}).get(self.version, []): | |
| tools.patch(**patch) | |
| meson = Meson(self) | |
| meson.configure() | |
| meson.build() | |
| def _fix_library_names(self, path): | |
| # regression in 1.16 | |
| if self.settings.compiler == "msvc": | |
| with tools.chdir(path): | |
| for filename_old in glob.glob("*.a"): | |
| filename_new = filename_old[3:-2] + ".lib" | |
| self.output.info("rename %s into %s" % (filename_old, filename_new)) | |
| shutil.move(filename_old, filename_new) | |
| def package(self): | |
| copy(self, pattern="COPYING", dst="licenses", src=self.source_folder) | |
| meson = Meson(self) | |
| meson.install() | |
| self._fix_library_names(os.path.join(self.package_folder, "lib")) | |
| self._fix_library_names(os.path.join(self.package_folder, "lib", "gstreamer-1.0")) | |
| rmdir(self, os.path.join(self.package_folder, "share")) | |
| rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) | |
| rmdir(self, os.path.join(self.package_folder, "lib", "gstreamer-1.0", "pkgconfig")) | |
| rm(self, "*.pdb", self.package_folder) | |
| def package_info(self): | |
| plugins = ["alpha", "alphacolor", | |
| "apetag", | |
| "audiofx", | |
| "audioparsers", | |
| "auparse", | |
| "autodetect", | |
| "avi", | |
| "cutter", | |
| "debug", | |
| "deinterlace", | |
| "dtmf", | |
| "effectv", | |
| "equalizer", | |
| "flv", | |
| "flxdec", | |
| "goom", | |
| "goom2k1", | |
| "icydemux", | |
| "id3demux", | |
| "imagefreeze", | |
| "interleave", | |
| "isomp4", | |
| "alaw", "mulaw", | |
| "level", | |
| "matroska", | |
| "monoscope", | |
| "multifile", | |
| "multipart", | |
| "replaygain", | |
| "rtp", | |
| "rtpmanager", | |
| "rtsp", | |
| "shapewipe", | |
| "smpte", | |
| "spectrum", | |
| "udp", | |
| "videobox", | |
| "videocrop", | |
| "videofilter", | |
| "videomixer", | |
| "wavenc", | |
| "wavparse", | |
| "y4menc"] | |
| if self.options.with_qt5: | |
| plugins.append("qmlgl") | |
| gst_plugin_path = os.path.join(self.package_folder, "lib", "gstreamer-1.0") | |
| if self.options.shared: | |
| self.output.info("Appending GST_PLUGIN_PATH env var : %s" % gst_plugin_path) | |
| self.cpp_info.bindirs.append(gst_plugin_path) | |
| self.runenv_info.prepend_path("GST_PLUGIN_PATH", gst_plugin_path) | |
| self.env_info.GST_PLUGIN_PATH.append(gst_plugin_path) | |
| else: | |
| self.cpp_info.defines.append("GST_PLUGINS_GOOD_STATIC") | |
| self.cpp_info.libdirs.append(gst_plugin_path) | |
| self.cpp_info.libs.extend(["gst%s" % plugin for plugin in plugins]) | |
| self.cpp_info.includedirs = ["include", os.path.join("include", "gstreamer-1.0")] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from conan import ConanFile | |
| from conan.tools.meson import Meson, MesonToolchain | |
| from conan.tools.env import VirtualBuildEnv | |
| from conan.tools.layout import basic_layout | |
| from conan.tools.files import get, copy, rmdir, patch, chdir, rm | |
| from conan.errors import ConanInvalidConfiguration | |
| from conan.tools.scm import Version | |
| from conan.tools.microsoft import msvc_runtime_flag | |
| import glob | |
| import os | |
| import shutil | |
| class GStRtspServerConan(ConanFile): | |
| package_type = "library" | |
| name = "gst-rtsp-server" | |
| description = "GStreamer is a development framework for creating applications like media players, video editors, " \ | |
| "streaming media broadcasters and so on" | |
| topics = ("gstreamer", "multimedia", "video", "audio", "broadcasting", "framework", "media") | |
| url = "https://github.com/conan-io/conan-center-index" | |
| homepage = "https://gstreamer.freedesktop.org/" | |
| license = "GPL-2.0-only" | |
| settings = "os", "arch", "compiler", "build_type" | |
| options = { | |
| "shared": [True, False], | |
| "fPIC": [True, False], | |
| "with_examples": [True, False], | |
| } | |
| default_options = { | |
| "shared": False, | |
| "fPIC": True, | |
| "with_examples": False | |
| } | |
| exports_sources = ["patches/*.patch"] | |
| generators = "PkgConfigDeps" | |
| @property | |
| def _is_msvc(self): | |
| return self.settings.compiler == "msvc" | |
| def validate(self): | |
| if self.options.shared != self.dependencies["gstreamer"].options.get_safe("shared") or \ | |
| self.options.shared != self.dependencies["glib"].options.get_safe("shared") or \ | |
| self.options.shared != self.dependencies["gst-plugins-base"].options.get_safe("shared"): | |
| # https://gitlab.freedesktop.org/gstreamer/gst-build/-/issues/133 | |
| raise ConanInvalidConfiguration("GLib, GStreamer and GstPlugins must be either all shared, or all static") | |
| if Version(self.version) >= "1.18.2" and\ | |
| self.settings.compiler == "gcc" and\ | |
| Version(self.settings.compiler.version) < "5": | |
| raise ConanInvalidConfiguration( | |
| "gst-plugins-good %s does not support gcc older than 5" % self.version | |
| ) | |
| if self.options.shared and str(msvc_runtime_flag(self)).startswith("MT"): | |
| raise ConanInvalidConfiguration('shared build with static runtime is not supported due to the FlsAlloc limit') | |
| def configure(self): | |
| if self.options.shared: | |
| del self.options.fPIC | |
| del self.settings.compiler.libcxx | |
| del self.settings.compiler.cppstd | |
| self.options['gstreamer'].shared = self.options.shared | |
| self.options['gst-plugins-base'].shared = self.options.shared | |
| def config_options(self): | |
| if self.settings.os == 'Windows': | |
| del self.options.fPIC | |
| def requirements(self): | |
| self.requires("glib/2.74.0@#4") | |
| self.requires("gstreamer/1.19.1") | |
| self.requires("gst-plugins-base/1.19.1") | |
| def build_requirements(self): | |
| self.tool_requires("meson/0.62.2") | |
| self.tool_requires("pkgconf/1.7.4") | |
| if self.settings.os == 'Windows': | |
| self.tool_requires("winflexbison/2.5.24") | |
| else: | |
| self.tool_requires("bison/3.7.6") | |
| self.tool_requires("flex/2.6.4") | |
| def layout(self): | |
| basic_layout(self, src_folder="src") | |
| def source(self): | |
| get(self, **self.conan_data["sources"][self.version], strip_root=True) | |
| def generate(self): | |
| tool_chain = MesonToolchain(self) | |
| def add_flag(name, value): | |
| if name in defs: | |
| tool_chain.project_options[name] += " " + value | |
| else: | |
| tool_chain.project_options[name] = value | |
| def add_compiler_flag(value): | |
| add_flag("c_args", value) | |
| add_flag("cpp_args", value) | |
| def add_linker_flag(value): | |
| add_flag("c_link_args", value) | |
| add_flag("cpp_link_args", value) | |
| if self.settings.compiler == "msvc": | |
| add_linker_flag("-lws2_32") | |
| add_compiler_flag("-%s" % self.settings.compiler.runtime) | |
| if int(str(self.settings.compiler.version)) < 14: | |
| add_compiler_flag("-Dsnprintf=_snprintf") | |
| if self.settings.get_safe("compiler.runtime"): | |
| tool_chain.project_options["b_vscrt"] = str(self.settings.compiler.runtime).lower() | |
| if self.version > "1.18.4": | |
| tool_chain.project_options["tests"] = "disabled" | |
| if self.options.with_examples: | |
| tool_chain.project_options["examples"] = "enabled" | |
| tool_chain.generate() | |
| env = VirtualBuildEnv(self) | |
| env.generate(scope="build") | |
| def build(self): | |
| for p in self.conan_data.get("patches", {}).get(self.version, []): | |
| patch(self, **p) | |
| meson = Meson(self) | |
| meson.configure() | |
| meson.build() | |
| def _fix_library_names(self, path): | |
| # regression in 1.16 | |
| if self.settings.compiler == "msvc": | |
| with chdir(self, path): | |
| for filename_old in glob.glob("*.a"): | |
| filename_new = filename_old[3:-2] + ".lib" | |
| self.output.info("rename %s into %s" % (filename_old, filename_new)) | |
| shutil.move(filename_old, filename_new) | |
| def package(self): | |
| copy(self, "COPYING", dst="licenses", src=self.source_folder) | |
| meson = Meson(self) | |
| meson.install() | |
| self._fix_library_names(os.path.join(self.package_folder, "lib")) | |
| self._fix_library_names(os.path.join(self.package_folder, "lib", "gstreamer-1.0")) | |
| rmdir(self, os.path.join(self.package_folder, "share")) | |
| rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) | |
| rmdir(self, os.path.join(self.package_folder, "lib", "gstreamer-1.0", "pkgconfig")) | |
| rm(self, "*.pdb", self.package_folder) | |
| def package_info(self): | |
| #plugins = ["libgstrtspclientsink"] | |
| gst_include_path = os.path.join(self.package_folder, "include", "gstreamer-1.0") | |
| self.cpp_info.components["gstreamer-rtsp-server-1.0"].names["pkg_config"] = "gstreamer-rtsp-server-1.0" | |
| self.cpp_info.components["gstreamer-rtsp-server-1.0"].set_property("pkg_config_name", "gstreamer-rtsp-server-1.0") | |
| self.cpp_info.components["gstreamer-rtsp-server-1.0"].libs = ["gstrtspserver-1.0"] | |
| self.cpp_info.components["gstreamer-rtsp-server-1.0"].requires = ["gstreamer::gstreamer-base-1.0", "gstreamer::gstreamer-net-1.0", "glib::gio-2.0", "gst-plugins-base::gstreamer-rtp-1.0" ,"gst-plugins-base::gstreamer-rtsp-1.0", "gst-plugins-base::gstreamer-video-1.0", "gst-plugins-base::gstreamer-sdp-1.0", "gst-plugins-base::gstreamer-app-1.0"] | |
| self.cpp_info.components["gstreamer-rtsp-server-1.0"].includedirs = [gst_include_path] | |
| gst_plugin_path = os.path.join(self.package_folder, "lib", "gstreamer-1.0") | |
| if self.options.shared: | |
| self.runenv_info.prepend_path("GST_PLUGIN_PATH", gst_plugin_path) | |
| self.env_info.GST_PLUGIN_PATH.append(gst_plugin_path) | |
| self.cpp_info.includedirs = ["include", os.path.join("include", "gstreamer-1.0")] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from conan import ConanFile | |
| from conan.errors import ConanInvalidConfiguration | |
| from conan.tools.env import VirtualBuildEnv | |
| from conan.tools.files import chdir, copy, get, rename, rm, rmdir | |
| from conan.tools.gnu import PkgConfigDeps | |
| from conan.tools.layout import basic_layout | |
| from conan.tools.meson import Meson, MesonToolchain | |
| from conan.tools.microsoft import is_msvc, check_min_vs | |
| from conan.tools.scm import Version | |
| import glob | |
| import os | |
| import subprocess | |
| required_conan_version = ">=1.53.0" | |
| class GStreamerConan(ConanFile): | |
| name = "gstreamer" | |
| description = "GStreamer is a development framework for creating applications like media players, video editors, streaming media broadcasters and so on" | |
| topics = ("multimedia", "video", "audio", "broadcasting", "framework", "media") | |
| url = "https://github.com/conan-io/conan-center-index" | |
| homepage = "https://gstreamer.freedesktop.org/" | |
| license = "LGPL-2.0-or-later" | |
| package_type = "library" | |
| settings = "os", "arch", "compiler", "build_type" | |
| options = { | |
| "shared": [True, False], | |
| "fPIC": [True, False], | |
| "with_introspection": [True, False], | |
| "with_tools": [True, False], | |
| } | |
| default_options = { | |
| "shared": False, | |
| "fPIC": True, | |
| "with_introspection": False, | |
| "with_tools": False, | |
| } | |
| 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") | |
| self.settings.rm_safe("compiler.libcxx") | |
| self.settings.rm_safe("compiler.cppstd") | |
| def layout(self): | |
| basic_layout(self, src_folder="src") | |
| def requirements(self): | |
| self.requires("glib/2.74.0@", transitive_headers=True, transitive_libs=True) | |
| def validate(self): | |
| if not self.dependencies.direct_host["glib"].options.shared and self.info.options.shared: | |
| # https://gitlab.freedesktop.org/gstreamer/gst-build/-/issues/133 | |
| raise ConanInvalidConfiguration("shared GStreamer cannot link to static GLib") | |
| def build_requirements(self): | |
| self.tool_requires("meson/1.1.0") | |
| # There used to be an issue with glib being shared by default but its dependencies being static | |
| # No longer the case, but see: https://github.com/conan-io/conan-center-index/pull/13400#issuecomment-1551565573 for context | |
| self.tool_requires("glib/2.74.0@") | |
| if not self.conf.get("tools.gnu:pkg_config", default=False, check_type=str): | |
| self.tool_requires("pkgconf/1.9.3") | |
| if self.options.with_introspection: | |
| self.tool_requires("gobject-introspection/1.72.0") | |
| if self.settings.os == 'Windows': | |
| self.tool_requires("winflexbison/2.5.24") | |
| else: | |
| self.tool_requires("bison/3.8.2") | |
| self.tool_requires("flex/2.6.4") | |
| def source(self): | |
| get(self, **self.conan_data["sources"][self.version], strip_root=True) | |
| def generate(self): | |
| virtual_build_env = VirtualBuildEnv(self) | |
| virtual_build_env.generate() | |
| pkg_config_deps = PkgConfigDeps(self) | |
| pkg_config_deps.generate() | |
| tc = MesonToolchain(self) | |
| if is_msvc(self) and not check_min_vs(self, "190", raise_invalid=False): | |
| tc.project_options["c_std"] = "c99" | |
| tc.project_options["tools"] = "enabled" if self.options.with_tools else "disabled" | |
| tc.project_options["examples"] = "disabled" | |
| tc.project_options["benchmarks"] = "disabled" | |
| tc.project_options["tests"] = "disabled" | |
| tc.project_options["introspection"] = "enabled" if self.options.with_introspection else "disabled" | |
| tc.generate() | |
| def build(self): | |
| meson = Meson(self) | |
| meson.configure() | |
| meson.build() | |
| def _fix_library_names(self, path): | |
| # regression in 1.16 | |
| if is_msvc(self): | |
| with chdir(self, path): | |
| for filename_old in glob.glob("*.a"): | |
| filename_new = filename_old[3:-2] + ".lib" | |
| self.output.info(f"rename {filename_old} into {filename_new}") | |
| rename(self, filename_old, filename_new) | |
| def package(self): | |
| copy(self, "COPYING", self.source_folder, os.path.join(self.package_folder, "licenses")) | |
| meson = Meson(self) | |
| meson.install() | |
| self._fix_library_names(os.path.join(self.package_folder, "lib")) | |
| self._fix_library_names(os.path.join(self.package_folder, "lib", "gstreamer-1.0")) | |
| rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) | |
| rmdir(self, os.path.join(self.package_folder, "lib", "gstreamer-1.0", "pkgconfig")) | |
| rmdir(self, os.path.join(self.package_folder, "share")) | |
| rm(self, "*.pdb", self.package_folder, recursive=True) | |
| def package_info(self): | |
| gst_plugin_path = os.path.join(self.package_folder, "lib", "gstreamer-1.0") | |
| pkgconfig_variables = { | |
| "exec_prefix": "${prefix}", | |
| "toolsdir": "${exec_prefix}/bin", | |
| # PkgConfigDep uses libdir1 instead of libdir, so the path is spelled out explicitly here. | |
| "pluginsdir": "${prefix}/lib/gstreamer-1.0", | |
| "datarootdir": "${prefix}/share", | |
| "datadir": "${datarootdir}", | |
| "girdir": "${datadir}/gir-1.0", | |
| "typelibdir": "${prefix}/lib/girepository-1.0", | |
| "libexecdir": "${prefix}/libexec", | |
| "pluginscannerdir": "${libexecdir}/gstreamer-1.0", | |
| } | |
| pkgconfig_custom_content = "\n".join("{}={}".format(key, value) for key, value in pkgconfig_variables.items()) | |
| self.cpp_info.components["gstreamer-1.0"].set_property("pkg_config_name", "gstreamer-1.0") | |
| self.cpp_info.components["gstreamer-1.0"].names["pkg_config"] = "gstreamer-1.0" | |
| self.cpp_info.components["gstreamer-1.0"].requires = ["glib::glib-2.0", "glib::gobject-2.0"] | |
| if not self.options.shared: | |
| self.cpp_info.components["gstreamer-1.0"].requires.append("glib::gmodule-no-export-2.0") | |
| self.cpp_info.components["gstreamer-1.0"].defines.append("GST_STATIC_COMPILATION") | |
| self.cpp_info.components["gstreamer-1.0"].libs = ["gstreamer-1.0"] | |
| self.cpp_info.components["gstreamer-1.0"].includedirs = [os.path.join("include", "gstreamer-1.0")] | |
| if self.settings.os == "Linux": | |
| self.cpp_info.components["gstreamer-1.0"].system_libs = ["m"] | |
| self.cpp_info.components["gstreamer-1.0"].set_property("pkg_config_custom_content", pkgconfig_custom_content) | |
| self.cpp_info.components["gstreamer-base-1.0"].set_property("pkg_config_name", "gstreamer-base-1.0") | |
| self.cpp_info.components["gstreamer-base-1.0"].names["pkg_config"] = "gstreamer-base-1.0" | |
| self.cpp_info.components["gstreamer-base-1.0"].requires = ["gstreamer-1.0"] | |
| self.cpp_info.components["gstreamer-base-1.0"].libs = ["gstbase-1.0"] | |
| self.cpp_info.components["gstreamer-base-1.0"].includedirs = [os.path.join("include", "gstreamer-1.0")] | |
| self.cpp_info.components["gstreamer-base-1.0"].set_property("pkg_config_custom_content", pkgconfig_custom_content) | |
| self.cpp_info.components["gstreamer-controller-1.0"].set_property("pkg_config_name", "gstreamer-controller-1.0") | |
| self.cpp_info.components["gstreamer-controller-1.0"].names["pkg_config"] = "gstreamer-controller-1.0" | |
| self.cpp_info.components["gstreamer-controller-1.0"].requires = ["gstreamer-1.0"] | |
| self.cpp_info.components["gstreamer-controller-1.0"].libs = ["gstcontroller-1.0"] | |
| self.cpp_info.components["gstreamer-controller-1.0"].includedirs = [os.path.join("include", "gstreamer-1.0")] | |
| if self.settings.os == "Linux": | |
| self.cpp_info.components["gstreamer-controller-1.0"].system_libs = ["m"] | |
| self.cpp_info.components["gstreamer-controller-1.0"].set_property("pkg_config_custom_content", pkgconfig_custom_content) | |
| self.cpp_info.components["gstreamer-net-1.0"].set_property("pkg_config_name", "gstreamer-net-1.0") | |
| self.cpp_info.components["gstreamer-net-1.0"].names["pkg_config"] = "gstreamer-net-1.0" | |
| self.cpp_info.components["gstreamer-net-1.0"].requires = ["gstreamer-1.0", "glib::gio-2.0"] | |
| self.cpp_info.components["gstreamer-net-1.0"].libs = ["gstnet-1.0"] | |
| self.cpp_info.components["gstreamer-net-1.0"].includedirs = [os.path.join("include", "gstreamer-1.0")] | |
| self.cpp_info.components["gstreamer-net-1.0"].set_property("pkg_config_custom_content", pkgconfig_custom_content) | |
| self.cpp_info.components["gstreamer-check-1.0"].set_property("pkg_config_name", "gstreamer-check-1.0") | |
| self.cpp_info.components["gstreamer-check-1.0"].names["pkg_config"] = "gstreamer-check-1.0" | |
| self.cpp_info.components["gstreamer-check-1.0"].requires = ["gstreamer-1.0"] | |
| self.cpp_info.components["gstreamer-check-1.0"].libs = ["gstcheck-1.0"] | |
| self.cpp_info.components["gstreamer-check-1.0"].includedirs = [os.path.join("include", "gstreamer-1.0")] | |
| if self.settings.os == "Linux": | |
| self.cpp_info.components["gstreamer-check-1.0"].system_libs = ["rt", "m"] | |
| self.cpp_info.components["gstreamer-check-1.0"].set_property("pkg_config_custom_content", pkgconfig_custom_content) | |
| # gstcoreelements and gstcoretracers are plugins which should be loaded dynamicaly, and not linked to directly | |
| if not self.options.shared: | |
| self.cpp_info.components["gstcoreelements"].set_property("pkg_config_name", "gstcoreelements") | |
| self.cpp_info.components["gstcoreelements"].names["pkg_config"] = "gstcoreelements" | |
| self.cpp_info.components["gstcoreelements"].requires = ["glib::gobject-2.0", "glib::glib-2.0", "gstreamer-1.0", "gstreamer-base-1.0"] | |
| self.cpp_info.components["gstcoreelements"].libs = ["gstcoreelements"] | |
| self.cpp_info.components["gstcoreelements"].includedirs = [os.path.join("include", "gstreamer-1.0")] | |
| self.cpp_info.components["gstcoreelements"].libdirs = [gst_plugin_path] | |
| self.cpp_info.components["gstcoretracers"].set_property("pkg_config_name", "gstcoretracers") | |
| self.cpp_info.components["gstcoretracers"].names["pkg_config"] = "gstcoretracers" | |
| self.cpp_info.components["gstcoretracers"].requires = ["gstreamer-1.0"] | |
| self.cpp_info.components["gstcoretracers"].libs = ["gstcoretracers"] | |
| self.cpp_info.components["gstcoretracers"].includedirs = [os.path.join("include", "gstreamer-1.0")] | |
| self.cpp_info.components["gstcoretracers"].libdirs = [gst_plugin_path] | |
| if self.options.shared: | |
| self.runenv_info.define_path("GST_PLUGIN_PATH", gst_plugin_path) | |
| gstreamer_root = self.package_folder | |
| gst_plugin_scanner = "gst-plugin-scanner.exe" if self.settings.os == "Windows" else "gst-plugin-scanner" | |
| gst_plugin_scanner = os.path.join(self.package_folder, "bin", "gstreamer-1.0", gst_plugin_scanner) | |
| self.runenv_info.define_path("GSTREAMER_ROOT", gstreamer_root) | |
| self.runenv_info.define_path("GST_PLUGIN_SCANNER", gst_plugin_scanner) | |
| if self.settings.arch == "x86": | |
| self.runenv_info.define_path("GSTREAMER_ROOT_X86", gstreamer_root) | |
| elif self.settings.arch == "x86_64": | |
| self.runenv_info.define_path("GSTREAMER_ROOT_X86_64", gstreamer_root) | |
| # TODO: remove the following when only Conan 2.0 is supported | |
| if self.options.shared: | |
| self.env_info.GST_PLUGIN_PATH.append(gst_plugin_path) | |
| self.env_info.GSTREAMER_ROOT = gstreamer_root | |
| self.env_info.GST_PLUGIN_SCANNER = gst_plugin_scanner | |
| if self.settings.arch == "x86": | |
| self.env_info.GSTREAMER_ROOT_X86 = gstreamer_root | |
| elif self.settings.arch == "x86_64": | |
| self.env_info.GSTREAMER_ROOT_X86_64 = gstreamer_root |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment