live-bootstrap/sysa/tcc-0.9.26/tcc-0.9.26.kaem

411 lines
16 KiB
Bash
Executable File

#!/bin/sh
# SPDX-FileCopyrightText: 2021-22 fosslinux <fosslinux@aussies.space>
#
# SPDX-License-Identifier: GPL-3.0-or-later
set -ex
# Vars
MES_STACK=15000000
MES_ARENA=30000000
MES_MAX_ARENA=30000000
MES_LIB=${MES_PREFIX}/lib
MES_SOURCE=${MES_PREFIX}
MES=${bindir}/mes
TCC_TAR=tcc-0.9.26
TCC_PKG=tcc-0.9.26-1136-g5bba73cc
# Unpack
mkdir src build
cp ${distfiles}/${TCC_TAR}.tar.gz src
cp ${distfiles}/${MES_PKG}.tar.gz src
cd src
ungz ${TCC_TAR}.tar.gz
ungz ${MES_PKG}.tar.gz
cd ..
cd build
untar ../src/${TCC_TAR}.tar
untar ../src/${MES_PKG}.tar
# Create config.h
cd ${TCC_PKG}
catm config.h
${MES} --no-auto-compile -e main ${bindir}/mescc.scm -- \
-S \
-o tcc.s \
-I ${incdir} \
-D BOOTSTRAP=1 \
-I . \
-D TCC_TARGET_I386=1 \
-D inline= \
-D CONFIG_TCCDIR=\"${libdir}/mes/tcc\" \
-D CONFIG_SYSROOT=\"/\" \
-D CONFIG_TCC_CRTPREFIX=\"${libdir}/mes\" \
-D CONFIG_TCC_ELFINTERP=\"/mes/loader\" \
-D CONFIG_TCC_SYSINCLUDEPATHS=\"${prefix}/mes/include:${prefix}/include\" \
-D TCC_LIBGCC=\"${libdir}/mes/libc.a\" \
-D CONFIG_TCC_LIBTCC1_MES=0 \
-D CONFIG_TCCBOOT=1 \
-D CONFIG_TCC_STATIC=1 \
-D CONFIG_USE_LIBGCC=1 \
-D TCC_MES_LIBC=1 \
-D TCC_VERSION=\"0.9.26\" \
-D ONE_SOURCE=1 \
tcc.c
${MES} --no-auto-compile -e main ${bindir}/mescc.scm -- \
-o mes-tcc \
-L ${libdir} \
tcc.s \
-l c+tcc
cp mes-tcc ${bindir}/
chmod 755 ${bindir}/mes-tcc
# Install libc into a subdirectory
libdir=${libdir}/mes
mkdir ${libdir}
# test mes-tcc
mes-tcc -version
# Recompile the mes C library
cd ../${MES_PKG_DIR}
# Create unified libc file
cd lib
catm ../unified-libc.c ctype/isalnum.c ctype/isalpha.c ctype/isascii.c ctype/iscntrl.c ctype/isdigit.c ctype/isgraph.c ctype/islower.c ctype/isnumber.c ctype/isprint.c ctype/ispunct.c ctype/isspace.c ctype/isupper.c ctype/isxdigit.c ctype/tolower.c ctype/toupper.c dirent/closedir.c dirent/__getdirentries.c dirent/opendir.c dirent/readdir.c linux/access.c linux/brk.c linux/chdir.c linux/chmod.c linux/clock_gettime.c linux/close.c linux/dup2.c linux/dup.c linux/execve.c linux/fcntl.c linux/fork.c linux/fsync.c linux/fstat.c linux/_getcwd.c linux/getdents.c linux/getegid.c linux/geteuid.c linux/getgid.c linux/getpid.c linux/getppid.c linux/getrusage.c linux/gettimeofday.c linux/getuid.c linux/ioctl.c linux/ioctl3.c linux/kill.c linux/link.c linux/lseek.c linux/lstat.c linux/malloc.c linux/mkdir.c linux/mknod.c linux/nanosleep.c linux/_open3.c linux/pipe.c linux/_read.c linux/readlink.c linux/rename.c linux/rmdir.c linux/setgid.c linux/settimer.c linux/setuid.c linux/signal.c linux/sigprogmask.c linux/symlink.c linux/stat.c linux/time.c linux/unlink.c linux/waitpid.c linux/x86-mes-gcc/_exit.c linux/x86-mes-gcc/syscall.c linux/x86-mes-gcc/_write.c math/ceil.c math/fabs.c math/floor.c mes/abtod.c mes/abtol.c mes/__assert_fail.c mes/assert_msg.c mes/__buffered_read.c mes/cast.c mes/dtoab.c mes/eputc.c mes/eputs.c mes/fdgetc.c mes/fdgets.c mes/fdputc.c mes/fdputs.c mes/fdungetc.c mes/globals.c mes/itoa.c mes/ltoab.c mes/ltoa.c mes/__mes_debug.c mes/mes_open.c mes/ntoab.c mes/oputc.c mes/oputs.c mes/search-path.c mes/ultoa.c mes/utoa.c posix/alarm.c posix/buffered-read.c posix/execl.c posix/execlp.c posix/execv.c posix/execvp.c posix/getcwd.c posix/getenv.c posix/isatty.c posix/mktemp.c posix/open.c posix/raise.c posix/sbrk.c posix/setenv.c posix/sleep.c posix/unsetenv.c posix/wait.c posix/write.c stdio/clearerr.c stdio/fclose.c stdio/fdopen.c stdio/feof.c stdio/ferror.c stdio/fflush.c stdio/fgetc.c stdio/fgets.c stdio/fileno.c stdio/fopen.c stdio/fprintf.c stdio/fputc.c stdio/fputs.c stdio/fread.c stdio/freopen.c stdio/fscanf.c stdio/fseek.c stdio/ftell.c stdio/fwrite.c stdio/getc.c stdio/getchar.c stdio/perror.c stdio/printf.c stdio/putc.c stdio/putchar.c stdio/remove.c stdio/snprintf.c stdio/sprintf.c stdio/sscanf.c stdio/ungetc.c stdio/vfprintf.c stdio/vfscanf.c stdio/vprintf.c stdio/vsnprintf.c stdio/vsprintf.c stdio/vsscanf.c stdlib/abort.c stdlib/abs.c stdlib/alloca.c stdlib/atexit.c stdlib/atof.c stdlib/atoi.c stdlib/atol.c stdlib/calloc.c stdlib/__exit.c stdlib/exit.c stdlib/free.c stdlib/mbstowcs.c stdlib/puts.c stdlib/qsort.c stdlib/realloc.c stdlib/strtod.c stdlib/strtof.c stdlib/strtol.c stdlib/strtold.c stdlib/strtoll.c stdlib/strtoul.c stdlib/strtoull.c string/bcmp.c string/bcopy.c string/bzero.c string/index.c string/memchr.c string/memcmp.c string/memcpy.c string/memmem.c string/memmove.c string/memset.c string/rindex.c string/strcat.c string/strchr.c string/strcmp.c string/strcpy.c string/strcspn.c string/strdup.c string/strerror.c string/strlen.c string/strlwr.c string/strncat.c string/strncmp.c string/strncpy.c string/strpbrk.c string/strrchr.c string/strspn.c string/strstr.c string/strupr.c stub/atan2.c stub/bsearch.c stub/chown.c stub/__cleanup.c stub/cos.c stub/ctime.c stub/exp.c stub/fpurge.c stub/freadahead.c stub/frexp.c stub/getgrgid.c stub/getgrnam.c stub/getlogin.c stub/getpgid.c stub/getpgrp.c stub/getpwnam.c stub/getpwuid.c stub/gmtime.c stub/ldexp.c stub/localtime.c stub/log.c stub/mktime.c stub/modf.c stub/mprotect.c stub/pclose.c stub/popen.c stub/pow.c stub/rand.c stub/rewind.c stub/setbuf.c stub/setgrent.c stub/setlocale.c stub/setvbuf.c stub/sigaction.c stub/sigaddset.c stub/sigblock.c stub/sigdelset.c stub/sigemptyset.c stub/sigsetmask.c stub/sin.c stub/sys_siglist.c stub/system.c stub/sqrt.c stub/strftime.c stub/times.c stub/ttyname.c stub/umask.c stub/utime.c x86-mes-gcc/setjmp.c
cd ..
# crt1.o
mes-tcc -c -D HAVE_CONFIG_H=1 -I include -I include/linux/x86 -o ${libdir}/crt1.o lib/linux/x86-mes-gcc/crt1.c
# crtn.o
mes-tcc -c -D HAVE_CONFIG_H=1 -I include -I include/linux/x86 -o ${libdir}/crtn.o lib/linux/x86-mes-gcc/crtn.c
# crti.o
mes-tcc -c -D HAVE_CONFIG_H=1 -I include -I include/linux/x86 -o ${libdir}/crti.o lib/linux/x86-mes-gcc/crti.c
# libc+gcc.a
mes-tcc -c -D HAVE_CONFIG_H=1 -I include -I include/linux/x86 -o unified-libc.o unified-libc.c
mes-tcc -ar cr ${libdir}/libc.a unified-libc.o
# libtcc1.a
mkdir ${libdir}/tcc
mes-tcc -c -D HAVE_CONFIG_H=1 -I include -I include/linux/x86 lib/libtcc1.c
mes-tcc -ar cr ${libdir}/tcc/libtcc1.a libtcc1.o
# libgetopt.a
mes-tcc -c -D HAVE_CONFIG_H=1 -I include -I include/linux/x86 lib/posix/getopt.c
mes-tcc -ar cr ${libdir}/libgetopt.a getopt.o
cd ../${TCC_PKG}
# boot0 (ref comments here for all boot*)
# compile
mes-tcc \
-g \
-v \
-static \
-o boot0-tcc \
-D BOOTSTRAP=1 \
-D HAVE_LONG_LONG_STUB=1 \
-D HAVE_SETJMP=1 \
-I . \
-I ${prefix}/include \
-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=\"${prefix}/include\" \
-D TCC_LIBGCC=\"${libdir}/libc.a\" \
-D TCC_LIBTCC1=\"libtcc1.a\" \
-D CONFIG_TCCBOOT=1 \
-D CONFIG_TCC_STATIC=1 \
-D CONFIG_USE_LIBGCC=1 \
-D TCC_MES_LIBC=1 \
-D TCC_VERSION=\"0.9.26\" \
-D ONE_SOURCE=1 \
-L . \
-L ${libdir} \
tcc.c
# Install
cp boot0-tcc ${bindir}/
chmod 755 ${bindir}/boot0-tcc
cd ../${MES_PKG_DIR}
# Recompile libc: crt{1,n,i}, libtcc.a, libc.a
boot0-tcc -c -D HAVE_CONFIG_H=1 -I include -I include/linux/x86 -o ${libdir}/crt1.o lib/linux/x86-mes-gcc/crt1.c
boot0-tcc -c -D HAVE_CONFIG_H=1 -I include -I include/linux/x86 -o ${libdir}/crtn.o lib/linux/x86-mes-gcc/crtn.c
boot0-tcc -c -D HAVE_CONFIG_H=1 -I include -I include/linux/x86 -o ${libdir}/crti.o lib/linux/x86-mes-gcc/crti.c
boot0-tcc -c -D HAVE_CONFIG_H=1 -D HAVE_LONG_LONG_STUB=1 -I include -I include/linux/x86 lib/libtcc1.c
boot0-tcc -c -D TCC_TARGET_I386=1 ../${TCC_PKG}/lib/libtcc1.c
boot0-tcc -ar cr ${libdir}/tcc/libtcc1.a libtcc1.o
boot0-tcc -c -D HAVE_CONFIG_H=1 -I include -I include/linux/x86 -o unified-libc.o unified-libc.c
boot0-tcc -ar cr ${libdir}/libc.a unified-libc.o
cd ../${TCC_PKG}
# Test boot0
boot0-tcc -version
# boot1
boot0-tcc \
-g \
-v \
-static \
-o boot1-tcc \
-D BOOTSTRAP=1 \
-D HAVE_BITFIELD=1 \
-D HAVE_LONG_LONG=1 \
-D HAVE_SETJMP=1 \
-I . \
-I ${prefix}/include \
-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=\"${prefix}/include\" \
-D TCC_LIBGCC=\"${libdir}/libc.a\" \
-D TCC_LIBTCC1=\"libtcc1.a\" \
-D CONFIG_TCCBOOT=1 \
-D CONFIG_TCC_STATIC=1 \
-D CONFIG_USE_LIBGCC=1 \
-D TCC_MES_LIBC=1 \
-D TCC_VERSION=\"0.9.26\" \
-D ONE_SOURCE=1 \
-L . \
tcc.c
cp boot1-tcc ${bindir}
chmod 755 ${bindir}/boot1-tcc
cd ../${MES_PKG_DIR}
boot1-tcc -c -D HAVE_CONFIG_H=1 -I include -I include/linux/x86 -o ${libdir}/crt1.o lib/linux/x86-mes-gcc/crt1.c
boot1-tcc -c -D HAVE_CONFIG_H=1 -I include -I include/linux/x86 -o ${libdir}/crtn.o lib/linux/x86-mes-gcc/crtn.c
boot1-tcc -c -D HAVE_CONFIG_H=1 -I include -I include/linux/x86 -o ${libdir}/crti.o lib/linux/x86-mes-gcc/crti.c
boot1-tcc -c -D HAVE_CONFIG_H=1 -D HAVE_LONG_LONG=1 -I include -I include/linux/x86 lib/libtcc1.c
boot1-tcc -c -D TCC_TARGET_I386=1 ../${TCC_PKG}/lib/libtcc1.c
boot1-tcc -ar cr ${libdir}/tcc/libtcc1.a libtcc1.o
boot1-tcc -c -D HAVE_CONFIG_H=1 -I include -I include/linux/x86 -o unified-libc.o unified-libc.c
boot1-tcc -ar cr ${libdir}/libc.a unified-libc.o
cd ../${TCC_PKG}
# Test boot1
boot1-tcc -version
# boot2
boot1-tcc \
-g \
-v \
-static \
-o boot2-tcc \
-D BOOTSTRAP=1 \
-D HAVE_BITFIELD=1 \
-D HAVE_FLOAT_STUB=1 \
-D HAVE_LONG_LONG=1 \
-D HAVE_SETJMP=1 \
-I . \
-I ${prefix}/include \
-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=\"${prefix}/include\" \
-D TCC_LIBGCC=\"${libdir}/libc.a\" \
-D TCC_LIBTCC1=\"libtcc1.a\" \
-D CONFIG_TCCBOOT=1 \
-D CONFIG_TCC_STATIC=1 \
-D CONFIG_USE_LIBGCC=1 \
-D TCC_MES_LIBC=1 \
-D TCC_VERSION=\"0.9.26\" \
-D ONE_SOURCE=1 \
-L . \
tcc.c
cp boot2-tcc ${bindir}
chmod 755 ${bindir}/boot2-tcc
cd ../${MES_PKG_DIR}
boot2-tcc -c -D HAVE_CONFIG_H=1 -I include -I include/linux/x86 -o ${libdir}/crt1.o lib/linux/x86-mes-gcc/crt1.c
boot2-tcc -c -D HAVE_CONFIG_H=1 -I include -I include/linux/x86 -o ${libdir}/crtn.o lib/linux/x86-mes-gcc/crtn.c
boot2-tcc -c -D HAVE_CONFIG_H=1 -I include -I include/linux/x86 -o ${libdir}/crti.o lib/linux/x86-mes-gcc/crti.c
boot2-tcc -c -D HAVE_CONFIG_H=1 -D HAVE_FLOAT_STUB=1 -D HAVE_LONG_LONG=1 -I include -I include/linux/x86 lib/libtcc1.c
boot2-tcc -c -D TCC_TARGET_I386=1 ../${TCC_PKG}/lib/libtcc1.c
boot2-tcc -ar cr ${libdir}/tcc/libtcc1.a libtcc1.o
boot2-tcc -c -D HAVE_CONFIG_H=1 -I include -I include/linux/x86 -o unified-libc.o unified-libc.c
boot2-tcc -ar cr ${libdir}/libc.a unified-libc.o
cd ../${TCC_PKG}
# Test boot2
boot2-tcc -version
# boot3
boot2-tcc \
-g \
-v \
-static \
-o boot3-tcc \
-D BOOTSTRAP=1 \
-D HAVE_BITFIELD=1 \
-D HAVE_FLOAT=1 \
-D HAVE_LONG_LONG=1 \
-D HAVE_SETJMP=1 \
-I . \
-I ${prefix}/include \
-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=\"${prefix}/include\" \
-D TCC_LIBGCC=\"${libdir}/libc.a\" \
-D TCC_LIBTCC1=\"libtcc1.a\" \
-D CONFIG_TCCBOOT=1 \
-D CONFIG_TCC_STATIC=1 \
-D CONFIG_USE_LIBGCC=1 \
-D TCC_MES_LIBC=1 \
-D TCC_VERSION=\"0.9.26\" \
-D ONE_SOURCE=1 \
-L . \
tcc.c
cp boot3-tcc ${bindir}
chmod 755 ${bindir}/boot3-tcc
cd ../${MES_PKG_DIR}
boot3-tcc -c -D HAVE_CONFIG_H=1 -I include -I include/linux/x86 -o ${libdir}/crt1.o lib/linux/x86-mes-gcc/crt1.c
boot3-tcc -c -D HAVE_CONFIG_H=1 -I include -I include/linux/x86 -o ${libdir}/crtn.o lib/linux/x86-mes-gcc/crtn.c
boot3-tcc -c -D HAVE_CONFIG_H=1 -I include -I include/linux/x86 -o ${libdir}/crti.o lib/linux/x86-mes-gcc/crti.c
boot3-tcc -c -D HAVE_CONFIG_H=1 -D HAVE_FLOAT=1 -D HAVE_LONG_LONG=1 -I include -I include/linux/x86 lib/libtcc1.c
boot3-tcc -c -D TCC_TARGET_I386=1 ../${TCC_PKG}/lib/libtcc1.c
boot3-tcc -ar cr ${libdir}/tcc/libtcc1.a libtcc1.o
boot3-tcc -c -D HAVE_CONFIG_H=1 -I include -I include/linux/x86 -o unified-libc.o unified-libc.c
boot3-tcc -ar cr ${libdir}/libc.a unified-libc.o
cd ../${TCC_PKG}
# Test boot3
boot3-tcc -version
# boot4
boot3-tcc \
-g \
-v \
-static \
-o boot4-tcc \
-D BOOTSTRAP=1 \
-D HAVE_BITFIELD=1 \
-D HAVE_FLOAT=1 \
-D HAVE_LONG_LONG=1 \
-D HAVE_SETJMP=1 \
-I . \
-I ${prefix}/include \
-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=\"${prefix}/include\" \
-D TCC_LIBGCC=\"${libdir}/libc.a\" \
-D TCC_LIBTCC1=\"libtcc1.a\" \
-D CONFIG_TCCBOOT=1 \
-D CONFIG_TCC_STATIC=1 \
-D CONFIG_USE_LIBGCC=1 \
-D TCC_MES_LIBC=1 \
-D TCC_VERSION=\"0.9.26\" \
-D ONE_SOURCE=1 \
-L . \
tcc.c
cp boot4-tcc ${bindir}
chmod 755 ${bindir}/boot4-tcc
cd ../${MES_PKG_DIR}
boot4-tcc -c -D HAVE_CONFIG_H=1 -I include -I include/linux/x86 -o ${libdir}/crt1.o lib/linux/x86-mes-gcc/crt1.c
boot4-tcc -c -D HAVE_CONFIG_H=1 -I include -I include/linux/x86 -o ${libdir}/crtn.o lib/linux/x86-mes-gcc/crtn.c
boot4-tcc -c -D HAVE_CONFIG_H=1 -I include -I include/linux/x86 -o ${libdir}/crti.o lib/linux/x86-mes-gcc/crti.c
boot4-tcc -c -D HAVE_CONFIG_H=1 -D HAVE_FLOAT=1 -D HAVE_LONG_LONG=1 -I include -I include/linux/x86 lib/libtcc1.c
boot4-tcc -c -D TCC_TARGET_I386=1 ../${TCC_PKG}/lib/libtcc1.c
boot4-tcc -ar cr ${libdir}/tcc/libtcc1.a libtcc1.o
boot4-tcc -c -D HAVE_CONFIG_H=1 -I include -I include/linux/x86 -o unified-libc.o unified-libc.c
boot4-tcc -ar cr ${libdir}/libc.a unified-libc.o
cd ../${TCC_PKG}
# Test boot4
boot4-tcc -version
# boot5
boot4-tcc \
-g \
-v \
-static \
-o boot5-tcc \
-D BOOTSTRAP=1 \
-D HAVE_BITFIELD=1 \
-D HAVE_FLOAT=1 \
-D HAVE_LONG_LONG=1 \
-D HAVE_SETJMP=1 \
-I . \
-I ${prefix}/include \
-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=\"${prefix}/include\" \
-D TCC_LIBGCC=\"${libdir}/libc.a\" \
-D TCC_LIBTCC1=\"libtcc1.a\" \
-D CONFIG_TCCBOOT=1 \
-D CONFIG_TCC_STATIC=1 \
-D CONFIG_USE_LIBGCC=1 \
-D TCC_MES_LIBC=1 \
-D TCC_VERSION=\"0.9.26\" \
-D ONE_SOURCE=1 \
-L . \
tcc.c
cp boot5-tcc ${bindir}
chmod 755 ${bindir}/boot5-tcc
cd ../${MES_PKG_DIR}
boot5-tcc -c -D HAVE_CONFIG_H=1 -I include -I include/linux/x86 -o ${libdir}/crt1.o lib/linux/x86-mes-gcc/crt1.c
boot5-tcc -c -D HAVE_CONFIG_H=1 -I include -I include/linux/x86 -o ${libdir}/crtn.o lib/linux/x86-mes-gcc/crtn.c
boot5-tcc -c -D HAVE_CONFIG_H=1 -I include -I include/linux/x86 -o ${libdir}/crti.o lib/linux/x86-mes-gcc/crti.c
boot5-tcc -c -D HAVE_CONFIG_H=1 -D HAVE_FLOAT=1 -D HAVE_LONG_LONG=1 -I include -I include/linux/x86 lib/libtcc1.c
boot5-tcc -c -D TCC_TARGET_I386=1 ../${TCC_PKG}/lib/libtcc1.c
boot5-tcc -ar cr ${libdir}/tcc/libtcc1.a libtcc1.o
boot5-tcc -c -D HAVE_CONFIG_H=1 -I include -I include/linux/x86 -o unified-libc.o unified-libc.c
boot5-tcc -ar cr ${libdir}/libc.a unified-libc.o
# Test boot5
boot5-tcc -version
# We have our final tcc 0.9.26!
cp ${bindir}/boot5-tcc ${bindir}/tcc
chmod 755 ${bindir}/tcc
cp ${bindir}/tcc ${bindir}/tcc-0.9.26
chmod 755 ${bindir}/tcc-0.9.26
# Also recompile getopt, we don't need to do this during the boot* stages
# because nothing is linked against it
tcc -c -D HAVE_CONFIG_H=1 -I include -I include/linux/x86 lib/posix/getopt.c
tcc -ar cr ${libdir}/libgetopt.a getopt.o
cd ../..
# Checksums
if match x${UPDATE_CHECKSUMS} xTrue; then
sha256sum -o ${pkg}.checksums \
/usr/bin/mes-tcc \
/usr/bin/boot0-tcc \
/usr/bin/boot1-tcc \
/usr/bin/boot2-tcc \
/usr/bin/boot3-tcc \
/usr/bin/boot4-tcc \
/usr/bin/tcc \
/usr/lib/mes/libc.a \
/usr/lib/mes/libgetopt.a \
/usr/lib/mes/crt1.o \
/usr/lib/mes/crti.o \
/usr/lib/mes/crtn.o \
/usr/lib/mes/tcc/libtcc1.a
cp ${pkg}.checksums ${srcdir}
else
sha256sum -c ${pkg}.checksums
fi