commit: 5ef1baeccfded32b1b70c8ed496459573ee78242
parent 6a6c5acf1c1e87b74181fe4cfa37ecf39964e744
Author: fosslinux <fosslinux@aussies.space>
Date: Wed, 3 Mar 2021 16:24:09 +1100
Merge pull request #54 from stikonas/binutils
Binutils
Diffstat:
15 files changed, 331 insertions(+), 2 deletions(-)
diff --git a/SHA256SUMS.sources b/SHA256SUMS.sources
@@ -3,9 +3,11 @@ 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
+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
@@ -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
==========
@@ -392,3 +397,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/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
@@ -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
@@ -213,6 +216,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/autoconf-2.12/checksums b/sysa/autoconf-2.12/checksums
diff --git a/sysa/autoconf-2.13/checksums b/sysa/autoconf-2.13/checksums
diff --git a/sysa/autoconf-2.52/checksums b/sysa/autoconf-2.52/checksums
diff --git a/sysa/automake-1.4-p6/checksums b/sysa/automake-1.4-p6/checksums
diff --git a/sysa/binutils-2.14/binutils-2.14.sh b/sysa/binutils-2.14/binutils-2.14.sh
@@ -0,0 +1,85 @@
+# SPDX-FileCopyrightText: 2021 Andrius Štikonas <andrius@stikonas.eu>
+# SPDX-FileCopyrightText: 2021 Paul Dersey <pdersey@gmail.com>
+#
+# 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
+ 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
+ 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
+
+ # 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() {
+ 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 \
+ --prefix="${PREFIX}" \
+ --libdir="${PREFIX}/lib/musl"
+
+ # 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
+}
+
+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
+}
diff --git a/sysa/binutils-2.14/checksums b/sysa/binutils-2.14/checksums
@@ -0,0 +1,20 @@
+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
+530d1747439ab516ad010d170e2f56ebe2b2049043fb3d5e18a4234b04b96e5c /after/bin/ranlib
+978d6cf91009703d14aa2c678b0fd90fa7e417dc4ade9c151986a56bca98a79a /after/bin/readelf
+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
+d3c307c7a2cd62a3fc39aa933f40bee94b94aff5db58a3652689ebfe0f616c82 /after/lib/musl/libopcodes.la
diff --git a/sysa/binutils-2.14/patches/deterministic_binutils.patch b/sysa/binutils-2.14/patches/deterministic_binutils.patch
@@ -0,0 +1,68 @@
+SPDX-FileCopyrightText: 2021 Andrius Štikonas <andrius@stikonas.eu>
+SPDX-FileCopyrightText: 2009 Chris Demetriou <cgd@google.com>
+
+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);
diff --git a/sysa/coreutils-6.3/checksums 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
@@ -0,0 +1,21 @@
+# SPDX-FileCopyrightText: 2021 Andrius Štikonas <andrius@stikonas.eu>
+#
+# 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
@@ -0,0 +1,105 @@
+# SPDX-FileCopyrightText: 2021 Andrius Štikonas <andrius@stikonas.eu>
+# SPDX-FileCopyrightText: 2021 Paul Dersey <pdersey@gmail.com>
+#
+# 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/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 ..
@@ -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
diff --git 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
@@ -79,4 +82,6 @@ build autoconf-2.13
build autoconf-2.12
+build binutils-2.14
+
echo "Bootstrapping completed."