Revert "Enable rpathification and working relocation on Linux (take 2)"

This reverts commit 8dfe8737c5
This commit is contained in:
João Valverde 2023-02-12 20:30:38 +00:00
parent 58a80312cb
commit ce6c3da727
3 changed files with 22 additions and 82 deletions

View File

@ -270,25 +270,26 @@ if(NOT (WIN32 OR APPLE OR USE_STATIC))
# Some systems support $ORIGIN in RPATH to enable relocatable
# binaries. In other cases, only absolute paths can be used.
# https://www.lekensteyn.nl/rpath.html
#
# Also note that some systems (notably those using GNU libc)
# silently ignore $ORIGIN in RPATH for binaries that are
# setuid root or use privileged capabilities.
#
if(CMAKE_SYSTEM_NAME MATCHES "^(Linux|SunOS|FreeBSD)$")
set(_enable_rpath_origin TRUE)
if(BUILD_dumpcap AND ENABLE_PCAP)
# dumpcap will most likely be installed with
# capabilities or setuid. Relative RPATHs that
# resolve to non-standard library directories
# are ignored for such binaries and since we
# cannot achieve relocatable builds, just
# disable it by default.
set(_enable_rpath_origin FALSE)
endif()
# Provide a knob to optionally force absolute rpaths,
# to support old/buggy systems and as a user preference
# for hardening.
set(ENABLE_RPATH_ORIGIN ${_enable_rpath_origin} CACHE BOOL
"Use $ORIGIN with INSTALL_RPATH")
mark_as_advanced(ENABLE_RPATH_ORIGIN)
else()
set(_enable_rpath_origin FALSE)
set(ENABLE_RPATH_ORIGIN FALSE)
endif()
# Provide a knob to optionally force absolute rpaths,
# to support old/buggy systems and as a user preference
# for hardening.
# XXX Should this be a CMake option?
set(ENABLE_RPATH_ORIGIN ${_enable_rpath_origin} CACHE BOOL
"Use $ORIGIN with INSTALL_RPATH")
mark_as_advanced(ENABLE_RPATH_ORIGIN)
if(ENABLE_RPATH_ORIGIN)
set(LIBRARY_INSTALL_RPATH "$ORIGIN")
set(EXECUTABLE_INSTALL_RPATH "$ORIGIN/../${CMAKE_INSTALL_LIBDIR}")
@ -3119,47 +3120,28 @@ endif()
if(BUILD_dumpcap AND PCAP_FOUND)
set(dumpcap_LIBS
writecap
wsutil_static
wsutil
caputils
iface_monitor
pcap::pcap
${CAP_LIBRARIES}
${ZLIB_LIBRARIES}
${NL_LIBRARIES}
${APPLE_CORE_FOUNDATION_LIBRARY}
${APPLE_SYSTEM_CONFIGURATION_LIBRARY}
${WIN_WS2_32_LIBRARY}
)
if(UNIX)
list(APPEND CAPUTILS_SRC
capture/capture-pcap-util-unix.c)
endif()
if(WIN32)
list(APPEND CAPUTILS_SRC
capture/capture_win_ifnames.c
capture/capture-wpcap.c
)
endif()
list(APPEND CAPUTILS_SRC
capture/capture-pcap-util.c
)
if (AIRPCAP_FOUND)
list(APPEND CAPUTILS_SRC capture/airpcap_loader.c)
endif()
set(dumpcap_FILES
capture_opts.c
cli_main.c
$<TARGET_OBJECTS:capture_opts>
$<TARGET_OBJECTS:cli_main>
dumpcap.c
ringbuffer.c
sync_pipe_write.c
capture/iface_monitor.c
capture/ws80211_utils.c
${CAPUTILS_SRC}
)
set_executable_resources(dumpcap "Dumpcap" UNIQUE_RC)
add_executable(dumpcap ${dumpcap_FILES})
set_extra_executable_properties(dumpcap "Executables")
target_link_libraries(dumpcap ${dumpcap_LIBS})
target_include_directories(dumpcap SYSTEM PRIVATE ${ZLIB_INCLUDE_DIRS} ${NL_INCLUDE_DIRS})
target_compile_definitions(dumpcap PRIVATE ENABLE_STATIC)
target_include_directories(dumpcap SYSTEM PRIVATE ${ZLIB_INCLUDE_DIRS})
executable_link_mingw_unicode(dumpcap)
install(TARGETS dumpcap
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}

View File

@ -36,9 +36,6 @@ Previously it was ``$XDG_CONFIG_HOME/wireshark/extcap``.
The installation target no longer installs development headers by default.
That must be done explicitly using ``cmake --install <builddir> --component Development``.
The Wireshark installation is relocatable on Linux (and other ELF platforms
with support for relative RPATHs).
Many other improvements have been made.
See the “New and Updated Features” section below for more details.

View File

@ -406,45 +406,6 @@ install(FILES ${WSUTIL_PUBLIC_HEADERS}
EXCLUDE_FROM_ALL
)
add_library(wsutil_static STATIC
${WSUTIL_FILES}
)
target_compile_definitions(wsutil_static PRIVATE
ENABLE_STATIC
BUILD_WSUTIL
)
target_link_libraries(wsutil_static
PUBLIC
${GLIB2_LIBRARIES}
PRIVATE
${GMODULE2_LIBRARIES}
${APPLE_CORE_FOUNDATION_LIBRARY}
${CMAKE_DL_LIBS}
${GCRYPT_LIBRARIES}
${GNUTLS_LIBRARIES}
${ZLIB_LIBRARIES}
${PCRE2_LIBRARIES}
${WIN_IPHLPAPI_LIBRARY}
${WIN_WS2_32_LIBRARY}
)
target_include_directories(wsutil_static SYSTEM
PUBLIC
${GLIB2_INCLUDE_DIRS}
${GCRYPT_INCLUDE_DIRS}
${GNUTLS_INCLUDE_DIRS}
PRIVATE
${GMODULE2_INCLUDE_DIRS}
${ZLIB_INCLUDE_DIRS}
${PCRE2_INCLUDE_DIRS}
)
if(NOT VCSVERSION_OVERRIDE)
add_dependencies(wsutil_static vcs_version)
endif()
add_executable(wmem_test EXCLUDE_FROM_ALL wmem/wmem_test.c ${WMEM_FILES})
target_link_libraries(wmem_test wsutil)