Skip to content

Commit

Permalink
Update Meson Files (#701)
Browse files Browse the repository at this point in the history
  • Loading branch information
Marukesu authored Feb 9, 2023
1 parent 7f41498 commit df0c9af
Show file tree
Hide file tree
Showing 8 changed files with 126 additions and 105 deletions.
2 changes: 1 addition & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ end_of_line = lf
indent_size = tab
indent_style = space
insert_final_newline = true
max_line_length = 80
max_line_length = 120
tab_width = 4

[{*.xml,*.xml.in,*.yml}]
Expand Down
14 changes: 7 additions & 7 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ on:
jobs:
build:
runs-on: ubuntu-latest

container:
image: elementary/docker:unstable
image: elementary/docker:next-unstable

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Install Dependencies
run: |
apt update
Expand All @@ -28,11 +28,11 @@ jobs:
lint:
runs-on: ubuntu-latest

container:
image: valalang/lint

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Lint
run: io.elementary.vala-lint -d .
66 changes: 36 additions & 30 deletions data/meson.build
Original file line number Diff line number Diff line change
@@ -1,52 +1,58 @@
install_data(
meson.project_name() + '.gschema.xml',
install_dir: join_paths(get_option('datadir'), 'glib-2.0', 'schemas')
)
datadir = get_option('prefix') / get_option('datadir')
podir = meson.project_source_root() / 'po'

i18n.merge_file (
i18n.merge_file(
type: 'desktop',
input: meson.project_name() + '.desktop.in',
output: meson.project_name() + '.desktop',
output: '@BASENAME@',
po_dir: podir / 'extra',
install: true,
install_dir: join_paths(get_option('datadir'), 'applications'),
po_dir: join_paths(meson.source_root (), 'po', 'extra'),
type: 'desktop'
install_dir: datadir / 'applications'
)

i18n.merge_file (
i18n.merge_file(
type: 'desktop',
input: 'open-pantheon-terminal-here.desktop.in',
output: 'open-pantheon-terminal-here.desktop',
output: '@BASENAME@',
po_dir: podir / 'extra',
install: true,
install_dir: join_paths(get_option('datadir'), 'applications'),
po_dir: join_paths(meson.source_root (), 'po', 'extra'),
type: 'desktop'
install_dir: datadir / 'applications'
)

i18n.merge_file (
i18n.merge_file(
input: meson.project_name() + '.appdata.xml.in',
output: meson.project_name() + '.appdata.xml',
output: '@BASENAME@',
po_dir: podir / 'extra',
install: true,
install_dir: join_paths(get_option('datadir'), 'metainfo'),
po_dir: join_paths(meson.source_root (), 'po', 'extra')
)

test (
'Validate desktop file',
find_program('desktop-file-validate'),
args: join_paths(meson.current_build_dir (), meson.project_name() + '.desktop')
install_dir: datadir / 'metainfo'
)

test (
'Validate open here desktop file',
find_program('desktop-file-validate'),
args: join_paths(meson.current_build_dir (), 'open-pantheon-terminal-here.desktop')
install_data(
meson.project_name() + '.gschema.xml',
install_dir: datadir / 'glib-2.0' / 'schemas'
)

install_data(
'pantheon_terminal_process_completion_notifications.fish',
install_dir: join_paths(get_option('datadir'), 'fish', 'vendor_conf.d')
install_dir: datadir / 'fish' / 'vendor_conf.d'
)

install_data(
'enable-zsh-completion-notifications',
install_dir: join_paths(get_option('datadir'), meson.project_name())
install_dir: datadir / meson.project_name()
)

terminal_gresource = gnome.compile_resources('gresource', meson.project_name() + '.gresource.xml')

desktop_file_validate = find_program('desktop-file-validate', required: false)
if desktop_file_validate.found()
test(
'Validate desktop file', desktop_file_validate,
args: meson.current_build_dir() / meson.project_name() + '.desktop'
)

test(
'Validate open here desktop file', desktop_file_validate,
args: meson.current_build_dir() / 'open-pantheon-terminal-here.desktop'
)
endif
97 changes: 36 additions & 61 deletions meson.build
Original file line number Diff line number Diff line change
@@ -1,27 +1,43 @@
project(
'io.elementary.terminal',
'vala', 'c',
version: '6.1.1'
version: '6.1.1',
meson_version: '>=0.58'
)

if meson.get_compiler('vala').version().version_compare('<0.40')
valac = meson.get_compiler('vala')
cc = meson.get_compiler('c')

if valac.version().version_compare('<0.40')
error('Missing required dependency: valac >= 0.40')
endif

gnome = import('gnome')
i18n = import('i18n')

add_global_arguments([
'-DGETTEXT_PACKAGE="@0@"'.format(meson.project_name()),
'-DHANDY_USE_UNSTABLE_API'
],
language:'c'
)
glib_version = '>=2.40'

glib_dep = dependency('glib-2.0', version: glib_version)
gobject_dep = dependency('gobject-2.0', version: glib_version)
gio_dep = dependency('gio-2.0', version: glib_version)
gee_dep = dependency('gee-0.8')
gtk_dep = dependency('gtk+-3.0', version: '>=3.24')
granite_dep = dependency('granite', version: '>=6.1')
handy_dep = dependency('libhandy-1', version: '>=0.83')
vte_dep = dependency('vte-2.91', version: '>=0.59')
libpcre2_dep = dependency('libpcre2-8')
glib_dep = dependency('glib-2.0')
linux_dep = meson.get_compiler('vala').find_library('linux', required: false)
pcre2_dep = dependency('libpcre2-8')

posix_dep = valac.find_library('posix')
linux_dep = valac.find_library('linux', required: false)
m_dep = cc.find_library('m', required : false)

conf_data = configuration_data()
conf_data.set_quoted('PROJECT_NAME', meson.project_name())
conf_data.set_quoted('VERSION', meson.project_version())
conf_data.set_quoted('GETTEXT_PACKAGE', meson.project_name())
conf_data.set_quoted('LOCALEDIR', get_option('prefix') / get_option('localedir'))

add_project_arguments('--vapidir', meson.current_source_dir() / 'vapi', language: 'vala')

if glib_dep.version().version_compare('>=2.73.2')
add_project_arguments('--define', 'HAS_GLIB_2_74', language: 'vala')
Expand All @@ -31,57 +47,16 @@ if linux_dep.found()
add_project_arguments('--define', 'HAS_LINUX', language: 'vala')
endif

vapi_dir = meson.current_source_dir() / 'vapi'
add_project_arguments('--vapidir=' + vapi_dir, language: 'vala')
add_project_arguments('-DPCRE2_CODE_UNIT_WIDTH=0', language: 'c')

terminal_resources = gnome.compile_resources(
'terminal-resources', 'data/' + meson.project_name() + '.gresource.xml',
source_dir: 'data'
)

conf_data = configuration_data()
conf_data.set_quoted('PROJECT_NAME', meson.project_name())
conf_data.set_quoted('VERSION', meson.project_version())
conf_data.set_quoted('GETTEXT_PACKAGE', meson.project_name())
conf_data.set_quoted('LOCALEDIR', join_paths(get_option('prefix'), get_option('localedir')))
config_header = configure_file(
input : 'config.vala.in',
output : 'config.vala',
configuration : conf_data
add_project_arguments(
'-DGETTEXT_PACKAGE="@0@"'.format(meson.project_name()),
'-DPCRE2_CODE_UNIT_WIDTH=0',
'-DHANDY_USE_UNSTABLE_API',
language:'c'
)

executable(
meson.project_name(),
config_header,
'src/Application.vala',
'src/DBus.vala',
'src/MainWindow.vala',
'src/Themes.vala',
'src/Dialogs/ForegroundProcessDialog.vala',
'src/Dialogs/UnsafePasteDialog.vala',
'src/Dialogs/ColorPreferencesDialog.vala',
'src/Widgets/SearchToolbar.vala',
'src/Widgets/TerminalWidget.vala',
'src/Utils.vala',
terminal_resources,
dependencies: [
dependency('gee-0.8'),
glib_dep,
dependency('gobject-2.0'),
dependency('gtk+-3.0'),
dependency('granite', version: '>=6.1.0'),
dependency('libhandy-1', version: '>=0.83.0'),
vte_dep,
libpcre2_dep,
meson.get_compiler('vala').find_library('posix'),
linux_dep,
meson.get_compiler('c').find_library('m', required : false)
],
install : true
)
subdir('po')
subdir('po/extra')
subdir('data')
subdir('src')

meson.add_install_script('meson/post_install.py')

subdir('data')
subdir('po')
7 changes: 4 additions & 3 deletions po/extra/meson.build
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
i18n.gettext('extra',
args: '--directory=' + meson.source_root(),
i18n.gettext(
'extra',
args: '--directory=' + meson.project_source_root(),
preset: 'glib',
install: false,
install: false
)
6 changes: 3 additions & 3 deletions po/meson.build
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
i18n.gettext(meson.project_name(),
args: '--directory=' + meson.source_root(),
i18n.gettext(
meson.project_name(),
args: '--directory=' + meson.project_source_root(),
preset: 'glib'
)
subdir('extra')
File renamed without changes.
39 changes: 39 additions & 0 deletions src/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
terminal_deps = [
glib_dep,
gobject_dep,
gio_dep,
gtk_dep,
granite_dep,
handy_dep,
pcre2_dep,
vte_dep,
posix_dep,
linux_dep,
m_dep
]

terminal_sources = [
'Dialogs/ColorPreferencesDialog.vala',
'Dialogs/ForegroundProcessDialog.vala',
'Dialogs/UnsafePasteDialog.vala',
'Widgets/SearchToolbar.vala',
'Widgets/TerminalWidget.vala',
'Application.vala',
'DBus.vala',
'MainWindow.vala',
'Themes.vala',
'Utils.vala',
configure_file(
input: 'config.vala.in',
output: '@BASENAME@',
configuration: conf_data
),
terminal_gresource
]

executable(
meson.project_name(),
terminal_sources,
dependencies: terminal_deps,
install : true
)

0 comments on commit df0c9af

Please sign in to comment.