commit:     a17bb3fea0e10d907d09092f835571dec4268534
Author:     Hank Leininger <hlein <AT> korelogic <DOT> com>
AuthorDate: Mon Jul 28 04:38:07 2025 +0000
Commit:     Viorel Munteanu <ceamac <AT> gentoo <DOT> org>
CommitDate: Thu Sep 18 17:15:40 2025 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=a17bb3fe

sys-boot/lilo: Pick up as p-m; misc updates and cleanups

See: https://github.com/gentoo/gentoo/pull/43203
Closes: https://bugs.gentoo.org/792567
Closes: https://bugs.gentoo.org/944419
Closes: https://bugs.gentoo.org/753605
Signed-off-by: Hank Leininger <hlein <AT> korelogic.com>
Part-of: https://github.com/gentoo/gentoo/pull/43203
Closes: https://github.com/gentoo/gentoo/pull/43203
Signed-off-by: Viorel Munteanu <ceamac <AT> gentoo.org>

 .../lilo/files/lilo-24.2-Makefile-tweaks.patch     |  40 +++++++
 sys-boot/lilo/files/lilo-24.2-fix-gcc-15.patch     |  12 ++
 sys-boot/lilo/files/lilo-24.2-musl.patch           |  17 +++
 .../files/lilo-24.2-remove-gcc-ver-check.patch     |  25 +++++
 sys-boot/lilo/lilo-24.2-r3.ebuild                  | 123 +++++++++++++++++++++
 sys-boot/lilo/metadata.xml                         |  13 ++-
 6 files changed, 227 insertions(+), 3 deletions(-)

diff --git a/sys-boot/lilo/files/lilo-24.2-Makefile-tweaks.patch 
b/sys-boot/lilo/files/lilo-24.2-Makefile-tweaks.patch
new file mode 100644
index 000000000000..1a0c5350c5fe
--- /dev/null
+++ b/sys-boot/lilo/files/lilo-24.2-Makefile-tweaks.patch
@@ -0,0 +1,40 @@
+Do not strip, have parallel make, and do not rebuild images
+--- a/Makefile
++++ b/Makefile
+@@ -12,7 +12,6 @@
+ #
+ all: test
+       make -C src all
+-      make -C images all
+ 
+ #
+ #  make help
+@@ -45,7 +44,6 @@
+ #
+ alles: test
+       $(MAKE) -C src alles
+-      $(MAKE) -C images all
+ 
+ #
+ # documentation files
+@@ -104,7 +102,6 @@
+ #
+ install:  all
+       $(MAKE) -C src install
+-      $(MAKE) -C images install
+       $(MAKE) -C hooks install
+       $(MAKE) -C sample install
+       $(MAKE) -C scripts install
+--- a/src/Makefile
++++ b/src/Makefile
+@@ -242,10 +242,8 @@
+       if [ -f diag1.img ]; then cp -f diag1.img $$DESTDIR$(BOOT_DIR); fi
+       if [ -f diag2.img ]; then cp -f diag2.img $$DESTDIR$(BOOT_DIR); fi
+ 
+-      strip lilo
+       cp lilo $$DESTDIR$(SBIN_DIR)/lilo
+       if [ -f lilo.static ]; then \
+-        strip lilo.static; \
+         cp lilo.static $$DESTDIR$(SBIN_DIR)/lilo.static; \
+       fi
+       cp ../mkrescue $$DESTDIR$(USRSBIN_DIR)/mkrescue

diff --git a/sys-boot/lilo/files/lilo-24.2-fix-gcc-15.patch 
b/sys-boot/lilo/files/lilo-24.2-fix-gcc-15.patch
new file mode 100644
index 000000000000..a10e41687cec
--- /dev/null
+++ b/sys-boot/lilo/files/lilo-24.2-fix-gcc-15.patch
@@ -0,0 +1,12 @@
+Adapted from 
https://mirrors.slackware.com/slackware/slackware-current/source/a/lilo/lilo.gcc15.diff
+--- a/make.vars
++++ b/make.vars
+@@ -80,7 +80,7 @@
+ MAN_DIR=/usr/share/man
+ 
+ # set the compiler optimization level
+-OPT=-Os
++OPT=-Os -std=gnu17
+ 
+ ### End of configuration variables for makefiles ###
+ 

diff --git a/sys-boot/lilo/files/lilo-24.2-musl.patch 
b/sys-boot/lilo/files/lilo-24.2-musl.patch
new file mode 100644
index 000000000000..c542e27ea1c3
--- /dev/null
+++ b/sys-boot/lilo/files/lilo-24.2-musl.patch
@@ -0,0 +1,17 @@
+Adapted from 
https://git.sr.ht/~kqz/repo/tree/b8808d806c887c0b800d3548f0c6201440b25a5e/item/server/lilo/patches/musl.patch
+--- a/src/common.h
++++ b/src/common.h
+@@ -23,12 +23,7 @@
+ # define PAGE_SIZE 4096U
+ #endif
+ 
+-#ifdef O_ACCMODE
+-# define O_NOACCESS O_ACCMODE
+-#else
+-/* open a file for "no access" */
+-# define O_NOACCESS 3
+-#endif
++#define O_NOACCESS O_RDONLY
+ 
+ /* special for LILO, bypass the actual open in  dev_open( , ,-1)   */
+ #define O_BYPASS -1

diff --git a/sys-boot/lilo/files/lilo-24.2-remove-gcc-ver-check.patch 
b/sys-boot/lilo/files/lilo-24.2-remove-gcc-ver-check.patch
new file mode 100644
index 000000000000..44883cdcdab5
--- /dev/null
+++ b/sys-boot/lilo/files/lilo-24.2-remove-gcc-ver-check.patch
@@ -0,0 +1,25 @@
+Drop explicit GCC invocation for version check (of 3.3.5...).
+Adapted from https://753605.bugs.gentoo.org/attachment.cgi?id=773618
+--- a/checkit
++++ b/checkit
+@@ -47,20 +47,6 @@
+ }
+ 
+ #echo
+-echo GCC version $gccmin or later is required
+-gcc -v 1>foo1 2>foo2
+-V=`cat foo1 foo2 | cut -d' ' -f1-3 | grep -i version | tr '-' ' ' | cut -d' ' 
-f 3`
+-rm -f foo1 foo2
+-if [ -z "$V" ]; then
+-      echo gcc is not present
+-      ret=1
+-else
+-      vers_min $V $gccmin
+-      echo gcc version $V
+-      if [ $rc = 0 ]; then echo OKAY; else echo ERROR; ret=1; fi
+-fi
+-
+-echo
+ echo AS86 version $bccmin or later is required
+ as86 -v 1>foo1 2>foo2
+ A=`cat foo1 foo2 | grep version | cut -d " " -f 3`

