[yelp-tools: 1/3] build: Port to meson build system




commit 36cac1db2806a6f50baaec01469f710061b42910
Author: Martin Blanchard <martin blanchard codethink co uk>
Date:   Tue Mar 13 09:27:14 2018 +0000

    build: Port to meson build system
    
    The meson is a build system focused on speed an ease of use,
    which helps speeding up the software development.
    
    https://wiki.gnome.org/Initiatives/GnomeGoals/MesonPorting
    
    https://gitlab.gnome.org/GNOME/yelp-tools/issues/17
    https://bugzilla.gnome.org/show_bug.cgi?id=794279

 help/meson.build      | 12 ++++++++
 meson.build           | 85 +++++++++++++++++++++++++++++++++++++++++++++++++++
 meson_options.txt     |  7 +++++
 templates/meson.build | 10 ++++++
 tools/meson.build     | 68 +++++++++++++++++++++++++++++++++++++++++
 xslt/meson.build      | 54 ++++++++++++++++++++++++++++++++
 6 files changed, 236 insertions(+)
---
diff --git a/help/meson.build b/help/meson.build
new file mode 100644
index 00000000..acf51274
--- /dev/null
+++ b/help/meson.build
@@ -0,0 +1,12 @@
+yelp_tools_help_sources = [
+  'index.page',
+  'yelp-build.page',
+  'yelp-check.page',
+  'yelp-new.page',
+  'yelp.m4.page',
+]
+
+gnome.yelp(
+  package_name,
+  sources: yelp_tools_help_sources,
+)
\ No newline at end of file
diff --git a/meson.build b/meson.build
new file mode 100644
index 00000000..903dec57
--- /dev/null
+++ b/meson.build
@@ -0,0 +1,85 @@
+project('yelp-tools',
+  version: '3.27.90',
+  license: 'LGPL2.1+',
+  meson_version: '>= 0.43.0',
+)
+
+gnome = import('gnome')
+
+# Versioning
+version = meson.project_version()
+version_arr = version.split('.')
+version_major = version_arr[0].to_int()
+version_minor = version_arr[1].to_int()
+version_micro = version_arr[2].to_int()
+
+package_name = meson.project_name()
+
+# Paths
+srcdir = meson.source_root()
+builddir = meson.build_root()
+
+prefix = get_option('prefix')
+
+bindir = join_paths(prefix, get_option('bindir'))
+datadir = join_paths(prefix, get_option('datadir'))
+
+autoconfdatadir = join_paths(datadir, 'aclocal')
+pkgdir = join_paths(datadir, package_name)
+pkgtemplatesdir = join_paths(pkgdir, 'templates')
+pkgxsltdir = join_paths(pkgdir, 'xslt')
+
+# Dependencies
+yelp_xsl_req = '>= 3.17.3'
+
+yelp_xsl_dep = dependency('yelp-xsl', version: yelp_xsl_req)
+
+xmllint_prg = find_program('xmllint', required: true)
+xsltproc_prg = find_program('xsltproc', required: true)
+itstool_prg = find_program('itstool', required: true)
+
+awk_prg = find_program('awk', required: false)
+
+yelp_db2html_path = yelp_xsl_dep.get_pkgconfig_variable('db2html')
+yelp_db2xhtml_path = yelp_xsl_dep.get_pkgconfig_variable('db2xhtml')
+yelp_mal2html_path = yelp_xsl_dep.get_pkgconfig_variable('mal2html')
+yelp_mal2xhtml_path = yelp_xsl_dep.get_pkgconfig_variable('mal2xhtml')
+
+yelp_xslt_dir = yelp_xsl_dep.get_pkgconfig_variable('xsltdir')
+yelp_js_dir = yelp_xsl_dep.get_pkgconfig_variable('jsdir')
+yelp_templates_dir = pkgtemplatesdir
+yelp_icons_dir = join_paths(
+  yelp_xsl_dep.get_pkgconfig_variable('icondir'),
+  'hicolor', '24x24', 'status',
+)
+
+# Options
+build_yelp_manual = get_option('yelp_manual')
+if not awk_prg.found()
+  build_yelp_manual = false
+endif
+
+subdir('xslt')
+subdir('templates')
+
+subdir('tools')
+
+if build_yelp_manual == true
+  subdir('help')
+endif
+
+summary = [
+  '',
+  '------',
+  'yelp-tools @0@'.format(version),
+  '',
+  '  Autotools: @0@'.format(get_option('autotools')),
+  '     Manual: @0@'.format(build_yelp_manual),
+  '',
+  'Directories:',
+  '     prefix: @0@'.format(prefix),
+  '    datadir: @0@'.format(datadir),
+  '------',
+]
+
+message('\n'.join(summary))
\ No newline at end of file
diff --git a/meson_options.txt b/meson_options.txt
new file mode 100644
index 00000000..2dab818c
--- /dev/null
+++ b/meson_options.txt
@@ -0,0 +1,7 @@
+option('autotools',
+       type: 'boolean', value: true,
+       description: 'Install autotools macros')
+
+option('yelp_manual',
+       type: 'boolean', value: false,
+       description: 'Build user manual (requires awk)')
\ No newline at end of file
diff --git a/templates/meson.build b/templates/meson.build
new file mode 100644
index 00000000..19b7cf3a
--- /dev/null
+++ b/templates/meson.build
@@ -0,0 +1,10 @@
+yelp_tools_templates_data = [
+  'task.page',
+]
+
+install_data(
+  yelp_tools_templates_data,
+  install_dir: join_paths(
+    pkgtemplatesdir,
+  )
+)
\ No newline at end of file
diff --git a/tools/meson.build b/tools/meson.build
new file mode 100644
index 00000000..16d9c800
--- /dev/null
+++ b/tools/meson.build
@@ -0,0 +1,68 @@
+yelp_tools_in = configuration_data()
+yelp_tools_in.set('DATADIR', pkgdir)
+
+yelp_tools_in.set('YELP_XSLT_DIR', yelp_xslt_dir)
+yelp_tools_in.set('YELP_TMPL_DIR', join_paths(yelp_templates_dir, '')) # Hack for trailing '/'
+yelp_tools_in.set('YELP_JS_DIR', yelp_js_dir)
+yelp_tools_in.set('YELP_ICON_DIR', yelp_icons_dir)
+
+yelp_tools_in.set('XSL_DB2HTML', yelp_db2html_path)
+yelp_tools_in.set('XSL_DB2XHTML', yelp_db2xhtml_path)
+yelp_tools_in.set('XSL_MAL2HTML', yelp_mal2html_path)
+yelp_tools_in.set('XSL_MAL2XHTML', yelp_mal2xhtml_path)
+
+yelp_tools_in.set('XSL_MAL_CACHE', join_paths(
+  yelp_xslt_dir,
+  'mallard',
+  'cache',
+  'mal-cache.xsl',
+  )
+)
+
+yelp_tools_in.set('XSL_MAL_LINK', join_paths(
+  yelp_xslt_dir,
+  'mallard',
+  'common',
+  'mal-link.xsl',
+  )
+)
+
+yelp_tools_in.set('ID', '@ID@')
+yelp_tools_in.set('DATE', '@DATE@')
+yelp_tools_in.set('YEAR', '@YEAR@')
+yelp_tools_in.set('NAME', '@NAME@')
+yelp_tools_in.set('EMAIL', '@EMAIL@')
+yelp_tools_in.set('TITLE', '@TITLE@')
+
+configure_file(
+  input: 'yelp-build.in',
+  output: 'yelp-build',
+  configuration: yelp_tools_in,
+  install: true,
+  install_dir: bindir,
+)
+
+configure_file(
+  input: 'yelp-check.in',
+  output: 'yelp-check',
+  configuration: yelp_tools_in,
+  install: true,
+  install_dir: bindir,
+)
+
+configure_file(
+  input: 'yelp-new.in',
+  output: 'yelp-new',
+  configuration: yelp_tools_in,
+  install: true,
+  install_dir: bindir,
+)
+
+if get_option('autotools') == true
+  install_data(
+    'yelp.m4',
+    install_dir: join_paths(
+      autoconfdatadir,
+    )
+  )
+endif
\ No newline at end of file
diff --git a/xslt/meson.build b/xslt/meson.build
new file mode 100644
index 00000000..9615d428
--- /dev/null
+++ b/xslt/meson.build
@@ -0,0 +1,54 @@
+yelp_tools_xslt_data = [
+  'comments.xsl',
+  'mal-epub.xsl',
+  'mal-files.xsl',
+  'mal-license.xsl',
+  'mal-rng.xsl',
+  'mal-status.xsl',
+  'media.xsl',
+]
+
+install_data(
+  yelp_tools_xslt_data,
+  install_dir: join_paths(
+    pkgxsltdir,
+  )
+)
+
+yelp_xslt_in = configuration_data()
+
+yelp_xslt_in.set('XSL_MAL_LINK', join_paths(
+  yelp_xslt_dir,
+  'mallard',
+  'common',
+  'mal-link.xsl',
+  )
+)
+
+yelp_xslt_in.set('XSL_MAL_SORT', join_paths(
+  yelp_xslt_dir,
+  'mallard',
+  'common',
+  'mal-sort.xsl',
+  )
+)
+
+configure_file(
+  input: 'mal-ncx.xsl.in',
+  output: 'mal-ncx.xsl',
+  configuration: yelp_xslt_in,
+  install: true,
+  install_dir: join_paths(
+    pkgxsltdir,
+  )
+)
+
+configure_file(
+  input: 'mal-opf.xsl.in',
+  output: 'mal-opf.xsl',
+  configuration: yelp_xslt_in,
+  install: true,
+  install_dir: join_paths(
+    pkgxsltdir,
+  )
+)
\ No newline at end of file


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