From fd4713eb1e1a76c36b388a9961c3bdb236ad61c4 Mon Sep 17 00:00:00 2001 From: Nathan Fisher Date: Tue, 10 Jan 2023 00:56:05 -0500 Subject: [PATCH] Compilation upo to Util-linux on x86_64 --- include/mk/src-config.mk | 2 +- toolchain/gcc-pass2/Makefile | 7 ++++--- world/bin/sed/Makefile | 14 ++++++-------- world/e2fsprogs/Makefile | 1 + world/usr.bin/ex/Makefile | 8 ++++++++ world/util-linux/Makefile | 3 ++- world/util-linux/config_opts.mk | 1 + world/util-linux/util-linux-sigsetjmp.patch | 14 ++++++++++++++ 8 files changed, 37 insertions(+), 13 deletions(-) create mode 100644 world/util-linux/util-linux-sigsetjmp.patch diff --git a/include/mk/src-config.mk b/include/mk/src-config.mk index 8984729..bc03029 100644 --- a/include/mk/src-config.mk +++ b/include/mk/src-config.mk @@ -31,7 +31,7 @@ ifeq ($(filter armv6 armv7l aarch64, $(arch)), $(arch)) else tgt = $(arch)-hitchhiker-linux-musl endif -bld = $(shell gcc -dumpmachine) +bld = $(shell gcc -dumpmachine) exec_prefix ?= ${DESTDIR}${install_prefix} bindir ?= ${exec_prefix}/bin diff --git a/toolchain/gcc-pass2/Makefile b/toolchain/gcc-pass2/Makefile index 0d08c13..55f223a 100644 --- a/toolchain/gcc-pass2/Makefile +++ b/toolchain/gcc-pass2/Makefile @@ -3,11 +3,12 @@ # distname = gcc include toolchain.mk -objdir = $(global_objdir)/gcc-pass2 +ifeq ($(build_fortran), 1) + fortran = ',fortran' +objdir = $(global_objdir)/gcc-pass2 config_opts += --target=$(tgt) config_opts += --with-sysroot=$(build) -config_opts += --with-glibc-version=2.11 -config_opts += --enable-languages=c,c++ +config_opts += --enable-languages=c,c++${fortran} config_opts += --disable-multilib config_opts += --disable-bootstrap # For musl diff --git a/world/bin/sed/Makefile b/world/bin/sed/Makefile index 38f24d6..833e7fa 100644 --- a/world/bin/sed/Makefile +++ b/world/bin/sed/Makefile @@ -8,12 +8,10 @@ installdirs += $(local_docdir) docsrc = $(objdir)/doc/$(distname).html docfile = $(local_docdir)/$(distname).html +define post_install +$(MAKE) -C $(objdir) html +install -d $(local_docdir) +install -m644 $(docsrc) $(docfile) +endef + include targets.mk - -$(objdir)/doc/$(distname).html: - cd $(objdir) && $(MAKE) html - -$(docfile): $(docsrc) | $(local_docdir) - install -m644 $(docsrc) $@ - -install: $(docfile) diff --git a/world/e2fsprogs/Makefile b/world/e2fsprogs/Makefile index fd0d24f..206f43a 100644 --- a/world/e2fsprogs/Makefile +++ b/world/e2fsprogs/Makefile @@ -6,6 +6,7 @@ include world.mk export CFLAGS = --sysroot=$(DESTDIR) config_opts += --host=$(tgt) +config_opts += --build=$(bld) config_opts += --bindir=/bin config_opts += --with-root-prefix="" config_opts += --enable-elf-shlibs diff --git a/world/usr.bin/ex/Makefile b/world/usr.bin/ex/Makefile index f9c7dc7..c0f4cf4 100644 --- a/world/usr.bin/ex/Makefile +++ b/world/usr.bin/ex/Makefile @@ -54,3 +54,11 @@ $(libexecdir)/exrecover: $(objdir)/exrecover.o $(objdir)/compat.o $(objdir)/mapm $(libexecdir): install -d $@ + +libsclean: + $(MAKE) -C libuxre clean + $(MAKE) -C libterm clean + +clean: libsclean + +.PHONY: libsclean diff --git a/world/util-linux/Makefile b/world/util-linux/Makefile index 20ae6b7..702ca69 100644 --- a/world/util-linux/Makefile +++ b/world/util-linux/Makefile @@ -2,8 +2,9 @@ # Copyright 2020 Nathan Fisher # distname = util-linux -#patches += util-linux-musl.patch +patches += util-linux-musl.patch patches += util-linux-makefile.patch +patches += util-linux-sigsetjmp.patch include world.mk uldocdir = $(install_prefix)/share/doc/util-linux/$(util-linux_version) diff --git a/world/util-linux/config_opts.mk b/world/util-linux/config_opts.mk index 05eb5d3..9340f16 100644 --- a/world/util-linux/config_opts.mk +++ b/world/util-linux/config_opts.mk @@ -35,5 +35,6 @@ config_opts += --disable-static config_opts += --without-python config_opts += --without-systemd config_opts += --without-systemdsystemunitdir +config_opts += --without-libmagic config_opts += ADJTIME_PATH=/var/lib/hwclock/adjtime config_opts += runstatedir=/run diff --git a/world/util-linux/util-linux-sigsetjmp.patch b/world/util-linux/util-linux-sigsetjmp.patch new file mode 100644 index 0000000..c13f1bf --- /dev/null +++ b/world/util-linux/util-linux-sigsetjmp.patch @@ -0,0 +1,14 @@ +diff -Naur util-linux-2.36.1.orig/sys-utils/lscpu.c util-linux-2.36.1/sys-utils/lscpu.c +--- util-linux-2.36.1.orig/sys-utils/lscpu.c 2023-01-04 01:31:32.544009151 -0500 ++++ util-linux-2.36.1/sys-utils/lscpu.c 2023-01-04 01:51:51.679673180 -0500 +@@ -876,8 +876,8 @@ + * the signal. All this magic is needed because lscpu + * isn't supposed to require root privileges. + */ +- if (sigsetjmp(segv_handler_env, 1)) +- return 0; ++ //if (sigsetjmp(segv_handler_env, 1)) ++ // return 0; + + memset(&act, 0, sizeof(act)); + act.sa_sigaction = segv_handler;