diff options
author | orbea <orbea@riseup.net> | 2021-04-01 19:01:54 -0700 |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2021-04-04 09:27:35 +0200 |
commit | 68913466af49c738d7e226f55db15be70b22dbe6 (patch) | |
tree | 62d6655bc2ce08c4f7cb2ccab3275acc6aa72697 | |
parent | 74fc2793417a5e5b1bc366b3fb42bb3aa2fe3cf7 (diff) | |
download | NetworkManager-68913466af49c738d7e226f55db15be70b22dbe6.tar.gz |
tools: use libtool --mode=execute
Better fix for https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/732
The original issue was that when compiling NetworkManager with slibtool
the create-exports-NetworkManager.sh script gave the NetworkManager-all-sym
slibtool wrapper script to nm(1) instead of the actual binary. This is
because slibtool and GNU libtool do not place the compiled programs in
the same location. The original fix was to test both locations, but this
is bit of a hack especially since the build system should not be using the
.libs directory directly. However with $(LIBTOOL) --mode=execute this is
not a problem since both implementations can figure out where the correct
binary is.
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/805
-rw-r--r-- | Makefile.am | 2 | ||||
-rwxr-xr-x | tools/create-exports-NetworkManager.sh | 31 |
2 files changed, 18 insertions, 15 deletions
diff --git a/Makefile.am b/Makefile.am index 1e804dacfe..b7a3a04c29 100644 --- a/Makefile.am +++ b/Makefile.am @@ -2671,7 +2671,7 @@ src_core_NetworkManager_all_sym_LDFLAGS = \ $(src_core_NetworkManager_all_sym_OBJECTS): $(src_libnm_core_public_mkenums_h) src/core/NetworkManager.ver: src/core/NetworkManager-all-sym $(core_plugins) - $(AM_V_GEN) NM="$(NM)" "$(srcdir)/tools/create-exports-NetworkManager.sh" --called-from-build "$(srcdir)" + $(AM_V_GEN) LIBTOOL="$(LIBTOOL)" NM="$(NM)" "$(srcdir)/tools/create-exports-NetworkManager.sh" --called-from-build "$(srcdir)" CLEANFILES += src/core/NetworkManager.ver diff --git a/tools/create-exports-NetworkManager.sh b/tools/create-exports-NetworkManager.sh index f7fd3bab95..21ba369a41 100755 --- a/tools/create-exports-NetworkManager.sh +++ b/tools/create-exports-NetworkManager.sh @@ -35,15 +35,18 @@ _sort() { } call_nm() { - "${NM:-nm}" "$1" | - sed -n 's/.* \([^ ]\) \([^ ]*\)$/\1 \2/p' + if [ -n "$from_meson" ]; then + "${NM:-nm}" "$1" | + sed -n 's/.* \([^ ]\) \([^ ]*\)$/\1 \2/p' + else + libtool=(${LIBTOOL:-libtool}) + ${libtool[@]} --mode=execute "${NM:-nm}" "$1" | + sed -n 's/.* \([^ ]\) \([^ ]*\)$/\1 \2/p' + fi } get_symbols_nm () { - base=./src/core/.libs/NetworkManager-all-sym - if ! test -f "$base"; then - base=./src/core/NetworkManager-all-sym - fi + base=./src/core/NetworkManager-all-sym call_nm "$base" | sed -n 's/^[tTDGRBS] //p' | _sort @@ -85,6 +88,14 @@ do_update() { do_generate > ./src/core/NetworkManager.ver } +if [ -f "build.ninja" ]; then + from_meson=1 + libs= +else + from_meson= + libs=.libs/ +fi + SYMBOLS_MISSING="$(get_symbols_missing | pretty)" SYMBOLS_EXPLICIT="$(get_symbols_explicit | pretty)" @@ -102,14 +113,6 @@ local: EOF } -if [ -f "build.ninja" ]; then - from_meson=1 - libs= -else - from_meson= - libs=.libs/ -fi - test -f ./src/core/${libs}libNetworkManager.a || die "must be called from NetworkManager top build dir after building the tree" case "$1" in |