Add untar.c

This commit is contained in:
Andrius Štikonas 2021-04-15 01:00:51 +01:00
parent 0d64413670
commit f030a3a74e
10 changed files with 56 additions and 29 deletions

View File

@ -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

View File

@ -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
=========

19
sysa.py
View File

@ -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)

View File

@ -50,20 +50,26 @@ cd ${pkg}
kaem --file ${pkg}.kaem
cd ..
# untar
pkg="untar"
cd ${pkg}
kaem --file ${pkg}.kaem
cd ..
# tcc 0.9.27
pkg="tcc-0.9.27"
cd ${pkg}
kaem --file ${pkg}.kaem
cd ..
# tar
pkg="tar-1.12"
# gzip
pkg="gzip-1.2.4"
cd ${pkg}
kaem --file ${pkg}.kaem
cd ..
# gzip
pkg="gzip-1.2.4"
# tar
pkg="tar-1.12"
cd ${pkg}
kaem --file ${pkg}.kaem
cd ..

View File

@ -11,7 +11,7 @@ set -ex
cd build
# Extract
tar xf ../src/${pkg}.tar
untar ../src/${pkg}.tar
cd ${pkg}
# Compile

View File

@ -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

View File

@ -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

View File

@ -1,6 +1,5 @@
#!/bin/sh
# SPDX-FileCopyrightText: 2021 fosslinux <fosslinux@aussies.space>
# SPDX-FileCopyrightText: 2021 fosslinux <fosslinux@aussies.space>
#
# SPDX-License-Identifier: GPL-3.0-or-later

1
sysa/untar/checksums Normal file
View File

@ -0,0 +1 @@
27524 /after/bin/untar

14
sysa/untar/untar.kaem Executable file
View File

@ -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