Skip to content

Commit

Permalink
fix: helper binary build
Browse files Browse the repository at this point in the history
  • Loading branch information
ratankaliani committed Aug 7, 2024
1 parent 668d55d commit 96bb992
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 12 deletions.
15 changes: 11 additions & 4 deletions build/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -224,18 +224,25 @@ fn copy_elf_to_output_dir(

// The ELF is written to a target folder specified by the program's package. If built with Docker,
// includes /docker after HELPER_TARGET_SUBDIR.
let target_dir_suffix = if args.docker {
format!("{}/{}", HELPER_TARGET_SUBDIR, "docker")
let mut target_dir_suffix = HELPER_TARGET_SUBDIR.to_string();
if args.docker {
target_dir_suffix = format!("{}/{}", HELPER_TARGET_SUBDIR, "docker");
}

// The ELF's file name is the binary name if it's specified. Otherwise, it is the root package
// name.
let original_elf_file_name = if !args.binary.is_empty() {
args.binary.clone()
} else {
HELPER_TARGET_SUBDIR.to_string()
root_package_name.unwrap().clone()
};

let original_elf_path = program_metadata
.target_directory
.join(target_dir_suffix)
.join(BUILD_TARGET)
.join("release")
.join(root_package_name.unwrap());
.join(original_elf_file_name);

// The order of precedence for the ELF name is:
// 1. --elf_name flag
Expand Down
12 changes: 4 additions & 8 deletions helper/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,14 +61,10 @@ fn execute_build_cmd(
}

// Build the program with the given arguments.
let path_output = if let Some(args) = args {
sp1_build::build_program(&args, Some(program_dir.as_ref().to_path_buf()))
} else {
sp1_build::build_program(
&BuildArgs::default(),
Some(program_dir.as_ref().to_path_buf()),
)
};
let path_output = sp1_build::build_program(
&args.unwrap_or_default(),
Some(program_dir.as_ref().to_path_buf()),
);
if let Err(err) = path_output {
panic!("Failed to build SP1 program: {}.", err);
}
Expand Down

0 comments on commit 96bb992

Please sign in to comment.