Skip to content

Commit

Permalink
Use cargo workspaces to prevent spurious warnings
Browse files Browse the repository at this point in the history
Fixes #256.
Closes #262.
  • Loading branch information
paulrouget authored and baskerville committed Sep 4, 2022
1 parent ffcfa74 commit b68da92
Show file tree
Hide file tree
Showing 139 changed files with 1,058 additions and 427 deletions.
2 changes: 1 addition & 1 deletion .cargo/config
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[target.arm-unknown-linux-gnueabihf]
linker = "arm-linux-gnueabihf-gcc"
rustflags = ["-C", "target-feature=+v7,+vfp3,+a9,+neon"]
rustflags = ["-C", "target-feature=+v7,+vfp3,+neon"]
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
/css/*-user.css
/hyphenation-patterns
/dictionaries
/src/mupdf_wrapper/*/
/dist
/standalone
/plato-*.zip
Expand Down
36 changes: 32 additions & 4 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

93 changes: 9 additions & 84 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,87 +1,12 @@
[package]
authors = ["Bastien Dejean <[email protected]>"]
name = "plato"
version = "0.9.31"
edition = "2021"

[[bin]]
name = "plato"
path = "src/main.rs"

[[bin]]
name = "plato-import"
path = "src/importer.rs"
required-features = ["importer"]

[[bin]]
name = "plato-emulator"
path = "src/emulator.rs"
required-features = ["emulator"]

[[bin]]
name = "article_fetcher"
path = "src/fetcher.rs"
required-features = ["fetcher"]

[dependencies]
bitflags = "1.3.2"
downcast-rs = "1.2.0"
lazy_static = "1.4.0"
libc = "0.2.132"
png = "0.17.5"
regex = "1.6.0"
serde = { version = "1.0.144", features = ["derive"] }
serde_json = "1.0.85"
titlecase = "2.2.0"
unicode-normalization = "0.1.21"
toml = "0.5.9"
zip = "0.6.2"
kl-hyphenate = "0.7.3"
entities = "1.0.1"
paragraph-breaker = "0.4.4"
xi-unicode = "0.3.0"
septem = "1.1.0"
byteorder = "1.4.3"
flate2 = "1.0.24"
levenshtein = "1.0.5"
nix = "0.25.0"
indexmap = { version = "1.9.1", features = ["serde-1"] }
anyhow = "1.0.63"
thiserror = "1.0.33"
walkdir = "2.3.2"
globset = "0.4.9"
filetime = "0.2.17"
fxhash = "0.2.1"
rand_core = "0.6.3"
rand_xoshiro = "0.6.0"
percent-encoding = "2.1.0"

[dependencies.getopts]
version = "0.2.21"
optional = true

[dependencies.reqwest]
version = "0.11.11"
features = ["rustls-tls", "json", "blocking"]
default-features = false
optional = true

[dependencies.chrono]
features = ["serde"]
version = "0.4.22"

[dependencies.sdl2]
version = "0.35.2"
optional = true

[dependencies.signal-hook]
version = "0.3.14"
optional = true

[features]
importer = ["getopts"]
emulator = ["sdl2"]
fetcher = ["reqwest", "signal-hook"]
[workspace]

members = [
"crates/core",
"crates/plato",
"crates/emulator",
"crates/importer",
"crates/fetcher",
]

[profile.release-minsized]
inherits = "release"
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ WORKDIR /plato

ADD . /plato

# Plato requires a specific version of the mupdf dev library for src/mupdf_wrapper
# Plato requires a specific version of the mupdf dev library for /mupdf_wrapper
RUN cd /plato/thirdparty && ./download.sh mupdf

CMD ["./build.sh"]
2 changes: 1 addition & 1 deletion Dockerfile.dev
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@ WORKDIR /plato

ADD . /plato

CMD ["bash", "-c", "cd /plato/src/mupdf_wrapper && ./build.sh && cd /plato/ && cargo test && cargo build --all-features"]
CMD ["bash", "-c", "cd /plato/mupdf_wrapper && ./build.sh && cd /plato/ && cargo test && cargo build --all"]
6 changes: 3 additions & 3 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@ case "$method" in
;;
esac

cd src/mupdf_wrapper
cd mupdf_wrapper
./build-kobo.sh
cd ../..
cd ..

cargo build --release --target=arm-unknown-linux-gnueabihf
cargo build --release --target=arm-unknown-linux-gnueabihf -p plato
42 changes: 42 additions & 0 deletions crates/core/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
[package]
authors = ["Bastien Dejean <[email protected]>"]
name = "plato-core"
version = "0.9.31"
edition = "2021"

[lib]
crate-type = ["rlib"]

[dependencies]
bitflags = "1.3.2"
downcast-rs = "1.2.0"
lazy_static = "1.4.0"
libc = "0.2.132"
png = "0.17.5"
regex = "1.6.0"
serde = { version = "1.0.144", features = ["derive"] }
serde_json = "1.0.85"
titlecase = "2.2.0"
unicode-normalization = "0.1.21"
toml = "0.5.9"
zip = "0.6.2"
kl-hyphenate = "0.7.3"
entities = "1.0.1"
paragraph-breaker = "0.4.4"
xi-unicode = "0.3.0"
septem = "1.1.0"
byteorder = "1.4.3"
flate2 = "1.0.24"
levenshtein = "1.0.5"
nix = "0.25.0"
indexmap = { version = "1.9.1", features = ["serde-1"] }
anyhow = "1.0.63"
thiserror = "1.0.33"
walkdir = "2.3.2"
globset = "0.4.9"
filetime = "0.2.17"
fxhash = "0.2.1"
rand_core = "0.6.3"
rand_xoshiro = "0.6.0"
percent-encoding = "2.1.0"
chrono = { version = "0.4.22", features = ["serde"] }
7 changes: 3 additions & 4 deletions build.rs → crates/core/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ fn main() {
// 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=target/mupdf_wrapper/Kobo");
println!("cargo:rustc-link-search=libs");
println!("cargo:rustc-link-lib=dylib=stdc++");
println!("cargo:rustc-link-lib=z");
Expand All @@ -19,14 +19,13 @@ fn main() {
// 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-search=target/mupdf_wrapper/Linux");
println!("cargo:rustc-link-lib=dylib=stdc++");
},
"macos" => {
println!("cargo:rustc-link-search=src/mupdf_wrapper/Darwin");
println!("cargo:rustc-link-search=target/mupdf_wrapper/Darwin");
println!("cargo:rustc-link-lib=dylib=c++");
},
_ => panic!("Unsupported platform: {}.", target_os),
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loading

0 comments on commit b68da92

Please sign in to comment.