Skip to content

Commit

Permalink
Account for ftmodapi.h maybe being in a sub-directory of -I'd dir
Browse files Browse the repository at this point in the history
  • Loading branch information
Chris00 committed Sep 6, 2018
1 parent 37af06e commit a1a3bee
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 7 deletions.
20 changes: 14 additions & 6 deletions config/discover.ml
Expand Up @@ -62,21 +62,29 @@ let discover_cairo c =
let has_fc_font = match List.assoc "CAIRO_HAS_FC_FONT" d with
| C.C_define.Value.Switch b -> b
| _ -> false in
let libs =
let cflags, libs =
if has_ft_font && has_fc_font then (
match P.get c with
| Some p ->
(match P.query p ~package:"fontconfig" with
| Some fc ->
(match P.query p ~package:"freetype2" with
| Some ft -> c_header_has_ft ();
ft.libs @ fc.libs @ libs
| None -> libs)
| Some ft ->
(* freetype/ftmodapi.h on Debian but no prefix
directory on Ubuntu. *)
let freetype l f =
if String.length f > 2 && f.[0] = '-' && f.[1] = 'I' then
f :: (f ^ "/freetype") :: l
else f :: l in
c_header_has_ft ();
(List.fold_left freetype [] ft.cflags @ ft.cflags @ cflags,
ft.libs @ fc.libs @ libs)
| None -> cflags, libs)
| None -> C.die "Cairo was compiled with FreeType but \
fontconfig cannot be found.")
| None -> libs
| None -> cflags, libs
)
else libs in
else cflags, libs in
write ~cflags ~libs

let default_gtk c =
Expand Down
2 changes: 1 addition & 1 deletion src/cairo_ocaml_types.h
Expand Up @@ -351,7 +351,7 @@ DEFINE_CUSTOM_OPERATIONS(scaled_font,

#ifdef OCAML_CAIRO_HAS_FT
#include <cairo-ft.h>
#include <freetype/ftmodapi.h>
#include <ftmodapi.h>

#define FT_LIBRARY_ASSIGN(v, x) \
v = ALLOC(cairo_ft_library); FT_LIBRARY_VAL(v) = x
Expand Down

0 comments on commit a1a3bee

Please sign in to comment.