Build most utils from coreutils-5.0.

This commit is contained in:
Andrius Štikonas 2021-01-20 19:23:48 +00:00
parent e0335ce910
commit d26463ffa2
8 changed files with 194 additions and 3 deletions

View file

@ -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
# coreutils 5.0
get_file https://ftp.gnu.org/gnu/coreutils/coreutils-5.0.tar.bz2
# grep 2.4
get_file https://ftp.gnu.org/gnu/grep/grep-2.4.tar.gz

View file

@ -118,19 +118,25 @@ cd ${pkg}
kaem --file ${pkg}.kaem
cd ..
# Part 15: grep
# Part 15: coreutils
pkg="coreutils-5.0"
cd ${pkg}
kaem --file ${pkg}.kaem
cd ..
# Part 16: grep
pkg="grep-2.4"
cd ${pkg}
kaem --file ${pkg}.kaem
cd ..
# Part 16: bash
# Part 17: bash
pkg="bash-2.05b"
cd ${pkg}
kaem --file ${pkg}.kaem
cd ..
# Part 17: m4
# Part 18: m4
pkg="m4-1.4"
cd ${pkg}
kaem --file ${pkg}.kaem

View file

View file

@ -0,0 +1,24 @@
#!/bin/sh
set -ex
cd build
# Extract
bunzip2 ../src/${pkg}.tar.bz2
tar xf ../src/${pkg}.tar
cd ${pkg}
cp ../../mk/main.mk Makefile
# Patch and prepare
cp lib/fnmatch_.h lib/fnmatch.h
cp lib/ftw_.h lib/ftw.h
cp lib/search_.h lib/search.h
catm config.h
patch -Np0 -i ../../patches/modechange.patch
patch -Np0 -i ../../patches/mbstate.patch
# Build and install
/after/bin/make -f Makefile
/after/bin/make -f Makefile install

View file

@ -0,0 +1,110 @@
PACKAGE=coreutils
PACKAGE_NAME=GNU\ coreutils
PACKAGE_BUGREPORT=bug-coreutils@gnu.org
PACKAGE_VERSION=5.0
VERSION=5.0
CC = tcc
LD = tcc
AR = tcc -ar
bindir=/after/bin
CFLAGS = -I . -I lib \
-DPACKAGE=\"$(PACKAGE)\" \
-DPACKAGE_NAME=\"$(PACKAGE_NAME)\" \
-DGNU_PACKAGE=\"$(PACKAGE_NAME)\" \
-DPACKAGE_BUGREPORT=\"$(PACKAGE_BUGREPORT)\" \
-DPACKAGE_VERSION=\"$(PACKAGE_VERSION)\" \
-DVERSION=\"$(VERSION)\" \
-DHAVE_LIMITS_H=1 \
-DHAVE_DECL_FREE=1 \
-DHAVE_DECL_MALLOC=1 \
-DHAVE_MALLOC=1 \
-DHAVE_STDLIB_H=1 \
-DHAVE_REALLOC=1 \
-DHAVE_DECL_REALLOC=1 \
-DHAVE_DECL_GETENV=1 \
-DHAVE_DIRENT_H=1 \
-DHAVE_DECL___FPENDING=0 \
-DSTDC_HEADERS=1 \
-DHAVE_ALLOCA_H=1 \
-DHAVE_STRUCT_TIMESPEC=1 \
-DHAVE_STRING_H=1 \
-DHAVE_SYS_TIME_H=1 \
-DTIME_WITH_SYS_TIME=1 \
-DHAVE_STDINT_H=1 \
-DMB_LEN_MAX=16 \
-DLIBDIR=\"/after/lib\" \
-DHAVE_DECL_WCWIDTH=0 \
-DHAVE_SYS_STAT_H=1 \
-DHAVE_INTTYPES_H=1 \
-DHAVE_DECL_MEMCHR=1 \
-DHAVE_MEMORY_H=1 \
-DPENDING_OUTPUT_N_BYTES=1 \
-DCHAR_MIN=0 \
-DLOCALEDIR=NULL \
-DHAVE_FCNTL_H=1 \
-DEPERM=1 \
-DHAVE_DECL_STRTOUL=1 \
-DHAVE_DECL_STRTOULL=1 \
-DHAVE_DECL_STRTOL=1 \
-DHAVE_DECL_STRTOLL=1 \
-DHAVE_RMDIR=1 \
-DRMDIR_ERRNO_NOT_EMPTY=39 \
-DHAVE_DECL_FREE=1 \
-DENOTEMPTY=1 \
-DLSTAT_FOLLOWS_SLASHED_SYMLINK=1 \
-DHAVE_DECL_DIRFD=0 \
-DLC_TIME=\"C\" \
-DLC_COLLATE=\"C\" \
-DHAVE_GETCWD=1 \
-Dmy_strftime=nstrftime \
-DDIR_TO_FD\(Dir_p\)=-1 \
-DUTILS_OPEN_MAX=1000
.PHONY: all install
SRC_DIR=src
COREUTILS = basename cat chmod cksum csplit cut echo expand factor false fmt fold head id join kill link ln logname mkfifo mkdir nl od paste pathchk printf ptx pwd readlink rmdir seq split sum tail tee touch tr tsort unexpand unlink wc whoami
BINARIES = $(addprefix $(SRC_DIR)/, $(COREUTILS))
ALL=$(BINARIES) $(SRC_DIR)/install $(SRC_DIR)/md5sum $(SRC_DIR)/mv $(SRC_DIR)/rm $(SRC_DIR)/sha1sum
all: $(BINARIES) $(SRC_DIR)/install $(SRC_DIR)/md5sum $(SRC_DIR)/mv $(SRC_DIR)/rm $(SRC_DIR)/sha1sum
LIB_DIR = lib
LIB_SRC = acl getdate posixtm posixver strftime getopt getopt1 hash hash-pjw addext argmatch backupfile basename canon-host closeout cycle-check diacrit dirname dup-safer error exclude exitfail filemode __fpending file-type fnmatch fopen-safer full-read full-write getline getstr gettime hard-locale human idcache isdir imaxtostr linebuffer localcharset long-options makepath mbswidth md5 memcasecmp memcoll modechange offtostr path-concat physmem quote quotearg readtokens rpmatch safe-read safe-write same save-cwd savedir settime sha stpcpy stripslash strtoimax strtoumax umaxtostr unicodeio userspec version-etc xgetcwd xgethostname xmalloc xmemcoll xnanosleep xreadlink xstrdup xstrtod xstrtol xstrtoul xstrtoimax xstrtoumax yesno strnlen getcwd sig2str mountlist regex canonicalize mkstemp memrchr euidaccess ftw dirfd obstack strverscmp strftime tsearch
LIB_OBJECTS = $(addprefix $(LIB_DIR)/, $(addsuffix .o, $(LIB_SRC)))
$(LIB_DIR)/libfettish.a: $(LIB_OBJECTS)
$(AR) cr $@ $^
$(BINARIES) : % : %.o $(LIB_DIR)/libfettish.a
$(CC) $(CFLAGS) $^ $(LDFLAGS) -o $@
$(SRC_DIR)/cp: $(SRC_DIR)/cp.o $(SRC_DIR)/copy.o $(SRC_DIR)/cp-hash.c $(LIB_DIR)/libfettish.a
$(CC) $(CFLAGS) $^ $(LDFLAGS) -o $@
$(SRC_DIR)/install: $(SRC_DIR)/install.o $(SRC_DIR)/copy.o $(SRC_DIR)/cp-hash.c $(LIB_DIR)/libfettish.a
$(CC) $(CFLAGS) $^ $(LDFLAGS) -o $@
$(SRC_DIR)/ls: $(SRC_DIR)/ls.o $(SRC_DIR)/ls-ls.o $(LIB_DIR)/libfettish.a
$(CC) $(CFLAGS) $^ $(LDFLAGS) -o $@
$(SRC_DIR)/md5sum: $(SRC_DIR)/md5.o $(SRC_DIR)/md5sum.o $(LIB_DIR)/libfettish.a
$(CC) $(CFLAGS) $^ $(LDFLAGS) -o $@
$(SRC_DIR)/mv: $(SRC_DIR)/mv.o $(SRC_DIR)/copy.o $(SRC_DIR)/remove.o $(SRC_DIR)/cp-hash.o $(LIB_DIR)/libfettish.a
$(CC) $(CFLAGS) $^ $(LDFLAGS) -o $@
$(SRC_DIR)/rm: $(SRC_DIR)/rm.o $(SRC_DIR)/remove.o $(LIB_DIR)/libfettish.a
$(CC) $(CFLAGS) $^ $(LDFLAGS) -o $@
$(SRC_DIR)/sha1sum: $(SRC_DIR)/sha1sum.o $(SRC_DIR)/md5sum.o $(LIB_DIR)/libfettish.a
$(CC) $(CFLAGS) $^ $(LDFLAGS) -o $@
install: $(ALL)
$(SRC_DIR)/install $^ $(bindir)

View file

@ -0,0 +1,36 @@
--- lib/quotearg.c 2002-11-23 07:08:10.000000000 +0000
+++ lib/quotearg.c 2021-01-17 19:41:59.461095532 +0000
@@ -21,6 +21,7 @@
# include <config.h>
#endif
+#include "mbstate_t.h"
#include "quotearg.h"
#include "xalloc.h"
--- lib/mbstate_t.h 1970-01-01 01:00:00.000000000 +0100
+++ lib/mbstate_t.h 2021-01-17 19:42:21.341658668 +0000
@@ -0,0 +1,23 @@
+#ifndef ____mbstate_t_defined
+#define ____mbstate_t_defined 1
+
+/* Integral type unchanged by default argument promotions that can
+ hold any value corresponding to members of the extended character
+ set, as well as at least one value that does not correspond to any
+ member of the extended character set. */
+#ifndef __WINT_TYPE__
+# define __WINT_TYPE__ unsigned int
+#endif
+
+/* Conversion state information. */
+typedef struct
+{
+ int __count;
+ union
+ {
+ __WINT_TYPE__ __wch;
+ char __wchb[4];
+ } __value; /* Value so far. */
+} mbstate_t;
+
+#endif

View file

@ -0,0 +1,12 @@
--- lib/modechange.c 2001-12-09 22:54:19.000000000 +0000
+++ lib/modechange.c 2021-01-17 18:34:22.016427148 +0000
@@ -28,8 +28,8 @@
# include <config.h>
#endif
-#include "modechange.h"
#include <sys/stat.h>
+#include "modechange.h"
#include "xstrtol.h"
#if STDC_HEADERS

View file