Commit 3e28b245 authored by Oliver Galvin's avatar Oliver Galvin Committed by Guido Gunther
Browse files

meson: Tidy build files. Use / operator (added in Meson 0.49.0) instead of...

meson: Tidy build files. Use / operator (added in Meson 0.49.0) instead of join_paths. Use package_api_name variable to avoid repetition.
parent cc2d6e9b
......@@ -38,15 +38,15 @@ content_files = [
'visual-index.xml',
]
glib_prefix = dependency('glib-2.0').get_pkgconfig_variable('prefix')
glib_docpath = join_paths(glib_prefix, 'share', 'gtk-doc', 'html')
docpath = join_paths(get_option('datadir'), 'gtk-doc', 'html')
glib_prefix = dependency('glib-2.0').get_pkgconfig_variable('prefix')
glib_docpath = glib_prefix / 'share' / 'gtk-doc' / 'html'
docpath = get_option('datadir') / 'gtk-doc' / 'html'
gnome.gtkdoc('libhandy',
main_xml: 'handy-docs.xml',
src_dir: [
join_paths(meson.source_root(), 'src'),
join_paths(meson.build_root(), 'src'),
meson.source_root() / 'src',
meson.build_root() / 'src',
],
dependencies: libhandy_dep,
gobject_typesfile: 'libhandy.types',
......@@ -56,11 +56,11 @@ gnome.gtkdoc('libhandy',
],
fixxref_args: [
'--html-dir=@0@'.format(docpath),
'--extra-dir=@0@'.format(join_paths(glib_docpath, 'glib')),
'--extra-dir=@0@'.format(join_paths(glib_docpath, 'gobject')),
'--extra-dir=@0@'.format(join_paths(glib_docpath, 'gio')),
'--extra-dir=@0@'.format(join_paths(glib_docpath, 'gi')),
'--extra-dir=@0@'.format(join_paths(glib_docpath, 'gtk3')),
'--extra-dir=@0@'.format(glib_docpath / 'glib'),
'--extra-dir=@0@'.format(glib_docpath / 'gobject'),
'--extra-dir=@0@'.format(glib_docpath / 'gio'),
'--extra-dir=@0@'.format(glib_docpath / 'gi'),
'--extra-dir=@0@'.format(glib_docpath / 'gtk3'),
],
install_dir: 'libhandy',
content_files: content_files,
......
......@@ -6,4 +6,4 @@
<!ENTITY package_url "@PACKAGE_URL@">
<!ENTITY package_version "@PACKAGE_VERSION@">
<!ENTITY package_api_version "@PACKAGE_API_VERSION@">
<!ENTITY package_ver_str "@PACKAGE_STRING@-@PACKAGE_API_VERSION@">
<!ENTITY package_ver_str "@PACKAGE_API_NAME@">
......@@ -7,5 +7,6 @@ ent_conf.set('PACKAGE_TARNAME', 'libhandy-' + meson.project_version())
ent_conf.set('PACKAGE_URL', 'https://source.puri.sm/Librem5/libhandy')
ent_conf.set('PACKAGE_VERSION', meson.project_version())
ent_conf.set('PACKAGE_API_VERSION', apiversion)
ent_conf.set('PACKAGE_API_NAME', package_api_name)
configure_file(input: 'gtkdocentities.ent.in', output: 'gtkdocentities.ent', configuration: ent_conf)
......@@ -4,15 +4,15 @@ if glade_catalog
# https://gitlab.gnome.org/GNOME/glade/issues/379
is_flatpak_app = get_option('prefix') == '/app'
glade_xml = 'libhandy.xml'
glade_xml = 'libhandy.xml'
if (is_flatpak_app)
module_dir = join_paths(libdir, 'glade', 'modules')
module_dir = libdir / 'glade' / 'modules'
else
module_dir = gladeui_dep.get_pkgconfig_variable('moduledir')
module_dir = gladeui_dep.get_pkgconfig_variable('moduledir')
endif
dtd = join_paths(meson.current_source_dir(), 'glade-catalog.dtd')
dtd = meson.current_source_dir() / 'glade-catalog.dtd'
if (is_flatpak_app)
glade_catalogdir = join_paths(datadir, 'glade', 'catalogs')
glade_catalogdir = datadir / 'glade' / 'catalogs'
else
glade_catalogdir = gladeui_dep.get_pkgconfig_variable('catalogdir')
endif
......@@ -45,10 +45,10 @@ xmllint = find_program('xmllint', required: true)
if xmllint.found()
custom_target(
'xmllint',
build_by_default: true,
input: glade_xml,
output: 'doesnotexist',
command: [xmllint, '--dtdvalid', dtd, '--noout', '@INPUT@'],
build_by_default: true,
input: glade_xml,
output: 'doesnotexist',
command: [xmllint, '--dtdvalid', dtd, '--noout', '@INPUT@'],
)
endif
......
......@@ -12,6 +12,7 @@ handy_version_micro = version_arr[2].to_int()
apiversion = '0.0'
soversion = 0
package_api_name = '@0@-@1@'.format(meson.project_name(), apiversion)
if handy_version_minor.is_odd()
handy_interface_age = 0
......@@ -28,10 +29,10 @@ libversion = '@0@.@1@.@2@'.format(soversion, current, revision)
config_h = configuration_data()
config_h.set_quoted('GETTEXT_PACKAGE', 'libhandy')
config_h.set_quoted('LOCALEDIR', join_paths(get_option('prefix'), get_option('localedir')))
config_h.set_quoted('LOCALEDIR', get_option('prefix') / get_option('localedir'))
configure_file(
output: 'config.h',
output: 'config.h',
configuration: config_h,
)
......@@ -109,14 +110,14 @@ add_project_arguments(
# Setup various paths that subdirectory meson.build files need
package_subdir = get_option('package_subdir') # When used as subproject
datadir = join_paths(get_option('datadir'), package_subdir)
libdir = join_paths(get_option('libdir'), package_subdir)
girdir = join_paths(get_option('datadir'), package_subdir, 'gir-1.0')
typelibdir = join_paths(get_option('libdir'), package_subdir, 'girepository-1.0')
datadir = get_option('datadir') / package_subdir
libdir = get_option('libdir') / package_subdir
girdir = get_option('datadir') / package_subdir / 'gir-1.0'
typelibdir = get_option('libdir') / package_subdir / 'girepository-1.0'
if package_subdir != ''
vapidir = join_paths(get_option('datadir'), package_subdir, 'vapi')
vapidir = get_option('datadir') / package_subdir / 'vapi'
else
vapidir = join_paths(get_option('datadir'), 'vala', 'vapi')
vapidir = get_option('datadir') / 'vala' / 'vapi'
endif
static = get_option('static')
......@@ -149,8 +150,8 @@ run_data = configuration_data()
run_data.set('ABS_BUILDDIR', meson.current_build_dir())
run_data.set('ABS_SRCDIR', meson.current_source_dir())
configure_file(
input: 'run.in',
output: 'run',
input: 'run.in',
output: 'run',
configuration: run_data)
summary = [
......
libhandy_header_subdir = join_paths(package_subdir, 'libhandy-' + apiversion)
libhandy_header_dir = join_paths(get_option('includedir'), libhandy_header_subdir)
libhandy_header_subdir = package_subdir / package_api_name
libhandy_header_dir = get_option('includedir') / libhandy_header_subdir
libhandy_resources = gnome.compile_resources(
'hdy-resources',
'handy.gresources.xml',
......@@ -100,9 +100,9 @@ sed = find_program('sed', required: true)
gen_public_types = find_program('gen-public-types.sh', required: true)
libhandy_init_public_types = custom_target('hdy-public-types.c',
output : 'hdy-public-types.c',
input : [src_headers, libhandy_generated_headers],
command : [gen_public_types, '@INPUT@'],
output: 'hdy-public-types.c',
input: [src_headers, libhandy_generated_headers],
command: [gen_public_types, '@INPUT@'],
capture: true,
)
......@@ -206,7 +206,7 @@ libhandy = build_target(
'handy-' + apiversion,
libhandy_sources,
soversion: 0,
soversion: soversion,
c_args: libhandy_c_args,
dependencies: libhandy_deps,
include_directories: [ root_inc, src_inc ],
......@@ -235,7 +235,7 @@ if introspection
sources: libhandy_generated_headers + libhandy_public_headers + libhandy_public_sources,
nsversion: apiversion,
namespace: 'Handy',
export_packages: 'libhandy-@0@'.format(apiversion),
export_packages: package_api_name,
symbol_prefix: 'hdy',
identifier_prefix: 'Hdy',
link_with: libhandy,
......@@ -248,7 +248,7 @@ if introspection
if get_option('vapi')
libhandy_vapi = gnome.generate_vapi('libhandy-' + apiversion,
libhandy_vapi = gnome.generate_vapi(package_api_name,
sources: libhandy_gir[0],
packages: [ 'gio-2.0', 'gtk+-3.0' ],
install: true,
......@@ -267,9 +267,9 @@ if installable
subdirs: libhandy_header_subdir,
version: meson.project_version(),
name: 'Handy',
filebase: 'libhandy-@0@'.format(apiversion),
filebase: package_api_name,
description: 'Handy Mobile widgets',
requires: 'gtk+-3.0',
install_dir: join_paths(libdir, 'pkgconfig'),
install_dir: libdir / 'pkgconfig',
)
endif
......@@ -45,10 +45,10 @@ test_names = [
foreach test_name : test_names
t = executable(test_name, [test_name + '.c'] + libhandy_generated_headers,
c_args: test_cflags,
link_args: test_link_args,
c_args: test_cflags,
link_args: test_link_args,
dependencies: libhandy_deps + [libhandy_dep],
pie: true,
pie: true,
)
test(test_name, t, env: test_env)
endforeach
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment