From 21096f6ff23fe198cefa9bf8422aad4040facdf3 Mon Sep 17 00:00:00 2001 From: Paul Dersey Date: Wed, 24 Feb 2021 09:38:10 -0500 Subject: [PATCH 01/12] start binutils --- SHA256SUMS.sources | 1 + rootfs.sh | 3 +++ sysa/binutils-2.14/binutils-2.14.sh | 24 ++++++++++++++++++++++++ sysa/binutils-2.14/checksums | 0 sysa/run.sh | 2 ++ 5 files changed, 30 insertions(+) create mode 100755 sysa/binutils-2.14/binutils-2.14.sh create mode 100644 sysa/binutils-2.14/checksums diff --git a/SHA256SUMS.sources b/SHA256SUMS.sources index 123ff5b1..022c3315 100644 --- a/SHA256SUMS.sources +++ b/SHA256SUMS.sources @@ -3,6 +3,7 @@ f0611136bee505811e9ca11ca7ac188ef5323a8e2ef19cffd3edb3cf08fd791e autoconf-2.13. 534e99b61b81e79327b6d08f1a3edb0755ac246e1249009b0e1bf5887b60d7a9 autoconf-2.52.tar.gz 503cdc2b0992a4309545d17f462cb15f99bb57b7161dfc4082b2e7188f2bcc0f automake-1.4-p6.tar.gz ba03d412998cc54bd0b0f2d6c32100967d3137098affdc2d32e6e7c11b163fe4 bash-2.05b.tar.gz +e20bdd49a0fb317959b410c1fe81269a620ec21207045d8a37cadea621be4b59 binutils-2.14.tar.bz2 7007fc89c216fbfaff5525359b02a7e5b612694df5168c74673f67055f015095 bison-3.4.1.tar.gz ab5a03176ee106d3f0fa90e381da478ddae405918153cca248e682cd0c4a2269 bzip2-1.0.8.tar.gz c25b36b8af6e0ad2a875daf4d6196bd0df28a62be7dd252e5f99a4d5d7288d95 coreutils-5.0.tar.bz2 diff --git a/rootfs.sh b/rootfs.sh index 6ee07468..49589a69 100755 --- a/rootfs.sh +++ b/rootfs.sh @@ -213,6 +213,9 @@ get_file https://ftp.gnu.org/gnu/autoconf/autoconf-2.13.tar.gz # autoconf 2.12 get_file https://ftp.gnu.org/gnu/autoconf/autoconf-2.12.tar.gz +# binutils 2.14 +get_file https://ftp.gnu.org/gnu/binutils/binutils-2.14.tar.bz2 + # General cleanup find tmp -name .git -exec rm -rf \; diff --git a/sysa/binutils-2.14/binutils-2.14.sh b/sysa/binutils-2.14/binutils-2.14.sh new file mode 100755 index 00000000..cf0e200b --- /dev/null +++ b/sysa/binutils-2.14/binutils-2.14.sh @@ -0,0 +1,24 @@ +# SPDX-FileCopyrightText: 2021 Andrius Štikonas +# +# SPDX-License-Identifier: GPL-3.0-or-later + +src_configure() { + # TODO: use autoconf to regenerate configure + + AR="tcc -ar" RANLIB="true" CC="tcc -D __GLIBC_MINOR__=6" \ + ./configure \ + --disable-nls \ + --disable-shared \ + --disable-werror \ + --build=i386-unknown-linux \ + --host=i386-unknown-linux \ + --target=i386-unknown-linux \ + --with-sysroot=/after \ + --disable-64-bit-bfd + + # TODO: Find a way to avoid these hacks + sed -i '/#undef pid_t/d' libiberty/config.in + sed -i '/#undef uintptr_t/d' libiberty/config.in + sed -i 's/C_alloca/alloca/g' libiberty/alloca.c + sed -i 's/C_alloca/alloca/g' include/libiberty.h +} diff --git a/sysa/binutils-2.14/checksums b/sysa/binutils-2.14/checksums new file mode 100644 index 00000000..e69de29b diff --git a/sysa/run.sh b/sysa/run.sh index 306993bc..1e9ae99d 100755 --- a/sysa/run.sh +++ b/sysa/run.sh @@ -79,4 +79,6 @@ build autoconf-2.13 build autoconf-2.12 +build binutils-2.14 + echo "Bootstrapping completed." From cf9d0d1f3c60c645a6b0634025605b5ac58e590c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrius=20=C5=A0tikonas?= Date: Sat, 27 Feb 2021 12:04:59 +0000 Subject: [PATCH 02/12] Regenerate binutils bison files, autoconf and automake files. --- sysa/binutils-2.14/binutils-2.14.sh | 49 +++++++++++++++++++++++++++-- 1 file changed, 46 insertions(+), 3 deletions(-) diff --git a/sysa/binutils-2.14/binutils-2.14.sh b/sysa/binutils-2.14/binutils-2.14.sh index cf0e200b..9b378b41 100755 --- a/sysa/binutils-2.14/binutils-2.14.sh +++ b/sysa/binutils-2.14/binutils-2.14.sh @@ -1,10 +1,52 @@ # SPDX-FileCopyrightText: 2021 Andrius Štikonas +# SPDX-FileCopyrightText: 2021 Paul Dersey # # SPDX-License-Identifier: GPL-3.0-or-later -src_configure() { - # TODO: use autoconf to regenerate configure +src_prepare() { + rm configure + autoconf-2.13 + for dir in binutils bfd gas ld gprof libiberty opcodes; do + cd $dir + rm configure + autoconf-2.13 + cd .. + done + for dir in etc intl; do + cd $dir + rm configure + autoconf-2.12 + cd .. + done + # automake errors out without this + cd gas + mv config/m68k-parse.y + sed -i 's#config/m68k-parse.y#m68k-parse.y#' Makefile.am + cd .. + + # Disable documentation build which needs pod2man + for dir in bfd binutils gas gprof ld opcodes; do + cd $dir + sed -i '/SUBDIRS/d' Makefile.am + rm Makefile.in + automake-1.4 + cd .. + done + + # Rebuild bison files + touch */*.y + rm ld/ldgram.c ld/ldgram.h + rm gas/itbl-parse.c gas/itbl-parse.h + rm gas/m68k-parse.c gas/m68k-parse.h + rm binutils/arparse.c binutils/arparse.h + rm binutils/nlmheader.c binutils/nlmheader.h + rm binutils/sysinfo.c binutils/sysinfo.h + rm binutils/defparse.c binutils/defparse.h + rm binutils/rcparse.c binutils/rcparse.h +} + +src_configure() { AR="tcc -ar" RANLIB="true" CC="tcc -D __GLIBC_MINOR__=6" \ ./configure \ --disable-nls \ @@ -14,7 +56,8 @@ src_configure() { --host=i386-unknown-linux \ --target=i386-unknown-linux \ --with-sysroot=/after \ - --disable-64-bit-bfd + --disable-64-bit-bfd \ + --prefix=/after # TODO: Find a way to avoid these hacks sed -i '/#undef pid_t/d' libiberty/config.in From 9122b5e2e0f51acbc7bc6227dc2a9d3a19e063fd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrius=20=C5=A0tikonas?= Date: Sat, 27 Feb 2021 23:29:59 +0000 Subject: [PATCH 03/12] Add description of binutils. --- parts.rst | 10 ++++++++++ sysa/binutils-2.14/binutils-2.14.sh | 4 ++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/parts.rst b/parts.rst index 218e53dc..c9d593a7 100644 --- a/parts.rst +++ b/parts.rst @@ -392,3 +392,13 @@ autoconf 2.12 ============= Yet another old autoconf version that we will need for GNU Binutils. + +binutils 2.14 +============= + +The GNU Binary Utilities, or binutils, are a set of programming tools for creating and +managing binary programs, object files, libraries, profile data, and assembly source code. + +In particular we can now use full featured ``ar`` instead of ``tcc -ar``, +the GNU linker ``ld``, which allows us building shared libraries, +and the GNU assembler ``as``. diff --git a/sysa/binutils-2.14/binutils-2.14.sh b/sysa/binutils-2.14/binutils-2.14.sh index 9b378b41..b8c3ef88 100755 --- a/sysa/binutils-2.14/binutils-2.14.sh +++ b/sysa/binutils-2.14/binutils-2.14.sh @@ -21,7 +21,7 @@ src_prepare() { # automake errors out without this cd gas - mv config/m68k-parse.y + mv config/m68k-parse.y . sed -i 's#config/m68k-parse.y#m68k-parse.y#' Makefile.am cd .. @@ -38,7 +38,7 @@ src_prepare() { touch */*.y rm ld/ldgram.c ld/ldgram.h rm gas/itbl-parse.c gas/itbl-parse.h - rm gas/m68k-parse.c gas/m68k-parse.h + rm gas/m68k-parse.c rm binutils/arparse.c binutils/arparse.h rm binutils/nlmheader.c binutils/nlmheader.h rm binutils/sysinfo.c binutils/sysinfo.h From f70815aef49acb878b94357130e9874c883cb8b7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrius=20=C5=A0tikonas?= Date: Sun, 28 Feb 2021 01:02:16 +0000 Subject: [PATCH 04/12] Add binutils checksums --- sysa/binutils-2.14/checksums | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/sysa/binutils-2.14/checksums b/sysa/binutils-2.14/checksums index e69de29b..05c5f9d0 100644 --- a/sysa/binutils-2.14/checksums +++ b/sysa/binutils-2.14/checksums @@ -0,0 +1,20 @@ +7b1da1994710a9aa36444bc7b407d08e71868d2359961f77d49e66a20af4d87a /after/bin/addr2line +9554c687330a311f751ed8fd6530848e8dd82aeb7e9d5c1512bc0c70e7fdd17a /after/bin/ar +597f7b0e56caba525fdc03bb1d2687c90de56c238cbb57851064a953ca967bb5 /after/bin/as +0bc538abc2e08b42253a8da759e7129db90030694eb2346f582cfd3bde12b758 /after/bin/c++filt +e8fbe83b64a48e3b84a09f2cad2ae0eb386f91e8ab7113d87d018f5a93202737 /after/bin/gprof +27e88c0e3aa2a88a0bf6f2ad7af6e7a48e0c10c8b7a388d856d911814adf771d /after/bin/ld +fcdcbbd7b0e110db0af54ffe5f1f23cedce3453b146b9a9acbcaeba7abb09956 /after/bin/nm +9e867d24d0a712ce78f66ac420ea91446615ee95ff2d5d0a116b1eaa88d57ccc /after/bin/objcopy +a2a2aea479cbe6f87fd0d801a9f309715af8b3d7ddfe83419bd0982ae8418cb8 /after/bin/objdump +e49bba1ea6a61fb90f754e8de4692ed0810e7c68429f0b22fbf37670607a7807 /after/bin/od +c24d55549d0552d2c11978f16dabdc793b39d81e81bf6832dc503c71bc1cde36 /after/bin/ranlib +978d6cf91009703d14aa2c678b0fd90fa7e417dc4ade9c151986a56bca98a79a /after/bin/readelf +1e4a29fded449aaba9844502a983818babb9535d872f11daa0057e2d651146ed /after/bin/size +32d6fc414d07ef1c5cc51d115730d7e41487459ec735b959a4f0127b779929bc /after/bin/strings +f73212b09ef427ac4708262a23b4d3d24fa2500639902600726af8b7968cc3c5 /after/bin/strip +bf061ebdf7ef24944fcadd2f12583d00b5d174ea30a3b5cb23618b259d3cf0b1 /after/lib/musl/libbfd.a +3c9ab37cff5f732bca1258879fabf3c6c734890de1d7aa6381a5945d38f31c86 /after/lib/musl/libbfd.la +61a03b0d2eafa5ad50242a7ee8ce8664c2ef342bf727f46ceab8999b61a9a61b /after/lib/musl/libiberty.a +6530574bde4f5c57b194ae4229efb9784a97cc89cd45fc0d852e9afb5e103e4f /after/lib/musl/libopcodes.a +d3c307c7a2cd62a3fc39aa933f40bee94b94aff5db58a3652689ebfe0f616c82 /after/lib/musl/libopcodes.la From cb7835987855d1c6d0b48d67d61b23dad28234d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrius=20=C5=A0tikonas?= Date: Sun, 28 Feb 2021 12:52:50 +0000 Subject: [PATCH 05/12] Fix libdir location. --- sysa/binutils-2.14/binutils-2.14.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sysa/binutils-2.14/binutils-2.14.sh b/sysa/binutils-2.14/binutils-2.14.sh index b8c3ef88..5c16e484 100755 --- a/sysa/binutils-2.14/binutils-2.14.sh +++ b/sysa/binutils-2.14/binutils-2.14.sh @@ -57,7 +57,8 @@ src_configure() { --target=i386-unknown-linux \ --with-sysroot=/after \ --disable-64-bit-bfd \ - --prefix=/after + --prefix="${PREFIX}" \ + --libdir="${PREFIX}/lib/musl" # TODO: Find a way to avoid these hacks sed -i '/#undef pid_t/d' libiberty/config.in From 4363c6422a135dc6c81807416169af316dd75dc3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrius=20=C5=A0tikonas?= Date: Sun, 28 Feb 2021 15:50:26 +0000 Subject: [PATCH 06/12] Also cache tar downloads. --- rootfs.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rootfs.sh b/rootfs.sh index 49589a69..5e0c0ff5 100755 --- a/rootfs.sh +++ b/rootfs.sh @@ -110,7 +110,7 @@ cp -r tar-1.12 tmp/after mkdir tmp/after/tar-1.12/{src,build} pushd tmp/after/tar-1.12/src if [ ! -f "$(basename $url)" ]; then - wget "$url" + _wget "$url" fi popd tar -C tmp/after/tar-1.12/src -xf "tmp/after/tar-1.12/src/$(basename $url)" --strip-components=1 From a27e7b99a7d8f9f9a70f41c4a06015f3b0bb12ee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrius=20=C5=A0tikonas?= Date: Sun, 28 Feb 2021 20:53:20 +0000 Subject: [PATCH 07/12] Build sha256sum from coreutils 6.3. --- SHA256SUMS.sources | 1 + parts.rst | 5 ++ rootfs.sh | 3 + sysa/coreutils-6.3/checksums | 1 + sysa/coreutils-6.3/coreutils-6.3.sh | 21 ++++++ sysa/coreutils-6.3/mk/main.mk | 105 ++++++++++++++++++++++++++++ sysa/run.sh | 3 + 7 files changed, 139 insertions(+) create mode 100644 sysa/coreutils-6.3/checksums create mode 100755 sysa/coreutils-6.3/coreutils-6.3.sh create mode 100644 sysa/coreutils-6.3/mk/main.mk diff --git a/SHA256SUMS.sources b/SHA256SUMS.sources index 022c3315..b26a70a4 100644 --- a/SHA256SUMS.sources +++ b/SHA256SUMS.sources @@ -7,6 +7,7 @@ e20bdd49a0fb317959b410c1fe81269a620ec21207045d8a37cadea621be4b59 binutils-2.14. 7007fc89c216fbfaff5525359b02a7e5b612694df5168c74673f67055f015095 bison-3.4.1.tar.gz ab5a03176ee106d3f0fa90e381da478ddae405918153cca248e682cd0c4a2269 bzip2-1.0.8.tar.gz c25b36b8af6e0ad2a875daf4d6196bd0df28a62be7dd252e5f99a4d5d7288d95 coreutils-5.0.tar.bz2 +8815a918867a14dcfeb623786b3a7f7483a039a78dd5a94e9b562667684c07a1 coreutils-6.3.tar.bz2 d5f2489c4056a31528e3ada4adacc23d498532b0af1a980f2f76158162b139d6 diffutils-2.7.tar.gz bc79b890f35ca38d66ff89a6e3758226131e51ccbd10ef78d5ff150b7bd73689 flex-2.5.11.tar.gz e87aae032bf07c26f85ac0ed3250998c37621d95f8bd748b31f15b33c45ee995 flex-2.6.4.tar.gz diff --git a/parts.rst b/parts.rst index c9d593a7..0f492f5e 100644 --- a/parts.rst +++ b/parts.rst @@ -306,6 +306,11 @@ coreutils 5.0 including ``comm``, ``expr``, ``date``, ``dd``, ``sort``, ``uname`` and ``uniq``. This fixes a variety of issues with existing ``coreutils``. +coreutils 6.3 +============= +We build ``sha256sum`` from coreutils 6.3 since it is absent in 5.0. +Other utils are not build at this stage. + gawk 3.0.4 ========== diff --git a/rootfs.sh b/rootfs.sh index 5e0c0ff5..7a8200b3 100755 --- a/rootfs.sh +++ b/rootfs.sh @@ -156,6 +156,9 @@ get_file ftp://sourceware.org/pub/bzip2/bzip2-1.0.8.tar.gz 1 # coreutils 5.0 get_file https://ftp.gnu.org/gnu/coreutils/coreutils-5.0.tar.bz2 1 +# coreutils 6.3 +get_file https://ftp.gnu.org/gnu/coreutils/coreutils-6.3.tar.bz2 + # heirloom-devtools get_file http://downloads.sourceforge.net/project/heirloom/heirloom-devtools/070527/heirloom-devtools-070527.tar.bz2 diff --git a/sysa/coreutils-6.3/checksums b/sysa/coreutils-6.3/checksums new file mode 100644 index 00000000..e2b85e45 --- /dev/null +++ b/sysa/coreutils-6.3/checksums @@ -0,0 +1 @@ +34ec35d9de41dd954802dbcfc7c07697f1e7e3cecedbe32ea16a6da85c3eb260 /after/bin/sha256sum diff --git a/sysa/coreutils-6.3/coreutils-6.3.sh b/sysa/coreutils-6.3/coreutils-6.3.sh new file mode 100755 index 00000000..3d7f3e01 --- /dev/null +++ b/sysa/coreutils-6.3/coreutils-6.3.sh @@ -0,0 +1,21 @@ +# SPDX-FileCopyrightText: 2021 Andrius Štikonas +# +# SPDX-License-Identifier: GPL-3.0-or-later + +src_prepare() { + default_src_prepare + + cp lib/fnmatch_.h lib/fnmatch.h + cp lib/fcntl_.h lib/fcntl.h + sed -i 's#@ABSOLUTE_FCNTL_H@#"/after/include/musl/fcntl.h"#' lib/fcntl.h + + touch config.h lib/configmake.h +} + +src_compile() { + make -f Makefile +} + +src_install() { + make -f Makefile install PREFIX="${PREFIX}" +} diff --git a/sysa/coreutils-6.3/mk/main.mk b/sysa/coreutils-6.3/mk/main.mk new file mode 100644 index 00000000..b5be74e0 --- /dev/null +++ b/sysa/coreutils-6.3/mk/main.mk @@ -0,0 +1,105 @@ +# SPDX-FileCopyrightText: 2021 Andrius Štikonas +# SPDX-FileCopyrightText: 2021 Paul Dersey +# +# SPDX-License-Identifier: GPL-3.0-or-later + +PACKAGE=coreutils +PACKAGE_NAME=GNU\ coreutils +PACKAGE_BUGREPORT=bug-coreutils@gnu.org +PACKAGE_VERSION=6.3 +VERSION=6.3 + +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)\" \ + -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 \ + -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 \ + -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 \ + -DLSTAT_FOLLOWS_SLASHED_SYMLINK=1 \ + -DHAVE_DECL_DIRFD=1 \ + -DHAVE_GETCWD=1 \ + -Dmy_strftime=nstrftime \ + -DDIR_TO_FD\(Dir_p\)=-1 \ + -DUTILS_OPEN_MAX=1000 \ + -Dmajor_t=unsigned \ + -Dminor_t=unsigned \ + -DHAVE_GETTIMEOFDAY=1 \ + -DHASH_ALGO_SHA256 + +.PHONY: all install + +SRC_DIR=src + +COREUTILS = + +BINARIES = $(addprefix $(SRC_DIR)/, $(COREUTILS)) + +ALL=$(BINARIES) $(SRC_DIR)/sha256sum +all: $(BINARIES) $(SRC_DIR)/sha256sum + +LIB_DIR = lib +LIB_SRC = acl alloca getdate posixtm posixver strftime getopt hash hash-pjw 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 gettime hard-locale human idcache imaxtostr linebuffer localcharset long-options mbswidth md5 memcasecmp memcoll modechange offtostr physmem quote quotearg readtokens rpmatch safe-read safe-write same save-cwd savedir settime sha256 stpcpy stripslash umaxtostr unicodeio userspec version-etc version-etc-fsf xgetcwd xgethostname xmalloc xmemcoll xnanosleep xreadlink xstrtod xstrtol xstrtoul xstrtoimax xstrtoumax yesno strnlen getcwd sig2str mountlist canonicalize mkstemp memrchr euidaccess obstack strverscmp strftime xalloc-die close-stream + +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)/sha256sum: $(SRC_DIR)/md5sum.o $(LIB_DIR)/libfettish.a + $(CC) $(CFLAGS) $^ $(LDFLAGS) -o $@ + +install: $(ALL) + install $^ $(bindir) diff --git a/sysa/run.sh b/sysa/run.sh index 1e9ae99d..309cf15a 100755 --- a/sysa/run.sh +++ b/sysa/run.sh @@ -54,6 +54,9 @@ build diffutils-2.7 # Rebuild coreutils using musl build coreutils-5.0 coreutils-5.0.sh checksums/pass2 +# Build only sha256sum +build coreutils-6.3 + build gawk-3.0.4 build perl-5.000 From 0be033fada1f51d912016eb3d823dd3ef84ed8ae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrius=20=C5=A0tikonas?= Date: Sun, 28 Feb 2021 22:07:55 +0000 Subject: [PATCH 08/12] Do remove empty checksum files. GNU sha256sum does not accept them. --- sysa/autoconf-2.12/checksums | 0 sysa/autoconf-2.13/checksums | 0 sysa/autoconf-2.52/checksums | 0 sysa/automake-1.4-p6/checksums | 0 sysa/helpers.sh | 2 +- 5 files changed, 1 insertion(+), 1 deletion(-) delete mode 100644 sysa/autoconf-2.12/checksums delete mode 100644 sysa/autoconf-2.13/checksums delete mode 100644 sysa/autoconf-2.52/checksums delete mode 100644 sysa/automake-1.4-p6/checksums diff --git a/sysa/autoconf-2.12/checksums b/sysa/autoconf-2.12/checksums deleted file mode 100644 index e69de29b..00000000 diff --git a/sysa/autoconf-2.13/checksums b/sysa/autoconf-2.13/checksums deleted file mode 100644 index e69de29b..00000000 diff --git a/sysa/autoconf-2.52/checksums b/sysa/autoconf-2.52/checksums deleted file mode 100644 index e69de29b..00000000 diff --git a/sysa/automake-1.4-p6/checksums b/sysa/automake-1.4-p6/checksums deleted file mode 100644 index e69de29b..00000000 diff --git a/sysa/helpers.sh b/sysa/helpers.sh index 74b25a4b..30a260ba 100755 --- a/sysa/helpers.sh +++ b/sysa/helpers.sh @@ -57,7 +57,7 @@ build () { cd ../.. echo "${pkg}: checksumming installed files." - sha256sum -c "${checksum_f}" + test -e "${checksum_f}" && sha256sum -c "${checksum_f}" echo "${pkg}: build successful" cd .. From 1412fb99ec750afe6110b8a14c3326bba66b45a1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrius=20=C5=A0tikonas?= Date: Sun, 28 Feb 2021 22:32:37 +0000 Subject: [PATCH 09/12] Remove flex generated files from binutils. --- sysa/binutils-2.14/binutils-2.14.sh | 6 ++++++ sysa/binutils-2.14/checksums | 6 +++--- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/sysa/binutils-2.14/binutils-2.14.sh b/sysa/binutils-2.14/binutils-2.14.sh index 5c16e484..bedbaacb 100755 --- a/sysa/binutils-2.14/binutils-2.14.sh +++ b/sysa/binutils-2.14/binutils-2.14.sh @@ -44,6 +44,12 @@ src_prepare() { rm binutils/sysinfo.c binutils/sysinfo.h rm binutils/defparse.c binutils/defparse.h rm binutils/rcparse.c binutils/rcparse.h + + # Rebuild flex generated files + touch */*.l + rm ld/ldlex.c + rm gas/itbl-lex.c + rm binutils/syslex.c binutils/rclex.c binutils/deflex.c binutils/arlex.c } src_configure() { diff --git a/sysa/binutils-2.14/checksums b/sysa/binutils-2.14/checksums index 05c5f9d0..8edc8b6a 100644 --- a/sysa/binutils-2.14/checksums +++ b/sysa/binutils-2.14/checksums @@ -1,14 +1,14 @@ 7b1da1994710a9aa36444bc7b407d08e71868d2359961f77d49e66a20af4d87a /after/bin/addr2line -9554c687330a311f751ed8fd6530848e8dd82aeb7e9d5c1512bc0c70e7fdd17a /after/bin/ar +74dd89fbb30b8a1ecbab65239044485a4008c905442b9c1e990c7e8801bb6831 /after/bin/ar 597f7b0e56caba525fdc03bb1d2687c90de56c238cbb57851064a953ca967bb5 /after/bin/as 0bc538abc2e08b42253a8da759e7129db90030694eb2346f582cfd3bde12b758 /after/bin/c++filt e8fbe83b64a48e3b84a09f2cad2ae0eb386f91e8ab7113d87d018f5a93202737 /after/bin/gprof -27e88c0e3aa2a88a0bf6f2ad7af6e7a48e0c10c8b7a388d856d911814adf771d /after/bin/ld +a203fff2d5e392b8a594435a58389f6e9a96bc2aad2cc96987589f140bd3ff1a /after/bin/ld fcdcbbd7b0e110db0af54ffe5f1f23cedce3453b146b9a9acbcaeba7abb09956 /after/bin/nm 9e867d24d0a712ce78f66ac420ea91446615ee95ff2d5d0a116b1eaa88d57ccc /after/bin/objcopy a2a2aea479cbe6f87fd0d801a9f309715af8b3d7ddfe83419bd0982ae8418cb8 /after/bin/objdump e49bba1ea6a61fb90f754e8de4692ed0810e7c68429f0b22fbf37670607a7807 /after/bin/od -c24d55549d0552d2c11978f16dabdc793b39d81e81bf6832dc503c71bc1cde36 /after/bin/ranlib +af1dd1d58e1c2023b2799d1a9653888e0253f285d762ec101d4b175adfcff0fe /after/bin/ranlib 978d6cf91009703d14aa2c678b0fd90fa7e417dc4ade9c151986a56bca98a79a /after/bin/readelf 1e4a29fded449aaba9844502a983818babb9535d872f11daa0057e2d651146ed /after/bin/size 32d6fc414d07ef1c5cc51d115730d7e41487459ec735b959a4f0127b779929bc /after/bin/strings From 329f5ac73ed43a42edc220d7efdcc0ef4ba03930 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrius=20=C5=A0tikonas?= Date: Mon, 1 Mar 2021 23:32:04 +0000 Subject: [PATCH 10/12] Regenerate bfd header files. --- sysa/binutils-2.14/binutils-2.14.sh | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/sysa/binutils-2.14/binutils-2.14.sh b/sysa/binutils-2.14/binutils-2.14.sh index bedbaacb..8db54b1d 100755 --- a/sysa/binutils-2.14/binutils-2.14.sh +++ b/sysa/binutils-2.14/binutils-2.14.sh @@ -72,3 +72,12 @@ src_configure() { sed -i 's/C_alloca/alloca/g' libiberty/alloca.c sed -i 's/C_alloca/alloca/g' include/libiberty.h } + +src_compile() { + # Rebuild generated header files. bfd/Makefile does not exists at this stage, + # so we need to create it first. + make configure-bfd + make -C bfd headers + + default_src_compile +} From ecb6e4868a45c82dd2813d1e34ed820c1e8fee7f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrius=20=C5=A0tikonas?= Date: Tue, 2 Mar 2021 22:02:07 +0000 Subject: [PATCH 11/12] Be a bit more verbose when applying patches. --- sysa/helpers.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/sysa/helpers.sh b/sysa/helpers.sh index 30a260ba..d1f35264 100755 --- a/sysa/helpers.sh +++ b/sysa/helpers.sh @@ -87,6 +87,7 @@ default_src_unpack() { default_src_prepare() { if test -d "${patch_dir}"; then for p in "${patch_dir}"/*.patch; do + echo "Applying patch: ${p}" patch -Np0 < "${p}" done fi From ed0f6136210b9797eac4fb82163561263dfba8a3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrius=20=C5=A0tikonas?= Date: Tue, 2 Mar 2021 22:02:53 +0000 Subject: [PATCH 12/12] Add a patch to produce deterministic binutils archives. --- sysa/binutils-2.14/binutils-2.14.sh | 2 + sysa/binutils-2.14/checksums | 28 ++++---- .../patches/deterministic_binutils.patch | 68 +++++++++++++++++++ 3 files changed, 84 insertions(+), 14 deletions(-) create mode 100644 sysa/binutils-2.14/patches/deterministic_binutils.patch diff --git a/sysa/binutils-2.14/binutils-2.14.sh b/sysa/binutils-2.14/binutils-2.14.sh index 8db54b1d..708ff866 100755 --- a/sysa/binutils-2.14/binutils-2.14.sh +++ b/sysa/binutils-2.14/binutils-2.14.sh @@ -4,6 +4,8 @@ # SPDX-License-Identifier: GPL-3.0-or-later src_prepare() { + default_src_prepare + rm configure autoconf-2.13 for dir in binutils bfd gas ld gprof libiberty opcodes; do diff --git a/sysa/binutils-2.14/checksums b/sysa/binutils-2.14/checksums index 8edc8b6a..6b90df25 100644 --- a/sysa/binutils-2.14/checksums +++ b/sysa/binutils-2.14/checksums @@ -1,19 +1,19 @@ -7b1da1994710a9aa36444bc7b407d08e71868d2359961f77d49e66a20af4d87a /after/bin/addr2line -74dd89fbb30b8a1ecbab65239044485a4008c905442b9c1e990c7e8801bb6831 /after/bin/ar -597f7b0e56caba525fdc03bb1d2687c90de56c238cbb57851064a953ca967bb5 /after/bin/as -0bc538abc2e08b42253a8da759e7129db90030694eb2346f582cfd3bde12b758 /after/bin/c++filt -e8fbe83b64a48e3b84a09f2cad2ae0eb386f91e8ab7113d87d018f5a93202737 /after/bin/gprof -a203fff2d5e392b8a594435a58389f6e9a96bc2aad2cc96987589f140bd3ff1a /after/bin/ld -fcdcbbd7b0e110db0af54ffe5f1f23cedce3453b146b9a9acbcaeba7abb09956 /after/bin/nm -9e867d24d0a712ce78f66ac420ea91446615ee95ff2d5d0a116b1eaa88d57ccc /after/bin/objcopy -a2a2aea479cbe6f87fd0d801a9f309715af8b3d7ddfe83419bd0982ae8418cb8 /after/bin/objdump +9d04d6617616fe5cb2cfb3fbc32b9fe9ab891a8f21ecf5fbf9e9570831826ef4 /after/bin/addr2line +8ac5f9c6281a4272bb5329b5d3b73bb744102b0e9c6964ebd5fbc893e56d866f /after/bin/ar +6dc5bf6e40feacd8ea20e7a8a3ded12fe37c2848b6023f284d22e89db09b101f /after/bin/as +4eae20278831c452f01d4a7dde2a795e9e1c0ab60f9d32590c8d77e98a33b39e /after/bin/c++filt +c70b11d11aaebefb92d08e61a18c2a79eb78f63add3a62c2b31fd73d394430ed /after/bin/gprof +20f10bddc981e797943980195794fdb19bfaf679be49c2e1236f0522ed9c07aa /after/bin/ld +e4409a21081ec94abda6c749a9791f68a5bdc35ee77093abb608cf7beefa8020 /after/bin/nm +97fcc442ec3785b1413133c2b4f528a005aa927a4e54f955bc17a07df620f189 /after/bin/objcopy +3d7a99f65f51aca2ec4c526683740637586c9321cf43fc0fc561955615c4d7ad /after/bin/objdump e49bba1ea6a61fb90f754e8de4692ed0810e7c68429f0b22fbf37670607a7807 /after/bin/od -af1dd1d58e1c2023b2799d1a9653888e0253f285d762ec101d4b175adfcff0fe /after/bin/ranlib +530d1747439ab516ad010d170e2f56ebe2b2049043fb3d5e18a4234b04b96e5c /after/bin/ranlib 978d6cf91009703d14aa2c678b0fd90fa7e417dc4ade9c151986a56bca98a79a /after/bin/readelf -1e4a29fded449aaba9844502a983818babb9535d872f11daa0057e2d651146ed /after/bin/size -32d6fc414d07ef1c5cc51d115730d7e41487459ec735b959a4f0127b779929bc /after/bin/strings -f73212b09ef427ac4708262a23b4d3d24fa2500639902600726af8b7968cc3c5 /after/bin/strip -bf061ebdf7ef24944fcadd2f12583d00b5d174ea30a3b5cb23618b259d3cf0b1 /after/lib/musl/libbfd.a +9d1b1179b67279109e9648368a8ffedd71fdd1c21857ee77058192b0f1dbaeba /after/bin/size +82657d370bca61bf6a6a4cbfb621614582519f2e938be1a4d09c135344c7c889 /after/bin/strings +fe6eaa5cf6e6621356fff3cd047c7cd0051490e895915027b6d4439159707f36 /after/bin/strip +f5934b4f057018b7f14adc197460d8b238cff80294234d771a17a408d5794104 /after/lib/musl/libbfd.a 3c9ab37cff5f732bca1258879fabf3c6c734890de1d7aa6381a5945d38f31c86 /after/lib/musl/libbfd.la 61a03b0d2eafa5ad50242a7ee8ce8664c2ef342bf727f46ceab8999b61a9a61b /after/lib/musl/libiberty.a 6530574bde4f5c57b194ae4229efb9784a97cc89cd45fc0d852e9afb5e103e4f /after/lib/musl/libopcodes.a diff --git a/sysa/binutils-2.14/patches/deterministic_binutils.patch b/sysa/binutils-2.14/patches/deterministic_binutils.patch new file mode 100644 index 00000000..06d556d0 --- /dev/null +++ b/sysa/binutils-2.14/patches/deterministic_binutils.patch @@ -0,0 +1,68 @@ +SPDX-FileCopyrightText: 2021 Andrius Štikonas +SPDX-FileCopyrightText: 2009 Chris Demetriou + +SPDX-License-Identifier: GPL-2.0-or-later + +Old binutils do not have support for creating deterministic archives. +Backported from upstream commit 36e4dce69dd23bea9ea2258dea35f034b6d6351c + +--- bfd/archive.c 2021-03-01 00:05:54.888301655 +0000 ++++ bfd/archive.c 2021-03-02 21:53:51.001617689 +0000 +@@ -1396,10 +1396,6 @@ + { + /* Assume we just "made" the member, and fake it. */ + struct bfd_in_memory *bim = (struct bfd_in_memory *) member->iostream; +- time (&status.st_mtime); +- status.st_uid = getuid (); +- status.st_gid = getgid (); +- status.st_mode = 0644; + status.st_size = bim->size; + } + else if (stat (filename, &status) != 0) +@@ -1408,6 +1404,11 @@ + return NULL; + } + ++ status.st_mtime = 0; ++ status.st_uid = 0; ++ status.st_gid = 0; ++ status.st_mode = 0644; ++ + amt = sizeof (struct ar_hdr) + sizeof (struct areltdata); + ared = (struct areltdata *) bfd_zalloc (abfd, amt); + if (ared == NULL) +@@ -2003,13 +2004,11 @@ + stat (arch->filename, &statbuf); + memset ((char *) (&hdr), 0, sizeof (struct ar_hdr)); + sprintf (hdr.ar_name, RANLIBMAG); +- /* Remember the timestamp, to keep it holy. But fudge it a little. */ +- bfd_ardata (arch)->armap_timestamp = statbuf.st_mtime + ARMAP_TIME_OFFSET; + bfd_ardata (arch)->armap_datepos = (SARMAG + + offsetof (struct ar_hdr, ar_date[0])); +- sprintf (hdr.ar_date, "%ld", bfd_ardata (arch)->armap_timestamp); +- sprintf (hdr.ar_uid, "%ld", (long) getuid ()); +- sprintf (hdr.ar_gid, "%ld", (long) getgid ()); ++ sprintf (hdr.ar_date, "%ld", 0); ++ sprintf (hdr.ar_uid, "%ld", 0); ++ sprintf (hdr.ar_gid, "%ld", 0); + sprintf (hdr.ar_size, "%-10d", (int) mapsize); + strncpy (hdr.ar_fmag, ARFMAG, 2); + for (i = 0; i < sizeof (struct ar_hdr); i++) +@@ -2082,6 +2081,8 @@ + struct ar_hdr hdr; + unsigned int i; + ++ return TRUE; ++ + /* Flush writes, get last-write timestamp from file, and compare it + to the timestamp IN the file. */ + bfd_flush (arch); +@@ -2169,7 +2170,7 @@ + memset ((char *) (&hdr), 0, sizeof (struct ar_hdr)); + hdr.ar_name[0] = '/'; + sprintf (hdr.ar_size, "%-10d", (int) mapsize); +- sprintf (hdr.ar_date, "%ld", (long) time (NULL)); ++ sprintf (hdr.ar_date, "%ld", 0); + /* This, at least, is what Intel coff sets the values to. */ + sprintf ((hdr.ar_uid), "%d", 0); + sprintf ((hdr.ar_gid), "%d", 0);