commit: 089b6d6020e58780cf43d896edc7ce3a400a6b6c
parent 996e6f7c10ea46b22bf81c63351dc0de2fc54952
Author: Andrius Štikonas <andrius@stikonas.eu>
Date: Wed, 20 Jan 2021 19:05:10 +0000
Build grep-2.4.
Diffstat:
5 files changed, 55 insertions(+), 2 deletions(-)
diff --git a/rootfs.sh b/rootfs.sh
@@ -113,6 +113,9 @@ get_file https://ftp.gnu.org/gnu/make/make-3.80.tar.gz
# bzip2 1.0.8
get_file ftp://sourceware.org/pub/bzip2/bzip2-1.0.8.tar.gz
+# grep 2.4
+get_file https://ftp.gnu.org/gnu/grep/grep-2.4.tar.gz
+
# bash 2.05b
get_file https://ftp.gnu.org/pub/gnu/bash/bash-2.05b.tar.gz
diff --git a/sysa/after.kaem.run b/sysa/after.kaem.run
@@ -118,13 +118,19 @@ cd ${pkg}
kaem --file ${pkg}.kaem
cd ..
-# Part 15: bash
+# Part 15: grep
+pkg="grep-2.4"
+cd ${pkg}
+kaem --file ${pkg}.kaem
+cd ..
+
+# Part 16: bash
pkg="bash-2.05b"
cd ${pkg}
kaem --file ${pkg}.kaem
cd ..
-# Part 16: m4
+# Part 17: m4
pkg="m4-1.4"
cd ${pkg}
kaem --file ${pkg}.kaem
diff --git a/sysa/grep-2.4/grep-2.4.kaem b/sysa/grep-2.4/grep-2.4.kaem
@@ -0,0 +1,23 @@
+#!/bin/sh
+
+set -ex
+
+cd build
+
+# Extract
+gunzip ../src/${pkg}.tar.gz
+tar xf ../src/${pkg}.tar
+cd ${pkg}
+cp ../../mk/main.mk Makefile
+
+# Build
+make
+
+# Install
+cp grep /after/bin/grep
+chmod 755 /after/bin/grep
+
+# Test
+grep --version
+
+cd ../..
diff --git a/sysa/grep-2.4/mk/main.mk b/sysa/grep-2.4/mk/main.mk
@@ -0,0 +1,21 @@
+PACKAGE=grep
+VERSION=2.4
+
+CC = tcc
+LD = tcc
+AR = tcc -ar
+
+CFLAGS = -DPACKAGE=\"$(PACKAGE)\" \
+ -DVERSION=\"$(VERSION)\" \
+ -DHAVE_DIRENT_H=1 \
+ -DHAVE_UNISTD_H=1
+
+.PHONY: all
+
+GREP_SRC = grep dfa kwset obstack regex stpcpy savedir getopt getopt1 search grepmat
+GREP_OBJECTS = $(addprefix src/, $(addsuffix .o, $(GREP_SRC)))
+
+all: grep
+
+grep: $(GREP_OBJECTS)
+ $(CC) $(CFLAGS) $^ $(LDFLAGS) -o $@
diff --git a/sysa/grep-2.4/src/.placeholder b/sysa/grep-2.4/src/.placeholder