diff --git a/cmake/modules/jq.cmake b/cmake/modules/jq.cmake deleted file mode 100644 index 4ce07aa0a5..0000000000 --- a/cmake/modules/jq.cmake +++ /dev/null @@ -1,87 +0,0 @@ -# SPDX-License-Identifier: Apache-2.0 -# -# Copyright (C) 2023 The Falco Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the -# specific language governing permissions and limitations under the License. -# - -option(USE_BUNDLED_JQ "Enable building of the bundled jq" ${USE_BUNDLED_DEPS}) - -if(JQ_INCLUDE) - # we already have jq -elseif(NOT USE_BUNDLED_JQ) - find_path(JQ_INCLUDE jq.h PATH_SUFFIXES jq) - find_library(JQ_LIB NAMES jq) - if(JQ_INCLUDE AND JQ_LIB) - message(STATUS "Found jq: include: ${JQ_INCLUDE}, lib: ${JQ_LIB}") - else() - message(FATAL_ERROR "Couldn't find system jq") - endif() -else() - set(JQ_SRC "${PROJECT_BINARY_DIR}/jq-prefix/src/jq") - message(STATUS "Using bundled jq in '${JQ_SRC}'") - set(JQ_INCLUDE "${JQ_SRC}/target/include/") - set(JQ_INSTALL_DIR "${JQ_SRC}/target") - if(BUILD_SHARED_LIBS) - set(JQ_LIB_SUFFIX ${CMAKE_SHARED_LIBRARY_SUFFIX}) - set(JQ_STATIC_OPTION --enable-shared --disable-static) - else() - set(JQ_LIB_SUFFIX ${CMAKE_STATIC_LIBRARY_SUFFIX}) - set(JQ_STATIC_OPTION --enable-all-static) - endif() - set(JQ_LIB "${JQ_INSTALL_DIR}/lib/libjq${JQ_LIB_SUFFIX}") - set(ONIGURUMA_LIB "${JQ_INSTALL_DIR}/lib/libonig${JQ_LIB_SUFFIX}") - - if(APPLE) - set(CPPFLAGS -D_REENTRANT) - endif() - - if(NOT TARGET jq) - message(STATUS "Bundled jq: include: ${JQ_INCLUDE}, lib: ${JQ_LIB}") - - # Why we mirror jq here? - # - # In their readme, jq claims that you don't have - # to do autoreconf -fi when downloading a released tarball. - # - # However, they forgot to push the released makefiles - # into their release tarbal. - # - # For this reason, we have to mirror their release after - # doing the configuration ourselves. - # - # This is needed because many distros do not ship the right - # version of autoreconf, making virtually impossible to build libs on them. - # Read more about it here: - # https://github.com/stedolan/jq/issues/2061#issuecomment-593445920 - ExternalProject_Add( - jq - PREFIX "${PROJECT_BINARY_DIR}/jq-prefix" - URL "https://download.falco.org/dependencies/jq-1.6.tar.gz" - URL_HASH "SHA256=787518068c35e244334cc79b8e56b60dbab352dff175b7f04a94f662b540bfd9" - CONFIGURE_COMMAND CPPFLAGS=${CPPFLAGS} ./configure --disable-maintainer-mode ${JQ_STATIC_OPTION} --disable-dependency-tracking --with-oniguruma=builtin --prefix=${JQ_INSTALL_DIR} - BUILD_COMMAND make clean all LDFLAGS=${JQ_LDFLAGS} - BUILD_IN_SOURCE 1 - BUILD_BYPRODUCTS ${JQ_LIB} ${ONIGURUMA_LIB} - INSTALL_COMMAND make install) - install(FILES "${JQ_LIB}" DESTINATION "${CMAKE_INSTALL_LIBDIR}/${LIBS_PACKAGE_NAME}" - COMPONENT "libs-deps") - install(FILES "${ONIGURUMA_LIB}" DESTINATION "${CMAKE_INSTALL_LIBDIR}/${LIBS_PACKAGE_NAME}" - COMPONENT "libs-deps") - install(DIRECTORY "${JQ_INCLUDE}" DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/${LIBS_PACKAGE_NAME}" - COMPONENT "libs-deps") - endif() -endif() - -if(NOT TARGET jq) - add_custom_target(jq) -endif() - -include_directories("${JQ_INCLUDE}") diff --git a/cmake/modules/libsinsp.cmake b/cmake/modules/libsinsp.cmake index 48fcff7560..d5499fe8ff 100644 --- a/cmake/modules/libsinsp.cmake +++ b/cmake/modules/libsinsp.cmake @@ -34,7 +34,6 @@ if (NOT EMSCRIPTEN) endif() if(NOT WIN32 AND NOT APPLE) include(b64) - include(jq) endif() if(NOT WIN32 AND NOT APPLE AND NOT MINIMAL_BUILD AND NOT EMSCRIPTEN) include(cares) @@ -72,8 +71,6 @@ endif() if(NOT WIN32 AND NOT APPLE) get_filename_component(B64_ABSOLUTE_INCLUDE_DIR ${B64_INCLUDE} ABSOLUTE) list(APPEND LIBSINSP_INCLUDE_DIRS ${B64_ABSOLUTE_INCLUDE_DIR}) - get_filename_component(JQ_ABSOLUTE_INCLUDE_DIR ${JQ_INCLUDE} ABSOLUTE) - list(APPEND LIBSINSP_INCLUDE_DIRS ${JQ_ABSOLUTE_INCLUDE_DIR}) endif() if(NOT WIN32 AND NOT APPLE AND NOT MINIMAL_BUILD AND NOT EMSCRIPTEN) diff --git a/test/vm/containers/ubuntu2004.Dockerfile b/test/vm/containers/ubuntu2004.Dockerfile index 9e5310594e..8c66c293a7 100755 --- a/test/vm/containers/ubuntu2004.Dockerfile +++ b/test/vm/containers/ubuntu2004.Dockerfile @@ -34,7 +34,6 @@ RUN apt --fix-broken -y install && apt-get install -y --no-install-recommends \ libc-ares-dev \ libprotobuf-dev \ protobuf-compiler \ - libjq-dev \ libgrpc++-dev \ protobuf-compiler-grpc \ libcurl4-openssl-dev \ diff --git a/test/vm/containers/ubuntu2204.Dockerfile b/test/vm/containers/ubuntu2204.Dockerfile index ff08fc3936..f20436d2c0 100755 --- a/test/vm/containers/ubuntu2204.Dockerfile +++ b/test/vm/containers/ubuntu2204.Dockerfile @@ -35,7 +35,6 @@ RUN apt --fix-broken -y install && apt-get install -y --no-install-recommends \ libc-ares-dev \ libprotobuf-dev \ protobuf-compiler \ - libjq-dev \ libgrpc++-dev \ protobuf-compiler-grpc \ libcurl4-openssl-dev \ diff --git a/test/vm/containers/ubuntu2310.Dockerfile b/test/vm/containers/ubuntu2310.Dockerfile index 64e314091d..d5605bb23a 100644 --- a/test/vm/containers/ubuntu2310.Dockerfile +++ b/test/vm/containers/ubuntu2310.Dockerfile @@ -33,7 +33,6 @@ RUN apt --fix-broken -y install && apt-get install -y \ libc-ares-dev \ libprotobuf-dev \ protobuf-compiler \ - libjq-dev \ libgrpc++-dev \ protobuf-compiler-grpc \ libcurl4-openssl-dev \ diff --git a/userspace/libsinsp/CMakeLists.txt b/userspace/libsinsp/CMakeLists.txt index f73b2ce593..1308a9f48e 100644 --- a/userspace/libsinsp/CMakeLists.txt +++ b/userspace/libsinsp/CMakeLists.txt @@ -66,7 +66,6 @@ if(NOT WIN32 AND NOT APPLE ) include(protobuf) include(openssl) endif() # NOT MINIMAL_BUILD - include(jq) include_directories("${CMAKE_CURRENT_BINARY_DIR}") endif() @@ -268,7 +267,7 @@ if(NOT WIN32) "${GPR_LIB}" "${PROTOBUF_LIB}" "${CARES_LIB}" - "${JQ_LIB}") + ) list(APPEND SINSP_PKGCONFIG_LIBRARIES "${GRPC_LIBRARIES}" "${GRPCPP_LIB}" @@ -276,7 +275,7 @@ if(NOT WIN32) "${GPR_LIB}" "${PROTOBUF_LIB}" "${CARES_LIB}" - "${JQ_LIB}") + ) if(NOT MUSL_OPTIMIZED_BUILD) target_link_libraries(sinsp INTERFACE rt anl) @@ -284,16 +283,9 @@ if(NOT WIN32) endif() else() - target_link_libraries(sinsp INTERFACE "${JQ_LIB}" rt) - list(APPEND SINSP_PKGCONFIG_LIBRARIES "${JQ_LIB}" rt) + target_link_libraries(sinsp INTERFACE rt) + list(APPEND SINSP_PKGCONFIG_LIBRARIES rt) endif() # NOT MINIMAL_BUILD - # when JQ is compiled statically, it will - # also compile a static object for oniguruma we need to link - if(ONIGURUMA_LIB) - target_link_libraries(sinsp INTERFACE "${ONIGURUMA_LIB}") - list(APPEND SINSP_PKGCONFIG_LIBRARIES "${ONIGURUMA_LIB}") - add_dependencies(sinsp jq) - endif() endif() # NOT APPLE target_link_libraries(sinsp INTERFACE "${OPENSSL_LIBRARIES}")