commit: 238e9359b0d6321165367f7ef6719d5629aaf251
parent 3405518e2eb755a153ba9169f885d09754020116
Author: Andrius Štikonas <andrius@stikonas.eu>
Date: Mon, 11 Jan 2021 20:44:07 +0000
Build gzip 1.2.4.
Diffstat:
3 files changed, 48 insertions(+), 0 deletions(-)
diff --git a/rootfs.sh b/rootfs.sh
@@ -87,6 +87,14 @@ popd
cp "$(basename $url .tar.gz).kaem" tmp/after
tar -C tmp/after -xf "../sources/$(basename $url)"
+# gzip 1.2.4
+url=https://ftp.gnu.org/gnu/gzip/gzip-1.2.4.tar
+pushd ../sources
+wget --continue "$url"
+popd
+cp "$(basename $url .tar).kaem" tmp/after
+cp "../sources/$(basename $url)" tmp/after
+
# General cleanup
find tmp -name .git -exec rm -rf \;
diff --git a/sysa/after.kaem.run b/sysa/after.kaem.run
@@ -57,3 +57,9 @@ cd ..
cd tar-1.12
kaem --file ../tar-1.12.kaem
cd ..
+
+# Part 9: gzip
+/after/bin/tar xf gzip-1.2.4.tar
+cd gzip-1.2.4
+kaem --file ../gzip-1.2.4.kaem
+cd ..
diff --git a/sysa/gzip-1.2.4.kaem b/sysa/gzip-1.2.4.kaem
@@ -0,0 +1,34 @@
+#!/bin/sh
+
+set -ex
+
+# Variables
+bindir=/after/bin
+
+# Compile
+tcc -c -DNO_UTIME gzip.c
+tcc -c bits.c
+tcc -c crypt.c
+tcc -c deflate.c
+tcc -c getopt.c
+tcc -c inflate.c
+tcc -c lzw.c
+tcc -c trees.c
+tcc -c unlzh.c
+tcc -c unlzw.c
+tcc -c unpack.c
+tcc -c unzip.c
+# Remove strlwr, it does not build with mes libc
+cp util.c util_patched.c
+sed -i 165,174d util_patched.c
+tcc -c util_patched.c
+tcc -c zip.c
+
+# Link
+tcc -static -o ${bindir}/gzip gzip.o zip.o deflate.o trees.o bits.o unzip.o inflate.o util_patched.o crypt.o lzw.o unlzw.o unpack.o unlzh.o getopt.o
+
+# Install
+cp ${bindir}/gzip ${bindir}/gunzip
+cp ${bindir}/gzip ${bindir}/zcat
+chmod 755 ${bindir}/gunzip
+chmod 755 ${bindir}/zcat