Commit 187ad6e0 authored by Niels De Graef's avatar Niels De Graef Committed by Robert Roth

Port build system to Meson (bug 783062)

* Moved mpc.vapi and mpfr.vapi to the vapi directory
* Tried to keep lists sorted when possible.
Signed-off-by: Niels De Graef's avatarNiels De Graef <nielsdegraef@gmail.com>
parent 3898772d
......@@ -2,6 +2,12 @@ SUBDIRS = data lib src search-provider tests help po
AM_DISTCHECK_CONFIGURE_FLAGS = --enable-installed-tests
EXTRA_DIST = \
**/meson.build \
meson_options.txt \
meson_post_install.py \
$(NULL)
MAINTAINERCLEANFILES = \
$(GITIGNORE_MAINTAINERCLEANFILES_TOPLEVEL) \
$(GITIGNORE_MAINTAINERCLEANFILES_MAKEFILE_IN) \
......
# Desktop file
i18n.merge_file(
input: 'org.gnome.Calculator.desktop.in',
output: 'org.gnome.Calculator.desktop',
type: 'desktop',
po_dir: po_dir,
install: true,
install_dir: join_paths(get_option('datadir'), 'applications'),
)
# Appdata
i18n.merge_file(
input: 'org.gnome.Calculator.appdata.xml.in',
output: 'org.gnome.Calculator.appdata.xml',
type: 'xml',
po_dir: po_dir,
install: true,
install_dir: join_paths(get_option('datadir'), 'metainfo')
)
# Gschema
install_data('org.gnome.calculator.gschema.xml',
install_dir: join_paths(get_option('datadir'), 'appdata'),
)
# Manpage
install_man(
'gnome-calculator.1',
'gcalccmd.1'
)
gnome_calculator_help_pages = [
'absolute.page',
'base.page',
'boolean.page',
'complex.page',
'conv-base.page',
'conv-character.page',
'conv-currency.page',
'conv-length.page',
'conv-time.page',
'conv-weight.page',
'equation.page',
'factorial.page',
'factorize.page',
'financial.page',
'functions.page',
'history.page',
'index.page',
'keyboard.page',
'legal.xml',
'logarithm.page',
'modulus.page',
'mouse.page',
'number-display.page',
'percentage.page',
'power.page',
'scientific.page',
'superscript.page',
'trigonometry.page',
'variables.page',
]
gnome_calculator_help_media = [
'figures/logo32.png',
]
gnome_calculator_help_languages = [
'bg',
'ca',
'cs',
'de',
'el',
'es',
'eu',
'fi',
'fr',
'gl',
'hu',
'it',
'ja',
'ko',
'lv',
'oc',
'pt',
'pt_BR',
'ro',
'ru',
'sl',
'sv',
'te',
'zh_CN',
'zh_HK',
'zh_TW',
]
gnome.yelp(meson.project_name(),
sources: gnome_calculator_help_pages,
media: gnome_calculator_help_media,
languages: gnome_calculator_help_languages
)
......@@ -6,9 +6,7 @@ AM_CPPFLAGS = \
$(LIBCALCULATOR_CFLAGS)
libcalculator_la_SOURCES = \
mpfr.vapi \
mpfr-glue.vala \
mpc.vapi \
currency.vala \
equation.vala \
equation-lexer.vala \
......
public const string GETTEXT_PACKAGE;
libcalculator_sources = [
'mpfr-glue.vala',
'currency.vala',
'equation.vala',
'equation-lexer.vala',
'equation-parser.vala',
'financial.vala',
'function-manager.vala',
'math-equation.vala',
'math-function.vala',
'math-variables.vala',
'number.vala',
'serializer.vala',
'unit.vala',
]
libcalculator_vala_flags = [
'--target-glib', glib_min_version,
]
libcalculator_c_flags = [
'-include', 'config.h',
]
libcalculator_deps = [
gio,
glib,
gobject,
gtk,
gtksourceview,
libsoup,
libxml,
mpc,
mpfr,
posix,
]
libcalculator = static_library('libcalculator', libcalculator_sources,
dependencies: libcalculator_deps,
c_args: libcalculator_c_flags,
vala_args: libcalculator_vala_flags,
include_directories: config_h_dir,
install: true,
)
project('gnome-calculator', ['c', 'vala'],
version: '3.25.91',
meson_version: '>= 0.37',
license: 'GPLv3+',
)
gnome = import('gnome')
i18n = import('i18n')
# Some variables
libexec_dir = join_paths(get_option('prefix'), get_option('libexecdir'))
locale_dir = join_paths(get_option('prefix'), get_option('localedir'))
po_dir = join_paths(meson.source_root(), 'po')
vapi_dir = join_paths(meson.source_root(), 'vapi')
# Add our custom VAPI dir
add_project_arguments(['--vapidir', vapi_dir],
language: 'vala'
)
# Dependencies
glib_min_version = '2.40.0'
gio = dependency('gio-2.0', version: '>= ' + glib_min_version)
glib = dependency('glib-2.0', version: '>= ' + glib_min_version)
gmodule_export = dependency('gmodule-export-2.0')
gobject = dependency('gobject-2.0', version: '>= ' + glib_min_version)
gtk = dependency('gtk+-3.0', version: '>= 3.19.3')
gtksourceview = dependency('gtksourceview-3.0', version: '>= 3.15.1')
libsoup = dependency('libsoup-2.4', version: '>= 2.42')
libxml = dependency('libxml-2.0')
# Libraries
cc = meson.get_compiler('c')
valac = meson.get_compiler('vala')
libmath = cc.find_library('m')
mpc = declare_dependency(
dependencies: [
cc.find_library('mpc'),
valac.find_library('mpc', dirs: vapi_dir)
]
)
mpfr = declare_dependency(
dependencies: [
cc.find_library('mpfr'),
valac.find_library('mpfr', dirs: vapi_dir)
]
)
posix = valac.find_library('posix')
# Configuration
conf = configuration_data()
conf.set_quoted('GETTEXT_PACKAGE', meson.project_name())
conf.set_quoted('LOCALE_DIR', locale_dir)
conf.set_quoted('VERSION', meson.project_version())
configure_file(output: 'config.h', configuration: conf)
config_h_dir = include_directories('.')
# Extra scripts
meson.add_install_script('meson_post_install.py')
# Subdirs
subdir('data')
subdir('lib')
subdir('src')
subdir('search-provider')
subdir('tests')
subdir('help')
subdir('po')
#!/usr/bin/env python3
import os
import subprocess
install_prefix = os.environ['MESON_INSTALL_PREFIX']
icondir = os.path.join(install_prefix, 'share', 'icons', 'hicolor')
schemadir = os.path.join(install_prefix, 'share', 'glib-2.0', 'schemas')
if not os.environ.get('DESTDIR'):
print('Update icon cache...')
subprocess.call(['gtk-update-icon-cache', '-f', '-t', icondir])
print('Compiling gsettings schemas...')
subprocess.call(['glib-compile-schemas', schemadir])
i18n.gettext(meson.project_name(),
preset: 'glib'
)
search_provider_sources = [
'search-provider.vala',
]
search_provider_deps = [
gio,
glib,
gobject,
gtk,
gtksourceview,
mpc,
mpfr,
posix,
]
search_provider_vala_flags = [
'--vapidir=' + meson.current_source_dir(),
'--pkg', 'config',
]
search_provider_includes = [
config_h_dir,
include_directories('../lib'),
]
# The executable
executable('gnome-calculator-search-provider', search_provider_sources,
dependencies: search_provider_deps,
link_with: libcalculator,
include_directories: search_provider_includes,
vala_args: search_provider_vala_flags,
install: true,
)
# The search-provider file for GNOME shell
install_data('org.gnome.Calculator-search-provider.ini',
install_dir: join_paths(get_option('datadir'), 'gnome-shell', 'search-providers'),
)
# The DBUS service file
dbusconf = configuration_data()
dbusconf.set('libexecdir', libexec_dir)
configure_file(
input: 'org.gnome.Calculator.SearchProvider.service.in',
output: 'org.gnome.Calculator.SearchProvider.service',
configuration: dbusconf,
install: true,
install_dir: join_paths(get_option('datadir'), 'dbus-1', 'services'),
)
# gnome-calculator executable
gnome_calculator_vala_sources = [
'gnome-calculator.vala',
'math-buttons.vala',
'math-converter.vala',
'math-display.vala',
'math-preferences.vala',
'math-function-popover.vala',
'math-variable-popover.vala',
'math-window.vala',
'math-history.vala',
]
gnome_calculator_resource_files = files('gnome-calculator.gresource.xml')
gnome_calculator_resources = gnome.compile_resources('org.gnome.Calculator', gnome_calculator_resource_files)
gnome_calculator_sources = [
gnome_calculator_vala_sources,
gnome_calculator_resources,
]
gnome_calculator_deps = [
glib,
gobject,
gtk,
gtksourceview,
mpc,
mpfr,
posix,
]
gnome_calculator_vala_flags = [
'--target-glib', glib_min_version,
'--vapidir=' + meson.current_source_dir(),
'--pkg', 'config',
'--gresources', gnome_calculator_resource_files,
]
gnome_calculator_c_flags = [
'-include', 'config.h',
]
gnome_calculator_includes = [
config_h_dir,
include_directories('../lib'),
]
executable('gnome-calculator', gnome_calculator_sources,
dependencies: gnome_calculator_deps,
link_with: libcalculator,
include_directories: gnome_calculator_includes,
vala_args: gnome_calculator_vala_flags,
c_args: gnome_calculator_c_flags,
install: true,
)
# gcalccmd executable
gcalccmd_sources = [
'gcalccmd.vala',
]
gcalccmd_deps = [
gio,
glib,
gobject,
gtk,
gtksourceview,
mpc,
mpfr,
posix,
]
gcalccmd_vala_flags = [
'--vapidir=' + meson.current_source_dir(),
'--pkg', 'config',
]
gcalccmd_includes = [
config_h_dir,
include_directories('../lib'),
]
executable('gcalccmd', gcalccmd_sources,
dependencies: gcalccmd_deps,
link_with: libcalculator,
include_directories: gcalccmd_includes,
vala_args: gcalccmd_vala_flags,
install: true,
)
# Common
gnome_calculator_tests_deps = [
gio,
glib,
gobject,
gtk,
gtksourceview,
libmath,
mpc,
mpfr,
posix,
]
gnome_calculator_tests_includes = [
include_directories('../lib'),
]
# Tests
test_equation_sources = [
'test-equation.vala',
]
test_equation = executable('test-equation', test_equation_sources,
dependencies: gnome_calculator_tests_deps,
link_with: libcalculator,
include_directories: gnome_calculator_tests_includes,
)
test('Equation test', test_equation)
test_number_sources = [
'test-number.vala',
]
test_number = executable('test-number', test_number_sources,
dependencies: gnome_calculator_tests_deps,
link_with: libcalculator,
include_directories: gnome_calculator_tests_includes,
)
test('Number test', test_number)
test_serializer_sources = [
'test-serializer.vala',
]
test_serializer = executable('test-serializer', test_serializer_sources,
dependencies: gnome_calculator_tests_deps,
link_with: libcalculator,
include_directories: gnome_calculator_tests_includes,
)
test('Serializer test', test_serializer)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment