2019-07-17 13:10:36 +02:00
|
|
|
project('tuhi',
|
2019-07-10 01:51:41 +02:00
|
|
|
version: '0.1',
|
|
|
|
license: 'GPLv2',
|
|
|
|
meson_version: '>= 0.48.0')
|
|
|
|
# The tag date of the project_version(), update when the version bumps.
|
|
|
|
version_date='2019-07-10'
|
|
|
|
# Note: Update the Contributor list in data/ui/AboutDialog.ui.in when the
|
|
|
|
# version bumps
|
|
|
|
|
|
|
|
# Dependencies
|
|
|
|
dependency('python3', required: true)
|
|
|
|
dependency('pygobject-3.0', required: true)
|
|
|
|
|
|
|
|
# Gtk version required
|
|
|
|
gtk_major_version = 3
|
|
|
|
gtk_minor_version = 22
|
|
|
|
|
|
|
|
prefix = get_option('prefix')
|
|
|
|
datadir = join_paths(prefix, get_option('datadir'))
|
|
|
|
localedir = join_paths(prefix, get_option('localedir'))
|
|
|
|
pkgdatadir = join_paths(datadir, meson.project_name())
|
|
|
|
bindir = join_paths(prefix, get_option('bindir'))
|
|
|
|
podir = join_paths(meson.source_root(), 'po')
|
2019-07-11 04:11:55 +02:00
|
|
|
desktopdir = join_paths(datadir, 'applications')
|
|
|
|
icondir = join_paths(datadir, 'icons', 'hicolor', 'scalable', 'apps')
|
|
|
|
metainfodir = join_paths(datadir, 'metainfo')
|
2019-07-18 03:48:05 +02:00
|
|
|
libexecdir = join_paths(get_option('prefix'), get_option('libexecdir'), 'tuhi')
|
|
|
|
|
2019-07-10 01:51:41 +02:00
|
|
|
|
|
|
|
i18n = import('i18n')
|
|
|
|
|
|
|
|
subdir('po')
|
2019-07-17 13:10:36 +02:00
|
|
|
subdir('tuhigui/data')
|
2019-07-10 01:51:41 +02:00
|
|
|
|
|
|
|
# Find the directory to install our Python code
|
|
|
|
pymod = import('python')
|
|
|
|
py3 = pymod.find_installation()
|
|
|
|
python_dir = py3.get_install_dir()
|
2019-07-18 03:54:03 +02:00
|
|
|
install_subdir('tuhigui',
|
|
|
|
install_dir: python_dir,
|
|
|
|
exclude_directories: ['__pycache__', 'data'])
|
|
|
|
install_subdir('tuhi',
|
|
|
|
install_dir: python_dir,
|
|
|
|
exclude_directories: '__pycache__')
|
2019-07-10 01:51:41 +02:00
|
|
|
|
2019-07-18 03:48:05 +02:00
|
|
|
# We have three startup scripts:
|
|
|
|
# - tuhi: starts server and GUI
|
|
|
|
# - tuhi-gui: starts the GUI only
|
|
|
|
# - tuhi-server: starts the server only
|
|
|
|
#
|
|
|
|
# tuhi-server can run as-is, we don't need meson for it. But for the other
|
|
|
|
# two we build a {name}.devel version that uses the in-tree files.
|
|
|
|
# For that we need to replace a few paths, in the installed versions we just
|
|
|
|
# use the normal dirs.
|
|
|
|
#
|
|
|
|
config_tuhi = configuration_data()
|
|
|
|
config_tuhi.set_quoted('libexecdir', libexecdir)
|
|
|
|
config_tuhi.set('devel', '')
|
|
|
|
|
|
|
|
config_tuhi_devel = configuration_data()
|
|
|
|
config_tuhi_devel.set_quoted('libexecdir', '')
|
|
|
|
config_tuhi_devel.set('devel', '''
|
|
|
|
tuhi_gui = '@1@/tuhi-gui.devel'
|
|
|
|
tuhi_server = '@0@/tuhi-server.py'
|
|
|
|
print('Running from source tree, using local files')
|
|
|
|
'''.format(meson.source_root(), meson.build_root()))
|
|
|
|
|
2019-07-10 01:51:41 +02:00
|
|
|
config_tuhigui = configuration_data()
|
|
|
|
config_tuhigui.set('pkgdatadir', pkgdatadir)
|
|
|
|
config_tuhigui.set('localedir', localedir)
|
|
|
|
config_tuhigui.set('devel', '')
|
|
|
|
|
|
|
|
config_tuhigui_devel = config_tuhigui
|
2019-07-17 13:10:36 +02:00
|
|
|
config_tuhigui_devel.set('pkgdatadir', join_paths(meson.build_root(), 'tuhigui', 'data'))
|
2019-07-10 01:51:41 +02:00
|
|
|
config_tuhigui_devel.set('localedir', join_paths(meson.build_root(), 'po'))
|
|
|
|
config_tuhigui_devel.set('devel', '''
|
|
|
|
sys.path.insert(1, '@0@')
|
|
|
|
print('Running from source tree, using local files')
|
2019-07-18 03:48:05 +02:00
|
|
|
'''.format(meson.source_root(), meson.build_root()))
|
|
|
|
|
|
|
|
configure_file(input: 'tuhi.in',
|
|
|
|
output: 'tuhi',
|
|
|
|
configuration: config_tuhi,
|
|
|
|
install_dir: bindir)
|
|
|
|
|
|
|
|
configure_file(input: 'tuhi.in',
|
|
|
|
output: 'tuhi.devel',
|
|
|
|
configuration: config_tuhi_devel)
|
2019-07-10 01:51:41 +02:00
|
|
|
|
2019-07-18 03:05:58 +02:00
|
|
|
configure_file(input: 'tuhi-gui.in',
|
|
|
|
output: 'tuhi-gui',
|
2019-07-10 01:51:41 +02:00
|
|
|
configuration: config_tuhigui,
|
2019-07-18 03:48:05 +02:00
|
|
|
install_dir: libexecdir)
|
2019-07-10 01:51:41 +02:00
|
|
|
|
2019-07-18 03:05:58 +02:00
|
|
|
configure_file(input: 'tuhi-gui.in',
|
|
|
|
output: 'tuhi-gui.devel',
|
2019-07-10 01:51:41 +02:00
|
|
|
configuration: config_tuhigui_devel)
|
|
|
|
|
2019-07-18 03:54:03 +02:00
|
|
|
configure_file(input: 'tuhi-server.py',
|
|
|
|
output: 'tuhi-server',
|
|
|
|
copy: true,
|
2019-07-18 03:48:05 +02:00
|
|
|
install_dir: libexecdir)
|
2019-07-18 03:54:03 +02:00
|
|
|
|
2019-07-10 01:51:41 +02:00
|
|
|
meson.add_install_script('meson_install.sh')
|
|
|
|
|
2019-07-17 13:10:36 +02:00
|
|
|
desktop_file = i18n.merge_file(input: 'tuhigui/data/org.freedesktop.Tuhi.desktop.in',
|
|
|
|
output: 'org.freedesktop.Tuhi.desktop',
|
2019-07-11 04:11:55 +02:00
|
|
|
type: 'desktop',
|
|
|
|
po_dir: podir,
|
|
|
|
install: true,
|
|
|
|
install_dir: desktopdir)
|
|
|
|
|
|
|
|
conf = configuration_data()
|
|
|
|
conf.set('version', meson.project_version())
|
2019-07-17 13:10:36 +02:00
|
|
|
conf.set('url', 'https://github.com/tuhiproject/tuhi')
|
2019-07-11 04:11:55 +02:00
|
|
|
conf.set('version_date', version_date)
|
|
|
|
|
2019-07-17 13:10:36 +02:00
|
|
|
appdata_intl = configure_file(input: 'tuhigui/data/org.freedesktop.Tuhi.appdata.xml.in.in',
|
|
|
|
output: 'org.freedesktop.Tuhi.appdata.xml.in',
|
2019-07-11 04:11:55 +02:00
|
|
|
configuration: conf)
|
|
|
|
|
|
|
|
appdata = i18n.merge_file(input: appdata_intl,
|
2019-07-17 13:10:36 +02:00
|
|
|
output: 'org.freedesktop.Tuhi.appdata.xml',
|
2019-07-11 04:11:55 +02:00
|
|
|
type: 'xml',
|
|
|
|
po_dir: podir,
|
|
|
|
install: true,
|
|
|
|
install_dir: metainfodir)
|
|
|
|
|
2019-07-17 13:10:36 +02:00
|
|
|
install_data('tuhigui/data/org.freedesktop.Tuhi.svg', install_dir: icondir)
|
2019-07-10 01:51:41 +02:00
|
|
|
|
|
|
|
flake8 = find_program('flake8-3', required: false)
|
|
|
|
if flake8.found()
|
|
|
|
test('flake8', flake8,
|
|
|
|
args: ['--ignore=E501,W504',
|
|
|
|
join_paths(meson.source_root(), 'tuhigui/')])
|
|
|
|
endif
|
2019-07-11 04:11:55 +02:00
|
|
|
|
|
|
|
desktop_validate = find_program('desktop-file-validate', required: false)
|
|
|
|
if desktop_validate.found()
|
|
|
|
test('desktop-file-validate', desktop_validate, args: [desktop_file])
|
|
|
|
endif
|
|
|
|
|
|
|
|
appstream_util = find_program('appstream-util', required: false)
|
|
|
|
if appstream_util.found()
|
|
|
|
test('appstream-util validate-relax', appstream_util,
|
|
|
|
args: ['validate-relax', appdata])
|
|
|
|
endif
|
2019-07-16 14:10:09 +02:00
|
|
|
|
|
|
|
# A wrapper to start tuhi at the same time as tuhigui, used by the flatpak
|
|
|
|
configure_file(input: 'tools/tuhi-gui-flatpak.py',
|
|
|
|
output: 'tuhi-gui-flatpak.py',
|
|
|
|
copy: true)
|