Add meson build system

This commit is contained in:
Romain Failliot 2020-08-11 13:27:23 -04:00
parent f9a6bd1094
commit b12f4612a5
7 changed files with 86 additions and 2 deletions

View File

@ -0,0 +1,15 @@
#!/usr/bin/env python3
import sysconfig
from compileall import compile_dir
from os import environ, path
from subprocess import call
prefix = environ.get('MESON_INSTALL_PREFIX', '/usr/local')
datadir = path.join(prefix, 'share')
destdir = environ.get('DESTDIR', '')
# Package managers set this so we don't need to run
if not destdir:
print('Updating icon cache...')
call(['gtk-update-icon-cache', '-qtf', path.join(datadir, 'icons', 'hicolor')])

28
meson.build Normal file
View File

@ -0,0 +1,28 @@
project('diffuse',
version: '0.6.0',
meson_version: '>= 0.50',
license: 'GPL-2.0-or-later')
i18n = import('i18n')
python = import('python')
py_installation = python.find_installation('python3')
find_program('gtk-update-icon-cache', required: false)
prefix = get_option('prefix')
bindir = prefix / get_option('bindir')
datadir = prefix / get_option('datadir')
localedir = prefix / get_option('localedir')
libexecdir = prefix / get_option('libexecdir')
sysconfdir = prefix / get_option('sysconfdir')
pythondir = py_installation.get_path('purelib')
pkgdatadir = join_paths(datadir, meson.project_name())
podir = join_paths(meson.source_root(), 'translations')
subdir('translations')
subdir('src')
meson.add_install_script('build-scripts/meson-postinstall.py')

View File

@ -2,4 +2,4 @@
#
# Copyright (C) 2006-2009 Derrick Moser <derrick_moser@yahoo.com>
import ../usr/share/diffuse/syntax/*.syntax
import @PKGDATADIR@/syntax/*.syntax

26
src/meson.build Normal file
View File

@ -0,0 +1,26 @@
# Diffuse binary file
diffuse_conf = configuration_data()
diffuse_conf.set('SYSCONFIGDIR', sysconfdir)
configure_file(
input: 'usr/bin/diffuse.py.in',
output: 'diffuse',
configuration: diffuse_conf,
install: true,
install_dir: bindir
)
# Diffuse config file
diffuserc_conf = configuration_data()
diffuserc_conf.set('PKGDATADIR', pkgdatadir)
configure_file(
input: 'etc/diffuserc.py.in',
output: 'diffuserc',
configuration: diffuserc_conf,
install: true,
install_dir: sysconfdir
)
# Data files
install_subdir('usr/share', install_dir: datadir, strip_directory: true)

View File

@ -8345,7 +8345,7 @@ if __name__ == '__main__':
if isWindows():
rc_file = os.path.join(bin_dir, 'diffuserc')
else:
rc_file = os.path.join(bin_dir, '../../etc/diffuserc')
rc_file = os.path.join(bin_dir, '@SYSCONFIGDIR@/diffuserc')
for rc_file in rc_file, os.path.join(rc_dir, 'diffuserc'):
if os.path.isfile(rc_file):
rc_files.append(rc_file)

14
translations/LINGUAS Normal file
View File

@ -0,0 +1,14 @@
# Please keep this list sorted alphabetically
cs
de
es
it
ja
ko
pl
pt
ru
sv
th
zh_CN
zh_TW

1
translations/meson.build Normal file
View File

@ -0,0 +1 @@
i18n.gettext(meson.project_name(), preset: 'glib')