buildsys: meson: implement update-map-file target

Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/461>
This commit is contained in:
Igor V. Kovalenko 2021-01-09 17:57:23 +03:00 committed by PulseAudio Marge Bot
parent 4f0f215a13
commit 353c013780
2 changed files with 28 additions and 1 deletions

23
scripts/generate-map-file.sh Executable file
View file

@ -0,0 +1,23 @@
#!/bin/bash
# Generator for linker version script.
# We use the same linker version script for all public .so files
#
# generate-map-file.sh where-is/map-file public_interface_1.h public_interface_2.h ... public_interface_N.h
#
CTAGS_IDENTIFIER_LIST="PA_GCC_MALLOC,PA_GCC_ALLOC_SIZE2,PA_GCC_ALLOC_SIZE,PA_GCC_PURE,PA_GCC_CONST,PA_GCC_DEPRECATED,PA_GCC_PRINTF_ATTR"
print_map_file() {
echo "PULSE_0 {"
echo "global:"
ctags -I ${CTAGS_IDENTIFIER_LIST} -f - --c-kinds=p "$@" | awk '/^pa_/ { print $1 ";" }' | sort
echo "local:"
echo "*;"
echo "};"
}
TARGET_FILE=$1
shift
cd "${MESON_SOURCE_ROOT}/${MESON_SUBDIR}" && print_map_file "$@" > ${TARGET_FILE}

View file

@ -72,7 +72,11 @@ if glib_dep.found()
libpulse_headers += 'glib-mainloop.h'
endif
versioning_link_args = '-Wl,-version-script=' + join_paths(meson.source_root(), 'src', 'map-file')
run_target('update-map-file',
command : [ join_paths(meson.source_root(), 'scripts/generate-map-file.sh'), 'map-file',
[ libpulse_headers, 'simple.h', join_paths(meson.build_root(), 'src', 'pulse', 'version.h') ] ])
versioning_link_args = '-Wl,-version-script=' + join_paths(meson.source_root(), 'src', 'pulse', 'map-file')
libpulse = shared_library('pulse',
libpulse_sources,