New package: yaboot-1.3.17
This should replace the yaboot-bin package (which should be dropped
assuming this is found to be working well). This, instead of taking
the binary from Debian, compiles yaboot from source.
The tricky part here is e2fsprogs, or rather, libext2fs. Yaboot
requires a fairly old version of it, and being a strictly ppc32
program, needs that library compiled in a minimal form for ppc32.
In order to achieve that, I abuse the cross-compiler, using the
musl ppc32 cross-compiler as that's universally available on all
crosshosts, as well as all ppc64 (and ppc32 doesn't need it).
The main reason to do this over shipping the binary is that this
will actually work properly on some ppc64 machines, which require
the bundled addnote executable, which can now be compiled properly
for the native architecture.
2019-10-24 21:41:02 +00:00
|
|
|
# Template file for 'yaboot'
|
|
|
|
pkgname=yaboot
|
|
|
|
version=1.3.17
|
|
|
|
revision=1
|
2019-10-28 01:06:02 +00:00
|
|
|
archs="ppc64 ppc64-musl ppc ppc-musl"
|
New package: yaboot-1.3.17
This should replace the yaboot-bin package (which should be dropped
assuming this is found to be working well). This, instead of taking
the binary from Debian, compiles yaboot from source.
The tricky part here is e2fsprogs, or rather, libext2fs. Yaboot
requires a fairly old version of it, and being a strictly ppc32
program, needs that library compiled in a minimal form for ppc32.
In order to achieve that, I abuse the cross-compiler, using the
musl ppc32 cross-compiler as that's universally available on all
crosshosts, as well as all ppc64 (and ppc32 doesn't need it).
The main reason to do this over shipping the binary is that this
will actually work properly on some ppc64 machines, which require
the bundled addnote executable, which can now be compiled properly
for the native architecture.
2019-10-24 21:41:02 +00:00
|
|
|
build_style=gnu-makefile
|
|
|
|
hostmakedepends="autoconf automake"
|
|
|
|
depends="powerpc-utils hfsutils"
|
|
|
|
short_desc="Bootloader for PowerMac and IBM CHRP computers"
|
|
|
|
maintainer="q66 <daniel@octaforge.org>"
|
|
|
|
license="GPL-2.0-or-later"
|
|
|
|
homepage="https://wiki.debian.org/YaBoot"
|
|
|
|
_e2fsprogs_ver="1.41.14"
|
|
|
|
distfiles="https://cdimage.debian.org/cdimage/cd-sources/yaboot_${version}.orig.tar.gz
|
|
|
|
http://ftp.be.debian.org/pub/linux/kernel/people/tytso/e2fsprogs/e2fsprogs-${_e2fsprogs_ver}.tar.gz"
|
|
|
|
checksum="2fb738d8fd48b94ab2534a4fdf63738ad02c1a30f4b2add91f837baff8fa2aa1
|
|
|
|
3f8ac1fedd7c4bec480afcbe4acabdd4ac59ec0446a0fd50c8975cd0aad7b176"
|
|
|
|
patch_args="-Np1"
|
|
|
|
# Don't want stripped yaboot bits to leak into -dbg
|
|
|
|
nostrip_files=yaboot
|
|
|
|
|
|
|
|
# This is a safe choice available on all cross-hosts and ppc64 itself
|
|
|
|
# We need to compile yaboot binary itself, as well as e2fsprogs libraries,
|
|
|
|
# using a 32-bit ppc compiler; 64-bit with -m32 won't do because of libgcc etc.
|
|
|
|
case "$XBPS_TARGET_MACHINE" in
|
|
|
|
ppc64*) _need_cross=powerpc-linux-musl ;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
if [ -n "$_need_cross" ]; then
|
|
|
|
hostmakedepends+=" cross-${_need_cross}"
|
|
|
|
fi
|
|
|
|
|
|
|
|
# No testsuite provided
|
|
|
|
do_check() {
|
|
|
|
:
|
|
|
|
}
|
|
|
|
|
|
|
|
post_patch() {
|
|
|
|
# Add support for DESTDIR in order to not leak files
|
|
|
|
sed -i 's/^ROOT =/ROOT = $(DESTDIR)/' Makefile
|
|
|
|
|
|
|
|
# Ensure safe cleanup
|
|
|
|
mv ${XBPS_BUILDDIR}/e2fsprogs-${_e2fsprogs_ver} .
|
|
|
|
}
|
|
|
|
|
|
|
|
# This builds e2fsprogs libraries, needed by yaboot for ext* support
|
|
|
|
# We need to build this using the potential 32-bit cross compiler, with
|
|
|
|
# specific minimal flags, so we can't just makedepend on it...
|
|
|
|
_build_e2fsprogs() {
|
|
|
|
pushd e2fsprogs-${_e2fsprogs_ver}
|
|
|
|
|
|
|
|
if [ ! -f Makefile ]; then
|
|
|
|
# Regenerate autotools
|
|
|
|
autoreconf -isf
|
|
|
|
|
|
|
|
# Explicitly disable things we definitely don't need
|
|
|
|
local _args="--disable-testio-debug --disable-debugfs --disable-tls"
|
|
|
|
local _ecc="$CC" _ear="$AR"
|
|
|
|
if [ -n "$_need_cross" -o -n "$CROSS_BUILD" ]; then
|
|
|
|
# using a crosscompiler, set up configure/compiler for that
|
|
|
|
_args+=" --host=${_need_cross:-$XBPS_CROSS_TRIPLET}"
|
|
|
|
_ecc="${_need_cross:-$XBPS_CROSS_TRIPLET}-gcc"
|
|
|
|
_ear="${_need_cross:-$XBPS_CROSS_TRIPLET}-ar"
|
|
|
|
fi
|
|
|
|
|
|
|
|
# We need to keep flags synchronized with yaboot itself
|
|
|
|
local _ecflags="-Os -fno-stack-protector -no-pie"
|
|
|
|
_ecflags+=" -fgnu89-inline -fno-builtin-malloc -DNDEBUG"
|
|
|
|
|
|
|
|
CFLAGS="$_ecflags" CC="$_ecc" AR="$_ear" ./configure ${_args}
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Avoid building the whole thing, build only the two libs we need
|
|
|
|
cd lib/et
|
|
|
|
make ${makejobs}
|
|
|
|
cd ../ext2fs
|
|
|
|
make ${makejobs}
|
|
|
|
|
|
|
|
cd ..
|
|
|
|
cp libcom_err.a libext2fs.a ${wrksrc}
|
|
|
|
|
|
|
|
popd
|
|
|
|
}
|
|
|
|
|
|
|
|
pre_build() {
|
|
|
|
# Add toolchain prefix when cross-compiling; for userland tools
|
|
|
|
# always, for yaboot itself when cross-compiling to ppc32
|
|
|
|
if [ "$CROSS_BUILD" ]; then
|
|
|
|
sed -i "s/^CROSS =/CROSS = ${XBPS_CROSS_TRIPLET}-/" Makefile
|
|
|
|
fi
|
|
|
|
|
|
|
|
# When using a separate cross-compiler (ppc64 target), override YBCC
|
|
|
|
if [ -n "$_need_cross" ]; then
|
|
|
|
sed -i "s/^YBCC =.*/YBCC = ${_need_cross}-gcc/" Makefile
|
|
|
|
fi
|
|
|
|
|
|
|
|
# These are needed by yaboot core
|
|
|
|
_build_e2fsprogs
|
|
|
|
}
|
|
|
|
|
|
|
|
post_install() {
|
|
|
|
# Yaboot is nostrip_files so do it manually (and ignore -dbg)
|
|
|
|
if [ -n "$_need_cross" ]; then
|
|
|
|
${_need_cross}-strip --remove-section=.comment \
|
|
|
|
${DESTDIR}/usr/lib/yaboot/yaboot
|
|
|
|
else
|
|
|
|
$STRIP --remove-section=.comment ${DESTDIR}/usr/lib/yaboot/yaboot
|
|
|
|
fi
|
|
|
|
}
|