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