CMake: Add an option to disable building libdpkg tables and library (#6848)

This commit is contained in:
Teddy Reed 2020-12-26 16:09:16 -05:00 committed by GitHub
parent 6eb9392cb1
commit 2c0791276e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 31 additions and 5 deletions

View File

@ -117,7 +117,6 @@ function(importLibraries)
"Linux:libaudit" "Linux:libaudit"
"Linux:libcryptsetup" "Linux:libcryptsetup"
"Linux:libdevmapper" "Linux:libdevmapper"
"Linux:libdpkg"
"Linux:libelfin" "Linux:libelfin"
"Linux:libgcrypt" "Linux:libgcrypt"
"Linux:libgpg-error" "Linux:libgpg-error"
@ -161,6 +160,12 @@ function(importLibraries)
) )
endif() endif()
if(OSQUERY_BUILD_DPKG)
list(APPEND library_descriptor_list
"Linux:libdpkg"
)
endif()
foreach(library_descriptor ${library_descriptor_list}) foreach(library_descriptor ${library_descriptor_list})
# Expand the library descriptor # Expand the library descriptor
string(REPLACE ":" ";" library_descriptor "${library_descriptor}") string(REPLACE ":" ";" library_descriptor "${library_descriptor}")

View File

@ -87,6 +87,7 @@ set(OSQUERY_CLANG_TIDY_CHECKS "-checks=cert-*,cppcoreguidelines-*,performance-*,
option(OSQUERY_BUILD_BPF "Whether to enable and build BPF support" ON) option(OSQUERY_BUILD_BPF "Whether to enable and build BPF support" ON)
option(OSQUERY_BUILD_AWS "Whether to build the aws tables and library, to decrease memory usage and increase speed during build." ON) option(OSQUERY_BUILD_AWS "Whether to build the aws tables and library, to decrease memory usage and increase speed during build." ON)
option(OSQUERY_BUILD_DPKG "Whether to build the dpkg tables" ON)
# This is a temporary option to ignore the version check if there's no intention to generate RPM packages # This is a temporary option to ignore the version check if there's no intention to generate RPM packages
option(OSQUERY_IGNORE_CMAKE_MAX_VERSION_CHECK "Ignore the maximum cmake version check introduced due to CPack generating incorrect RPM packages") option(OSQUERY_IGNORE_CMAKE_MAX_VERSION_CHECK "Ignore the maximum cmake version check introduced due to CPack generating incorrect RPM packages")

View File

@ -58,7 +58,6 @@ function(generateOsqueryTablesSystemSystemtable)
linux/dbus/uniquedbusmessage.cpp linux/dbus/uniquedbusmessage.cpp
linux/acpi_tables.cpp linux/acpi_tables.cpp
linux/block_devices.cpp linux/block_devices.cpp
linux/deb_packages.cpp
linux/disk_encryption.cpp linux/disk_encryption.cpp
linux/elf_info.cpp linux/elf_info.cpp
linux/extended_attributes.cpp linux/extended_attributes.cpp
@ -93,6 +92,12 @@ function(generateOsqueryTablesSystemSystemtable)
linux/systemd_units.cpp linux/systemd_units.cpp
) )
if(OSQUERY_BUILD_DPKG)
list(APPEND source_files
linux/deb_packages.cpp
)
endif()
elseif(DEFINED PLATFORM_MACOS) elseif(DEFINED PLATFORM_MACOS)
list(APPEND source_files list(APPEND source_files
darwin/account_policy_data.mm darwin/account_policy_data.mm
@ -266,7 +271,6 @@ function(generateOsqueryTablesSystemSystemtable)
if(DEFINED PLATFORM_LINUX) if(DEFINED PLATFORM_LINUX)
target_link_libraries(osquery_tables_system_systemtable PUBLIC target_link_libraries(osquery_tables_system_systemtable PUBLIC
thirdparty_libdevmapper thirdparty_libdevmapper
thirdparty_libdpkg
thirdparty_libelfin thirdparty_libelfin
thirdparty_libcryptsetup thirdparty_libcryptsetup
thirdparty_librpm thirdparty_librpm
@ -275,6 +279,12 @@ function(generateOsqueryTablesSystemSystemtable)
thirdparty_libcap thirdparty_libcap
) )
if(OSQUERY_BUILD_DPKG)
target_link_libraries(osquery_tables_system_systemtable PUBLIC
thirdparty_libdpkg
)
endif()
elseif(DEFINED PLATFORM_MACOS) elseif(DEFINED PLATFORM_MACOS)
target_link_libraries(osquery_tables_system_systemtable PUBLIC target_link_libraries(osquery_tables_system_systemtable PUBLIC
thirdparty_openssl thirdparty_openssl

View File

@ -169,7 +169,6 @@ function(generateNativeTables)
"linux/memory_info.table:linux" "linux/memory_info.table:linux"
"linux/msr.table:linux" "linux/msr.table:linux"
"linux/memory_map.table:linux" "linux/memory_map.table:linux"
"linux/deb_packages.table:linux"
"linux/elf_dynamic.table:linux" "linux/elf_dynamic.table:linux"
"linux/elf_sections.table:linux" "linux/elf_sections.table:linux"
"linux/selinux_settings.table:linux" "linux/selinux_settings.table:linux"
@ -316,6 +315,12 @@ function(generateNativeTables)
) )
endif() endif()
if(OSQUERY_BUILD_DPKG)
list(APPEND platform_dependent_spec_files
"linux/deb_packages.table:linux"
)
endif()
foreach(spec_descriptor ${platform_dependent_spec_files}) foreach(spec_descriptor ${platform_dependent_spec_files})
string(REPLACE ":" ";" spec_descriptor "${spec_descriptor}") string(REPLACE ":" ";" spec_descriptor "${spec_descriptor}")
list(GET spec_descriptor 0 spec_file) list(GET spec_descriptor 0 spec_file)

View File

@ -151,7 +151,6 @@ function(generateTestsIntegrationTablesTestsTest)
set(platform_source_files set(platform_source_files
arp_cache.cpp arp_cache.cpp
atom_packages.cpp atom_packages.cpp
deb_packages.cpp
elf_dynamic.cpp elf_dynamic.cpp
elf_info.cpp elf_info.cpp
elf_sections.cpp elf_sections.cpp
@ -188,6 +187,12 @@ function(generateTestsIntegrationTablesTestsTest)
yara.cpp yara.cpp
) )
if(OSQUERY_BUILD_DPKG)
list(APPEND platform_source_files
deb_packages.cpp
)
endif()
list(APPEND source_files ${platform_source_files}) list(APPEND source_files ${platform_source_files})
elseif(DEFINED PLATFORM_MACOS) elseif(DEFINED PLATFORM_MACOS)
set(platform_source_files set(platform_source_files