diff --git a/.github/workflows/compile_v_with_vtcc.sh b/.github/workflows/compile_v_with_vtcc.sh new file mode 100755 index 00000000000000..d3476d79c6a435 --- /dev/null +++ b/.github/workflows/compile_v_with_vtcc.sh @@ -0,0 +1,40 @@ +#!/bin/bash + +set -ex + +function show() { + printf "\u001b[35m$1\u001b[0m\n" +} + +show "Prepare" +rm -rf vtcc/ + +show "Clone vtcc" +git clone https://github.com/felipensp/vtcc --branch stable --quiet vtcc/ +du -s vtcc/ +## 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 +show "Compile vtcc" +./v -o vtcc/xx vtcc/ +ls -la vtcc/xx +./vtcc/xx --version + +show "Generate the C file, for the current V version" +./v -o vlang.c cmd/v +ls -la vlang.c + +show "Compile the C file with vtcc" +export tcclib=thirdparty/tcc/lib/tcc +export tccinc=$tcclib/include +./vtcc/xx -o v_compiled_with_vtcc vlang.c -L$tcclib -I$tccinc -lc -ldl -pthread -ltcc1 $tcclib/bt-log.o +ls -la v_compiled_with_vtcc + +show "Test the resulting V compiler" +./v_compiled_with_vtcc version +./v_compiled_with_vtcc -showcc run examples/hello_world.v + +## TODO: this step passes locally, but fails on the main CI: +## show "Compile and run hello with vtcc" +## ./v_compiled_with_vtcc -showcc -cc ./vtcc/xx run examples/hello_world.v + +show "Remove the generated temporary files, so the script can be re-run cleanly" +rm -rf v_compiled_with_vtcc vlang.c vtcc/ diff --git a/.github/workflows/v_apps_and_modules_compile_ci.yml b/.github/workflows/v_apps_and_modules_compile_ci.yml index b285368ca6706a..fa9079e937854e 100644 --- a/.github/workflows/v_apps_and_modules_compile_ci.yml +++ b/.github/workflows/v_apps_and_modules_compile_ci.yml @@ -27,6 +27,9 @@ jobs: 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 sudo apt-get install --quiet -y --no-install-recommends sassc libgit2-dev ## needed by gitly + - name: Test vtcc + run: .github/workflows/compile_v_with_vtcc.sh + - name: Test vsql compilation and examples run: | echo "Install vsql"