Build tcc 0.9.27 immediately after tcc 0.9.26.

This commit is contained in:
Andrius Štikonas 2022-12-25 01:49:54 +00:00
parent 278b2390f7
commit 20c2d4c36e
27 changed files with 108 additions and 61 deletions

View file

@ -86,6 +86,15 @@ recompiled 5(!) times to add new features that are required for other
features, namely ``long long`` and ``float``. Each time, the libc is features, namely ``long long`` and ``float``. Each time, the libc is
also recompiled. also recompiled.
tinycc 0.9.27
=============
Now, we compile upstream tcc 0.9.27, the latest release of tinycc, using
the final version of tcc 0.9.26.
From this point onwards, until further notice, all programs are compiled
using tinycc 0.9.27.
Note that now we begin to delve into the realm of old GNU software, Note that now we begin to delve into the realm of old GNU software,
using older versions compilable by tinycc. Prior to this point, all tools using older versions compilable by tinycc. Prior to this point, all tools
have been adapted significantly for the bootstrap; now, we will be using have been adapted significantly for the bootstrap; now, we will be using
@ -120,7 +129,6 @@ patch 2.5.9
``patch`` is a very useful tool at this stage, allowing us to make ``patch`` is a very useful tool at this stage, allowing us to make
significantly more complex edits, including just changes to lines. significantly more complex edits, including just changes to lines.
Luckily, we are able to patch ``patch`` using ``sed`` only.
bzip2 1.0.8 bzip2 1.0.8
=========== ===========
@ -128,17 +136,6 @@ bzip2 1.0.8
``bzip2`` is a compression format that compresses more than ``gzip``. It ``bzip2`` is a compression format that compresses more than ``gzip``. It
is preferred where we can use it, and makes source code sizes smaller. is preferred where we can use it, and makes source code sizes smaller.
tinycc 0.9.27
=============
Now, we compile upstream tcc 0.9.27, the latest release of tinycc, using
the final version of tcc 0.9.26.
From this point onwards, until further notice, all programs are compiled
using tinycc 0.9.27.
We patch tinycc to force static linking.
coreutils 5.0 coreutils 5.0
============= =============
@ -183,6 +180,11 @@ manually modified so that it can be processed by lex from the Heirloom
project (the required modifications are mostly syntactical, plus a few project (the required modifications are mostly syntactical, plus a few
workarounds to avoid some flex advanced features). workarounds to avoid some flex advanced features).
tcc 0.9.27 (patched)
=================
We recompile ``tcc`` against with some patches needed to build musl.
musl 1.1.24 musl 1.1.24
=========== ===========

View file

@ -94,9 +94,10 @@ c69e0197ebc1bf9f9fc68a06d4c649c934784077058c24a484da59a153132816 pkg-config-0.2
8a0248fbf8fe1764580698415cc3628585d4dd054ddf63040f400e18cbaef7a4 sed-4.0.9_0.tar.bz2 8a0248fbf8fe1764580698415cc3628585d4dd054ddf63040f400e18cbaef7a4 sed-4.0.9_0.tar.bz2
b4aec2c2b107562c0d1e173259ad8c4484d1ebedb9ee24faa33a2159bdfd04b6 sed4.8-0_0.x86.xbps b4aec2c2b107562c0d1e173259ad8c4484d1ebedb9ee24faa33a2159bdfd04b6 sed4.8-0_0.x86.xbps
1245905d8942a10cccf21850a521db19c9a65ab35cef4c6bbb72672773851048 tar-1.34_0.tar.bz2 1245905d8942a10cccf21850a521db19c9a65ab35cef4c6bbb72672773851048 tar-1.34_0.tar.bz2
42b8eabbd299737541b57b3aa362eeeb20499449901fc2a4895302ce0117080c tcc-0.9.27_0.tar.bz2 5e7fdb405574717e3759144fab500954817ab8852d2da6111d43cb9fe77f01ac tcc-0.9.27_0.tar.bz2
db57c6ef39965f0562d2aefe3c06571df50ba1265446d97f2714d80518862cef tcc-0.9.27_1.tar.bz2 42b8eabbd299737541b57b3aa362eeeb20499449901fc2a4895302ce0117080c tcc-0.9.27_1.tar.bz2
e2014b844b1a79cda9142a38af0404efd242ae02f77aa286c968e4ad6ad87265 tcc-0.9.27_2.tar.bz2 db57c6ef39965f0562d2aefe3c06571df50ba1265446d97f2714d80518862cef tcc-0.9.27_2.tar.bz2
e2014b844b1a79cda9142a38af0404efd242ae02f77aa286c968e4ad6ad87265 tcc-0.9.27_3.tar.bz2
3a9ee359fe490d64225f14cddeb749dda1a24a1bb39bbc7300336b2fe4419538 texinfo6.7-0_0.x86.xbps 3a9ee359fe490d64225f14cddeb749dda1a24a1bb39bbc7300336b2fe4419538 texinfo6.7-0_0.x86.xbps
bf4a6be34cda165e4c206e852ccc09387f5ae8ea7db6de2db01297cabfa1a486 util-linux-2.19.1_0.tar.bz2 bf4a6be34cda165e4c206e852ccc09387f5ae8ea7db6de2db01297cabfa1a486 util-linux-2.19.1_0.tar.bz2
c091eb91d33ef7b7747800ee3758337f3ef9334f83e294dcddb0e492f7ea6ecf which2.21-0_0.x86.xbps c091eb91d33ef7b7747800ee3758337f3ef9334f83e294dcddb0e492f7ea6ecf which2.21-0_0.x86.xbps

View file

@ -36,6 +36,7 @@ cp /${ARCH_DIR}/bin/M2-Mesoplanet ${bindir}/M2-Mesoplanet
cp /${ARCH_DIR}/bin/M2-Planet ${bindir}/M2-Planet cp /${ARCH_DIR}/bin/M2-Planet ${bindir}/M2-Planet
cp /${ARCH_DIR}/bin/mkdir ${bindir}/mkdir cp /${ARCH_DIR}/bin/mkdir ${bindir}/mkdir
cp /${ARCH_DIR}/bin/sha256sum ${bindir}/sha256sum cp /${ARCH_DIR}/bin/sha256sum ${bindir}/sha256sum
cp /${ARCH_DIR}/bin/unbz2 ${bindir}/unbz2
cp /${ARCH_DIR}/bin/ungz ${bindir}/ungz cp /${ARCH_DIR}/bin/ungz ${bindir}/ungz
cp /${ARCH_DIR}/bin/untar ${bindir}/untar cp /${ARCH_DIR}/bin/untar ${bindir}/untar
cp /${ARCH_DIR}/bin/cp ${bindir}/cp cp /${ARCH_DIR}/bin/cp ${bindir}/cp
@ -55,6 +56,7 @@ chmod 755 ${bindir}/M2-Mesoplanet
chmod 755 ${bindir}/M2-Planet chmod 755 ${bindir}/M2-Planet
chmod 755 ${bindir}/mkdir chmod 755 ${bindir}/mkdir
chmod 755 ${bindir}/sha256sum chmod 755 ${bindir}/sha256sum
chmod 755 ${bindir}/unbz2
chmod 755 ${bindir}/ungz chmod 755 ${bindir}/ungz
chmod 755 ${bindir}/untar chmod 755 ${bindir}/untar
chmod 755 ${bindir}/replace chmod 755 ${bindir}/replace

View file

@ -13,7 +13,7 @@ CFLAGS = \
-Ibuiltins \ -Ibuiltins \
$(COMMON_CFLAGS) $(COMMON_CFLAGS)
LDFLAGS = -L. -Lbuiltins LDFLAGS = -L. -Lbuiltins -static
LIBRARIES = libsh.a builtins/libbuiltins.a libglob.a libtilde.a LIBRARIES = libsh.a builtins/libbuiltins.a libglob.a libtilde.a
SHLIB_FILES = clktck getcwd getenv oslib setlinebuf strcasecmp strerror strtod \ SHLIB_FILES = clktck getcwd getenv oslib setlinebuf strcasecmp strerror strtod \

View file

@ -1 +1 @@
c6fdc2f9e349353cd08ce632fc1a0951826a1266d610b3c3afd60087d28be171 /usr/bin/bzip2 c8aca3a1a941002471bf8f0901808151603e7226b68fe28b78df00353ac9a54e /usr/bin/bzip2

View file

@ -25,7 +25,7 @@ patch -Np0 -i ../../patches/mes-libc.patch
patch -Np0 -i ../../patches/coreutils.patch patch -Np0 -i ../../patches/coreutils.patch
# Build # Build
make CC=tcc AR="tcc -ar" bzip2 make CC=tcc AR="tcc -ar" LDFLAGS="-static" bzip2
# Install # Install
cp bzip2 ${prefix}/bin/bzip2 cp bzip2 ${prefix}/bin/bzip2

View file

@ -12,6 +12,7 @@ VERSION=5.0
CC = tcc CC = tcc
LD = tcc LD = tcc
AR = tcc -ar AR = tcc -ar
LDFLAGS = -static
bindir=$(PREFIX)/bin bindir=$(PREFIX)/bin

View file

@ -5,14 +5,15 @@
# SPDX-License-Identifier: GPL-3.0-or-later # SPDX-License-Identifier: GPL-3.0-or-later
CFLAGS = -DVERSION=\"2.5.11\" CFLAGS = -DVERSION=\"2.5.11\"
LDFLAGS = -static
all: flex all: flex
flex: ccl.o dfa.o ecs.o gen.o main.o misc.o nfa.o parse.o scan.o skel.o sym.o tblcmp.o yylex.o options.o scanopt.o buf.o flex: ccl.o dfa.o ecs.o gen.o main.o misc.o nfa.o parse.o scan.o skel.o sym.o tblcmp.o yylex.o options.o scanopt.o buf.o
tcc -o $@ $^ -ll tcc -o $@ $^ -ll $(LDFLAGS)
flex-tmp: ccl.o dfa.o ecs.o gen.o main.o misc.o nfa.o parse.o scan-tmp.o skel.o sym.o tblcmp.o yylex.o options.o scanopt.o buf.o flex-tmp: ccl.o dfa.o ecs.o gen.o main.o misc.o nfa.o parse.o scan-tmp.o skel.o sym.o tblcmp.o yylex.o options.o scanopt.o buf.o
tcc -o $@ $^ -ll tcc -o $@ $^ -ll $(LDFLAGS)
%.o: %.c %.o: %.c
tcc -g -c $(CFLAGS) -o $@ $< tcc -g -c $(CFLAGS) -o $@ $<

View file

@ -1 +1 @@
df921cd658fd73dc770be62ecf8adfc50761526cbeb5d0161ab68233df142fe1 /usr/bin/gzip 363d9a67c192530a76b41be906a1a22e307f9bc057d520a319f9757cc8f147dc /usr/bin/gzip

View file

@ -5,12 +5,11 @@
CC = tcc CC = tcc
AR = tcc -ar AR = tcc -ar
# -DSIZEOF_UNSIGNED_LONG=4 forces use of simulated arithmetic
# This is to avoid running configure test to determine sizeof(long long)
CPPFLAGS = -DNO_UTIME \ CPPFLAGS = -DNO_UTIME \
-Dstrlwr=unused -Dstrlwr=unused
CFLAGS = -I . -static CFLAGS = -I .
LDFLAGS = -static
.PHONY: all .PHONY: all
@ -20,4 +19,4 @@ GZIP_OBJ = $(addsuffix .o, $(GZIP_SRC))
all: gzip all: gzip
gzip: $(GZIP_OBJ) gzip: $(GZIP_OBJ)
$(CC) $^ -o $@ $(CC) $(LDFLAGS) $^ -o $@

View file

@ -29,7 +29,7 @@ patch -Np0 -i ../../patches/lex_remove_wchar.patch
# Build yacc # Build yacc
cd yacc cd yacc
make -f Makefile.mk CC=tcc AR=tcc\ -ar CFLAGS=-DMAXPATHLEN=100\ -DEILSEQ=84\ -DMB_LEN_MAX=100 LDFLAGS=-lgetopt RANLIB=true make -f Makefile.mk CC=tcc AR=tcc\ -ar CFLAGS=-DMAXPATHLEN=100\ -DEILSEQ=84\ -DMB_LEN_MAX=100 LDFLAGS=-lgetopt\ -static RANLIB=true
# Install yacc # Install yacc
install yacc ${bindir} install yacc ${bindir}
@ -37,7 +37,7 @@ install -m 644 yaccpar /
# Build lex # Build lex
cd ../lex cd ../lex
make -f Makefile.mk CC=tcc AR=tcc\ -ar CFLAGS=-DEILSEQ=84\ -DMB_LEN_MAX=100 LDFLAGS=-lgetopt RANLIB=true make -f Makefile.mk CC=tcc AR=tcc\ -ar CFLAGS=-DEILSEQ=84\ -DMB_LEN_MAX=100 LDFLAGS=-lgetopt\ -static RANLIB=true
# Install lex # Install lex
mkdir ${lexdir} mkdir ${lexdir}

View file

@ -1 +1 @@
3846fe9be3f59a16c688ba2b34e56ec7213239583f505a04aef93f00287bf404 /usr/bin/make 8112529259780fe659ba68030d1ba1a64589ece80d0f328523395029827bd41f /usr/bin/make

View file

@ -14,7 +14,7 @@ mkdir build src
cd build cd build
# Extract # Extract
ungz --file ${distfiles}/${pkg}.tar.gz --output ../src/${pkg}.tar unbz2 --file ${distfiles}/${pkg}.tar.bz2 --output ../src/${pkg}.tar
untar --file ../src/${pkg}.tar untar --file ../src/${pkg}.tar
rm ../src/${pkg}.tar rm ../src/${pkg}.tar
cd ${pkg} cd ${pkg}
@ -51,7 +51,7 @@ tcc -c -Iglob -DSTDC_HEADERS glob/fnmatch.c
tcc -c -Iglob -DHAVE_STRDUP -DHAVE_DIRENT_H glob/glob.c tcc -c -Iglob -DHAVE_STRDUP -DHAVE_DIRENT_H glob/glob.c
# Link # Link
tcc -o ${bindir}/make getopt.o getopt1.o ar.o arscan.o commands.o default.o dir.o expand.o file.o function.o implicit.o job.o main.o misc.o read.o remake.o rule.o signame.o variable.o version.o vpath.o hash.o remote-stub.o getloadavg.o fnmatch.o glob.o tcc -static -o ${bindir}/make getopt.o getopt1.o ar.o arscan.o commands.o default.o dir.o expand.o file.o function.o implicit.o job.o main.o misc.o read.o remake.o rule.o signame.o variable.o version.o vpath.o hash.o remote-stub.o getloadavg.o fnmatch.o glob.o
# Test # Test
make --version make --version

View file

@ -1 +1 @@
https://mirrors.kernel.org/gnu/make/make-3.80.tar.gz 64b30b41fde2ebf669e6af489883fb1df6a06ac30555a96cfa3c39ecce7267dd https://mirrors.kernel.org/gnu/make/make-3.80.tar.bz2 a99b39e7b04c333724f48c38fede709481cfb69fafe7e32ae4285b7fadf92f1b

View file

@ -1 +1 @@
https://mirrors.kernel.org/gnu/make/make-3.82.tar.gz 3d991b33e604187c5881a0abc2e102d5b9776da5569640e73778f85d617242e7 https://mirrors.kernel.org/gnu/make/make-3.82.tar.bz2 e2c1a73f179c40c71e2fe8abf8a8a0688b8499538512984da4a76958d0402966

View file

@ -11,5 +11,5 @@ LDFLAGS = -static
.PHONY: all .PHONY: all
all: patch all: patch
patch: error.o getopt.o getopt1.o addext.o argmatch.o backupfile.o basename.o dirname.o inp.o maketime.o partime.o patch.o pch_patched.o quote.o quotearg.o quotesys.o util.o version.o xmalloc.o patch: error.o getopt.o getopt1.o addext.o argmatch.o backupfile.o basename.o dirname.o inp.o maketime.o partime.o patch.o pch.o quote.o quotearg.o quotesys.o util.o version.o xmalloc.o
$(CC) $^ $(LDFLAGS) -o $@ $(CC) $^ $(LDFLAGS) -o $@

View file

@ -1 +1 @@
265d486bf4712f2af7c55178d990fec39a39dab9f867623a69e9b37c3d516b2f /usr/bin/patch d0633928b5f9892f1db3b84479088c502eeaca3d29ee7de6cd20915917a36d1f /usr/bin/patch

View file

@ -24,10 +24,6 @@ cp ../../mk/main.mk Makefile
catm config.h catm config.h
catm patchlevel.h catm patchlevel.h
# Patch
cp pch.c pch_patched.c
sed -i 841,848d pch_patched.c
# Build # Build
make -f Makefile PREFIX=${prefix} make -f Makefile PREFIX=${prefix}

View file

@ -36,6 +36,12 @@ cd ..
libdir=${libdir}/mes libdir=${libdir}/mes
# tcc 0.9.27
pkg="tcc-0.9.27"
cd ${pkg}
kaem --file ${pkg}.kaem
cd ..
# make # make
pkg="make-3.80" pkg="make-3.80"
cd ${pkg} cd ${pkg}
@ -72,12 +78,6 @@ cd ${pkg}
kaem --file ${pkg}.kaem kaem --file ${pkg}.kaem
cd .. cd ..
# tcc 0.9.27
pkg="tcc-0.9.27"
cd ${pkg}
kaem --file ${pkg}.kaem
cd ..
# coreutils # coreutils
pkg="coreutils-5.0" pkg="coreutils-5.0"
cd ${pkg} cd ${pkg}

View file

@ -100,6 +100,9 @@ mkdir -p "${DESTDIR}" "${SRCDIR}/repo" /dev
build flex-2.5.11 build flex-2.5.11
# Rebuild tcc with some patches
build tcc-0.9.27 tcc-mes-pass2.sh
build musl-1.1.24 build musl-1.1.24
# Rebuild tcc using musl # Rebuild tcc using musl

View file

@ -12,8 +12,8 @@ CPPFLAGS = -DENABLE_NLS=0 \
-DSED_FEATURE_VERSION=\"4.0\" \ -DSED_FEATURE_VERSION=\"4.0\" \
-DVERSION=\"4.0.9\" \ -DVERSION=\"4.0.9\" \
-DPACKAGE=\"sed\" -DPACKAGE=\"sed\"
CFLAGS = -I . -I lib -static CFLAGS = -I . -I lib
LDFLAGS = -L. -lsed LDFLAGS = -L . -lsed -static
.PHONY: all .PHONY: all

View file

@ -1 +1 @@
68b1a0669544cdc8855ba09c3ff6ab19c3c5543a65d8d56c6f0f15b3dc3fa787 /usr/bin/sed cd7cb869b26dd7c2cd0d2b53ab4ef1c2d26a2f16d24ab1f3ff7c3b138fe97469 /usr/bin/sed

