Skip to content

Commit

Permalink
feat(meson): replace config.h with Build.vala
Browse files Browse the repository at this point in the history
  • Loading branch information
GeopJr committed Feb 4, 2024
1 parent 2b3d97a commit dbf2cbe
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 36 deletions.
35 changes: 15 additions & 20 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -19,28 +19,28 @@ endif
devel = get_option('devel')
distro = get_option('distro')

# Setup configuration file, accessed via vapi/build.vapi
# Setup configuration file
config = configuration_data()
config.set_quoted('EXEC_NAME', meson.project_name())
config.set_quoted('GETTEXT_PACKAGE', meson.project_name())
config.set_quoted('LOCALEDIR', join_paths(get_option('prefix'), get_option('localedir')))
config.set_quoted('DOMAIN', meson.project_name ())
config.set_quoted('G_LOG_DOMAIN', 'Tuba')
config.set_quoted('RESOURCES', '/' + '/'.join(meson.project_name().split('.')) + '/')
config.set_quoted('VERSION', meson.project_version())
config.set_quoted('PREFIX', get_option('prefix'))
config.set_quoted('NAME', 'Tuba')
config.set_quoted('WEBSITE', 'https://github.com/GeopJr/Tuba')
config.set_quoted('SUPPORT_WEBSITE', 'https://github.com/GeopJr/Tuba/issues')
config.set_quoted('PROFILE', devel ? 'development' : 'production')
config.set('EXEC_NAME', meson.project_name())
config.set('GETTEXT_PACKAGE', meson.project_name())
config.set('LOCALEDIR', join_paths(get_option('prefix'), get_option('localedir')))
config.set('DOMAIN', meson.project_name ())
config.set('G_LOG_DOMAIN', 'Tuba')
config.set('RESOURCES', '/' + '/'.join(meson.project_name().split('.')) + '/')
config.set('VERSION', meson.project_version())
config.set('PREFIX', get_option('prefix'))
config.set('NAME', 'Tuba')
config.set('WEBSITE', 'https://github.com/GeopJr/Tuba')
config.set('SUPPORT_WEBSITE', 'https://github.com/GeopJr/Tuba/issues')
config.set('PROFILE', devel ? 'development' : 'production')

if devel
git = find_program('git')
if git.found()
branch = run_command('git', 'branch', '--show-current', check: true).stdout().strip()
revision = run_command('git', 'rev-parse', '--short', 'HEAD', check: true).stdout().strip()
version = '@0@-@1@'.format(branch, revision)
config.set_quoted('VERSION', version)
config.set('VERSION', version)
endif
endif

Expand All @@ -49,10 +49,7 @@ if devmode
add_project_arguments(['--define=DEV_MODE'], language: 'vala')
endif

configure_file(output: 'config.h', configuration: config)

add_project_arguments (
'--include','config.h',
'-DGETTEXT_PACKAGE="@0@"'.format(meson.project_name()),
language: 'c'
)
Expand Down Expand Up @@ -93,9 +90,7 @@ if gtksourceview_dep.version().version_compare('>=5.7.1')
add_project_arguments(['--define=GTKSOURCEVIEW_5_7_1'], language: 'vala')
endif

sources = files(
'vapi/build.vapi',
)
sources = files()
subdir('src')

final_deps = [
Expand Down
14 changes: 14 additions & 0 deletions src/Build.vala.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
namespace Build {
public const string NAME = "@NAME@";
public const string VERSION = "@VERSION@";
public const string DOMAIN = "@DOMAIN@";
public const string RESOURCES = "@RESOURCES@";
public const string PROFILE = "@PROFILE@";

public const string GETTEXT_PACKAGE = "@GETTEXT_PACKAGE@";
public const string LOCALEDIR = "@LOCALEDIR@";

public const string WEBSITE = "@WEBSITE@";
public const string SUPPORT_WEBSITE = "@SUPPORT_WEBSITE@";
public const string PREFIX = "@PREFIX@";
}
10 changes: 9 additions & 1 deletion src/meson.build
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@
sources += files('Application.vala')
sources += configure_file(
input : 'Build.vala.in',
output : 'Build.vala',
configuration : config
)

sources += files(
'Application.vala'
)

subdir('API')
subdir('Dialogs')
Expand Down
15 changes: 0 additions & 15 deletions vapi/build.vapi

This file was deleted.

0 comments on commit dbf2cbe

Please sign in to comment.