1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

compiler: linux tcc fixes

This commit is contained in:
Alexander Medvednikov 2019-10-18 20:49:34 +03:00
parent 1795d34a1f
commit c18578af6f
2 changed files with 14 additions and 4 deletions

3
v.v
View File

@ -7,9 +7,12 @@ module main
import ( import (
compiler compiler
benchmark benchmark
//time
) )
fn main() { fn main() {
//t := time.ticks()
//defer { println(time.ticks() - t) }
// There's no `flags` module yet, so args have to be parsed manually // There's no `flags` module yet, so args have to be parsed manually
args := compiler.env_vflags_and_os_args() args := compiler.env_vflags_and_os_args()
options := args.filter(it.starts_with('-')) options := args.filter(it.starts_with('-'))

View File

@ -56,10 +56,19 @@ fn (v mut V) cc() {
// TCC on Linux by default, unless -cc was provided // TCC on Linux by default, unless -cc was provided
// TODO if -cc = cc, TCC is still used, default compiler should be // TODO if -cc = cc, TCC is still used, default compiler should be
// used instead. // used instead.
//vdir := os.dir(vexe)
$if linux { $if linux {
//tcc_path := '$vdir/thirdparty/tcc/bin/tcc' vdir := os.dir(vexe)
tcc_3rd := '$vdir/thirdparty/tcc/bin/tcc'
//println('tcc third "$tcc_3rd"')
tcc_path := '/var/tmp/tcc/bin/tcc' tcc_path := '/var/tmp/tcc/bin/tcc'
if os.file_exists(tcc_3rd) && !os.file_exists(tcc_path) {
//println('moving tcc')
// if there's tcc in thirdparty/, that means this is
// a prebuilt V_linux.zip.
// Until the libtcc1.a bug is fixed, we neeed to move
// it to /var/tmp/
os.system('mv $vdir/thirdparty/tcc /var/tmp/')
}
if v.pref.ccompiler == 'cc' && os.file_exists(tcc_path) { if v.pref.ccompiler == 'cc' && os.file_exists(tcc_path) {
// TODO tcc bug, needs an empty libtcc1.a fila // TODO tcc bug, needs an empty libtcc1.a fila
//os.mkdir('/var/tmp/tcc/lib/tcc/') //os.mkdir('/var/tmp/tcc/lib/tcc/')
@ -67,8 +76,6 @@ fn (v mut V) cc() {
v.pref.ccompiler = tcc_path v.pref.ccompiler = tcc_path
} }
} }
//linux_host := os.user_os() == 'linux' //linux_host := os.user_os() == 'linux'
v.log('cc() isprod=$v.pref.is_prod outname=$v.out_name') v.log('cc() isprod=$v.pref.is_prod outname=$v.out_name')
mut a := [v.pref.cflags, '-std=gnu11', '-w'] // arguments for the C compiler mut a := [v.pref.cflags, '-std=gnu11', '-w'] // arguments for the C compiler