From b9079045db46e7ca596613981f6bd1feacc7fe5f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrius=20=C5=A0tikonas?= Date: Fri, 13 May 2022 22:46:56 +0100 Subject: [PATCH] Swap sed and make. This allows to use makefile rather than kaem script for building sed. Makefiles for musl and mes are unified into one makefile with some conditional code. --- parts.rst | 10 ++++----- sysa.py | 8 +++---- sysa/after.kaem | 8 +++---- sysa/patch-2.5.9/patch-2.5.9.kaem | 2 -- sysa/sed-4.0.9/checksums | 2 +- sysa/sed-4.0.9/mk/main.mk | 21 +++++++++++++++---- sysa/sed-4.0.9/sed-4.0.9.kaem | 35 ++++++------------------------- sysa/sed-4.0.9/sed-4.0.9.sh | 1 - 8 files changed, 37 insertions(+), 50 deletions(-) diff --git a/parts.rst b/parts.rst index d314e1e4..9ef1f566 100644 --- a/parts.rst +++ b/parts.rst @@ -104,11 +104,6 @@ tar 1.12 We build GNU Tar 1.12, the last version compilable with mes libc. -sed 4.0.9 -========= - -You are most likely aware of GNU ``sed``, a line editor. - make 3.80 ========= @@ -116,6 +111,11 @@ GNU ``make`` is now built so we have a more robust building system. ``make`` allows us to do things like define rules for files rather than writing complex kaem scripts. +sed 4.0.9 +========= + +You are most likely aware of GNU ``sed``, a line editor. + patch 2.5.9 =========== diff --git a/sysa.py b/sysa.py index d2ab0683..21c2033f 100755 --- a/sysa.py +++ b/sysa.py @@ -92,7 +92,7 @@ class SysA(SysGeneral): def get_packages(self): """Prepare remaining sources""" - # mes-0.22 snapshot with m2 fixes + # mes-0.24 self.get_file(["https://mirrors.kernel.org/gnu/mes/mes-0.24.tar.gz", "https://download.savannah.gnu.org/releases/nyacc/nyacc-1.00.2.tar.gz"]) @@ -105,15 +105,15 @@ class SysA(SysGeneral): # tar 1.12 self.get_file("https://mirrors.kernel.org/gnu/tar/tar-1.12.tar.gz") + # make 3.80 + self.get_file("https://mirrors.kernel.org/gnu/make/make-3.80.tar.gz") + # sed 4.0.9 self.get_file("https://mirrors.kernel.org/gnu/sed/sed-4.0.9.tar.gz") # patch 2.5.9 self.get_file("https://mirrors.kernel.org/gnu/patch/patch-2.5.9.tar.gz") - # make 3.80 - self.get_file("https://mirrors.kernel.org/gnu/make/make-3.80.tar.gz") - # bzip2 1.0.8 self.get_file("https://sourceware.org/pub/bzip2/bzip2-1.0.8.tar.gz") diff --git a/sysa/after.kaem b/sysa/after.kaem index 2441eb86..e192655c 100755 --- a/sysa/after.kaem +++ b/sysa/after.kaem @@ -88,14 +88,14 @@ cd ${pkg} kaem --file ${pkg}.kaem cd .. -# sed -pkg="sed-4.0.9" +# make +pkg="make-3.80" cd ${pkg} kaem --file ${pkg}.kaem cd .. -# make -pkg="make-3.80" +# sed +pkg="sed-4.0.9" cd ${pkg} kaem --file ${pkg}.kaem cd .. diff --git a/sysa/patch-2.5.9/patch-2.5.9.kaem b/sysa/patch-2.5.9/patch-2.5.9.kaem index 3ee3e664..87d10df2 100755 --- a/sysa/patch-2.5.9/patch-2.5.9.kaem +++ b/sysa/patch-2.5.9/patch-2.5.9.kaem @@ -24,8 +24,6 @@ catm patchlevel.h cp pch.c pch_patched.c sed -i 841,848d pch_patched.c -# Compile - # Build make -f Makefile PREFIX=${prefix} diff --git a/sysa/sed-4.0.9/checksums b/sysa/sed-4.0.9/checksums index f0853958..a7847ef5 100644 --- a/sysa/sed-4.0.9/checksums +++ b/sysa/sed-4.0.9/checksums @@ -1 +1 @@ -19140fdea18e2d8f3ed1597f7d0d72baa7b2c3b69bf87edc35271df2da24bbfb /usr/bin/sed +092b2972a16ffe6919f52678c675ac29708f507ee800172ac139fb9c44ccb153 /usr/bin/sed diff --git a/sysa/sed-4.0.9/mk/main.mk b/sysa/sed-4.0.9/mk/main.mk index e7ec1236..554ee13b 100644 --- a/sysa/sed-4.0.9/mk/main.mk +++ b/sysa/sed-4.0.9/mk/main.mk @@ -12,11 +12,19 @@ CPPFLAGS = -DENABLE_NLS=0 \ -DSED_FEATURE_VERSION=\"4.0\" \ -DVERSION=\"4.0.9\" \ -DPACKAGE=\"sed\" -CFLAGS = -I . -I lib +CFLAGS = -I . -I lib -static +LDFLAGS = -L. -lsed .PHONY: all -LIB_SRC = alloca getopt1 getopt utils regex obstack strverscmp mkstemp +ifeq ($(LIBC),mes) + LIB_SRC = getline +else + LIB_SRC = alloca +endif + +LIB_SRC += getopt1 getopt utils regex obstack strverscmp mkstemp + LIB_OBJ = $(addprefix lib/, $(addsuffix .o, $(LIB_SRC))) SED_SRC = compile execute regexp fmt sed @@ -24,11 +32,16 @@ SED_OBJ = $(addprefix sed/, $(addsuffix .o, $(SED_SRC))) all: sed/sed +lib/regex.h: lib/regex_.h + cp $< $@ + +lib/regex.o: lib/regex.h + libsed.a: $(LIB_OBJ) $(AR) cr $@ $^ -sed/sed: $(SED_OBJ) libsed.a - $(CC) -o $@ $^ +sed/sed: libsed.a $(SED_OBJ) + $(CC) $^ $(LDFLAGS) -o $@ install: install -D sed/sed $(DESTDIR)$(PREFIX)/bin/sed diff --git a/sysa/sed-4.0.9/sed-4.0.9.kaem b/sysa/sed-4.0.9/sed-4.0.9.kaem index 0120359d..e181e494 100755 --- a/sysa/sed-4.0.9/sed-4.0.9.kaem +++ b/sysa/sed-4.0.9/sed-4.0.9.kaem @@ -16,40 +16,17 @@ cp ${distfiles}/${pkg}.tar.gz ../src/ gunzip -f ../src/${pkg}.tar.gz tar xf ../src/${pkg}.tar cd ${pkg} +cp ../../mk/main.mk Makefile # Create config.h catm config.h -# Compile +# Build +make -f Makefile LIBC=mes -## libsed.a -cd lib - -tcc -c getopt1.c -tcc -c -I .. getopt.c -tcc -c -I .. -DENABLE_NLS=0 utils.c -cp regex_.h regex.h -tcc -c -DHAVE_ALLOCA_H -I . regex.c -tcc -c obstack.c -tcc -c strverscmp.c -tcc -c getline.c -tcc -c -DHAVE_FCNTL_H mkstemp.c - -tcc -ar cr libsed.a getopt1.o getopt.o utils.o regex.o obstack.o strverscmp.o getline.o mkstemp.o -cd .. - -## sed -tcc -c -I . -I lib -DSED_FEATURE_VERSION=\"4.0\" sed/compile.c -tcc -c -I . -I lib sed/execute.c -tcc -c -I . -I lib sed/regexp.c -tcc -c -I . -I lib sed/fmt.c -tcc -c -I . -I lib -DPACKAGE=\"sed\" -DVERSION=\"4.0.9\" sed/sed.c - -# Link -tcc -static -o ${bindir}/sed -L lib lib/libsed.a compile.o execute.o regexp.o fmt.o sed.o -lsed - -# Test -sed --version +# Install +cp sed/sed ${prefix}/bin/sed +chmod 755 ${prefix}/bin/sed cd ../.. diff --git a/sysa/sed-4.0.9/sed-4.0.9.sh b/sysa/sed-4.0.9/sed-4.0.9.sh index b919317b..1b8b85d6 100755 --- a/sysa/sed-4.0.9/sed-4.0.9.sh +++ b/sysa/sed-4.0.9/sed-4.0.9.sh @@ -5,7 +5,6 @@ src_prepare() { default - cp lib/regex_.h lib/regex.h touch config.h }