From c9a390d67c31dacbf1ddc8d78b418ae2f3506023 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrius=20=C5=A0tikonas?= Date: Sun, 7 Feb 2021 15:39:42 +0000 Subject: [PATCH] Update m4 to 1.4.7 --- README.md | 18 +++++++-------- rootfs.sh | 6 ++--- sysa/helpers.sh | 4 ++-- sysa/m4-1.4.4/mk/main.mk | 33 ---------------------------- sysa/m4-1.4.7/mk/main.mk | 47 ++++++++++++++++++++++++++++++++++++++++ sysa/run.sh | 10 ++++----- 6 files changed, 66 insertions(+), 52 deletions(-) delete mode 100644 sysa/m4-1.4.4/mk/main.mk create mode 100644 sysa/m4-1.4.7/mk/main.mk diff --git a/README.md b/README.md index 2e7f93f..29fb07d 100644 --- a/README.md +++ b/README.md @@ -254,13 +254,7 @@ Bash ships with a bison pre-generated file here which we delete. Unfortunately, we have not bootstrapped bison but fortunately for us, heirloom yacc is able to cope here. -#### Part 19: m4 1.4.4 - -`m4` is the first piece of software we need in the autotools suite and flex -2.6.4. It allows macros to be defined and files to be generated from those -macros. - -#### Part 20: flex 2.5.11 +#### Part 19: flex 2.5.11 `flex` is a tool for generating lexers or scanners: programs that recognize lexical patters. @@ -271,7 +265,7 @@ that it can be processed by lex for the Heirloom project (the required modifications are mostly syntactical, plus a few workarounds to avoid some flex advanced features). -#### Part 21: musl 1.1.24 +#### Part 20: musl 1.1.24 `musl` is a C standard library that is lightweight, fast, simple, free, and strives to be correct in the sense of standards-conformance and safety. `musl` @@ -283,13 +277,19 @@ complex programs. patches. In particular, we replace all weak symbols with strong symbols and will patch `tcc` in the next step to ignore duplicate symbols. -#### Part 22: tcc 0.9.27 (musl) +#### Part 21: tcc 0.9.27 (musl) We recompile `tcc` against musl. This is a two stage process. First we build tcc-0.9.27 that itself links to Mes C library but produces binaries linked to musl. Then we recompile newly produced tcc with itself. Interestingly, tcc-0.9.27 linked against musl is self hosting. +#### Part 22: m4 1.4.7 + +`m4` is the first piece of software we need in the autotools suite, flex +2.6.4 and bison. It allows macros to be defined and files to be generated from those +macros. + #### Part 23: flex 2.6.14 We recompile unpatched GNU `flex` using older flex 2.5.11. This is again a two diff --git a/rootfs.sh b/rootfs.sh index 33098a6..6087949 100755 --- a/rootfs.sh +++ b/rootfs.sh @@ -124,15 +124,15 @@ get_file http://downloads.sourceforge.net/project/heirloom/heirloom-devtools/070 # bash 2.05b get_file https://ftp.gnu.org/pub/gnu/bash/bash-2.05b.tar.gz -# m4 1.4.4 -get_file https://ftp.gnu.org/gnu/m4/m4-1.4.4.tar.gz - # flex 2.5.11 get_file http://download.nust.na/pub2/openpkg1/sources/DST/flex/flex-2.5.11.tar.gz # musl 1.1.24 get_file https://musl.libc.org/releases/musl-1.1.24.tar.gz +# m4 1.4.7 +get_file https://ftp.gnu.org/gnu/m4/m4-1.4.7.tar.gz + # flex 2.6.4 get_file https://github.com/westes/flex/releases/download/v2.6.4/flex-2.6.4.tar.gz diff --git a/sysa/helpers.sh b/sysa/helpers.sh index 7e0ed68..49aa716 100755 --- a/sysa/helpers.sh +++ b/sysa/helpers.sh @@ -103,13 +103,13 @@ default_src_configure() { # Default function for compiling source. It simply runs make without any parameters. default_src_compile() { - make + make -f Makefile } # Default installing function. PREFIX should be set by run.sh script. # Note that upstream makefiles might ignore PREFIX and have to be configured in configure stage. default_src_install() { - make install PREFIX="${PREFIX}" + make -f Makefile install PREFIX="${PREFIX}" } # Check if bash function exists diff --git a/sysa/m4-1.4.4/mk/main.mk b/sysa/m4-1.4.4/mk/main.mk deleted file mode 100644 index 72c4176..0000000 --- a/sysa/m4-1.4.4/mk/main.mk +++ /dev/null @@ -1,33 +0,0 @@ -PRODUCT = m4 -VERSION = 1.4 - -CC = tcc -LD = tcc -AR = tcc -ar - -CFLAGS = -I lib \ - -DPRODUCT=\"$(PRODUCT)\" \ - -DVERSION=\"$(VERSION)\" \ - -DHAVE_SIGNAL_H=1 \ - -DPACKAGE_STRING=\"GNU\ M4\ 1.4.4\" - -LDFLAGS = -L . -lm4 - -.PHONY: all - -LIB_SRC = regex getopt getopt1 error obstack xmalloc xstrdup -LIB_OBJECTS = $(addprefix lib/, $(addsuffix .o, $(LIB_SRC))) - -M4_SRC = m4 builtin debug eval format freeze input macro output path symtab -M4_OBJ = $(addprefix src/, $(addsuffix .o, $(M4_SRC))) - -all: m4 - -m4: libm4.a $(M4_OBJ) - $(CC) $(CFLAGS) $^ $(LDFLAGS) -o $@ - -libm4.a: $(LIB_OBJECTS) - $(AR) cr $@ $^ - -install: all - install m4 $(PREFIX)/bin diff --git a/sysa/m4-1.4.7/mk/main.mk b/sysa/m4-1.4.7/mk/main.mk new file mode 100644 index 0000000..7faa4a0 --- /dev/null +++ b/sysa/m4-1.4.7/mk/main.mk @@ -0,0 +1,47 @@ +# SPDX-FileCopyrightText: 2021 Andrius Štikonas + +# SPDX-License-Identifier: GPL-3.0-or-later + +CC = tcc +AR = tcc -ar + +CFLAGS = -I lib \ + -DVERSION=\"1.4.7\" \ + -DPACKAGE_BUGREPORT=\"bug-m4@gnu.org\" \ + -DPACKAGE_STRING=\"GNU\ M4\ 1.4.7\" \ + -DPACKAGE=\"m4\" \ + -DPACKAGE_NAME=\"GNU\ M4\" \ + -DHAVE_STDINT_H=1 \ + -DHAVE___FPENDING=1 \ + -DHAVE_DECL___FPENDING=1 \ + -D_GNU_SOURCE=1 \ + -D_GL_UNUSED= \ + -D__getopt_argv_const=const \ + -DSYSCMD_SHELL=\"/bin/sh\" + +LDFLAGS = -L . -lm4 + +.PHONY: all + +LIB_SRC = cloexec close-stream dup-safer error exitfail fd-safer fopen-safer getopt getopt1 mkstemp-safer regex obstack tmpfile-safer verror xalloc-die xasprintf xmalloc xvasprintf +LIB_OBJECTS = $(addprefix lib/, $(addsuffix .o, $(LIB_SRC))) + +M4_SRC = m4 builtin debug eval format freeze input macro output path symtab +M4_OBJ = $(addprefix src/, $(addsuffix .o, $(M4_SRC))) + +all: src/m4 + +src/m4: libm4.a $(M4_OBJ) + $(CC) $(CFLAGS) $^ $(LDFLAGS) -o $@ + +libm4.a: $(LIB_OBJECTS) + $(AR) cr $@ $^ + +%.o : %.c lib/config.h + $(CC) -c -o $@ $< $(CFLAGS) + +lib/config.h: + touch lib/config.h + +install: all + install src/m4 $(PREFIX)/bin diff --git a/sysa/run.sh b/sysa/run.sh index cb33eeb..dc3b607 100755 --- a/sysa/run.sh +++ b/sysa/run.sh @@ -10,17 +10,17 @@ set -e export PREFIX=/after # Part 19 -build m4-1.4.4 - -# Part 20 build flex-2.5.11 -# Part 21 +# Part 20 build musl-1.1.24 -# Part 22 +# Part 21 build tcc-0.9.27 tcc-musl.sh +# Part 22 +build m4-1.4.7 + # Part 23 build flex-2.6.4