From c18578af6f71c2709928e23c1e4377f9e19e88b0 Mon Sep 17 00:00:00 2001 From: Alexander Medvednikov Date: Fri, 18 Oct 2019 20:49:34 +0300 Subject: [PATCH] compiler: linux tcc fixes --- v.v | 3 +++ vlib/compiler/cc.v | 15 +++++++++++---- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/v.v b/v.v index e95431530f..1882bf8c67 100755 --- a/v.v +++ b/v.v @@ -7,9 +7,12 @@ module main import ( compiler benchmark + //time ) fn main() { + //t := time.ticks() + //defer { println(time.ticks() - t) } // There's no `flags` module yet, so args have to be parsed manually args := compiler.env_vflags_and_os_args() options := args.filter(it.starts_with('-')) diff --git a/vlib/compiler/cc.v b/vlib/compiler/cc.v index 0959a9585a..34f63fd778 100644 --- a/vlib/compiler/cc.v +++ b/vlib/compiler/cc.v @@ -56,10 +56,19 @@ fn (v mut V) cc() { // TCC on Linux by default, unless -cc was provided // TODO if -cc = cc, TCC is still used, default compiler should be // used instead. - //vdir := os.dir(vexe) $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' + 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) { // TODO tcc bug, needs an empty libtcc1.a fila //os.mkdir('/var/tmp/tcc/lib/tcc/') @@ -67,8 +76,6 @@ fn (v mut V) cc() { v.pref.ccompiler = tcc_path } } - - //linux_host := os.user_os() == 'linux' 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