Skip to content

Commit

Permalink
Revert "Enable rpathification and working relocation on Linux"
Browse files Browse the repository at this point in the history
This reverts commit 7a346c3.
  • Loading branch information
geraldcombs committed Jan 30, 2023
1 parent abb0e7e commit 894e8c4
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 52 deletions.
33 changes: 17 additions & 16 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -269,25 +269,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}")
Expand Down Expand Up @@ -3130,7 +3131,7 @@ endif()
if(BUILD_dumpcap AND PCAP_FOUND)
set(dumpcap_LIBS
writecap
wsutil_static
wsutil
caputils
ui
version_info
Expand Down
2 changes: 1 addition & 1 deletion capture/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,9 @@ add_library(caputils STATIC

target_link_libraries(caputils
PUBLIC
wsutil
$<$<BOOL:${PCAP_FOUND}>:pcap::pcap>
PRIVATE
wsutil_static
${NL_LIBRARIES}
${WIN_IPHLPAPI_LIBRARY}
)
Expand Down
3 changes: 0 additions & 3 deletions docbook/release-notes.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down
32 changes: 0 additions & 32 deletions wsutil/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -333,38 +333,6 @@ install(TARGETS wsutil
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
)

add_library(wsutil_static STATIC
${WSUTIL_FILES}
$<TARGET_OBJECTS:wmem>
)

target_compile_definitions(wsutil_static PRIVATE
ENABLE_STATIC
BUILD_WSUTIL
)

target_link_libraries(wsutil_static
PUBLIC
${GLIB2_LIBRARIES}
${GMODULE2_LIBRARIES}
${GNUTLS_LIBRARIES}
${PCRE2_LIBRARIES}
${GCRYPT_LIBRARIES}
PRIVATE
${APPLE_CORE_FOUNDATION_LIBRARY}
${CMAKE_DL_LIBS}
${M_LIBRARIES}
${WIN_IPHLPAPI_LIBRARY}
${WIN_WS2_32_LIBRARY}
)

target_include_directories(wsutil_static
SYSTEM PUBLIC
${GCRYPT_INCLUDE_DIRS}
${GNUTLS_INCLUDE_DIRS}
${PCRE2_INCLUDE_DIRS}
)

add_executable(test_wsutil EXCLUDE_FROM_ALL
test_wsutil.c
)
Expand Down

0 comments on commit 894e8c4

Please sign in to comment.