Skip to content

Commit 1284f7b

Browse files
authored
Allow specifying the path to libquickjs.a (theduke#63)
* Allow specifying the path to libquickjs.a
1 parent 2e0ee4d commit 1284f7b

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

libquickjs-sys/build.rs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,15 @@ fn main() {
2424
#[cfg(feature = "patched")]
2525
panic!("Invalid configuration for libquickjs-sys: the patched feature is incompatible with the system feature");
2626

27-
let lib = if cfg!(unix) {
27+
let lib: std::borrow::Cow<str> = if let Ok(lib) = env::var("QUICKJS_LIBRARY_PATH") {
28+
lib.into()
29+
} else if cfg!(unix) {
2830
if exists(format!("/usr/lib/quickjs/{}.a", LIB_NAME)) {
29-
"/usr/lib/quickjs"
31+
"/usr/lib/quickjs".into()
3032
} else if exists("/usr/local/lib/quickjs") {
31-
"/usr/local/lib/quickjs"
33+
"/usr/local/lib/quickjs".into()
3234
} else {
33-
panic!("quickjs is not supported on this platform");
35+
panic!("quickjs library could not be found. Try setting the QUICKJS_LIBRARY_PATH env variable");
3436
}
3537
} else {
3638
panic!("quickjs error: Windows is not supported yet");

0 commit comments

Comments
 (0)