Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: add option to complie rlottie #56

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions rlottie-sys/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,5 @@ links = "rlottie"

[build-dependencies]
bindgen = { version = "0.68.1", features = ["prettyplease", "runtime"], default-features = false }
cmake = "0.1.50"
pkg-config = "0.3.22"
41 changes: 40 additions & 1 deletion rlottie-sys/build.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,45 @@
use std::{env, path::PathBuf};
use std::{env, fs::remove_dir_all, path::PathBuf, process::Command};

fn main() {
let lottie_version = "v0.2";
let output = PathBuf::from(env::var("OUT_DIR").unwrap());
let clone_dest_dir = format!("lottie-source-{}", lottie_version);
let lottie_source_dir = output.join(&clone_dest_dir);
let lottie_install_dir= output.join(format!("lottie-install-{}", lottie_version));
let _ = remove_dir_all(&lottie_source_dir); //avoid error at cloning if folder already exist
let status = Command::new("git")
.current_dir(&output)
.arg("clone")
.arg("--depth=1")
.arg("--branch")
.arg(lottie_version)
.arg("https://github.com/Samsung/rlottie.git")
.arg(&clone_dest_dir)
.status()
.unwrap();
if !status.success() {
panic!("fetch lottie failed");
}
// rlottie needs patch for newer compilers
let status = Command::new("wget").current_dir(&lottie_source_dir).args(["-qO","patch","https://github.com/Samsung/rlottie/commit/2d7b1fa2b005bba3d4b45e8ebfa632060e8a157a.patch"])
.status().unwrap();
if !status.success() {
panic!("fetch patch failed");
}
let status = Command::new("patch")
.current_dir(&lottie_source_dir)
.args(["-N", "-p1", "-i", "patch"])
.status()
.unwrap();
if !status.success() {
panic!("apply patch failed");
}
// build lottie
let dst = cmake::Config::new(lottie_source_dir)
.define("CMAKE_INSTALL_PREFIX", &lottie_install_dir)
.build();

panic!("sucess");
pkg_config::Config::new()
.probe("rlottie")
.expect("Unable to find rlottie");
Expand Down
Loading