Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* bump bindgen to 0.57 * automatically download and use the frida devkit This makes the library really usable in other packages * remove the devkit download from the github workflow make sure cd .. happens irrespective of if the download and build line fails * remove static requirement for libfrida-XXX * formatting * Deduplicate build.rs code by creating frida-build; Introduce feature flag 'autodownload' * Add FRIDA_VERSION file * formatting * changed autodownload to auto-download; removed frida-core.h * update FRIDA_VERSION to 14.2.13
- Loading branch information
Showing
11 changed files
with
115 additions
and
58,609 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
14.2.13 |
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,8 @@ | ||
[package] | ||
name = "frida-build" | ||
version = "0.1.1" | ||
authors = ["meme <keegan@sdf.org>"] | ||
edition = "2018" | ||
license = "wxWindows" | ||
repository = "https://github.com/meme/frida-rust" | ||
description = "Build scripts for Frida rust bindings" |
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,73 @@ | ||
use std::env; | ||
use std::path::Path; | ||
use std::process::Command; | ||
|
||
pub fn download_and_use_devkit(kind: &str, version: &str) { | ||
let mut target_arch = env::var("CARGO_CFG_TARGET_ARCH").unwrap(); | ||
|
||
if target_arch == "aarch64" { | ||
target_arch = "arm64".to_string(); | ||
} | ||
|
||
let cwd = env::current_dir().unwrap().to_string_lossy().to_string(); | ||
|
||
let devkit = format!( | ||
"{}/frida-{}-devkit-{}-{}-{}", | ||
env::var("CARGO_MANIFEST_DIR").unwrap(), | ||
kind, | ||
version, | ||
env::var("CARGO_CFG_TARGET_OS").unwrap(), | ||
target_arch | ||
); | ||
let devkit_path = Path::new(&devkit); | ||
let devkit_tar = format!("{}.tar.xz", devkit); | ||
|
||
let out_dir_path = Path::new(&cwd); | ||
|
||
if !devkit_path.is_dir() { | ||
if !Path::new(&devkit_tar).is_file() { | ||
println!( | ||
"cargo:warning=Frida {} devkit not found, downloading...", | ||
kind | ||
); | ||
// Download devkit | ||
Command::new("wget") | ||
.arg("-c") | ||
.arg(format!( | ||
"https://github.com/frida/frida/releases/download/{}/frida-{}-devkit-{}-{}-{}.tar.xz", | ||
version, | ||
kind, | ||
version, | ||
env::var("CARGO_CFG_TARGET_OS").unwrap(), | ||
target_arch)) | ||
.arg("-O") | ||
.arg(&devkit_tar) | ||
.status() | ||
.unwrap(); | ||
} | ||
Command::new("tar") | ||
.current_dir(&out_dir_path) | ||
.arg("-xvf") | ||
.arg(&devkit_tar) | ||
.status() | ||
.unwrap(); | ||
Command::new("mv") | ||
.current_dir(&out_dir_path) | ||
.arg(format!("libfrida-{}.a", kind)) | ||
.arg(format!( | ||
"libfrida-{}-{}-{}.a", | ||
kind, | ||
env::var("CARGO_CFG_TARGET_OS").unwrap(), | ||
target_arch | ||
)) | ||
.status() | ||
.unwrap(); | ||
} | ||
|
||
println!( | ||
"cargo:rustc-link-lib=frida-{}-{}-{}", | ||
kind, | ||
env::var("CARGO_CFG_TARGET_OS").unwrap(), | ||
target_arch | ||
); | ||
} |
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 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
Oops, something went wrong.