mirror of
https://github.com/roc-lang/roc.git
synced 2025-08-03 03:42:17 +00:00
fix: change target directory output to match release tarball structure
This commit is contained in:
parent
03eadc2e0f
commit
5a231763af
3 changed files with 25 additions and 11 deletions
|
@ -10,20 +10,18 @@ strip ./target/release-with-lto/roc_language_server
|
||||||
# to be able to delete "target" later
|
# to be able to delete "target" later
|
||||||
cp target/release-with-lto/roc ./roc
|
cp target/release-with-lto/roc ./roc
|
||||||
cp target/release-with-lto/roc_language_server ./roc_language_server
|
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
|
# 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
|
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/roc_std $1/crates
|
||||||
mv crates/compiler/builtins/bitcode/src $1/crates/compiler/builtins/bitcode
|
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 {
|
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
|
// Environment variable defined in wasi-libc-sys/build.rs
|
||||||
let wasi_libc_pathbuf = PathBuf::from(WASI_LIBC_PATH);
|
let build_path = PathBuf::from(WASI_LIBC_PATH);
|
||||||
if std::path::Path::exists(&wasi_libc_pathbuf) {
|
if std::path::Path::exists(&build_path) {
|
||||||
return wasi_libc_pathbuf;
|
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`")
|
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=build.rs");
|
||||||
println!("cargo:rerun-if-changed=src/dummy.c");
|
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 out_dir = env::var("OUT_DIR").unwrap();
|
||||||
let zig_cache_dir = PathBuf::from(&out_dir).join("zig-cache");
|
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
|
// Compile a dummy C program with Zig, with our own private cache directory
|
||||||
zig()
|
zig()
|
||||||
|
@ -38,6 +46,7 @@ fn main() {
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
// Copy libc to where Cargo expects the output of this crate
|
// 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();
|
fs::copy(libc_path, &out_file).unwrap();
|
||||||
|
|
||||||
println!(
|
println!(
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue