|
@@ -88,7 +88,7 @@ fn localize_hidden(input: &PathBuf)
|
|
|
.unwrap();
|
|
|
}
|
|
|
|
|
|
-fn link(args: &LocalizeArgs)
|
|
|
+fn link(input_lib: &PathBuf, output_object: &PathBuf)
|
|
|
{
|
|
|
let output_dir = "./output_dir/";
|
|
|
|
|
@@ -96,7 +96,7 @@ fn link(args: &LocalizeArgs)
|
|
|
fs::create_dir(output_dir)
|
|
|
.expect("Cannot create output directory");
|
|
|
|
|
|
- let input = fs::canonicalize(args.input_files[0].clone())
|
|
|
+ let input = fs::canonicalize(input_lib)
|
|
|
.expect("Input path is invalid");
|
|
|
|
|
|
let objects = extract(input, PathBuf::from(&output_dir))
|
|
@@ -104,8 +104,8 @@ fn link(args: &LocalizeArgs)
|
|
|
|
|
|
println!("Archive objects successfully extracted");
|
|
|
|
|
|
- link_partial(&objects, &args.output_file).unwrap();
|
|
|
- localize_hidden(&args.output_file);
|
|
|
+ link_partial(&objects, &output_object).unwrap();
|
|
|
+ localize_hidden(&output_object);
|
|
|
}
|
|
|
|
|
|
struct PluginEntry
|
|
@@ -238,14 +238,28 @@ const char * vlc_entry_api_version()
|
|
|
fn main() {
|
|
|
let opt = LocalizeArgs::from_args();
|
|
|
println!("{:?}", opt);
|
|
|
- link(&opt);
|
|
|
|
|
|
+ // Intermediate files will be generated in the following directory.
|
|
|
let output_dir = fs::canonicalize("./output_dir/")
|
|
|
.unwrap();
|
|
|
|
|
|
generate_plugin(&vec![
|
|
|
PluginEntry{ suffix: "__video_chroma_yuy2_i420".into(),
|
|
|
lib: PathBuf::from("output_dir/yuy2_i420.o") } ],
|
|
|
+ // Prepare one output object path for each input plugin library.
|
|
|
+ let output_files = opt.input_files
|
|
|
+ .iter()
|
|
|
+ .map(|input_file| PathBuf::from(&output_dir)
|
|
|
+ .join(input_file.file_name().unwrap())
|
|
|
+ .join(".o"))
|
|
|
+ .collect::<Vec<_>>();
|
|
|
+
|
|
|
+ // Pre-link each library to put each of them in a single object
|
|
|
+ // file and localize the private symbols.
|
|
|
+ opt.input_files
|
|
|
+ .iter()
|
|
|
+ .zip(output_files.iter())
|
|
|
+ .for_each(|(input_lib, output_object)| link(&input_lib, &output_object));
|
|
|
&output_dir,
|
|
|
&PathBuf::from(&opt.output_file));
|
|
|
}
|