[cantarell-fonts] Add option to use prebuilt binaries



commit 7ecd189327149385a3922771c7e04cf7599f2a85
Author: Nikolaus Waxweiler <madigens gmail com>
Date:   Wed Feb 7 21:08:20 2018 +0000

    Add option to use prebuilt binaries
    
    Instead of building from source.

 meson.build          |   12 ++++++++----
 meson_options.txt    |    3 +++
 prebuilt/meson.build |    7 +++++++
 src/meson.build      |   30 +++++++++++++++---------------
 4 files changed, 33 insertions(+), 19 deletions(-)
---
diff --git a/meson.build b/meson.build
index d0a4ebd..27ab8ad 100644
--- a/meson.build
+++ b/meson.build
@@ -8,10 +8,14 @@ if fontsdir == ''
   fontsdir = join_paths(datadir, 'fonts', 'cantarell')
 endif
 
-python3 = import('python3').find_python()
-fontmake = find_program('fontmake')
-fontmake_wrapper = join_paths(meson.current_source_dir(), 'scripts', 'fm.py')
-psautohint = find_program('psautohint')
+useprebuilt = get_option('useprebuilt')
+if useprebuilt == false
+  python3 = import('python3').find_python()
+  fontmake = find_program('fontmake')
+  fontmake_wrapper = join_paths(meson.current_source_dir(), 'scripts', 'fm.py')
+  psautohint = find_program('psautohint')
+endif
 
 subdir('src')
+subdir('prebuilt')
 subdir('appstream')
diff --git a/meson_options.txt b/meson_options.txt
index a2c473d..7e1e038 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -1,2 +1,5 @@
 option('fontsdir', type : 'string',
        description : 'The directory the fonts should be copied to.')
+
+option('useprebuilt', type : 'boolean', value : false,
+      description : 'Use pre-built font binaries in "prebuilt/" instead of buiding from source')
diff --git a/prebuilt/meson.build b/prebuilt/meson.build
new file mode 100644
index 0000000..6601711
--- /dev/null
+++ b/prebuilt/meson.build
@@ -0,0 +1,7 @@
+if useprebuilt == true
+  install_data('Cantarell-Thin.otf', install_dir : fontsdir)
+  install_data('Cantarell-Light.otf', install_dir : fontsdir)
+  install_data('Cantarell-Regular.otf', install_dir : fontsdir)
+  install_data('Cantarell-Bold.otf', install_dir : fontsdir)
+  install_data('Cantarell-ExtraBold.otf', install_dir : fontsdir)
+endif
diff --git a/src/meson.build b/src/meson.build
index 048b304..06e9050 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -1,15 +1,15 @@
-cantarell_binaries = [
-'Cantarell-Thin.otf',
-'Cantarell-Light.otf',
-'Cantarell-Regular.otf',
-'Cantarell-Bold.otf',
-'Cantarell-ExtraBold.otf'
-]
-
-custom_target('Cantarell',
-              input : 'Cantarell.glyphs',
-              output : cantarell_binaries,
-              command : [python3, fontmake_wrapper, fontmake, psautohint,
-                         '@INPUT@', '@OUTDIR@'],
-              install: true,
-              install_dir : fontsdir)
+if useprebuilt == false
+  custom_target('Cantarell',
+                input : 'Cantarell.glyphs',
+                output : [
+                  'Cantarell-Thin.otf',
+                  'Cantarell-Light.otf',
+                  'Cantarell-Regular.otf',
+                  'Cantarell-Bold.otf',
+                  'Cantarell-ExtraBold.otf'
+                ],
+                command : [python3, fontmake_wrapper, fontmake, psautohint,
+                           '@INPUT@', '@OUTDIR@'],
+                install: true,
+                install_dir : fontsdir)
+endif


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]