mirror of
https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs.git
synced 2025-04-24 17:44:32 +00:00
webrtc: Rename and add to meson build the signalling server
The binary was only called `server` it has been renamed to `gst-webrtc-signalling-server` and is installed in meson.
This commit is contained in:
parent
60223d127e
commit
5c89c3db69
5 changed files with 81 additions and 32 deletions
|
@ -217,7 +217,7 @@ meson shared:
|
||||||
script:
|
script:
|
||||||
- meson build --default-library=shared --prefix=$(pwd)/install
|
- meson build --default-library=shared --prefix=$(pwd)/install
|
||||||
- ninja -C build install
|
- ninja -C build install
|
||||||
- ./ci/check-plugins-installed.py install
|
- ./ci/check-installed.py install
|
||||||
- ninja -C build docs/gst_plugins_cache.json
|
- ninja -C build docs/gst_plugins_cache.json
|
||||||
- ci/check-documentation-diff.py
|
- ci/check-documentation-diff.py
|
||||||
artifacts:
|
artifacts:
|
||||||
|
|
|
@ -21,20 +21,19 @@ PARSER.add_argument('extra_env')
|
||||||
PARSER.add_argument('prefix', type=P)
|
PARSER.add_argument('prefix', type=P)
|
||||||
PARSER.add_argument('libdir', type=P)
|
PARSER.add_argument('libdir', type=P)
|
||||||
PARSER.add_argument('--version', default=None)
|
PARSER.add_argument('--version', default=None)
|
||||||
|
PARSER.add_argument('--bin', default=None, type=P)
|
||||||
PARSER.add_argument('--exts', nargs="+", default=[])
|
PARSER.add_argument('--exts', nargs="+", default=[])
|
||||||
PARSER.add_argument('--depfile')
|
PARSER.add_argument('--depfile')
|
||||||
PARSER.add_argument('--disable-doc', action="store_true", default=False)
|
PARSER.add_argument('--disable-doc', action="store_true", default=False)
|
||||||
|
|
||||||
|
|
||||||
def generate_depfile_for(libfile):
|
def generate_depfile_for(fpath):
|
||||||
file_stem = libfile.parent / libfile.stem
|
file_stem = fpath.parent / fpath.stem
|
||||||
depfile_content = ""
|
depfile_content = ""
|
||||||
with open(f"{file_stem}.d", 'r') as depfile:
|
with open(f"{file_stem}.d", 'r') as depfile:
|
||||||
for l in depfile.readlines():
|
for l in depfile.readlines():
|
||||||
if l.startswith(str(file_stem)):
|
if l.startswith(str(file_stem)):
|
||||||
output, srcs = l.split(":", maxsplit=2)
|
output, srcs = l.split(":", maxsplit=2)
|
||||||
output = re.sub(f"^{file_stem}",
|
|
||||||
f"{opts.build_dir / libfile.stem}", f)
|
|
||||||
|
|
||||||
all_deps = []
|
all_deps = []
|
||||||
for src in srcs.split(" "):
|
for src in srcs.split(" "):
|
||||||
|
@ -74,11 +73,15 @@ if __name__ == "__main__":
|
||||||
env[k] = v
|
env[k] = v
|
||||||
|
|
||||||
if opts.command == 'build':
|
if opts.command == 'build':
|
||||||
cargo_cmd = ['cargo', 'cbuild']
|
cargo_cmd = ['cargo']
|
||||||
|
if opts.bin:
|
||||||
|
cargo_cmd += ['build']
|
||||||
|
else:
|
||||||
|
cargo_cmd += ['cbuild']
|
||||||
|
if not opts.disable_doc:
|
||||||
|
cargo_cmd += ['--features', "doc"]
|
||||||
if opts.target == 'release':
|
if opts.target == 'release':
|
||||||
cargo_cmd.append('--release')
|
cargo_cmd.append('--release')
|
||||||
if not opts.disable_doc:
|
|
||||||
cargo_cmd += ['--features', "doc"]
|
|
||||||
elif opts.command == 'test':
|
elif opts.command == 'test':
|
||||||
# cargo test
|
# cargo test
|
||||||
cargo_cmd = ['cargo', 'ctest', '--no-fail-fast', '--color=always']
|
cargo_cmd = ['cargo', 'ctest', '--no-fail-fast', '--color=always']
|
||||||
|
@ -86,41 +89,54 @@ if __name__ == "__main__":
|
||||||
print("Unknown command:", opts.command, file=logfile)
|
print("Unknown command:", opts.command, file=logfile)
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
cargo_cmd.extend(['--manifest-path', opts.src_dir / 'Cargo.toml'])
|
cwd = None
|
||||||
cargo_cmd.extend(['--prefix', opts.prefix, '--libdir',
|
if not opts.bin:
|
||||||
opts.prefix / opts.libdir])
|
cargo_cmd.extend(['--manifest-path', opts.src_dir / 'Cargo.toml'])
|
||||||
|
cargo_cmd.extend(['--prefix', opts.prefix, '--libdir',
|
||||||
|
opts.prefix / opts.libdir])
|
||||||
|
for p in opts.include.split(','):
|
||||||
|
cargo_cmd.extend(['-p', p])
|
||||||
|
else:
|
||||||
|
cargo_cmd.extend(['--bin', opts.bin.name])
|
||||||
|
cwd = opts.src_dir
|
||||||
|
|
||||||
def run(cargo_cmd, env):
|
def run(cargo_cmd, env, cwd=cwd):
|
||||||
try:
|
try:
|
||||||
subprocess.run(cargo_cmd, env=env, check=True)
|
subprocess.run(cargo_cmd, env=env, check=True, cwd=cwd)
|
||||||
except subprocess.SubprocessError:
|
except subprocess.SubprocessError:
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
for p in opts.include.split(','):
|
run(cargo_cmd, env, cwd)
|
||||||
cargo_cmd.extend(['-p', p])
|
|
||||||
run(cargo_cmd, env)
|
|
||||||
|
|
||||||
if opts.command == 'build':
|
if opts.command == 'build':
|
||||||
target_dir = cargo_target_dir / '**' / opts.target
|
target_dir = cargo_target_dir / '**' / opts.target
|
||||||
|
if opts.bin:
|
||||||
|
if opts.exts[0]:
|
||||||
|
ext = f'.{opts.exts[0]}'
|
||||||
|
else:
|
||||||
|
ext = ''
|
||||||
|
exe = glob.glob(str(target_dir / opts.bin) + ext, recursive=True)[0]
|
||||||
|
shutil.copy2(exe, opts.build_dir)
|
||||||
|
depfile_content = generate_depfile_for(P(exe))
|
||||||
|
else:
|
||||||
|
# Copy so files to build dir
|
||||||
|
depfile_content = ""
|
||||||
|
for ext in opts.exts:
|
||||||
|
for f in glob.glob(str(target_dir / f'*.{ext}'), recursive=True):
|
||||||
|
libfile = P(f)
|
||||||
|
|
||||||
# Copy so files to build dir
|
depfile_content += generate_depfile_for(libfile)
|
||||||
depfile_content = ""
|
|
||||||
for ext in opts.exts:
|
|
||||||
for f in glob.glob(str(target_dir / f'*.{ext}'), recursive=True):
|
|
||||||
libfile = P(f)
|
|
||||||
|
|
||||||
depfile_content += generate_depfile_for(libfile)
|
copied_file = (opts.build_dir / libfile.name)
|
||||||
|
try:
|
||||||
|
if copied_file.stat().st_mtime == libfile.stat().st_mtime:
|
||||||
|
print(f"{copied_file} has not changed.", file=logfile)
|
||||||
|
continue
|
||||||
|
except FileNotFoundError:
|
||||||
|
pass
|
||||||
|
|
||||||
copied_file = (opts.build_dir / libfile.name)
|
print(f"Copying {copied_file}", file=logfile)
|
||||||
try:
|
shutil.copy2(f, opts.build_dir)
|
||||||
if copied_file.stat().st_mtime == libfile.stat().st_mtime:
|
|
||||||
print(f"{copied_file} has not changed.", file=logfile)
|
|
||||||
continue
|
|
||||||
except FileNotFoundError:
|
|
||||||
pass
|
|
||||||
|
|
||||||
print(f"Copying {copied_file}", file=logfile)
|
|
||||||
shutil.copy2(f, opts.build_dir)
|
|
||||||
|
|
||||||
with open(opts.depfile, 'w') as depfile:
|
with open(opts.depfile, 'w') as depfile:
|
||||||
depfile.write(depfile_content)
|
depfile.write(depfile_content)
|
||||||
|
|
|
@ -23,5 +23,9 @@ for name in iterate_plugins():
|
||||||
print(name, "missing in", prefix)
|
print(name, "missing in", prefix)
|
||||||
success = False
|
success = False
|
||||||
|
|
||||||
|
if len(glob.glob(os.path.join(prefix, '**', 'bin', 'gst-webrtc-signalling-server'), recursive=True)) != 1:
|
||||||
|
print("gst-webrtc-signalling-serverm is missing in", prefix)
|
||||||
|
success = False
|
||||||
|
|
||||||
if not success:
|
if not success:
|
||||||
sys.exit(1)
|
sys.exit(1)
|
25
meson.build
25
meson.build
|
@ -23,7 +23,9 @@ if not cargo_c.found()
|
||||||
endif
|
endif
|
||||||
|
|
||||||
system = build_machine.system()
|
system = build_machine.system()
|
||||||
|
ext_exe = ''
|
||||||
if system == 'windows'
|
if system == 'windows'
|
||||||
|
ext_exe = 'exe'
|
||||||
ext_dynamic = 'dll'
|
ext_dynamic = 'dll'
|
||||||
ext_static = 'lib'
|
ext_static = 'lib'
|
||||||
elif system == 'darwin'
|
elif system == 'darwin'
|
||||||
|
@ -286,6 +288,29 @@ custom_target('gst-plugins-rs-pc-files',
|
||||||
depends: rs_plugins,
|
depends: rs_plugins,
|
||||||
command: [python, '-c', '""'])
|
command: [python, '-c', '""'])
|
||||||
|
|
||||||
|
|
||||||
|
custom_target('gst-webrtc-signalling-server',
|
||||||
|
build_by_default: true,
|
||||||
|
output: 'gst-webrtc-signalling-server',
|
||||||
|
console: true,
|
||||||
|
install: true,
|
||||||
|
install_dir: get_option('bindir'),
|
||||||
|
depfile: 'gst-webrtc-signalling-server.dep',
|
||||||
|
command: [cargo_wrapper,
|
||||||
|
'build',
|
||||||
|
meson.current_build_dir(),
|
||||||
|
meson.current_source_dir(),
|
||||||
|
meson.global_build_root(),
|
||||||
|
target,
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
get_option('prefix'),
|
||||||
|
get_option('libdir'),
|
||||||
|
'--depfile', '@DEPFILE@',
|
||||||
|
'--exts', ext_exe,
|
||||||
|
'--bin', 'gst-webrtc-signalling-server'
|
||||||
|
])
|
||||||
|
|
||||||
test('tests',
|
test('tests',
|
||||||
cargo_wrapper,
|
cargo_wrapper,
|
||||||
args: ['test',
|
args: ['test',
|
||||||
|
|
|
@ -25,3 +25,7 @@ thiserror = "1"
|
||||||
test-log = { version = "0.2", features = ["trace"], default-features = false }
|
test-log = { version = "0.2", features = ["trace"], default-features = false }
|
||||||
pin-project-lite = "0.2"
|
pin-project-lite = "0.2"
|
||||||
gst_plugin_webrtc_protocol = { version = "0.9", path="../protocol", package = "gst-plugin-webrtc-signalling-protocol" }
|
gst_plugin_webrtc_protocol = { version = "0.9", path="../protocol", package = "gst-plugin-webrtc-signalling-protocol" }
|
||||||
|
|
||||||
|
[[bin]]
|
||||||
|
name = "gst-webrtc-signalling-server"
|
||||||
|
path = "src/bin/server.rs"
|
||||||
|
|
Loading…
Reference in a new issue