-
Notifications
You must be signed in to change notification settings - Fork 17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Install with cargo #29
Conversation
I'll update Dockerfile later.. |
|
||
fn main() { | ||
let llvm_version = "15.0.0"; | ||
let target = format!("clang+llvm-{}-x86_64-linux-gnu-rhel-8.4", llvm_version); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could automatically detect the platform, and remove the need to edit it.
std::process::Command::new("wget") | ||
.arg(&url) | ||
.arg("-O") | ||
.arg(format!("/tmp/{}.tar.xz", target)) | ||
.output() | ||
.expect("Failed to download LLVM"); | ||
|
||
// Create directory | ||
if !std::path::Path::new(&wasker_dir).exists() { | ||
println!("Creating directory {:?}", wasker_dir); | ||
std::fs::create_dir(&wasker_dir).expect("Failed to create directory"); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could directly download the file, instead of using wget.
println!("Extracting tar file to {:?}", wasker_dir); | ||
std::process::Command::new("tar") | ||
.arg("-xf") | ||
.arg(format!("/tmp/{}.tar.xz", target)) | ||
.arg("-C") | ||
.arg(wasker_dir) | ||
.output() | ||
.expect("Failed to extract tar file"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could directly extract tar files, instead of using tar command.
5: let target = format!("clang+llvm-{}-aarch64-linux-gnu-rhel-8.4", llvm_version); | ||
|
||
# shell | ||
export LLVM_SYS_150_PREFIX=~/.wasker/clang+llvm-15.0.0-aarch64-linux-gnu/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it possible to automatically set the environment variable? By something like build.rs
or cargo.toml
?
https://stackoverflow.com/questions/57017066/how-do-i-set-environment-variables-with-cargo
https://doc.rust-lang.org/cargo/reference/build-scripts.html#rustc-env
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And it would be helpful if build.rs
renames the LLVM directory to clang+llvm
regardless of the platforms.
git clone [email protected]:mewz-project/wasker.git | ||
cd Wasker | ||
export LLVM_SYS_150_PREFIX=~/.wasker/clang+llvm-15.0.0-x86_64-linux-gnu-rhel-8.4/ | ||
cargo install wasker |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cargo install wasker | |
cargo build |
@ainozaki Oh sorry, it's still not ready for review. |
Thank you for comments 🙏 |
Sounds good |
This PR enables installing Wasker with cargo.
In
build.rs
, LLVM is downloaded and installed into$HOME/.wasker
.