c0cbd2315a3b67911436beb2e6a1d8c26966ea28 — emersion 3 months ago 5c45ed9
Add support for macOS ld
1 files changed, 8 insertions(+), 1 deletions(-)

M meson.build
M meson.build => meson.build +8 -1
@@ 40,6 40,13 @@ install_subdir('include/mrsh', install_dir: get_option('includedir'))
  
  libmrsh_sym_path = meson.current_source_dir() + '/libmrsh.sym'
+ if cc.has_link_argument('-Wl,--version-script=' + libmrsh_sym_path) # GNU ld
+ 	link_args = ['-Wl,--version-script=' + libmrsh_sym_path]
+ elif cc.has_link_argument('-Wl,-exported_symbol') # macOS
+ 	link_args = ['-Wl,-exported_symbol', 'mrsh_*']
+ else
+ 	error('Linker doesn\'t support --version-script or -exported_symbol')
+ endif
  
  lib_mrsh = library(
  	meson.project_name(),


@@ 104,7 111,7 @@ ),
  	include_directories: mrsh_inc,
  	version: meson.project_version(),
- 	link_args: ['-Wl,--version-script=' + libmrsh_sym_path],
+ 	link_args: link_args,
  	install: true,
  )