diff --git a/audio/audiofx/Cargo.toml b/audio/audiofx/Cargo.toml index 85dd5fa9..6a264e0f 100644 --- a/audio/audiofx/Cargo.toml +++ b/audio/audiofx/Cargo.toml @@ -20,7 +20,7 @@ nnnoiseless = { version = "0.3", default-features = false } [lib] name = "gstrsaudiofx" -crate-type = ["cdylib", "rlib"] +crate-type = ["cdylib", "rlib", "staticlib"] path = "src/lib.rs" [dev-dependencies] diff --git a/audio/claxon/Cargo.toml b/audio/claxon/Cargo.toml index 149af82c..2f8101c0 100644 --- a/audio/claxon/Cargo.toml +++ b/audio/claxon/Cargo.toml @@ -18,7 +18,7 @@ atomic_refcell = "0.1" [lib] name = "gstclaxon" -crate-type = ["cdylib", "rlib"] +crate-type = ["cdylib", "rlib", "staticlib"] path = "src/lib.rs" [build-dependencies] diff --git a/audio/csound/Cargo.toml b/audio/csound/Cargo.toml index 034ea4cf..0ef87902 100644 --- a/audio/csound/Cargo.toml +++ b/audio/csound/Cargo.toml @@ -19,7 +19,7 @@ byte-slice-cast = "1.0" [lib] name = "gstcsound" -crate-type = ["cdylib", "rlib"] +crate-type = ["cdylib", "rlib", "staticlib"] path = "src/lib.rs" [[example]] diff --git a/audio/lewton/Cargo.toml b/audio/lewton/Cargo.toml index 1e5cef57..444c9e7d 100644 --- a/audio/lewton/Cargo.toml +++ b/audio/lewton/Cargo.toml @@ -19,7 +19,7 @@ lazy_static = "1.0" [lib] name = "gstlewton" -crate-type = ["cdylib", "rlib"] +crate-type = ["cdylib", "rlib", "staticlib"] path = "src/lib.rs" [build-dependencies] diff --git a/cargo_wrapper.py b/cargo_wrapper.py index f951c514..23c0dabc 100644 --- a/cargo_wrapper.py +++ b/cargo_wrapper.py @@ -27,6 +27,12 @@ if len(extra_env) > 0: if command == 'build': # cargo build ext = sys.argv[8] + # when using --default-library=both 2 extensions are passed + try: + ext2 = sys.argv[9] + except IndexError: + ext2 = None + cargo_cmd = ['cargo', 'build', '--all-targets', '--manifest-path', os.path.join( meson_current_source_dir, 'Cargo.toml'), @@ -56,3 +62,6 @@ if command == 'build': # Copy so files to build dir for f in glob.glob(os.path.join(cargo_target_dir, target, '*.' + ext)): shutil.copy(f, meson_build_dir) + if ext2: + for f in glob.glob(os.path.join(cargo_target_dir, target, '*.' + ext2)): + shutil.copy(f, meson_build_dir) diff --git a/generic/file/Cargo.toml b/generic/file/Cargo.toml index ae0f4b24..9493baf6 100644 --- a/generic/file/Cargo.toml +++ b/generic/file/Cargo.toml @@ -15,7 +15,7 @@ lazy_static = "1.0" [lib] name = "gstrsfile" -crate-type = ["cdylib", "rlib"] +crate-type = ["cdylib", "rlib", "staticlib"] path = "src/lib.rs" [build-dependencies] diff --git a/generic/sodium/Cargo.toml b/generic/sodium/Cargo.toml index ebb68a00..bb811901 100644 --- a/generic/sodium/Cargo.toml +++ b/generic/sodium/Cargo.toml @@ -35,7 +35,7 @@ package="gstreamer-app" [lib] name = "gstsodium" -crate-type = ["cdylib", "rlib"] +crate-type = ["cdylib", "rlib", "staticlib"] path = "src/lib.rs" [[example]] diff --git a/generic/threadshare/Cargo.toml b/generic/threadshare/Cargo.toml index 1c8da3c4..53122568 100644 --- a/generic/threadshare/Cargo.toml +++ b/generic/threadshare/Cargo.toml @@ -36,7 +36,7 @@ socket2 = { version = "0.3", features = ["reuseport"] } [lib] name = "gstthreadshare" -crate-type = ["cdylib", "rlib"] +crate-type = ["cdylib", "rlib", "staticlib"] path = "src/lib.rs" [[example]] diff --git a/meson.build b/meson.build index ba36b173..4ef622fb 100644 --- a/meson.build +++ b/meson.build @@ -15,11 +15,14 @@ cargo_wrapper = find_program('cargo_wrapper.py') system = build_machine.system() if system == 'windows' - ext = 'dll' + ext_dynamic = 'dll' + ext_static = 'lib' elif system == 'darwin' - ext = 'dylib' + ext_dynamic = 'dylib' + ext_static = 'a' else - ext = 'so' + ext_dynamic = 'so' + ext_static = 'a' endif plugins_rep = { @@ -82,10 +85,22 @@ endif output = [] -foreach p, lib : plugins_rep - # Add the plugin file as output - output += [lib + '.' + ext] -endforeach +extensions = [] + +# Add the plugin file as output +if get_option('default_library') == 'shared' or get_option('default_library') == 'both' + extensions += [ext_dynamic] + foreach p, lib : plugins_rep + output += [lib + '.' + ext_dynamic] + endforeach +endif + +if get_option('default_library') == 'static' or get_option('default_library') == 'both' + extensions += [ext_static] + foreach p, lib : plugins_rep + output += [lib + '.' + ext_static] + endforeach +endif # Need to depends on all gstreamer-rs deps to ensure they are built # before gstreamer-rs when building with gst-build. @@ -143,7 +158,7 @@ rs_plugins = custom_target('gst-plugins-rs', target, exclude, extra_env_str, - ext]) + extensions]) # FIXME: raises a warning as the target has multiple outputs and meson will use # only the first one. All the plugins have the same basedir, hence diff --git a/net/reqwest/Cargo.toml b/net/reqwest/Cargo.toml index 367f6fc7..cc9a6b6e 100644 --- a/net/reqwest/Cargo.toml +++ b/net/reqwest/Cargo.toml @@ -24,7 +24,7 @@ hyper = "0.13" [lib] name = "gstreqwest" -crate-type = ["cdylib", "rlib"] +crate-type = ["cdylib", "rlib", "staticlib"] path = "src/lib.rs" [build-dependencies] diff --git a/net/rusoto/Cargo.toml b/net/rusoto/Cargo.toml index 8e898bbc..aecee5e9 100644 --- a/net/rusoto/Cargo.toml +++ b/net/rusoto/Cargo.toml @@ -34,7 +34,7 @@ serde_json = "1" [lib] name = "gstrusoto" -crate-type = ["cdylib", "rlib"] +crate-type = ["cdylib", "rlib", "staticlib"] path = "src/lib.rs" [build-dependencies] diff --git a/text/wrap/Cargo.toml b/text/wrap/Cargo.toml index 594e1855..20ae8cfb 100644 --- a/text/wrap/Cargo.toml +++ b/text/wrap/Cargo.toml @@ -20,7 +20,7 @@ package="gstreamer" [lib] name = "gstrstextwrap" -crate-type = ["cdylib", "rlib"] +crate-type = ["cdylib", "rlib", "staticlib"] path = "src/lib.rs" [build-dependencies] diff --git a/tutorial/Cargo.toml b/tutorial/Cargo.toml index 5c45fa9f..f3f2e70f 100644 --- a/tutorial/Cargo.toml +++ b/tutorial/Cargo.toml @@ -19,7 +19,7 @@ once_cell = "1.0" [lib] name = "gstrstutorial" -crate-type = ["cdylib", "rlib"] +crate-type = ["cdylib", "rlib", "staticlib"] path = "src/lib.rs" [build-dependencies] diff --git a/utils/fallbackswitch/Cargo.toml b/utils/fallbackswitch/Cargo.toml index 6f999415..5084d0b2 100644 --- a/utils/fallbackswitch/Cargo.toml +++ b/utils/fallbackswitch/Cargo.toml @@ -27,7 +27,7 @@ gst-check = { package = "gstreamer-check", git = "https://gitlab.freedesktop.org [lib] name = "gstfallbackswitch" -crate-type = ["cdylib", "rlib"] +crate-type = ["cdylib", "rlib", "staticlib"] path = "src/lib.rs" [[example]] diff --git a/utils/togglerecord/Cargo.toml b/utils/togglerecord/Cargo.toml index 44c5ab5d..62728639 100644 --- a/utils/togglerecord/Cargo.toml +++ b/utils/togglerecord/Cargo.toml @@ -23,7 +23,7 @@ either = "1.0" [lib] name = "gsttogglerecord" -crate-type = ["cdylib", "rlib"] +crate-type = ["cdylib", "rlib", "staticlib"] path = "src/lib.rs" [[example]] diff --git a/video/cdg/Cargo.toml b/video/cdg/Cargo.toml index 56a71e87..604a5b03 100644 --- a/video/cdg/Cargo.toml +++ b/video/cdg/Cargo.toml @@ -21,7 +21,7 @@ lazy_static = "1.0" [lib] name = "gstcdg" -crate-type = ["cdylib", "rlib"] +crate-type = ["cdylib", "rlib", "staticlib"] path = "src/lib.rs" [build-dependencies] diff --git a/video/closedcaption/Cargo.toml b/video/closedcaption/Cargo.toml index 1518bdaf..b81088c6 100644 --- a/video/closedcaption/Cargo.toml +++ b/video/closedcaption/Cargo.toml @@ -46,7 +46,7 @@ package="gstreamer-check" [lib] name = "gstrsclosedcaption" -crate-type = ["cdylib", "rlib"] +crate-type = ["cdylib", "rlib", "staticlib"] path = "src/lib.rs" [build-dependencies] diff --git a/video/dav1d/Cargo.toml b/video/dav1d/Cargo.toml index ee2eaca3..df6582ab 100644 --- a/video/dav1d/Cargo.toml +++ b/video/dav1d/Cargo.toml @@ -17,7 +17,7 @@ lazy_static = "1.0" [lib] name = "gstrsdav1d" -crate-type = ["cdylib", "rlib"] +crate-type = ["cdylib", "rlib", "staticlib"] path = "src/lib.rs" [build-dependencies] diff --git a/video/flavors/Cargo.toml b/video/flavors/Cargo.toml index a383a99d..3636d5ac 100644 --- a/video/flavors/Cargo.toml +++ b/video/flavors/Cargo.toml @@ -21,7 +21,7 @@ smallvec = "1.0" [lib] name = "gstrsflv" -crate-type = ["cdylib", "rlib"] +crate-type = ["cdylib", "rlib", "staticlib"] path = "src/lib.rs" [build-dependencies] diff --git a/video/gif/Cargo.toml b/video/gif/Cargo.toml index 6973980a..07995281 100644 --- a/video/gif/Cargo.toml +++ b/video/gif/Cargo.toml @@ -18,7 +18,7 @@ once_cell = "1" [lib] name = "gstgif" -crate-type = ["cdylib", "rlib"] +crate-type = ["cdylib", "rlib", "staticlib"] path = "src/lib.rs" [[example]] diff --git a/video/rav1e/Cargo.toml b/video/rav1e/Cargo.toml index 758903ed..5ed1db60 100644 --- a/video/rav1e/Cargo.toml +++ b/video/rav1e/Cargo.toml @@ -18,7 +18,7 @@ lazy_static = "1.0" [lib] name = "gstrav1e" -crate-type = ["cdylib", "rlib"] +crate-type = ["cdylib", "rlib", "staticlib"] path = "src/lib.rs" [build-dependencies] diff --git a/video/rspng/Cargo.toml b/video/rspng/Cargo.toml index aa5da4d0..b7d52446 100644 --- a/video/rspng/Cargo.toml +++ b/video/rspng/Cargo.toml @@ -19,7 +19,7 @@ atomic_refcell = "0.1" [lib] name = "gstrspng" -crate-type = ["cdylib", "rlib"] +crate-type = ["cdylib", "rlib", "staticlib"] path = "src/lib.rs" [build-dependencies]