Skip to content

Commit a023fe3

Browse files
authored
ci: add a vtcc step (check that vtcc, continues to be able to compile with v, and v itself can be compiled with vtcc) (#21000)
1 parent d6236e1 commit a023fe3

File tree

2 files changed

+43
-0
lines changed

2 files changed

+43
-0
lines changed
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
#!/bin/bash
2+
3+
set -ex
4+
5+
function show() {
6+
printf "\u001b[35m$1\u001b[0m\n"
7+
}
8+
9+
show "Prepare"
10+
rm -rf vtcc/
11+
12+
show "Clone vtcc"
13+
git clone https://github.com/felipensp/vtcc --branch stable --quiet vtcc/
14+
du -s vtcc/
15+
## TODO: just `./v vtcc`, later will cause V, to detect the compiler as tcc (which it is), and add `-fwrapv`, which causes the vtcc compiler to panic currently
16+
show "Compile vtcc"
17+
./v -o vtcc/xx vtcc/
18+
ls -la vtcc/xx
19+
./vtcc/xx --version
20+
21+
show "Generate the C file, for the current V version"
22+
./v -o vlang.c cmd/v
23+
ls -la vlang.c
24+
25+
show "Compile the C file with vtcc"
26+
export tcclib=thirdparty/tcc/lib/tcc
27+
export tccinc=$tcclib/include
28+
./vtcc/xx -o v_compiled_with_vtcc vlang.c -L$tcclib -I$tccinc -lc -ldl -pthread -ltcc1 $tcclib/bt-log.o
29+
ls -la v_compiled_with_vtcc
30+
31+
show "Test the resulting V compiler"
32+
./v_compiled_with_vtcc version
33+
./v_compiled_with_vtcc -showcc run examples/hello_world.v
34+
35+
## TODO: this step passes locally, but fails on the main CI:
36+
## show "Compile and run hello with vtcc"
37+
## ./v_compiled_with_vtcc -showcc -cc ./vtcc/xx run examples/hello_world.v
38+
39+
show "Remove the generated temporary files, so the script can be re-run cleanly"
40+
rm -rf v_compiled_with_vtcc vlang.c vtcc/

.github/workflows/v_apps_and_modules_compile_ci.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@ jobs:
2727
sudo apt-get install --quiet -y libgc-dev libsodium-dev libssl-dev sqlite3 libsqlite3-dev libfreetype6-dev libxi-dev libxcursor-dev libgl-dev xfonts-75dpi xfonts-base
2828
sudo apt-get install --quiet -y --no-install-recommends sassc libgit2-dev ## needed by gitly
2929
30+
- name: Test vtcc
31+
run: .github/workflows/compile_v_with_vtcc.sh
32+
3033
- name: Test vsql compilation and examples
3134
run: |
3235
echo "Install vsql"

0 commit comments

Comments
 (0)