commit: b769e16e87916549d80068b88ac8e1bd82bd149d
parent b88fbd1a2d725023ebc6f82f66d60620508fbdbc
Author: fosslinux <fosslinux@aussies.space>
Date: Mon, 8 Feb 2021 17:22:41 +1100
Merge pull request #33 from stikonas/m4
Update m4 to 1.4.7
Diffstat:
6 files changed, 65 insertions(+), 51 deletions(-)
diff --git 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
@@ -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
@@ -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
@@ -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
@@ -0,0 +1,47 @@
+# SPDX-FileCopyrightText: 2021 Andrius Štikonas <andrius@stikonas.eu>
+
+# 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
@@ -10,16 +10,16 @@ set -e
export PREFIX=/after
# Part 19
-build m4-1.4.4
+build flex-2.5.11
# Part 20
-build flex-2.5.11
+build musl-1.1.24
# Part 21
-build musl-1.1.24
+build tcc-0.9.27 tcc-musl.sh
# Part 22
-build tcc-0.9.27 tcc-musl.sh
+build m4-1.4.7
# Part 23
build flex-2.6.4