pub fn link_primordial(funcs: Vec<MuName>, out: &str, vm: &VM) -> PathBuf {
    let emit_dir = PathBuf::from(&vm.vm_options.flag_aot_emit_dir);

    // prepare a list of files that need to be compiled and linked together
    let files: Vec<PathBuf> = {
        use std::fs;

        let mut ret = vec![];

        // all interested mu funcs
        for func in funcs {
            ret.push(get_path_for_mu_func(func, vm));
        }

        // mu context
        ret.push(get_path_for_mu_context(vm));

        // copy primoridal entry
        let source = get_path_under_zebu(runtime::PRIMORDIAL_ENTRY);
        let dest = {
            let mut ret = PathBuf::from(&vm.vm_options.flag_aot_emit_dir);
            ret.push("main.c");

            ret
        };
        trace!("copying from {:?} to {:?}", source, dest);
        match fs::copy(source.as_path(), dest.as_path()) {
            Ok(_) => {}
            Err(e) => panic!("failed to copy: {}", e)
        }

        // include the primordial C main
        ret.push(dest);

        // include mu static lib
        if vm.vm_options.flag_aot_link_static {
            ret.push(get_path_under_zebu(if cfg!(debug_assertions) {
                "target/debug/libmu.a"
            } else {
                "target/release/libmu.a"
            }));
        }

        ret
    };

    let mut out_path = emit_dir.clone();
    out_path.push(out);

    link_executable_internal(
        !vm.vm_options.flag_aot_link_static,
        files,
        &vm.vm_options.flag_bootimage_external_lib,
        &vm.vm_options.flag_bootimage_external_libpath,
        out_path
    )
}
/// links generated code for the given functions, static library of Zebu,
/// and a main function to produce an executable of the given name
links generated code for the given functions, static library of Zebu,
and a main function to produce an executable of the given name
links generated code for the given functions static library of Zebu and a main function to produce an executable of the given name
pub fn link_primordial(funcs: Vec<MuName>, out: &str, vm: &VM) -> PathBuf {
    let emit_dir = PathBuf::from(&vm.vm_options.flag_aot_emit_dir);
    // prepare a list of files that need to be compiled and linked together
    let files: Vec<PathBuf> = {
        use std::fs;
        let mut ret = vec![];
        // all interested mu funcs
        for func in funcs {
            ret.push(get_path_for_mu_func(func, vm));
        }
        // mu context
        ret.push(get_path_for_mu_context(vm));
        // copy primoridal entry
        let source = get_path_under_zebu(runtime::PRIMORDIAL_ENTRY);
        let dest = {
            let mut ret = PathBuf::from(&vm.vm_options.flag_aot_emit_dir);
            ret.push("main.c");
            ret
        };
        trace!("copying from {:?} to {:?}", source, dest);
        match fs::copy(source.as_path(), dest.as_path()) {
            Ok(_) => {}
            Err(e) => panic!("failed to copy: {}", e)
        }
        // include the primordial C main
        ret.push(dest);
        // include mu static lib
        if vm.vm_options.flag_aot_link_static {
            ret.push(get_path_under_zebu(if cfg!(debug_assertions) {
                "target/debug/libmu.a"
            } else {
                "target/release/libmu.a"
            }));
        }
        ret
    };
    let mut out_path = emit_dir.clone();
    out_path.push(out);
    link_executable_internal(
        !vm.vm_options.flag_aot_link_static,
        files,
        &vm.vm_options.flag_bootimage_external_lib,
        &vm.vm_options.flag_bootimage_external_libpath,
        out_path
    )
}
pub fn link_primordial ( funcs : Vec < MuName > , out : & str , vm : & VM ) -> PathBuf { let emit_dir = PathBuf :: from ( & vm . vm_options . flag_aot_emit_dir ) ; // prepare a list of files that need to be compiled and linked together let files : Vec < PathBuf > = { use std :: fs ; let mut ret = vec ! [ ] ; // all interested mu funcs for func in funcs { ret . push ( get_path_for_mu_func ( func , vm ) ) ; } // mu context ret . push ( get_path_for_mu_context ( vm ) ) ; // copy primoridal entry let source = get_path_under_zebu ( runtime :: PRIMORDIAL_ENTRY ) ; let dest = { let mut ret = PathBuf :: from ( & vm . vm_options . flag_aot_emit_dir ) ; ret . push ( " " ) ; ret } ; trace ! ( " " source dest ) ; match fs :: copy ( source . as_path ( ) , dest . as_path ( ) ) { Ok ( _ ) => { } Err ( e ) => panic ! ( " " e ) } // include the primordial C main ret . push ( dest ) ; // include mu static lib if vm . vm_options . flag_aot_link_static { ret . push ( get_path_under_zebu ( if cfg ! ( debug_assertions ) { " " } else { " " } ) ) ; } ret } ; let mut out_path = emit_dir . clone ( ) ; out_path . push ( out ) ; link_executable_internal ( ! vm . vm_options . flag_aot_link_static , files , & vm . vm_options . flag_bootimage_external_lib , & vm . vm_options . flag_bootimage_external_libpath , out_path ) }
links generated code for the given functions, static library of Zebu,
and a main function to produce an executable of the given name
links generated code for the given functions static library of Zebu and a main function to produce an executable of the given name
funcs
Vec<MuName>
out
&str
vm
&VM
funcs
Vec<MuName>
out
&str
vm
&VM