feat: add support for building and installing lib32 companion packages with --lib32-only flag
This commit is contained in:
+33
-4
@@ -184,8 +184,9 @@ fn build_lib32_companion_package(
|
|||||||
config: &config::Config,
|
config: &config::Config,
|
||||||
cross_config: Option<&cross::CrossConfig>,
|
cross_config: Option<&cross::CrossConfig>,
|
||||||
export_compiler_flags: bool,
|
export_compiler_flags: bool,
|
||||||
|
force: bool,
|
||||||
) -> Result<Option<(package::PackageSpec, PathBuf)>> {
|
) -> Result<Option<(package::PackageSpec, PathBuf)>> {
|
||||||
if !pkg_spec.build.flags.build_32 {
|
if !pkg_spec.build.flags.build_32 && !force {
|
||||||
return Ok(None);
|
return Ok(None);
|
||||||
}
|
}
|
||||||
if pkg_spec.is_metapackage() {
|
if pkg_spec.is_metapackage() {
|
||||||
@@ -197,7 +198,9 @@ fn build_lib32_companion_package(
|
|||||||
}
|
}
|
||||||
|
|
||||||
crate::log_info!("Running separate lib32 build pass...");
|
crate::log_info!("Running separate lib32 build pass...");
|
||||||
let lib32_build_spec = make_lib32_build_spec(pkg_spec);
|
let mut lib32_input = pkg_spec.clone();
|
||||||
|
lib32_input.build.flags.build_32 = true;
|
||||||
|
let lib32_build_spec = make_lib32_build_spec(&lib32_input);
|
||||||
let lib32_install_destdir = config
|
let lib32_install_destdir = config
|
||||||
.build_dir
|
.build_dir
|
||||||
.join("destdir")
|
.join("destdir")
|
||||||
@@ -801,6 +804,10 @@ struct Cli {
|
|||||||
#[arg(long, global = true)]
|
#[arg(long, global = true)]
|
||||||
dry_run: bool,
|
dry_run: bool,
|
||||||
|
|
||||||
|
/// Build/install only the lib32 companion package path (skip primary package output)
|
||||||
|
#[arg(long, global = true)]
|
||||||
|
lib32_only: bool,
|
||||||
|
|
||||||
#[command(subcommand)]
|
#[command(subcommand)]
|
||||||
command: Commands,
|
command: Commands,
|
||||||
}
|
}
|
||||||
@@ -1210,6 +1217,10 @@ fn main() -> Result<()> {
|
|||||||
(pkg_spec, None)
|
(pkg_spec, None)
|
||||||
};
|
};
|
||||||
|
|
||||||
|
if cli.lib32_only && staging_dir.is_some() {
|
||||||
|
anyhow::bail!("--lib32-only is only supported when installing from a package spec");
|
||||||
|
}
|
||||||
|
|
||||||
ui::info(format!(
|
ui::info(format!(
|
||||||
"Package: {} v{}-{}",
|
"Package: {} v{}-{}",
|
||||||
pkg_spec.package.name, pkg_spec.package.version, pkg_spec.package.revision
|
pkg_spec.package.name, pkg_spec.package.version, pkg_spec.package.revision
|
||||||
@@ -1363,6 +1374,7 @@ fn main() -> Result<()> {
|
|||||||
.join("destdir")
|
.join("destdir")
|
||||||
.join(&pkg_spec.package.name);
|
.join(&pkg_spec.package.name);
|
||||||
|
|
||||||
|
if !cli.lib32_only {
|
||||||
builder::build(
|
builder::build(
|
||||||
&pkg_spec,
|
&pkg_spec,
|
||||||
&src_dir,
|
&src_dir,
|
||||||
@@ -1374,10 +1386,12 @@ fn main() -> Result<()> {
|
|||||||
// 3.1 Copy license files into staged tree
|
// 3.1 Copy license files into staged tree
|
||||||
staging::add_licenses(&src_dir, &destdir, &pkg_spec.package.name)?;
|
staging::add_licenses(&src_dir, &destdir, &pkg_spec.package.name)?;
|
||||||
install::scripts::stage_scripts_from_spec_dir(&pkg_spec, &destdir)?;
|
install::scripts::stage_scripts_from_spec_dir(&pkg_spec, &destdir)?;
|
||||||
|
}
|
||||||
|
|
||||||
destdir
|
destdir
|
||||||
};
|
};
|
||||||
|
|
||||||
|
if !cli.lib32_only {
|
||||||
// 4. Stage (clean .la files, etc.)
|
// 4. Stage (clean .la files, etc.)
|
||||||
staging::process(&destdir, &pkg_spec)?;
|
staging::process(&destdir, &pkg_spec)?;
|
||||||
|
|
||||||
@@ -1398,6 +1412,7 @@ fn main() -> Result<()> {
|
|||||||
));
|
));
|
||||||
// TODO(snapper): create post-install snapshot after install commit succeeds.
|
// TODO(snapper): create post-install snapshot after install commit succeeds.
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if let Some(src_dir) = built_src_dir.as_deref()
|
if let Some(src_dir) = built_src_dir.as_deref()
|
||||||
&& let Some((lib32_spec, lib32_destdir)) = build_lib32_companion_package(
|
&& let Some((lib32_spec, lib32_destdir)) = build_lib32_companion_package(
|
||||||
@@ -1406,6 +1421,7 @@ fn main() -> Result<()> {
|
|||||||
&config,
|
&config,
|
||||||
cross_config.as_ref(),
|
cross_config.as_ref(),
|
||||||
!cli.no_flags,
|
!cli.no_flags,
|
||||||
|
cli.lib32_only,
|
||||||
)?
|
)?
|
||||||
{
|
{
|
||||||
install_staged_to_rootfs(&lib32_spec, &lib32_destdir, &cli.rootfs, &config)?;
|
install_staged_to_rootfs(&lib32_spec, &lib32_destdir, &cli.rootfs, &config)?;
|
||||||
@@ -1561,6 +1577,7 @@ fn main() -> Result<()> {
|
|||||||
.as_ref()
|
.as_ref()
|
||||||
.map(|p| cross::CrossConfig::from_prefix(p))
|
.map(|p| cross::CrossConfig::from_prefix(p))
|
||||||
.transpose()?;
|
.transpose()?;
|
||||||
|
if !cli.lib32_only {
|
||||||
builder::build(
|
builder::build(
|
||||||
&pkg_spec,
|
&pkg_spec,
|
||||||
&src_dir,
|
&src_dir,
|
||||||
@@ -1568,11 +1585,13 @@ fn main() -> Result<()> {
|
|||||||
cross_config.as_ref(),
|
cross_config.as_ref(),
|
||||||
!cli.no_flags,
|
!cli.no_flags,
|
||||||
)?;
|
)?;
|
||||||
|
}
|
||||||
|
|
||||||
|
if !cli.lib32_only {
|
||||||
staging::add_licenses(&src_dir, &destdir, &pkg_spec.package.name)?;
|
staging::add_licenses(&src_dir, &destdir, &pkg_spec.package.name)?;
|
||||||
install::scripts::stage_scripts_from_spec_dir(&pkg_spec, &destdir)?;
|
install::scripts::stage_scripts_from_spec_dir(&pkg_spec, &destdir)?;
|
||||||
|
|
||||||
staging::process(&destdir, &pkg_spec)?;
|
staging::process(&destdir, &pkg_spec)?;
|
||||||
|
}
|
||||||
|
|
||||||
// Create package archive(s) — support multiple outputs from a single spec.
|
// Create package archive(s) — support multiple outputs from a single spec.
|
||||||
let arch = cli
|
let arch = cli
|
||||||
@@ -1581,6 +1600,7 @@ fn main() -> Result<()> {
|
|||||||
.unwrap_or(std::env::consts::ARCH);
|
.unwrap_or(std::env::consts::ARCH);
|
||||||
|
|
||||||
let mut created_files = Vec::new();
|
let mut created_files = Vec::new();
|
||||||
|
if !cli.lib32_only {
|
||||||
for out in pkg_spec.outputs() {
|
for out in pkg_spec.outputs() {
|
||||||
let mut spec_for_out = pkg_spec.clone();
|
let mut spec_for_out = pkg_spec.clone();
|
||||||
let output_name = out.name.clone();
|
let output_name = out.name.clone();
|
||||||
@@ -1602,6 +1622,7 @@ fn main() -> Result<()> {
|
|||||||
}
|
}
|
||||||
created_files.push(pkg_file);
|
created_files.push(pkg_file);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
let mut lib32_install_bundle: Option<(package::PackageSpec, PathBuf)> = None;
|
let mut lib32_install_bundle: Option<(package::PackageSpec, PathBuf)> = None;
|
||||||
if let Some((lib32_spec, lib32_destdir)) = build_lib32_companion_package(
|
if let Some((lib32_spec, lib32_destdir)) = build_lib32_companion_package(
|
||||||
@@ -1610,6 +1631,7 @@ fn main() -> Result<()> {
|
|||||||
&config,
|
&config,
|
||||||
cross_config.as_ref(),
|
cross_config.as_ref(),
|
||||||
!cli.no_flags,
|
!cli.no_flags,
|
||||||
|
cli.lib32_only,
|
||||||
)? {
|
)? {
|
||||||
let lib32_arch = lib32_arch_name(arch);
|
let lib32_arch = lib32_arch_name(arch);
|
||||||
let packager = package::Packager::new(
|
let packager = package::Packager::new(
|
||||||
@@ -1639,6 +1661,7 @@ fn main() -> Result<()> {
|
|||||||
if !ui::prompt_yes_no("Install built package(s) to rootfs now?", true)? {
|
if !ui::prompt_yes_no("Install built package(s) to rootfs now?", true)? {
|
||||||
anyhow::bail!("Aborted");
|
anyhow::bail!("Aborted");
|
||||||
}
|
}
|
||||||
|
if !cli.lib32_only {
|
||||||
for out in pkg_spec.outputs() {
|
for out in pkg_spec.outputs() {
|
||||||
let mut spec_for_out = pkg_spec.clone();
|
let mut spec_for_out = pkg_spec.clone();
|
||||||
let output_name = out.name.clone();
|
let output_name = out.name.clone();
|
||||||
@@ -1647,13 +1670,19 @@ fn main() -> Result<()> {
|
|||||||
spec_for_out.dependencies = pkg_spec.dependencies_for_output(&output_name);
|
spec_for_out.dependencies = pkg_spec.dependencies_for_output(&output_name);
|
||||||
let out_destdir =
|
let out_destdir =
|
||||||
output_destdir_for(&destdir, &pkg_spec.package.name, &output_name);
|
output_destdir_for(&destdir, &pkg_spec.package.name, &output_name);
|
||||||
install_staged_to_rootfs(&spec_for_out, &out_destdir, &cli.rootfs, &config)?;
|
install_staged_to_rootfs(
|
||||||
|
&spec_for_out,
|
||||||
|
&out_destdir,
|
||||||
|
&cli.rootfs,
|
||||||
|
&config,
|
||||||
|
)?;
|
||||||
ui::success(format!(
|
ui::success(format!(
|
||||||
"Successfully installed {} v{}",
|
"Successfully installed {} v{}",
|
||||||
spec_for_out.package.name, spec_for_out.package.version
|
spec_for_out.package.name, spec_for_out.package.version
|
||||||
));
|
));
|
||||||
// TODO(snapper): create post-install snapshot after --install commit succeeds.
|
// TODO(snapper): create post-install snapshot after --install commit succeeds.
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if let Some((lib32_spec, lib32_destdir)) = &lib32_install_bundle {
|
if let Some((lib32_spec, lib32_destdir)) = &lib32_install_bundle {
|
||||||
install_staged_to_rootfs(lib32_spec, lib32_destdir, &cli.rootfs, &config)?;
|
install_staged_to_rootfs(lib32_spec, lib32_destdir, &cli.rootfs, &config)?;
|
||||||
ui::success(format!(
|
ui::success(format!(
|
||||||
|
|||||||
Reference in New Issue
Block a user