kanru / libtool-rs Goto Github PK
View Code? Open in Web Editor NEWbuild script helper to automatically generate libtool convenience library (.la) files.
License: Mozilla Public License 2.0
build script helper to automatically generate libtool convenience library (.la) files.
License: Mozilla Public License 2.0
Thanks for this very useful library!
I believe that this fragment does not work as expected:
Line 52 in f6a009e
The exists()
method follows symlinks and so instead of checking that new_lib_path
exists it checks that the file it points to exists. This breaks my builds if the previous build was interrupted.
I think the fix is simply to drop the exists()
check, since remove_file()
will succeed if the file does not exist. FWIW, this code works for me:
pub fn generate_convenience_lib(lib: &str) -> std::io::Result<()> {
let self_version = env!("CARGO_PKG_VERSION");
let topdir = env::var("CARGO_MANIFEST_DIR").unwrap();
let profile = env::var("PROFILE").unwrap();
let target_dir = format!("{}/target/{}", topdir, profile);
let libs_dir = format!("{}/.libs", target_dir);
let libs_path = PathBuf::from(&libs_dir);
let la_path = PathBuf::from(format!("{}/{}.la", target_dir, lib));
let old_lib_path = PathBuf::from(format!("{}/{}.a", target_dir, lib));
let new_lib_path = PathBuf::from(format!("{}/{}.a", libs_dir, lib));
fs::create_dir_all(&libs_path).unwrap();
fs::remove_file(&la_path)?;
fs::remove_file(&new_lib_path)?;
let mut file = File::create(&la_path)?;
writeln!(file, "# {}.la - a libtool library file", lib)?;
writeln!(file, "# Generated by libtool-rust {}", self_version)?;
writeln!(file, "dlname=''")?;
writeln!(file, "library_names=''")?;
writeln!(file, "old_library='{}.a'", lib)?;
writeln!(file, "inherited_linker_flags=' -pthread -lm -ldl'")?;
writeln!(file, "installed=no")?;
writeln!(file, "shouldnotlink=no")?;
symlink(&old_lib_path, &new_lib_path)?;
Ok(())
}
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.