-
Notifications
You must be signed in to change notification settings - Fork 102
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make accessing the emulator and importer easier
- Loading branch information
1 parent
53dcb4a
commit c4a5e04
Showing
20 changed files
with
546 additions
and
271 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,38 @@ | ||
use std::env; | ||
|
||
fn main() { | ||
if env::var("HOST") != env::var("TARGET") { | ||
println!("cargo:rustc-flags=-L libs -l jpeg -l png16 -l openjp2 -l jbig2dec -l bz2 -l z -l m"); | ||
let target = env::var("TARGET").unwrap(); | ||
|
||
// Cross-compiling for Kobo. | ||
if target == "arm-unknown-linux-gnueabihf" { | ||
println!("cargo:rustc-env=PKG_CONFIG_ALLOW_CROSS=1"); | ||
println!("cargo:rustc-link-search=src/mupdf_wrapper/Kobo"); | ||
println!("cargo:rustc-link-search=libs"); | ||
println!("cargo:rustc-link-lib=dylib=stdc++"); | ||
// Handle the Linux and macOS platforms. | ||
} else { | ||
let target_os = env::var("CARGO_CFG_TARGET_OS").unwrap(); | ||
|
||
match target_os.as_ref() { | ||
"linux" => { | ||
println!("cargo:rustc-link-search=src/mupdf_wrapper/Linux"); | ||
println!("cargo:rustc-link-lib=dylib=stdc++"); | ||
}, | ||
"macos" => { | ||
println!("cargo:rustc-link-search=src/mupdf_wrapper/Darwin"); | ||
println!("cargo:rustc-link-lib=dylib=c++"); | ||
}, | ||
_ => panic!("Unsupported platform: {}.", target_os), | ||
} | ||
|
||
println!("cargo:rustc-link-lib=mupdf-third"); | ||
} | ||
|
||
// Needed in all cases. | ||
println!("cargo:rustc-link-lib=z"); | ||
println!("cargo:rustc-link-lib=bz2"); | ||
println!("cargo:rustc-link-lib=jpeg"); | ||
println!("cargo:rustc-link-lib=png16"); | ||
println!("cargo:rustc-link-lib=openjp2"); | ||
println!("cargo:rustc-link-lib=jbig2dec"); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#! /bin/sh | ||
|
||
./service.sh install_importer "$@" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#! /bin/sh | ||
|
||
./service.sh run_emulator "$@" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
#! /bin/sh | ||
|
||
if [ $# -lt 1 ]; then | ||
printf 'Usage: %s CMD [OPTS].\n' "${0##*/}" 1>&2 | ||
exit 1 | ||
fi | ||
|
||
WRAPPER_PATH=src/mupdf_wrapper | ||
TARGET_OS=$(uname -s) | ||
|
||
if ! [ -e "${WRAPPER_PATH}/${TARGET_OS}" ]; then | ||
cd "$WRAPPER_PATH" || exit 1 | ||
./build.sh | ||
cd ../.. | ||
fi | ||
|
||
CMD=$1 | ||
shift | ||
|
||
case "$CMD" in | ||
run_emulator) | ||
cargo run --bin plato-emulator --features emulator "$@" | ||
;; | ||
install_importer) | ||
cargo install --path . --bin plato-import --features importer "$@" | ||
;; | ||
*) | ||
printf 'Unknown command: %s.\n' "$CMD" 1>&2 | ||
exit 1 | ||
;; | ||
esac |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.