Avi Halachmi wrote in
https://repo.or.cz/tinycc.git/commitdiff/4fccaf61241a5eb72b0777b3a44bd7abbea48604
Reasons for the revert:
1. The commit message is lacking and the use case is not obvious.
At the very least a concrete example of use case should be given
(likely cross-building tcc on platform X for running on platform Y),
I'd maybe like too to see a concrete example of
"cross-building tcc on platform X for running on platform Y"
but it's probably not that simple and currently unsupported
by the tcc build scripts.
The possible workaround is basically a two step procedure with two
variants:
1) build a tcc cross-compiler and use that to build libtcc1.a
1a) ./configure
make cross-<target>
mv <target>-libtcc1.a libtcc1.a
(possibly using config-extra.mak for target path options)
1b) ./configure --cpu=<target> ...
make tcc libtcc1.a
mv tcc <target>-tcc
(possibly using configure options for paths etc.)
2) and then cross-build the tcc executable in a second step using
either the cross-tcc from step 1) or a cross-gcc
./configure --cpu=<target> --cc=./<target>-tcc ... && make tcc
In such scenario a "BUILD_CC" is not really needed since c2str/tccdefs_.h
are already built natively in step 1).
Still, why not, for example just in the most minimal form of
BUILD_CC ?= $(CC) # compiler to build the 'c2str' tool
in the Makefile, which one can use in a basic form like
$ make BUILD_CC=gcc ...
Below is an example to make a tcc package to run under termux on a
smartphone (variant 1b, using only tcc itself).
-- gr
MAKE_N = @$(MAKE) --no-print-directory
TERMUX_PREFIX = /data/data/com.termux/files/usr
DESTDIR = .$(TERMUX_PREFIX)
X = arm-eabi
TAR = $(X)-bin.tar.bz2
NDK_P = .../NDK/sysroot/usr
LIB_P = {B}:{R}/lib:{R}/../system/lib
INC_P = {B}/include:{R}/include:{R}/include/arm-linux-androideabi
CRT_P = {R}/lib
TCC_SW = -Wl,-rpath=$(TERMUX_PREFIX)/lib
tinycc-bin-tar :
./configure --targetos=Termux --cpu=arm --cc=tcc --config-static \
--tccdir="." \
--sysroot="$(NDK_P)" \
--libpaths="$(LIB_P)" \
--sysincludepaths="$(INC_P)" \
--crtprefix="$(CRT_P)" \
--tcc-switches="$(TCC_SW)"
$(MAKE_N) ONE_SOURCE=yes tcc libtcc1.a
mv tcc $(X)-tcc
rm tcc.o libtcc.o libtcc.a
./configure --targetos=Termux --cpu=arm --cc=./$(X)-tcc
$(MAKE_N) ONE_SOURCE=yes tcc
$(MAKE_N) install DESTDIR=.
cd $(DESTDIR)/.. && tar -cjf $(CURDIR)/$(TAR) usr
_______________________________________________
Tinycc-devel mailing list
[email protected]
https://lists.nongnu.org/mailman/listinfo/tinycc-devel