Files
hakorune/build_llvm_wsl.sh
Selfhosting Dev b573c3e5b8 feat: LLVM_SYS_180_PREFIX環境変数削除完了!llvm-harness経路でRust LLVMバインディング不要化達成
🚀 Phase 15.5 MIR Call統一革命 - LLVM環境変数削除フェーズ完了

##  完了内容
- **条件分岐実装**: llvm-harness(デフォルト)はLLVM_SYS_180_PREFIX不要
- **後方互換性維持**: llvm-inkwell-legacy使用時はLLVM_SYS_180_PREFIX必要
- **全ツール統一**: 12個のビルドスクリプト・テストスクリプトを一括更新
- **ドキュメント更新**: ENV_VARS.mdでLLVM feature選択方法を明記

## 🛠️ 更新ファイル
- **コアビルド**: src/runner/build.rs, tools/build_llvm.sh, build_llvm.sh
- **スモークテスト**: tools/llvm_smoke.sh, tools/test/smoke/llvm/ir_phi_empty_check.sh
- **CI設定**: .github/workflows/min-gate.yml
- **Windows版**: build_llvm_wsl.sh, build_llvm_wsl_msvc.sh (cross-compilation)
- **開発ツール**: tools/build_compiler_exe.sh, tools/ny_mir_builder.sh
- **ドキュメント**: docs/development/runtime/ENV_VARS.md

##  技術的成果
- **環境変数削減**: LLVM_SYS_180_PREFIX → 条件付き使用のみ
- **Python LLVM統合**: llvmliteハーネス経路でRust LLVM依存完全除去
- **ビルド簡略化**: デフォルトでllvm-config-18のみ必要
- **動作確認**: tools/llvm_smoke.sh成功 (1648バイト.oファイル生成)

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-24 03:28:24 +09:00

33 lines
1.3 KiB
Bash
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/bin/bash
set -e
echo "Building Nyash with LLVM for Windows from WSL..."
# Windows cross-compilation: Use legacy inkwell approach for cross-platform builds
LLVM_FEATURE=${NYASH_LLVM_FEATURE:-llvm-inkwell-legacy}
if [[ "$LLVM_FEATURE" == "llvm-inkwell-legacy" ]]; then
# Windows側のLLVMを使う (legacy inkwell for cross-compilation)
export LLVM_SYS_180_PREFIX="/mnt/c/Program Files/LLVM"
else
echo "Warning: Cross-compilation typically requires llvm-inkwell-legacy feature"
echo "Consider setting NYASH_LLVM_FEATURE=llvm-inkwell-legacy for Windows builds"
fi
# 追加の環境変数Qt6ビルドで使っていたかもしれない技
export LLVM_SYS_180_FFI_WORKAROUND=1
export CC=x86_64-w64-mingw32-gcc
export CXX=x86_64-w64-mingw32-g++
export AR=x86_64-w64-mingw32-ar
# MinGWターゲットで試すQt6と同じ方法
echo "Trying MinGW target with feature: $LLVM_FEATURE..."
cargo build --target x86_64-pc-windows-gnu --release --features "$LLVM_FEATURE"
# 成功したら実行ファイルの場所を表示
if [ $? -eq 0 ]; then
echo "Build successful!"
echo "Binary at: target/x86_64-pc-windows-gnu/release/nyash.exe"
else
echo "MinGW build failed, trying MSVC target with cargo-xwin..."
cargo xwin build --target x86_64-pc-windows-msvc --release --features "$LLVM_FEATURE"
fi