mirror of
https://github.com/fosslinux/live-bootstrap.git
synced 2026-03-04 02:15:24 +01:00
Remove the notion of "sys*"
- This idea originates from very early in the project and was, at the
time, a very easy way to categorise things.
- Now, it doesn't really make much sense - it is fairly arbitary, often
occuring when there is a change in kernel, but not from builder-hex0
to fiwix, and sysb is in reality completely unnecessary.
- In short, the sys* stuff is a bit of a mess that makes the project
more difficult to understand.
- This puts everything down into one folder and has a manifest file that
is used to generate the build scripts on the fly rather than using
coded scripts.
- This is created in the "seed" stage.
stage0-posix -- (calls) --> seed -- (generates) --> main steps
Alongside this change there are a variety of other smaller fixups to the
general structure of the live-bootstrap rootfs.
- Creating a rootfs has become much simpler and is defined as code in
go.sh. The new structure, for an about-to-be booted system, is
/
-- /steps (direct copy of steps/)
-- /distfiles (direct copy of distfiles/)
-- all files from seed/*
-- all files from seed/stage0-posix/*
- There is no longer such a thing as /usr/include/musl, this didn't
really make any sense, as musl is the final libc used. Rather, to
separate musl and mes, we have /usr/include/mes, which is much easier
to work with.
- This also makes mes easier to blow away later.
- A few things that weren't properly in packages have been changed;
checksum-transcriber, simple-patch, kexec-fiwix have all been given
fully qualified package names.
- Highly breaking change, scripts now exist in their package directory
but NOT WITH THE packagename.sh. Rather, they use pass1.sh, pass2.sh,
etc. This avoids manual definition of passes.
- Ditto with patches; default directory is patches, but then any patch
series specific to a pass are named patches-passX.
This commit is contained in:
parent
0907cfd073
commit
6ed2e09f3a
546 changed files with 700 additions and 1299 deletions
61
steps/coreutils-5.0/coreutils-5.0.checksums
Normal file
61
steps/coreutils-5.0/coreutils-5.0.checksums
Normal file
|
|
@ -0,0 +1,61 @@
|
|||
292fcbf47ee383832767bb2bb8b378f96a14dd68725270ae0db5539a94d031f3 /usr/bin/install
|
||||
a57f7328c2a81bd50fe5c83015406634baa8747211f912c9090e162e70735110 /usr/bin/basename
|
||||
f2e6cf099ee87d2f4a3b1e62db57075fab98ee3d2d5839ff9e81eb0ac0e37137 /usr/bin/cat
|
||||
9c77061b24adf9ba42951f8008dc457bcefff17b87d867f09a61f0c96817f083 /usr/bin/chmod
|
||||
669211c275348cff62c580d96119af225735746c0168edb63492116bf9647bd1 /usr/bin/cksum
|
||||
5be51d83898d33ffced444433fb977bd576e7bd3c37330f311458502f990083a /usr/bin/cp
|
||||
e72996b66d573cfb1f27120ade2fd29bc9582e79057d8d43b6081aea510562d4 /usr/bin/csplit
|
||||
a22cc2f79c70fac946e79fd93551578505c69a76beba68cbebb8d32e323a3e49 /usr/bin/cut
|
||||
9e2b178412eaa6b8442940b632452d931af50dc8be1c770d47e752248d9fd4ea /usr/bin/dirname
|
||||
42d8967cdfdd14e9f6f4ad6feb3e899f491ce2dcb6cb62f5160b6bd217bc4a04 /usr/bin/echo
|
||||
dda7112d7c33fe77486f4336d5d57cc3228ce9a18082332250af2c0be57391b0 /usr/bin/expand
|
||||
6f32c1383580aa37c9877eaed65090839dd3d12d8868ded3147c1adbdeb9a909 /usr/bin/expr
|
||||
d8eaa5d9d8e601fdbbe4715e5632a55efa986e691027590ac5905c150d8e4f94 /usr/bin/factor
|
||||
9f1f38e219d15070ece6229c3f75e40f11e5a3aaf426ee17745b95bb5205c94d /usr/bin/false
|
||||
98915280c8bad059cfb1bf99636dc69bf33532f7a982bd086d2114e0daa39a76 /usr/bin/fmt
|
||||
a8f6d99bc641f486ebdbc1bc5adb1b9fa424aceb4d9e0cc62ce08ceb43541c88 /usr/bin/fold
|
||||
4d215db24218e8b6dfeeea05268477fac56b11651d789a5972945a15ab7b2917 /usr/bin/head
|
||||
52718fa65c99150a773da13f4b155f8843391219f89d4aa0d5fe1d3cc9cf36b0 /usr/bin/hostname
|
||||
fc845714f8d461698daaadcd7bb507d4228c09504b886a679c129226727186d0 /usr/bin/id
|
||||
2fbe6af8f5c01521edacff2d145b8ee392489684e1624157e1e1841aade290a2 /usr/bin/join
|
||||
ea4e13ec9e2f622600d961be4f41de96251e429e7ed8a881be8fb70c379b80de /usr/bin/kill
|
||||
5c606a0febaeca39455847b11ea2ad1445cd4bfd40e187e4e3499c23e0dc2d43 /usr/bin/link
|
||||
52c561306a91197034106b20678da1b06e77228ab77a3ce40639fa1c132d44bc /usr/bin/ln
|
||||
2d7450a962ffdb434d2061aa36e74aa18e1e3e5d237eb39ccd3851a34a819694 /usr/bin/logname
|
||||
bb651823aa51315576d30c79c84248577bce2daab9be4cbcaedabdf2aef882a5 /usr/bin/mkfifo
|
||||
051a8465ba5e34d0f8c84f34f618b2ff059e566bf52d36c572d164762eca3618 /usr/bin/mkdir
|
||||
50be768057f0284b4b9cc034b990cc739228b96449c1c2062d9d98c778b1d4b5 /usr/bin/mknod
|
||||
e7c50e668907ce88388f127b2f07aed6dc10ddb6a8c9313f4269ed5b7e923c92 /usr/bin/nl
|
||||
ae1033bcc79daca95df1feefa3b4d64c0313cc2bf021efcf14760cccc5b42215 /usr/bin/od
|
||||
79aa11388de19028de66b06ce6e0983ba0d558b146aed51ce293d599fcaec627 /usr/bin/paste
|
||||
70eb12b8db8550d5b642df34d28f19e76a768a425efccaa8dfaee18c41db1228 /usr/bin/pathchk
|
||||
1fa81f879efc48472ab093eb82edc429736a10078aecab04d2b2cfb9634b47ef /usr/bin/pr
|
||||
8913fd449afc122c42b99b89b04428a22e7f07e032eaa530cbd076e611849a23 /usr/bin/printf
|
||||
b87663d81cc361221e643ca9f064995c7333f7c650f918393c9bb4482d8667e3 /usr/bin/ptx
|
||||
d31910a5308cfe80f2136677234d515728a06c84f60441f131d2b8dd878ce3aa /usr/bin/pwd
|
||||
84290d1d0a662ffc8d0ec314bbffa53aaacdae4104d8ba8f9a56d8896e97923b /usr/bin/readlink
|
||||
55dfb9a4c9c1f4efe74aaceaad37baff1e9f24acea83ac92a7008b703394edd4 /usr/bin/rmdir
|
||||
fec6d4f310ee0ad79fc76a23ed440b916502bc30af41c4a5e1ed578d2dca91f3 /usr/bin/seq
|
||||
1d0c39f163aa5029d867a091e5d1963b8e55aec09c33cd99da237df7e5b31e60 /usr/bin/sleep
|
||||
355ba0b4e1e655cfde75c493d907a68dbe2acf12adec88eaad019f231de1e75b /usr/bin/sort
|
||||
96ab28039a859a5b78f142aabe75f55b560e340e350751ce3696d02903dfb31f /usr/bin/split
|
||||
8852646f277cfbb01eff42c903f03248a7e3e9833cf3655c78a34f02687872ee /usr/bin/sum
|
||||
79b02fef988b77c1e3adee565aa474aec05e522ef4a5fd4635ca9bb6b1e65b6c /usr/bin/tail
|
||||
91038661556a3c6e91d4f45b41e44388bf62aea5a37abeca3395740344e03890 /usr/bin/tee
|
||||
0c4517c49db58cd700f588281557514894e5c924bfad5df129a70ff46d4a8dae /usr/bin/tr
|
||||
2d897818467998063800a4e92c50fa855b090202da11831f87be17665fd44a29 /usr/bin/tsort
|
||||
f8ca50f4d91ef6233049e2bd68cf6aa05a300a16d9fba2dce2e90e085ab8f401 /usr/bin/unexpand
|
||||
c8066c50b1a6f654a4cd1adc69e3a7fd58c6fa6ce987617c54b0d2668cb39daf /usr/bin/uniq
|
||||
93feee6a854be3a733f9e7a4e421e274f0781d235c02421b837fee3134c47897 /usr/bin/unlink
|
||||
a31f4b48b7517a348b44621e8d572eda835ffcdb7a97f64b1d7e78d67a38c84f /usr/bin/wc
|
||||
fae709b45aca8b7e4630aa853681b6f1d053135b4a5c8f72477a1e311f1e4616 /usr/bin/whoami
|
||||
11a17c10d03e56012685851f96145fe8a4701fd4ecbf05bad1c19b92fe97f347 /usr/bin/tac
|
||||
ceac9200b63c7b8b3cda19ca4e90b7d619c3bbd412834a7cb14ae022e5f05fa2 /usr/bin/test
|
||||
958a28e582bb69c684f666e2b47b98ff27d3b9a6177549444b85c03aad746c3d /usr/bin/touch
|
||||
05dc8f5f6d78716f649eb7ad5d355a67b6e133e241efcd0b99d5bd1b3c01b3b1 /usr/bin/true
|
||||
2203da05ecbf1d8be50e4c9669d78f8c45aa09055e55486322e18f9874cb3b4e /usr/bin/yes
|
||||
7ec9570369e239d3f295490250fc0d79c32fd6cf2d7d4eb02042c56c67d8bc86 /usr/bin/ls
|
||||
8323119905c2d42d9aefafb214ae314b7b9103247263328472d909fd794ffe8a /usr/bin/md5sum
|
||||
e2ed596c2adba6cab2853cea203f66bf5aeee85d3424685acffc567dc417459a /usr/bin/mv
|
||||
cb67b297e4e4f124f6c0a2a392fb8934ea8c07af4155bd7d49f367b9c77f4719 /usr/bin/rm
|
||||
b51e023e8e70a8cc6dadaba1a789c5c8c96dc526f224a1e8de44e57aad31ca7a /usr/bin/sha1sum
|
||||
127
steps/coreutils-5.0/mk/main.mk
Normal file
127
steps/coreutils-5.0/mk/main.mk
Normal file
|
|
@ -0,0 +1,127 @@
|
|||
# SPDX-FileCopyrightText: 2021 Andrius Štikonas <andrius@stikonas.eu>
|
||||
# SPDX-FileCopyrightText: 2021 Paul Dersey <pdersey@gmail.com>
|
||||
# SPDX-FileCopyrightText: 2023 Emily Trau <emily@downunderctf.com>
|
||||
#
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
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
|
||||
LDFLAGS = -static
|
||||
|
||||
bindir=$(PREFIX)/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=\"$(PREFIX)/lib/mes\" \
|
||||
-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 \
|
||||
-Dmkstemp=rpl_mkstemp \
|
||||
-DDIR_TO_FD\(Dir_p\)=-1 \
|
||||
-DUTILS_OPEN_MAX=1000 \
|
||||
-Dmajor_t=unsigned \
|
||||
-Dminor_t=unsigned
|
||||
|
||||
.PHONY: all install
|
||||
|
||||
SRC_DIR=src
|
||||
|
||||
COREUTILS = basename cat chmod cksum csplit cut dirname echo expand expr factor false fmt fold head hostname id join kill link ln logname mkfifo mkdir mknod nl od paste pathchk pr printf ptx pwd readlink rmdir seq sleep sort split sum tail tee tr tsort unexpand uniq unlink wc whoami tac test touch true yes
|
||||
|
||||
BINARIES = $(addprefix $(SRC_DIR)/, $(COREUTILS))
|
||||
|
||||
ALL=$(BINARIES) $(SRC_DIR)/cp $(SRC_DIR)/ls $(SRC_DIR)/install $(SRC_DIR)/md5sum $(SRC_DIR)/mv $(SRC_DIR)/rm $(SRC_DIR)/sha1sum
|
||||
all: $(BINARIES) $(SRC_DIR)/cp $(SRC_DIR)/ls $(SRC_DIR)/install $(SRC_DIR)/md5sum $(SRC_DIR)/mv $(SRC_DIR)/rm $(SRC_DIR)/sha1sum
|
||||
|
||||
LIB_DIR = lib
|
||||
LIB_SRC = acl 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 gethostname 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 tempname tsearch
|
||||
|
||||
LIB_OBJECTS = $(addprefix $(LIB_DIR)/, $(addsuffix .o, $(LIB_SRC)))
|
||||
|
||||
$(SRC_DIR)/false.c: $(SRC_DIR)/true.c
|
||||
cp $< $@
|
||||
sed -i -e s/true/false/g \
|
||||
-e s/success/failure/g \
|
||||
-e 's/(EXIT_SUCCESS)/(EXIT_FAILURE)/g' \
|
||||
$@
|
||||
|
||||
$(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)
|
||||
138
steps/coreutils-5.0/mk/pass2.mk
Normal file
138
steps/coreutils-5.0/mk/pass2.mk
Normal file
|
|
@ -0,0 +1,138 @@
|
|||
# SPDX-FileCopyrightText: 2021 Andrius Štikonas <andrius@stikonas.eu>
|
||||
# SPDX-FileCopyrightText: 2021 Paul Dersey <pdersey@gmail.com>
|
||||
# SPDX-FileCopyrightText: 2022 fosslinux <fosslinux@aussies.space>
|
||||
#
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
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 = $(DESTDIR)$(PREFIX)/bin
|
||||
|
||||
CFLAGS = -I . -I lib \
|
||||
-DPACKAGE=\"$(PACKAGE)\" \
|
||||
-DPACKAGE_NAME=\"$(PACKAGE_NAME)\" \
|
||||
-DGNU_PACKAGE=\"$(PACKAGE_NAME)\" \
|
||||
-DPACKAGE_BUGREPORT=\"$(PACKAGE_BUGREPORT)\" \
|
||||
-DPACKAGE_VERSION=\"$(PACKAGE_VERSION)\" \
|
||||
-DHOST_OPERATING_SYSTEM=\"Linux\" \
|
||||
-DVERSION=\"$(VERSION)\" \
|
||||
-DHAVE_LIMITS_H=1 \
|
||||
-DHAVE_DECL_FREE=1 \
|
||||
-DHAVE_LONG_LONG=1 \
|
||||
-DHAVE_UNSIGNED_LONG_LONG=1 \
|
||||
-DHAVE_DECL_MALLOC=1 \
|
||||
-DHAVE_DECL_STRERROR=1 \
|
||||
-DHAVE_STRERROR=1 \
|
||||
-DHAVE_MALLOC=1 \
|
||||
-DHAVE_STDLIB_H=1 \
|
||||
-DHAVE_WCHAR_H=1 \
|
||||
-DHAVE_SYS_TYPES_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 \
|
||||
-DHAVE_SETLOCALE=1 \
|
||||
-DHAVE_LOCALE_H=1 \
|
||||
-DTIME_WITH_SYS_TIME=1 \
|
||||
-DHAVE_STDINT_H=1 \
|
||||
-DMB_LEN_MAX=16 \
|
||||
-DLIBDIR=\"$(PREFIX)/lib\" \
|
||||
-DHAVE_DECL_WCWIDTH=0 \
|
||||
-DHAVE_SYS_STAT_H=1 \
|
||||
-DHAVE_SYS_STATFS_H=1 \
|
||||
-DHAVE_SYS_VFS_H=1 \
|
||||
-DHAVE_STRUCT_STATVFS_F_NAMEMAX=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=1 \
|
||||
-DLC_TIME=\"C\" \
|
||||
-DLC_COLLATE=\"C\" \
|
||||
-DHAVE_GETCWD=1 \
|
||||
-Dmy_strftime=nstrftime \
|
||||
-DDIR_TO_FD\(Dir_p\)=-1 \
|
||||
-DUTILS_OPEN_MAX=1000 \
|
||||
-Dmajor_t=unsigned \
|
||||
-Dminor_t=unsigned
|
||||
|
||||
.PHONY: all install
|
||||
|
||||
SRC_DIR=src
|
||||
|
||||
COREUTILS = basename cat chmod chroot cksum comm csplit cut dd dirname echo env expand expr false fmt fold head id join kill link ln logname mkfifo mkdir mknod nl od paste pathchk printf ptx pwd readlink rmdir seq sleep sort split stat sum sync tail tee touch tr tsort uname unexpand uniq unlink wc whoami tac test true yes
|
||||
|
||||
BINARIES = $(addprefix $(SRC_DIR)/, $(COREUTILS))
|
||||
|
||||
ALL=$(BINARIES) $(SRC_DIR)/cp $(SRC_DIR)/ls $(SRC_DIR)/install $(SRC_DIR)/md5sum $(SRC_DIR)/mv $(SRC_DIR)/rm $(SRC_DIR)/sha1sum
|
||||
all: $(BINARIES) $(SRC_DIR)/cp $(SRC_DIR)/ls $(SRC_DIR)/install $(SRC_DIR)/md5sum $(SRC_DIR)/mv $(SRC_DIR)/rm $(SRC_DIR)/sha1sum
|
||||
|
||||
LIB_DIR = lib
|
||||
LIB_SRC = acl alloca 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 obstack strverscmp strftime tsearch stat
|
||||
|
||||
LIB_OBJECTS = $(addprefix $(LIB_DIR)/, $(addsuffix .o, $(LIB_SRC)))
|
||||
|
||||
$(SRC_DIR)/false.c: $(SRC_DIR)/true.c
|
||||
cp $< $@
|
||||
sed -i -e s/true/false/g \
|
||||
-e s/success/failure/g \
|
||||
-e 's/(EXIT_SUCCESS)/(EXIT_FAILURE)/g' \
|
||||
$@
|
||||
|
||||
$(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 -d $(bindir)
|
||||
$(SRC_DIR)/install $^ $(bindir)
|
||||
122
steps/coreutils-5.0/pass1.kaem
Executable file
122
steps/coreutils-5.0/pass1.kaem
Executable file
|
|
@ -0,0 +1,122 @@
|
|||
#!/bin/sh
|
||||
|
||||
# SPDX-FileCopyrightText: 2021 Andrius Štikonas <andrius@stikonas.eu>
|
||||
# SPDX-FileCopyrightText: 2021 Paul Dersey <pdersey@gmail.com>
|
||||
# SPDX-FileCopyrightText: 2021-22 fosslinux <fosslinux@aussies.space>
|
||||
# SPDX-FileCopyrightText: 2023 Emily Trau <emily@downunderctf.com>
|
||||
#
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
set -ex
|
||||
|
||||
# Check tarball checksums
|
||||
checksum-transcriber sources
|
||||
sha256sum -c sources.SHA256SUM
|
||||
|
||||
mkdir build src
|
||||
cd build
|
||||
|
||||
# Extract
|
||||
cp ${DISTFILES}/${pkg}.tar.bz2 ../src/
|
||||
bunzip2 -f ../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
|
||||
|
||||
# We will rebuild it
|
||||
rm src/false.c
|
||||
|
||||
rm src/dircolors.h
|
||||
|
||||
patch -Np0 -i ../../patches/modechange.patch
|
||||
patch -Np0 -i ../../patches/mbstate.patch
|
||||
patch -Np0 -i ../../patches/ls-strcmp.patch
|
||||
patch -Np0 -i ../../patches/touch-getdate.patch
|
||||
patch -Np0 -i ../../patches/touch-dereference.patch
|
||||
patch -Np0 -i ../../patches/tac-uint64.patch
|
||||
patch -Np0 -i ../../patches/expr-strcmp.patch
|
||||
patch -Np0 -i ../../patches/sort-locale.patch
|
||||
patch -Np0 -i ../../patches/uniq-fopen.patch
|
||||
|
||||
# Build and install
|
||||
make -f Makefile PREFIX=${PREFIX}
|
||||
make -f Makefile PREFIX=${PREFIX} install
|
||||
|
||||
cd ../..
|
||||
rm -r src/
|
||||
|
||||
# Checksums
|
||||
if match x${UPDATE_CHECKSUMS} xTrue; then
|
||||
sha256sum -o ${pkg}.checksums \
|
||||
/usr/bin/install \
|
||||
/usr/bin/basename \
|
||||
/usr/bin/cat \
|
||||
/usr/bin/chmod \
|
||||
/usr/bin/cksum \
|
||||
/usr/bin/cp \
|
||||
/usr/bin/csplit \
|
||||
/usr/bin/cut \
|
||||
/usr/bin/dirname \
|
||||
/usr/bin/echo \
|
||||
/usr/bin/expand \
|
||||
/usr/bin/expr \
|
||||
/usr/bin/factor \
|
||||
/usr/bin/false \
|
||||
/usr/bin/fmt \
|
||||
/usr/bin/fold \
|
||||
/usr/bin/head \
|
||||
/usr/bin/hostname \
|
||||
/usr/bin/id \
|
||||
/usr/bin/join \
|
||||
/usr/bin/kill \
|
||||
/usr/bin/link \
|
||||
/usr/bin/ln \
|
||||
/usr/bin/logname \
|
||||
/usr/bin/mkfifo \
|
||||
/usr/bin/mkdir \
|
||||
/usr/bin/mknod \
|
||||
/usr/bin/nl \
|
||||
/usr/bin/od \
|
||||
/usr/bin/paste \
|
||||
/usr/bin/pathchk \
|
||||
/usr/bin/pr \
|
||||
/usr/bin/printf \
|
||||
/usr/bin/ptx \
|
||||
/usr/bin/pwd \
|
||||
/usr/bin/readlink \
|
||||
/usr/bin/rmdir \
|
||||
/usr/bin/seq \
|
||||
/usr/bin/sleep \
|
||||
/usr/bin/sort \
|
||||
/usr/bin/split \
|
||||
/usr/bin/sum \
|
||||
/usr/bin/tail \
|
||||
/usr/bin/tee \
|
||||
/usr/bin/tr \
|
||||
/usr/bin/tsort \
|
||||
/usr/bin/unexpand \
|
||||
/usr/bin/uniq \
|
||||
/usr/bin/unlink \
|
||||
/usr/bin/wc \
|
||||
/usr/bin/whoami \
|
||||
/usr/bin/tac \
|
||||
/usr/bin/test \
|
||||
/usr/bin/touch \
|
||||
/usr/bin/true \
|
||||
/usr/bin/yes \
|
||||
/usr/bin/ls \
|
||||
/usr/bin/md5sum \
|
||||
/usr/bin/mv \
|
||||
/usr/bin/rm \
|
||||
/usr/bin/sha1sum
|
||||
|
||||
install ${pkg}.checksums ${SRCDIR}
|
||||
else
|
||||
sha256sum -c ${pkg}.checksums
|
||||
fi
|
||||
31
steps/coreutils-5.0/pass2.sh
Executable file
31
steps/coreutils-5.0/pass2.sh
Executable file
|
|
@ -0,0 +1,31 @@
|
|||
# SPDX-FileCopyrightText: 2021 Paul Dersey <pdersey@gmail.com>
|
||||
# SPDX-FileCopyrightText: 2022 fosslinux <fosslinux@aussies.space>
|
||||
# SPDX-FileCopyrightText: 2022 Andrius Štikonas <andrius@stikonas.eu>
|
||||
#
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
src_prepare() {
|
||||
default
|
||||
|
||||
cp lib/fnmatch_.h lib/fnmatch.h
|
||||
cp lib/ftw_.h lib/ftw.h
|
||||
cp lib/search_.h lib/search.h
|
||||
touch config.h
|
||||
|
||||
# Rebuild pregenerated file
|
||||
rm -f src/false.c
|
||||
|
||||
rm -f src/dircolors.h
|
||||
|
||||
# Bison pre-generated file
|
||||
rm lib/getdate.c
|
||||
|
||||
cp "${mk_dir}/pass2.mk" Makefile
|
||||
}
|
||||
|
||||
src_install() {
|
||||
default
|
||||
|
||||
# perl later requires /bin/pwd
|
||||
ln -s "${PREFIX}/bin/pwd" /bin/pwd
|
||||
}
|
||||
1
steps/coreutils-5.0/patches-pass2/touch-dereference.patch
Symbolic link
1
steps/coreutils-5.0/patches-pass2/touch-dereference.patch
Symbolic link
|
|
@ -0,0 +1 @@
|
|||
../patches/touch-dereference.patch
|
||||
1
steps/coreutils-5.0/patches-pass2/touch-getdate.patch
Symbolic link
1
steps/coreutils-5.0/patches-pass2/touch-getdate.patch
Symbolic link
|
|
@ -0,0 +1 @@
|
|||
../patches/touch-getdate.patch
|
||||
26
steps/coreutils-5.0/patches/expr-strcmp.patch
Normal file
26
steps/coreutils-5.0/patches/expr-strcmp.patch
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
SPDX-FileCopyrightText: 2023 Emily Trau <emily@downunderctf.com>
|
||||
|
||||
SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
strcoll() does not exist in mes libc, change it to strcmp.
|
||||
|
||||
--- src/expr.c
|
||||
+++ src/expr.c
|
||||
@@ -332,7 +332,7 @@ nextarg (char *str)
|
||||
return 0;
|
||||
else
|
||||
{
|
||||
- int r = strcoll (*args, str) == 0;
|
||||
+ int r = strcmp (*args, str) == 0;
|
||||
args += r;
|
||||
return r;
|
||||
}
|
||||
@@ -668,7 +668,7 @@ eval2 (void)
|
||||
r = eval3 ();
|
||||
tostring (l);
|
||||
tostring (r);
|
||||
- lval = strcoll (l->u.s, r->u.s);
|
||||
+ lval = strcmp (l->u.s, r->u.s);
|
||||
rval = 0;
|
||||
if (toarith (l) && toarith (r))
|
||||
{
|
||||
18
steps/coreutils-5.0/patches/ls-strcmp.patch
Normal file
18
steps/coreutils-5.0/patches/ls-strcmp.patch
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
SPDX-FileCopyrightText: 2021 Andrius Štikonas <andrius@stikonas.eu>
|
||||
SPDX-FileCopyrightText: 2021 fosslinux <fosslinux@aussies.space>
|
||||
|
||||
SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
strcoll() does not exist in mes libc, change it to strcmp.
|
||||
|
||||
--- src/ls.c
|
||||
+++ src/ls.c
|
||||
@@ -2597,7 +2597,7 @@ xstrcoll (char const *a, char const *b)
|
||||
{
|
||||
int diff;
|
||||
errno = 0;
|
||||
- diff = strcoll (a, b);
|
||||
+ diff = strcmp (a, b);
|
||||
if (errno)
|
||||
{
|
||||
error (0, errno, _("cannot compare file names %s and %s"),
|
||||
44
steps/coreutils-5.0/patches/mbstate.patch
Normal file
44
steps/coreutils-5.0/patches/mbstate.patch
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
SPDX-FileCopyrightText: 2021 Andrius Štikonas <andrius@stikonas.eu>
|
||||
SPDX-FileCopyrightText: 2021 fosslinux <fosslinux@aussies.space>
|
||||
|
||||
SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
mbstate_t is a struct that is required. However, it is not defined by mes libc.
|
||||
This implementation was taken from glibc 2.32.
|
||||
|
||||
--- 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
|
||||
20
steps/coreutils-5.0/patches/modechange.patch
Normal file
20
steps/coreutils-5.0/patches/modechange.patch
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
SPDX-FileCopyrightText: 2021 Andrius Štikonas <andrius@stikonas.eu>
|
||||
SPDX-FileCopyrightText: 2021 fosslinux <fosslinux@aussies.space>
|
||||
|
||||
SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
modechange.h uses functions defined in sys/stat.h, so we need to move it to
|
||||
after sys/stat.h include.
|
||||
|
||||
--- 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
|
||||
37
steps/coreutils-5.0/patches/sort-locale.patch
Normal file
37
steps/coreutils-5.0/patches/sort-locale.patch
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
SPDX-FileCopyrightText: 2023 Emily Trau <emily@downunderctf.com>
|
||||
|
||||
SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
strcoll() does not exist in mes libc, change it to strcmp.
|
||||
hard_LC_COLLATE is used but not declared when HAVE_SETLOCALE is unset.
|
||||
|
||||
--- lib/memcoll.c
|
||||
+++ lib/memcoll.c
|
||||
@@ -47,7 +47,7 @@ memcoll (char *s1, size_t s1len, char *s2, size_t s2len)
|
||||
s1[s1len++] = '\0';
|
||||
s2[s2len++] = '\0';
|
||||
|
||||
- while (! (errno = 0, (diff = strcoll (s1, s2)) || errno))
|
||||
+ while (! (errno = 0, (diff = strcmp (s1, s2)) || errno))
|
||||
{
|
||||
/* strcoll found no difference, but perhaps it was fooled by NUL
|
||||
characters in the data. Work around this problem by advancing
|
||||
|
||||
--- src/sort.c
|
||||
+++ src/sort.c
|
||||
@@ -91,13 +91,13 @@ double strtod ();
|
||||
#define NEGATION_SIGN '-'
|
||||
#define NUMERIC_ZERO '0'
|
||||
|
||||
+/* Nonzero if the corresponding locales are hard. */
|
||||
+static int hard_LC_COLLATE;
|
||||
#if HAVE_SETLOCALE
|
||||
|
||||
static char decimal_point;
|
||||
static int th_sep; /* if CHAR_MAX + 1, then there is no thousands separator */
|
||||
|
||||
-/* Nonzero if the corresponding locales are hard. */
|
||||
-static int hard_LC_COLLATE;
|
||||
# if HAVE_NL_LANGINFO
|
||||
static int hard_LC_TIME;
|
||||
# endif
|
||||
27
steps/coreutils-5.0/patches/tac-uint64.patch
Normal file
27
steps/coreutils-5.0/patches/tac-uint64.patch
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
SPDX-FileCopyrightText: 2022 Andrius Štikonas <andrius@stikonas.eu>
|
||||
|
||||
SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
uint64_t is not supported in tcc 0.9.27
|
||||
--- lib/tempname.c 2002-12-01 10:40:32.000000000 +0000
|
||||
+++ lib/tempname.c 2022-06-22 20:57:37.449423973 +0100
|
||||
@@ -231,8 +231,8 @@
|
||||
{
|
||||
int len;
|
||||
char *XXXXXX;
|
||||
- static uint64_t value;
|
||||
- uint64_t random_time_bits;
|
||||
+ static unsigned long long value;
|
||||
+ unsigned long long random_time_bits;
|
||||
unsigned int count;
|
||||
int fd = -1;
|
||||
int save_errno = errno;
|
||||
@@ -278,7 +278,7 @@
|
||||
|
||||
for (count = 0; count < attempts; value += 7777, ++count)
|
||||
{
|
||||
- uint64_t v = value;
|
||||
+ unsigned long long v = value;
|
||||
|
||||
/* Fill in the random bits. */
|
||||
XXXXXX[0] = letters[v % 62];
|
||||
97
steps/coreutils-5.0/patches/touch-dereference.patch
Normal file
97
steps/coreutils-5.0/patches/touch-dereference.patch
Normal file
|
|
@ -0,0 +1,97 @@
|
|||
SPDX-FileCopyrightText: 2022 Andrius Štikonas <andrius@stikonas.eu>
|
||||
SPDX-FileCopyrightText: 2009 Eric Blake <ebb9@byu.net>
|
||||
|
||||
SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
touch: add -h to change symlink timestamps, where supported
|
||||
|
||||
diff -r -U3 coreutils-5.0.orig/src/touch.c coreutils-5.0/src/touch.c
|
||||
--- src/touch.c 2002-12-20 20:09:22.000000000 +0000
|
||||
+++ src/touch.c 2022-05-16 20:31:37.801988595 +0100
|
||||
@@ -77,6 +77,9 @@
|
||||
/* (-r) If nonzero, use times from a reference file. */
|
||||
static int use_ref;
|
||||
|
||||
+/* (-h) If true, change the times of an existing symlink, if possible. */
|
||||
+static int no_dereference;
|
||||
+
|
||||
/* (-t) If nonzero, date supplied on command line in POSIX format. */
|
||||
static int posix_date;
|
||||
|
||||
@@ -110,6 +113,7 @@
|
||||
{"date", required_argument, 0, 'd'},
|
||||
{"file", required_argument, 0, 'r'}, /* FIXME: phase out --file */
|
||||
{"reference", required_argument, 0, 'r'},
|
||||
+ {"no-dereference", no_argument, NULL, 'h'},
|
||||
{GETOPT_HELP_OPTION_DECL},
|
||||
{GETOPT_VERSION_OPTION_DECL},
|
||||
{0, 0, 0, 0}
|
||||
@@ -138,7 +142,7 @@
|
||||
int fd = -1;
|
||||
int open_errno = 0;
|
||||
|
||||
- if (! no_create)
|
||||
+ if (! (no_create || no_dereference))
|
||||
{
|
||||
/* Try to open FILE, creating it if necessary. */
|
||||
fd = open (file, O_WRONLY | O_CREAT | O_NONBLOCK | O_NOCTTY,
|
||||
@@ -158,7 +162,7 @@
|
||||
the other one. If we have the file descriptor already, use fstat.
|
||||
Otherwise, either we're in no-create mode (and hence didn't call open)
|
||||
or FILE is inaccessible or a directory, so we have to use stat. */
|
||||
- if (fd != -1 ? fstat (fd, &sbuf) : stat (file, &sbuf))
|
||||
+ if (fd != -1 ? fstat (fd, &sbuf) : (no_dereference ? lstat (file, &sbuf) : stat (file, &sbuf)))
|
||||
{
|
||||
if (open_errno)
|
||||
error (0, open_errno, _("creating %s"), quote (file));
|
||||
@@ -223,7 +227,7 @@
|
||||
}
|
||||
else
|
||||
{
|
||||
- if (no_create && errno == ENOENT)
|
||||
+ if ((no_create || no_dereference) && errno == ENOENT)
|
||||
return 0;
|
||||
error (0, errno, _("setting times of %s"), quote (file));
|
||||
}
|
||||
@@ -254,6 +258,9 @@
|
||||
-c, --no-create do not create any files\n\
|
||||
-d, --date=STRING parse STRING and use it instead of current time\n\
|
||||
-f (ignored)\n\
|
||||
+ -h, --no-dereference affect each symbolic link instead of any referenced\n\
|
||||
+ file (useful only on systems that can change the\n\
|
||||
+ timestamps of a symlink)\n\
|
||||
-m change only the modification time\n\
|
||||
"), stdout);
|
||||
fputs (_("\
|
||||
@@ -289,7 +296,7 @@
|
||||
|
||||
change_times = no_create = use_ref = posix_date = flexible_date = 0;
|
||||
|
||||
- while ((c = getopt_long (argc, argv, "acd:fmr:t:", longopts, NULL)) != -1)
|
||||
+ while ((c = getopt_long (argc, argv, "acd:fhmr:t:", longopts, NULL)) != -1)
|
||||
{
|
||||
switch (c)
|
||||
{
|
||||
@@ -315,6 +322,10 @@
|
||||
case 'f':
|
||||
break;
|
||||
|
||||
+ case 'h':
|
||||
+ no_dereference = true;
|
||||
+ break;
|
||||
+
|
||||
case 'm':
|
||||
change_times |= CH_MTIME;
|
||||
break;
|
||||
@@ -358,7 +369,10 @@
|
||||
|
||||
if (use_ref)
|
||||
{
|
||||
- if (stat (ref_file, &ref_stats))
|
||||
+ /* Don't use (no_dereference ? lstat : stat) (args), since stat
|
||||
+ might be an object-like macro. */
|
||||
+ if (no_dereference ? lstat (ref_file, &ref_stats)
|
||||
+ : stat (ref_file, &ref_stats))
|
||||
error (EXIT_FAILURE, errno,
|
||||
_("failed to get attributes of %s"), quote (ref_file));
|
||||
date_set++;
|
||||
19
steps/coreutils-5.0/patches/touch-getdate.patch
Normal file
19
steps/coreutils-5.0/patches/touch-getdate.patch
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
SPDX-FileCopyrightText: 2021 Andrius Štikonas <andrius@stikonas.eu>
|
||||
|
||||
SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
getdate.c is pre-compiled from getdate.y
|
||||
At this point we don't have bison yet and in any case getdate.y does not
|
||||
compile when generated with modern bison.
|
||||
|
||||
--- src/touch.c.orig 2021-03-13 18:16:05.344355958 +0000
|
||||
+++ src/touch.c 2021-03-13 18:16:26.204891355 +0000
|
||||
@@ -306,7 +306,7 @@
|
||||
|
||||
case 'd':
|
||||
flexible_date++;
|
||||
- newtime = get_date (optarg, NULL);
|
||||
+ newtime = 0;
|
||||
if (newtime == (time_t) -1)
|
||||
error (EXIT_FAILURE, 0, _("invalid date format %s"), quote (optarg));
|
||||
date_set++;
|
||||
68
steps/coreutils-5.0/patches/uniq-fopen.patch
Normal file
68
steps/coreutils-5.0/patches/uniq-fopen.patch
Normal file
|
|
@ -0,0 +1,68 @@
|
|||
SPDX-FileCopyrightText: 2005 Paul Eggert <eggert@cs.ucla.edu>
|
||||
SPDX-FileCopyrightText: 2023 Emily Trau <emily@downunderctf.com>
|
||||
|
||||
SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
uniq: don't assume fopen cannot return stdin or stdout.
|
||||
Backport of https://git.savannah.gnu.org/cgit/coreutils.git/commit/?id=786ebb2ceca72f69aa2de701671fb41f53cb1489
|
||||
|
||||
--- src/uniq.c
|
||||
+++ src/uniq.c
|
||||
@@ -30,6 +30,7 @@
|
||||
#include "error.h"
|
||||
#include "hard-locale.h"
|
||||
#include "posixver.h"
|
||||
+#include "stdio-safer.h"
|
||||
#include "xmemcoll.h"
|
||||
#include "xstrtol.h"
|
||||
#include "memcasecmp.h"
|
||||
@@ -267,20 +268,26 @@ check_file (const char *infile, const char *outfile)
|
||||
FILE *ostream;
|
||||
struct linebuffer lb1, lb2;
|
||||
struct linebuffer *thisline, *prevline;
|
||||
+ bool is_stdin = STREQ (infile, "-");
|
||||
+ bool is_stdout = STREQ (outfile, "-");
|
||||
|
||||
- if (STREQ (infile, "-"))
|
||||
+ if (is_stdin)
|
||||
istream = stdin;
|
||||
else
|
||||
- istream = fopen (infile, "r");
|
||||
- if (istream == NULL)
|
||||
- error (EXIT_FAILURE, errno, "%s", infile);
|
||||
+ {
|
||||
+ istream = fopen_safer (infile, "r");
|
||||
+ if (! istream)
|
||||
+ error (EXIT_FAILURE, errno, "%s", infile);
|
||||
+ }
|
||||
|
||||
- if (STREQ (outfile, "-"))
|
||||
+ if (is_stdout)
|
||||
ostream = stdout;
|
||||
else
|
||||
- ostream = fopen (outfile, "w");
|
||||
- if (ostream == NULL)
|
||||
- error (EXIT_FAILURE, errno, "%s", outfile);
|
||||
+ {
|
||||
+ ostream = fopen_safer (outfile, "w");
|
||||
+ if (! ostream)
|
||||
+ error (EXIT_FAILURE, errno, "%s", outfile);
|
||||
+ }
|
||||
|
||||
thisline = &lb1;
|
||||
prevline = &lb2;
|
||||
@@ -377,12 +384,12 @@ check_file (const char *infile, const char *outfile)
|
||||
}
|
||||
|
||||
closefiles:
|
||||
- if (ferror (istream) || fclose (istream) == EOF)
|
||||
+ if (!is_stdin && (ferror (istream) || fclose (istream) != 0))
|
||||
error (EXIT_FAILURE, errno, _("error reading %s"), infile);
|
||||
|
||||
/* Close ostream only if it's not stdout -- the latter is closed
|
||||
via the atexit-invoked close_stdout. */
|
||||
- if (ostream != stdout && (ferror (ostream) || fclose (ostream) == EOF))
|
||||
+ if (!is_stdout && (ferror (ostream) || fclose (ostream) != 0))
|
||||
error (EXIT_FAILURE, errno, _("error writing %s"), outfile);
|
||||
|
||||
free (lb1.buffer);
|
||||
1
steps/coreutils-5.0/sources
Normal file
1
steps/coreutils-5.0/sources
Normal file
|
|
@ -0,0 +1 @@
|
|||
https://mirrors.kernel.org/gnu/coreutils/coreutils-5.0.tar.bz2 c25b36b8af6e0ad2a875daf4d6196bd0df28a62be7dd252e5f99a4d5d7288d95
|
||||
Loading…
Add table
Add a link
Reference in a new issue