Commit 1ef2fb92 authored by Sam Thursfield's avatar Sam Thursfield

Fixes to Meson build system

First, instead of using add_global_arguments() we now use a variable
to set global compiler args. It turns out that add_global_arguments()
is broken if you ever want to include your project as a subproject of
something else.

Second, dependencies weren't being specified correctly. These are
hopefully now fixed to avoid any more random build failures.
parent 902f0d8e
......@@ -461,10 +461,17 @@ configure_file(input: 'config.h.meson.in',
output: 'config.h',
configuration: conf)
# Needed for O_NOATIME, and probably other stuff.
add_global_arguments('-D_GNU_SOURCE', language: 'c')
# Needed for statvfs64, and probably other stuff
add_global_arguments('-D_LARGEFILE64_SOURCE', language: 'c')
# Global compiler defines. We avoid add_global_arguments() as it breaks
# when we are included by another project as a subproject.
tracker_c_args = [
# Needed for O_NOATIME, and probably other stuff.
'-D_GNU_SOURCE',
# Needed for statvfs64, and probably other stuff
'-D_LARGEFILE64_SOURCE',
'-DTRACKER_COMPILATION'
]
have_tracker_miner_fs = true
have_tracker_miner_apps = true
......
......@@ -4,9 +4,8 @@ libtracker_bus = static_library('tracker-bus',
'tracker-array-cursor.vala',
'tracker-bus-fd-cursor.vala',
'../libtracker-common/libtracker-common.vapi',
c_args: [
'-DTRACKER_COMPILATION',
],
tracker_common_enum_header, tracker_common_parser_sha1_header,
c_args: tracker_c_args,
vala_args: [
'--debug',
'--pkg', 'posix',
......@@ -19,7 +18,6 @@ libtracker_bus = static_library('tracker-bus',
dependencies: [glib, gio, gio_unix, tracker_sparql_intermediate_dep],
include_directories: [commoninc, configinc, srcinc],
link_with: libtracker_common,
sources: tracker_common_enum_header,
)
tracker_sparql_bus_dep = declare_dependency(
......
......@@ -6,13 +6,13 @@ enums = gnome.mkenums('tracker-enum-types',
h_template: 'tracker-enum-types.h.template',
)
tracker_common_enum_header = enums[1]
parser_sha1_header = configure_file(
tracker_common_parser_sha1_header = configure_file(
input: 'tracker-parser-sha1.h.in',
output: 'tracker-parser-sha1.h',
command: ['generate-tracker-parser-sha1-header.sh'])
tracker_common_enum_header = enums[1]
tracker_common_sources = [
'tracker-date-time.c',
'tracker-dbus.c',
......@@ -27,7 +27,7 @@ tracker_common_sources = [
'tracker-language.c',
'tracker-seccomp.c',
enums[0], enums[1],
parser_sha1_header,
tracker_common_parser_sha1_header,
]
if unicode_library_name == 'icu'
......@@ -42,9 +42,7 @@ tracker_common_dependencies = [glib, gio, gio_unix, libmath]
libtracker_common = library('tracker-common',
tracker_common_sources,
dependencies: tracker_common_dependencies + [unicode_library],
c_args: [
'-DTRACKER_COMPILATION',
],
c_args: tracker_c_args,
include_directories: [configinc, srcinc],
install: true,
install_dir: tracker_internal_libs_dir,
......@@ -62,7 +60,7 @@ commoninc = include_directories('.')
#
# Upstream issue: https://github.com/mesonbuild/meson/issues/671
tracker_common_dep = declare_dependency(
sources: enums[1],
sources: [tracker_common_enum_header, tracker_common_parser_sha1_header],
link_with: libtracker_common,
dependencies: tracker_common_dependencies,
include_directories: [configinc, srcinc, commoninc],
......
......@@ -4,7 +4,8 @@ headers = ['tracker-control.h', 'tracker-miner-manager.h']
libtracker_control = library('tracker-control-' + tracker_api_version,
sources,
c_args: '-DTRACKER_COMPILATION',
tracker_common_enum_header, tracker_common_parser_sha1_header,
c_args: tracker_c_args,
install: true,
install_rpath: tracker_internal_libs_dir,
# This doesn't depend on tracker_common_dep because of
......@@ -12,7 +13,6 @@ libtracker_control = library('tracker-control-' + tracker_api_version,
dependencies: [gio, tracker_sparql_dep, tracker_miner_dep],
include_directories: [commoninc, configinc, srcinc],
link_with: libtracker_common,
sources: tracker_common_enum_header,
)
tracker_control_dep = declare_dependency(
......
......@@ -10,9 +10,8 @@ libtracker_data_vala = static_library('tracker-sparql-query',
'tracker-turtle-reader.vala',
'../libtracker-common/libtracker-common.vapi',
'../libtracker-data/libtracker-data.vapi',
c_args: [
'-DTRACKER_COMPILATION',
],
tracker_common_enum_header, tracker_common_parser_sha1_header,
c_args: tracker_c_args,
vala_args: [
'--debug',
'--pkg', 'posix',
......@@ -24,7 +23,6 @@ libtracker_data_vala = static_library('tracker-sparql-query',
# https://github.com/mesonbuild/meson/issues/671
dependencies: [glib, gio, tracker_sparql_intermediate_dep],
include_directories: [commoninc, configinc, srcinc],
sources: tracker_common_enum_header,
)
tracker_data_dependencies = [
......@@ -35,7 +33,6 @@ if get_option('fts')
tracker_data_dependencies += tracker_fts_dep
endif
#[gio_unix, glib, libmath, sqlite, uuid]
libtracker_data = library('tracker-data',
'tracker-class.c',
'tracker-collation.c',
......@@ -54,9 +51,8 @@ libtracker_data = library('tracker-data',
'tracker-ontology.c',
'tracker-ontologies.c',
'tracker-property.c',
c_args: [
'-DTRACKER_COMPILATION',
],
tracker_common_enum_header, tracker_common_parser_sha1_header,
c_args: tracker_c_args,
install: true,
install_dir: tracker_internal_libs_dir,
# This doesn't depend on tracker_common_dep because of
......@@ -69,5 +65,6 @@ libtracker_data = library('tracker-data',
tracker_data_dep = declare_dependency(
link_with: [libtracker_data, libtracker_data_vala],
dependencies: tracker_data_dependencies,
include_directories: include_directories('.')
include_directories: include_directories('.'),
source: enums[1],
)
......@@ -3,9 +3,7 @@ libtracker_direct = static_library('tracker-direct',
'tracker-namespace.vala',
'../libtracker-common/libtracker-common.vapi',
'../libtracker-data/libtracker-data.vapi',
c_args: [
'-DTRACKER_COMPILATION',
],
c_args: tracker_c_args,
vala_args: [
'--debug',
'--pkg', 'posix',
......
......@@ -33,8 +33,7 @@ endif
libtracker_extract = library('tracker-extract',
libtracker_extract_sources,
dependencies: [tracker_common_dep, tracker_sparql_dep] + tracker_extract_dependencies,
c_args: [
'-DTRACKER_COMPILATION',
c_args: tracker_c_args + [
'-DTRACKER_EXTRACTOR_RULES_DIR="@0@"'.format(tracker_extract_rules_dir),
'-DTRACKER_EXTRACTORS_DIR="@0@"'.format(tracker_extract_modules_dir)
],
......
......@@ -11,10 +11,8 @@ libtracker_fts = static_library('libtracker-fts',
'tracker-fts-config.c',
'tracker-fts-tokenizer.c',
libtracker_fts_fts5,
dependencies: tracker_common_dep,
c_args: [
'-DTRACKER_COMPILATION',
],
dependencies: [tracker_common_dep, tracker_sparql_intermediate_dep],
c_args: tracker_c_args
)
tracker_fts_dep = declare_dependency(
......
......@@ -54,9 +54,7 @@ libtracker_miner_private = static_library(
'tracker-miner-private',
miner_enums[0], miner_enums[1], private_sources,
dependencies: [tracker_common_dep, tracker_sparql_dep],
c_args: [
'-DTRACKER_COMPILATION',
],
c_args: tracker_c_args,
)
tracker_miner_dependencies = []
......@@ -67,7 +65,7 @@ endif
libtracker_miner = library(
'tracker-miner-' + tracker_api_version,
miner_enums[0], miner_enums[1], miner_sources,
c_args: [ '-DTRACKER_COMPILATION', ],
c_args: tracker_c_args,
install: true,
install_rpath: tracker_internal_libs_dir,
# This doesn't depend on tracker_common_dep because of
......@@ -93,9 +91,8 @@ tracker_miner_gir = gnome.generate_gir(libtracker_miner,
# but we can't currently access that from the Vala target
includes : ['GLib-2.0', 'GObject-2.0', 'Gio-2.0' ],
install: true,
extra_args: [
extra_args: tracker_c_args + [
'--c-include=libtracker-miner/tracker-miner.h',
'-D', 'TRACKER_COMPILATION',
])
configure_file(
......
......@@ -9,9 +9,7 @@ sources = [
libtracker_remote = static_library('tracker-remote', sources,
dependencies: tracker_remote_dependencies + [tracker_common_dep, tracker_sparql_intermediate_dep],
c_args: [
'-DTRACKER_COMPILATION',
],
c_args: tracker_c_args,
vala_args: [
'--debug',
'--pkg', 'posix',
......
......@@ -2,6 +2,7 @@ libtracker_sparql = library('tracker-sparql-' + tracker_api_version,
'tracker-backend.vala',
install: true,
install_rpath: tracker_internal_libs_dir,
c_args: tracker_c_args,
dependencies: [tracker_sparql_intermediate_dep, tracker_sparql_remote_dep, tracker_sparql_bus_dep, tracker_sparql_direct_dep],
)
......
......@@ -22,7 +22,7 @@ libtracker_sparql_intermediate = static_library('tracker-sparql',
'tracker-uri.c',
'tracker-version.c',
vala_header: 'tracker-generated-no-checks.h',
c_args: [ '-DTRACKER_COMPILATION', ],
c_args: tracker_c_args,
# FIXME: getting Vala to output the GIR means that the symbols from the
# C files aren't included. This problem seems to affect the Autotools
# build system as well.
......
......@@ -5,7 +5,7 @@ sources = [
executable('tracker-miner-apps', sources,
dependencies: [tracker_common_dep, tracker_miner_dep, tracker_sparql_dep],
c_args: [ '-DTRACKER_COMPILATION', ],
c_args: tracker_c_args,
install: true,
install_dir: get_option('libexecdir'),
install_rpath: tracker_internal_libs_dir,
......
......@@ -19,9 +19,7 @@ endif
executable('tracker-miner-fs', sources,
dependencies: [tracker_common_dep, tracker_miner_dep, tracker_extract_dep],
c_args: [
'-DTRACKER_COMPILATION',
],
c_args: tracker_c_args,
install: true,
install_dir: get_option('libexecdir'),
install_rpath: tracker_internal_libs_dir,
......
......@@ -5,7 +5,7 @@ sources = [
executable('tracker-miner-rss', sources,
dependencies: [libgrss, tracker_common_dep, tracker_miner_dep, tracker_extract_dep],
c_args: [ '-DTRACKER_COMPILATION', ],
c_args: tracker_c_args,
install_rpath: tracker_internal_libs_dir,
)
......
......@@ -117,7 +117,7 @@ foreach module : modules
dependencies = module[3]
shared_module(name, sources,
c_args: [ '-DTRACKER_COMPILATION' ],
c_args: tracker_c_args,
dependencies: [tracker_extract_dep] + dependencies,
include_directories: configinc,
install: true,
......@@ -155,7 +155,8 @@ endif
executable('tracker-extract',
tracker_extract_sources,
c_args: [ '-DTRACKER_COMPILATION' ],
# Manually add the root dir to work around https://github.com/mesonbuild/meson/issues/1387
c_args: tracker_c_args + ['-I' + meson.build_root()],
dependencies: tracker_extract_dependencies,
install: true,
install_dir: join_paths(get_option('prefix'), get_option('libexecdir')))
......
......@@ -4,10 +4,9 @@ executable(
'tracker-preferences.vala',
'../miners/fs/tracker-config.c',
dependencies: [tracker_common_dep, tracker_sparql_dep, gmodule, gtk3],
c_args: [
c_args: tracker_c_args + [
'-D_XOPEN_SOURCE',
'-D_XOPEN_SOURCE_EXTENDED',
'-DTRACKER_COMPILATION',
'-include', 'config.h'
],
vala_args: [
......
......@@ -20,8 +20,7 @@ tracker_store_sources = [
executable('tracker-store',
tracker_store_sources,
c_args: [
'-DTRACKER_COMPILATION',
c_args: tracker_c_args + [
'-include', 'config.h'
],
vala_args: [ '--pkg', 'posix' ],
......
......@@ -20,7 +20,7 @@ foreach module : modules
dependencies = module[2]
shared_module(name, sources,
c_args: [ '-DTRACKER_COMPILATION' ],
c_args: tracker_c_args,
dependencies: dependencies,
include_directories: configinc,
install: true,
......@@ -41,8 +41,7 @@ tracker_writeback_sources = [
executable('tracker-writeback',
tracker_writeback_sources,
c_args: [
'-DTRACKER_COMPILATION',
c_args: tracker_c_args + [
'-DWRITEBACK_MODULES_DIR="@0@"'.format(tracker_writeback_modules_dir),
],
dependencies: [gmodule, tracker_common_dep, tracker_miner_dep, tracker_sparql_dep],
......
......@@ -17,11 +17,10 @@ sources = [
]
executable('tracker', sources,
c_args: [
c_args: tracker_c_args + [
'-DLIBEXECDIR="@0@"'.format(join_paths(get_option('prefix'), get_option('libexecdir'))),
'-DMANDIR="@0@"'.format(join_paths(get_option('prefix'), get_option('datadir'), 'man')),
'-DTRACKER_EXTRACTOR_RULES_DIR="@0@"'.format(tracker_extract_rules_dir),
'-DTRACKER_COMPILATION',
],
install: true,
install_rpath: tracker_internal_libs_dir,
......
test_c_args = [
'-DTRACKER_COMPILATION',
test_c_args = tracker_c_args + [
'-DTOP_BUILDDIR="@0@"'.format(meson.build_root()),
'-DTOP_SRCDIR="@0@"'.format(meson.source_root()),
]
......
test_c_args = [
'-DTRACKER_COMPILATION',
test_c_args = tracker_c_args + [
'-DTOP_BUILDDIR="@0@"'.format(meson.build_root()),
'-DTOP_SRCDIR="@0@"'.format(meson.source_root()),
]
......
test_c_args = [
'-DTRACKER_COMPILATION',
test_c_args = tracker_c_args + [
'-DTOP_BUILDDIR="@0@/"'.format(meson.build_root()),
'-DTOP_SRCDIR="@0@/"'.format(meson.source_root()),
]
......
test_c_args = [
'-DTRACKER_COMPILATION',
test_c_args = tracker_c_args + [
'-DTOP_BUILDDIR="@0@/"'.format(meson.build_root()),
'-DTOP_SRCDIR="@0@/"'.format(meson.source_root()),
]
......
test_c_args = ['-DTRACKER_COMPILATION']
resource_test = executable('tracker-resource-test',
'tracker-resource-test.c',
dependencies: [tracker_common_dep, tracker_sparql_dep],
c_args: test_c_args)
c_args: tracker_c_args)
test('sparql-resource', resource_test)
sparql_test = executable('tracker-sparql-test',
'tracker-sparql-test.c',
dependencies: [tracker_common_dep, tracker_sparql_dep],
c_args: test_c_args)
c_args: tracker_c_args)
test('sparql', sparql_test)
gb_737023_test = executable('tracker-gb-737023-test',
'tracker-gb-737023.c',
dependencies: [tracker_common_dep, tracker_sparql_dep],
c_args: test_c_args)
c_args: tracker_c_args)
test('gb_737023', sparql_test)
test_c_args = ['-DTRACKER_COMPILATION']
steroids_test = executable('tracker-steroids-test',
'tracker-test.c',
dependencies: [tracker_common_dep, tracker_sparql_dep],
c_args: test_c_args)
c_args: tracker_c_args)
test('steroids', steroids_test)
executable('data-validator', 'data-validator.c',
dependencies: [tracker_common_dep, tracker_data_dep, tracker_sparql_dep],
c_args: ['-DTRACKER_COMPILATION'])
c_args: tracker_c_args)
executable('ontology-validator', 'ontology-validator.c',
dependencies: [tracker_common_dep, tracker_data_dep, tracker_sparql_dep],
c_args: ['-DTRACKER_COMPILATION'])
c_args: tracker_c_args)
Markdown is supported
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