Skip to content

Commit

Permalink
sys-boot/yaboot: bundle e2fsprogs-1.42.13, bug #641560
Browse files Browse the repository at this point in the history
By default yaboot setup is unusual: it provides it's own
ext2fs headers and links against systems' ext2fs code.

That occasionally breaks when ext2fs.a gets too much out
of sync with expected interface. Pin it to something that
was observed to work by Olivier Néumin.

Reported-by: Paul Osmialowski
Bug: https://bugs.gentoo.org/641560
Package-Manager: Portage-2.3.56, Repoman-2.3.12
Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
  • Loading branch information
Sergei Trofimovich committed Jan 16, 2019
1 parent d2d54a3 commit 80e699d
Show file tree
Hide file tree
Showing 3 changed files with 198 additions and 0 deletions.
1 change: 1 addition & 0 deletions sys-boot/yaboot/Manifest
@@ -1,3 +1,4 @@
DIST e2fsprogs-1.42.13.tar.gz 6511931 BLAKE2B 2f849e82ad366f86d9d166f1901a99a8ac0ddc94471a29fb0de9132ae2ba8f8dc0f4c143acf889afdaa1daf1c57e7bf545a2b4e15ebb8463667f2768a8bc2ebb SHA512 d341790f55c3bff34425369063757280b9ba6ac08f405e14f94f299345ae76c0dc6e90871b746cc98c73467448d888fe5bc029688b5eed5fd22c3c37bf285cd0
DIST yaboot-1.3.14.tar.gz 219089 BLAKE2B e9f71476502dd61e1e277980eab486b35675f809249e27d72627f6469c75c7ea43740898cc8dc58196bb70d08dce52ef334fcd035ac92c66a4f77236a0371049 SHA512 7542073159a15787e27fd8246fe4c84c48cec5cc6fe76be06f4591bb9ca459ad0c81f0085f08d944745a186da005a5ace0d3d0b2598711ca3309fad1c5a00e74
DIST yaboot-1.3.16.tar.gz 220360 BLAKE2B e717b101f14b6178f9fdcd4cf45077c1b9c5db91504f8a000710c02d8b35f6094deb590710c09352fcd18385122a1824b99de5600b176c79da0937fa5b287b0b SHA512 9cd98335c8b32787567253e628549fe88af5ebe4b81fb6b99741fbbcc0ae3b44dc4fdad527ed27da00103bc0482d9a33d3f128f542884387f5aa754546624e14
DIST yaboot-1.3.17.tar.gz 224325 BLAKE2B 41f96266f2342eebbfdc3c0eb64eeaf59e55a31d7388f86839cf9318d231ef808d3aa16fb3b3fdfe85a6fca743e191d064f0ed633723f135a7ca25483e460566 SHA512 da910c4c6ca2de817342bf4dbcefe2857606043e614782581a86bae206cf6cfe5597ad47aea15369feb60e02d8a4f9f4aa3b12863d715c757584c1f4d7ffb9de
85 changes: 85 additions & 0 deletions sys-boot/yaboot/files/e2fsprogs-1.42.13-sysmacros.h.patch
@@ -0,0 +1,85 @@
From 3fb715b55426875902dfef3056b2cf7335953178 Mon Sep 17 00:00:00 2001
From: Mike Frysinger <vapier@gentoo.org>
Date: Fri, 19 May 2017 13:25:59 -0400
Subject: [PATCH] include sys/sysmacros.h as needed

The minor/major/makedev macros are not entirely standard. glibc has had
the definitions in sys/sysmacros.h since the start, and wants to move away
from always defining them implicitly via sys/types.h (as this pollutes the
namespace in violation of POSIX). Other C libraries have already dropped
them. Since the configure script already checks for this header, use that
to pull in the header in files that use these macros.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
---
lib/blkid/devname.c | 3 +++
lib/blkid/devno.c | 3 +++
lib/ext2fs/finddev.c | 3 +++
lib/ext2fs/ismounted.c | 3 +++
misc/mk_hugefiles.c | 3 +++
7 files changed, 22 insertions(+)

--- a/lib/blkid/devname.c
+++ b/lib/blkid/devname.c
@@ -36,6 +36,9 @@
#if HAVE_SYS_MKDEV_H
#include <sys/mkdev.h>
#endif
+#ifdef HAVE_SYS_SYSMACROS_H
+#include <sys/sysmacros.h>
+#endif
#include <time.h>

#include "blkidP.h"
--- a/lib/blkid/devno.c
+++ b/lib/blkid/devno.c
@@ -31,6 +31,9 @@
#if HAVE_SYS_MKDEV_H
#include <sys/mkdev.h>
#endif
+#ifdef HAVE_SYS_SYSMACROS_H
+#include <sys/sysmacros.h>
+#endif

#include "blkidP.h"

--- a/lib/ext2fs/finddev.c
+++ b/lib/ext2fs/finddev.c
@@ -31,6 +31,9 @@
#if HAVE_SYS_MKDEV_H
#include <sys/mkdev.h>
#endif
+#ifdef HAVE_SYS_SYSMACROS_H
+#include <sys/sysmacros.h>
+#endif

