aboutsummaryrefslogtreecommitdiffhomepage
path: root/gyp/fontconfig.gyp
diff options
context:
space:
mode:
authorGravatar commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2014-01-09 17:37:38 +0000
committerGravatar commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2014-01-09 17:37:38 +0000
commit9a907fa0d3ac573af2f5b45bd41af76c9035777f (patch)
treeaccf1380a8085cc5193a0108bbe12abf5cd9cbcd /gyp/fontconfig.gyp
parent18b75e54ab64763615e09761fcaeb3f439835f59 (diff)
Fix Mac fontconfig build
The Mac fontconfig just #defines the cache directory, which works fine if fontconfig never has to look up any fonts (the case until now). If it has to actually find fonts from the disk, the cache directory and config directory need to be properly defined as well as running fc-cache to populate the cache directory. Populating the cache directory can take some time, but should only happen on a clean build. To remove this extra time, we have to not build poppler on Mac, which can now be accomplished with GYP_DEFINES="skia_mac_poppler=0" R=bungeman@google.com, epoger@google.com Author: vandebo@chromium.org Review URL: https://codereview.chromium.org/113203003 git-svn-id: http://skia.googlecode.com/svn/trunk@12994 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'gyp/fontconfig.gyp')
-rw-r--r--gyp/fontconfig.gyp107
1 files changed, 103 insertions, 4 deletions
diff --git a/gyp/fontconfig.gyp b/gyp/fontconfig.gyp
index 35f699faae..0a4a09899a 100644
--- a/gyp/fontconfig.gyp
+++ b/gyp/fontconfig.gyp
@@ -13,13 +13,31 @@
'targets': [
{
'target_name': 'fontconfig',
+ 'type': 'none',
+ 'dependencies': [
+ 'libfontconfig',
+ ],
+ 'direct_dependent_settings': {
+ 'include_dirs': [
+ '../third_party/externals/fontconfig',
+ ],
+ },
+ 'conditions': [
+ ['skia_os == "mac"', {
+ 'dependencies': [
+ 'fontconfig_setup',
+ ],
+ }],
+ ],
+ },
+ {
+ 'target_name': 'libfontconfig',
'type': 'static_library',
'dependencies': [
'freetype.gyp:freetype_poppler',
],
'include_dirs' : [
'../third_party/externals/fontconfig',
-
'../third_party/fontconfig/config',
'../third_party/fontconfig/config/src',
],
@@ -66,12 +84,12 @@
'conditions': [
['skia_os == "mac"', {
'include_dirs': [
+ '<(SHARED_INTERMEDIATE_DIR)/fontconfig_config',
'../third_party/fontconfig/config/mac',
'../third_party/fontconfig/config/mac/src',
],
- 'defines': [
- 'FC_CACHEDIR',
- 'FONTCONFIG_PATH',
+ 'dependencies': [
+ 'fontconfig_config_template',
],
'libraries': [
'$(SDKROOT)/usr/lib/libexpat.dylib',
@@ -97,4 +115,85 @@
],
},
],
+ 'conditions': [
+ ['skia_os == "mac"', {
+ 'variables': {
+ 'cachedir': '<(PRODUCT_DIR)/fontconfig/cache',
+ 'configdir': '<(PRODUCT_DIR)/fontconfig/etc',
+ },
+ 'targets': [
+ {
+ 'target_name': 'fontconfig_config_template',
+ 'type': 'none',
+ 'actions': [{
+ 'action_name': 'fontconfig_config_template',
+ 'message': 'Generating fontconfig header',
+ 'inputs': [
+ '../third_party/fontconfig/process-template.py',
+ '../third_party/fontconfig/config/mac/config.h.template',
+ ],
+ 'outputs': [
+ '<(SHARED_INTERMEDIATE_DIR)/fontconfig_config/config.h',
+ ],
+ 'action': [
+ 'python', '../third_party/fontconfig/process-template.py',
+ '-i', '../third_party/fontconfig/config/mac/config.h.template',
+ '-o', '<@(_outputs)',
+ '-p', '@FC_CACHEDIR@', '<(cachedir)',
+ '-p', '@FONTCONFIG_PATH@', '<(configdir)',
+ ],
+ }],
+ }, {
+ 'target_name': 'fontconfig_setup',
+ 'type': 'none',
+ 'dependencies': [
+ 'fc-cache',
+ ],
+ 'actions': [{
+ 'action_name': 'fontconfig_config_file',
+ 'message': 'Generating font.conf',
+ 'inputs': [
+ '../third_party/fontconfig/process-template.py',
+ '../third_party/externals/fontconfig/fonts.conf.in',
+ ],
+ 'outputs': [ '<(configdir)/fonts.conf', ],
+ 'action': [
+ 'python', '../third_party/fontconfig/process-template.py',
+ '-i', '../third_party/externals/fontconfig/fonts.conf.in',
+ '-o', '<(configdir)/fonts.conf',
+ '-p', '@FC_CACHEDIR@', '<(cachedir)',
+ '-k', '@FC_DEFAULT_FONTS@', '/System/Library/Fonts',
+ '-k', '@FC_FONTPATH@', '<dir>/Library/Fonts</dir>',
+ '-p', '@CONFIGDIR@', '<(configdir)/conf.d',
+ '-k', '@PACKAGE@', 'fontconfig',
+ '-k', '@VERSION@', '2.10.93',
+ ],
+ }, {
+ 'action_name': 'populate_fontconfig_cache',
+ 'message':
+ 'Generating fontconfig cache (this will take a few minutes).',
+ 'inputs': [
+ '<(PRODUCT_DIR)/fc-cache',
+ '<(configdir)/fonts.conf',
+ ],
+ 'outputs': [ '<(cachedir)/CACHEDIR.TAG', ],
+ 'action': [ '<(PRODUCT_DIR)/fc-cache', '-s', '-f', '-v', ],
+ }],
+ },
+ {
+ 'target_name': 'fc-cache',
+ 'type': 'executable',
+ 'dependencies': [
+ 'libfontconfig',
+ ],
+ 'libraries':[
+ '$(SDKROOT)/usr/lib/libexpat.dylib',
+ ],
+ 'sources': [
+ '../third_party/externals/fontconfig/fc-cache/fc-cache.c',
+ ],
+ },
+ ],
+ }],
+ ],
}