From b7864dee4cdfb78bcfa0db4146d15236fb02b73c Mon Sep 17 00:00:00 2001 From: Nirbheek Chauhan Date: Thu, 8 Feb 2024 07:52:51 +0530 Subject: cerbero: packages are a cargo feature, not cargo-c Part-of: --- cerbero/build/build.py | 24 +++++++++++------------- recipes/gst-plugins-rs.recipe | 4 ++-- 2 files changed, 13 insertions(+), 15 deletions(-) diff --git a/cerbero/build/build.py b/cerbero/build/build.py index 1bd2232c..efdb4b71 100644 --- a/cerbero/build/build.py +++ b/cerbero/build/build.py @@ -1173,9 +1173,11 @@ class Cargo(Build, ModifyEnvBase): srcdir = '.' can_msvc = True cargo_features = None + cargo_packages = None def __init__(self): self.cargo_features = self.cargo_features or [] + self.cargo_packages = self.cargo_packages or [] Build.__init__(self) ModifyEnvBase.__init__(self) @@ -1225,10 +1227,13 @@ class Cargo(Build, ModifyEnvBase): return min(determine_num_cargo_jobs(), self.config.num_of_cpus) return 1 - def get_cargo_features_args(self): - if not self.cargo_features: - return [] - return ['--features=' + ','.join(self.cargo_features)] + def get_cargo_args(self): + args = self.cargo_args[:] + if self.cargo_features: + args += ['--features=' + ','.join(self.cargo_features)] + for package in self.cargo_packages: + args += ['-p', package] + return args def append_config_toml(self, s): dot_cargo = os.path.join(self.config_src_dir, '.cargo') @@ -1308,7 +1313,7 @@ class Cargo(Build, ModifyEnvBase): self.cargo, 'install', '--path', self.config_src_dir, '--root', self.config.prefix, - ] + self.cargo_args + self.get_cargo_features_args() + ] + self.get_cargo_args() await self.retry_run(shell.async_call, cmd, logfile=self.logfile, env=self.env) @@ -1318,10 +1323,7 @@ class CargoC(Cargo): ''' srcdir = '.' - cargoc_packages = None - def __init__(self): - self.cargoc_packages = self.cargoc_packages or [] Cargo.__init__(self) def get_cargoc_args(self): @@ -1335,11 +1337,7 @@ class CargoC(Cargo): cargoc_args += ['--library-type', 'staticlib'] if self.library_type in (LibraryType.SHARED, LibraryType.BOTH): cargoc_args += ['--library-type', 'cdylib'] - cargoc_args += self.cargo_args - for package in self.cargoc_packages: - args = ['-p', package] - cargoc_args += args - cargoc_args += self.get_cargo_features_args() + cargoc_args += self.get_cargo_args() return cargoc_args @modify_environment diff --git a/recipes/gst-plugins-rs.recipe b/recipes/gst-plugins-rs.recipe index b8264e0c..37da7410 100644 --- a/recipes/gst-plugins-rs.recipe +++ b/recipes/gst-plugins-rs.recipe @@ -26,7 +26,7 @@ class Recipe(recipe.Recipe): }] btype = BuildType.CARGO_C - cargoc_packages = [ + cargo_packages = [ 'audiofx', 'aws', 'cdg', @@ -115,7 +115,7 @@ class Recipe(recipe.Recipe): for name in names: self.enable_plugin(name, category) - self.cargoc_packages = [f'gst-plugin-{pkg}' for pkg in self.cargoc_packages] + self.cargo_packages = [f'gst-plugin-{pkg}' for pkg in self.cargo_packages] # Build with Cerbero's latest glib version as minimum version self.cargo_features += ['glib/v2_74', 'gio/v2_74'] # Enable assembly optimizations via nasm -- cgit v1.2.3