From 0e3eeee45d0f4a7c6a08607ae8642f4228974a02 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A1t=C3=A9=20Szab=C3=B3?= Date: Mon, 30 Mar 2026 15:11:42 +0200 Subject: [PATCH] Build all of folly for HHVM OSS rather than patching out bits and pieces Currently we patch the folly build system in OSS HHVM to only build a subset. This is generally brittle since the patch needs updating if the upstream listfile changes in an incompatible way. Let's simplify things and build all of folly instead. Add newly required deps and remove dead patches. --- CMake/HPHPFindLibs.cmake | 5 ++ third-party/folly/CMakeLists.txt | 7 --- .../folly/patches/disable-liblzma.patch | 24 --------- .../folly/patches/disable-libsnappy.patch | 24 --------- .../do-not-export-unbuilt-targets.patch | 24 --------- .../patches/folly-install-component.patch | 52 ------------------- third-party/folly/patches/series | 3 -- 7 files changed, 5 insertions(+), 134 deletions(-) delete mode 100644 third-party/folly/patches/disable-liblzma.patch delete mode 100644 third-party/folly/patches/disable-libsnappy.patch delete mode 100644 third-party/folly/patches/do-not-export-unbuilt-targets.patch delete mode 100644 third-party/folly/patches/folly-install-component.patch diff --git a/CMake/HPHPFindLibs.cmake b/CMake/HPHPFindLibs.cmake index 4932cea7057ce0..82a6db84919a9f 100644 --- a/CMake/HPHPFindLibs.cmake +++ b/CMake/HPHPFindLibs.cmake @@ -285,6 +285,9 @@ if (PAM_INCLUDE_PATH) include_directories(${PAM_INCLUDE_PATH}) endif() +find_package(LibLZMA MODULE REQUIRED) +find_package(Snappy CONFIG REQUIRED) + include_directories(${HPHP_HOME}/hphp) macro(hphp_link target) @@ -429,6 +432,8 @@ macro(hphp_link target) target_link_libraries(${target} ${VISIBILITY} afdt) target_link_libraries(${target} ${VISIBILITY} mbfl) + target_link_libraries(${target} ${VISIBILITY} ${LIBLZMA_LIBRARIES} Snappy::snappy) + if (LINUX) target_link_libraries(${target} ${VISIBILITY} ${LIBUNWIND_LIBRARIES}) endif() diff --git a/third-party/folly/CMakeLists.txt b/third-party/folly/CMakeLists.txt index 4c9be24277a289..7fb6440eae1967 100644 --- a/third-party/folly/CMakeLists.txt +++ b/third-party/folly/CMakeLists.txt @@ -71,13 +71,6 @@ ExternalProject_add( -DZSTD_LIBRARY_RELEASE=${ZSTD_LIBRARY} BUILD_COMMAND $(MAKE) folly - INSTALL_COMMAND -# Prefered, but needs CMake 3.15 or above. Revist when Ubuntu 18.04 support is removed -# ${CMAKE_COMMAND} --install . --config ${CMAKE_BUILD_TYPE} --component dev && -# ${CMAKE_COMMAND} --install . --config ${CMAKE_BUILD_TYPE} --component lib -# Legacy way: - ${CMAKE_COMMAND} -DCOMPONENT=dev -P cmake_install.cmake --config ${CMAKE_BUILD_TYPE} && - ${CMAKE_COMMAND} -DCOMPONENT=lib -P cmake_install.cmake --config ${CMAKE_BUILD_TYPE} ) ExternalProject_Get_Property(bundled_folly INSTALL_DIR) set( diff --git a/third-party/folly/patches/disable-liblzma.patch b/third-party/folly/patches/disable-liblzma.patch deleted file mode 100644 index 74b8f798ee9a29..00000000000000 --- a/third-party/folly/patches/disable-liblzma.patch +++ /dev/null @@ -1,24 +0,0 @@ -Index: folly/CMake/folly-deps.cmake -=================================================================== ---- folly.orig/CMake/folly-deps.cmake -+++ folly/CMake/folly-deps.cmake -@@ -102,11 +102,14 @@ if (BZIP2_FOUND) - list(APPEND FOLLY_LINK_LIBRARIES ${BZIP2_LIBRARIES}) - endif() - --find_package(LibLZMA MODULE) --set(FOLLY_HAVE_LIBLZMA ${LIBLZMA_FOUND}) --if (LIBLZMA_FOUND) -- list(APPEND FOLLY_INCLUDE_DIRECTORIES ${LIBLZMA_INCLUDE_DIRS}) -- list(APPEND FOLLY_LINK_LIBRARIES ${LIBLZMA_LIBRARIES}) -+option(WITHOUT_LIBLZMA "Disable LZMA support" OFF) -+if(NOT WITHOUT_LIBLZMA) -+ find_package(LibLZMA MODULE) -+ set(FOLLY_HAVE_LIBLZMA ${LIBLZMA_FOUND}) -+ if (LIBLZMA_FOUND) -+ list(APPEND FOLLY_INCLUDE_DIRECTORIES ${LIBLZMA_INCLUDE_DIRS}) -+ list(APPEND FOLLY_LINK_LIBRARIES ${LIBLZMA_LIBRARIES}) -+ endif() - endif() - - find_package(LZ4 MODULE) diff --git a/third-party/folly/patches/disable-libsnappy.patch b/third-party/folly/patches/disable-libsnappy.patch deleted file mode 100644 index 069ac3d8b21b69..00000000000000 --- a/third-party/folly/patches/disable-libsnappy.patch +++ /dev/null @@ -1,24 +0,0 @@ -Index: folly/CMake/folly-deps.cmake -=================================================================== ---- folly.orig/CMake/folly-deps.cmake -+++ folly/CMake/folly-deps.cmake -@@ -126,11 +126,14 @@ if(ZSTD_FOUND) - list(APPEND FOLLY_LINK_LIBRARIES ${ZSTD_LIBRARY}) - endif() - --find_package(Snappy MODULE) --set(FOLLY_HAVE_LIBSNAPPY ${SNAPPY_FOUND}) --if (SNAPPY_FOUND) -- list(APPEND FOLLY_INCLUDE_DIRECTORIES ${SNAPPY_INCLUDE_DIR}) -- list(APPEND FOLLY_LINK_LIBRARIES ${SNAPPY_LIBRARY}) -+option(WITHOUT_LIBSNAPPY "Disable Snappy support" OFF) -+if (NOT WITHOUT_LIBSNAPPY) -+ find_package(Snappy MODULE) -+ set(FOLLY_HAVE_LIBSNAPPY ${SNAPPY_FOUND}) -+ if (SNAPPY_FOUND) -+ list(APPEND FOLLY_INCLUDE_DIRECTORIES ${SNAPPY_INCLUDE_DIR}) -+ list(APPEND FOLLY_LINK_LIBRARIES ${SNAPPY_LIBRARY}) -+ endif() - endif() - - find_package(LibDwarf) diff --git a/third-party/folly/patches/do-not-export-unbuilt-targets.patch b/third-party/folly/patches/do-not-export-unbuilt-targets.patch deleted file mode 100644 index ce13f6a46572b1..00000000000000 --- a/third-party/folly/patches/do-not-export-unbuilt-targets.patch +++ /dev/null @@ -1,24 +0,0 @@ -Index: folly/folly/CMakeLists.txt -=================================================================== ---- folly.orig/folly/CMakeLists.txt -+++ folly/folly/CMakeLists.txt -@@ -21,7 +21,6 @@ target_link_libraries(follybenchmark PUB - apply_folly_compile_options_to_target(follybenchmark) - install( - TARGETS follybenchmark -- EXPORT folly - RUNTIME DESTINATION ${BIN_INSTALL_DIR} - LIBRARY DESTINATION ${LIB_INSTALL_DIR} - ARCHIVE DESTINATION ${LIB_INSTALL_DIR} -Index: folly/folly/experimental/exception_tracer/CMakeLists.txt -=================================================================== ---- folly.orig/folly/experimental/exception_tracer/CMakeLists.txt -+++ folly/folly/experimental/exception_tracer/CMakeLists.txt -@@ -63,7 +63,6 @@ if (FOLLY_HAVE_ELF AND FOLLY_HAVE_DWARF) - folly_exception_tracer_base - folly_exception_tracer - folly_exception_counter -- EXPORT folly - RUNTIME DESTINATION ${BIN_INSTALL_DIR} - LIBRARY DESTINATION ${LIB_INSTALL_DIR} - ARCHIVE DESTINATION ${LIB_INSTALL_DIR} diff --git a/third-party/folly/patches/folly-install-component.patch b/third-party/folly/patches/folly-install-component.patch deleted file mode 100644 index 773b84cd1c3a0c..00000000000000 --- a/third-party/folly/patches/folly-install-component.patch +++ /dev/null @@ -1,52 +0,0 @@ -Index: folly/CMakeLists.txt -=================================================================== ---- folly.orig/CMakeLists.txt -+++ folly/CMakeLists.txt -@@ -385,8 +385,6 @@ target_compile_definitions(folly_base - $ - ) - --set(FOLLY_INSTALL_TARGETS folly folly_deps) -- - option(PYTHON_EXTENSIONS - "Build Python Bindings for Folly, requires Cython and (BUILD_SHARED_LIBS=ON)" - OFF -@@ -414,21 +412,31 @@ target_link_libraries(folly_test_util - ${LIBGMOCK_LIBRARIES} - ) - apply_folly_compile_options_to_target(folly_test_util) --list(APPEND FOLLY_INSTALL_TARGETS folly_test_util) - --install(TARGETS ${FOLLY_INSTALL_TARGETS} -+install(TARGETS folly folly_deps - EXPORT folly -+ COMPONENT lib -+ RUNTIME DESTINATION bin -+ LIBRARY DESTINATION ${LIB_INSTALL_DIR} -+ ARCHIVE DESTINATION ${LIB_INSTALL_DIR}) -+install(TARGETS folly_test_util -+ EXPORT folly_test_util -+ COMPONENT test_util - RUNTIME DESTINATION bin - LIBRARY DESTINATION ${LIB_INSTALL_DIR} - ARCHIVE DESTINATION ${LIB_INSTALL_DIR}) --auto_install_files(folly ${FOLLY_DIR} -- ${hfiles} --) - install( - FILES ${CMAKE_CURRENT_BINARY_DIR}/folly/folly-config.h - DESTINATION ${INCLUDE_INSTALL_DIR}/folly -- COMPONENT dev --) -+ COMPONENT dev) -+foreach(HEADER ${hfiles}) -+ string(REPLACE "${FOLLY_DIR}" "${INCLUDE_INSTALL_DIR}/folly" DEST "${HEADER}") -+ get_filename_component(DEST "${DEST}" DIRECTORY) -+ install( -+ FILES "${HEADER}" -+ DESTINATION "${DEST}" -+ COMPONENT dev) -+endforeach() - - # Generate the folly-config.cmake file for installation so that - # downstream projects that use on folly can easily depend on it in their CMake diff --git a/third-party/folly/patches/series b/third-party/folly/patches/series index a50f8704012df0..f4cde67a0f8a1b 100644 --- a/third-party/folly/patches/series +++ b/third-party/folly/patches/series @@ -1,7 +1,4 @@ disable-liblzma.patch folly-cmake-fixup.patch -folly-install-component.patch disable-libsnappy.patch -without-unwind-symbolizer.patch -do-not-export-unbuilt-targets.patch bad_implicit_cast.patch