commit
88f3b52c35
36
README.md
36
README.md
|
@ -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.
|
A few of the utilities cannot be easily compiled with Mes C library, so we skip them.
|
||||||
|
|
||||||
#### Part 18: grep 2.4
|
#### Part 18: heirloom devtools
|
||||||
|
|
||||||
GNU `grep` is a pattern matching utility. Is is not immediately needed but will
|
|
||||||
be useful later for autotools.
|
|
||||||
|
|
||||||
#### Part 19: heirloom devtools
|
|
||||||
`lex` and `yacc` from the Heirloom project. The Heirloom project is a collection
|
`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
|
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`.
|
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
|
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
|
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
|
we have not bootstrapped bison but fortunately for us, heirloom yacc is able to
|
||||||
cope here.
|
cope here.
|
||||||
|
|
||||||
#### Part 21: m4 1.4
|
#### Part 20: m4 1.4.4
|
||||||
|
|
||||||
`m4` is the first piece of software we need in the autotools suite. It allows
|
`m4` is the first piece of software we need in the autotools suite and flex 2.6.4.
|
||||||
macros to be defined and files to be generated from those macros.
|
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.
|
`flex` is a tool for generating lexers or scanners: programs that recognize lexical patters.
|
||||||
|
|
||||||
|
@ -274,11 +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
|
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).
|
are mostly syntactical, plus a few workarounds to avoid some flex advanced features).
|
||||||
|
|
||||||
#### Part 23 flex 2.5.14
|
#### Part 22 musl 1.1.24
|
||||||
|
|
||||||
Then we recompile unpatched `flex` using its own lexer.
|
|
||||||
|
|
||||||
#### Part 24 musl 1.1.24
|
|
||||||
|
|
||||||
`musl` is a C standard library that is lightweight, fast, simple, free, and strives to be correct
|
`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
|
in the sense of standards-conformance and safety. `musl` is used by some distributions of GNU/Linux
|
||||||
|
@ -289,8 +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
|
we replace all weak symbols with strong symbols and will patch `tcc` in the next step to ignore duplicate
|
||||||
symbols.
|
symbols.
|
||||||
|
|
||||||
#### Part 25 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
|
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
|
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.
|
with itself. Interestingly, tcc-0.9.27 linked against musl is self hosting.
|
||||||
|
|
||||||
|
#### 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.
|
||||||
|
|
16
rootfs.sh
16
rootfs.sh
|
@ -121,27 +121,27 @@ get_file ftp://sourceware.org/pub/bzip2/bzip2-1.0.8.tar.gz 1
|
||||||
# coreutils 5.0
|
# coreutils 5.0
|
||||||
get_file https://ftp.gnu.org/gnu/coreutils/coreutils-5.0.tar.bz2 1
|
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
|
# heirloom-devtools
|
||||||
get_file http://downloads.sourceforge.net/project/heirloom/heirloom-devtools/070527/heirloom-devtools-070527.tar.bz2
|
get_file http://downloads.sourceforge.net/project/heirloom/heirloom-devtools/070527/heirloom-devtools-070527.tar.bz2
|
||||||
|
|
||||||
# bash 2.05b
|
# bash 2.05b
|
||||||
get_file https://ftp.gnu.org/pub/gnu/bash/bash-2.05b.tar.gz
|
get_file https://ftp.gnu.org/pub/gnu/bash/bash-2.05b.tar.gz
|
||||||
|
|
||||||
# m4 1.4
|
# m4 1.4.4
|
||||||
get_file https://ftp.gnu.org/gnu/m4/m4-1.4.tar.gz
|
get_file https://ftp.gnu.org/gnu/m4/m4-1.4.4.tar.gz
|
||||||
|
|
||||||
# flex 2.5.11
|
# flex 2.5.11
|
||||||
get_file http://download.nust.na/pub2/openpkg1/sources/DST/flex/flex-2.5.11.tar.gz
|
get_file http://download.nust.na/pub2/openpkg1/sources/DST/flex/flex-2.5.11.tar.gz
|
||||||
|
|
||||||
# flex 2.5.14
|
|
||||||
get_file http://download.nust.na/pub2/openpkg1/sources/DST/flex/flex-2.5.14.tar.gz
|
|
||||||
|
|
||||||
# musl 1.1.24
|
# musl 1.1.24
|
||||||
get_file https://musl.libc.org/releases/musl-1.1.24.tar.gz
|
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
|
# General cleanup
|
||||||
find tmp -name .git -exec rm -rf \;
|
find tmp -name .git -exec rm -rf \;
|
||||||
|
|
||||||
|
|
|
@ -129,19 +129,13 @@ cd ${pkg}
|
||||||
kaem --file ${pkg}.kaem
|
kaem --file ${pkg}.kaem
|
||||||
cd ..
|
cd ..
|
||||||
|
|
||||||
# Part 18: grep
|
# Part 18: heirloom-devtools
|
||||||
pkg="grep-2.4"
|
|
||||||
cd ${pkg}
|
|
||||||
kaem --file ${pkg}.kaem
|
|
||||||
cd ..
|
|
||||||
|
|
||||||
# Part 19: heirloom-devtools
|
|
||||||
pkg="heirloom-devtools-070527"
|
pkg="heirloom-devtools-070527"
|
||||||
cd ${pkg}
|
cd ${pkg}
|
||||||
kaem --file ${pkg}.kaem
|
kaem --file ${pkg}.kaem
|
||||||
cd ..
|
cd ..
|
||||||
|
|
||||||
# Part 20: bash
|
# Part 19: bash
|
||||||
pkg="bash-2.05b"
|
pkg="bash-2.05b"
|
||||||
cd ${pkg}
|
cd ${pkg}
|
||||||
kaem --file ${pkg}.kaem
|
kaem --file ${pkg}.kaem
|
||||||
|
|
|
@ -1,13 +1,10 @@
|
||||||
# When we rebuild flex it no longer needs patching
|
# When we rebuild flex it no longer needs patching
|
||||||
# and can use simplified makefile
|
# and can use simplified makefile
|
||||||
src_prepare() {
|
src_prepare() {
|
||||||
if test -d /lex; then
|
default_src_prepare
|
||||||
default_src_prepare
|
|
||||||
else
|
|
||||||
cp ../../mk/main2.mk Makefile
|
|
||||||
fi
|
|
||||||
touch config.h
|
touch config.h
|
||||||
rm parse.c parse.h scan.c
|
rm parse.c parse.h scan.c skel.c
|
||||||
}
|
}
|
||||||
|
|
||||||
src_install() {
|
src_install() {
|
||||||
|
|
|
@ -1,28 +0,0 @@
|
||||||
CFLAGS = -DVERSION=\"2.5.11\"
|
|
||||||
|
|
||||||
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
|
|
||||||
tcc -o $@ $^
|
|
||||||
|
|
||||||
%.o: %.c
|
|
||||||
tcc -g -c $(CFLAGS) -o $@ $<
|
|
||||||
|
|
||||||
scan.o: parse.h
|
|
||||||
yylex.o: parse.h
|
|
||||||
|
|
||||||
parse.c parse.h: parse.y
|
|
||||||
yacc -d parse.y
|
|
||||||
mv y.tab.h parse.h
|
|
||||||
mv y.tab.c parse.c
|
|
||||||
|
|
||||||
scan.c: scan.l
|
|
||||||
flex scan.l
|
|
||||||
mv lex.yy.c scan.c
|
|
||||||
|
|
||||||
skel.c: mkskel.sh flex.skl
|
|
||||||
/bin/sh ./mkskel.sh ./flex.skl > skel.c
|
|
||||||
|
|
||||||
install: all
|
|
||||||
install flex $(PREFIX)/bin
|
|
||||||
ln -sf $(PREFIX)/bin/flex $(PREFIX)/bin/lex
|
|
|
@ -1,6 +0,0 @@
|
||||||
src_prepare() {
|
|
||||||
default_src_prepare
|
|
||||||
|
|
||||||
touch config.h
|
|
||||||
rm parse.c parse.h scan.c
|
|
||||||
}
|
|
|
@ -1,29 +0,0 @@
|
||||||
CFLAGS = -I . \
|
|
||||||
-DVERSION=\"2.5.14\"
|
|
||||||
|
|
||||||
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
|
|
||||||
tcc -o $@ $^
|
|
||||||
|
|
||||||
%.o: %.c
|
|
||||||
tcc -g -c $(CFLAGS) -o $@ $<
|
|
||||||
|
|
||||||
scan.o: parse.h
|
|
||||||
yylex.o: parse.h
|
|
||||||
|
|
||||||
parse.c parse.h: parse.y
|
|
||||||
yacc -d parse.y
|
|
||||||
mv y.tab.h parse.h
|
|
||||||
mv y.tab.c parse.c
|
|
||||||
|
|
||||||
scan.c: scan.l
|
|
||||||
flex scan.l
|
|
||||||
mv lex.yy.c scan.c
|
|
||||||
|
|
||||||
skel.c: mkskel.sh flex.skl
|
|
||||||
/bin/sh ./mkskel.sh ./flex.skl > skel.c
|
|
||||||
|
|
||||||
install: all
|
|
||||||
install flex $(PREFIX)/bin
|
|
||||||
ln -sf $(PREFIX)/bin/flex $(PREFIX)/bin/lex
|
|
|
@ -0,0 +1,23 @@
|
||||||
|
src_prepare() {
|
||||||
|
default_src_prepare
|
||||||
|
|
||||||
|
mv Makefile src/
|
||||||
|
touch src/config.h
|
||||||
|
rm src/parse.c src/parse.h src/scan.c src/skel.c
|
||||||
|
}
|
||||||
|
|
||||||
|
src_compile() {
|
||||||
|
cd src
|
||||||
|
default_src_compile
|
||||||
|
cd ..
|
||||||
|
}
|
||||||
|
|
||||||
|
src_install() {
|
||||||
|
cd src
|
||||||
|
default_src_install
|
||||||
|
cd ..
|
||||||
|
|
||||||
|
# Remove yacc, we won't need it any longer
|
||||||
|
rm ${PREFIX}/bin/yacc
|
||||||
|
rm /yaccpar
|
||||||
|
}
|
|
@ -0,0 +1,41 @@
|
||||||
|
CC := tcc
|
||||||
|
CFLAGS = -DVERSION=\"2.6.4\" \
|
||||||
|
-DM4=\"m4\" \
|
||||||
|
-DHAVE_LIMITS_H=1
|
||||||
|
|
||||||
|
all: flex
|
||||||
|
|
||||||
|
flex: buf.o ccl.o dfa.o ecs.o filter.o gen.o main.o misc.o nfa.o options.o parse.o regex.o scan.o scanflags.o scanopt.o skel.o sym.o tables.o tables_shared.o tblcmp.o yylex.o
|
||||||
|
$(CC) -o $@ $^ -lm
|
||||||
|
|
||||||
|
flex-tmp: buf.o ccl.o dfa.o ecs.o filter.o gen.o main.o misc.o nfa.o options.o parse.o regex.o scan-tmp.o scanflags.o scanopt.o skel.o sym.o tables.o tables_shared.o tblcmp.o yylex.o
|
||||||
|
$(CC) -o $@ $^ -lm
|
||||||
|
|
||||||
|
%.o: %.c
|
||||||
|
$(CC) $(CFLAGS) -g -c -I. -o $@ $<
|
||||||
|
|
||||||
|
main.o: parse.h
|
||||||
|
scan.o: parse.h
|
||||||
|
scan-tmp.o: parse.h
|
||||||
|
yylex.o: parse.h
|
||||||
|
|
||||||
|
parse.c parse.h: parse.y
|
||||||
|
yacc -d parse.y
|
||||||
|
mv y.tab.h parse.h
|
||||||
|
mv y.tab.c parse.c
|
||||||
|
echo 'extern int yylval;' >> parse.h
|
||||||
|
|
||||||
|
scan-tmp.c: scan.l
|
||||||
|
flex scan.l
|
||||||
|
mv lex.yy.c scan-tmp.c
|
||||||
|
|
||||||
|
scan.c: scan.l flex-tmp
|
||||||
|
./flex-tmp scan.l
|
||||||
|
mv lex.yy.c scan.c
|
||||||
|
|
||||||
|
skel.c: mkskel.sh flex.skl
|
||||||
|
/bin/sh ./mkskel.sh . m4 2.6.4 > skel.c
|
||||||
|
|
||||||
|
install: all
|
||||||
|
install flex $(PREFIX)/bin
|
||||||
|
ln -sf $(PREFIX)/bin/flex $(PREFIX)/bin/lex
|
|
@ -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 ../..
|
|
|
@ -8,7 +8,9 @@ AR = tcc -ar
|
||||||
CFLAGS = -DPACKAGE=\"$(PACKAGE)\" \
|
CFLAGS = -DPACKAGE=\"$(PACKAGE)\" \
|
||||||
-DVERSION=\"$(VERSION)\" \
|
-DVERSION=\"$(VERSION)\" \
|
||||||
-DHAVE_DIRENT_H=1 \
|
-DHAVE_DIRENT_H=1 \
|
||||||
-DHAVE_UNISTD_H=1
|
-DHAVE_UNISTD_H=1 \
|
||||||
|
-DHAVE_STRERROR=1 \
|
||||||
|
-DREGEX_MALLOC=1
|
||||||
|
|
||||||
.PHONY: all
|
.PHONY: all
|
||||||
|
|
||||||
|
@ -19,3 +21,8 @@ all: grep
|
||||||
|
|
||||||
grep: $(GREP_OBJECTS)
|
grep: $(GREP_OBJECTS)
|
||||||
$(CC) $(CFLAGS) $^ $(LDFLAGS) -o $@
|
$(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
|
||||||
|
|
|
@ -7,7 +7,9 @@ AR = tcc -ar
|
||||||
|
|
||||||
CFLAGS = -I lib \
|
CFLAGS = -I lib \
|
||||||
-DPRODUCT=\"$(PRODUCT)\" \
|
-DPRODUCT=\"$(PRODUCT)\" \
|
||||||
-DVERSION=\"$(VERSION)\"
|
-DVERSION=\"$(VERSION)\" \
|
||||||
|
-DHAVE_SIGNAL_H=1 \
|
||||||
|
-DPACKAGE_STRING=\"GNU\ M4\ 1.4.4\"
|
||||||
|
|
||||||
LDFLAGS = -L . -lm4
|
LDFLAGS = -L . -lm4
|
||||||
|
|
|
@ -1,15 +0,0 @@
|
||||||
sys/signal.h is not the POSIX appropriate place for signal.h, which mes libc
|
|
||||||
attempts to conform to.
|
|
||||||
|
|
||||||
diff -r -U3 src/m4.c src/m4.c
|
|
||||||
--- src/m4.c 1994-11-02 03:14:28.000000000 +0000
|
|
||||||
+++ src/m4.c 2021-01-15 00:19:21.947654461 +0000
|
|
||||||
@@ -19,7 +19,7 @@
|
|
||||||
#include "m4.h"
|
|
||||||
|
|
||||||
#include <getopt.h>
|
|
||||||
-#include <sys/signal.h>
|
|
||||||
+#include <signal.h>
|
|
||||||
|
|
||||||
static void usage _((int));
|
|
||||||
|
|
19
sysa/run.sh
19
sysa/run.sh
|
@ -9,19 +9,22 @@ set -e
|
||||||
|
|
||||||
export PREFIX=/after
|
export PREFIX=/after
|
||||||
|
|
||||||
# Part 21
|
# Part 20
|
||||||
build m4-1.4
|
build m4-1.4.4
|
||||||
|
|
||||||
# Part 22
|
# Part 21
|
||||||
build flex-2.5.11
|
build flex-2.5.11
|
||||||
|
|
||||||
# Part 23
|
# Part 22
|
||||||
build flex-2.5.14
|
|
||||||
|
|
||||||
# Part 24
|
|
||||||
build musl-1.1.24
|
build musl-1.1.24
|
||||||
|
|
||||||
# Part 25
|
# Part 23
|
||||||
build tcc-0.9.27 tcc-musl.sh
|
build tcc-0.9.27 tcc-musl.sh
|
||||||
|
|
||||||
|
# Part 24
|
||||||
|
build flex-2.6.4
|
||||||
|
|
||||||
|
# Part 25
|
||||||
|
build grep-2.4
|
||||||
|
|
||||||
echo "Bootstrapping completed."
|
echo "Bootstrapping completed."
|
||||||
|
|
Loading…
Reference in New Issue