Files
ViperC/Tools/linux_link.sh
T
2026-11-07 19:35:29 +08:00

27 lines
732 B
Bash

#!/bin/bash
# linux_link.sh - Windows -> Linux link wrapper for project.linux.vpj.
#
# ViperC emits ELF objects for x86_64-pc-linux-gnu, but Windows has no native
# Linux linker available. Invoke this through WSL:
#
# wsl.exe -d Ubuntu -- bash Tools/linux_link.sh <clang++ args...>
#
# project.linux.vpj sets linker.cmd to exactly that command. WSL starts in the
# calling Windows directory, so the relative script path resolves; every
# Windows path argument (D:/... or D:\...) is converted with wslpath.
set -e
args=()
for a in "$@"; do
case "$a" in
[A-Za-z]:[\\/]*)
args+=("$(wslpath -u "$a")")
;;
*)
args+=("$a")
;;
esac
done
exec clang++ "${args[@]}"