Commit 5375bc48 authored by Iñigo Martínez's avatar Iñigo Martínez Committed by Alberto Fanjul

meson: Improved linker flag support checks

Since version 0.46, meson has support for checking support for
linker flags[0].

gitg's linker flag support checking has been improved by using
the provided functions.

[0] http://mesonbuild.com/Release-notes-for-0-46-0.html#new-functions-has_link_argument-and-friends
parent d4b83390
......@@ -75,6 +75,8 @@ cflags = warn_flags + [
'-DGITG_LOCALEDIR="@0@"'.format(gitg_localedir),
]
ldflags = common_ldflags
resources_conf = configuration_data()
resources_conf.set('PLATFORM_NAME', platform_name)
......@@ -137,12 +139,6 @@ executable(
install: true,
)
ldflags = []
if have_version_script
ldflags += '-Wl,--version-script,' + symbol_map
endif
# FIXME: to be tested on win32
if platform_name == 'win32'
win = import('windows')
......@@ -152,7 +148,7 @@ if platform_name == 'win32'
args: ['-O', 'coff'],
)
ldflags += '-mwindows'
ldflags += cc.get_supported_link_arguments('-mwindows')
endif
gitg = shared_library(
......
......@@ -47,12 +47,6 @@ cflags = warn_flags + [
'-DLIBDIR="@0@"'.format(gitg_libdir),
]
ldflags = []
if have_version_script
ldflags += '-Wl,--version-script,' + symbol_map
endif
libgitg_ext = shared_library(
api_name,
sources: sources,
......@@ -64,7 +58,7 @@ libgitg_ext = shared_library(
vala_header: lib_name + '.h',
vala_vapi: lib_api_name + '.vapi',
vala_gir: gir_name,
link_args: ldflags,
link_args: common_ldflags,
link_depends: symbol_map,
install: true,
install_dir: [
......
......@@ -104,13 +104,8 @@ cflags = warn_flags + [
'-DGETTEXT_PACKAGE="@0@"'.format(gitg_gettext),
]
ldflags = []
ldflags = common_ldflags
if have_version_script
ldflags += '-Wl,--version-script,' + symbol_map
endif
test_ldflags = []
if gdk_targets.contains('quartz')
sources += files('gitg-platform-support-osx.c')
gio_system_pkg = 'gio-unix-2.0'
......@@ -120,10 +115,10 @@ if gdk_targets.contains('quartz')
]
cflags += '-xobjective-c'
test_ldflags += [
ldflags += cc.get_supported_link_arguments([
'-framework Foundation',
'-framework AppKit',
]
])
elif gdk_targets.contains('win32')
sources += files('gitg-platform-support-win32.c')
gio_system_pkg = 'gio-windows-2.0'
......@@ -134,12 +129,6 @@ else
deps += dependency(gio_system_pkg)
endif
foreach test_ldflag: test_ldflags
if cc.has_argument(test_ldflag)
ldflags += test_ldflag
endif
endforeach
libgitg = shared_library(
api_name,
sources: sources,
......
......@@ -100,10 +100,8 @@ vapi_dir = join_paths(meson.source_root(), 'vapi')
add_project_arguments('--vapidir=' + vapi_dir, language: 'vala')
ldflag = '-Wl,--version-script'
have_version_script = host_machine.system().contains('linux') and cc.has_argument(ldflag)
symbol_map = join_paths(meson.source_root(), 'libgitg.map')
symbol_map = join_paths(meson.current_source_dir(), 'libgitg.map')
common_ldflags = cc.get_supported_link_arguments('-Wl,--version-script,@0@'.format(symbol_map))
glib_req_version = '>= 2.38'
......
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