View file

@ -15,8 +15,8 @@ CPPFLAGS = -DHAVE_FCNTL_H \
-DVERSION=\"1.12\" \ -DVERSION=\"1.12\" \
-DPACKAGE=\"tar\" -DPACKAGE=\"tar\"
CFLAGS = -I . -I lib -static CFLAGS = -I . -I lib
LDFLAGS = -L. -ltar LDFLAGS = -L . -ltar -static
.PHONY: all .PHONY: all

View file

@ -1 +1 @@
e197c1b35273bafe7b47dd9ae902eb118327bb1fb16d083608e86a065ac01e42 /usr/bin/tar 09465058a104cd100368e6ab610650ab83fe660c6f52d5e3d8b186eaefa689e7 /usr/bin/tar

View file

@ -1 +1 @@
379d94b17a6762b5acd331cb3f216ff57f50ebd46835a1e8cc0117f4062a96dd /usr/bin/tcc dc73141eaa2b75fd6aaa085ef1945577b976ad1304e2875afe98ebc37a4f2f5d /usr/bin/tcc

View file

@ -11,22 +11,19 @@ set -ex
checksum-transcriber sources checksum-transcriber sources
sha256sum -c sources.SHA256SUM sha256sum -c sources.SHA256SUM
mkdir build src
cd build
# Extract # Extract
cp ${distfiles}/${pkg}.tar.bz2 ../src/ mkdir build src
bunzip2 -f ../src/${pkg}.tar.bz2 cd src
tar xf ../src/${pkg}.tar unbz2 --file ${distfiles}/${pkg}.tar.bz2 --output ${pkg}.tar
cd ..
cd build
untar --file ../src/${pkg}.tar
cd ${pkg} cd ${pkg}
# Create config.h # Create config.h
catm config.h catm config.h
# Patch
patch -Np0 -i ../../patches/static-link.patch
patch -Np0 -i ../../patches/ignore-static-inside-array.patch
# Compile # Compile
tcc-0.9.26 \ tcc-0.9.26 \
-v \ -v \

View file

@ -0,0 +1,45 @@
# SPDX-FileCopyrightText: 2021-2022 Andrius Štikonas <andrius@stikonas.eu>
# SPDX-FileCopyrightText: 2022 fosslinux <fosslinux@aussies.space>
#
# SPDX-License-Identifier: GPL-3.0-or-later
src_prepare() {
default
touch config.h
}
src_compile() {
export libdir=${PREFIX}/lib/mes
export incdir=${PREFIX}/include/
export bindir=${PREFIX}/bin
mkdir -p "${libdir}/tcc"
# We have to compile using tcc-0.9.26 as tcc-0.9.27 is not self-hosting when built with mes
tcc-0.9.26 \
-v \
-static \
-o tcc \
-D TCC_TARGET_I386=1 \
-D CONFIG_TCCDIR=\""${libdir}/tcc"\" \
-D CONFIG_TCC_CRTPREFIX=\""${libdir}"\" \
-D CONFIG_TCC_ELFINTERP=\"/mes/loader\" \
-D CONFIG_TCC_LIBPATHS=\""${libdir}:${libdir}/tcc"\" \
-D CONFIG_TCC_SYSINCLUDEPATHS=\""${incdir}"\" \
-D TCC_LIBGCC=\""${libdir}/libc.a"\" \
-D CONFIG_TCC_STATIC=1 \
-D CONFIG_USE_LIBGCC=1 \
-D TCC_VERSION=\"0.9.27\" \
-D ONE_SOURCE=1 \
tcc.c
# libtcc1.a
tcc-0.9.26 -c -D HAVE_CONFIG_H=1 lib/libtcc1.c
tcc-0.9.26 -ar cr "${libdir}/tcc/libtcc1.a" libtcc1.o
}
src_install() {
# Remove old tcc binaries
install -D tcc "${DESTDIR}${bindir}/tcc"
}