ESP32: Add option to enable controller building (#27544)

diff --git a/config/esp32/components/chip/CMakeLists.txt b/config/esp32/components/chip/CMakeLists.txt
index 8b46be6..d279ce3 100644
--- a/config/esp32/components/chip/CMakeLists.txt
+++ b/config/esp32/components/chip/CMakeLists.txt
@@ -158,6 +158,10 @@
     chip_gn_arg_append("chip_build_libshell"                "true")
 endif()
 
+if (CONFIG_ENABLE_CHIP_CONTROLLER_BUILD)
+    chip_gn_arg_append("chip_build_controller"              "true")
+endif()
+
 if (CONFIG_ENABLE_WIFI_STATION OR CONFIG_ENABLE_WIFI_AP)
     chip_gn_arg_append("chip_enable_wifi"                       "true")
 else()
diff --git a/config/esp32/components/chip/Kconfig b/config/esp32/components/chip/Kconfig
index 7bd4b0b..99de12a 100644
--- a/config/esp32/components/chip/Kconfig
+++ b/config/esp32/components/chip/Kconfig
@@ -96,6 +96,12 @@
             help
                 Link the application against CHIP interactive shell.
 
+        config ENABLE_CHIP_CONTROLLER_BUILD
+            bool "Enable chip-controller build"
+            default n
+            help
+                This option enables chip-controller building.
+
         config DISABLE_IPV4
             bool "Disable IPv4 functionality in the CHIP stack"
             default "n"