Skip to content

Commit

Permalink
Allow sterile builds (#641)
Browse files Browse the repository at this point in the history
A sterile build requires that all dependencies are already installed on the system and thus cannot be downloaded/built from source by the Dyninst build system.
  • Loading branch information
hainest committed Nov 13, 2019
1 parent d8a5fb0 commit 03a33fb
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 0 deletions.
3 changes: 3 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ set (CMAKE_SKIP_BUILD_RPATH FALSE)
set (CMAKE_BUILD_WITH_INSTALL_RPATH FALSE)
set (CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
set (CMAKE_EXPORT_COMPILE_COMMANDS ON)

set(STERILE_BUILD OFF CACHE BOOL "Do not download/build any third-party dependencies from source")

LIST(FIND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES
"${CMAKE_INSTALL_PREFIX}/lib" isSystemDir)
IF("${isSystemDir}" STREQUAL "-1")
Expand Down
2 changes: 2 additions & 0 deletions cmake/Boost.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,8 @@ if(Boost_FOUND)
set(Boost_LIBRARY_DIRS ${Boost_LIBRARY_DIRS} CACHE PATH "Boost library directory" FORCE)
set(Boost_INCLUDE_DIR ${Boost_INCLUDE_DIR} CACHE PATH "Boost include directory" FORCE)
add_library(boost SHARED IMPORTED)
elseif(NOT Boost_FOUND AND STERILE_BUILD)
message(FATAL_ERROR "Boost not found and cannot be downloaded because build is sterile.")
else()
# If we didn't find a suitable version on the system, then download one from the web
set(_boost_download_version "1.69.0")
Expand Down
2 changes: 2 additions & 0 deletions cmake/ElfUtils.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,8 @@ if(LibElf_FOUND AND LibDwarf_FOUND)
set(_eu_lib_dirs ${LibElf_LIBRARY_DIRS} ${LibDwarf_LIBRARY_DIRS})
set(_eu_libs ${LibElf_LIBRARIES} ${LibDwarf_LIBRARIES})
add_library(ElfUtils SHARED IMPORTED)
elseif(NOT (LibElf_FOUND AND LibDwarf_FOUND) AND STERILE_BUILD)
message(FATAL_ERROR "Elfutils not found and cannot be downloaded because build is sterile.")
else()
# If we didn't find a suitable version on the system, then download one from the web
# NB: When building from source, we need at least elfutils-0.176 in order to use
Expand Down
2 changes: 2 additions & 0 deletions cmake/LibIberty.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ if(LibIberty_FOUND)
set(_li_lib_dirs ${LibIberty_LIBRARY_DIRS})
set(_li_libs ${LibIberty_LIBRARIES})
add_library(LibIberty STATIC IMPORTED)
elseif(NOT LibIberty_FOUND AND STERILE_BUILD)
message(FATAL_ERROR "LibIberty not found and cannot be downloaded because build is sterile.")
else()
message(STATUS "${LibIberty_ERROR_REASON}")
message(STATUS "Attempting to build LibIberty as external project")
Expand Down
2 changes: 2 additions & 0 deletions cmake/ThreadingBuildingBlocks.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,8 @@ if(TBB_FOUND)
if(NOT TARGET TBB)
add_library(TBB SHARED IMPORTED)
endif()
elseif(NOT TBB_FOUND AND STERILE_BUILD)
message(FATAL_ERROR "TBB not found and cannot be downloaded because build is sterile.")
else()
# If we didn't find a suitable version on the system, then download one from the web
message(STATUS "${ThreadingBuildingBlocks_ERROR_REASON}")
Expand Down

0 comments on commit 03a33fb

Please sign in to comment.