Skip to content

Commit

Permalink
build: Add Meson build system
Browse files Browse the repository at this point in the history
Meson is a meta build system that is:

  - fast
  - simpler to understand and use
  - portable to multiple platforms through different backends
  - well integrated with the GNOME platform
  - well maintained

Using Meson allows us to build Pango much more quickly, and on all the
platforms we currently target, without any loss of functionality,
compared to Autotools.

Some timing comparisons with hot ccache for both build systems:

  * autogen.sh:                         * meson
    real	0m11.149s                 real          0m2.525s
    user	0m8.153s                  user	        0m1.609s
    sys	        0m2.363s                  sys	        0m1.206s
  * make -j$(($(nproc) + 2))            * ninja
    real	0m9.186s                  real	        0m3.387s
    user	0m16.295s                 user	        0m6.887s
    sys	        0m5.337s                  sys	        0m1.318s
  --------------------------------------------------------------
  * autotools                           * meson + ninja
    real	0m27.669s                 real	        0m5.772s
    user	0m45.622s                 user	        0m8.465s
    sys	        0m10.698s                 sys	        0m2.357s

System: Intel Core i7-7500U, SSD, 16GB of RAM
  • Loading branch information
ebassi committed May 19, 2017
1 parent 4819027 commit 5d3af9b
Show file tree
Hide file tree
Showing 12 changed files with 994 additions and 0 deletions.
108 changes: 108 additions & 0 deletions docs/meson.build
@@ -0,0 +1,108 @@
subdir('xml')

version_xml_conf = configuration_data()
version_xml_conf.set('PANGO_VERSION', meson.project_version())
configure_file(input: 'version.xml.in',
output: 'version.xml',
configuration: version_xml_conf)

private_headers = [
'ftglue.h',
'modules.h',
'pangoatsui-private.h',
'pangocairo-private.h',
'pangocairo-fc.h',
'pangocairo-win32.h',
'pangocairo-atsui.h',
'pango-color-table.h',
'pango-engine-private.h',
'pango-impl-utils.h',
'pango-glyph-item-private.h',
'pango-layout-private.h',
'pango-script-table.h',
'pango-script-private.h',
'pangofc-private.h',
'pangoft2-private.h',
'pangowin32-private.h',
'pangoatsui-private.h',
'pangox-private.h',
'pangoxft-private.h',
'pango-ot-private.h',
'pango-script-lang-table.h',
'pango-language-sample-table.h',
'pangocoretext-private.h',
'pangoatsui-private.h',
'mini-fribidi',
]

if not host_system.contains('darwin')
private_headers += [
'pangocairo-coretextfont.h',
'pangocairo-coretext.h',
'pangocoretext.h',
]
endif

if not host_system.contains('windows')
private_headers += [
'pangocairo-win32.h',
'pangowin32.h',
]
endif

content_files = [
'pango_markup.sgml',
'version.xml',
]

html_images = [
'layout.gif',
'rotated-text.png',
]

docdeps = [ libpango_dep ]

if freetype_dep.found()
docdeps += libpangoft2_dep
endif

if xft_dep.found()
docdeps += libpangoxft_dep
endif

if cairo_dep.found()
docdeps += libpangocairo_dep
endif

glib_prefix = dependency('glib-2.0').get_pkgconfig_variable('prefix')
glib_docpath = join_paths(glib_prefix, 'share', 'gtk-doc', 'html')
cairo_prefix = dependency('cairo').get_pkgconfig_variable('prefix')
cairo_docpath = join_paths(cairo_prefix, 'share', 'gtk-doc', 'html')
docpath = join_paths(pango_datadir, 'gtk-doc', 'html')

gnome.gtkdoc('pango',
main_xml: 'pango-docs.sgml',
src_dir: [
join_paths(meson.source_root(), 'pango'),
join_paths(meson.build_root(), 'pango'),
],
dependencies: docdeps,
gobject_typesfile: 'pango.types',
scan_args: [
'--rebuild-types',
'--deprecated-guards=PANGO_DISABLE_DEPRECATED',
'--ignore-decorators=_PANGO_EXTERN',
'--ignore-headers=' + ' '.join(private_headers),
],
mkdb_args: [
'--sgml-mode',
'--output-format=xml',
],
fixxref_args: [
'--html-dir=@0@'.format(docpath),
'--extra-dir=@0@'.format(join_paths(glib_docpath, 'glib')),
'--extra-dir=@0@'.format(join_paths(glib_docpath, 'gobject')),
'--extra-dir=@0@'.format(join_paths(cairo_docpath, 'cairo')),
],
html_assets: html_images,
install: true)
8 changes: 8 additions & 0 deletions docs/xml/gtkdocentities.ent.in
@@ -0,0 +1,8 @@
<!ENTITY package "@PACKAGE@">
<!ENTITY package_bugreport "@PACKAGE_BUGREPORT@">
<!ENTITY package_name "@PACKAGE_NAME@">
<!ENTITY package_string "@PACKAGE_STRING@">
<!ENTITY package_tarname "@PACKAGE_TARNAME@">
<!ENTITY package_url "@PACKAGE_URL@">
<!ENTITY package_version "@PACKAGE_VERSION@">
<!ENTITY package_api_version "@PACKAGE_API_VERSION@">
10 changes: 10 additions & 0 deletions docs/xml/meson.build
@@ -0,0 +1,10 @@
ent_conf = configuration_data()
ent_conf.set('PACKAGE', meson.project_name())
ent_conf.set('PACKAGE_BUGREPORT', 'https://bugzilla.gnome.org/enter_bug.cgi?product=pango')
ent_conf.set('PACKAGE_NAME', meson.project_name())
ent_conf.set('PACKAGE_STRING', meson.project_name())
ent_conf.set('PACKAGE_TARNAME', '@0@-@1@'.format(meson.project_name(), meson.project_version()))
ent_conf.set('PACKAGE_URL', 'https://developer.gnome.org/pango/stable')
ent_conf.set('PACKAGE_VERSION', meson.project_version())
ent_conf.set('PACKAGE_API_VERSION', pango_api_version)
configure_file(input: 'gtkdocentities.ent.in', output: 'gtkdocentities.ent', configuration: ent_conf)
22 changes: 22 additions & 0 deletions examples/meson.build
@@ -0,0 +1,22 @@
examples = []

if pango_cairo_backends.contains('png')
examples += [
'cairoshape',
'cairosimple',
'cairotwisted',
]
endif

examples_deps = [ libpango_dep, libpangocairo_dep, ]

if pango_font_backends.contains('freetype')
examples_deps += libpangoft2_dep
endif

foreach e: examples
executable(e, '@0@.c'.format(e),
dependencies: examples_deps + pango_deps,
include_directories: root_inc,
install: false)
endforeach

0 comments on commit 5d3af9b

Please sign in to comment.