1
0
mirror of https://github.com/rkd77/elinks.git synced 2024-06-15 23:35:34 +00:00

[tcc] Wrapper for tcc to use with meson

meson does not support tcc yet, but with this wrapper you can build
elinks (no js version) with meson and save a few seconds.
This wrapper pretends to be gcc for meson.
While compiling it filters unsupported options, and execute tcc.

Compile it as:
gcc -O2 -o elinks_tcc elinks_tcc.c

Here is my mes_tcc.sh:
rm -rf /dev/shm/builddir2
export C_INCLUDE_PATH=/usr/local/lib/tcc/include:$HOME/include:/usr/include:/usr/local/include
CPPFLAGS="-I$HOME/include" \
CC=elinks_tcc \
meson setup /dev/shm/builddir2 \
-D88-colors=false \
-D256-colors=true \
-Dapidoc=false \
-Dbacktrace=false \
-Dbittorrent=false \
-Dbookmarks=false \
-Dbrotli=true \
-Dbzlib=false \
-Dcgi=true \
-Dcombining=true \
-Dfastmem=true \
-Dgemini=true \
-Dgettext=true \
-Dgnutls=true \
-Dgopher=true \
-Dgpm=false \
-Dguile=false \
-Dhtmldoc=false \
-Dlibcss=true \
-Dlibev=false \
-Dlibevent=true \
-Dopenssl=false \
-Dluapkg='luajit' \
-Dlzma=false \
-Dnls=true \
-Dnntp=false \
-Dpdfdoc=false \
-Dperl=false \
-Dprefix=$HOME \
-Dpython=false \
-Druby=false \
-Dsm-scripting=false \
-Dspidermonkey=false \
-Dterminfo=true \
-Dtre=false \
-Dtrue-color=true \
-Dutf-8=true \
-Dwithdebug=false \
-Dx=false \
-Dzlib=true \
-Dzstd=true

ninja -C /dev/shm/builddir2
This commit is contained in:
Witold Filipczyk 2023-11-29 16:05:21 +01:00
parent a5d2119dbf
commit 33c30a7840

52
contrib/tcc/elinks_tcc.c Normal file
View File

@ -0,0 +1,52 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
int
main(int argc, char **argv)
{
int i,j;
#if 0
FILE *log = fopen("/dev/shm/log", "a");
fprintf(log, "Before:\n");
for (i = 0; i <= argc; i++) {
fprintf(log, "argv[%d]=%s\n", i, argv[i]);
}
fprintf(log, "----\n");
fclose(log);
#endif
argv[0] = "tcc";
if (argc > 1) {
if (!strcmp(argv[1], "--version")) {
argv[0] = "gcc";
} else if (!strcmp(argv[1], "-Wl,--version")) {
argv[0] = "gcc";
} else {
for (i = 1, j = 1; i < argc;) {
if (!strcmp(argv[j], "-MQ") || !strcmp(argv[j], "-MF")) {
j += 2;
argc -= 2;
} else if (!strcmp(argv[j], "-Wl,--no-undefined") || !strcmp(argv[j], "-Wl,--start-group") || !strcmp(argv[j], "-Wl,--end-group")
|| !strncmp(argv[j], "-Wl,-rpath-link,", sizeof("-Wl,-rpath-link,") - 1)) {
++j;
--argc;
} else {
argv[i++] = argv[j++];
}
}
argv[i] = argv[j];
}
}
#if 0
log = fopen("/dev/shm/log", "a");
fprintf(log, "After\n");
for (i = 0; i <= argc; i++) {
fprintf(log, "argv[%d]=%s\n", i, argv[i]);
}
fprintf(log, "----\n");
fclose(log);
#endif
return execvp(argv[0], argv);
}