@@ -784,6 +784,59 @@ def name(self):
784
784
return 'cmake'
785
785
786
786
787
+ class KConfigBuildScanner (AutoBuildBase ):
788
+ """Auto builder for KConfig-based projects."""
789
+
790
+ def __init__ (self ):
791
+ super ().__init__ ()
792
+ self .matches_found = {
793
+ 'Config.in' : [],
794
+ 'Makefile' : [],
795
+ }
796
+
797
+ def is_matched (self ):
798
+ """Returns True if the build heuristic found matching files."""
799
+ # Ensure both Config.in and Makefile exists
800
+ for found_matches in self .matches_found .values ():
801
+ if len (found_matches ) == 0 :
802
+ return False
803
+ return True
804
+
805
+ def steps_to_build (self ) -> Iterator [AutoBuildContainer ]:
806
+ base_command = [
807
+ '''
808
+ make defconfig
809
+ make
810
+ find . -type f -name "*.o" > objfiles
811
+ llvm-ar rcs libfuzz.a $(cat objfiles)
812
+ '''
813
+ ]
814
+ build_container = AutoBuildContainer ()
815
+ build_container .list_of_commands = base_command
816
+ build_container .heuristic_id = self .name + '1'
817
+ yield build_container
818
+
819
+ # Alternative to avoid Gold lld
820
+ build_container_2 = AutoBuildContainer ()
821
+ base_command .append ('export CFLAGS="${CFLAGS} -fuse-ld=lld"' )
822
+ base_command .append ('export CFXXLAGS="${CXXFLAGS} -fuse-ld=lld"' )
823
+ build_container_2 .list_of_commands = base_command
824
+ build_container .heuristic_id = self .name + '2'
825
+ yield build_container_2
826
+
827
+ # Alternative to avoid Gold lld and add thread/crypt libraries
828
+ build_container_3 = AutoBuildContainer ()
829
+ base_command .append ('export CFLAGS="${CFLAGS} -lpthread -lcrypt"' )
830
+ base_command .append ('export CFXXLAGS="${CXXFLAGS} -lpthread -lcrypt"' )
831
+ build_container_3 .list_of_commands = base_command
832
+ build_container .heuristic_id = self .name + '3'
833
+ yield build_container_3
834
+
835
+ @property
836
+ def name (self ):
837
+ return 'kconfig'
838
+
839
+
787
840
def match_build_heuristics_on_folder (abspath_of_target : str ):
788
841
"""Yields AutoBuildContainer objects.
789
842
@@ -808,6 +861,7 @@ def match_build_heuristics_on_folder(abspath_of_target: str):
808
861
BootstrapScanner (),
809
862
AutogenScannerSH (),
810
863
HeaderOnlyCBuilder (),
864
+ KConfigBuildScanner (),
811
865
]
812
866
813
867
checks_to_test = []
0 commit comments