diff --git a/sys-boot/lilo/lilo-24.2-r3.ebuild 
b/sys-boot/lilo/lilo-24.2-r3.ebuild
new file mode 100644
index 000000000000..d918734bb34c
--- /dev/null
+++ b/sys-boot/lilo/lilo-24.2-r3.ebuild
@@ -0,0 +1,123 @@
+# Copyright 1999-2025 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+inherit optfeature toolchain-funcs
+
+DOLILO_V="0.6"
+
+DESCRIPTION="LInux LOader, the original Linux bootloader"
+HOMEPAGE="https://www.joonet.de/lilo/";
+
+DOLILO_TAR="dolilo-${DOLILO_V}.tar.bz2"
+SRC_URI="
+       https://www.joonet.de/lilo/ftp/sources/${P}.tar.gz
+       mirror://gentoo/${DOLILO_TAR}
+"
+
+LICENSE="BSD GPL-2"
+SLOT="0"
+KEYWORDS="-* ~amd64 ~x86"
+
+IUSE="device-mapper keytab pxeserial static"
+
+DEPEND="sys-devel/bin86"
+RDEPEND="
+       device-mapper? ( sys-fs/lvm2 )
+       keytab? ( dev-lang/perl )
+"
+
+PATCHES=(
+       "${FILESDIR}"/${PN}-24.2-Makefile-tweaks.patch
+       "${FILESDIR}"/${PN}-24.2-add-nvme-support.patch
+       "${FILESDIR}"/${PN}-24.x-fix-gcc-10.patch
+       "${FILESDIR}"/${PN}-24.x-check-for-__GLIBC__.patch
+       "${FILESDIR}"/${PN}-24.2-fix-gcc-15.patch
+       "${FILESDIR}"/${PN}-24.2-musl.patch
+       "${FILESDIR}"/${PN}-24.2-remove-gcc-ver-check.patch
+)
+
+# Bootloaders should not be using arbitrary CFLAGS without good reason.  A 
bootloader
+# is typically only executed once to boot the system, and it should work the 
first time.
+QA_FLAGS_IGNORED="sbin/lilo"
+
+src_prepare() {
+       default
+
+       # this patch is needed when booting PXE and the device you're using
+       # emulates vga console via serial console.
+       # IE..  B.B.o.o.o.o.t.t.i.i.n.n.g.g....l.l.i.i.n.n.u.u.x.x and stair 
stepping.
+       use pxeserial && eapply "${FILESDIR}/${PN}-24.1-novga.patch"
+}
+
+src_configure() {
+       if ! use device-mapper; then
+               sed -i make.vars -e 's|-DDEVMAPPER||g' || die
+       fi
+}
+
+src_compile() {
+       # lilo needs this. bug #140209
+       export LC_ALL=C
+
+       local target=$(usex static alles all)
+
+       # we explicitly prevent the custom CFLAGS for stability reasons
+       emake CC="$(tc-getCC) ${LDFLAGS}" ${target}
+}
+
+src_install() {
+       emake DESTDIR="${ED}" install
+
+       into /
+       dosbin "${WORKDIR}"/dolilo/dolilo
+
+       if use keytab; then
+               into /usr
+               dosbin keytab-lilo.pl
+       fi
+
+       insinto /etc
+       newins "${FILESDIR}"/lilo.conf lilo.conf.example
+
+       newconfd "${WORKDIR}"/dolilo/dolilo.conf.d dolilo.example
+
+       dodoc CHANGELOG* readme/README.* readme/INCOMPAT README
+       docinto samples ; dodoc sample/*
+
+       # This we don't use
+       rm -r "${ED}/etc/initramfs" || die
+       # This should be in /usr/lib and it should have the .install suffix
+       dodir /usr/lib/kernel
+       for dir in postinst.d postrm.d; do
+               mv "${ED}/etc/kernel/${dir}" "${ED}/usr/lib/kernel/${dir}" || 
die
+               mv "${ED}/usr/lib/kernel/${dir}/zz-runlilo" 
"${ED}/usr/lib/kernel/${dir}/90-runlilo.install" || die
+       done
+       # Insert wrapper for systemd's kernel-install
+       exeinto /usr/lib/kernel/install.d
+       newexe - 90-runlilo.install <<-EOF
+               #!/bin/sh
+               if [ "\${1}" = "add" ]; then
+                       exec "\$(dirname 
\${0})/../postinst.d/90-runlilo.install"
+               elif [ "\${1}" = "remove" ]; then
+                       exec "\$(dirname \${0})/../postrm.d/90-runlilo.install"
+               fi
+       EOF
+}
+
+pkg_postinst() {
+       if [[ ! -e "${ROOT}/boot/boot.b" && ! -L "${ROOT}/boot/boot.b" ]]; then
+               [[ -f "${ROOT}/boot/boot-menu.b" ]] && \
+                       ln -snf boot-menu.b "${ROOT}/boot/boot.b"
+       fi
+
+       einfo
+       einfo "Issue 'dolilo' instead of 'lilo' to have a friendly wrapper that"
+       einfo "handles mounting and unmounting /boot for you. It can do more, "
+       einfo "edit /etc/conf.d/dolilo to harness its full potential."
+       einfo
+
+       optfeature "automatically updating lilo's configuration on each kernel 
installation" \
+               sys-kernel/installkernel
+}

diff --git a/sys-boot/lilo/metadata.xml b/sys-boot/lilo/metadata.xml
index 0a0ff316148b..164cc0bce00d 100644
--- a/sys-boot/lilo/metadata.xml
+++ b/sys-boot/lilo/metadata.xml
@@ -1,11 +1,18 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!DOCTYPE pkgmetadata SYSTEM "https://www.gentoo.org/dtd/metadata.dtd";>
 <pkgmetadata>
-       <!-- maintainer-needed -->
-
+       <maintainer type="person" proxied="yes">
+               <email>[email protected]</email>
+               <name>Hank Leininger</name>
+       </maintainer>
+       <maintainer type="project" proxied="proxy">
+               <email>[email protected]</email>
+               <name>Proxy Maintainers</name>
+       </maintainer>
        <use>
                <flag name="device-mapper">Enable support for device-mapper 
from <pkg>sys-fs/lvm2</pkg></flag>
-               <flag name="minimal">Do not install the dolilo helper 
script</flag>
+               <flag name="keytab">Install keytab, keyboard remapping helper 
script</flag>
+               <flag name="minimal">Do not install optional bits (dolilo 
helper, docs, etc.)</flag>
                <flag name="pxeserial">Avoid character echo on PXE serial 
console</flag>
        </use>
 </pkgmetadata>

Reply via email to