#include "ext2_fs.h"
#include "ext2fs.h"
--- a/lib/ext2fs/ismounted.c
+++ b/lib/ext2fs/ismounted.c
@@ -49,6 +49,9 @@
#endif /* HAVE_GETMNTINFO */
#include <string.h>
#include <sys/stat.h>
+#ifdef HAVE_SYS_SYSMACROS_H
+#include <sys/sysmacros.h>
+#endif

#include "ext2_fs.h"
#include "ext2fs.h"
--- a/misc/mk_hugefiles.c
+++ b/misc/mk_hugefiles.c
@@ -35,6 +35,9 @@ extern int optind;
#include <sys/ioctl.h>
#include <sys/types.h>
#include <sys/stat.h>
+#ifdef HAVE_SYS_SYSMACROS_H
+#include <sys/sysmacros.h>
+#endif
#include <libgen.h>
#include <limits.h>
#include <blkid/blkid.h>
--
2.20.1

112 changes: 112 additions & 0 deletions sys-boot/yaboot/yaboot-1.3.17-r3.ebuild
@@ -0,0 +1,112 @@
# Copyright 1999-2019 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=7

inherit flag-o-matic toolchain-funcs

# yaboot is sensitive to external libc dependencies
# of e2fsprogs. Pin to known working versions.
# As a bonus we can control CFLAGS used to build e2fsprogs.
# See compile_bundled_e2fsprogs() below and https://bugs.gentoo.org/641560
E2FS_P="e2fsprogs-1.42.13"

DESCRIPTION="PPC Bootloader"
HOMEPAGE="http://yaboot.ozlabs.org"
SRC_URI="
http://yaboot.ozlabs.org/releases/${P}.tar.gz
mirror://sourceforge/e2fsprogs/${E2FS_P}.tar.gz
"

LICENSE="GPL-2"
SLOT="0"
KEYWORDS="-* ~ppc -ppc64"
IUSE="ibm"

DEPEND="
sys-apps/powerpc-utils
"
RDEPEND="!sys-boot/yaboot-static
!ibm? (
sys-fs/hfsutils
sys-fs/hfsplusutils
sys-fs/mac-fdisk
)"

PATCHES=(
# dual boot patch
"${FILESDIR}/yabootconfig-1.3.13.patch"
"${FILESDIR}/chrpfix.patch"
"${FILESDIR}/${P}-nopiessp-gcc4.patch"
"${FILESDIR}/${PN}-stubfuncs.patch"

# Fix the devspec path on newer kernels
"${FILESDIR}/new-ofpath-devspec.patch"
)

src_prepare() {
# has to be copied before 'new-ofpath-devspec'
cp "${FILESDIR}/new-ofpath" "${S}/ybin/ofpath" || die
default

pushd "${WORKDIR}/${E2FS_P}"
eapply "${FILESDIR}"/e2fsprogs-1.42.13-sysmacros.h.patch
popd

# No need to hardcode this path -- the compiler already knows to use it.
# Error only on real errors, for prom printing format compile failure.
sed -i \
-e 's:-I/usr/include::' \
-e 's:-Werror:-Wno-error:g' \
Makefile || die

# We'll install bundled libext2fs.a here
DEPS_DIR="${T}"/bundled-deps
export DEPS_DIR
}

src_configure() {
pushd "${WORKDIR}/${E2FS_P}" || die
econf \
--enable-libblkid \
--enable-libuuid \
--disable-fsck \
--disable-quota
popd

default
}

src_compile() {
# Note: we use unmodified host's CFLAGS to build depends.
emake -C "${WORKDIR}/${E2FS_P}" V=1
# install-libs to install libext2fs.a for yaboot to statically link against
emake -C "${WORKDIR}/${E2FS_P}" DESTDIR="${DEPS_DIR}" install-libs V=1

unset CFLAGS CXXFLAGS CPPFLAGS LDFLAGS
# -std=gnu90 is needed to preserve 'inline' semantics
# of pre-c99 (always-inline) to avoid duplicate symbol
# definition, bug #641560.
# -L${deps_prefix}/usr/lib is needed to inject known
# working libext2fs.a as yaboot bundles header overrides
# that assume matcking implementation. System's version
# frequently does not work like in bug #641560.
emake \
PREFIX=/usr \
MANDIR=share/man \
CC="$(tc-getCC) -std=gnu90" \
LD="$(tc-getLD) -L${DEPS_DIR}/usr/lib"
}

src_install() {
sed -i -e 's/\/local//' etc/yaboot.conf || die
emake \
ROOT="${D}" \
PREFIX=/usr \
MANDIR=share/man \
CC="$(tc-getCC) -std=gnu90" \
LD="$(tc-getLD) -L${DEPS_DIR}/usr/lib" \
\
install
mv "${ED}"/etc/yaboot.conf{,.sample} || die
}

0 comments on commit 80e699d

Please sign in to comment.