commit: f030a3a74e54132f0510e809a243be45eea3fc2e
parent 0d64413670e9a848c2ee57ee6b46a24b17dc0987
Author: Andrius Štikonas <andrius@stikonas.eu>
Date: Thu, 15 Apr 2021 01:00:51 +0100
Add untar.c
Diffstat:
10 files changed, 56 insertions(+), 29 deletions(-)
diff --git a/SHA256SUMS.sources b/SHA256SUMS.sources
@@ -56,4 +56,5 @@ c365874794187f8444e5d22998cd5888ffa47f36def4b77517a808dec27c0600 sed-4.0.9.tar.
404a8d72427a559c074e581bf8f7d5a73283faf249cd3faf6dc1c6faf97d07c7 sha-2-61555d.tar.gz
c6c37e888b136ccefab903c51149f4b7bd659d69d4aea21245f61053a57aa60a tar-1.12.tar.gz
63bebd26879c5e1eea4352f0d03c991f966aeb3ddeb3c7445c902568d5411d28 tar-1.34.tar.xz
+1b700d375e253e88bdf79caa244284a899b80f59fd64fdd3aaa6408b7bd715ae untar.c
166c48d2842519bc4f96333bff9e265f8cdda44d38e40594ef3f9bbb52890490 xz-5.0.5.tar.bz2
diff --git a/parts.rst b/parts.rst
@@ -85,6 +85,14 @@ recompiled 5(!) times to add new features that are required for other
features, namely ``long long`` and ``float``. Each time, the libc is
also recompiled.
+untar
+=====
+
+``tar`` is the most common archive format used by software source
+code, often compressed also. To avoid continuing using submodules we
+switch to software distribution using tar tarchives. ``untar.c`` is
+a single file implementation of tar format and is part of libarchive 3.4.
+
tinycc 0.9.27
=============
@@ -97,13 +105,6 @@ old GNU software, using older versions compilable by tinycc. Prior to
this point, all tools have been adapted significantly for the bootstrap;
now, we will be using old tooling instead.
-tar 1.12
-========
-
-GNU ``tar`` is the most common archive format used by software source
-code, often compressed also. To avoid continuing using submodules, we
-build GNU tar 1.12, the last version compilable with mes libc.
-
gzip 1.2.4
==========
@@ -113,6 +114,11 @@ which we extract and then build.
Going forward, we can now use ``.tar.gz`` for source code.
+tar 1.12
+========
+
+We build GNU tar 1.12, the last version compilable with mes libc.
+
sed 4.0.9
=========
diff --git a/sysa.py b/sysa.py
@@ -10,7 +10,7 @@ import shutil
import requests
-from lib.utils import mount, umount, copytree, run, get_target
+from lib.utils import mount, umount, copytree, get_target
class SysA:
@@ -191,7 +191,6 @@ class SysA:
self.mes()
self.tcc_0_9_26()
self.tcc_0_9_27()
- self.tar_1_12()
self.get_packages()
def create_after_dirs(self):
@@ -257,24 +256,18 @@ class SysA:
"""TinyCC 0.9.27"""
copytree(os.path.join(self.sysa_dir, 'tcc-0.9.27'), self.after_dir)
- def tar_1_12(self):
- """GNU Tar 1.12"""
- # We have to pre-unpack tar sources.
- # Possible alternative is to build a single C file implementation of untar.
- tar_url = "https://mirrors.kernel.org/gnu/tar/tar-1.12.tar.gz"
- self.get_file(tar_url)
- tar_src_dir = os.path.join(self.after_dir, 'tar-1.12', 'src')
- tar_tarball = os.path.join(tar_src_dir, os.path.basename(tar_url))
-
- run('tar', '-C', tar_src_dir, '-xf', tar_tarball, '--strip-components=1')
-
# pylint: disable=line-too-long,too-many-statements
def get_packages(self):
"""Prepare remaining sources"""
+ # untar from libarchive 3.4
+ self.get_file("https://raw.githubusercontent.com/libarchive/libarchive/3.4/contrib/untar.c", mkbuild=True)
# gzip 1.2.4
self.get_file("https://mirrors.kernel.org/gnu/gzip/gzip-1.2.4.tar", mkbuild=True)
+ # tar 1.12
+ self.get_file("https://mirrors.kernel.org/gnu/tar/tar-1.12.tar.gz", mkbuild=True)
+
# sed 4.0.9
self.get_file("https://mirrors.kernel.org/gnu/sed/sed-4.0.9.tar.gz", mkbuild=True)
diff --git a/sysa/after.kaem.run b/sysa/after.kaem.run
@@ -50,14 +50,14 @@ cd ${pkg}
kaem --file ${pkg}.kaem
cd ..
-# tcc 0.9.27
-pkg="tcc-0.9.27"
+# untar
+pkg="untar"
cd ${pkg}
kaem --file ${pkg}.kaem
cd ..
-# tar
-pkg="tar-1.12"
+# tcc 0.9.27
+pkg="tcc-0.9.27"
cd ${pkg}
kaem --file ${pkg}.kaem
cd ..
@@ -68,6 +68,12 @@ cd ${pkg}
kaem --file ${pkg}.kaem
cd ..
+# tar
+pkg="tar-1.12"
+cd ${pkg}
+kaem --file ${pkg}.kaem
+cd ..
+
# sed
pkg="sed-4.0.9"
cd ${pkg}
diff --git a/sysa/gzip-1.2.4/gzip-1.2.4.kaem b/sysa/gzip-1.2.4/gzip-1.2.4.kaem
@@ -11,7 +11,7 @@ set -ex
cd build
# Extract
-tar xf ../src/${pkg}.tar
+untar ../src/${pkg}.tar
cd ${pkg}
# Compile
diff --git a/sysa/pre-sha.sha256sums b/sysa/pre-sha.sha256sums
@@ -15,6 +15,7 @@ e94a2468c045582cfd13df51acd0932afdc834fa60139f7bfb7a2d65afa39a65 /after/bin/mes
3cf426251744300a099a40f3609ccbd32ec3b9f3334601defa5736e7fd6c6f1d /after/bin/patch
d453932b7d83fc3e183afeca65c1afb2a620b985c378ee072710e0cc593d9811 /after/bin/sed
bc9ddf9854bd954c71bb1cf5b0af77fd65b8fa7f290b42c75020fb8893deb53c /after/bin/sha256sum
+74e0a13cb6e92d70c43f71ec704afbc44b7a38c703fe40700f7af7c640a22158 /after/bin/untar
957229511dc5ac62a949dbd76e965e3a476ce214b8e6fc7f120bf17d195b924b /after/bin/tar
690c2a941c444ba761076f6b8ef1ba2b634ebe2e63ea44c8f3789f6e3df6d2a9 /after/bin/tcc
cacc2cda3ce6c2cc0cb761b8aa2115a003e166c94d1039974fc0221263897c52 /after/bin/tcc-0.9.26
diff --git a/sysa/tar-1.12/tar-1.12.kaem b/sysa/tar-1.12/tar-1.12.kaem
@@ -8,9 +8,15 @@
set -ex
-cp files/getdate_stub.c src/lib/getdate_stub.c
+cd build
-cd src
+# Extract
+gunzip ../src/${pkg}.tar.gz
+untar ../src/${pkg}.tar
+
+cd ${pkg}
+
+cp ../../files/getdate_stub.c lib/getdate_stub.c
# Compile
@@ -57,7 +63,7 @@ tcc -c -I lib -DSIZEOF_UNSIGNED_LONG=4 -DHAVE_FCNTL_H src/update.c
# Link
tcc -static -o ${bindir}/tar -L lib lib/libtar.a arith.o buffer.o compare.o create.o delete.o extract.o incremen.o list.o mangle.o misc.o names.o open3.o rtapelib.o tar.o update.o -ltar
-cd ..
+cd ../..
# Checksums
fletcher16 checksums
diff --git a/sysa/tcc-0.9.27/tcc-patched.kaem b/sysa/tcc-0.9.27/tcc-patched.kaem
@@ -1,7 +1,6 @@
#!/bin/sh
# SPDX-FileCopyrightText: 2021 fosslinux <fosslinux@aussies.space>
-# SPDX-FileCopyrightText: 2021 fosslinux <fosslinux@aussies.space>
#
# SPDX-License-Identifier: GPL-3.0-or-later
diff --git a/sysa/untar/checksums b/sysa/untar/checksums
@@ -0,0 +1 @@
+27524 /after/bin/untar
diff --git a/sysa/untar/untar.kaem b/sysa/untar/untar.kaem
@@ -0,0 +1,14 @@
+#!/bin/sh
+
+# SPDX-FileCopyrightText: 2021 Andrius Štikonas <andrius@stikonas.eu>
+#
+# SPDX-License-Identifier: GPL-3.0-or-later
+
+set -ex
+
+# Compile
+# 0.9.26 is intentional as later tcc segfaults when linking
+tcc-0.9.26 src/untar.c -o ${bindir}/untar
+
+# Checksums
+fletcher16 checksums