Skip to content

Truly independent web browser

Meta: Rename ENABLE_LAGOM_CCACHE to LADYBIRD_ENABLE_CCACHE

Jelle Raaijmakerse267a6b3e417
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 7a8777be45c..3a0974663c4 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -57,9 +57,7 @@ if(ENABLE_ALL_THE_DEBUG_MACROS)
include(all_the_debug_macros)
endif()
-if (ENABLE_LAGOM_CCACHE)
- include(setup_ccache)
-endif()
+include(setup_ccache)
if (ENABLE_FUZZERS_LIBFUZZER OR ENABLE_FUZZERS_OSSFUZZ)
set(ENABLE_FUZZERS ON)
diff --git a/Documentation/AdvancedBuildInstructions.md b/Documentation/AdvancedBuildInstructions.md
index 2528600d2cc..f99aea74b9c 100644
--- a/Documentation/AdvancedBuildInstructions.md
+++ b/Documentation/AdvancedBuildInstructions.md
@@ -42,7 +42,7 @@ There are some optional features that can be enabled during compilation that are
- `ENABLE_CLANG_PLUGINS_INVALID_FUNCTION_MEMBERS`: makes the Clang plugins also detect invalid function types as members of GC-allocated objects. Only applies with `ENABLE_CLANG_PLUGINS`.
- `BUILD_SHARED_LIBS`: builds shared libraries instead of static ones. Enabled by default, and disabled by the `Distribution` preset.
- `ENABLE_GUI_TARGETS`: builds the browser, its helper processes and the tests that need them. Enabled by default.
-- `ENABLE_LAGOM_CCACHE`: compiles through ccache when it is installed. Enabled by default.
+- `LADYBIRD_ENABLE_CCACHE`: compiles through ccache when it is installed. Enabled by default.
- `LAGOM_USE_LINKER`: sets the linker to use, such as `lld` or `mold`, instead of the compiler's default. On Linux and the BSDs, LLD or mold is picked automatically when one of them is installed.
- `LAGOM_LINK_POOL_SIZE`: sets the maximum number of link jobs that run at once.
- `LADYBIRD_ENABLE_LTO`: enables link-time optimization. Disabled by default and enabled by the `Distribution` preset. Static builds with GCC need a lot of memory with it.
diff --git a/Meta/CMake/cmake_options.cmake b/Meta/CMake/cmake_options.cmake
index 8b270e0efa3..cf31c2426fd 100644
--- a/Meta/CMake/cmake_options.cmake
+++ b/Meta/CMake/cmake_options.cmake
@@ -64,7 +64,7 @@ option(ENABLE_THREAD_SANITIZER "Enable thread sanitizer testing in gcc/clang" OF
option(ENABLE_FUZZERS "Build fuzzing targets" OFF)
option(ENABLE_FUZZERS_LIBFUZZER "Build fuzzers using Clang's libFuzzer" OFF)
option(ENABLE_FUZZERS_OSSFUZZ "Build OSS-Fuzz compatible fuzzers" OFF)
-option(ENABLE_LAGOM_CCACHE "Enable ccache for Lagom builds" ON)
+option(LADYBIRD_ENABLE_CCACHE "Compile through ccache when it is installed" ON)
set(LAGOM_USE_LINKER "" CACHE STRING "The linker to use (e.g. lld, mold) instead of the system default")
set(LAGOM_LINK_POOL_SIZE "" CACHE STRING "The maximum number of parallel jobs to use for linking")
option(LADYBIRD_ENABLE_LTO "Enable link-time optimization" OFF)
diff --git a/Meta/CMake/setup_ccache.cmake b/Meta/CMake/setup_ccache.cmake
index c3306261557..3dcf34c4264 100644
--- a/Meta/CMake/setup_ccache.cmake
+++ b/Meta/CMake/setup_ccache.cmake
@@ -6,13 +6,22 @@ list(APPEND COMPILERS
"CMAKE_C_COMPILER"
"CMAKE_CXX_COMPILER"
)
-find_program(CCACHE_PROGRAM ccache)
-if(CCACHE_PROGRAM)
- foreach(compiler ${COMPILERS})
+if (LADYBIRD_ENABLE_CCACHE)
+ find_program(CCACHE_PROGRAM ccache)
+endif()
+foreach(compiler ${COMPILERS})
+ if (LADYBIRD_ENABLE_CCACHE AND CCACHE_PROGRAM)
get_filename_component(compiler_path "${${compiler}}" REALPATH)
get_filename_component(compiler_name "${compiler_path}" NAME)
if (NOT ${compiler_name} MATCHES "ccache")
set("${compiler}_LAUNCHER" "${CCACHE_PROGRAM}" CACHE FILEPATH "Path to a compiler launcher program, e.g. ccache")
endif()
- endforeach()
-endif()
+ elseif (NOT LADYBIRD_ENABLE_CCACHE AND DEFINED CACHE{${compiler}_LAUNCHER})
+ string(REGEX MATCH "^[^;]*" launcher_program "$CACHE{${compiler}_LAUNCHER}")
+ get_filename_component(launcher_name "${launcher_program}" NAME)
+ if (launcher_name STREQUAL "ccache" OR launcher_name STREQUAL "ccache.exe"
+ OR (CCACHE_PROGRAM AND launcher_program STREQUAL CCACHE_PROGRAM))
+ unset("${compiler}_LAUNCHER" CACHE)
+ endif()
+ endif()
+endforeach()
diff --git a/Meta/Fuzzers/README.md b/Meta/Fuzzers/README.md
index 75cdd5a7ccb..c6c0fad8fd6 100644
--- a/Meta/Fuzzers/README.md
+++ b/Meta/Fuzzers/README.md
@@ -24,7 +24,7 @@ To build fuzzers without any kind of default instrumentation, pass the ``--stand
./Build/lagom-fuzzers-standalone/Fuzzers/FuzzSomething
```
-The fuzzing build's CMake cache can be manipulated with commands like `cmake -B Build/fuzzers -S . -DENABLE_LAGOM_CCACHE=OFF`.
+The fuzzing build's CMake cache can be manipulated with commands like `cmake -B Build/lagom-fuzzers -S . -DLADYBIRD_ENABLE_CCACHE=OFF`.
Any fuzzing results (particularly slow inputs, crashes, etc.) will be dropped in the current directory.