Skip to content

Commit 9499c3c

Browse files
committed
Revert "Merge pull request #1791 from awakecoding/libsql-ffi-build-cp-fix"
This reverts commit 5ee4723, reversing changes made to cc1d9c5 because it breaks `libsql-js` build on macOS: ``` penberg@vonneumann libsql-js % cargo check Updating git repository `https://github.com/tursodatabase/libsql/` Compiling libsql-ffi v0.5.0 (https://github.com/tursodatabase/libsql/?rev=9c73c68f0b034c5e01a51d9dc93a61936a71c801#9c73c68f) Compiling libsql-sqlite3-parser v0.13.0 (https://github.com/tursodatabase/libsql/?rev=9c73c68f0b034c5e01a51d9dc93a61936a71c801#9c73c68f) Checking reqwest v0.12.9 Checking libsql-hrana v0.2.0 (https://github.com/tursodatabase/libsql/?rev=9c73c68f0b034c5e01a51d9dc93a61936a71c801#9c73c68f) error: failed to run custom build command for `libsql-ffi v0.5.0 (https://github.com/tursodatabase/libsql/?rev=9c73c68f0b034c5e01a51d9dc93a61936a71c801#9c73c68f)` Caused by: process didn't exit successfully: `/Users/penberg/src/tursodatabase/libsql-js/target/debug/build/libsql-ffi-755a07789947d931/build-script-build` (exit status: 101) --- stdout cargo:rustc-link-lib=framework=Security cargo:rerun-if-changed=bundled/src/sqlite3.c cargo:rerun-if-changed=/Users/penberg/src/tursodatabase/libsql-js/target/debug/build/libsql-ffi-e660048e9fb948a4/out/sqlite3mc/libsqlite3mc_static.a --- stderr cp: illegal option -- - usage: cp [-R [-H | -L | -P]] [-fi | -n] [-aclpSsvXx] source_file target_file cp [-R [-H | -L | -P]] [-fi | -n] [-aclpSsvXx] source_file ... target_directory thread 'main' panicked at /Users/penberg/.cargo/git/checkouts/libsql-311658d335deb3b1/9c73c68/libsql-ffi/build.rs:43:44: called `Result::unwrap()` on an `Err` value: Custom { kind: Other, error: "Failed to copy using cp" } note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace warning: build failed, waiting for other jobs to finish... ```
1 parent 9c73c68 commit 9499c3c

File tree

1 file changed

+8
-28
lines changed

1 file changed

+8
-28
lines changed

libsql-ffi/build.rs

Lines changed: 8 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use std::env;
22
use std::ffi::OsString;
33
use std::fs::{self, OpenOptions};
4-
use std::io::{self, Write};
4+
use std::io::Write;
55
use std::path::{Path, PathBuf};
66
use std::process::Command;
77

@@ -39,8 +39,13 @@ fn main() {
3939

4040
let dir = env!("CARGO_MANIFEST_DIR");
4141

42-
let full_src_path = Path::new(dir).join(bindgen_rs_path);
43-
copy_with_cp(full_src_path, &out_path).unwrap();
42+
Command::new("cp")
43+
.arg("--no-preserve=mode,ownership")
44+
.arg("-R")
45+
.arg(format!("{dir}/{bindgen_rs_path}"))
46+
.arg(&out_path)
47+
.output()
48+
.unwrap();
4449

4550
println!("cargo:lib_dir={out_dir}");
4651

@@ -56,31 +61,6 @@ fn main() {
5661
build_bundled(&out_dir, &out_path);
5762
}
5863

59-
#[cfg(target_os = "windows")]
60-
fn copy_with_cp(src: impl AsRef<Path>, dst: impl AsRef<Path>) -> io::Result<()> {
61-
fs::copy(src, dst)?; // do a regular file copy on Windows
62-
Ok(())
63-
}
64-
65-
#[cfg(not(target_os = "windows"))]
66-
fn copy_with_cp(src: impl AsRef<Path>, dst: impl AsRef<Path>) -> io::Result<()> {
67-
let status = Command::new("cp")
68-
.arg("--no-preserve=mode,ownership")
69-
.arg("-R")
70-
.arg(src.as_ref().to_str().unwrap())
71-
.arg(dst.as_ref().to_str().unwrap())
72-
.status()?;
73-
74-
if !status.success() {
75-
Err(io::Error::new(
76-
io::ErrorKind::Other,
77-
"Failed to copy using cp",
78-
))
79-
} else {
80-
Ok(())
81-
}
82-
}
83-
8464
fn make_amalgamation() {
8565
let flags = ["-DSQLITE_ENABLE_COLUMN_METADATA=1"];
8666

0 commit comments

Comments
 (0)