@@ -400,51 +400,53 @@ jobs:
400400
401401 export V=1
402402
403+ # Prevent timeout killing build
403404 ( while true; do echo "❤️ still building mac depends…"; sleep 60; done ) &
404405
405- echo "▶ Installing universal auto-detect compiler wrappers…"
406+ echo "▶ Installing auto-detect compiler wrappers…"
406407 mkdir -p autodetect
407- TOOLFILE="autodetect/.toolchain"
408408
409409 create_wrapper() {
410- local WRAP="$1"
411- cat <<'EOF' > "autodetect/$WRAP"
412- #!/bin/bash
413- WRAPDIR="$(cd "$(dirname "$0")" && pwd)"
414-
415- # If toolchain already detected → use it
416- if [ -f "$WRAPDIR/.toolchain" ]; then
417- REALDIR="$(cat "$WRAPDIR/.toolchain")"
418- exec "$REALDIR/$(basename $0)" "$@"
419- fi
410+ WRAP="$1"
411+ # IMPORTANT: heredoc MUST start at column 0 inside the script.
412+ cat <<'EOF' > autodetect/$WRAP
413+ #!/bin/bash
414+ WRAPDIR="$(cd "$(dirname "$0")" && pwd)"
415+
416+ # Use cached toolchain if already detected
417+ if [ -f "$WRAPDIR/.toolchain" ]; then
418+ REALDIR="$(cat "$WRAPDIR/.toolchain")"
419+ exec "$REALDIR/$(basename "$0")" "$@"
420+ fi
420421
421- # Search for clang toolchain inside depends
422- FOUND=$(find depends -maxdepth 7 -type f -name clang 2>/dev/null | grep native | head -n1)
422+ # Search for Darwin clang produced by native_cctools
423+ FOUND=$(find depends -maxdepth 7 -type f -name clang 2>/dev/null | grep native | head -n1)
423424
424- if [ -n "$FOUND" ]; then
425- REALDIR="$(dirname "$FOUND")"
426- echo "$REALDIR" > "$WRAPDIR/.toolchain"
427- echo "🚀 Auto-detected Darwin compiler at: $REALDIR"
428- exec "$REALDIR/$(basename $0 )" "$@"
429- fi
425+ if [ -n "$FOUND" ]; then
426+ REALDIR="$(dirname "$FOUND")"
427+ echo "$REALDIR" > "$WRAPDIR/.toolchain"
428+ echo "🚀 Auto-detected Darwin compiler at: $REALDIR"
429+ exec "$REALDIR/$(basename "$0" )" "$@"
430+ fi
430431
431- # Temporary fallback until toolchain builds
432- exec /usr/bin/gcc "$@"
433- EOF
434- chmod +x " autodetect/$WRAP"
435- }
432+ # Fallback: use GCC until toolchain is built
433+ exec /usr/bin/gcc "$@"
434+ EOF
435+ chmod +x autodetect/$WRAP
436+ }
436437
437- create_wrapper clang
438- create_wrapper clang++
439- create_wrapper cc
440- create_wrapper gcc
438+ # Generate wrapper binaries
439+ create_wrapper clang
440+ create_wrapper clang++
441+ create_wrapper cc
442+ create_wrapper gcc
441443
442- export PATH="$(pwd)/autodetect:$PATH"
444+ export PATH="$(pwd)/autodetect:$PATH"
443445
444- echo "▶ PATH = $PATH"
446+ echo "▶ PATH = $PATH"
447+ echo "▶ Building depends for macOS…"
445448
446- echo "▶ Building macOS depends…"
447- make $MAKEJOBS -C depends HOST=x86_64-apple-darwin11
449+ make $MAKEJOBS -C depends HOST=x86_64-apple-darwin11
448450
449451 - name : Build AdventureCoin
450452 env :
0 commit comments