From 29c9ee04b32ad3551b383a1841033a40d1b5baa7 Mon Sep 17 00:00:00 2001 From: CyberMind-FR Date: Wed, 24 Dec 2025 14:02:31 +0100 Subject: [PATCH] fix: correct Makefile include paths for SDK and image builds MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fix critical build failure in GitHub Actions workflows and local build script. The issue was that LuCI package Makefiles reference ../../luci.mk which doesn't exist when packages are copied to SDK or OpenWrt build environments. Changes: - build-openwrt-packages.yml: Auto-fix Makefile paths after package copy - build-secubox-images.yml: Auto-fix Makefile paths for image builds - local-build.sh: Complete rewrite to use feed-based architecture * Packages installed as local feed instead of direct copy * Automatic Makefile path correction (../../luci.mk → $(TOPDIR)/feeds/luci/luci.mk) * Skip dependency resolution with NO_DEPS=1 for arch-independent packages * Single package build support throughout the pipeline This fixes the "No such file or directory: ../../luci.mk" error that prevented all package and firmware image builds from succeeding. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 --- .github/workflows/build-openwrt-packages.yml | 10 ++ .github/workflows/build-secubox-images.yml | 10 +- secubox-tools/local-build.sh | 157 +++++++++++++++---- 3 files changed, 145 insertions(+), 32 deletions(-) diff --git a/.github/workflows/build-openwrt-packages.yml b/.github/workflows/build-openwrt-packages.yml index 163c771e..cb27ad1d 100644 --- a/.github/workflows/build-openwrt-packages.yml +++ b/.github/workflows/build-openwrt-packages.yml @@ -374,6 +374,11 @@ jobs: # Update version sed -i "s/PKG_VERSION:=.*/PKG_VERSION:=$VERSION/" "sdk/package/${PACKAGE_NAME}/Makefile" sed -i "s/PKG_RELEASE:=.*/PKG_RELEASE:=1/" "sdk/package/${PACKAGE_NAME}/Makefile" + + # Fix Makefile include path for SDK environment + # Change from ../../luci.mk to $(TOPDIR)/feeds/luci/luci.mk + sed -i 's|include.*luci\.mk|include $(TOPDIR)/feeds/luci/luci.mk|' "sdk/package/${PACKAGE_NAME}/Makefile" + echo " ✓ Fixed Makefile include path" else echo "❌ Package $PACKAGE_NAME not found or missing Makefile" exit 1 @@ -390,6 +395,11 @@ jobs: # Update version sed -i "s/PKG_VERSION:=.*/PKG_VERSION:=$VERSION/" "sdk/package/${PKG_NAME}/Makefile" sed -i "s/PKG_RELEASE:=.*/PKG_RELEASE:=1/" "sdk/package/${PKG_NAME}/Makefile" + + # Fix Makefile include path for SDK environment + # Change from ../../luci.mk to $(TOPDIR)/feeds/luci/luci.mk + sed -i 's|include.*luci\.mk|include $(TOPDIR)/feeds/luci/luci.mk|' "sdk/package/${PKG_NAME}/Makefile" + echo " ✓ Fixed Makefile include path" fi done fi diff --git a/.github/workflows/build-secubox-images.yml b/.github/workflows/build-secubox-images.yml index 5cdbbb2d..694657a0 100644 --- a/.github/workflows/build-secubox-images.yml +++ b/.github/workflows/build-secubox-images.yml @@ -198,12 +198,20 @@ jobs: PKG_NAME=$(basename "$pkg") echo " ✅ $PKG_NAME" cp -r "$pkg" openwrt/package/secubox/ + + # Fix Makefile include path for direct package integration + # Change from ../../luci.mk to $(TOPDIR)/feeds/luci/luci.mk + if [[ -f "openwrt/package/secubox/$PKG_NAME/Makefile" ]]; then + sed -i 's|include.*luci\.mk|include $(TOPDIR)/feeds/luci/luci.mk|' "openwrt/package/secubox/$PKG_NAME/Makefile" + echo " ✓ Fixed Makefile include path" + fi + PKG_COUNT=$((PKG_COUNT + 1)) fi done echo "" - echo "📊 Total: $PKG_COUNT SecuBox packages copied" + echo "📊 Total: $PKG_COUNT SecuBox packages copied and fixed" echo "" echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━" diff --git a/secubox-tools/local-build.sh b/secubox-tools/local-build.sh index dbe79411..da6c52f4 100755 --- a/secubox-tools/local-build.sh +++ b/secubox-tools/local-build.sh @@ -366,20 +366,25 @@ setup_sdk_feeds() { print_success "Removed telephony and routing from feeds.conf.default" fi - # Use GitHub mirrors - cat > feeds.conf << 'FEEDS' + # Create local feed for SecuBox packages outside of SDK + local local_feed_dir="$(pwd)/../local-feed" + mkdir -p "$local_feed_dir" + + # Use GitHub mirrors + local feed + cat > feeds.conf << FEEDS src-git packages https://github.com/openwrt/packages.git;openwrt-23.05 src-git luci https://github.com/openwrt/luci.git;openwrt-23.05 +src-link secubox $local_feed_dir FEEDS - print_info "feeds.conf configured" + print_info "feeds.conf configured with local SecuBox feed at $local_feed_dir" # Update feeds echo "🔄 Updating feeds..." local feeds_ok=0 - local required_feeds=2 + local required_feeds=3 - for feed in packages luci; do + for feed in packages luci secubox; do echo "" echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━" echo "Updating feed: $feed" @@ -426,16 +431,36 @@ FEEDS print_warning "Feed installation had errors, checking if critical..." fi + # Install critical dependencies explicitly + echo "" + echo "📦 Installing LuCI and build dependencies..." + for dep in lua liblua luci-base lucihttp rpcd rpcd-mod-rrdns cgi-io libiwinfo ucode libucode rpcd-mod-luci; do + echo " Installing $dep..." + ./scripts/feeds install "$dep" 2>&1 | grep -v "WARNING:" || true + done + + # Build essential dependencies first + echo "" + echo "🔨 Building essential dependencies..." + for dep in lua liblua lucihttp rpcd cgi-io; do + echo " Building $dep..." + make package/feeds/*/${dep}/compile V=s -j1 2>&1 | tail -5 || true + done + # Verify feeds echo "" echo "🔍 Verifying feed installation..." - for feed in packages luci; do + for feed in packages luci secubox; do if [[ -d "feeds/$feed" ]]; then local feed_size=$(du -sh "feeds/$feed" 2>/dev/null | cut -f1) print_success "feeds/$feed exists ($feed_size)" else - print_error "feeds/$feed is missing!" - return 1 + if [[ "$feed" == "secubox" ]]; then + print_warning "feeds/$feed is empty (will be populated)" + else + print_error "feeds/$feed is missing!" + return 1 + fi fi done @@ -468,57 +493,110 @@ LUCI_MK return 0 } -# Copy packages to SDK +# Copy packages to SDK feed copy_packages() { local single_package="$1" - print_header "Copying Packages to SDK" + print_header "Copying Packages to SecuBox Feed" + + cd "$SDK_DIR" + + # Use the local feed directory (outside SDK) + local feed_dir="../local-feed" + mkdir -p "$feed_dir" if [[ -n "$single_package" ]]; then print_info "Copying single package: $single_package" - if [[ -d "../$single_package" && -f "../${single_package}/Makefile" ]]; then + if [[ -d "../../$single_package" && -f "../../${single_package}/Makefile" ]]; then echo " 📁 $single_package" - cp -r "../$single_package" "$SDK_DIR/package/" + cp -r "../../$single_package" "$feed_dir/" + + # Fix Makefile include path for feed structure + sed -i 's|include.*luci\.mk|include $(TOPDIR)/feeds/luci/luci.mk|' "$feed_dir/$single_package/Makefile" + echo " ✓ Fixed Makefile include path" else print_error "Package $single_package not found or missing Makefile" + cd - > /dev/null return 1 fi else print_info "Copying all packages" - for pkg in ../luci-app-*/; do + for pkg in ../../luci-app-*/; do if [[ -d "$pkg" && -f "${pkg}Makefile" ]]; then local pkg_name=$(basename "$pkg") echo " 📁 $pkg_name" - cp -r "$pkg" "$SDK_DIR/package/" + cp -r "$pkg" "$feed_dir/" + + # Fix Makefile include path for feed structure + sed -i 's|include.*luci\.mk|include $(TOPDIR)/feeds/luci/luci.mk|' "$feed_dir/$pkg_name/Makefile" + echo " ✓ Fixed Makefile include path" fi done fi echo "" - print_info "Packages in SDK:" - ls -d "$SDK_DIR/package/luci-app-"*/ 2>/dev/null || echo "None" + print_info "Packages in feed:" + ls -d "$feed_dir/luci-app-"*/ 2>/dev/null || echo "None" - print_success "Packages copied" + # Update the secubox feed + echo "" + echo "🔄 Updating SecuBox feed index..." + ./scripts/feeds update secubox + + # Install packages from secubox feed + echo "" + echo "📦 Installing packages from SecuBox feed..." + if [[ -n "$single_package" ]]; then + echo " Installing $single_package..." + ./scripts/feeds install "$single_package" + else + for pkg in "$feed_dir"/luci-app-*/; do + if [[ -d "$pkg" ]]; then + local pkg_name=$(basename "$pkg") + echo " Installing $pkg_name..." + ./scripts/feeds install "$pkg_name" 2>&1 | grep -v "WARNING:" || true + fi + done + fi + + cd - > /dev/null + + print_success "Packages copied and installed to feed" return 0 } # Configure packages configure_packages() { + local single_package="$1" + print_header "Configuring Packages" cd "$SDK_DIR" echo "⚙️ Enabling packages..." - for pkg in package/luci-app-*/; do - if [[ -d "$pkg" ]]; then - local pkg_name=$(basename "$pkg") - echo "CONFIG_PACKAGE_${pkg_name}=m" >> .config - print_success "$pkg_name enabled" + if [[ -n "$single_package" ]]; then + # Enable only the specified package + if [[ -d "feeds/secubox/$single_package" ]]; then + echo "CONFIG_PACKAGE_${single_package}=m" >> .config + print_success "$single_package enabled" + else + print_error "Package $single_package not found in feed" + cd - > /dev/null + return 1 fi - done + else + # Enable all SecuBox packages from feed + for pkg in feeds/secubox/luci-app-*/; do + if [[ -d "$pkg" ]]; then + local pkg_name=$(basename "$pkg") + echo "CONFIG_PACKAGE_${pkg_name}=m" >> .config + print_success "$pkg_name enabled" + fi + done + fi make defconfig @@ -530,6 +608,8 @@ configure_packages() { # Build packages build_packages() { + local single_package="$1" + print_header "Building Packages" cd "$SDK_DIR" @@ -539,11 +619,24 @@ build_packages() { local built_list="" local failed_list="" - for pkg in package/luci-app-*/; do - [[ -d "$pkg" ]] || continue - - local pkg_name=$(basename "$pkg") + # Determine which packages to build + local packages_to_build=() + if [[ -n "$single_package" ]]; then + if [[ -d "feeds/secubox/$single_package" ]]; then + packages_to_build=("$single_package") + else + print_error "Package $single_package not found in feed" + cd - > /dev/null + return 1 + fi + else + for pkg in feeds/secubox/luci-app-*/; do + [[ -d "$pkg" ]] && packages_to_build+=("$(basename "$pkg")") + done + fi + # Build packages + for pkg_name in "${packages_to_build[@]}"; do echo "" echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━" echo "📦 Building: $pkg_name" @@ -551,12 +644,14 @@ build_packages() { # Show package contents for debugging echo "📁 Package contents:" - ls -la "$pkg" + ls -la "feeds/secubox/$pkg_name" # Build with timeout (10 minutes per package) local build_log="/tmp/build-${pkg_name}.log" - if timeout 600 make "package/${pkg_name}/compile" V=s -j"$(nproc)" > "$build_log" 2>&1; then + # Build from feed (skip dependency checks for architecture-independent packages) + # These packages are just JavaScript/shell scripts - no compilation needed + if timeout 600 make "package/feeds/secubox/${pkg_name}/compile" V=s -j1 NO_DEPS=1 > "$build_log" 2>&1; then # Check if .ipk was created local ipk_file=$(find bin -name "${pkg_name}*.ipk" 2>/dev/null | head -1) @@ -663,8 +758,8 @@ run_build() { download_sdk || return 1 setup_sdk_feeds || return 1 copy_packages "$single_package" || return 1 - configure_packages || return 1 - build_packages || return 1 + configure_packages "$single_package" || return 1 + build_packages "$single_package" || return 1 collect_artifacts || return 1 print_header "Build Complete!"