diff --git a/.github/workflows/headless-test.yml b/.github/workflows/headless-test.yml index c4137e68..a1e678d8 100644 --- a/.github/workflows/headless-test.yml +++ b/.github/workflows/headless-test.yml @@ -8,8 +8,6 @@ jobs: steps: - uses: actions/checkout@v4 - with: - submodules: recursive - name: Install dependencies run: | diff --git a/.gitignore b/.gitignore index 3d4aa216..99dec60a 100644 --- a/.gitignore +++ b/.gitignore @@ -28,6 +28,9 @@ tags __pycache__/ *.pyc +# Kconfiglib (cloned on demand via 'make config') +tools/kconfig/ + # Configuration .config* config.h diff --git a/.gitmodules b/.gitmodules deleted file mode 100644 index f3adb532..00000000 --- a/.gitmodules +++ /dev/null @@ -1,3 +0,0 @@ -[submodule "tools/kconfig"] - path = tools/kconfig - url = https://github.com/sysprog21/Kconfiglib diff --git a/Makefile b/Makefile index e88336fe..6929a6b6 100644 --- a/Makefile +++ b/Makefile @@ -271,7 +271,7 @@ CFLAGS += -include config.h # Ensure composite-decls.h exists before including build rules # (needed for dependency generation in mk/common.mk) -ifeq ($(filter config defconfig clean,$(MAKECMDGOALS)),) +ifeq ($(filter config defconfig clean distclean,$(MAKECMDGOALS)),) ifeq ($(wildcard src/composite-decls.h),) $(shell scripts/gen-composite-decls.py > src/composite-decls.h) endif @@ -287,14 +287,11 @@ else ifeq ($(check_goal),) endif # Otherwise, only config/defconfig targets - skip mk/common.mk +KCONFIGLIB_REPO := https://github.com/sysprog21/Kconfiglib KCONFIGLIB := tools/kconfig/kconfiglib.py $(KCONFIGLIB): - @if [ -d .git ]; then \ - git submodule update --init tools/kconfig; \ - else \ - echo "Error: Kconfig tools not found"; \ - exit 1; \ - fi + $(RM) -r tools/kconfig + git clone --depth=1 $(KCONFIGLIB_REPO) tools/kconfig # Load default configuration .PHONY: defconfig @@ -308,6 +305,11 @@ config: $(KCONFIGLIB) configs/Kconfig @tools/kconfig/menuconfig.py configs/Kconfig @tools/kconfig/genconfig.py configs/Kconfig +# Remove Kconfiglib and build artifacts +.PHONY: distclean +distclean: clean + $(RM) -r tools/kconfig + # WebAssembly post-build: Copy artifacts to assets/web/ .PHONY: wasm-install wasm-install: diff --git a/configs/Kconfig b/configs/Kconfig index 08295b0d..ac5d6c6c 100644 --- a/configs/Kconfig +++ b/configs/Kconfig @@ -9,20 +9,20 @@ menu "Toolchain Configuration" # Compiler detection using scripts/detect-compiler.py config COMPILER_TYPE string - default "$(shell,scripts/detect-compiler.py 2>/dev/null || echo Unknown)" + default "$(shell,python3 scripts/detect-compiler.py 2>/dev/null || echo Unknown)" config CC_IS_EMCC - def_bool $(shell,scripts/detect-compiler.py --is Emscripten 2>/dev/null && echo y || echo n) + def_bool $(python,assert run(sys.executable, 'scripts/detect-compiler.py', '--is', 'Emscripten')) config CC_IS_CLANG - def_bool $(shell,scripts/detect-compiler.py --is Clang 2>/dev/null && echo y || echo n) + def_bool $(python,assert run(sys.executable, 'scripts/detect-compiler.py', '--is', 'Clang')) config CC_IS_GCC - def_bool $(shell,scripts/detect-compiler.py --is GCC 2>/dev/null && echo y || echo n) + def_bool $(python,assert run(sys.executable, 'scripts/detect-compiler.py', '--is', 'GCC')) # Cross-compilation support detection config CROSS_COMPILE_ENABLED - def_bool $(shell,test -n "$(CROSS_COMPILE)" && echo y || echo n) + def_bool $(python,assert os.environ.get('CROSS_COMPILE')) config CROSS_COMPILE_PREFIX string @@ -41,32 +41,32 @@ comment "Build mode: Native" endmenu -# Dependency detection using Kconfiglib shell function +# Dependency detection using Kconfiglib $(python,...) preprocessor function # For Emscripten builds, libraries are provided via ports system (-sUSE_*) # and do not require host pkg-config detection config HAVE_SDL2 bool default n if CC_IS_EMCC - default $(shell,pkg-config --exists sdl2 && echo y || echo n) if !CC_IS_EMCC + default $(python,assert run('pkg-config', '--exists', 'sdl2')) if !CC_IS_EMCC config HAVE_PIXMAN default n if CC_IS_EMCC - def_bool $(shell,pkg-config --exists pixman-1 && echo y || echo n) if !CC_IS_EMCC + def_bool $(python,assert run('pkg-config', '--exists', 'pixman-1')) if !CC_IS_EMCC config HAVE_LIBPNG bool default y if CC_IS_EMCC - default $(shell,pkg-config --exists libpng && echo y || echo n) if !CC_IS_EMCC + default $(python,assert run('pkg-config', '--exists', 'libpng')) if !CC_IS_EMCC config HAVE_LIBJPEG bool default y if CC_IS_EMCC - default $(shell,pkg-config --exists libjpeg && echo y || echo n) if !CC_IS_EMCC + default $(python,assert run('pkg-config', '--exists', 'libjpeg')) if !CC_IS_EMCC config HAVE_CAIRO default n if CC_IS_EMCC - def_bool $(shell,pkg-config --exists cairo && echo y || echo n) if !CC_IS_EMCC + def_bool $(python,assert run('pkg-config', '--exists', 'cairo')) if !CC_IS_EMCC choice prompt "Backend Selection" diff --git a/tools/kconfig b/tools/kconfig deleted file mode 160000 index da6ffc3f..00000000 --- a/tools/kconfig +++ /dev/null @@ -1 +0,0 @@ -Subproject commit da6ffc3f42462cf71cff96bbd11b099bf4aa1522