mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
use tcc on linux by default
This commit is contained in:
parent
efe03a39cc
commit
9845fade89
2
Makefile
2
Makefile
@ -16,6 +16,8 @@ ifdef WIN32
|
||||
./v0.exe -o v.exe compiler
|
||||
rm -f v0.exe
|
||||
else
|
||||
git clone --depth 1 --quiet https://github.com/vmisc/tccbin /var/tmp/tcc
|
||||
|
||||
$(CC) -std=gnu11 -w -o v vc/v.c -lm
|
||||
@(VC_V=`./v version | cut -f 3 -d " "`; \
|
||||
V_V=`git rev-parse --short HEAD`; \
|
||||
|
@ -11,13 +11,13 @@ import (
|
||||
|
||||
fn (v mut V) cc() {
|
||||
v.build_thirdparty_obj_files()
|
||||
vexe := os.executable()
|
||||
// Just create a C/JavaScript file and exit
|
||||
// for example: `v -o v.c compiler`
|
||||
if v.out_name.ends_with('.c') || v.out_name.ends_with('.js') {
|
||||
// Translating V code to JS by launching vjs
|
||||
$if !js {
|
||||
if v.out_name.ends_with('.js') {
|
||||
vexe := os.executable()
|
||||
vjs_path := vexe + 'js'
|
||||
dir := os.dir(vexe)
|
||||
if !os.file_exists(vjs_path) {
|
||||
@ -53,6 +53,21 @@ fn (v mut V) cc() {
|
||||
return
|
||||
}
|
||||
}
|
||||
// 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'
|
||||
tcc_path := '/var/tmp/tcc/bin/tcc'
|
||||
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/')
|
||||
//os.create('/var/tmp/tcc/lib/tcc/libtcc1.a')
|
||||
v.pref.ccompiler = tcc_path
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//linux_host := os.user_os() == 'linux'
|
||||
v.log('cc() isprod=$v.pref.is_prod outname=$v.out_name')
|
||||
@ -117,7 +132,6 @@ fn (v mut V) cc() {
|
||||
a << '-c'
|
||||
}
|
||||
else if v.pref.is_cache {
|
||||
vexe := os.executable()
|
||||
builtin_o_path := '$v_modules_path${os.path_separator}cache${os.path_separator}vlib${os.path_separator}builtin.o'
|
||||
if os.file_exists(builtin_o_path) {
|
||||
libs = builtin_o_path
|
||||
|
Loading…
Reference in New Issue
Block a user