Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Meson Files #701

Merged
merged 5 commits into from
Feb 9, 2023
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 .
67 changes: 31 additions & 36 deletions data/meson.build
Original file line number Diff line number Diff line change
@@ -1,52 +1,47 @@
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')
install_dir: datadir / 'metainfo'
)

test (
'Validate desktop file',
find_program('desktop-file-validate'),
args: join_paths(meson.current_build_dir (), meson.project_name() + '.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: datadir / 'fish' / 'vendor_conf.d')
install_data('enable-zsh-completion-notifications', install_dir: datadir / meson.project_name())
Marukesu marked this conversation as resolved.
Show resolved Hide resolved

test (
'Validate open here desktop file',
find_program('desktop-file-validate'),
args: join_paths(meson.current_build_dir (), 'open-pantheon-terminal-here.desktop')
)
terminal_gresource = gnome.compile_resources('gresource', meson.project_name() + '.gresource.xml')

install_data(
'pantheon_terminal_process_completion_notifications.fish',
install_dir: join_paths(get_option('datadir'), 'fish', 'vendor_conf.d')
)
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'
)

install_data(
'enable-zsh-completion-notifications',
install_dir: join_paths(get_option('datadir'), meson.project_name())
)
test(
'Validate open here desktop file', desktop_file_validate,
args: meson.current_build_dir() / 'open-pantheon-terminal-here.desktop'
)
endif
106 changes: 40 additions & 66 deletions meson.build
Original file line number Diff line number Diff line change
@@ -1,27 +1,42 @@
project(
'io.elementary.terminal',
'vala', 'c',
version: '6.1.1'
)
project('io.elementary.terminal', 'vala', 'c', version: '6.1.1', meson_version: '>=0.58')
Marukesu marked this conversation as resolved.
Show resolved Hide resolved

valac = meson.get_compiler('vala')
cc = meson.get_compiler('c')

if meson.get_compiler('vala').version().version_compare('<0.40')
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'
gtk_version = '>-3.24'
granite_version = '>=6.1'
handy_version = '>=0.83'
vte_version = '>=0.59'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a good reason to have these all separated out like this? it seems like it kind of just makes it more complicated and I'm not sure we ever want to re-use these values besides glib_version

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i would say it make more easy to find minimal versions of dependencies, but i can inline the not re-used ones if preferred.


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: gtk_version)
granite_dep = dependency('granite', version: granite_version)
handy_dep = dependency('libhandy-1', version: handy_version)
vte_dep = dependency('vte-2.91', version: vte_version)
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'))

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)
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 +46,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')
6 changes: 1 addition & 5 deletions po/extra/meson.build
Original file line number Diff line number Diff line change
@@ -1,5 +1 @@
i18n.gettext('extra',
args: '--directory=' + meson.source_root(),
preset: 'glib',
install: false,
)
i18n.gettext('extra', args: '--directory=' + meson.project_source_root(), preset: 'glib', install: false)
Marukesu marked this conversation as resolved.
Show resolved Hide resolved
6 changes: 1 addition & 5 deletions po/meson.build
Original file line number Diff line number Diff line change
@@ -1,5 +1 @@
i18n.gettext(meson.project_name(),
args: '--directory=' + meson.source_root(),
preset: 'glib'
)
subdir('extra')
i18n.gettext(meson.project_name(), args: '--directory=' + meson.project_source_root(), preset: 'glib')
File renamed without changes.
30 changes: 30 additions & 0 deletions src/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
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)