+ if not use_function_versioning or is_windows
+ # use pre-build objects to build shared lib
+ sources = []
+ objs += static_lib.extract_all_objects(recursive: false)
+ else
+ # for compat we need to rebuild with
+ # RTE_BUILD_SHARED_LIB defined
+ cflags += '-DRTE_BUILD_SHARED_LIB'
+ endif
+ version_map = '@0@/@1@/version.map'.format(
+ meson.current_source_dir(), dir_name)
+ implib = dir_name + '.dll.a'
+
+ def_file = custom_target(libname + '_def',
+ command: [map_to_win_cmd, '@INPUT@', '@OUTPUT@'],
+ input: version_map,
+ output: '@0@_exports.def'.format(libname))
+
+ mingw_map = custom_target(libname + '_mingw',
+ command: [map_to_win_cmd, '@INPUT@', '@OUTPUT@'],
+ input: version_map,
+ output: '@0@_mingw.map'.format(libname))
+
+ if is_ms_linker
+ lk_args = ['-Wl,/def:' + def_file.full_path()]
+ if meson.version().version_compare('<0.54.0')
+ lk_args += ['-Wl,/implib:lib\\' + implib]
+ endif
+ else
+ if is_windows
+ lk_args = ['-Wl,--version-script=' + mingw_map.full_path()]
+ else
+ lk_args = ['-Wl,--version-script=' + version_map]
+ endif
+ endif
+
+ lk_deps = [version_map, def_file, mingw_map]
+ if not is_windows
+ # on unix systems check the output of the
+ # check-symbols.sh script, using it as a
+ # dependency of the .so build
+ lk_deps += custom_target(name + '.sym_chk',
+ command: [check_symbols,
+ version_map, '@INPUT@'],
+ capture: true,
+ input: static_lib,
+ output: name + '.sym_chk')
+ endif
+