mirror of
https://github.com/roc-lang/roc.git
synced 2024-07-14 22:00:24 +03:00
fix: change target directory output to match release tarball structure
This commit is contained in:
parent
03eadc2e0f
commit
5a231763af
@ -10,20 +10,18 @@ strip ./target/release-with-lto/roc_language_server
|
||||
# to be able to delete "target" later
|
||||
cp target/release-with-lto/roc ./roc
|
||||
cp target/release-with-lto/roc_language_server ./roc_language_server
|
||||
cp target/release-with-lto/wasi-libc.a wasi-libc.a
|
||||
|
||||
# delete unnecessary files and folders
|
||||
git clean -fdx --exclude roc --exclude roc_language_server
|
||||
git clean -fdx --exclude roc --exclude roc_language_server --exclude wasi-libc.a
|
||||
|
||||
mkdir $1
|
||||
mkdir -p $1 $1/examples $1/crates/compiler/builtins/bitcode
|
||||
|
||||
mv roc roc_language_server lib LICENSE LEGAL_DETAILS $1
|
||||
|
||||
mv roc roc_language_server LICENSE LEGAL_DETAILS $1
|
||||
|
||||
mkdir $1/examples
|
||||
mv examples/helloWorld.roc examples/platform-switching examples/cli $1/examples
|
||||
|
||||
mkdir -p $1/crates/compiler/builtins/bitcode
|
||||
mv crates/roc_std $1/crates
|
||||
mv crates/compiler/builtins/bitcode/src $1/crates/compiler/builtins/bitcode
|
||||
|
||||
tar -czvf "$1.tar.gz" $1
|
||||
tar -czvf "$1.tar.gz" $1
|
||||
|
@ -119,10 +119,17 @@ fn find_zig_glue_path() -> PathBuf {
|
||||
}
|
||||
|
||||
fn find_wasi_libc_path() -> PathBuf {
|
||||
// This path is available when built and run from source
|
||||
// Environment variable defined in wasi-libc-sys/build.rs
|
||||
let wasi_libc_pathbuf = PathBuf::from(WASI_LIBC_PATH);
|
||||
if std::path::Path::exists(&wasi_libc_pathbuf) {
|
||||
return wasi_libc_pathbuf;
|
||||
let build_path = PathBuf::from(WASI_LIBC_PATH);
|
||||
if std::path::Path::exists(&build_path) {
|
||||
return build_path;
|
||||
}
|
||||
|
||||
// This path is available in the release tarball
|
||||
match get_relative_path(Path::new("wasi-libc.a")) {
|
||||
Some(path) if path.exists() => return path,
|
||||
_ => (),
|
||||
}
|
||||
|
||||
internal_error!("cannot find `wasi-libc.a`")
|
||||
|
@ -8,9 +8,17 @@ fn main() {
|
||||
println!("cargo:rerun-if-changed=build.rs");
|
||||
println!("cargo:rerun-if-changed=src/dummy.c");
|
||||
|
||||
// out_dir == "<project_root>/target/[<platform>/]<profile>/build/wasi_libc_sys_<hex>/"
|
||||
let out_dir = env::var("OUT_DIR").unwrap();
|
||||
let zig_cache_dir = PathBuf::from(&out_dir).join("zig-cache");
|
||||
let out_file = PathBuf::from(&out_dir).join("wasi-libc.a");
|
||||
|
||||
// out_file == "<project_root>/target/[<platform>/]<profile>/lib/wasi-libc.a"
|
||||
let mut out_file = PathBuf::from(&out_dir);
|
||||
out_file.pop();
|
||||
out_file.pop();
|
||||
out_file.pop();
|
||||
out_file.push("lib");
|
||||
out_file.push("wasi-libc.a");
|
||||
|
||||
// Compile a dummy C program with Zig, with our own private cache directory
|
||||
zig()
|
||||
@ -38,6 +46,7 @@ fn main() {
|
||||
.unwrap();
|
||||
|
||||
// Copy libc to where Cargo expects the output of this crate
|
||||
fs::create_dir_all(out_file.parent().unwrap()).unwrap();
|
||||
fs::copy(libc_path, &out_file).unwrap();
|
||||
|
||||
println!(
|
||||
|
Loading…
Reference in New Issue
Block a user