Move grep after musl.

This commit is contained in:
Andrius Štikonas 2021-02-04 21:41:43 +00:00
parent 3e7b17c03e
commit 13b030e1ed
6 changed files with 30 additions and 51 deletions

View File

@ -240,17 +240,12 @@ GNU Coreutils is a collection of widely used utilities such as `cat`, `chmod`, `
A few of the utilities cannot be easily compiled with Mes C library, so we skip them.
#### 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 19: heirloom devtools
#### Part 18: 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 20: bash 2.05b
#### Part 19: 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
@ -260,12 +255,12 @@ 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 21: m4 1.4.4
#### Part 20: m4 1.4.4
`m4` is the first piece of software we need in the autotools suite and flex 2.6.4.
It allows macros to be defined and files to be generated from those macros.
#### Part 22: flex 2.5.11
#### Part 21: flex 2.5.11
`flex` is a tool for generating lexers or scanners: programs that recognize lexical patters.
@ -274,7 +269,7 @@ first flex 2.5.11 is compiled, with its scanner definition manually modified so
it can be processed by lex for the Heirloom project (the required modifications
are mostly syntactical, plus a few workarounds to avoid some flex advanced features).
#### Part 23 musl 1.1.24
#### Part 22 musl 1.1.24
`musl` is a C standard library that is lightweight, fast, simple, free, and strives to be correct
in the sense of standards-conformance and safety. `musl` is used by some distributions of GNU/Linux
@ -285,14 +280,19 @@ newer or more complex programs.
we replace all weak symbols with strong symbols and will patch `tcc` in the next step to ignore duplicate
symbols.
#### Part 24 tcc 0.9.27 (musl)
#### Part 23 tcc 0.9.27 (musl)
We recompile `tcc` against musl. This is a two stage process. First we build tcc-0.9.27 that itself
links to Mes C library but produces binaries linked to musl. Then we recompile newly produced tcc
with itself. Interestingly, tcc-0.9.27 linked against musl is self hosting.
#### Part 25 flex 2.6.14
#### Part 24 flex 2.6.14
We recompile unpatched GNU `flex` using older flex 2.5.11. This is again two stage process,
first compile flex using scanner generated by old flex, then recompile scan.l using the new version
of flex to remove any buggy artificats from the old flex.
#### Part 25: grep 2.4
GNU `grep` is a pattern matching utility. Is is not immediately needed but will
be useful later for autotools.

View File

@ -121,9 +121,6 @@ get_file ftp://sourceware.org/pub/bzip2/bzip2-1.0.8.tar.gz 1
# coreutils 5.0
get_file https://ftp.gnu.org/gnu/coreutils/coreutils-5.0.tar.bz2 1
# grep 2.4
get_file https://ftp.gnu.org/gnu/grep/grep-2.4.tar.gz
# heirloom-devtools
get_file http://downloads.sourceforge.net/project/heirloom/heirloom-devtools/070527/heirloom-devtools-070527.tar.bz2
@ -142,6 +139,9 @@ get_file https://musl.libc.org/releases/musl-1.1.24.tar.gz
# flex 2.6.4
get_file https://github.com/westes/flex/releases/download/v2.6.4/flex-2.6.4.tar.gz
# grep 2.4
get_file https://ftp.gnu.org/gnu/grep/grep-2.4.tar.gz
# General cleanup
find tmp -name .git -exec rm -rf \;

View File

@ -129,19 +129,13 @@ cd ${pkg}
kaem --file ${pkg}.kaem
cd ..
# Part 18: grep
pkg="grep-2.4"
cd ${pkg}
kaem --file ${pkg}.kaem
cd ..
# Part 19: heirloom-devtools
# Part 18: heirloom-devtools
pkg="heirloom-devtools-070527"
cd ${pkg}
kaem --file ${pkg}.kaem
cd ..
# Part 20: bash
# Part 19: bash
pkg="bash-2.05b"
cd ${pkg}
kaem --file ${pkg}.kaem

View File

@ -1,23 +0,0 @@
#!/bin/sh
set -ex
mkdir build
cd build
# Extract
gunzip ../src/${pkg}.tar.gz
tar xf ../src/${pkg}.tar
cd ${pkg}
cp ../../mk/main.mk Makefile
# Build
make
# Install
install grep /after/bin/
# Test
grep --version
cd ../..

View File

@ -21,3 +21,8 @@ all: grep
grep: $(GREP_OBJECTS)
$(CC) $(CFLAGS) $^ $(LDFLAGS) -o $@
install: all
install grep $(PREFIX)/bin
ln -sf $(PREFIX)/bin/grep $(PREFIX)/bin/egrep
ln -sf $(PREFIX)/bin/grep $(PREFIX)/bin/fgrep

View File

@ -9,19 +9,22 @@ set -e
export PREFIX=/after
# Part 21
# Part 20
build m4-1.4.4
# Part 22
# Part 21
build flex-2.5.11
# Part 23
# Part 22
build musl-1.1.24
# Part 24
# Part 23
build tcc-0.9.27 tcc-musl.sh
# Part 25
# Part 24
build flex-2.6.4
# Part 25
build grep-2.4
echo "Bootstrapping completed."