Skip to content

Commit

Permalink
Restore pkg-config / dynamic linking support
Browse files Browse the repository at this point in the history
  • Loading branch information
decathorpe committed Mar 1, 2023
1 parent 09e8a0e commit ece8a60
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ homepage = "https://github.com/PistonDevelopers/freetype-sys"

[build-dependencies]
cc = "1"
pkg-config = "0.3.11"

[dependencies]
libc = "0.2.42"
12 changes: 12 additions & 0 deletions build.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
use std::env;

fn add_sources(build: &mut cc::Build, root: &str, files: &[&str]) {
let root = std::path::Path::new(root);
build.files(files.iter().map(|src| {
Expand All @@ -10,6 +12,16 @@ fn add_sources(build: &mut cc::Build, root: &str, files: &[&str]) {
}

fn main() {
let target = env::var("TARGET").unwrap();
if !target.contains("android")
&& pkg_config::Config::new()
.atleast_version("24.3.18")

This comment has been minimized.

Copy link
@rockyzhengwu

rockyzhengwu Jul 27, 2024

Contributor

@decathorpe i need help freetype2 latest version is 2.13.2, why this 24.3.18 ? where ths version come from ,thanks , i don't know this is a bug or a feature, but i can't build on my ubuntu 22.04

This comment has been minimized.

Copy link
@decathorpe

decathorpe Jul 27, 2024

Author Contributor

freetype2 is weird, the version of the project does not match the version of the library provided by pkg-config. for example, in Fedora Rawhide we have freetype 2.13.2, but the version provided by pkg-config is 26.1.20.

This comment has been minimized.

Copy link
@rockyzhengwu

rockyzhengwu Jul 27, 2024

Contributor

thanks for you help, i also found this https://github.com/freetype/freetype/blob/master/docs/VERSIONS.TXT link explain this

.find("freetype2")
.is_ok()
{
return;
}

let mut build = cc::Build::new();

build
Expand Down

0 comments on commit ece8a60

Please sign in to comment.