diff --git a/crates/emulator/build.rs b/crates/emulator/build.rs new file mode 100644 index 0000000..511bc11 --- /dev/null +++ b/crates/emulator/build.rs @@ -0,0 +1,14 @@ +use std::path::Path; + +fn main() { + if std::env::consts::OS == "macos" { + println!("cargo:rustc-link-search=/opt/homebrew/lib"); + + let manifest_dir = std::env::var("CARGO_MANIFEST_DIR").unwrap(); + let mupdf_path = Path::new(&manifest_dir) + .join("../../thirdparty/mupdf/build/release") + .canonicalize() + .unwrap(); + println!("cargo:rustc-link-search={}", mupdf_path.display()); + } +} diff --git a/service.sh b/service.sh index 2745203..7c84dc8 100755 --- a/service.sh +++ b/service.sh @@ -14,6 +14,12 @@ fi WRAPPER_PATH=mupdf_wrapper TARGET_OS=$(uname -s) +if ! [ -e "thirdparty/mupdf/build/release/libmupdf.a" ]; then + cd thirdparty/mupdf || exit 1 + make libs + cd - +fi + if ! [ -e "${WRAPPER_PATH}/${TARGET_OS}" ]; then cd "$WRAPPER_PATH" || exit 1 ./build.sh