me

/

vinix-ports Public
382 commits 0 issues 0 pull requests 1 contributor Discussions Projects Snippets LOC history Platform CI

vinix-cc: select the C++ compiler through vinix-c++

diviocity committed 6 days ago · 839ef6fbbb2698ccd494375d6833e7c4458c9b0c View patch
Unverified signature 2 files changed +11 -4
README.md +1 -0

@@ -36,6 +36,7 @@ cp -R musl busybox "$work/"

36export MAKEFLAGS=-j1

137v -o "$work/feed" tests/feed.v

238v -o "$work/vinix-cc" tools/vinix-cc.v

39+ln -s vinix-cc "$work/vinix-c++"

340export PATH="$work:$PATH"

441vpac --native-build "$work/musl/PKGBUILD.vile" "$work/musl.txt"

542"$work/feed" keys "$work/test-keys"

tools/vinix-cc.v +10 -4

@@ -5,21 +5,27 @@ module main

55import os

66

77fn main() {

8+ driver := os.base(os.args[0])

89 root := os.getenv('VPAC_MAKEPKG_ROOT')

910 if !os.is_abs_path(root) {

10- eprintln('vinix-cc requires an absolute VPAC_MAKEPKG_ROOT')

11+ eprintln('${driver} requires an absolute VPAC_MAKEPKG_ROOT')

1112 exit(1)

1213 }

1314 specs := os.join_path(root, 'usr/lib/musl-gcc-sysroot.specs')

1415 if !os.is_file(specs) {

15- eprintln('vinix-cc: missing installed musl specs at ${specs}')

16+ eprintln('${driver}: missing installed musl specs at ${specs}')

1617 exit(1)

1718 }

18- compiler := os.getenv_opt('VINIX_REAL_CC') or { os.getenv('CROSS_COMPILE') + 'gcc' }

19+ prefix := os.getenv('CROSS_COMPILE')

20+ compiler := if driver == 'vinix-c++' {

21+ os.getenv_opt('VINIX_REAL_CXX') or { prefix + 'g++' }

22+ } else {

23+ os.getenv_opt('VINIX_REAL_CC') or { prefix + 'gcc' }

24+ }

1925 mut args := ['--sysroot=${root}', '-specs=${specs}']

2026 args << os.args[1..]

2127 os.execvp(compiler, args) or {

22- eprintln('vinix-cc: ${compiler}: ${err}')

28+ eprintln('${driver}: ${compiler}: ${err}')

2329 exit(1)

2430 }

2531}