Merge pull request #31 from stikonas/diffutils
Move diffutils after musl.
This commit is contained in:
commit
b88fbd1a2d
38
README.md
38
README.md
|
@ -197,23 +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 11: diffutils 2.7
|
||||
|
||||
`diffutils` is useful for comparing two files. It is not immediately needed but
|
||||
is required later for autotools.
|
||||
|
||||
#### Part 12: patch 2.5.9
|
||||
#### Part 11: 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 13: patched mes-libc
|
||||
#### Part 12: 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 14: 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
|
||||
|
@ -222,18 +217,18 @@ 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 15: make 3.80
|
||||
#### Part 14: 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 16: bzip2 1.0.8
|
||||
#### Part 15: 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 17: coreutils 5.0.0
|
||||
#### Part 16: coreutils 5.0.0
|
||||
|
||||
GNU Coreutils is a collection of widely used utilities such as `cat`, `chmod`,
|
||||
`chown`, `cp`, `install`, `ln`, `ls`, `mkdir`, `mknod`, `mv`, `rm`, `rmdir`,
|
||||
|
@ -242,14 +237,14 @@ 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: heirloom devtools
|
||||
#### Part 17: 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 19: bash 2.05b
|
||||
#### Part 18: 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
|
||||
|
@ -259,13 +254,13 @@ 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 20: m4 1.4.4
|
||||
#### Part 19: 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 21: flex 2.5.11
|
||||
#### Part 20: flex 2.5.11
|
||||
|
||||
`flex` is a tool for generating lexers or scanners: programs that recognize
|
||||
lexical patters.
|
||||
|
@ -276,7 +271,7 @@ that 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 22: musl 1.1.24
|
||||
#### Part 21: 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`
|
||||
|
@ -288,21 +283,26 @@ complex programs.
|
|||
patches. In particular, we replace all weak symbols with strong symbols and will
|
||||
patch `tcc` in the next step to ignore duplicate symbols.
|
||||
|
||||
#### Part 23: tcc 0.9.27 (musl)
|
||||
#### Part 22: 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 24: flex 2.6.14
|
||||
#### Part 23: flex 2.6.14
|
||||
|
||||
We recompile unpatched GNU `flex` using older flex 2.5.11. This is again a two
|
||||
stage process, first compiling flex using `scan.c` (from `scan.l`) created by
|
||||
old flex, then recompile `scan.c` using the new version of flex to remove any
|
||||
buggy artifacts from the old flex.
|
||||
|
||||
#### Part 25: grep 2.4
|
||||
#### Part 24: grep 2.4
|
||||
|
||||
GNU `grep` is a pattern matching utility. Is is not immediately needed but will
|
||||
be useful later for autotools.
|
||||
|
||||
#### Part 25: diffutils 2.7
|
||||
|
||||
`diffutils` is useful for comparing two files. It is not immediately needed but
|
||||
is required later for autotools.
|
||||
|
|
|
@ -106,9 +106,6 @@ get_file() {
|
|||
# gzip 1.2.4
|
||||
get_file https://ftp.gnu.org/gnu/gzip/gzip-1.2.4.tar 1
|
||||
|
||||
# diffutils 2.7
|
||||
get_file https://ftp.gnu.org/gnu/diffutils/diffutils-2.7.tar.gz 1
|
||||
|
||||
# patch 2.5.9
|
||||
get_file https://ftp.gnu.org/pub/gnu/patch/patch-2.5.9.tar.gz 1
|
||||
|
||||
|
@ -142,6 +139,9 @@ get_file https://github.com/westes/flex/releases/download/v2.6.4/flex-2.6.4.tar.
|
|||
# grep 2.4
|
||||
get_file https://ftp.gnu.org/gnu/grep/grep-2.4.tar.gz
|
||||
|
||||
# diffutils 2.7
|
||||
get_file https://ftp.gnu.org/gnu/diffutils/diffutils-2.7.tar.gz
|
||||
|
||||
# General cleanup
|
||||
find tmp -name .git -exec rm -rf \;
|
||||
|
||||
|
|
|
@ -89,53 +89,47 @@ cd ${pkg}
|
|||
kaem --file ${pkg}.kaem
|
||||
cd ..
|
||||
|
||||
# Part 11: diffutils
|
||||
pkg="diffutils-2.7"
|
||||
cd ${pkg}
|
||||
kaem --file ${pkg}.kaem
|
||||
cd ..
|
||||
|
||||
# Part 12: patch
|
||||
# Part 11: patch
|
||||
pkg="patch-2.5.9"
|
||||
cd ${pkg}
|
||||
kaem --file ${pkg}.kaem
|
||||
cd ..
|
||||
|
||||
# Part 13: mes-libc-patched
|
||||
# Part 12: mes-libc-patched
|
||||
cd tcc-0.9.27
|
||||
kaem --file mes-libc-patched.kaem
|
||||
cd ..
|
||||
|
||||
# Part 14: tcc-patched
|
||||
# Part 13: tcc-patched
|
||||
cd tcc-0.9.27
|
||||
kaem --file tcc-patched.kaem
|
||||
cd ..
|
||||
|
||||
# Part 15: make
|
||||
# Part 14: make
|
||||
pkg="make-3.80"
|
||||
cd ${pkg}
|
||||
kaem --file ${pkg}.kaem
|
||||
cd ..
|
||||
|
||||
# Part 16: bzip2
|
||||
# Part 15: bzip2
|
||||
pkg="bzip2-1.0.8"
|
||||
cd ${pkg}
|
||||
kaem --file ${pkg}.kaem
|
||||
cd ..
|
||||
|
||||
# Part 17: coreutils
|
||||
# Part 16: coreutils
|
||||
pkg="coreutils-5.0"
|
||||
cd ${pkg}
|
||||
kaem --file ${pkg}.kaem
|
||||
cd ..
|
||||
|
||||
# Part 18: heirloom-devtools
|
||||
# Part 17: heirloom-devtools
|
||||
pkg="heirloom-devtools-070527"
|
||||
cd ${pkg}
|
||||
kaem --file ${pkg}.kaem
|
||||
cd ..
|
||||
|
||||
# Part 19: bash
|
||||
# Part 18: bash
|
||||
pkg="bash-2.05b"
|
||||
cd ${pkg}
|
||||
kaem --file ${pkg}.kaem
|
||||
|
|
|
@ -1,44 +0,0 @@
|
|||
#!/bin/sh
|
||||
|
||||
set -ex
|
||||
|
||||
cd build
|
||||
|
||||
# Extract
|
||||
gunzip ../src/${pkg}.tar.gz
|
||||
tar xf ../src/${pkg}.tar
|
||||
cd ${pkg}
|
||||
|
||||
# Touch config.h file
|
||||
catm config.h
|
||||
|
||||
# Compile
|
||||
tcc -c -I. -DNULL_DEVICE=\"/dev/null\" cmp.c
|
||||
tcc -c -I. cmpbuf.c
|
||||
tcc -c -I. error.c
|
||||
tcc -c -I. getopt.c
|
||||
tcc -c -I. getopt1.c
|
||||
tcc -c -I. xmalloc.c
|
||||
tcc -c -I. version.c
|
||||
tcc -c -I. diff.c
|
||||
tcc -c -I. analyze.c
|
||||
tcc -c -I. -DHAVE_DIRENT_H dir.c
|
||||
tcc -c -I. io.c
|
||||
tcc -c -I. -DHAVE_DUP2 -DHAVE_FORK=0 util.c
|
||||
tcc -c -I. context.c
|
||||
tcc -c -I. ed.c
|
||||
tcc -c -I. ifdef.c
|
||||
tcc -c -I. normal.c
|
||||
tcc -c -I. side.c
|
||||
tcc -c -I. fnmatch.c
|
||||
tcc -c -I. regex.c
|
||||
|
||||
# Link
|
||||
tcc -static -o ${bindir}/cmp cmp.o cmpbuf.o error.o getopt.o getopt1.o xmalloc.o version.o
|
||||
tcc -static -o ${bindir}/diff diff.o analyze.o cmpbuf.o dir.o io.o util.o context.o ed.o ifdef.o normal.o side.o fnmatch.o getopt.o getopt1.o regex.o version.o
|
||||
|
||||
# Test
|
||||
cmp --version
|
||||
diff --version
|
||||
|
||||
cd ../..
|
|
@ -0,0 +1,5 @@
|
|||
src_prepare() {
|
||||
default_src_prepare
|
||||
|
||||
touch config.h
|
||||
}
|
|
@ -0,0 +1,29 @@
|
|||
CC = tcc
|
||||
|
||||
CFLAGS = -I . \
|
||||
-DNULL_DEVICE=\"/dev/null\" \
|
||||
-DHAVE_STRERROR=1 \
|
||||
-DREGEX_MALLOC=1 \
|
||||
-DHAVE_DIRENT_H \
|
||||
-DHAVE_DUP2=1 \
|
||||
-DHAVE_FORK=1
|
||||
|
||||
.PHONY: all
|
||||
|
||||
CMP_SRC = cmp cmpbuf error getopt getopt1 xmalloc version
|
||||
CMP_OBJECTS = $(addsuffix .o, $(CMP_SRC))
|
||||
|
||||
DIFF_SRC = diff alloca analyze cmpbuf dir io util context ed ifdef normal side fnmatch getopt getopt1 regex version
|
||||
DIFF_OBJECTS = $(addsuffix .o, $(DIFF_SRC))
|
||||
|
||||
all: cmp diff
|
||||
|
||||
cmp: $(CMP_OBJECTS)
|
||||
$(CC) $(CFLAGS) $^ $(LDFLAGS) -o $@
|
||||
|
||||
diff: $(DIFF_OBJECTS)
|
||||
$(CC) $(CFLAGS) $^ $(LDFLAGS) -o $@
|
||||
|
||||
install: all
|
||||
install cmp $(PREFIX)/bin
|
||||
install diff $(PREFIX)/bin
|
15
sysa/run.sh
15
sysa/run.sh
|
@ -9,22 +9,25 @@ set -e
|
|||
|
||||
export PREFIX=/after
|
||||
|
||||
# Part 20
|
||||
# Part 19
|
||||
build m4-1.4.4
|
||||
|
||||
# Part 21
|
||||
# Part 20
|
||||
build flex-2.5.11
|
||||
|
||||
# Part 22
|
||||
# Part 21
|
||||
build musl-1.1.24
|
||||
|
||||
# Part 23
|
||||
# Part 22
|
||||
build tcc-0.9.27 tcc-musl.sh
|
||||
|
||||
# Part 24
|
||||
# Part 23
|
||||
build flex-2.6.4
|
||||
|
||||
# Part 25
|
||||
# Part 24
|
||||
build grep-2.4
|
||||
|
||||
# Part 25
|
||||
build diffutils-2.7
|
||||
|
||||
echo "Bootstrapping completed."
|
||||
|
|
Loading…
Reference in New Issue