From 85ead5582e248619db9357883d889a74f3e8dcf4 Mon Sep 17 00:00:00 2001 From: Paul Dersey Date: Fri, 29 Jan 2021 10:26:24 -0500 Subject: [PATCH 1/4] tcc-0.9.27: move code to compile libc into separate kaem script --- sysa/tcc-0.9.27/compile-libc.kaem | 25 +++++++++++++++++++++++++ sysa/tcc-0.9.27/tcc-0.9.27.kaem | 22 +--------------------- 2 files changed, 26 insertions(+), 21 deletions(-) create mode 100755 sysa/tcc-0.9.27/compile-libc.kaem diff --git a/sysa/tcc-0.9.27/compile-libc.kaem b/sysa/tcc-0.9.27/compile-libc.kaem new file mode 100755 index 00000000..1676134d --- /dev/null +++ b/sysa/tcc-0.9.27/compile-libc.kaem @@ -0,0 +1,25 @@ +#!/bin/sh + +set -ex + +# libtcc1.a +tcc -c -D HAVE_CONFIG_H=1 lib/libtcc1.c +tcc -ar cr ${libdir}/tcc/libtcc1.a libtcc1.o +cd ../mes-libc +# crt{1,n,i}.o +tcc -c -D HAVE_CONFIG_H=1 -I include -I include/linux/x86 -o ${libdir}/crt1.o lib/linux/x86-mes-gcc/crt1.c +tcc -c -D HAVE_CONFIG_H=1 -I include -I include/linux/x86 -o ${libdir}/crtn.o lib/linux/x86-mes-gcc/crtn.c +tcc -c -D HAVE_CONFIG_H=1 -I include -I include/linux/x86 -o ${libdir}/crti.o lib/linux/x86-mes-gcc/crti.c +# Create unified libc files +catm unified-libc-1.c lib/mes/eputs.c lib/mes/oputs.c lib/mes/globals.c lib/stdlib/exit.c lib/linux/x86-mes-gcc/_exit.c lib/linux/x86-mes-gcc/_write.c lib/stdlib/puts.c lib/string/strlen.c lib/ctype/isnumber.c lib/mes/abtol.c lib/mes/cast.c lib/mes/eputc.c lib/mes/fdgetc.c lib/mes/fdputc.c lib/mes/fdputs.c lib/mes/fdungetc.c lib/mes/itoa.c lib/mes/ltoa.c lib/mes/ltoab.c lib/mes/mes_open.c lib/mes/ntoab.c lib/mes/oputc.c lib/mes/ultoa.c lib/mes/utoa.c lib/ctype/isdigit.c lib/ctype/isspace.c lib/ctype/isxdigit.c lib/mes/assert_msg.c lib/posix/write.c lib/stdlib/atoi.c lib/linux/lseek.c lib/mes/__assert_fail.c lib/mes/__buffered_read.c lib/mes/__mes_debug.c lib/posix/execv.c lib/posix/getcwd.c lib/posix/getenv.c lib/posix/isatty.c lib/posix/open.c lib/posix/buffered-read.c lib/posix/setenv.c lib/posix/wait.c lib/stdio/fgetc.c lib/stdio/fputc.c lib/stdio/fputs.c lib/stdio/getc.c lib/stdio/getchar.c lib/stdio/putc.c lib/stdio/putchar.c lib/stdio/ungetc.c lib/stdlib/free.c lib/stdlib/malloc.c lib/stdlib/realloc.c lib/string/memchr.c lib/string/memcmp.c lib/string/memcpy.c lib/string/memmove.c lib/string/memset.c lib/string/strcmp.c lib/string/strcpy.c lib/string/strncmp.c lib/posix/raise.c lib/linux/access.c lib/linux/brk.c lib/linux/chmod.c lib/linux/clock_gettime.c lib/linux/dup.c lib/linux/dup2.c lib/linux/execve.c lib/linux/fork.c lib/linux/fsync.c lib/linux/_getcwd.c lib/linux/gettimeofday.c lib/linux/ioctl3.c lib/linux/_open3.c lib/linux/_read.c lib/linux/time.c lib/linux/unlink.c lib/linux/waitpid.c lib/linux/x86-mes-gcc/syscall.c lib/linux/getpid.c lib/linux/kill.c lib/ctype/islower.c lib/ctype/isupper.c lib/ctype/tolower.c lib/ctype/toupper.c lib/mes/abtod.c lib/mes/dtoab.c lib/mes/search-path.c lib/posix/execvp.c lib/stdio/fclose.c lib/stdio/fdopen.c lib/stdio/ferror.c lib/stdio/fflush.c lib/stdio/fopen.c lib/stdio/fprintf.c lib/stdio/fread.c lib/stdio/fseek.c lib/stdio/ftell.c lib/stdio/fwrite.c +catm unified-libc-2.c lib/stdio/printf.c lib/stdio/remove.c lib/stdio/snprintf.c lib/stdio/sprintf.c lib/stdio/sscanf.c lib/stdio/vfprintf.c lib/stdio/vprintf.c lib/stdio/vsnprintf.c lib/stdio/vsprintf.c lib/stdio/vsscanf.c lib/stdlib/calloc.c lib/stdlib/qsort.c lib/stdlib/strtod.c lib/stdlib/strtof.c lib/stdlib/strtol.c lib/stdlib/strtold.c lib/stdlib/strtoll.c lib/stdlib/strtoul.c lib/stdlib/strtoull.c lib/string/memmem.c lib/string/strcat.c lib/string/strchr.c lib/string/strlwr.c lib/string/strncpy.c lib/string/strrchr.c lib/string/strstr.c lib/string/strupr.c lib/stub/sigaction.c lib/stub/ldexp.c lib/stub/mprotect.c lib/stub/localtime.c lib/stub/sigemptyset.c lib/x86-mes-gcc/setjmp.c lib/linux/close.c lib/linux/rmdir.c lib/linux/stat.c lib/ctype/isalnum.c lib/ctype/isalpha.c lib/ctype/isascii.c lib/ctype/iscntrl.c lib/ctype/isgraph.c lib/ctype/isprint.c lib/ctype/ispunct.c lib/dirent/__getdirentries.c lib/dirent/closedir.c lib/dirent/opendir.c lib/dirent/readdir.c lib/math/ceil.c lib/math/fabs.c lib/math/floor.c lib/mes/fdgets.c lib/posix/alarm.c lib/posix/execl.c lib/posix/execlp.c lib/posix/mktemp.c lib/posix/sbrk.c lib/posix/sleep.c lib/posix/unsetenv.c lib/stdio/clearerr.c lib/stdio/feof.c lib/stdio/fgets.c lib/stdio/fileno.c lib/stdio/freopen.c lib/stdio/fscanf.c lib/stdio/perror.c lib/stdio/vfscanf.c lib/stdlib/__exit.c lib/stdlib/abort.c lib/stdlib/abs.c lib/stdlib/alloca.c lib/stdlib/atexit.c lib/stdlib/atof.c lib/stdlib/atol.c lib/stdlib/mbstowcs.c lib/string/bcmp.c lib/string/bcopy.c lib/string/bzero.c lib/string/index.c lib/string/rindex.c lib/string/strcspn.c lib/string/strdup.c lib/string/strerror.c lib/string/strncat.c lib/string/strpbrk.c lib/string/strspn.c lib/stub/__cleanup.c lib/stub/atan2.c lib/stub/bsearch.c lib/stub/chown.c lib/stub/cos.c lib/stub/ctime.c lib/stub/exp.c lib/stub/fpurge.c lib/stub/freadahead.c lib/stub/frexp.c lib/stub/getgrgid.c lib/stub/getgrnam.c lib/stub/getlogin.c lib/stub/getpgid.c lib/stub/getpgrp.c lib/stub/getpwnam.c +catm unified-libc-3.c lib/stub/getpwuid.c lib/stub/gmtime.c lib/stub/log.c lib/stub/mktime.c lib/stub/modf.c lib/stub/pclose.c lib/stub/popen.c lib/stub/pow.c lib/stub/rand.c lib/stub/rewind.c lib/stub/setbuf.c lib/stub/setgrent.c lib/stub/setlocale.c lib/stub/setvbuf.c lib/stub/sigaddset.c lib/stub/sigblock.c lib/stub/sigdelset.c lib/stub/sigsetmask.c lib/stub/sin.c lib/stub/sqrt.c lib/stub/strftime.c lib/stub/sys_siglist.c lib/stub/system.c lib/stub/times.c lib/stub/ttyname.c lib/stub/umask.c lib/stub/utime.c lib/linux/chdir.c lib/linux/fcntl.c lib/linux/fstat.c lib/linux/getdents.c lib/linux/getegid.c lib/linux/geteuid.c lib/linux/getgid.c lib/linux/getppid.c lib/linux/getrusage.c lib/linux/getuid.c lib/linux/ioctl.c lib/linux/link.c lib/linux/lstat.c lib/linux/mkdir.c lib/linux/mknod.c lib/linux/nanosleep.c lib/linux/pipe.c lib/linux/readlink.c lib/linux/rename.c lib/linux/setgid.c lib/linux/settimer.c lib/linux/setuid.c lib/linux/signal.c lib/linux/sigprogmask.c lib/linux/symlink.c +# libc.a +tcc -c -D HAVE_CONFIG_H=1 -I include -I include/linux/x86 -o unified-libc-1.o unified-libc-1.c +tcc -c -D HAVE_CONFIG_H=1 -I include -I include/linux/x86 -o unified-libc-2.o unified-libc-2.c +tcc -c -D HAVE_CONFIG_H=1 -I include -I include/linux/x86 -o unified-libc-3.o unified-libc-3.c +tcc -ar cr ${libdir}/libc+gnu.a unified-libc-1.o unified-libc-2.o unified-libc-3.o +cp ${libdir}/libc+gnu.a ${libdir}/libc.a +# libgetopt.a +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 diff --git a/sysa/tcc-0.9.27/tcc-0.9.27.kaem b/sysa/tcc-0.9.27/tcc-0.9.27.kaem index 8fe38f50..d30590e7 100755 --- a/sysa/tcc-0.9.27/tcc-0.9.27.kaem +++ b/sysa/tcc-0.9.27/tcc-0.9.27.kaem @@ -33,26 +33,6 @@ chmod 755 ${bindir}/tcc tcc -version # Recompile libc -# libtcc1.a -tcc -c -D HAVE_CONFIG_H=1 lib/libtcc1.c -tcc -ar cr ${libdir}/tcc/libtcc1.a libtcc1.o -cd ../mes-libc -# crt{1,n,i}.o -tcc -c -D HAVE_CONFIG_H=1 -I include -I include/linux/x86 -o ${libdir}/crt1.o lib/linux/x86-mes-gcc/crt1.c -tcc -c -D HAVE_CONFIG_H=1 -I include -I include/linux/x86 -o ${libdir}/crtn.o lib/linux/x86-mes-gcc/crtn.c -tcc -c -D HAVE_CONFIG_H=1 -I include -I include/linux/x86 -o ${libdir}/crti.o lib/linux/x86-mes-gcc/crti.c -# Create unified libc files -catm unified-libc-1.c lib/mes/eputs.c lib/mes/oputs.c lib/mes/globals.c lib/stdlib/exit.c lib/linux/x86-mes-gcc/_exit.c lib/linux/x86-mes-gcc/_write.c lib/stdlib/puts.c lib/string/strlen.c lib/ctype/isnumber.c lib/mes/abtol.c lib/mes/cast.c lib/mes/eputc.c lib/mes/fdgetc.c lib/mes/fdputc.c lib/mes/fdputs.c lib/mes/fdungetc.c lib/mes/itoa.c lib/mes/ltoa.c lib/mes/ltoab.c lib/mes/mes_open.c lib/mes/ntoab.c lib/mes/oputc.c lib/mes/ultoa.c lib/mes/utoa.c lib/ctype/isdigit.c lib/ctype/isspace.c lib/ctype/isxdigit.c lib/mes/assert_msg.c lib/posix/write.c lib/stdlib/atoi.c lib/linux/lseek.c lib/mes/__assert_fail.c lib/mes/__buffered_read.c lib/mes/__mes_debug.c lib/posix/execv.c lib/posix/getcwd.c lib/posix/getenv.c lib/posix/isatty.c lib/posix/open.c lib/posix/buffered-read.c lib/posix/setenv.c lib/posix/wait.c lib/stdio/fgetc.c lib/stdio/fputc.c lib/stdio/fputs.c lib/stdio/getc.c lib/stdio/getchar.c lib/stdio/putc.c lib/stdio/putchar.c lib/stdio/ungetc.c lib/stdlib/free.c lib/stdlib/malloc.c lib/stdlib/realloc.c lib/string/memchr.c lib/string/memcmp.c lib/string/memcpy.c lib/string/memmove.c lib/string/memset.c lib/string/strcmp.c lib/string/strcpy.c lib/string/strncmp.c lib/posix/raise.c lib/linux/access.c lib/linux/brk.c lib/linux/chmod.c lib/linux/clock_gettime.c lib/linux/dup.c lib/linux/dup2.c lib/linux/execve.c lib/linux/fork.c lib/linux/fsync.c lib/linux/_getcwd.c lib/linux/gettimeofday.c lib/linux/ioctl3.c lib/linux/_open3.c lib/linux/_read.c lib/linux/time.c lib/linux/unlink.c lib/linux/waitpid.c lib/linux/x86-mes-gcc/syscall.c lib/linux/getpid.c lib/linux/kill.c lib/ctype/islower.c lib/ctype/isupper.c lib/ctype/tolower.c lib/ctype/toupper.c lib/mes/abtod.c lib/mes/dtoab.c lib/mes/search-path.c lib/posix/execvp.c lib/stdio/fclose.c lib/stdio/fdopen.c lib/stdio/ferror.c lib/stdio/fflush.c lib/stdio/fopen.c lib/stdio/fprintf.c lib/stdio/fread.c lib/stdio/fseek.c lib/stdio/ftell.c lib/stdio/fwrite.c -catm unified-libc-2.c lib/stdio/printf.c lib/stdio/remove.c lib/stdio/snprintf.c lib/stdio/sprintf.c lib/stdio/sscanf.c lib/stdio/vfprintf.c lib/stdio/vprintf.c lib/stdio/vsnprintf.c lib/stdio/vsprintf.c lib/stdio/vsscanf.c lib/stdlib/calloc.c lib/stdlib/qsort.c lib/stdlib/strtod.c lib/stdlib/strtof.c lib/stdlib/strtol.c lib/stdlib/strtold.c lib/stdlib/strtoll.c lib/stdlib/strtoul.c lib/stdlib/strtoull.c lib/string/memmem.c lib/string/strcat.c lib/string/strchr.c lib/string/strlwr.c lib/string/strncpy.c lib/string/strrchr.c lib/string/strstr.c lib/string/strupr.c lib/stub/sigaction.c lib/stub/ldexp.c lib/stub/mprotect.c lib/stub/localtime.c lib/stub/sigemptyset.c lib/x86-mes-gcc/setjmp.c lib/linux/close.c lib/linux/rmdir.c lib/linux/stat.c lib/ctype/isalnum.c lib/ctype/isalpha.c lib/ctype/isascii.c lib/ctype/iscntrl.c lib/ctype/isgraph.c lib/ctype/isprint.c lib/ctype/ispunct.c lib/dirent/__getdirentries.c lib/dirent/closedir.c lib/dirent/opendir.c lib/dirent/readdir.c lib/math/ceil.c lib/math/fabs.c lib/math/floor.c lib/mes/fdgets.c lib/posix/alarm.c lib/posix/execl.c lib/posix/execlp.c lib/posix/mktemp.c lib/posix/sbrk.c lib/posix/sleep.c lib/posix/unsetenv.c lib/stdio/clearerr.c lib/stdio/feof.c lib/stdio/fgets.c lib/stdio/fileno.c lib/stdio/freopen.c lib/stdio/fscanf.c lib/stdio/perror.c lib/stdio/vfscanf.c lib/stdlib/__exit.c lib/stdlib/abort.c lib/stdlib/abs.c lib/stdlib/alloca.c lib/stdlib/atexit.c lib/stdlib/atof.c lib/stdlib/atol.c lib/stdlib/mbstowcs.c lib/string/bcmp.c lib/string/bcopy.c lib/string/bzero.c lib/string/index.c lib/string/rindex.c lib/string/strcspn.c lib/string/strdup.c lib/string/strerror.c lib/string/strncat.c lib/string/strpbrk.c lib/string/strspn.c lib/stub/__cleanup.c lib/stub/atan2.c lib/stub/bsearch.c lib/stub/chown.c lib/stub/cos.c lib/stub/ctime.c lib/stub/exp.c lib/stub/fpurge.c lib/stub/freadahead.c lib/stub/frexp.c lib/stub/getgrgid.c lib/stub/getgrnam.c lib/stub/getlogin.c lib/stub/getpgid.c lib/stub/getpgrp.c lib/stub/getpwnam.c -catm unified-libc-3.c lib/stub/getpwuid.c lib/stub/gmtime.c lib/stub/log.c lib/stub/mktime.c lib/stub/modf.c lib/stub/pclose.c lib/stub/popen.c lib/stub/pow.c lib/stub/rand.c lib/stub/rewind.c lib/stub/setbuf.c lib/stub/setgrent.c lib/stub/setlocale.c lib/stub/setvbuf.c lib/stub/sigaddset.c lib/stub/sigblock.c lib/stub/sigdelset.c lib/stub/sigsetmask.c lib/stub/sin.c lib/stub/sqrt.c lib/stub/strftime.c lib/stub/sys_siglist.c lib/stub/system.c lib/stub/times.c lib/stub/ttyname.c lib/stub/umask.c lib/stub/utime.c lib/linux/chdir.c lib/linux/fcntl.c lib/linux/fstat.c lib/linux/getdents.c lib/linux/getegid.c lib/linux/geteuid.c lib/linux/getgid.c lib/linux/getppid.c lib/linux/getrusage.c lib/linux/getuid.c lib/linux/ioctl.c lib/linux/link.c lib/linux/lstat.c lib/linux/mkdir.c lib/linux/mknod.c lib/linux/nanosleep.c lib/linux/pipe.c lib/linux/readlink.c lib/linux/rename.c lib/linux/setgid.c lib/linux/settimer.c lib/linux/setuid.c lib/linux/signal.c lib/linux/sigprogmask.c lib/linux/symlink.c -# libc.a -tcc -c -D HAVE_CONFIG_H=1 -I include -I include/linux/x86 -o unified-libc-1.o unified-libc-1.c -tcc -c -D HAVE_CONFIG_H=1 -I include -I include/linux/x86 -o unified-libc-2.o unified-libc-2.c -tcc -c -D HAVE_CONFIG_H=1 -I include -I include/linux/x86 -o unified-libc-3.o unified-libc-3.c -tcc -ar cr ${libdir}/libc+gnu.a unified-libc-1.o unified-libc-2.o unified-libc-3.o -cp ${libdir}/libc+gnu.a ${libdir}/libc.a -# libgetopt.a -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 +kaem --file ../../compile-libc.kaem cd ../.. From 7c90d5bf4c632f41b1b493ffe845857ae6fdfdcb Mon Sep 17 00:00:00 2001 From: Paul Dersey Date: Fri, 29 Jan 2021 11:43:10 -0500 Subject: [PATCH 2/4] Add new step mes-libc-patched --- sysa/after.kaem.run | 19 ++++++++----- sysa/tcc-0.9.27/mes-libc-patched.kaem | 14 ++++++++++ sysa/tcc-0.9.27/patches/mes-libc-qsort.patch | 29 ++++++++++++++++++++ 3 files changed, 55 insertions(+), 7 deletions(-) create mode 100755 sysa/tcc-0.9.27/mes-libc-patched.kaem create mode 100644 sysa/tcc-0.9.27/patches/mes-libc-qsort.patch diff --git a/sysa/after.kaem.run b/sysa/after.kaem.run index 8390c235..4c2f7018 100755 --- a/sysa/after.kaem.run +++ b/sysa/after.kaem.run @@ -106,43 +106,48 @@ cd tcc-0.9.27 kaem --file tcc-patched.kaem cd .. -# Part 13: make +# Part 13: mes-libc-patched +cd tcc-0.9.27 +kaem --file mes-libc-patched.kaem +cd .. + +# Part 14: make pkg="make-3.80" cd ${pkg} kaem --file ${pkg}.kaem cd .. -# Part 14: bzip2 +# Part 15: bzip2 pkg="bzip2-1.0.8" cd ${pkg} kaem --file ${pkg}.kaem cd .. -# Part 15: coreutils +# Part 16: coreutils pkg="coreutils-5.0" cd ${pkg} kaem --file ${pkg}.kaem cd .. -# Part 16: grep +# Part 17: grep pkg="grep-2.4" cd ${pkg} kaem --file ${pkg}.kaem cd .. -# Part 16: heirloom-devtools +# Part 18: heirloom-devtools pkg="heirloom-devtools-070527" cd ${pkg} kaem --file ${pkg}.kaem cd .. -# Part 17: bash +# Part 19: bash pkg="bash-2.05b" cd ${pkg} kaem --file ${pkg}.kaem cd .. -# Part 18: m4 +# Part 20: m4 pkg="m4-1.4" cd ${pkg} kaem --file ${pkg}.kaem diff --git a/sysa/tcc-0.9.27/mes-libc-patched.kaem b/sysa/tcc-0.9.27/mes-libc-patched.kaem new file mode 100755 index 00000000..39da1ab0 --- /dev/null +++ b/sysa/tcc-0.9.27/mes-libc-patched.kaem @@ -0,0 +1,14 @@ +#!/bin/sh + +set -ex + +cd src/mes-libc + +# Patch +patch -Np0 -i ../../patches/mes-libc-qsort.patch + +# Recompile libc +cd ../tcc-0.9.27 +kaem --file ../../compile-libc.kaem + +cd ../.. diff --git a/sysa/tcc-0.9.27/patches/mes-libc-qsort.patch b/sysa/tcc-0.9.27/patches/mes-libc-qsort.patch new file mode 100644 index 00000000..5cf668d6 --- /dev/null +++ b/sysa/tcc-0.9.27/patches/mes-libc-qsort.patch @@ -0,0 +1,29 @@ +--- lib/stdlib/qsort.c ++++ lib/stdlib/qsort.c +@@ -1,6 +1,7 @@ + /* -*-comment-start: "//";comment-end:""-*- + * GNU Mes --- Maxwell Equations of Software + * Copyright © 2017,2018 Jan (janneke) Nieuwenhuizen ++ * Copyright © 2021 Paul Dersey + * + * This file is part of GNU Mes. + * +@@ -24,10 +25,14 @@ + void + qswap (void *a, void *b, size_t size) + { +- char *buf[8]; +- memcpy (buf, a, size); +- memcpy (a, b, size); +- memcpy (b, buf, size); ++ char *pa = a; ++ char *pb = b; ++ do ++ { ++ char tmp = *pa; ++ *pa++ = *pb; ++ *pb++ = tmp; ++ } while (--size > 0); + } + + size_t From fef663a46b9af22292e6d2fe94c5af9a606a9d4c Mon Sep 17 00:00:00 2001 From: Paul Dersey Date: Fri, 22 Jan 2021 16:41:47 -0500 Subject: [PATCH 3/4] coreutils: Fix build of ls --- sysa/coreutils-5.0/coreutils-5.0.kaem | 1 + sysa/coreutils-5.0/mk/main.mk | 4 ++-- sysa/coreutils-5.0/patches/ls-strcmp.patch | 11 +++++++++++ 3 files changed, 14 insertions(+), 2 deletions(-) create mode 100644 sysa/coreutils-5.0/patches/ls-strcmp.patch diff --git a/sysa/coreutils-5.0/coreutils-5.0.kaem b/sysa/coreutils-5.0/coreutils-5.0.kaem index c5123561..59019eb7 100755 --- a/sysa/coreutils-5.0/coreutils-5.0.kaem +++ b/sysa/coreutils-5.0/coreutils-5.0.kaem @@ -18,6 +18,7 @@ catm config.h patch -Np0 -i ../../patches/modechange.patch patch -Np0 -i ../../patches/mbstate.patch +patch -Np0 -i ../../patches/ls-strcmp.patch # Build and install /after/bin/make -f Makefile diff --git a/sysa/coreutils-5.0/mk/main.mk b/sysa/coreutils-5.0/mk/main.mk index d677c272..46fc378f 100644 --- a/sysa/coreutils-5.0/mk/main.mk +++ b/sysa/coreutils-5.0/mk/main.mk @@ -73,8 +73,8 @@ COREUTILS = basename cat chmod cksum csplit cut echo expand factor false fmt fol BINARIES = $(addprefix $(SRC_DIR)/, $(COREUTILS)) -ALL=$(BINARIES) $(SRC_DIR)/install $(SRC_DIR)/md5sum $(SRC_DIR)/mv $(SRC_DIR)/rm $(SRC_DIR)/sha1sum -all: $(BINARIES) $(SRC_DIR)/install $(SRC_DIR)/md5sum $(SRC_DIR)/mv $(SRC_DIR)/rm $(SRC_DIR)/sha1sum +ALL=$(BINARIES) $(SRC_DIR)/ls $(SRC_DIR)/install $(SRC_DIR)/md5sum $(SRC_DIR)/mv $(SRC_DIR)/rm $(SRC_DIR)/sha1sum +all: $(BINARIES) $(SRC_DIR)/ls $(SRC_DIR)/install $(SRC_DIR)/md5sum $(SRC_DIR)/mv $(SRC_DIR)/rm $(SRC_DIR)/sha1sum LIB_DIR = lib LIB_SRC = acl getdate posixtm posixver strftime getopt getopt1 hash hash-pjw addext argmatch backupfile basename canon-host closeout cycle-check diacrit dirname dup-safer error exclude exitfail filemode __fpending file-type fnmatch fopen-safer full-read full-write getline getstr gettime hard-locale human idcache isdir imaxtostr linebuffer localcharset long-options makepath mbswidth md5 memcasecmp memcoll modechange offtostr path-concat physmem quote quotearg readtokens rpmatch safe-read safe-write same save-cwd savedir settime sha stpcpy stripslash strtoimax strtoumax umaxtostr unicodeio userspec version-etc xgetcwd xgethostname xmalloc xmemcoll xnanosleep xreadlink xstrdup xstrtod xstrtol xstrtoul xstrtoimax xstrtoumax yesno strnlen getcwd sig2str mountlist regex canonicalize mkstemp memrchr euidaccess ftw dirfd obstack strverscmp strftime tsearch diff --git a/sysa/coreutils-5.0/patches/ls-strcmp.patch b/sysa/coreutils-5.0/patches/ls-strcmp.patch new file mode 100644 index 00000000..74ddef5e --- /dev/null +++ b/sysa/coreutils-5.0/patches/ls-strcmp.patch @@ -0,0 +1,11 @@ +--- src/ls.c ++++ src/ls.c +@@ -2597,7 +2597,7 @@ xstrcoll (char const *a, char const *b) + { + int diff; + errno = 0; +- diff = strcoll (a, b); ++ diff = strcmp (a, b); + if (errno) + { + error (0, errno, _("cannot compare file names %s and %s"), From 12617feabd3649d14fa7c50ab7181e7e113cadf2 Mon Sep 17 00:00:00 2001 From: Paul Dersey Date: Fri, 29 Jan 2021 14:42:40 -0500 Subject: [PATCH 4/4] Fix numbering of steps and update documentation --- README.md | 35 ++++++++++++++++++++--------------- sysa/after.kaem.run | 26 +++++++++++++------------- 2 files changed, 33 insertions(+), 28 deletions(-) diff --git a/README.md b/README.md index 2fa29dd8..bee88f53 100644 --- a/README.md +++ b/README.md @@ -155,7 +155,7 @@ two stages to this part: libc. This second interpreter is faster and less buggy. We need the libc to compile all the programs until we get glibc. -#### Part 6: tinycc +#### Part 6, 7: tinycc `tinycc` is a minimal C compiler that aims to be small and fast. It complies with all C89 and most of C99 standards. This is also a two-tiered process: @@ -179,17 +179,17 @@ software, using older versions compilable by tinycc. Prior to this point, all tools have been adapted significantly for the bootstrap; now, we will be using old tooling instead. -#### Part 7: sed 4.0.7 +#### Part 8: sed 4.0.7 You are most likely aware of GNU `sed`, a line editor. -#### Part 8: tar 1.12 +#### Part 9: tar 1.12 GNU `tar` is the most common archive format used by software source code, often compressed also. To avoid continuing using submodules, we build GNU tar 1.12, the last version compilable by tinycc without significant patching. -#### Part 9: gzip 1.2.4 +#### Part 10: gzip 1.2.4 `gzip` is the most common compression format used for software source code. It is luckily distributed as a barebones uncompressed `.tar`, which we extract and @@ -197,18 +197,18 @@ then build. We do require deletion of a few lines unsupported by mes libc. Going forward, we can now use `.tar.gz` for source code. -#### Part 10: diffutils 2.7 +#### Part 11: diffutils 2.7 `diffutils` is useful for comparing two files. It is not immediately needed but is required later for autotools. -#### Part 11: patch 2.5.9 +#### Part 12: patch 2.5.9 `patch` is a very useful tool at this stage, allowing us to make significantly more complex edits, including just changes to lines. Luckily, we are able to patch patch using sed only. -#### Part 12: patched tinycc +#### Part 13: patched tinycc In Guix, tinycc is patched to force static linking. Prior to this step, we have been forced to manually specify static linking for each tool. Now that we have @@ -217,35 +217,40 @@ patch, we can patch tinycc to force static linking and then recompile it. Note that we have to do this using tinycc 0.9.26, as tinycc 0.9.27 cannot recompile itself for unknown reasons. -#### Part 13: make 3.80 +#### Part 14: patched mes-libc + +Since patch is available at this point, we can apply additional fixes to +mes-libc that are not included in the wip-m2 branch and recompile libc. + +#### Part 15: make 3.80 GNU `make` is now built so we have a more robust building system. `make` allows us to do things like define rules for files rather than writing complex kaem scripts. -#### Part 14: bzip2 1.0.8 +#### Part 16: bzip2 1.0.8 `bzip2` is a compression format that compresses more than `gzip`. It is preferred where we can use it, and makes source code sizes smaller. -#### Part 15: coreutils 5.0.0 +#### Part 17: coreutils 5.0.0 GNU Coreutils is a collection of widely used utilities such as `cat`, `chmod`, `chown`, -`cp`, `install`, `ln`, `mkdir`, `mknod`, `mv`, `rm`, `rmdir`, `tee`, `test`, `true`, and many others. +`cp`, `install`, `ln`, `ls`, `mkdir`, `mknod`, `mv`, `rm`, `rmdir`, `tee`, `test`, `true`, and many others. A few of the utilities cannot be easily compiled with Mes C library, so we skip them. -#### Part 16: grep 2.4 +#### Part 18: grep 2.4 GNU `grep` is a pattern matching utility. Is is not immediately needed but will be useful later for autotools. -#### Part 17: heirloom devtools +#### Part 19: heirloom devtools `lex` and `yacc` from the Heirloom project. The Heirloom project is a collection of standard UNIX utilities derived from code by Caldera and Sun. Differently from the analogous utilities from the GNU project, they can be compiled with a simple `Makefile`. -#### Part 18: bash 2.05b +#### Part 20: bash 2.05b GNU `bash` is the most well known shell and the most complex piece of software so far. However, it comes with a number of great benefits over kaem, including @@ -255,7 +260,7 @@ Bash ships with a bison pre-generated file here which we delete. Unfortunately, we have not bootstrapped bison but fortunately for us, heirloom yacc is able to cope here. -#### Part 19: m4 1.4 +#### Part 21: m4 1.4 `m4` is the first piece of software we need in the autotools suite. It allows macros to be defined and files to be generated from those macros. diff --git a/sysa/after.kaem.run b/sysa/after.kaem.run index 4c2f7018..b2c5213a 100755 --- a/sysa/after.kaem.run +++ b/sysa/after.kaem.run @@ -77,77 +77,77 @@ cd ${pkg} kaem --file ${pkg}.kaem cd .. -# Part 8: tar +# Part 9: tar pkg="tar-1.12" cd ${pkg} kaem --file ${pkg}.kaem cd .. -# Part 9: gzip +# Part 10: gzip pkg="gzip-1.2.4" cd ${pkg} kaem --file ${pkg}.kaem cd .. -# Part 10: diffutils +# Part 11: diffutils pkg="diffutils-2.7" cd ${pkg} kaem --file ${pkg}.kaem cd .. -# Part 11: patch +# Part 12: patch pkg="patch-2.5.9" cd ${pkg} kaem --file ${pkg}.kaem cd .. -# Part 12: tcc-patched +# Part 13: tcc-patched cd tcc-0.9.27 kaem --file tcc-patched.kaem cd .. -# Part 13: mes-libc-patched +# Part 14: mes-libc-patched cd tcc-0.9.27 kaem --file mes-libc-patched.kaem cd .. -# Part 14: make +# Part 15: make pkg="make-3.80" cd ${pkg} kaem --file ${pkg}.kaem cd .. -# Part 15: bzip2 +# Part 16: bzip2 pkg="bzip2-1.0.8" cd ${pkg} kaem --file ${pkg}.kaem cd .. -# Part 16: coreutils +# Part 17: coreutils pkg="coreutils-5.0" cd ${pkg} kaem --file ${pkg}.kaem cd .. -# Part 17: grep +# Part 18: grep pkg="grep-2.4" cd ${pkg} kaem --file ${pkg}.kaem cd .. -# Part 18: heirloom-devtools +# Part 19: heirloom-devtools pkg="heirloom-devtools-070527" cd ${pkg} kaem --file ${pkg}.kaem cd .. -# Part 19: bash +# Part 20: bash pkg="bash-2.05b" cd ${pkg} kaem --file ${pkg}.kaem cd .. -# Part 20: m4 +# Part 21: m4 pkg="m4-1.4" cd ${pkg} kaem --file ${pkg}.kaem