// A single compiler name for build systems such as libtool that independently // expand CC and its arguments. Repeating musl's specs option makes GCC fail. module main import os fn main() { driver := os.base(os.args[0]) root := os.getenv('VPAC_MAKEPKG_ROOT') if !os.is_abs_path(root) { eprintln('${driver} requires an absolute VPAC_MAKEPKG_ROOT') exit(1) } specs := os.join_path(root, 'usr/lib/musl-gcc-sysroot.specs') if !os.is_file(specs) { eprintln('${driver}: missing installed musl specs at ${specs}') exit(1) } prefix := os.getenv('CROSS_COMPILE') compiler := if driver == 'vinix-c++' { os.getenv_opt('VINIX_REAL_CXX') or { prefix + 'g++' } } else { os.getenv_opt('VINIX_REAL_CC') or { prefix + 'gcc' } } mut args := ['--sysroot=${root}', '-specs=${specs}'] args << os.args[1..] os.execvp(compiler, args) or { eprintln('${driver}: ${compiler}: ${err}') exit(1) } }