Skip to content

Commit

Permalink
Fix libintl linkage and include directories (cmake transition fallout)
Browse files Browse the repository at this point in the history
We checked for libintl in the top-level CMakeLists.txt but then never
used it for anything. This only ever worked on glibc where this all
is bundled in. Unfortunately Intl only becomes an importable target
in cmake >= 3.20 which is too new for us to rely on for now.

Python bindings are omitted here because we don't have any translated
messages in there. Whether we should is another topic.
  • Loading branch information
pmatilai committed Jan 8, 2024
1 parent 6e507dd commit a77c1d0
Show file tree
Hide file tree
Showing 8 changed files with 17 additions and 4 deletions.
2 changes: 2 additions & 0 deletions build/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ target_include_directories(librpmbuild PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_SOURCE_DIR}/rpmio
${CMAKE_SOURCE_DIR}/lib
${Intl_INCLUDE_DIRS}
)

target_link_libraries(librpmbuild PUBLIC librpmio librpm)
Expand All @@ -25,6 +26,7 @@ target_link_libraries(librpmbuild PRIVATE
PkgConfig::POPT
LUA::LUA
MAGIC::MAGIC
${Intl_LIBRARIES}
)

if (LIBDW_FOUND)
Expand Down
3 changes: 2 additions & 1 deletion lib/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ target_include_directories(librpm PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_SOURCE_DIR}/rpmio
${CMAKE_CURRENT_BINARY_DIR}
${Intl_INCLUDE_DIRS}
)

target_sources(librpm PRIVATE
Expand Down Expand Up @@ -72,6 +73,6 @@ add_custom_command(OUTPUT tagtbl.C
)

target_link_libraries(librpm PUBLIC librpmio)
target_link_libraries(librpm PRIVATE PkgConfig::POPT LUA::LUA)
target_link_libraries(librpm PRIVATE PkgConfig::POPT LUA::LUA ${Intl_LIBRARIES})

install(TARGETS librpm EXPORT rpm-targets)
1 change: 1 addition & 0 deletions misc/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
add_library(libmisc OBJECT fts.c rpmfts.h)
target_include_directories(libmisc PRIVATE ${Intl_INCLUDE_DIRS})
3 changes: 2 additions & 1 deletion plugins/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@ set(RPM_PLUGINDIR ${CMAKE_INSTALL_FULL_LIBDIR}/rpm-plugins

get_property(plugins DIRECTORY PROPERTY BUILDSYSTEM_TARGETS)
foreach(plugin ${plugins})
target_link_libraries(${plugin} PRIVATE librpmio librpm)
target_link_libraries(${plugin} PRIVATE librpmio librpm ${Intl_LIBRARIES})
target_include_directories(${plugin} PRIVATE ${Intl_INCLUDE_DIRS})
install(TARGETS ${plugin} DESTINATION ${RPM_PLUGINDIR})
install(FILES macros.transaction_${plugin} DESTINATION ${RPM_MACROSDIR})
endforeach()
Expand Down
6 changes: 5 additions & 1 deletion rpmio/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@ target_sources(librpmio PRIVATE
rpmstrpool.c rpmmacro_internal.h rpmlua.c rpmlua.h lposix.c
)
target_compile_definitions(librpmio PRIVATE RPM_CONFIGDIR="${RPM_CONFIGDIR}")
target_include_directories(librpmio PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
target_include_directories(librpmio PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}
${Intl_INCLUDE_DIRS}
)

if (WITH_INTERNAL_OPENPGP)
add_subdirectory(rpmpgp_legacy)
Expand All @@ -27,6 +30,7 @@ target_link_libraries(librpmio PRIVATE
PkgConfig::POPT
LUA::LUA
ZLIB::ZLIB
${Intl_LIBRARIES}
)

if (ZSTD_FOUND)
Expand Down
1 change: 1 addition & 0 deletions rpmio/rpmpgp_legacy/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ target_sources(rpmpgp_legacy PRIVATE
rpmpgp_internal.h rpmpgp_internal.c
)
target_include_directories(rpmpgp_legacy PRIVATE ..)
target_include_directories(rpmpgp_legacy PRIVATE ${Intl_INCLUDE_DIRS})
if (WITH_OPENSSL)
find_package(OpenSSL 3.0.0 REQUIRED)
target_sources(rpmpgp_legacy PRIVATE digest_openssl.c)
Expand Down
3 changes: 2 additions & 1 deletion sign/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,11 @@ target_include_directories(librpmsign PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_SOURCE_DIR}/rpmio
${CMAKE_SOURCE_DIR}/lib
${Intl_INCLUDE_DIRS}
)

target_link_libraries(librpmsign PUBLIC librpmio librpm)
target_link_libraries(librpmsign PRIVATE PkgConfig::POPT)
target_link_libraries(librpmsign PRIVATE PkgConfig::POPT ${Intl_LIBRARIES})
if (WITH_IMAEVM)
target_sources(librpmsign PRIVATE rpmsignfiles.c)
target_link_libraries(librpmsign PRIVATE IMA::IMA)
Expand Down
2 changes: 2 additions & 0 deletions tools/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ endif()
get_property(executables DIRECTORY PROPERTY BUILDSYSTEM_TARGETS)
foreach(exe ${executables})
target_link_libraries(${exe} PRIVATE librpmio librpm PkgConfig::POPT)
target_link_libraries(${exe} PRIVATE ${Intl_LIBRARIES})
target_include_directories(${exe} PRIVATE ${Intl_INCLUDE_DIRS})
endforeach()

foreach(cmd rpmverify rpmquery)
Expand Down

0 comments on commit a77c1d0

Please sign in to comment.