From 8024acff6985f88ef2156346380d64920bf2dff5 Mon Sep 17 00:00:00 2001 From: Wez Furlong Date: Tue, 20 Feb 2018 17:12:17 -0800 Subject: [PATCH] macos related build tweaks --- .travis.yml | 1 + README.md | 2 +- harfbuzz/build.rs | 13 ++++++++++--- harfbuzz/src/lib.rs | 3 +++ 4 files changed, 15 insertions(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index 60b79ba5b..147e688c3 100644 --- a/.travis.yml +++ b/.travis.yml @@ -32,6 +32,7 @@ addons: - libxcb-ewmh-dev - libxcb-icccm4-dev - libxcb-keysyms1-dev + - ragel #env: # global: diff --git a/README.md b/README.md index 4942c2c41..cd8b21df0 100644 --- a/README.md +++ b/README.md @@ -21,7 +21,7 @@ You will need a collection of support libraries; the example below shows which deps are needed for ubuntu systems: ``` -$ sudo apt-get install -y libxcb-icccm4-dev libxcb-ewmh-dev \ +$ sudo apt-get install -y ragel libxcb-icccm4-dev libxcb-ewmh-dev \ libxcb-keysyms1-dev libfontconfig1-dev libfreetype6-dev libegl1-mesa-dev $ git clone --depth=1 --branch=master https://github.com/wez/wezterm.git $ cd wezterm diff --git a/harfbuzz/build.rs b/harfbuzz/build.rs index 46192fee0..c07ecfd1e 100644 --- a/harfbuzz/build.rs +++ b/harfbuzz/build.rs @@ -2,9 +2,16 @@ extern crate cmake; use std::env; fn main() { - let dst = cmake::Config::new("harfbuzz") - .define("HB_HAVE_FREETYPE", "ON") - .build(); + let mut dst = cmake::Config::new("harfbuzz"); + + if cfg!(any( + target_os = "android", + all(unix, not(target_os = "macos")), + )) + { + dst.define("HB_HAVE_FREETYPE", "ON"); + } + let dst = dst.build(); println!("cargo:rustc-link-search=native={}/lib", dst.display()); println!("cargo:rustc-link-lib=static=harfbuzz"); diff --git a/harfbuzz/src/lib.rs b/harfbuzz/src/lib.rs index 6c3bfa7d6..c340ac503 100644 --- a/harfbuzz/src/lib.rs +++ b/harfbuzz/src/lib.rs @@ -14,6 +14,7 @@ use std::mem; use std::ptr; use std::slice; +#[cfg(any(target_os = "android", all(unix, not(target_os = "macos"))))] extern "C" { fn hb_ft_font_set_load_flags(font: *mut hb_font_t, load_flags: i32); } @@ -55,6 +56,7 @@ impl Drop for Font { } impl Font { + #[cfg(any(target_os = "android", all(unix, not(target_os = "macos"))))] /// Create a harfbuzz face from a freetype font pub fn new(face: freetype::freetype::FT_Face) -> Font { // hb_ft_font_create_referenced always returns a @@ -64,6 +66,7 @@ impl Font { Font { font: unsafe { hb_ft_font_create_referenced(face) } } } + #[cfg(any(target_os = "android", all(unix, not(target_os = "macos"))))] pub fn set_load_flags(&mut self, load_flags: freetype::freetype::FT_Int32) { unsafe { hb_ft_font_set_load_flags(self.font, load_flags);