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.
This commit is contained in:
Andrius Štikonas 2022-05-13 22:46:56 +01:00
parent 3ed5daa5aa
commit b9079045db
8 changed files with 37 additions and 50 deletions

View file

@ -104,11 +104,6 @@ tar 1.12
We build GNU Tar 1.12, the last version compilable with mes libc. 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 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 ``make`` allows us to do things like define rules for files rather than
writing complex kaem scripts. writing complex kaem scripts.
sed 4.0.9
=========
You are most likely aware of GNU ``sed``, a line editor.
patch 2.5.9 patch 2.5.9
=========== ===========

View file

@ -92,7 +92,7 @@ class SysA(SysGeneral):
def get_packages(self): def get_packages(self):
"""Prepare remaining sources""" """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", 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"]) "https://download.savannah.gnu.org/releases/nyacc/nyacc-1.00.2.tar.gz"])
@ -105,15 +105,15 @@ class SysA(SysGeneral):
# tar 1.12 # tar 1.12
self.get_file("https://mirrors.kernel.org/gnu/tar/tar-1.12.tar.gz") 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 # sed 4.0.9
self.get_file("https://mirrors.kernel.org/gnu/sed/sed-4.0.9.tar.gz") self.get_file("https://mirrors.kernel.org/gnu/sed/sed-4.0.9.tar.gz")
# patch 2.5.9 # patch 2.5.9
self.get_file("https://mirrors.kernel.org/gnu/patch/patch-2.5.9.tar.gz") 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 # bzip2 1.0.8
self.get_file("https://sourceware.org/pub/bzip2/bzip2-1.0.8.tar.gz") self.get_file("https://sourceware.org/pub/bzip2/bzip2-1.0.8.tar.gz")

View file

@ -88,14 +88,14 @@ cd ${pkg}
kaem --file ${pkg}.kaem kaem --file ${pkg}.kaem
cd .. cd ..
# sed # make
pkg="sed-4.0.9" pkg="make-3.80"
cd ${pkg} cd ${pkg}
kaem --file ${pkg}.kaem kaem --file ${pkg}.kaem
cd .. cd ..
# make # sed
pkg="make-3.80" pkg="sed-4.0.9"
cd ${pkg} cd ${pkg}
kaem --file ${pkg}.kaem kaem --file ${pkg}.kaem
cd .. cd ..

View file

@ -24,8 +24,6 @@ catm patchlevel.h
cp pch.c pch_patched.c cp pch.c pch_patched.c
sed -i 841,848d pch_patched.c sed -i 841,848d pch_patched.c
# Compile
# Build # Build
make -f Makefile PREFIX=${prefix} make -f Makefile PREFIX=${prefix}

View file

@ -1 +1 @@
19140fdea18e2d8f3ed1597f7d0d72baa7b2c3b69bf87edc35271df2da24bbfb /usr/bin/sed 092b2972a16ffe6919f52678c675ac29708f507ee800172ac139fb9c44ccb153 /usr/bin/sed

View file

@ -12,11 +12,19 @@ CPPFLAGS = -DENABLE_NLS=0 \
-DSED_FEATURE_VERSION=\"4.0\" \ -DSED_FEATURE_VERSION=\"4.0\" \
-DVERSION=\"4.0.9\" \ -DVERSION=\"4.0.9\" \
-DPACKAGE=\"sed\" -DPACKAGE=\"sed\"
CFLAGS = -I . -I lib CFLAGS = -I . -I lib -static
LDFLAGS = -L. -lsed
.PHONY: all .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))) LIB_OBJ = $(addprefix lib/, $(addsuffix .o, $(LIB_SRC)))
SED_SRC = compile execute regexp fmt sed SED_SRC = compile execute regexp fmt sed
@ -24,11 +32,16 @@ SED_OBJ = $(addprefix sed/, $(addsuffix .o, $(SED_SRC)))
all: sed/sed all: sed/sed
lib/regex.h: lib/regex_.h
cp $< $@
lib/regex.o: lib/regex.h
libsed.a: $(LIB_OBJ) libsed.a: $(LIB_OBJ)
$(AR) cr $@ $^ $(AR) cr $@ $^
sed/sed: $(SED_OBJ) libsed.a sed/sed: libsed.a $(SED_OBJ)
$(CC) -o $@ $^ $(CC) $^ $(LDFLAGS) -o $@
install: install:
install -D sed/sed $(DESTDIR)$(PREFIX)/bin/sed install -D sed/sed $(DESTDIR)$(PREFIX)/bin/sed

View file

@ -16,40 +16,17 @@ cp ${distfiles}/${pkg}.tar.gz ../src/
gunzip -f ../src/${pkg}.tar.gz gunzip -f ../src/${pkg}.tar.gz
tar xf ../src/${pkg}.tar tar xf ../src/${pkg}.tar
cd ${pkg} cd ${pkg}
cp ../../mk/main.mk Makefile
# Create config.h # Create config.h
catm config.h catm config.h
# Compile # Build
make -f Makefile LIBC=mes
## libsed.a # Install
cd lib cp sed/sed ${prefix}/bin/sed
chmod 755 ${prefix}/bin/sed
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
cd ../.. cd ../..

View file

@ -5,7 +5,6 @@
src_prepare() { src_prepare() {
default default
cp lib/regex_.h lib/regex.h
touch config.h touch config.h
} }