meson: install plugins pc files

This commit is contained in:
Guillaume Desmottes 2020-11-26 16:50:04 +01:00
parent dfdbd370f9
commit 32d511684e
2 changed files with 46 additions and 5 deletions

View file

@ -9,8 +9,8 @@ import sys
PLUGIN_DIRS = ['audio', 'generic', 'net', 'text', 'utils', 'video']
command, meson_build_dir, meson_current_source_dir, meson_build_root, target, exclude, extra_env = sys.argv[
1:8]
command, meson_build_dir, meson_current_source_dir, meson_build_root, target, exclude, extra_env, prefix, libdir = sys.argv[
1:10]
cargo_target_dir = os.path.join(meson_build_dir, 'target')
@ -28,10 +28,10 @@ if len(extra_env) > 0:
if command == 'build':
# cargo build
ext = sys.argv[8]
ext = sys.argv[10]
# when using --default-library=both 2 extensions are passed
try:
ext2 = sys.argv[9]
ext2 = sys.argv[11]
except IndexError:
ext2 = None
@ -46,6 +46,9 @@ else:
print("Unknown command:", command)
sys.exit(1)
cargo_cmd.extend(['--prefix', prefix, '--libdir',
os.path.join(prefix, libdir)])
def run(cargo_cmd, env):
try:
@ -71,3 +74,17 @@ if command == 'build':
if ext2:
for f in glob.glob(os.path.join(cargo_target_dir, target, '*.' + ext2)):
shutil.copy(f, meson_build_dir)
# Copy generated pkg-config files
for f in glob.glob(os.path.join(cargo_target_dir, target, '*.pc')):
shutil.copy(f, meson_build_dir)
# Move -uninstalled.pc to meson-uninstalled
uninstalled = os.path.join(meson_build_dir, 'meson-uninstalled')
if not os.path.exists(uninstalled):
os.mkdir(uninstalled)
for f in glob.glob(os.path.join(meson_build_dir, '*-uninstalled.pc')):
# move() does not allow us to update the file so remove it if it already exists
dest = os.path.join(uninstalled, os.path.basename(f))
if os.path.exists(dest):
os.unlink(dest)
shutil.move(f, uninstalled)

View file

@ -106,6 +106,12 @@ if get_option('default_library') == 'static' or get_option('default_library') ==
endforeach
endif
pc_files = []
foreach p, lib : plugins_rep
# skip the 'lib' prefix in plugin name
pc_files += [lib.substring(3) + '.pc']
endforeach
# Need to depends on all gstreamer-rs deps to ensure they are built
# before gstreamer-rs when building with gst-build.
# Custom targets can't depend on dependency() objects so we have to depend
@ -144,6 +150,7 @@ endforeach
extra_env_str = ','.join(extra_env_list)
plugins_install_dir = get_option('libdir') / 'gstreamer-1.0'
pkgconfig_install_dir = get_option('libdir') / 'pkgconfig'
# Always build the target so we don't have to list all source files as input
rs_plugins = custom_target('gst-plugins-rs',
@ -162,10 +169,25 @@ rs_plugins = custom_target('gst-plugins-rs',
target,
exclude,
extra_env_str,
get_option('prefix'),
get_option('libdir'),
extensions])
plugins = rs_plugins.to_list()
# We don't need to pass a command as we depends on the target above
# but it is currently mandatory ( https://github.com/mesonbuild/meson/issues/8059 )
# so use python as it's guaranteed to be present on any setup
python = import('python').find_installation()
custom_target('gst-plugins-rs-pc-files',
build_by_default: true,
output: pc_files,
console: true,
install: true,
install_dir: pkgconfig_install_dir,
depends: rs_plugins,
command: [python, '-c', '""'])
test('tests',
cargo_wrapper,
args: ['test',
@ -174,5 +196,7 @@ test('tests',
meson.build_root(),
target,
exclude,
extra_env_str],
extra_env_str,
get_option('prefix'),
get_option('libdir')],
timeout: 600)